Compare commits

..

427 Commits

Author SHA1 Message Date
Matthias Clasen
47ffaefa25 testrevealer: Cover the new transitions
Add tests for all the swing transitions.
2019-03-29 10:51:00 -04:00
Benjamin Otte
9d0a42dc14 stack: Add a cube spin transition
Add a transition to GtkStack that pretends pages
are the sides or a cube, and switch them by
rotating the cube.

Use this transition in widget-factory.
2019-03-29 10:03:18 -04:00
Anders Jonsson
ec9be21771 Update Swedish translation
(cherry picked from commit 2b768edd43)
2019-03-29 10:51:19 +00:00
Benjamin Otte
1944ffe351 Revert "Bump meson req to 0.50"
This reverts commit f0845d98a2.

The commit breaks CI. CI has more power than meson telling things.
2019-03-29 10:19:41 +01:00
Benjamin Otte
a8dccef507 build: The private reftest library needs to be shared
Otherwise the module and gtk-reftest will each have their own copy and
that'll mean all symbols - and inhibiting the shutdown - will exist
twice. Not good.
2019-03-29 09:56:52 +01:00
Benjamin Otte
90f460c236 reftests: Remove notebook-childproperties test
Notebooks have no child properties anymore.
2019-03-29 09:56:52 +01:00
Benjamin Otte
e5e516468a reftests: Fix textview-tags test
The test was timeouting on X11.

I'm still not sure it does what it should do, but at least that
problem's gone.
2019-03-29 09:56:52 +01:00
Benjamin Otte
b88c9439aa reftests: Fix label-sizing test
Set border, padding and margin to 0, not just padding.
2019-03-29 09:56:52 +01:00
Benjamin Otte
95f9c8a5eb reftests: Remove box-packing test
Boxes have no packing flags anymore.
2019-03-29 09:56:52 +01:00
Benjamin Otte
fbc8bb979d reftests: Fix grid-empty-with-spacing test
Widgets are visible by default now, so make sure the ones that should be
invisible are marked as such.
2019-03-29 09:56:52 +01:00
Benjamin Otte
e861b0d6c1 reftests: Fix grid-spacing2 test
The expand flag needs to be set on widgets when previously it was a
packing property.
2019-03-29 09:56:52 +01:00
Benjamin Otte
7918eaf677 picture: Don't cause warnings on load failures
When a file set via gtk_picture_set_file() can't be loaded, just
silently don't load it.

Reftest picture-load-invalid-file added for that case.
2019-03-29 09:56:52 +01:00
Benjamin Otte
bf2a93ca0e reftests: Fix image-load-from-file test
- Images are always correctly sized
- Use a GtkPicture for the large file
2019-03-29 09:56:52 +01:00
Benjamin Otte
606aea2302 reftests: Fix iconview-empty test
Images have a static size now, use a GtkPicture instead.
2019-03-29 09:56:52 +01:00
Benjamin Otte
b21882bcea cssimagelinear: Make gradient offsets stay in [0, 1]
Fixes linear-gradient reftest
2019-03-29 09:56:52 +01:00
Benjamin Otte
fee8f6b9be reftests: Fix shorthand-entry-border test
We weren't setting CSS back to defaults, so the border highlight
transition would be at different stages when the 2 snapshots happened.
2019-03-29 09:56:52 +01:00
Benjamin Otte
3a8a9fc2bd reftests: Remove style-properties-nth-child test
Style properties don't exist anymore.
2019-03-29 09:56:52 +01:00
Benjamin Otte
866bc13557 reftests: Fix statusbar-remove-all test 2019-03-29 09:56:52 +01:00
Benjamin Otte
d10a73f509 textview: Paint border windows in the right spot
Fixes textview-border-windows reftest
2019-03-29 09:56:52 +01:00
Benjamin Otte
3c44f83909 Fix textview-margins reftest
Draw something, otherwise the test will timeout
2019-03-29 09:56:52 +01:00
Benjamin Otte
38fbb6856c headerbar: Duct-tape over the measure mess
Fixes various reftests.

The headerbar needs soeone to redo sizing.
2019-03-29 09:56:52 +01:00
Benjamin Otte
9ca5495380 reftests: Fix inherit-and-initial test
Run gtk-builder-tool --3to4 over it. As the test cares about the
"initial" and "inherit" CSS keywords, the actual widgets aren't that
important. It's just important to have many of them.
2019-03-29 09:56:52 +01:00
Benjamin Otte
4b07d28153 textlayout: Allow querying empty areas
This only happens when the textview has no content, but it does happen
now that such a textview gets allocated 0x0 and not 1x1.
2019-03-29 09:56:52 +01:00
Benjamin Otte
c04190e761 rendernode: Round pixel colors in color matrix drawing
Fixes symbolic-icon-translucent-color.ui reftest
2019-03-29 09:56:52 +01:00
Benjamin Otte
822791d8a9 reftests: Remove info-bar-message-types test
- The test doesn't properly test infobars. An infobar is not a box.

- Infobar message types aren't styled anymore.
2019-03-29 09:56:52 +01:00
Benjamin Otte
f070872b36 reftests: Fix notebook-tab-position test
The tab-fill child property is gone, don't use it.
2019-03-29 09:56:52 +01:00
Benjamin Otte
f3e47ee92e reftests: Fix icon-style-basics test
Add a type-func to the GThemedIcon and GEmeblemedIcon usages so
GtkBuilder finds them.
2019-03-29 09:56:52 +01:00
Benjamin Otte
e612b55bd4 reftests: Fix css-match-name test
- Replace GtkImage::pixbuf with GtkImage::paintable
- Use a GtkPicture so the sizing is correct
2019-03-29 09:56:52 +01:00
Benjamin Otte
6d38f1dcb5 reftests: Fix css-match-type test
- Replace GtkImage::pixbuf with GtkImage::paintable
- Use a GtkPicture so the sizing is correct
2019-03-29 09:56:52 +01:00
Benjamin Otte
d4df5211f3 reftests: Fix border-image-excess-size.ui test
The old reftests drew an opaque image, the new image is transparent.

This test drew the reference image as black and the test as transparent
black, and those are now different.
2019-03-29 09:56:52 +01:00
Benjamin Otte
2e67c2eb8f reftests: Delete removed tests from testdata 2019-03-29 09:56:52 +01:00
Benjamin Otte
47d4b06eca reftests: Fix css-currentcolor-alpha.ui test
The test did not draw anything, which fails now.
2019-03-29 09:56:52 +01:00
Benjamin Otte
5ddce32e1a reftests: Fix css-match-class test
- Replace GtkImage::pixbuf with GtkImage::paintable
- Use a GtkPicture so the sizing is correct
2019-03-29 09:56:52 +01:00
Benjamin Otte
8846f28369 reftests: Fix background-size-zero test
We were drawing nothing, causing a timeout.
2019-03-29 09:56:52 +01:00
Benjamin Otte
62d0bd7153 reftests: Fix nth-child test
Box children no longer have a "position" child property.
2019-03-29 09:56:52 +01:00
Benjamin Otte
d5175526f9 reftests: Fix treeview-fixed-height test
Convert -gtk-gradient() to linear-gradient in the CSS.
2019-03-29 09:56:52 +01:00
Benjamin Otte
7935f9d3b8 reftests: Actually build a module
Reftests are expecting a module called libreftest.so, so don't build a
static libgtkreftest.a but what they expect.
2019-03-29 09:56:52 +01:00
Benjamin Otte
7cc5e51a92 reftests: Fix actionbar test
Boxes have no pack-type anymore.
2019-03-29 09:56:52 +01:00
Benjamin Otte
8542ac2c42 reftests: Fix window-height-for-width test
The dialog's vbox internal child is now called content_area
2019-03-29 09:56:52 +01:00
Benjamin Otte
b3eddbb45d reftests: Fix grid-spacing1 test 2019-03-29 09:56:52 +01:00
Benjamin Otte
e3dbf8d524 reftests: Fix unresolvable.ui test
- Make sure we draw something
- Don't use -gtk-gradient() but linear-gradient instead
2019-03-29 09:56:52 +01:00
Benjamin Otte
5dd5ff5236 widgetpaintable: Don't emit signals on dispose 2019-03-29 09:56:52 +01:00
Benjamin Otte
d3be32f8ea reftest: Be more careful about snapshotting
Instead of waiting for the first invalidate-contents signal, wait until
we get a render node. This will break spectacularly for reftests not
drawing anything at all, but we just hope that won't happen.
2019-03-29 09:56:52 +01:00
Benjamin Otte
0c81ea2f28 reftests: Make meson run every test separately
This way, we don't get an abort once the first test gets a warning.

We also can use meson test to run individual tests.

Unfortunately, only ~60% of tests pass.
2019-03-29 09:56:52 +01:00
Benjamin Otte
c564a349e5 testsuite: Make reftests work again
Well, the testrunner works again, the tests don't all succeed.

So exclude them from CI.
2019-03-29 09:56:52 +01:00
Benjamin Otte
42d580dc07 reftests: Remove image-recording-surface test
It's no longer possible to set surfaces on a GtkImage, so we don't need
to test that setting a recording surface works.
2019-03-29 09:56:52 +01:00
Chun-wei Fan
4784c5a980 gdk/win32/gdkdrag-win32.c: Include math.h
We need that for round().
2019-03-29 16:50:53 +08:00
Chun-wei Fan
6b08227110 meson.build: Pull in fallback for PangoFT2 only when needed
On some systems PangoFT2 is optional, so we only use the fallback when
it is being required.
2019-03-29 16:50:35 +08:00
Matthias Clasen
6f470affef Merge branch 'adwaita-radii-fixes-master' into 'master'
Adwaita radii fixes master

See merge request GNOME/gtk!628
2019-03-29 00:51:23 +00:00
Matthias Clasen
c30fc92b3e builder-tool: Don't strip the xml declaration
This is useful for interoperability with other tools.
2019-03-28 19:28:05 -04:00
Matthias Clasen
7222bda146 file chooser entry: Fix a crash
The ::focus-out signal signature has changed. Adapt.
2019-03-28 18:55:36 -04:00
Matthias Clasen
eaae9650d9 popover menu: Fix a parameter name mismatch 2019-03-28 18:36:15 -04:00
Matthias Clasen
f20f02c416 overlay: Remove no-longer-existing api from header 2019-03-28 18:36:15 -04:00
Matthias Clasen
94533495aa gtk: Some documentation cleanups 2019-03-28 18:36:15 -04:00
Matthias Clasen
c9e08efcbf gsk: Fix up docs a bit
Some apis that were either removed or have never
existed were listed for the docs.
2019-03-28 18:36:15 -04:00
Matthias Clasen
e0f9c98e44 gsk: Add GskRoundedRect to the docs 2019-03-28 18:36:15 -04:00
Christoph Reiter
80c26ab904 CI: install meson 0.50 2019-03-28 22:47:18 +01:00
Matthias Clasen
f0845d98a2 Bump meson req to 0.50
meson told me to.
2019-03-28 17:35:50 -04:00
Matthias Clasen
121bbcec4b Merge branch 'overlay-layout' into 'master'
overlay: Use a layout manager

See merge request GNOME/gtk!677
2019-03-28 21:07:38 +00:00
Matthias Clasen
700183e5b6 Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-28 16:37:21 -04:00
Matthias Clasen
8d993160c2 builder-tool: Small refactoring
Introduce a PropKind enum, since the collection of
booleans is getting out of hands.
2019-03-28 16:36:59 -04:00
Matthias Clasen
fc3cae34ec builder-tool: Convert overlay child properties 2019-03-28 16:36:59 -04:00
Matthias Clasen
866640c0c2 overlay: Use a layout manager
This lets us get rid of the child properties,
by converting them to layout properties.
2019-03-28 16:36:59 -04:00
Piotr Drąg
0f7ca7e550 Update POTFILES.in 2019-03-28 18:58:56 +01:00
Matthias Clasen
18d1ea19e0 Merge branch 'layout-child-type' into 'master'
Connect LayoutManager to LayoutChild

See merge request GNOME/gtk!678
2019-03-28 17:41:33 +00:00
Emmanuele Bassi
208cae2f05 Do not leak unapplied layout properties
If the layout manager does not have a GtkLayoutChild, or if we cannot
apply layout properties, we should free them instead of leaking them.
2019-03-28 17:22:02 +00:00
Emmanuele Bassi
ecba428d52 Add missing handler for <layout> elements in UI files
The layout properties sub-parser needs to handle the parent tag.
2019-03-28 17:21:56 +00:00
Emmanuele Bassi
3f0f7c73e0 Connect LayoutManager to LayoutChild
If we want to inspect the type of layout properties exposed by a
GtkLayoutManager, we need a way to connect the layout manager type to
the GtkLayoutChild type it creates. In order to do so, we can set the
GtkLayoutChild type on a field of the GtkLayoutManagerClass structure.

Storing the GtkLayoutChild type on the class structure of the layout
manager also allows us to implement a default create_layout_child()
virtual function.
2019-03-28 16:58:00 +00:00
Emmanuele Bassi
3d6a456c85 Add release info to our demo apps
The appstream-util check performed by Flatpak on recent GNOME SDKs has
become more stringent, and now it requires a <release> tag in the
AppData XML file. If we don't have it, the Flatpak bundles of gtk-demo
and gtk-widget-factory will fail on our CI infrastructure.
2019-03-28 12:16:53 +00:00
Emmanuele Bassi
65c394dbaa Document how to define layout manager properties 2019-03-28 11:47:46 +00:00
Matthias Clasen
4d9f4ed14b Merge branch 'gbsneto/install-header' into 'master'
build: Install gtkboxlayout.h

See merge request GNOME/gtk!676
2019-03-28 02:48:03 +00:00
Georges Basile Stavracas Neto
56d420c06e boxlayout: Notify orientation changes
This was missing from the initial implementation, and
breaks the tests.
2019-03-27 23:34:03 -03:00
Matthias Clasen
dec2cf49dd Merge branch 'child-properties' into 'master'
Remove some more child properties

See merge request GNOME/gtk!675
2019-03-28 02:04:42 +00:00
Georges Basile Stavracas Neto
3d524cc67d build: Install gtkboxlayout.h
This is included by gtk.h, and thus required to build.
2019-03-27 22:55:07 -03:00
Matthias Clasen
396deb44fa Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 21:48:12 -04:00
Matthias Clasen
3631878cee builder-tool: Rewrite paned child properties 2019-03-27 21:48:12 -04:00
Matthias Clasen
26de69eaae paned: Replace the child properties
Replace the resize and shrink child properties
by resize-child1/2 and shrink-child1/2 properties.
2019-03-27 21:48:12 -04:00
Matthias Clasen
f89c93ea8e Merge branch 'window-api-cleanup' into 'master'
GtkWindow api cleanup

See merge request GNOME/gtk!674
2019-03-28 00:14:51 +00:00
Matthias Clasen
6b050a277e Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 20:03:59 -04:00
Matthias Clasen
7e88fcf24e builder-tool: Rewrite toolbar child properties 2019-03-27 20:03:34 -04:00
Matthias Clasen
a443145a4d toolbar: Remove the homogeneous and expand child properties
Replace these with GtkToolItem properties homogeneous
and expand-item.
2019-03-27 20:02:48 -04:00
Matthias Clasen
bbb6772934 win32: Drop set_role
One overlooked (non-)implementation of set_role.
2019-03-27 18:48:59 -04:00
Matthias Clasen
3600d129bf win32: Add a missing include
We are using round() now, so include math.h.
2019-03-27 18:47:56 -04:00
Matthias Clasen
14ad26a599 Convert ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 18:40:40 -04:00
Matthias Clasen
8c807303da builder-tool: Rewrite GtkPopoverMenu::submenu 2019-03-27 18:38:29 -04:00
Matthias Clasen
5c2697633c popover menu: Drop the submenu child property
We are using the GtkWidget::name property instead.
2019-03-27 18:37:57 -04:00
Matthias Clasen
4a1019bed0 popover menu: Add an api for adding submenus
This is a step towards removing the submenu
child property.
2019-03-27 17:53:48 -04:00
Matthias Clasen
0d43d11387 gdk: Drop gdk_surface_set_role
This is a very old X session management thing, and you
will be hard-pressed to find a session manager that can
make use of it, and even harder-pressed to find apps
using it to their advantage.
2019-03-27 17:29:17 -04:00
Matthias Clasen
8ef4e231ec gdk: Stop implementing set_role
All but the X implementation of these were
empty anyway. And the X one is just setting
a property.
2019-03-27 17:29:17 -04:00
Matthias Clasen
2f358469af Remove GtkWindow::role
...and the setter/getter for it.

This is a very old X session management thing, and you
will be hard-pressed to find a session manager that can
make use of it, and even harder-pressed to find apps
using it to their advantage.
2019-03-27 17:29:17 -04:00
Matthias Clasen
be944e0a31 file chooser: Stop setting a role
It does nothing.
2019-03-27 17:29:17 -04:00
Matthias Clasen
e5722367b3 Merge branch 'fixed-layout' into 'master'
Add GtkFixedLayout

See merge request GNOME/gtk!668
2019-03-27 18:51:04 +00:00
Alexander Larsson
2440e89a72 Merge branch 'wip/alexl/broadway6' into 'master'
broadway: Use css transforms

See merge request GNOME/gtk!673
2019-03-27 18:45:17 +00:00
Alexander Larsson
9212727f53 broadway: Use css transforms
This allows generic transforms nodes to work.
2019-03-27 19:27:16 +01:00
Matthias Clasen
733271e09a migration guide: Improve warp-pointer entry
Mention platform APIs.
2019-03-27 14:21:26 -04:00
Matthias Clasen
868d3cd609 Merge branch 'pack-type' into 'master'
Drop some more child properties

See merge request GNOME/gtk!672
2019-03-27 18:12:01 +00:00
Matthias Clasen
4a15b16198 Mention pack-type in the migration guide 2019-03-27 13:52:47 -04:00
Matthias Clasen
7ac250dea7 Convert all ui files
Run gtk4-builder-tool simplify --3to4 over all ui files.
2019-03-27 13:36:24 -04:00
Matthias Clasen
c507160bf2 builder-tool: Rewrite pack-type
Replace GtkActionBar::pack-type and GtHeaderBar::pack-type
with child types when going from 3 to 4.
2019-03-27 13:36:24 -04:00
Matthias Clasen
84480b3da8 action bar: Drop pack-type
Drop the pack-type child property. Allow ui
files to direct children by adding a child
type for it.
2019-03-27 13:36:24 -04:00
Matthias Clasen
6c30b474f5 header bar: Drop pack-type
Drop the pack-type child property. Allow ui files
to direct children by adding a child type.
2019-03-27 13:36:24 -04:00
Matthias Clasen
2fd2c61d37 dialog: Stop using GtkHeaderBar::pack-type
We want to get rid of child properties.
2019-03-27 13:36:24 -04:00
Alexander Larsson
411dc7e138 broadway: Fix leftover dom modification not using display_commands 2019-03-27 14:21:28 +01:00
Matthias Clasen
141f758c5c Migration guide: Updates 2019-03-27 02:18:36 -04:00
Matthias Clasen
5fb96392e3 Merge branch 'entry-sizing' into 'master'
Entry sizing

Closes #1721

See merge request GNOME/gtk!670
2019-03-27 05:55:06 +00:00
Matthias Clasen
7843382784 text: Allow growing entries
Add a propagate-text-width property, which, when set,
makes the entry request a natural width that is just
enough to fit the content, within the limits given
by width-chars and max-width-chars.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1721
2019-03-27 01:42:00 -04:00
Matthias Clasen
544fe83864 search entry: Fix sizing
Use the same sizing approach we use for GtkEntry:
ignore icons when measuring. This ensures that
search entries don't change size as icons come
and go.
2019-03-27 01:42:00 -04:00
Matthias Clasen
8a9290d0ba password entry: Fix sizing
Use the same sizing approach we use for GtkEntry:
ignore icons when measuring. This ensures that
password entries don't change size as icons come
and go.
2019-03-27 01:42:00 -04:00
Matthias Clasen
8d4343a550 Merge branch 'get_caret_offset_negative_one' into 'master'
Return -1 for AtkText::get_caret_offset on failure

See merge request GNOME/gtk!666
2019-03-26 23:14:48 +00:00
Matthias Clasen
8984320964 Merge branch 'gdk-api-cleanups' into 'master'
Gdk api cleanups

See merge request GNOME/gtk!669
2019-03-26 22:37:27 +00:00
Matthias Clasen
c0aaa43122 Rename gdk_device_get_surface_at_position_double
We can drop the double suffix now.
2019-03-26 18:12:55 -04:00
Matthias Clasen
5935f26a1d Drop gdk_device_get_surface_at_position
It is no longer used.
2019-03-26 18:12:55 -04:00
Matthias Clasen
562cc8b9ab gtk: Stop using gtk_device_get_surface_at_position
We should always use the double variant of the api.
2019-03-26 18:12:55 -04:00
Matthias Clasen
9021e7d3cd gdk: Stop using gdk_device_get_surface_at_position
We should always use the double variant.
2019-03-26 18:12:55 -04:00
Matthias Clasen
03eb455c93 Rename gdk_device_get_position_double
We can drop the double suffix now.
2019-03-26 18:12:55 -04:00
Matthias Clasen
6288043ec2 Drop gdk_device_get_position
It is no longer used.
2019-03-26 18:12:55 -04:00
Matthias Clasen
7e4707642a gtk: Stop using gdk_device_get_position
We should always use the double variant of this api.
2019-03-26 18:12:55 -04:00
Matthias Clasen
8dece0e940 gdk: Stop using gdk_device_get_position
We should always use the double variant of this api.
2019-03-26 18:12:55 -04:00
Matthias Clasen
21580309d3 Rename gdk_surface_get_device_position_double
Drop the _double suffix, now that the int version is gone.
2019-03-26 18:12:54 -04:00
Matthias Clasen
f1d61d5515 Drop gdk_surface_get_device_position
Not used anymore.
2019-03-26 18:08:39 -04:00
Matthias Clasen
2d10a7b9c4 gtk: Stop using gdk_surface_get_device_position
Use the double version directly.
2019-03-26 18:08:32 -04:00
Matthias Clasen
54a969e0ad gdk: Stop using gdk_surface_get_device_position
Use the double variant instead.
2019-03-26 17:55:29 -04:00
Matthias Clasen
eb4e7b9172 Remove GtkWindow::gravity
This was used to interpret the position passed
to gtk_window_move. Since that is gone, gravity
is no longer useful.
2019-03-26 17:55:29 -04:00
Matthias Clasen
de741e57f3 tests: Stop using gtk_window_set_gravity
This api is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
0481f123ea Drop gtk_window_move and gtk_window_get_position
These functions operate with global coordinates,
which are not available on Wayland.
2019-03-26 17:55:29 -04:00
Matthias Clasen
6f072c80db treeview: Stop using gtk_window_move
It is going away. The search popup needs to be
redone using popovers.
2019-03-26 17:55:29 -04:00
Matthias Clasen
2ed533c3e1 file chooser: Stop using gtk_window_get_position
It is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
27c286773c tests: Stop using gtk_window_move
It is going away.
2019-03-26 17:55:29 -04:00
Matthias Clasen
f7d3815fa8 a11y: Don't support changing widget size and position
This does not make sense.
2019-03-26 17:55:29 -04:00
Matthias Clasen
d45996c728 Avoid root coordinates in begin_drag/move apis
Change the all the begin_drag and begin_move apis in
GdkSurface and GtkWindow to expect surface coordinates.

Update the x11 implementation to translate to root
coordinates where it matters. Wayland is ignoring the
coordinates anyway.
2019-03-26 15:57:11 -04:00
Matthias Clasen
6b6f26ed45 Add a window move/resize test 2019-03-26 15:57:04 -04:00
Emmanuele Bassi
060e30de3f Turn GtkFixedLayoutChild:position into a transformation
This way we can transform children instead of just allocating them at an
offset.
2019-03-26 19:17:26 +00:00
Emmanuele Bassi
fc33bf2d1f Skip all LayoutChild when testing
GtkLayoutChild instances are created on demand once we have a widget, a
GtkLayoutManager, and a child widget. This makes testing their creation
fairly tricky.

Let's skip them, for the time being.
2019-03-26 18:46:55 +00:00
Emmanuele Bassi
dd5c981b63 Use GtkFixedLayout in GtkFixed
Drop the child properties and the sizing code.
2019-03-26 18:15:13 +00:00
Emmanuele Bassi
9a4c19349e Add GtkFixedLayout
A layout manager for fixed positioning.
2019-03-26 17:43:53 +00:00
Emmanuele Bassi
3389ddf6fc Do not connect to a non-existing signal
The GtkWidget::parent-set signal was removed in ff6cd8f7.

Instead of removing GtkLayoutChild instances associated to a widget
using notifications when the widget's parent changes, we can have
gtk_widget_unparent() call a method on GtkLayoutManager to remove any
eventual GtkLayoutChild instances associated to the widget.
2019-03-26 17:37:49 +00:00
Emmanuele Bassi
341660e056 Drop warning from GtkLayoutManager::get_request_mode()
We can return a sensible default value, so we don't really need to warn
about a missing implementation.
2019-03-26 17:37:49 +00:00
Piotr Drąg
b42bf99b13 Update POTFILES.in 2019-03-26 18:36:51 +01:00
Alexander Larsson
18d814d2ce Merge branch 'wip/alexl/broadway5' into 'master'
Update broadway for gtk4

See merge request GNOME/gtk!667
2019-03-26 16:25:10 +00:00
Alexander Larsson
6fce18e1a1 broadway: Remove some spew 2019-03-26 17:09:41 +01:00
Alexander Larsson
cf4226586a broadway: Load all textures before applying display ops, fixing flickers 2019-03-26 17:07:47 +01:00
Alexander Larsson
0481aa10e7 broadway: Use const use for constants in the js code 2019-03-26 17:07:47 +01:00
Alexander Larsson
edbaa0964f broadway: Clean up stuff using const defines 2019-03-26 17:07:47 +01:00
Alexander Larsson
fbefec52a5 Broadway: Add id for nodes and reuse old ones
When sending render nodes from the client to the daemon we add an id,
and whenever we're about to re-send the entire tree node we instead
send the old id. We track all the nodes for the previous frame
of the surface this way.

Having the id on the daemon side will allow us do to much better deltas.
2019-03-26 17:07:47 +01:00
Alexander Larsson
d59d8b5dd4 Disable accidental debug spew 2019-03-26 17:07:47 +01:00
Alexander Larsson
87a13fe3d2 broadway: Prepare for splitting display ops out of command handling 2019-03-26 17:07:47 +01:00
Alexander Larsson
2f85443e37 broadway: Refcount textures
We want to delay some rendering, and to make that safe we need to correctly
refcount the use of blob uris for the textures so that we don't unref
it while something is scheduled to use it.
2019-03-26 17:07:47 +01:00
Alexander Larsson
311aa01e01 broadway: Simplify fallback node cache
Since nodes are now cached we just store the fallback as a
texture in a hashtable indexed by the node. If its unused for
5 frames we drop it.
2019-03-26 17:07:47 +01:00
Alexander Larsson
3bbbe9f71b broadway: Don't crash of drag-resizing when already active
This is what the X11 code does.
2019-03-26 17:07:47 +01:00
Alexander Larsson
890b759091 broadway: Send actual float32, not some hack 2019-03-26 17:07:47 +01:00
Alexander Larsson
d997903d29 broadway: Use DataView instead of hand-rolled int parsers
This is nicer in general, but also will let us do floats more sanely.
2019-03-26 17:07:47 +01:00
Alexander Larsson
b097f0a7d8 Broadway: Add node for debug nodes
This can be helpful when debugging broadway.
2019-03-26 17:07:47 +01:00
Alexander Larsson
1b5b1bfd0e broadway: Don't fall back for translation transform nodes
These are trivial anyway
2019-03-26 17:07:47 +01:00
Christoph Reiter
c94867f8a1 CI: set a timeout multiplier for the tests
CI can be slower than your normal dev machine so give it a bit more time
2019-03-26 16:37:22 +01:00
Martin Robinson
c8d250deb1 Return -1 for AtkText::get_caret_offset on failure
ATK now expects this virtual method to return -1 on failure. This allows
ATs to distinguish between a caret at position 0 and a failure.
2019-03-26 15:38:20 +01:00
Matthias Clasen
dbac377ad2 Merge branch 'wip/layout-manager' into 'master'
Add Layout Managers

See merge request GNOME/gtk!534
2019-03-26 12:38:18 +00:00
Christoph Reiter
0638dca29a win32: remove another call to gdk_device_warp()
Inline the implementation (untested). To fix the build.
2019-03-26 08:20:07 +01:00
Christoph Reiter
ae68dc7a7d win32: remove unused gdk_display_warp_device
to fix the build
2019-03-26 07:59:01 +01:00
Matthias Clasen
20b4a8b38c Yet another win32 build fix
So much empty warping.
2019-03-25 23:29:34 -04:00
Emmanuele Bassi
65965bed16 Changes after review
- Rename GtkLegacyLayout to GtkCustomLayout
 - Use for() to iterate over children in GtkBinLayout
 - Whitespace fixes for code imported from GtkBox
 - Store the GtkLayoutChild instances inside LayoutManager
 - Simplify the GtkLayoutManager API by dropping unnecessary arguments
 - Fix the ownership model of GtkLayoutManager
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
630442f31c Parse layout properties
If a widget has a LayoutManager instance, then we want to parse layout
properties in UI description files; the grammar is similar to packing
properties in GtkContainer:

    <child>
      <object ...>
        <property name="...">...</property>
        <layout>
          <property name="pname">value</property>
        </layout>
      </object>
    </child>

The properties are applied after a child has been added to its parent,
to the parent's layout manager property should be set.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
d6dfa41f10 Add GtkBinLayout
Like GtkBin, but lets you lay out multiple children instead of just one.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
8cf06befc0 Port GtkSwitch to GtkLegacyLayout 2019-03-26 00:11:27 +00:00
Emmanuele Bassi
128a34fe37 Add GtkLegacyLayout
GtkLegacyLayout is a layout manager for the transitional period between
the introduction of layout managers and the removal of GtkWidget virtual
functions for the size negotiation.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
0285919f4a docs: Add chapter on layout managers 2019-03-26 00:11:27 +00:00
Emmanuele Bassi
1fed357752 Port GtkBox to GtkBoxLayout
We can delegate all the layout management to a GtkBoxLayout, now that we
have one.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
ef9863ab63 Add GtkBoxLayout
The same layout policy of GtkBox, without all the GtkContainer calories.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
5cbf6f5fbd Add GtkLayoutChild
Layout managers needs a way to store properties that control the layout
policy of a widget; typically, we used to store these in GtkContainer's
child properties, but since GtkLayoutManager is decoupled from the
actual container widget, we need a separate storage. Additionally, child
properties have their own downsides, like requiring a separate, global
GParamSpecPool storage, and additional lookup API.

GtkLayoutChild is a simple GObject class, which means you can introspect
and document it as you would any other type.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
15fda18791 Rename the internal GtkLayoutChild type
The type is completely private to GtkLayout, so there's really no need
to namespace it.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
f7856e887e Add GtkWidget:layout-manager
We can use a constructor property for existing container widgets with
a layout policy, and move the layout policy implementation out of the
widget itself and into a LayoutManager subclass.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
1b8595b5f2 Hook GtkLayoutManager into GtkWidget
We delegate the size request mode, the measuring, and the allocation of
a widget through a GtkLayoutManager instance, if one has been attached
to the widget; otherwise, we fall back to the widget's own implementation.
2019-03-26 00:11:27 +00:00
Emmanuele Bassi
24754c3259 Add GtkLayoutManager
A base abstract class for layout manager delegate objects.

Layout managers are associated to a single widget, like event
controllers, and are responsible for measuring and allocating the
children of the widget they are bound to.
2019-03-26 00:11:27 +00:00
Matthias Clasen
4dfe2a8aa8 Fix the windows build
There was another warp implementation that needed to be removed.
This commit also addresses a number of compiler warnings
in passing.
2019-03-25 20:06:08 -04:00
Timm Bäder
ab7507150b Doc comment fixup 2019-03-25 15:57:31 +01:00
Timm Bäder
e657d9d553 popover: Always measure contents gizmo
Otherwise we're getting warnings about allocating a widget we haven't
measured first, which is fair. The contents gizmo itself will later take
care about whether or not the real popover child is NULL.
2019-03-25 15:57:31 +01:00
Timm Bäder
36e00ae95e popover: Don't try to compute_bounds of a NULL child 2019-03-25 15:57:30 +01:00
Matthias Clasen
f2dff5115f win32: Drop the warp implementation
We no longer support pointer warping.
2019-03-25 10:16:14 -04:00
Piotr Drąg
a246f8c22a Update Polish translation 2019-03-25 14:37:44 +01:00
Piotr Drąg
6efa1fc006 Update POTFILES.in 2019-03-25 14:19:54 +01:00
Matthias Clasen
3d37f08f38 Remove gdk_device_warp
This was only ever implemented on X11, and is
not something we want to encourage apps to do, ever.
2019-03-24 20:49:08 -04:00
Matthias Clasen
160f1e581a Remove a dead file
We are not using this anymore.
2019-03-24 20:48:35 -04:00
Matthias Clasen
661e195ffc color editor: Don't warn if editing is cancelled
Thats a valid way to end color picking.
2019-03-24 20:47:26 -04:00
Benjamin Otte
551ced9ae4 Fix compile warning 2019-03-23 03:08:20 +01:00
Benjamin Otte
799cb39e08 Remove win32 themeing support
It was unused through all of GTK 3, so it is not worth supporting.

The best Windows themes do not make use of it at all.
2019-03-22 22:30:01 +01:00
LRN
0615668dd9 Merge branch 'ime-load-fix' into 'master'
Ime load fix (GTK4)

See merge request GNOME/gtk!662
2019-03-22 21:10:35 +00:00
Matthias Clasen
1ada7bbc02 Fix hover state handling
We were not paying enough attention to detail when updating
hover and focus state while generating crossing events. The
invariant that we need to preserve here is that when a widget
has focus or hover, its parent does too.
2019-03-22 16:35:20 -04:00
Matthias Clasen
81658105f7 Stop walking parent surfaces for crossing event generation
We basically don't have child surfaces anymore (the last
use in popovers is on the way out). This really needs
to be done in terms of widgets, not surfaces. For now,
just stop walking parent surfaces.
2019-03-22 16:35:20 -04:00
Benjamin Otte
d9ef734458 cssparser: Simplify
Remove the uint parser (and use the int parser in the one user of it).

And avoid unnecessarily going through a macro.
2019-03-22 19:55:34 +01:00
Benjamin Otte
73760e5835 cssparser: Remove unused functions 2019-03-22 19:55:34 +01:00
Matthias Clasen
5638882dca Remove debug spew 2019-03-22 14:44:51 -04:00
Руслан Ижбулатов
8da56cef79 GDK W32: Fix property setting to correctly use static strings
The strings that are set are static, so g_value_set_static_string() should
be used to set them instead of g_value_set_string().
2019-03-22 16:59:03 +00:00
Руслан Ижбулатов
64ab82c403 GDK W32: Test for IME correctly
ImmIsIME() doesn't work (always returns TRUE) since Vista.
Use ITfActiveLanguageProfileNotifySink to detect TSF changes,
which are equal to IME changes for us.

Also make sure that IMMultiContext re-loads the IM when keyboard layout
changes, otherwise there's a subtle bug that could happen:
* Run GTK application with non-IME layout (US, for example)
* Focus on an editable widget (GtkEntry, for example)
* IM Context is initialized to use the simple IM
* Switch to an IME layout (such as Korean)
* Start typing
* Since IME module is not loaded yet, keypresses are handled
  by a default MS IME handler
* Once IME commits a character, GDK will get a WM_KEYDOWN,
  which will trigger a GdkKeyEvent, which will be handled by
  an event filter in IM Context, which will finally re-evaluate
  its status and load IME, and only after that GTK will get
  to handle IME by itself - but by that point input would
  already be broken.
To avoid this we can emit a dummy event (with Void keyval),
which will cause IM Context to load the appropriate module
immediately.
2019-03-22 16:58:59 +00:00
Matthias Clasen
56df49971a entry: Disconnect text signals in dispose
This was showing up as crashes when closing
the file chooser.
2019-03-21 19:15:55 -04:00
Matthias Clasen
0bf136a902 Merge branch 'adwaita-remove-selectionmode-assets-master' into 'master'
Adwaita: Drop checkbox-selectionmode assets

See merge request GNOME/gtk!634
2019-03-20 14:10:18 +00:00
Matthias Clasen
2479d60012 Merge branch 'adwaita-selectionmode-checkboxes-master' into 'master'
Adwaita: Fix selection-mode checkboxes

Closes #28

See merge request GNOME/gtk!629
2019-03-20 14:10:05 +00:00
Matthias Clasen
6990f73940 Merge branch 'adwaita-headerbar-switch-margins-master' into 'master'
Adwaita: Adjust switch margins on headerbars

Closes #1759

See merge request GNOME/gtk!651
2019-03-20 14:06:19 +00:00
Matthias Clasen
254c27acbe Merge branch 'wip/jimmac/focus-ring-radii' into 'master'
Adwaita: draw bigger radius for focus rings

Closes #1756

See merge request GNOME/gtk!649
2019-03-20 12:32:15 +00:00
Matthias Clasen
558405e1bc window: Update state flags
When the window gets active / inactive, we
don't propagate events, but just send focus-in / -out
to the current focus_widget. Improve this by updating
its state flags as well.
2019-03-19 21:33:38 -04:00
Matthias Clasen
f47c376fb1 main: Fix crossing event generation for parented roots
We were walking the parent chain here, which now
always needs to consider whether it should stop
at roots. Like this one should.

The symptom was that a label with a popup attached to
it would end up with an unintentional focus ring that
would not go away.
2019-03-19 21:33:38 -04:00
Alex Monday
5679b9a687 Adwaita: Adjust switch margins on headerbars
Closes https://gitlab.gnome.org/GNOME/gtk/issues/1759
2019-03-19 19:59:05 +05:00
Jakub Steiner
24235f61ab Adwaita: draw bigger radius for focus rings
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1756
2019-03-19 14:07:10 +01:00
Benjamin Otte
a44ac75e65 gtk: Don't include gtkstylecontext.h from gtkcsstypesprivate.h
And make sure it's included everywhere it's needed.
2019-03-19 08:53:25 +01:00
Benjamin Otte
85c8e29d78 stylecontext: Move atk.h include where it belongs 2019-03-19 08:49:15 +01:00
Benjamin Otte
8fb797866d paned: hide the handle widget when <2 children are visible 2019-03-19 08:48:50 +01:00
Benjamin Otte
96a677e5ca paned: Refactor
Don't call a useless function, call gtk_widget_set_child_visible()
directly.
2019-03-19 08:48:41 +01:00
Benjamin Otte
07054ca20d singleselection: Add forgotten notify emission
Also, add docs for the model property while I'm looking at the file.
2019-03-19 08:48:22 +01:00
Benjamin Otte
8f6a48832d revealer: Always use identity transform for revealed child
Refactor the child allocation machinery, so that the complex allocation
paths are only run when the animation is running.

And in particular, ensure that when no animation is running, the
identity transform is allocated.
2019-03-19 08:48:06 +01:00
Benjamin Otte
658588dfe7 renderer: Make gsk_renderer_is_realized() public
... and add a property for it.
2019-03-19 08:47:54 +01:00
Benjamin Otte
480d8aec06 renderer: Remove display property
Renderers don't need a display until they get realized. And once they
get realized, they can look up the display from the surface.
2019-03-19 08:47:54 +01:00
Matthias Clasen
0d91481587 One forgotten leave signal handler 2019-03-18 15:35:07 -04:00
Matthias Clasen
8650980797 Adapt to motion controller api change
The signature of the enter/leave signals changed.
Adapt all users.
2019-03-18 09:24:42 -04:00
Matthias Clasen
2b0d1bca43 motion controller: Install the properties
Oops
2019-03-18 08:44:35 -04:00
Matthias Clasen
f7e328e5f7 Merge branch 'paned-no-grab' into 'master'
paned: Don't use a grab

See merge request GNOME/gtk!644
2019-03-18 11:50:42 +00:00
Matthias Clasen
b40743121b Merge branch 'crossing-details' into 'master'
motion controller: add details to signals

See merge request GNOME/gtk!621
2019-03-18 01:49:45 +00:00
Matthias Clasen
93c1353c69 Merge branch 'wip/carlosg/include-constructors-header' into 'master'
gdk: Include copy of glib/gconstructor.h

See merge request GNOME/gtk!642
2019-03-18 01:10:06 +00:00
Matthias Clasen
1196380f28 paned: Don't use a grab
It does not seem necessary for proper functioning
of the drag handle.
2019-03-17 18:55:00 -04:00
Matthias Clasen
26f99bf20c editable: Fix a thinko
When dealing with subclasses of GtkEntry, we were not
getting the property offset that is stored on the GtkEntry
type.

This was showing up as criticals when trying to set
::width-chars on a GtkFileChooserEntry.
2019-03-17 18:46:18 -04:00
Carlos Garnacho
65d9b7ee86 gdk: Include copy of glib/gconstructor.h
This is named gdkconstructor.h to avoid any possible conflicts. This fixes
the current usages of G_HAS_CONSTRUCTORS, as that header is not installed
by glib.
2019-03-17 21:29:59 +01:00
Piotr Drąg
688f0997f4 Update POTFILES.in 2019-03-17 17:17:02 +01:00
Matthias Clasen
430ea05aea widget: Fix a mission annotation 2019-03-17 01:11:22 -04:00
Matthias Clasen
17f4211e4f motion controller: Add getters for crossing event targets
This information can be needed in signal handlers,
so make it available.
2019-03-16 23:52:58 -04:00
Matthias Clasen
ecd6446d08 motion controller: Add focus properties
Add boolean properties, is-pointer-focus and
contains-pointer-focus, that track whether the pointer
is in the widget itself or in one of its descendants.
2019-03-16 23:32:31 -04:00
Matthias Clasen
1540797237 motion controller: add details to signals
The ::enter and ::leave signals get emitted up and down the
connecting path between the old an the new pointer location.

The signals are less useful if you can't find out where along
the path you are. That is what crossing mode and detail are
about, so add those to the signals.
2019-03-16 23:03:41 -04:00
Matthias Clasen
898728fb2d a11y tests: Clean up the placeholder-text test
This was relying on setting has-focus for initial focus.
2019-03-16 22:46:34 -04:00
Matthias Clasen
fc2b412c0c Merge branch 'wip/matthiasc/focus3' into 'master'
Move focus to GtkRoot

See merge request GNOME/gtk!640
2019-03-17 02:42:46 +00:00
Matthias Clasen
1ce5327058 xim: Stop using GtkWidget::event
It does not exist anymore. I'm removing this code now
because our CI tests are using xim and fail due to this.

Eventually, this code should be ported to use a popover.
2019-03-16 22:16:10 -04:00
Matthias Clasen
ad3773b2e1 a11y tests: Update expected results
The changes here are all related to initial focus.
2019-03-16 21:49:24 -04:00
Matthias Clasen
8619b109cc Update the focus test
Check that we get the expected sequences of focus
change events for the nonlinear, inferior and ancestor
cases.

It would be nice to do the same checks for crossing
events, but we have no gtk_window_set_hover().
2019-03-16 21:31:56 -04:00
Matthias Clasen
6ddb61119a Use root in gdk_synthesize_crossing_events 2019-03-16 21:30:48 -04:00
Matthias Clasen
492a38c229 Make gtk_widget_get_focus_child public
It doesn't really make sense to have only
the setter, but not the getter public.
2019-03-16 21:24:45 -04:00
Matthias Clasen
181a4bce25 Add key controller API to the docs
A bunch of API was missing here.
2019-03-16 21:24:45 -04:00
Matthias Clasen
93905a8513 key controller: Enforce limitations of key forwarding
We now set current_event for focus-change as well,
so make sure to check the event type.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4f06b669c5 key controller: Improve the docs
Mention the limitations of the key forwarding api.
2019-03-16 21:24:45 -04:00
Matthias Clasen
f3ed3e99c3 key controller: Add getters for focus event targets
This information can be needed in signal handlers,
so make it available.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4f5a8207bc key controller: Add focus properties
Add boolean properties, is-focus and contains-focus, that
track whether the focus is in the widget itself or in
one of its descendants.
2019-03-16 21:24:45 -04:00
Matthias Clasen
2f1194c0c1 key controller: Fix a copy/paste error
Prefix the finalize function properly.
2019-03-16 21:24:45 -04:00
Matthias Clasen
921eccb459 Pass mode and detail to focus-in/out signals
This information is useful when maintaining a
'last focus' field.

Update all users.
2019-03-16 21:24:45 -04:00
Matthias Clasen
888b92674f Move maintaining the focus chain
Put this code in the same place where we generate
the crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
7d354b5084 Some fixes to crossing event generation
In the inferior and ancestor cases, we were missing
the initial/final event.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4238a04c7b window: Use gtk_synthesize_crossing_events
Emit focus change events in the same way as crossing events.
Also change the code to only emit focus change events for
the master keyboard - we only maintain a single focus location,
so sending multiple focus change events for different devices
seems confusing.
2019-03-16 21:24:45 -04:00
Matthias Clasen
adb547a147 Export gtk_synthesize_crossing_events internally
We want to use this for focus changes, now that
it can emit focus change events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
cdcd2bb073 Share crossing and focus change event code
Make a single function that can emit both
enter/leave and focus change events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
06f790d663 gdk: Add a related_target field to some events
Crossing and focus change events are emitted between
two widgets, and want to associate both with the
events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
c73972f7df gdk: Rename gdk_event_set_user_data
Lets call it what it is, the target.
All of this is private api anyway.

Update all callers.
2019-03-16 21:24:45 -04:00
Matthias Clasen
8d5f1ae662 gdk: Add crossing mode and detail to focus events
We want focus events more similar to crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
a3abf0693d Clarify grab_focus docs 2019-03-16 21:24:45 -04:00
Matthias Clasen
7ca24f12d7 window: Remove initial-focus builder support
With focus-widget now a property, this is no longer needed.
2019-03-16 21:24:45 -04:00
Matthias Clasen
f68855341e window: Remove ::set-focus
The focus-widget is now a property, so we don't need
this signal anymore.
2019-03-16 21:24:45 -04:00
Matthias Clasen
31d9ecb5c3 popover: Stop using ::set-focus
This will change completely when GtkPopover becomes a
root. For now, stop using ::set-focus and just use the
focus-widget property.
2019-03-16 21:24:44 -04:00
Matthias Clasen
f13e6179e8 filechooser: Stop using ::set-focus
We can achieve the same with the focus-widget property.
2019-03-16 21:24:44 -04:00
Matthias Clasen
d279c666a9 inspector: Stop using ::set-focus
The focus-widget is just a regular property now that shows
up on the property page. No need to special-case it on
the misc page anymore.
2019-03-16 21:24:44 -04:00
Matthias Clasen
7819a5aab9 Drop gtk_widget_send_focus_change
Replace this with gtk_widget_set_has_focus + gtk_widget_event.
2019-03-16 21:24:44 -04:00
Matthias Clasen
15300f839e widget: Add a private setter for has-focus 2019-03-16 21:24:44 -04:00
Matthias Clasen
94b0e99be5 Exclude non-drawable widgets from focus
This was showing up as confusion between palette
and editor in the color chooser.
2019-03-16 21:24:44 -04:00
Matthias Clasen
8c1d852a84 widget: Drop the ::focus signal
The focus vfunc is an implementation detail
of GTK focus handling, and having external
signal handlers interfere with it is not
a good idea.
2019-03-16 21:24:44 -04:00
Matthias Clasen
2738926dcb Simplify the move_focus api
No need to pass the array in from the outside.
2019-03-16 21:24:44 -04:00
Matthias Clasen
029ec38e63 Move a check to gtk_window_set_focus
gtk_widget_grab_focus is just a wrapper for
gtk_window_set_focus. We should do all the enforcement
there.
2019-03-16 21:24:44 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Matthias Clasen
bd44831987 window: Implement the root focus api
This just uses the existing get/set_focus functions.
We keep them public for now.
2019-03-16 21:24:44 -04:00
Matthias Clasen
ab5d3e756b root: Add focus
Add a getter and a setter for the focus widget.
The default implementations do nothing.
2019-03-16 21:24:44 -04:00
Matthias Clasen
92f1bdcf45 Redo focus handling
GtkWindow has a focus_widget that points to the current input focus.
GtkWidget has a focus_child that points to the child that contains
the input focus. Following the focus_child chain from the toplevel
always leads to the focus_widget. We never unset focus_child, we only
set it. We bubble focus change events.
2019-03-16 21:24:44 -04:00
Matthias Clasen
64b9114d98 password entry: Fix property notification
Both placeholder-text and activates-default were not
up to our usual standards for property notification,
and the tests complained.
2019-03-16 21:23:28 -04:00
Matthias Clasen
a1cc809c60 search entry: Fix property notification
Both placeholder-text and activates-default were not
up to our usual standards for property notification,
and the tests complained.
2019-03-16 21:23:28 -04:00
Matthias Clasen
7c19ab66ee single selection: Skip tests properly
Do runtime checks for the GLib version,
instead of compiling out tests.
This avoids compiler warnings.
2019-03-16 21:23:28 -04:00
Matthias Clasen
7ca528b896 widget: Check rootness for invisibility
Make the function that determines initial visibility
look at whether the class implements GtkRoot. That is
the eventual goal for this check. For now, allow
popovers in here as well.
2019-03-16 21:23:28 -04:00
Jordi Mas
2870f4dbfe Update Catalan translation 2019-03-16 22:06:43 +01:00
Matthias Clasen
f14d998c95 password entry: Don't show both icons
It can be a bit confusing to have an indicator
and an action next to each other, and with the
peek icon, the need for the Caps Lock warning is
reduced, since you can just reveal the text to
see that it is capitalized.

Therefore, only show the Caps Lock warning if
the peek icon is disabled.
2019-03-15 14:35:25 -04:00
Matthias Clasen
34e859a5bc Add a tagged entry demo
This can serve as an example for how composite entries
can now be done outside of GTK, easily.
2019-03-15 13:21:26 -04:00
Matthias Clasen
5822a35087 gtk-demo: Show password peek icon 2019-03-14 20:43:15 -04:00
Matthias Clasen
a3b73a416e password entry: Add a way to see the content
Add a ::show-peek-icon property and show a clickable
icon when it is set. Clicking it toggles the visibility
of the content. The same functionality is also accessible
via a context menu item.

This is a common feature of password entries.
2019-03-14 20:31:45 -04:00
Matthias Clasen
d3cecd65a5 password entry: Make the Caps Lock icon less prominent
Set a style class, and theme the Caps Lock icon to
be  less promient, so it does not appear clickable.
2019-03-14 20:03:34 -04:00
Matthias Clasen
470720e11a password entry: Use text cursor for Caps Lock indicator
We don't want it to appear clickable, but we still
need to keep it pickable for the tooltip to work,
so explicitly give it the same cursor that we use
for the text.
2019-03-14 19:17:39 -04:00
Matthias Clasen
c3f43cf1f2 entry: Make progress bar not pickable
There is no need for that, we don't want to
handle input here at all.
2019-03-14 19:15:31 -04:00
Matthias Clasen
5251253fc0 password entry: a better Caps Lock icon
This is more in line with how Caps Lock
is typically indicated.
2019-03-14 19:00:37 -04:00
Matthias Clasen
f5e112fd2d gtk-demo: Add a password entry demo 2019-03-14 18:55:51 -04:00
Matthias Clasen
56ee1f3566 password entry: Add placeholder-text and activates-default
Add ::placeholder-text and ::activates-default properties.
Password entries are going to be used in dialogs, where
these two properties are useful.
2019-03-14 18:42:07 -04:00
Matthias Clasen
4afad781fe password entry: Initialize capslock state
The icon was erroneously showing up before the first
focus-in event.
2019-03-14 17:58:10 -04:00
Matthias Clasen
8e4c441f78 a11y: More entry fixes
Remove the GtkEntry assumption from more places.
2019-03-14 17:58:02 -04:00
Alex Monday
d07cd892e7 Adwaita: Drop checkbox-selectionmode assets 2019-03-13 14:12:45 +05:00
Matej Urbančič
44198cc779 Updated Slovenian translation 2019-03-12 20:25:31 +01:00
Alex Monday
4bba279085 Adwaita: Fix selection-mode checkboxes
Use object-select-symbolic as a check icon, adjust styles.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/28
2019-03-12 22:05:08 +05:00
Alex Monday
36539a22d7 Adwaita: Adjust entry border-radius
Replace entry border-radius value with $button_radius variable.
2019-03-12 20:42:48 +05:00
Alex Monday
ad96220448 Adwaita: Replace spinbutton border-radii with variables
Replace hardcoded border-radius values with $button_radius
variable on spinbuttons.
2019-03-12 20:34:38 +05:00
Alex Monday
73139d524b Adwaita: Replace all %linked radii with variables
Some of hardcoded border-radius values on linked elements were left
unchanged during Adwaita refresh.
2019-03-12 20:32:14 +05:00
Nathan Follens
f454a31caa Update Dutch translation 2019-03-10 13:02:39 +00:00
Benjamin Otte
3863e44360 text: Simplify
The previous arguments were equivalent to using NULL.
2019-03-08 14:12:17 +01:00
Benjamin Otte
8566218485 text: Remove two unused member variables 2019-03-08 14:12:04 +01:00
Benjamin Otte
1475575799 text: Use gtk_widget_set_overflow() 2019-03-08 13:39:52 +01:00
Benjamin Otte
bc901ffa5a text: Remove 2 unused variables
One is always 0, the other is always equal to gtk_widget_get_width()
2019-03-08 13:33:54 +01:00
Benjamin Otte
b114d45c5f colorswatch: Use gtk_widget_set_overflow() 2019-03-08 13:20:17 +01:00
Benjamin Otte
9a1c698070 widget: Make overflow respect rounded corners
Fixes !574
2019-03-08 13:20:17 +01:00
Bastien Nocera
884088f649 gsk: API docs fixes
gsk/gskenums.h:181: Error: Gsk: multiple "@GSK_TRANSFORM_CATEGORY_2D" parameters for identifier "GskTransformCategory":
 * @GSK_TRANSFORM_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent
    ^
gsk/gsktransform.c:1342: Warning: Gsk: gsk_transform_to_2d: unknown parameter 'm' in documentation comment, should be 'self'
gsk/gsktransform.c:1368: Warning: Gsk: gsk_transform_to_2d: invalid return annotation
gsk/gsktransform.c:1461: Warning: Gsk: gsk_transform_to_translate: unknown parameter 'm' in documentation comment, should be 'self'
2019-03-07 16:29:28 +01:00
Benjamin Otte
ad5c5d477e revealer: Add swing transitions
And make the revealer on page 2 of the widget-factory use one.
2019-03-07 15:06:12 +01:00
Piotr Drąg
1513bf4174 Update Polish translation 2019-03-07 11:56:27 +01:00
Matthias Clasen
eacbeb9efd x11: Don't emit GDK_NOTHING events
They are good for nothing.
2019-03-06 23:42:36 -05:00
Benjamin Otte
18da852e15 rendernode: Add can_diff implementation for transform nodes
That one was missing and killing performance in the fishbowl.
2019-03-06 12:40:58 +01:00
Timm Bäder
39fbf13fcb entry: Update CSS node docs
Remove all the nodes that are subnodes of GtkText nowadays and refer to
the GtkText docs instead.
2019-03-06 09:03:17 +01:00
Timm Bäder
9105de9170 gl renderer: Cache rendered fallback nodes 2019-03-06 06:31:25 +01:00
Timm Bäder
eeed55d45c gl renderer: Mark pointer textures as used
Otherwise we remove them, causing additional texture uploads.
2019-03-06 06:31:25 +01:00
Benjamin Otte
3a3b325f8e transform: Add perspective()
This commit adds gsk_transform_perspective(), gtk_snapshot_perspective()
and support for perspective() in the CSS syntax.
2019-03-05 20:46:00 +01:00
Benjamin Otte
dbe58452d7 rendernode: Implement diffing of transform nodes
This reinstates diffing in the same way that it worked for offset nodes.

It would be possible to add diffing for affine transforms or even all
transforms, but I think this is unnecessary right now - and also quite
expensive to compute.
2019-03-04 23:41:51 +01:00
Benjamin Otte
a8bf5eee0f transform: Readd optimization
This is the optimization from bbd4e2f60d
2019-03-04 23:41:51 +01:00
Benjamin Otte
bd113aa85c transform: Redo querying API
Make the API expect a tranform of the proper category instead of
doing the check ourselves and returning TRUE/FALSE.

The benefit is that the mai use case is switch (transform->category)
statements and in those we know the category and don't need to check
TRUE/FALSE.

Using the wrong matrix will now cause a g_warning().
2019-03-04 23:41:51 +01:00
Benjamin Otte
1fecbd4241 transform: Store the category in the transform
... instead of computing it every time we need it.

This should be faster and we want to use it a lot more prominently.

Also, we have the struct memory available anyway.
2019-03-04 23:41:51 +01:00
Benjamin Otte
3545abc7a1 transform: Implement gsk_transform_invert()
And use it.

And test it.
2019-03-04 23:41:51 +01:00
Benjamin Otte
70b341139b transform: Remove gsk_transform_identity()
This used to be a good idea back when GskTransform was intended to be
used for transitions, but without it, it's not anymore.
2019-03-04 23:41:51 +01:00
Benjamin Otte
b391aea2b3 widget: Make transform a GskTransform
This concludes pushing transforms down into GskTransform.

What's remaining is potentially pushing it further into the renderers.
2019-03-04 23:41:51 +01:00
Benjamin Otte
979e9bec27 testsuite: Add a transforms test
In particular, check that to_matrix() and to_2d(), to_affine() and
to_translate() return the same values.

This also requires a recent Graphene version or the tests will fail.
2019-03-04 23:41:27 +01:00
Benjamin Otte
e737b42113 trasnform: Fix print statement
We were printing the wrong variable.
2019-03-04 23:15:24 +01:00
Benjamin Otte
cf00c36c85 transform: Split rotate() and rotate3d() class
This is mainly for accuracy: We can guarantee the math we do for 2D
rotations results in a 2D matrix.
2019-03-04 23:15:24 +01:00
Benjamin Otte
3cc84d2860 transform: Make category public API
Also rename it from GskMatrixCategory to GskTransformCategory.
2019-03-04 23:15:24 +01:00
Benjamin Otte
791bf0c2eb transform: Remove API to poke internals
It is not interesting to users of GskTransform how it is made up
internally. Users should just use the gsk_transform_to_*() APIs.
2019-03-04 23:15:24 +01:00
Benjamin Otte
3a3c2d14ab rendernode: Make the transform node take a GskTransform
This is an attempt to push GskTransform deeper into the stack.
2019-03-04 23:15:07 +01:00
Benjamin Otte
4916280883 transform: Add more API
In particular, add a per-category querying API for the matrix:
- gsk_transform_to_translate()
- gsk_transform_to_affine()
- gsk_transform_to_2d()
- gsk_transform_to_matrix()

This way, code can use the relevant one for the given category.
2019-03-04 23:15:06 +01:00
Benjamin Otte
0e1a50366a transform: Move to GSK
The renaming of the prefix makes this a large patch.
2019-03-04 23:09:02 +01:00
Matthias Clasen
20f7588a84 Merge branch 'adwaita-typo-fix-master' into 'master'
Adwaita: Fix typo (missing comma)

Closes #1713

See merge request GNOME/gtk!618
2019-03-04 17:36:10 +00:00
Christoph Reiter
348912dff4 treeview: make sure separator nodes have a height > 0
In case the theme doesn't set a height/min-height for the treeview
separator the treeview drawing gets confused and draws rows on top of each
other depending on the redraw area.

This is due to gtk_tree_view_get_row_height() assuming that a node with a
height <= 0 is not set and not a separator and it will default to the
expander size.

Ideally gtk_tree_view_get_row_height() would know if it operates on a separator,
but there are too many calls/levels, so just make sure the separator height
is at least 1 (Adwaita already sets "min-height: 2px", so no change there)

Cherry-picked from !614 to master
2019-03-04 17:07:13 +01:00
Alex Monday
610692d07b Adwaita: Fix typo (missing comma)
Closes https://gitlab.gnome.org/GNOME/gtk/issues/1713


(cherry picked from commit 0b61d6f6ae)
2019-03-04 15:58:15 +00:00
Emmanuele Bassi
45ea288ba2 Merge branch 'notebook-notify-page-not-child' into 'master'
notebook: Notify the notebook page, not the child

See merge request GNOME/gtk!616
2019-03-04 11:35:18 +00:00
Matthias Clasen
b79545e83c search entry: Fix a copy-paste error 2019-03-03 22:56:02 -05:00
Matthias Clasen
02318dbda7 entries: Fix mnemonic activation
Since entries are no longer can-focus, the default
mnemonic_activate handler refuses to act on them.
2019-03-03 22:25:52 -05:00
Peter Bloomfield
afbfccb89e notebook: Notify the notebook page, not the child
Call g_object_notify() on the GtkNotebookPage, not the child GtkWidget.
Fixes some issues in !594.
2019-03-03 18:21:10 -05:00
Benjamin Otte
bed4c68041 widget: Fix gtk_widget_pick() on 3d-transformed widgets
Picking is done by drawing a line along the parent's z axis and picking
at the intersection with the child's z=0 plane.

However, the previous code was casting a ray along the child's z axis.

This patch actually transforms the line to pick into the target's
coordinate system and then computes the corrrect intersection with the
z=0 plane.

Using graphene_point3d_interpolate() to compute the final intersection
point is a bit of abuse of that function, but I found no better way in
Graphene to achieve the same thing.
2019-03-03 19:50:59 +01:00
Matthias Clasen
8ceff21497 gtk-demo: Minimally fix the sarch entry demo
This was broken by the entry refactoring.
2019-03-03 12:43:00 -05:00
Matej Urbančič
4fe67310fb Updated Slovenian translation 2019-03-02 20:57:57 +01:00
Timm Bäder
f35b8a7541 Fix compile time warnings 2019-03-02 05:28:55 +01:00
Timm Bäder
9948ca7be2 a11y: Include gtktextaccesible.h in gtk-a11y.h
Closes #1710
2019-03-02 05:26:26 +01:00
Emmanuele Bassi
eaf41cc90c Merge branch 'redundant-editable-api' into 'master'
entry, spin button: Drop redundant API

See merge request GNOME/gtk!611
2019-03-01 12:23:26 +00:00
Matthias Clasen
9e0c471b03 entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
2019-02-28 16:34:00 -05:00
Timm Bäder
dc282991c6 roundedrect: Add gsk_rounded_rect_to_string
Keep it private for now, but it's very useful when debugging.
2019-02-28 10:33:18 +01:00
Timm Bäder
7931ab5f33 gl renderer: Change shadow cache eviction strategy
Since we can do partial redraws, dropping every shadow that's been
unused for one frame happens too fast. This is also a problem when a
shadow gets drawn on a texture for a few frames.
2019-02-28 10:33:18 +01:00
Timm Bäder
416a4cf5ea gl renderer: Ignore nodes with nan bounds
This can happen for certain transform nodes. The transform node's
child's bounds are fine, but the transform node bounds are all nan.
Just ignore those bounds since we can't meaningfully render them anyway.
2019-02-28 07:22:34 +01:00
Timm Bäder
bbd4e2f60d transformnode: Avoid matrix multiplication if we can
If the given matrix is explicitly of category IDENTITY, we don't need to
do anything, and in the 2D_TRANSLATE case, just offset the child bounds.
Those are the two most common cases.
2019-02-28 07:22:34 +01:00
Timm Bäder
5577e30ad4 gl renderer: Add more nodes that support transforms 2019-02-28 07:22:34 +01:00
Matthias Clasen
5caf8ca76b entry: Don't use the buffer directly
We want to be a wrapper of the GtkText, which in turn
wraps the GtkEntryBuffer. Not some weird mix.
2019-02-28 00:36:44 -05:00
Matthias Clasen
fda4546de5 treeview: Stop using set_focus_child
Do this with an event controller on the buttons instead.
2019-02-28 00:36:44 -05:00
Nirbheek Chauhan
fe7dcf6eec Merge branch 'alatiera/python3' into 'master'
build: Use python3 for the post install script

See merge request GNOME/gtk!608
2019-02-27 14:46:22 +00:00
Jordan Petridis
539e3d387b build: use condense the mkdir calls to oneliners 2019-02-27 16:25:58 +02:00
Jordan Petridis
efbb26b8cb build: no need to replace path separators
Python APIs accept both `\` and `/` as path separators.
2019-02-27 16:25:58 +02:00
Jordan Petridis
69251d051a build: Use python3 for the post install script
While *some* systems alias python to python3 nowdays, this is
not true for eveything. Especially systems that can potentially
offer both python2 and python3.

According to both PEP 394 and PEP 441 its recommended to always
add the 3 in the shebang.
2019-02-27 16:25:58 +02:00
Jakub Steiner
d930c4a4d1 Adwaita: define insensitive links
- tone down the disabled/insensitive links.

Fixes issue #1645
2019-02-27 12:12:57 +01:00
Benjamin Otte
f36e41600a xembed: Remove unused file 2019-02-27 08:56:41 +01:00
Benjamin Otte
78d013f8d3 window: Return no item for no item name 2019-02-27 08:53:33 +01:00
Matthias Clasen
b4ae491b45 window: Undo the deprection of gtk_window_present
After considerable discussion, we came to the conclusion
that the convenience of this API wins over the correctness
of gtk_window_present_with_time(), in particular since we
don't have a good mechanism to carry timestamps from the
events to the places where we present windows.
2019-02-26 14:11:16 -05:00
Matthias Clasen
1469d01e2e testsuite: Stop using grab-focus as a keybinding signal
We don't have that signal anymore.
2019-02-26 08:16:48 -05:00
Matthias Clasen
b0083b33bb widget: Remove the ::grab-focus signal
Nobody is connecting to this signal. And nobody
should.
2019-02-26 08:02:31 -05:00
Matthias Clasen
c5c75f338e container: Remove the ::set-focus-child signal
Nobody is connecting to this signal. And its
better that way.
2019-02-26 08:02:25 -05:00
Matthias Clasen
572266429f Merge branch 'wip/hadess/window-present-docs' into 'master'
gtk_window_present() docs

See merge request GNOME/gtk!609
2019-02-25 18:17:46 +00:00
Bastien Nocera
91ad2eef5c surface: Advise using gtk_window_present_with_time()
Rather than gtk_window_present()
2019-02-25 17:38:08 +01:00
Bastien Nocera
14890fad47 window: Warn when gtk_window_present_with_time() is passed 0
When 0 or GDK_CURRENT_TIME is passed to gtk_window_present_with_time(),
print a warning so that the application developer knows that this isn't
a supported use of the function, but carry on working for now.
2019-02-25 17:38:08 +01:00
Bastien Nocera
5a6a7b50af all: Don't warn about deprecated gtk_window_present usage
Avoid compilation warnings about internal users of gtk_window_present().
2019-02-25 17:38:08 +01:00
Bastien Nocera
8438880906 window: Deprecate gtk_window_present()
And expect gtk_window_present_with_time() to be used instead.
2019-02-25 17:38:08 +01:00
Bastien Nocera
df6494d73a Add 4.0 deprecation warning macros
Note that functions deprecated in 4.0 will cause deprecation warnings
even with the pre-4.0 GTK development versions.
2019-02-25 17:38:08 +01:00
Matthias Clasen
9335cde8e8 entry: Make placeholder-text work again 2019-02-25 09:21:56 -05:00
Timm Bäder
e836c575ce gl renderer: Remove GskRoundedRect initializaion 2019-02-25 08:46:27 +01:00
Timm Bäder
47fb1ec4c4 gl renderer: Partially implement rounded rect intersection
Some rounded rect intersections can actually be done and even expressed
as a single rounded rectangle.
2019-02-25 08:46:27 +01:00
Timm Bäder
f0624266dc gl renderer: Add debug function to dump render node 2019-02-25 08:46:27 +01:00
Timm Bäder
74ab3cdf75 compare-render: Assert that no error has been set
Much better error message than just the one from the node != NULL
assertion in the next line.
2019-02-25 08:37:06 +01:00
Timm Bäder
58c2bea959 gl renderer: Stop determining the matrix category ourselves
Use the category we get from transform nodes and add ops_ API to supply
one when we set a graphene_matrix_t directly.
2019-02-25 08:37:06 +01:00
Matthias Clasen
d3c45cb979 docs: Miscellaneous doc fixes
Additions and correction all over the place,
in GDK and GTK docs.
2019-02-24 16:53:12 -05:00
Matthias Clasen
df27cb7240 docs: Remove some no-longer-existing api 2019-02-24 13:56:09 -05:00
Matthias Clasen
397b8ee9d5 docs: Its just GTK now
Another round of + removal.
2019-02-24 13:33:36 -05:00
Piotr Drąg
6687a0892a Update POTFILES.in 2019-02-24 16:59:47 +01:00
Matthias Clasen
77c0e68b57 gdk: Rename our vulkan context to GTK
Not sure it shows up anywhere, but just for completeness.
2019-02-24 10:53:23 -05:00
Matthias Clasen
fd667bb203 docs: Its just GTK now
Remove the + from GTK+ in more places in the GDK docs.
2019-02-24 10:51:21 -05:00
Matthias Clasen
d773bc0689 docs: Its just GTK now
Remove the + from GTK+ in the GDK docs.
2019-02-24 10:49:01 -05:00
Matthias Clasen
eddc823378 gitlab templates: Its just GTK now
More plus purging.
2019-02-24 10:44:15 -05:00
Matthias Clasen
eb1310effe docs: Remove a mention of Gtkinvisible 2019-02-24 10:40:17 -05:00
Matthias Clasen
8a0182e401 docs: Some cosmetic fixups
Some leftover comments from the drawing model rewrite.
2019-02-24 10:37:33 -05:00
Matthias Clasen
edc4f954c6 Revert "inspector: Make picking work again"
This reverts commit 5dbfb18d11.

Inspector picking no longer requries this.
2019-02-24 09:46:46 -05:00
Matthias Clasen
c35554cf68 Drop GtkInvisible
It was already private, and the previous commit removed
the last use.
2019-02-24 09:41:13 -05:00
Matthias Clasen
9861887f1a inspector: Avoid grabs for inspecting
Instead of using a grab on a GtkInvisible, use
a hook in the GTK event propagation machinery to
get events.

The only downside of this approach is that we
lose the crosshair cursor. But we get rid of
the last use of GtkInvisible.
2019-02-24 09:41:13 -05:00
Matthias Clasen
3ae31b0e79 notebook: Document new apis
This silences gi build warnings.
2019-02-23 23:26:59 -05:00
Matthias Clasen
06df7e6f2c transform: Fix a wrong annotation
It is (out caller-allocates), not (out) (caller-allocates).
2019-02-23 23:21:32 -05:00
Matthias Clasen
0d39cb7379 Merge branch 'kill-register-surface' into 'master'
Remove gdk_surface_set_user_data

See merge request GNOME/gtk!605
2019-02-24 03:46:04 +00:00
Matthias Clasen
cc216c9e84 Remove gdk_surface_set_user_data
Change gdk_surface_get/set_user_data to private
API and rename them to get/set_widget.
Also remove an unused associated function.

The last two places where the surface API is used
are in gtkroot.c and gtkwidget.c. Make them
use the private api.
2019-02-23 22:24:50 -05:00
Matthias Clasen
09fea73a40 gtk-demo: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
704e377fae inspector: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
12663d2844 tooltip: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
4e8aa0c37a main: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
ea4f552d50 xim: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
2501152842 ime: Stop using gdk_surface_get_user_data
Use gtk_root_get_for_surface instead.
2019-02-23 22:24:50 -05:00
Matthias Clasen
a13d8501d4 Add gtk_root_get_for_surface
This is a replacement for gdk_surface_get_user_data.
2019-02-23 22:24:50 -05:00
Matthias Clasen
69b1a348c6 a11y tests: Update output for entries 2019-02-23 22:24:50 -05:00
Matthias Clasen
b82e57fec6 fixup: warn about nothing events 2019-02-23 21:25:10 -05:00
Matthias Clasen
5dbfb18d11 inspector: Make picking work again
This was broken by the change in 01f7f255b5 which
caused the inspector to not get any events anymore.
Revert that part, even though it may be technically
correct.
2019-02-23 18:23:42 -05:00
Matthias Clasen
b6893b6d9f Quietly ignore GDK_NOTHING events
These don't have a surface, so we can't deliver
them via the ::event signal. But then, they're
good for nothing anyway.
2019-02-23 17:09:25 -05:00
Matthias Clasen
4001e7645b docs: Refresh the "Q & A" part
Remove references to long-gone API, add some pointers
to more modern alternatives, etc.
2019-02-23 16:08:05 -05:00
Matthias Clasen
ac8b192eab gdk: Document surface signals
At least a little bit.
2019-02-23 16:08:05 -05:00
Matthias Clasen
fad9468e77 Merge branch 'drawing-model-refresh' into 'master'
doc: Rewrite the drawing model overview

See merge request GNOME/gtk!603
2019-02-23 21:05:35 +00:00
Matthias Clasen
222d310370 doc: Rewrite the drawing model overview
This is a first cut at updating the drawing model chapter
for the way we do things now. It introduces the scene graph and
render nodes, explains node caching and tree diffing, and removes
sections about subwindows.
2019-02-23 15:24:07 -05:00
Benjamin Otte
fe95391184 Merge branch 'event-signal' into 'master'
Drop gdk_event_handler_set

See merge request GNOME/gtk!604
2019-02-23 19:33:51 +00:00
Matthias Clasen
e16cdb141c Drop gdk_event_handler_set
This is no longer used by GTK.
2019-02-23 14:13:57 -05:00
Matthias Clasen
08badd23cd Drop some dead code
There were some internal uses of GdkEventFunc. Thankfully,
they were unused, so lets just drop them.
2019-02-23 14:13:57 -05:00
Matthias Clasen
cc2c39209c Stop using gdk_event_handler_set
We no longer need it.
2019-02-23 14:13:57 -05:00
Matthias Clasen
d633beaccd widget: Connect to GdkSurface::event
This lets us handle input events the same way
we do expose events.
2019-02-23 14:13:57 -05:00
Matthias Clasen
23fb77af43 surface: Introduce an ::event signal
This will eventually replace the event handler
as the method to get events over the gdk/gtk
boundary.
2019-02-23 13:45:10 -05:00
Matthias Clasen
ccbaec0231 Merge branch 'kill-hierarchy-changed' into 'master'
Kill hierarchy changed

See merge request GNOME/gtk!601
2019-02-23 16:01:16 +00:00
Matthias Clasen
89470ab201 Document that root and unroot must chain up
I overlooked this at first.
2019-02-23 09:43:57 -05:00
Matthias Clasen
a3901f2563 Drop the anchored field
We can just change priv->root instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
5dd0863bd7 widget: Drop ::hierarchy-changed
It is no longer used and has been replaced by the
root and unroot vfuncs.
2019-02-23 09:43:57 -05:00
Matthias Clasen
8d93321461 gtk-demo: Stop using ::hierarchy-changed
We can use root and unroot instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
3ccbcf9f55 menu bar: Stop using ::hierarchy-changed
Use the root and unroot vfuncs instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
ef5108c89f label: Stop using ::hierarchy-changed
Use the new root and unroot vfuncs instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
0230a7b1e5 header bar: Stop using ::hierarchy-changed
Use the root and unroot vfuncs instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
55337c588c file chooser: Stop using ::hierarchy-changed
Use the root and unroot vfuncs instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
9e231f6333 popover: Stop using ::hierarchy-changed
Use notify::root instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
3ebf19b783 text handle: Stop using ::hierarchy-changed
Use notify::root instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
9591d40742 xim: Stop using ::hierarchy-changed
Use notify::root instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
de6132a158 ime: Stop using ::hierarchy-changed
We don't need it at all here.
2019-02-23 09:43:57 -05:00
Matthias Clasen
ddb52a5b5e drag dest: Stop using ::hierarchy-changed
Use notify::root instead.
2019-02-23 09:43:57 -05:00
Matthias Clasen
47249431e3 inspector: Stop using ::hierarchy-changed
Use the new root and unroot vfuncs instead.
2019-02-23 09:43:57 -05:00
Timm Bäder
f9041230c6 gl renderer: Round size up when rendering to a texture
Both the clip we use and the viewport we set should contain the entire
texture size and not potentially clip the last pixel.
2019-02-23 04:50:25 +01:00
Timm Bäder
e54ce8f328 treeview: Don't assume search widget is a GtkEntry
Maybe it's a GtkText!
2019-02-23 04:42:01 +01:00
Chun-wei Fan
8d987be673 Merge branch 'wip/fanc999/meson.msvc' into 'master'
GTK+ 4: Improve Windows/Visual Studio build experience

See merge request GNOME/gtk!185
2019-02-23 02:13:35 +00:00
Matthias Clasen
445dca42f5 widget: Remove ::event leftovers
The signal is long gone, no need for this unused
vfunc anymore.
2019-02-22 20:06:06 -05:00
Matthias Clasen
c53e9ed6aa search/password entry: Prevent expand leaks
We don't want the entry to expand, we just want
the text to expand inside the box, so explicitly
unset expand flags on the box.
2019-02-22 15:55:05 -05:00
Matthias Clasen
2b9436b279 search entry: Use a GtkEntryAccessible
This preserves the status quo of a11y support
for entry variations.
2019-02-22 15:50:45 -05:00
Matthias Clasen
bd99ae3767 entry accessible: Make work with almost-entries
This is not perfect, but gives a quick way to have
an accessible that can be used for password and
search entries.
2019-02-22 15:49:47 -05:00
Matthias Clasen
0e603a6646 search entry: Don't force-create the accessible
We can just set the accessible name when the
accessible is actually needed.
2019-02-22 14:12:52 -05:00
Timm Bäder
9d0e8b85c1 inspector: Fix an uninitialized value warning 2019-02-22 19:22:58 +01:00
Timm Bäder
da0bd697b8 gl renderer: Use the matrix node category 2019-02-22 19:08:43 +01:00
Milo Casagrande
3471aac4ef Update Italian translation 2019-02-22 11:05:55 +00:00
Milo Casagrande
593774133f Update Italian translation 2019-02-22 11:05:21 +00:00
Chun-wei Fan
3fa28ffd92 build: Make post-install script a Python script
The existing post-install shell script will most likely not work on
Visual Studio builds as there is normally no shell interpreter installed
on the system where the build is done, but the build is normally done in
a standard Windows cmd.exe console.

Instead, use a Python script so that it will work on the platforms that
Python supports.
2018-12-06 17:07:33 +08:00
Chun-wei Fan
5383d11bb4 modules/media/meson.build: Export needed symbols on MSVC
We need to override _GLIB_EXTERN to export the required symbols for the
GIO module on Visual Studio, so that the media modules can be
successfully loaded.
2018-12-06 17:07:33 +08:00
Chun-wei Fan
ed65ab1ba9 meson: Build .rc files for Windows
Build the .rc files for Windows so that one can track the version info
more easily for Windows, as well as giving GTK+ apps a default icon.

Also, move back the manifest embedding for the themed Windows print
dialog back into gtk-win32.rc.body.in, so that we just have one way of
embedding this manifest file, making things easier for ourselves, as
this is supported in the later Visual Studio compilers as well, which is
2013 and later.
2018-12-06 17:07:33 +08:00
546 changed files with 31732 additions and 40538 deletions

View File

@@ -13,7 +13,7 @@ stages:
- subprojects/pango/
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/master:v2
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
stage: build
script:
- bash -x ./.gitlab-ci/test-docker.sh
@@ -64,7 +64,7 @@ flatpak:widget-factory:
<<: *flatpak-defaults
pages:
image: registry.gitlab.gnome.org/gnome/gtk/master:v2
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
stage: deploy
script:
- meson -Ddocumentation=true _build .

View File

@@ -70,7 +70,7 @@ RUN dnf -y install \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson==0.49.0
RUN pip3 install meson==0.50.0
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}

View File

@@ -2,7 +2,7 @@
set -e
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v2"
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v3"
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .

View File

@@ -26,7 +26,9 @@ ccache --show-stats
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test \
--timeout-multiplier 2 \
--print-errorlogs \
--suite=gtk \
--no-suite=gtk:gsk \
--no-suite=gtk:reftest \
--no-suite=gtk:a11y

View File

@@ -23,7 +23,7 @@
## Version information
<!--
- Which version of GTK+ you are using
- Which version of GTK you are using
- What operating system and version
- For Linux, which distribution
- If you built GTK+ yourself, the list of options used to configure the build

View File

@@ -13,7 +13,7 @@
## Version information
<!--
- Which version of GTK+ you are using
- Which version of GTK you are using
- What operating system and version
- for Linux, which distribution
- If you built GTK+ yourself, the list of options used to configure the build

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python3
import os
import sys
import subprocess
if 'DESTDIR' not in os.environ:
gtk_api_version = sys.argv[1]
gtk_abi_version = sys.argv[2]
gtk_libdir = sys.argv[3]
gtk_datadir = sys.argv[4]
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...')
subprocess.call(['glib-compile-schemas',
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
subprocess.call(['gtk-update-icon-cache', '-q', '-t' ,'-f',
os.path.join(gtk_datadir, 'icons', 'hicolor')])
print('Updating module cache for print backends...')
os.makedirs(gtk_printmodule_dir, exist_ok=True)
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])

View File

@@ -1,26 +0,0 @@
#!/bin/sh
gtk_api_version=$1
gtk_abi_version=$2
gtk_libdir=$3
gtk_datadir=$4
# Package managers set this so we don't need to run
if [ -z "$DESTDIR" ]; then
echo Compiling GSettings schemas...
glib-compile-schemas ${gtk_datadir}/glib-2.0/schemas
echo Updating desktop database...
update-desktop-database -q ${gtk_datadir}/applications
echo Updating icon cache...
gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
echo Updating module cache for print backends...
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
echo Updating module cache for input methods...
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/immodules
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/immodules
fi

View File

@@ -80,7 +80,7 @@ on_entry_changed (GtkWidget *widget, gpointer data)
page_number = gtk_assistant_get_current_page (assistant);
current_page = gtk_assistant_get_nth_page (assistant, page_number);
text = gtk_entry_get_text (GTK_ENTRY (widget));
text = gtk_editable_get_text (GTK_EDITABLE (widget));
if (text && *text)
gtk_assistant_set_page_complete (assistant, current_page, TRUE);

View File

@@ -71,20 +71,12 @@ find_toplevel_at_pointer (GdkDisplay *display)
GdkSurface *pointer_window;
GtkWidget *widget = NULL;
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (),
NULL, NULL);
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
/* The user data field of a GdkSurface is used to store a pointer
* to the widget that created it.
*/
if (pointer_window)
{
gpointer widget_ptr;
gdk_surface_get_user_data (pointer_window, &widget_ptr);
widget = widget_ptr;
}
widget = GTK_WIDGET (gtk_root_get_for_surface (pointer_window));
return widget ? gtk_widget_get_toplevel (widget) : NULL;
return widget;
}
static void

View File

@@ -28,7 +28,7 @@ copy_button_clicked (GtkWidget *button,
clipboard = gtk_widget_get_clipboard (entry);
/* Set clipboard text */
gdk_clipboard_set_text (clipboard, gtk_entry_get_text (GTK_ENTRY (entry)));
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
}
void
@@ -50,7 +50,7 @@ paste_received (GObject *source_object,
if (text)
{
/* Set the entry text */
gtk_entry_set_text (GTK_ENTRY (entry), text);
gtk_editable_set_text (GTK_EDITABLE (entry), text);
g_free (text);
}
else

View File

@@ -256,7 +256,7 @@ mask_entry_set_background (MaskEntry *entry)
{
if (entry->mask)
{
if (!g_regex_match_simple (entry->mask, gtk_entry_get_text (GTK_ENTRY (entry)), 0, 0))
if (!g_regex_match_simple (entry->mask, gtk_editable_get_text (GTK_EDITABLE (entry)), 0, 0))
{
PangoAttrList *attrs;

View File

@@ -189,6 +189,7 @@
<file>paintable_animated.c</file>
<file>paintable_mediastream.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>pickers.c</file>
<file>pixbufs.c</file>
<file>popover.c</file>
@@ -206,6 +207,7 @@
<file>spinbutton.c</file>
<file>spinner.c</file>
<file>tabs.c</file>
<file>tagged_entry.c</file>
<file>textview.c</file>
<file>textscroll.c</file>
<file>theming_style_classes.c</file>
@@ -217,6 +219,9 @@
<gresource prefix="/textview">
<file>floppybuddy.gif</file>
</gresource>
<gresource prefix="/tagged_entry">
<file>tagstyle.css</file>
</gresource>
<gresource prefix="/listbox">
<file>listbox.ui</file>
<file>messages.txt</file>
@@ -261,6 +266,10 @@
<gresource prefix="/dnd">
<file>dnd.css</file>
</gresource>
<gresource prefix="/tagged_entry">
<file>demotaggedentry.c</file>
<file>demotaggedentry.h</file>
</gresource>
<gresource prefix="/org/gtk/Demo">
<file>icons/16x16/actions/application-exit.png</file>
<file>icons/16x16/actions/document-new.png</file>

View File

@@ -0,0 +1,493 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2019 Red Hat, Inc.
*
* Authors:
* - Matthias Clasen <mclasen@redhat.com>
*
* 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 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/>.
*/
#include "config.h"
#include "demotaggedentry.h"
#include <gtk/gtk.h>
#include <gtk/gtk-a11y.h>
typedef struct {
GtkWidget *box;
GtkWidget *entry;
} DemoTaggedEntryPrivate;
static void demo_tagged_entry_editable_init (GtkEditableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (DemoTaggedEntry)
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, demo_tagged_entry_editable_init))
static void
demo_tagged_entry_init (DemoTaggedEntry *entry)
{
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
gtk_widget_set_has_surface (GTK_WIDGET (entry), FALSE);
priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (priv->box, GTK_WIDGET (entry));
priv->entry = gtk_text_new ();
gtk_widget_set_hexpand (priv->entry, TRUE);
gtk_widget_set_vexpand (priv->entry, TRUE);
gtk_widget_set_hexpand (priv->box, FALSE);
gtk_widget_set_vexpand (priv->box, FALSE);
gtk_container_add (GTK_CONTAINER (priv->box), priv->entry);
gtk_editable_init_delegate (GTK_EDITABLE (entry));
}
static void
demo_tagged_entry_dispose (GObject *object)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object);
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
if (priv->entry)
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
g_clear_pointer (&priv->entry, gtk_widget_unparent);
g_clear_pointer (&priv->box, gtk_widget_unparent);
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object);
}
static void
demo_tagged_entry_finalize (GObject *object)
{
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->finalize (object);
}
static void
demo_tagged_entry_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
return;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
static void
demo_tagged_entry_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
if (gtk_editable_delegate_get_property (object, prop_id, value, pspec))
return;
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
static void
demo_tagged_entry_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
gtk_widget_measure (priv->box, orientation, for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
demo_tagged_entry_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
gtk_widget_size_allocate (priv->box,
&(GtkAllocation) { 0, 0, width, height },
baseline);
}
static void
demo_tagged_entry_grab_focus (GtkWidget *widget)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
gtk_widget_grab_focus (priv->entry);
}
static void
demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->dispose = demo_tagged_entry_dispose;
object_class->finalize = demo_tagged_entry_finalize;
object_class->get_property = demo_tagged_entry_get_property;
object_class->set_property = demo_tagged_entry_set_property;
widget_class->measure = demo_tagged_entry_measure;
widget_class->size_allocate = demo_tagged_entry_size_allocate;
widget_class->grab_focus = demo_tagged_entry_grab_focus;
gtk_editable_install_properties (object_class, 1);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, "entry");
}
static GtkEditable *
demo_tagged_entry_get_delegate (GtkEditable *editable)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (editable);
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
return GTK_EDITABLE (priv->entry);
}
static void
demo_tagged_entry_editable_init (GtkEditableInterface *iface)
{
iface->get_delegate = demo_tagged_entry_get_delegate;
}
GtkWidget *
demo_tagged_entry_new (void)
{
return GTK_WIDGET (g_object_new (DEMO_TYPE_TAGGED_ENTRY, NULL));
}
void
demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
GtkWidget *tag)
{
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_container_add (GTK_CONTAINER (priv->box), tag);
}
void
demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
GtkWidget *tag,
GtkWidget *sibling)
{
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
if (sibling == NULL)
gtk_container_add (GTK_CONTAINER (priv->box), tag);
else
gtk_box_insert_child_after (GTK_BOX (priv->box), tag, sibling);
}
void
demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
GtkWidget *tag)
{
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
gtk_container_remove (GTK_CONTAINER (priv->box), tag);
}
struct _DemoTaggedEntryTag
{
GtkWidget parent;
GtkWidget *box;
GtkWidget *label;
GtkWidget *button;
gboolean has_close_button;
char *style;
};
struct _DemoTaggedEntryTagClass
{
GtkWidgetClass parent_class;
};
enum {
PROP_0,
PROP_LABEL,
PROP_HAS_CLOSE_BUTTON,
};
enum {
SIGNAL_CLICKED,
SIGNAL_BUTTON_CLICKED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (DemoTaggedEntryTag, demo_tagged_entry_tag, GTK_TYPE_WIDGET)
static void
on_released (GtkGestureMultiPress *gesture,
int n_press,
double x,
double y,
DemoTaggedEntryTag *tag)
{
g_signal_emit (tag, signals[SIGNAL_CLICKED], 0);
}
static void
demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
{
GtkGesture *gesture;
GtkCssProvider *provider;
gtk_widget_set_has_surface (GTK_WIDGET (tag), FALSE);
tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_parent (tag->box, GTK_WIDGET (tag));
tag->label = gtk_label_new ("");
gtk_container_add (GTK_CONTAINER (tag->box), tag->label);
gesture = gtk_gesture_multi_press_new ();
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
}
static void
demo_tagged_entry_tag_dispose (GObject *object)
{
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
g_clear_pointer (&tag->box, gtk_widget_unparent);
G_OBJECT_CLASS (demo_tagged_entry_tag_parent_class)->dispose (object);
}
static void
demo_tagged_entry_tag_finalize (GObject *object)
{
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
g_clear_pointer (&tag->box, gtk_widget_unparent);
g_clear_pointer (&tag->style, g_free);
G_OBJECT_CLASS (demo_tagged_entry_tag_parent_class)->finalize (object);
}
static void
demo_tagged_entry_tag_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
switch (prop_id)
{
case PROP_LABEL:
demo_tagged_entry_tag_set_label (tag, g_value_get_string (value));
break;
case PROP_HAS_CLOSE_BUTTON:
demo_tagged_entry_tag_set_has_close_button (tag, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo_tagged_entry_tag_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (object);
switch (prop_id)
{
case PROP_LABEL:
g_value_set_string (value, demo_tagged_entry_tag_get_label (tag));
break;
case PROP_HAS_CLOSE_BUTTON:
g_value_set_boolean (value, demo_tagged_entry_tag_get_has_close_button (tag));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo_tagged_entry_tag_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (widget);
gtk_widget_measure (tag->box, orientation, for_size,
minimum, natural,
minimum_baseline, natural_baseline);
}
static void
demo_tagged_entry_tag_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
DemoTaggedEntryTag *tag = DEMO_TAGGED_ENTRY_TAG (widget);
gtk_widget_size_allocate (tag->box,
&(GtkAllocation) { 0, 0, width, height },
baseline);
}
static void
demo_tagged_entry_tag_class_init (DemoTaggedEntryTagClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo_tagged_entry_tag_dispose;
object_class->finalize = demo_tagged_entry_tag_finalize;
object_class->set_property = demo_tagged_entry_tag_set_property;
object_class->get_property = demo_tagged_entry_tag_get_property;
widget_class->measure = demo_tagged_entry_tag_measure;
widget_class->size_allocate = demo_tagged_entry_tag_size_allocate;
signals[SIGNAL_CLICKED] =
g_signal_new ("clicked",
DEMO_TYPE_TAGGED_ENTRY_TAG,
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
signals[SIGNAL_BUTTON_CLICKED] =
g_signal_new ("button-clicked",
DEMO_TYPE_TAGGED_ENTRY_TAG,
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_object_class_install_property (object_class, PROP_LABEL,
g_param_spec_string ("label", "Label", "Label",
NULL, G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_HAS_CLOSE_BUTTON,
g_param_spec_boolean ("has-close-button", "Has close button", "Whether this tag has a close button",
FALSE, G_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
gtk_widget_class_set_css_name (widget_class, "tag");
}
DemoTaggedEntryTag *
demo_tagged_entry_tag_new (const char *label)
{
return DEMO_TAGGED_ENTRY_TAG (g_object_new (DEMO_TYPE_TAGGED_ENTRY_TAG,
"label", label,
NULL));
}
const char *
demo_tagged_entry_tag_get_label (DemoTaggedEntryTag *tag)
{
g_return_val_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag), NULL);
return gtk_label_get_label (GTK_LABEL (tag->label));
}
void
demo_tagged_entry_tag_set_label (DemoTaggedEntryTag *tag,
const char *label)
{
g_return_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag));
gtk_label_set_label (GTK_LABEL (tag->label), label);
}
static void
on_button_clicked (GtkButton *button,
DemoTaggedEntryTag *tag)
{
g_signal_emit (tag, signals[SIGNAL_BUTTON_CLICKED], 0);
}
void
demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
gboolean has_close_button)
{
g_return_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag));
if ((tag->button != NULL) == has_close_button)
return;
if (!has_close_button && tag->button)
{
gtk_container_remove (GTK_CONTAINER (tag->box), tag->button);
tag->button = NULL;
}
else if (has_close_button && tag->button == NULL)
{
GtkWidget *image;
image = gtk_image_new_from_icon_name ("window-close-symbolic");
tag->button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (tag->button), image);
gtk_widget_set_halign (tag->button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (tag->button, GTK_ALIGN_CENTER);
gtk_button_set_relief (GTK_BUTTON (tag->button), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (tag->box), tag->button);
g_signal_connect (tag->button, "clicked", G_CALLBACK (on_button_clicked), tag);
}
g_object_notify (G_OBJECT (tag), "has-close-button");
}
gboolean
demo_tagged_entry_tag_get_has_close_button (DemoTaggedEntryTag *tag)
{
g_return_val_if_fail (DEMO_IS_TAGGED_ENTRY_TAG (tag), FALSE);
return tag->button != NULL;
}

View File

@@ -0,0 +1,89 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2019 Red Hat, Inc.
*
* Authors:
* - Matthias Clasen <mclasen@redhat.com>
*
* 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 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/>.
*/
#ifndef __DEMO_TAGGED_ENTRY_H__
#define __DEMO_TAGGED_ENTRY_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define DEMO_TYPE_TAGGED_ENTRY (demo_tagged_entry_get_type ())
#define DEMO_TAGGED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEMO_TYPE_TAGGED_ENTRY, DemoTaggedEntry))
#define DEMO_TAGGED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEMO_TYPE_TAGGED_ENTRY, DemoTaggedEntryClass))
#define DEMO_IS_TAGGED_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEMO_TYPE_TAGGED_ENTRY))
#define DEMO_IS_TAGGED_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEMO_TYPE_TAGGED_ENTRY))
#define DEMO_TAGGED_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEMO_TYPE_TAGGED_ENTRY, DemoTaggedEntryClass))
typedef struct _DemoTaggedEntry DemoTaggedEntry;
typedef struct _DemoTaggedEntryClass DemoTaggedEntryClass;
struct _DemoTaggedEntry
{
GtkWidget parent;
};
struct _DemoTaggedEntryClass
{
GtkWidgetClass parent_class;
};
#define DEMO_TYPE_TAGGED_ENTRY_TAG (demo_tagged_entry_tag_get_type ())
#define DEMO_TAGGED_ENTRY_TAG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DEMO_TYPE_TAGGED_ENTRY_TAG, DemoTaggedEntryTag))
#define DEMO_TAGGED_ENTRY_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DEMO_TYPE_TAGGED_ENTRY_TAG, DemoTaggedEntryTag))
#define DEMO_IS_TAGGED_ENTRY_TAG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DEMO_TYPE_TAGGED_ENTRY_TAG))
#define DEMO_IS_TAGGED_ENTRY_TAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DEMO_TYPE_TAGGED_ENTRY_TAG))
#define DEMO_TAGGED_ENTRY_TAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DEMO_TYPE_TAGGED_ENTRY_TAG, DemoTaggedEntryTagClass))
typedef struct _DemoTaggedEntryTag DemoTaggedEntryTag;
typedef struct _DemoTaggedEntryTagClass DemoTaggedEntryTagClass;
GType demo_tagged_entry_get_type (void) G_GNUC_CONST;
GType demo_tagged_entry_tag_get_type (void) G_GNUC_CONST;
GtkWidget * demo_tagged_entry_new (void);
void demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
GtkWidget *tag);
void demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
GtkWidget *tag,
GtkWidget *sibling);
void demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
GtkWidget *tag);
DemoTaggedEntryTag *
demo_tagged_entry_tag_new (const char *label);
const char * demo_tagged_entry_tag_get_label (DemoTaggedEntryTag *tag);
void demo_tagged_entry_tag_set_label (DemoTaggedEntryTag *tag,
const char *label);
gboolean demo_tagged_entry_tag_get_has_close_button (DemoTaggedEntryTag *tag);
void demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
gboolean has_close_button);
G_END_DECLS
#endif /* __DEMO_TAGGED_ENTRY_H__ */

View File

@@ -69,7 +69,7 @@ interactive_dialog_clicked (GtkButton *button,
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
local_entry1 = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (entry1)));
gtk_editable_set_text (GTK_EDITABLE (local_entry1), gtk_editable_get_text (GTK_EDITABLE (entry1)));
gtk_grid_attach (GTK_GRID (table), local_entry1, 1, 0, 1, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry1);
@@ -77,7 +77,7 @@ interactive_dialog_clicked (GtkButton *button,
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
local_entry2 = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2)));
gtk_editable_set_text (GTK_EDITABLE (local_entry2), gtk_editable_get_text (GTK_EDITABLE (entry2)));
gtk_grid_attach (GTK_GRID (table), local_entry2, 1, 1, 1, 1);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2);
@@ -85,8 +85,8 @@ interactive_dialog_clicked (GtkButton *button,
if (response == GTK_RESPONSE_OK)
{
gtk_entry_set_text (GTK_ENTRY (entry1), gtk_entry_get_text (GTK_ENTRY (local_entry1)));
gtk_entry_set_text (GTK_ENTRY (entry2), gtk_entry_get_text (GTK_ENTRY (local_entry2)));
gtk_editable_set_text (GTK_EDITABLE (entry1), gtk_editable_get_text (GTK_EDITABLE (local_entry1)));
gtk_editable_set_text (GTK_EDITABLE (entry2), gtk_editable_get_text (GTK_EDITABLE (local_entry2)));
}
gtk_widget_destroy (dialog);

View File

@@ -196,10 +196,10 @@ edit_label_done (GtkWidget *entry, gpointer data)
GtkWidget *label;
int x, y;
gtk_container_child_get (GTK_CONTAINER (fixed), entry, "x", &x, "y", &y, NULL);
gtk_fixed_get_child_position (GTK_FIXED (fixed), entry, &x, &y);
label = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "label"));
gtk_label_set_text (GTK_LABEL (label), gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_widget_destroy (entry);
}
@@ -210,7 +210,7 @@ edit_cb (GtkWidget *child)
GtkWidget *fixed = gtk_widget_get_parent (child);
int x, y;
gtk_container_child_get (GTK_CONTAINER (fixed), child, "x", &x, "y", &y, NULL);
gtk_fixed_get_child_position (GTK_FIXED (fixed), child, &x, &y);
if (GTK_IS_LABEL (child))
{
@@ -218,7 +218,7 @@ edit_cb (GtkWidget *child)
g_object_set_data (G_OBJECT (entry), "label", child);
gtk_entry_set_text (GTK_ENTRY (entry), gtk_label_get_text (GTK_LABEL (child)));
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
gtk_widget_grab_focus (entry);

View File

@@ -23,58 +23,46 @@
</child>
</object>
</child>
<child>
<child type="end">
<object class="GtkLabel">
<property name="label">fps</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkLabel">
<property name="label" bind-source="bowl" bind-property="framerate"/>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkLabel">
<property name="label">Icons, </property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkLabel">
<property name="label" bind-source="bowl" bind-property="count"/>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="changes_allow">
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
<property name="icon-name">changes-allow</property>
<property name="relief">none</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="changes_prevent">
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">1</property>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">0</property>
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean"/>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean"/>
<property name="icon-name">changes-prevent</property>
<property name="relief">none</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
</object>
</child>
@@ -82,7 +70,7 @@
<object class="GtkFishbowl" id="bowl">
<property name="visible">True</property>
<property name="animating">True</property>
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">1</property>
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
</object>
</child>
</object>

View File

@@ -305,7 +305,7 @@ update_display (void)
char *font_desc;
char *features;
text = gtk_entry_get_text (GTK_ENTRY (entry));
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (gtk_label_get_selection_bounds (GTK_LABEL (label), &ins, &bound))
{
@@ -728,7 +728,7 @@ adjustment_changed (GtkAdjustment *adjustment,
char *str;
str = g_strdup_printf ("%g", gtk_adjustment_get_value (adjustment));
gtk_entry_set_text (GTK_ENTRY (entry), str);
gtk_editable_set_text (GTK_EDITABLE (entry), str);
g_free (str);
update_display ();
@@ -741,7 +741,7 @@ entry_activated (GtkEntry *entry,
gdouble value;
gchar *err = NULL;
value = g_strtod (gtk_entry_get_text (entry), &err);
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
if (err != NULL)
gtk_adjustment_set_value (adjustment, value);
}
@@ -821,7 +821,7 @@ add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
gtk_grid_attach (GTK_GRID (variations_grid), axis_scale, 1, i, 1, 1);
axis_entry = gtk_entry_new ();
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
gtk_entry_set_width_chars (GTK_ENTRY (axis_entry), 4);
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_grid_attach (GTK_GRID (variations_grid), axis_entry, 2, i, 1, 1);
axis = g_new (Axis, 1);
@@ -1639,7 +1639,7 @@ static char *text;
static void
switch_to_entry (void)
{
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
gtk_widget_grab_focus (entry);
}
@@ -1677,7 +1677,7 @@ entry_key_press (GtkEventController *controller,
{
if (keyval == GDK_KEY_Escape)
{
gtk_entry_set_text (GTK_ENTRY (entry), text);
gtk_editable_set_text (GTK_EDITABLE (entry), text);
stop_edit ();
return GDK_EVENT_STOP;
}

View File

@@ -47,6 +47,7 @@ demos = files([
'paintable_animated.c',
'paintable_mediastream.c',
'panes.c',
'password_entry.c',
'pickers.c',
'pixbufs.c',
'popover.c',
@@ -64,6 +65,7 @@ demos = files([
'spinner.c',
'stack.c',
'tabs.c',
'tagged_entry.c',
'textmask.c',
'textview.c',
'textscroll.c',
@@ -75,7 +77,13 @@ demos = files([
gtkdemo_deps = [ libgtk_dep, ]
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c', 'puzzlepiece.c', 'bluroverlay.c'])
extra_demo_sources = files(['main.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'puzzlepiece.c',
'bluroverlay.c',
'demotaggedentry.c'])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files('font_features.c')

View File

@@ -30,4 +30,11 @@
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<releases>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
</releases>
</component>

View File

@@ -12,7 +12,7 @@
static void
do_number (GtkButton *button, GtkEntry *entry)
{
gtk_entry_set_text (entry, gtk_button_get_label (button));
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_button_get_label (button));
}
GtkWidget *

View File

@@ -171,8 +171,24 @@ on_pad_knob_change (GSimpleAction *action,
}
static void
drawing_area_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel)
drawing_area_unroot (GtkWidget *widget)
{
DrawingArea *area = (DrawingArea *) widget;
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget);
if (area->pad_controller)
{
gtk_widget_remove_controller (toplevel, GTK_EVENT_CONTROLLER (area->pad_controller));
area->pad_controller = NULL;
}
GTK_WIDGET_CLASS (drawing_area_parent_class)->unroot (widget);
}
static void
drawing_area_root (GtkWidget *widget)
{
DrawingArea *area = (DrawingArea *) widget;
GSimpleActionGroup *action_group;
@@ -180,20 +196,12 @@ drawing_area_hierarchy_changed (GtkWidget *widget,
GtkWidget *toplevel;
gint i;
if (previous_toplevel && area->pad_controller)
{
gtk_widget_remove_controller (previous_toplevel,
GTK_EVENT_CONTROLLER (area->pad_controller));
area->pad_controller = NULL;
}
GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (area));
if (!GTK_IS_WINDOW (toplevel))
return;
action_group = g_simple_action_group_new ();
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
NULL);
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group), NULL);
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
{
@@ -220,8 +228,7 @@ drawing_area_hierarchy_changed (GtkWidget *widget,
gtk_pad_controller_set_action_entries (area->pad_controller, pad_actions,
G_N_ELEMENTS (pad_actions));
gtk_widget_add_controller (toplevel,
GTK_EVENT_CONTROLLER (area->pad_controller));
gtk_widget_add_controller (toplevel, GTK_EVENT_CONTROLLER (area->pad_controller));
}
static void
@@ -233,7 +240,8 @@ drawing_area_class_init (DrawingAreaClass *klass)
widget_class->snapshot = drawing_area_snapshot;
widget_class->map = drawing_area_map;
widget_class->unmap = drawing_area_unmap;
widget_class->hierarchy_changed = drawing_area_hierarchy_changed;
widget_class->root = drawing_area_root;
widget_class->unroot = drawing_area_unroot;
area_signals[COLOR_SET] =
g_signal_new ("color-set",

View File

@@ -0,0 +1,89 @@
/* Entry/Password Entry
*
* GtkPasswordEntry provides common functionality of
* entries that are used to enter passwords and other
* secrets.
*
* It will display a warning if CapsLock is on, and it
* can optionally provide a way to see the text.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
static GtkWidget *entry;
static GtkWidget *entry2;
static GtkWidget *button;
static void
update_button (GObject *object,
GParamSpec *pspec,
gpointer data)
{
const char *text = gtk_editable_get_text (GTK_EDITABLE (entry));
const char *text2 = gtk_editable_get_text (GTK_EDITABLE (entry2));
gtk_widget_set_sensitive (button,
text[0] != '\0' && g_str_equal (text, text2));
}
GtkWidget *
do_password_entry (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *box;
GtkWidget *header;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Choose a Password");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
g_object_set (box, "margin", 18, NULL);
gtk_container_add (GTK_CONTAINER (window), box);
entry = gtk_password_entry_new ();
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);
g_object_set (entry,
"placeholder-text", "Password",
"activates-default", TRUE,
NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
gtk_container_add (GTK_CONTAINER (box), entry);
entry2 = gtk_password_entry_new ();
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry2), TRUE);
g_object_set (entry2,
"placeholder-text", "Confirm",
"activates-default", TRUE,
NULL);
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
gtk_container_add (GTK_CONTAINER (box), entry2);
button = gtk_button_new_with_mnemonic ("_Done");
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
gtk_widget_set_sensitive (button, FALSE);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
gtk_widget_set_can_default (button, TRUE);
gtk_window_set_default (GTK_WINDOW (window), button);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -85,7 +85,7 @@ stop_search (GtkButton *button,
static void
clear_entry (GtkEntry *entry)
{
gtk_entry_set_text (entry, "");
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static void
@@ -246,7 +246,10 @@ do_search_entry (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Create our entry */
entry = gtk_search_entry_new ();
entry = gtk_entry_new ();
gtk_entry_set_icon_from_icon_name (GTK_ENTRY (entry),
GTK_ENTRY_ICON_PRIMARY,
"edit-find-symbolic");
gtk_container_add (GTK_CONTAINER (hbox), entry);
/* Create the find and cancel buttons */

View File

@@ -19,7 +19,7 @@ hex_spin_input (GtkSpinButton *spin_button,
gchar *err;
gdouble res;
buf = gtk_spin_button_get_text (spin_button);
buf = gtk_editable_get_text (GTK_EDITABLE (spin_button));
res = strtol (buf, &err, 16);
*new_val = res;
if (*err)
@@ -41,8 +41,8 @@ hex_spin_output (GtkSpinButton *spin_button)
buf = g_strdup ("0x00");
else
buf = g_strdup_printf ("0x%.2X", (gint) val);
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
g_free (buf);
return TRUE;
@@ -60,7 +60,7 @@ time_spin_input (GtkSpinButton *spin_button,
gchar *endh;
gchar *endm;
text = gtk_spin_button_get_text (spin_button);
text = gtk_editable_get_text (GTK_EDITABLE (spin_button));
str = g_strsplit (text, ":", 2);
if (g_strv_length (str) == 2)
@@ -99,8 +99,8 @@ time_spin_output (GtkSpinButton *spin_button)
hours = gtk_adjustment_get_value (adjustment) / 60.0;
minutes = (hours - floor (hours)) * 60.0;
buf = g_strdup_printf ("%02.0f:%02.0f", floor (hours), floor (minutes + 0.5));
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
g_free (buf);
return TRUE;
@@ -132,7 +132,7 @@ month_spin_input (GtkSpinButton *spin_button,
for (i = 1; i <= 12; i++)
{
tmp1 = g_ascii_strup (month[i - 1], -1);
tmp2 = g_ascii_strup (gtk_spin_button_get_text (spin_button), -1);
tmp2 = g_ascii_strup (gtk_editable_get_text (GTK_EDITABLE (spin_button)), -1);
if (strstr (tmp1, tmp2) == tmp1)
found = TRUE;
g_free (tmp1);
@@ -162,8 +162,8 @@ month_spin_output (GtkSpinButton *spin_button)
for (i = 1; i <= 12; i++)
if (fabs (value - (double)i) < 1e-5)
{
if (strcmp (month[i-1], gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, month[i-1]);
if (strcmp (month[i-1], gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), month[i-1]);
}
return TRUE;

View File

@@ -0,0 +1,112 @@
/* Entry/Tagged Entry
*
* This example shows how to build a complex composite
* entry using GtkText, outside of GTK.
*
* This tagged entry can display tags and other widgets
* inside the entry area.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "demotaggedentry.h"
static GtkWidget *spinner = NULL;
static void
closed_cb (DemoTaggedEntryTag *tag, DemoTaggedEntry *entry)
{
demo_tagged_entry_remove_tag (entry, GTK_WIDGET (tag));
}
static void
add_tag (GtkButton *button, DemoTaggedEntry *entry)
{
DemoTaggedEntryTag *tag;
tag = demo_tagged_entry_tag_new ("Blue");
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (tag)), "blue");
demo_tagged_entry_tag_set_has_close_button (tag, TRUE);
g_signal_connect (tag, "button-clicked", G_CALLBACK (closed_cb), entry);
if (spinner == NULL)
demo_tagged_entry_add_tag (entry, GTK_WIDGET (tag));
else
demo_tagged_entry_insert_tag_after (entry, GTK_WIDGET (tag), gtk_widget_get_prev_sibling (spinner));
}
static void
toggle_spinner (GtkCheckButton *button, DemoTaggedEntry *entry)
{
if (spinner)
{
demo_tagged_entry_remove_tag (entry, spinner);
spinner = NULL;
}
else
{
spinner = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (spinner));
demo_tagged_entry_add_tag (entry, spinner);
}
}
GtkWidget *
do_tagged_entry (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *box;
GtkWidget *box2;
GtkWidget *header;
GtkWidget *entry;
GtkWidget *button;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "A tagged entry");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
g_object_set (box, "margin", 18, NULL);
gtk_container_add (GTK_CONTAINER (window), box);
entry = demo_tagged_entry_new ();
gtk_container_add (GTK_CONTAINER (box), entry);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_halign (box2, GTK_ALIGN_END);
gtk_container_add (GTK_CONTAINER (box), box2);
button = gtk_button_new_with_mnemonic ("Add _Tag");
g_signal_connect (button, "clicked", G_CALLBACK (add_tag), entry);
gtk_container_add (GTK_CONTAINER (box2), button);
button = gtk_check_button_new_with_mnemonic ("_Spinner");
g_signal_connect (button, "toggled", G_CALLBACK (toggle_spinner), entry);
gtk_container_add (GTK_CONTAINER (box2), button);
button = gtk_button_new_with_mnemonic ("_Done");
gtk_style_context_add_class (gtk_widget_get_style_context (button), "suggested-action");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
gtk_widget_set_can_default (button, TRUE);
gtk_window_set_default (GTK_WINDOW (window), button);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,19 @@
tag {
margin: 4px;
padding: 4px;
border-radius: 4px;
background: lightskyblue;
}
tag box {
border-spacing: 4px;
}
tag label,
tag image {
color: white;
}
tag button {
min-height: 0;
min-width: 0;
padding: 0;
border: 1px solid white;
}

View File

@@ -11,41 +11,36 @@
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
@@ -54,12 +49,10 @@
<class name="raised"/>
</style>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
@@ -69,12 +62,10 @@
<class name="raised"/>
</style>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
@@ -82,9 +73,6 @@
<property name="is-important">1</property>
<property name="active">1</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToolItem">
@@ -149,68 +137,56 @@
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">go-up-symbolic</property>
<property name="active">1</property>
</object>
<packing>
<property name="homogeneous">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -68,7 +68,7 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
{
const gchar *text;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
@@ -322,7 +322,7 @@ icon_visible_func (GtkTreeModel *model,
gboolean visible;
search = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (win->search));
search_text = gtk_entry_get_text (GTK_ENTRY (win->searchentry));
search_text = gtk_editable_get_text (GTK_EDITABLE (win->searchentry));
if (win->symbolic)
column = ICON_STORE_SYMBOLIC_NAME_COLUMN;

View File

@@ -35,7 +35,7 @@
</child>
</object>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="search">
<style>
<class name="image-button"/>
@@ -46,9 +46,7 @@
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
</object>
</child>

View File

@@ -31,4 +31,11 @@
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
<releases>
<release version="3.94.0" date="2018-06-25">
<description>
<p>A new developers snapshot towards GTK 4.0.</p>
</description>
</release>
</releases>
</component>

View File

@@ -48,7 +48,7 @@ change_transition_state (GSimpleAction *action,
GtkStackTransitionType transition;
if (g_variant_get_boolean (state))
transition = GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT;
transition = GTK_STACK_TRANSITION_TYPE_ROTATE_LEFT_RIGHT;
else
transition = GTK_STACK_TRANSITION_TYPE_NONE;
@@ -1406,7 +1406,7 @@ open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button
{
const gchar *text;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
gtk_widget_set_sensitive (button, strlen (text) > 0);
}

View File

@@ -411,15 +411,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="stack">toplevel_stack</property>
</object>
</child>
<child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
<property name="menu-model">gear_menu</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
@@ -429,7 +426,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="margin">10</property>
<child>
<object class="GtkStack" id="toplevel_stack">
<property name="transition-duration">30000</property>
<property name="transition-duration">1000</property>
<child>
<object class="GtkStackPage">
<property name="name">page1</property>
@@ -1432,6 +1429,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkOverlay" id="page2">
<child type="overlay">
<object class="GtkRevealer" id="page2revealer">
<property name="transition-type">swing-down</property>
<property name="halign">center</property>
<property name="valign">start</property>
<child>
@@ -1587,16 +1585,13 @@ microphone-sensitivity-medium-symbolic</property>
<property name="halign">center</property>
</object>
</child>
<child>
<child type="end">
<object class="GtkMenuButton">
<property name="menu-model">dinner_menu</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">emblem-system-symbolic</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
</object>
</child>
@@ -2847,6 +2842,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkToolItem">
<property name="expand-item">1</property>
<child>
<object class="GtkScale">
<property name="draw-value">0</property>
@@ -2854,9 +2850,6 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkToolItem">

View File

@@ -213,6 +213,7 @@ gdk_surface_get_pass_through
gdk_surface_move
gdk_surface_resize
gdk_surface_move_resize
gdk_surface_move_to_rect
gdk_surface_has_native
gdk_surface_raise
gdk_surface_lower
@@ -240,7 +241,6 @@ gdk_surface_thaw_updates
gdk_surface_get_frame_clock
<SUBSECTION>
gdk_surface_set_user_data
gdk_surface_set_accept_focus
gdk_surface_get_accept_focus
gdk_surface_set_focus_on_map
@@ -252,7 +252,6 @@ gdk_surface_set_title
GDK_PARENT_RELATIVE
gdk_surface_set_cursor
gdk_surface_get_cursor
gdk_surface_get_user_data
gdk_surface_get_geometry
gdk_surface_set_geometry_hints
gdk_surface_get_width
@@ -272,17 +271,14 @@ gdk_surface_get_frame_extents
gdk_surface_get_origin
gdk_surface_get_root_coords
gdk_surface_get_device_position
gdk_surface_get_device_position_double
GdkModifierType
GdkModifierIntent
gdk_surface_get_parent
gdk_surface_get_toplevel
gdk_surface_get_children
gdk_surface_get_children_with_user_data
gdk_surface_peek_children
gdk_surface_set_icon_name
gdk_surface_set_transient_for
gdk_surface_set_role
gdk_surface_set_startup_id
gdk_surface_set_group
gdk_surface_get_group
@@ -377,6 +373,7 @@ gdk_content_formats_builder_to_formats
GDK_TYPE_FILE_LIST
gdk_file_list_get_type
gdk_content_formats_get_type
gdk_content_formats_builder_get_type
</SECTION>
<SECTION>
@@ -442,6 +439,7 @@ gdk_keymap_get_modifier_state
gdk_keymap_add_virtual_modifiers
gdk_keymap_map_virtual_modifiers
gdk_keymap_get_modifier_mask
gdk_keymap_get_display
<SUBSECTION>
gdk_keyval_name
@@ -502,7 +500,6 @@ gdk_device_get_has_cursor
gdk_device_get_n_axes
gdk_device_get_n_keys
gdk_device_get_axes
gdk_device_warp
gdk_device_get_seat
<SUBSECTION>
@@ -512,9 +509,7 @@ gdk_device_ungrab
<SUBSECTION>
gdk_device_get_state
gdk_device_get_position
gdk_device_get_position_double
gdk_device_get_surface_at_position
gdk_device_get_surface_at_position_double
gdk_device_get_history
gdk_device_free_history
GdkTimeCoord
@@ -622,6 +617,7 @@ GDK_BUTTON_SECONDARY
gdk_event_new
gdk_event_copy
gdk_event_get_axes
gdk_event_get_axis
gdk_event_get_button
gdk_event_get_click_count
gdk_event_get_coords
@@ -662,9 +658,6 @@ gdk_event_get_touchpad_gesture_n_fingers
gdk_event_get_touchpad_gesture_phase
gdk_event_get_touchpad_scale
gdk_event_is_sent
<SUBSECTION>
gdk_event_handler_set
GdkEventFunc
<SUBSECTION>
gdk_get_show_events
@@ -687,6 +680,7 @@ GDK_TYPE_SCROLL_DIRECTION
GDK_TYPE_NOTIFY_TYPE
GDK_IS_EVENT
gdk_event_get_type
gdk_event_sequence_get_type
</SECTION>
<SECTION>
@@ -782,7 +776,6 @@ GDK_ACTION_ALL
gdk_drag_get_display
gdk_drag_get_actions
gdk_drag_get_suggested_action
gdk_drag_get_selected_action
gdk_drag_get_formats
gdk_drag_get_device

View File

@@ -15,7 +15,9 @@ private_headers = [
'gdkdisplaymanagerprivate.h',
'gdkdisplayprivate.h',
'gdkdndprivate.h',
'gdkdragprivate.h',
'gdkdrawcontextprivate.h',
'gdkdropprivate.h',
'gdkeventsprivate.h',
'gdkframeclockidleprivate.h',
'gdkframeclockprivate.h',

View File

@@ -18,6 +18,8 @@
<title>API Reference</title>
<xi:include href="xml/GskRenderer.xml" />
<xi:include href="xml/GskRenderNode.xml" />
<xi:include href="xml/GskRoundedRect.xml" />
<xi:include href="xml/GskTransform.xml" />
</reference>
<index id="api-index-full">

View File

@@ -2,9 +2,9 @@
<FILE>GskRenderer</FILE>
gsk_renderer_new_for_surface
gsk_renderer_get_surface
gsk_renderer_get_display
gsk_renderer_realize
gsk_renderer_unrealize
gsk_renderer_is_realized
gsk_renderer_render
gsk_renderer_render_texture
<SUBSECTION Standard>
@@ -67,11 +67,7 @@ gsk_container_node_get_n_children
gsk_container_node_get_child
gsk_transform_node_new
gsk_transform_node_get_child
gsk_transform_node_peek_transform
gsk_offset_node_new
gsk_offset_node_get_child
gsk_offset_node_get_x_offset
gsk_offset_node_get_y_offset
gsk_transform_node_get_transform
gsk_opacity_node_new
gsk_opacity_node_get_child
gsk_opacity_node_get_opacity
@@ -144,3 +140,40 @@ gsk_rounded_rect_contains_point
gsk_rounded_rect_contains_rect
gsk_rounded_rect_intersects_rect
</SECTION>
<SECTION>
<FILE>GskTransform</FILE>
GskTransform
gsk_transform_ref
gsk_transform_unref
<SUBSECTION>
GskTransformCategory
gsk_transform_get_category
<SUBSECTION>
gsk_transform_print
gsk_transform_to_string
gsk_transform_to_matrix
gsk_transform_to_2d
gsk_transform_to_affine
gsk_transform_to_translate
<SUBSECTION>
gsk_transform_transform
gsk_transform_invert
gsk_transform_matrix
gsk_transform_translate
gsk_transform_translate_3d
gsk_transform_rotate
gsk_transform_rotate_3d
gsk_transform_scale
gsk_transform_scale_3d
gsk_transform_perspective
<SUBSECTION>
gsk_transform_equal
<SUBSECTION>
gsk_transform_transform_bounds
<SUBSECTION Private>
GSK_TYPE_TRANSFORM
gsk_transform_get_type
gsk_transform_new
</SECTION>

View File

@@ -546,7 +546,7 @@ checkbutton:indeterminate {
GTK adds several additional ways to specify colors.
</para>
<literallayout><code>〈gtk color〉 = 〈symbolic color〉 | 〈color expression〉 | 〈win32 color〉</code>
<literallayout><code>〈gtk color〉 = 〈symbolic color〉 | 〈color expression〉</code>
</literallayout>
<para>
@@ -592,13 +592,6 @@ checkbutton:indeterminate {
<literallayout><code>〈color expression〉 = lighter( 〈color〉 ) | darker( 〈color〉 ) | shade( 〈color〉, 〈number〉 ) |</code>
<code> alpha( 〈color〉, 〈number〉 ) | mix( 〈color〉, 〈color〉, 〈number〉 )</code>
</literallayout>
<para>
On Windows, GTK allows to refer to system colors, as follows:
</para>
<literallayout><code>〈win32 color〉 = -gtk-win32-color( 〈name〉, 〈integer〉 )</code>
</literallayout>
</refsect2>
@@ -737,7 +730,7 @@ label {
GTK extends the CSS syntax for images and also uses it for specifying icons.
</para>
<literallayout><code>〈gtk image〉 = 〈themed icon〉 | 〈scaled image〉 | 〈recolored image〉 | 〈win32 theme part〉</code>
<literallayout><code>〈gtk image〉 = 〈themed icon〉 | 〈scaled image〉 | 〈recolored image〉</code>
</literallayout>
<para>
@@ -815,13 +808,6 @@ arrow {
}
]]></programlisting>
</example>
<para>
On Windows, GTK allows to refer to system theme parts as images, as follows:
</para>
<literallayout><code>〈win32 theme part〉 = -gtk-win32-theme-part( 〈name〉, 〈integer〉 〈integer〉</code>
<code> [ , [ over( 〈integer〉 〈integer〉 [ , 〈alpha value〉 ]? ) | margins( 〈integer〉{1,4} ) ] ]* )</code>
</literallayout>
</refsect2>

View File

@@ -65,20 +65,6 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
not quite the same as the CSS definition of rem.
</para>
<para>
Whereever a number is allowed, GTK also accepts a Windows-specific
theme size:
</para>
<literallayout>
<code>〈win32 theme size〉 = 〈win32 size〉 | 〈win32 part size〉</code>
<code>〈win32 size〉 = -gtk-win32-size ( 〈theme name〉, 〈metric id〉 )</code>
<code>〈win32 part size〉 = [ -gtk-win32-part-width | -gtk-win32-part-height |</code>
<code> -gtk-win32-part-border-top | -gtk-win32-part-border-right |</code>
<code> -gtk-win32-part-border-bottom | -gtk-win32-part-border-left ]</code>
<code> ( 〈theme name〉 , 〈integer〉 , 〈integer〉 )</code>
</literallayout>
<literallayout><code>〈calc expression〉 = calc( 〈calc sum〉 )</code>
<code>〈calc sum〉 = 〈calc product〉 [ [ + | - ] 〈calc product〉 ]*</code>
<code>〈calc product〉 = 〈calc value〉 [ * 〈calc value〉 | / 〈number〉 ]*</code>

View File

@@ -26,72 +26,53 @@
widgets and windows, you should read this chapter; this will be
useful to know if you decide to implement your own widgets. This
chapter will also clarify the reasons behind the ways certain
things are done in GTK; for example, why you cannot change the
background color of all widgets with the same method.
things are done in GTK.
</para>
<refsect2 id="drawing model windows">
<title>Windows and events</title>
<para>
Programs that run in a windowing system generally create
rectangular regions in the screen called
<firstterm>windows</firstterm>. Traditional windowing systems
do not automatically save the graphical content of windows, and
instead ask client programs to repaint those windows whenever it
is needed. For example, if a window that is stacked below other
windows gets raised to the top, then a client program has to
repaint the area that was previously obscured. When the
windowing system asks a client program to redraw part of a
window, it sends an <firstterm>exposure event</firstterm> to the
program for that window.
Applications that use a windowing system generally create
rectangular regions in the screen called <firstterm>surfaces</firstterm>
(GTK is following the Wayland terminology, other windowing systems
such as X11 may call these <firstterm>windows</firstterm>).
Traditional windowing systems do not automatically save the
graphical content of surfaces, and instead ask applications to
provide new content whenever it is needed.
For example, if a window that is stacked below other
windows gets raised to the top, then the application has to
repaint it, so the previously obscured area can be shown.
When the windowing system asks an application to redraw
a window, it sends a <firstterm>frame event</firstterm>
(<firstterm>expose event</firstterm> in X11 terminology)
for that window.
</para>
<para>
Each GTK toplevel window or dialog is associated with a
windowing system surface. Child widgets such as buttons or
entries don't have their own surface; they use the surface
of their toplevel.
</para>
<para>
Here, "windows" means "rectangular regions with automatic
clipping", instead of "toplevel application windows". Most
windowing systems support nested windows, where the contents of
child windows get clipped by the boundaries of their parents.
Although GTK and GDK in particular may run on a windowing
system with no such notion of nested windows, GDK presents the
illusion of being under such a system. A toplevel window may
contain many subwindows and sub-subwindows, for example, one for
the menu bar, one for the document area, one for each scrollbar,
and one for the status bar. In addition, controls that receive
user input, such as clickable buttons, are likely to have their
own subwindows as well.
</para>
<para>
In practice, most windows in modern GTK application are client-side
constructs. Only few windows (in particular toplevel windows) are
<emphasis>native</emphasis>, which means that they represent a
window from the underlying windowing system on which GTK is running.
For example, on X11 it corresponds to a <type>Window</type>; on Win32,
it corresponds to a <type>HANDLE</type>.
</para>
<para>
Generally, the drawing cycle begins when GTK receives an
exposure event from the underlying windowing system: if the
Generally, the drawing cycle begins when GTK receives
a frame event from the underlying windowing system: if the
user drags a window over another one, the windowing system will
tell the underlying window that it needs to repaint itself. The
tell the underlying surface that it needs to repaint itself. The
drawing cycle can also be initiated when a widget itself decides
that it needs to update its display. For example, when the user
types a character in a <link
linkend="GtkEntry"><classname>GtkEntry</classname></link>
widget, the entry asks GTK to queue a redraw operation for
itself.
types a character in an entry widget, the entry asks GTK to queue
a redraw operation for itself.
</para>
<para>
The windowing system generates events for native windows. The GDK
interface to the windowing system translates such native events into
<link linkend="GdkEvent"><structname>GdkEvent</structname></link>
structures and sends them on to the GTK layer. In turn, the GTK layer
finds the widget that corresponds to a particular
<classname>GdkSurface</classname> and emits the corresponding event
signals on that widget.
The windowing system generates frame events for surfaces. The GDK
interface to the windowing system translates such events into
emissions of the ::render signal on the affected surfaces.
The GTK toplevel window connects to that signal, and reacts appropriately.
</para>
<para>
@@ -112,8 +93,13 @@
it does. On top of this GTK has a frame clock that gives a
“pulse” to the application. This clock beats at a steady rate,
which is tied to the framerate of the output (this is synced to
the monitor via the window manager/compositor). The clock has
several phases:
the monitor via the window manager/compositor). A typical
refresh rate is 60 frames per second, so a new “pulse” happens
roughly every 16 milliseconds.
</para>
<para>
The clock has several phases:
<itemizedlist>
<listitem><para>Events</para></listitem>
<listitem><para>Update</para></listitem>
@@ -125,24 +111,24 @@
</para>
<para>
The Events phase is a long stretch of time between each
redraw where we get input events from the user and other events
The Events phase is a stretch of time between each redraw where
GTK processes input events from the user and other events
(like e.g. network I/O). Some events, like mouse motion are
compressed so that we only get a single mouse motion event per
clock cycle.
compressed so that only a single mouse motion event per clock
cycle needs to be handled.
</para>
<para>
Once the Events phase is over we pause all external events and
run the redraw loop. First is the Update phase, where all
Once the Events phase is over, external events are paused and
the redraw loop is run. First is the Update phase, where all
animations are run to calculate the new state based on the
estimated time the next frame will be visible (available via
the frame clock). This often involves geometry changes which
drives the next phase, Layout. If there are any changes in
widget size requirements we calculate a new layout for the
widget hierarchy (i.e. we assign sizes and positions). Then
we go to the Paint phase where we redraw the regions of the
window that need redrawing.
drive the next phase, Layout. If there are any changes in
widget size requirements the new layout is calculated for the
widget hierarchy (i.e. sizes and positions for all widgets are
determined). Then comes the Paint phase, where we redraw the
regions of the window that need redrawing.
</para>
<para>
@@ -184,162 +170,57 @@
</para>
</refsect2>
<refsect2 id="scene-graph">
<title>The scene graph</title>
<para>
The first step in “drawing” a window is that GTK creates
<firstterm>render nodes</firstterm> for all the widgets
in the window. The render nodes are combined into a tree
that you can think of as a <firstterm>scene graph</firstterm>
describing your window contents.
</para>
<para>
Render nodes belong to the GSK layer, and there are various kinds
of them, for the various kinds of drawing primitives you are likely
to need when translating widget content and CSS styling. Typical
examples are text nodes, gradient nodes, texture nodes or clip nodes.
<para>
<para>
In the past, all drawing in GTK happened via cairo. It is still possible
to use cairo for drawing your custom widget contents, by using a cairo
render node.
</para>
</para>
A GSK <firstterm>renderer</firstterm> takes these render nodes, transforms
them into rendering commands for the drawing API it targets, and arranges
for the resulting drawing to be associated with the right surface. GSK has
renderers for OpenGL, Vulkan and cairo.
</para>
</refsect2>
<refsect2 id="hierarchical-drawing">
<title>Hierarchical drawing</title>
<para>
During the Paint phase we will send a single expose event to
the toplevel window. The event handler will create a cairo
context for the window and emit a GtkWidget::draw() signal
on it, which will propagate down the entire widget hierarchy
in back-to-front order, using the clipping and transform of
the cairo context. This lets each widget draw its content at
the right place and time, correctly handling things like
partial transparencies and overlapping widgets.
During the Paint phase GTK receives a single ::render signal on the toplevel
window. The signal handler will create a snapshot object (which is a
helper for creating a scene graph) and emit a GtkWidget::snapshot() signal,
which will propagate down the widget hierarchy. This lets each widget
snapshot its content at the right place and time, correctly handling things
like partial transparencies and overlapping widgets.
</para>
<para>
When generating the event, GDK also sets up double buffering to
avoid the flickering that would result from each widget drawing
itself in turn. <xref linkend="double-buffering"/> describes
the double buffering mechanism in detail.
</para>
<para>
Normally, there is only a single cairo context which is used in
the entire repaint, rather than one per GdkSurface. This means you
have to respect (and not reset) existing clip and transformations
set on it.
</para>
<para>
Most widgets, including those that create their own GdkSurfaces have
a transparent background, so they draw on top of whatever widgets
are below them. This was not the case in GTK 2 where the theme set
the background of most widgets to the default background color. (In
fact, transparent GdkSurfaces used to be impossible.)
</para>
<para>
The whole rendering hierarchy is captured in the call stack, rather
than having multiple separate draw emissions, so you can use effects
like e.g. cairo_push/pop_group() which will affect all the widgets
below you in the hierarchy. This makes it possible to have e.g.
partially transparent containers.
To avoid excessive work when generating scene graphs, GTK caches render nodes.
Each widget keeps a reference to its render node (which in turn, will refer to
the render nodes of children, and grandchildren, and so on), and will reuse
that node during the Paint phase. Invalidating a widget (by calling
gtk_widget_queue_draw()) discards the cached render node, forcing the widget
to regenerate it the next time it needs to handle a ::snapshot.
</para>
</refsect2>
<refsect2 id="scrolling drawing model">
<title>Scrolling</title>
<para>
Traditionally, GTK has used self-copy operations to implement
scrolling with native windows. With transparent backgrounds, this
no longer works. Instead, we just mark the entire affected area for
repainting when these operations are used. This allows (partially)
transparent backgrounds, and it also more closely models modern
hardware where self-copy operations are problematic (they break the
rendering pipeline).
</para>
</refsect2>
</refsect1>
<refsect1 id="double-buffering">
<title>Double buffering</title>
<para>
If each of the drawing calls made by each subwidget's
<literal>draw</literal> handler were sent directly to the
windowing system, flicker could result. This is because areas may get
redrawn repeatedly: the background, then decorative frames, then text
labels, etc. To avoid flicker, GTK employs a <firstterm>double
buffering</firstterm> system at the GDK level. Widgets normally don't
know that they are drawing to an off-screen buffer; they just issue their
normal drawing commands, and the buffer gets sent to the windowing system
when all drawing operations are done.
</para>
<para>
Two basic functions in GDK form the core of the double-buffering
mechanism: <link
linkend="gdk_surface_begin_paint_region"><function>gdk_surface_begin_paint_region()</function></link>
and <link
linkend="gdk_surface_end_paint"><function>gdk_surface_end_paint()</function></link>.
The first function tells a <classname>GdkSurface</classname> to
create a temporary off-screen buffer for drawing. All
subsequent drawing operations to this window get automatically
redirected to that buffer. The second function actually paints
the buffer onto the on-screen window, and frees the buffer.
</para>
<refsect2 id="automatic-double-buffering">
<title>Automatic double buffering</title>
<para>
It would be inconvenient for all widgets to call
<function>gdk_surface_begin_paint_region()</function> and
<function>gdk_surface_end_paint()</function> at the beginning
and end of their draw handlers.
</para>
<para>
To make this easier, GTK normally calls
<function>gdk_surface_begin_paint_region()</function>
before emitting the #GtkWidget::draw signal, and
then it calls <function>gdk_surface_end_paint()</function>
after the signal has been emitted. This is convenient for
most widgets, as they do not need to worry about creating
their own temporary drawing buffers or about calling those
functions.
</para>
<para>
However, some widgets may prefer to disable this kind of
automatic double buffering and do things on their own.
To do this, call the
<function>gtk_widget_set_double_buffered()</function>
function in your widget's constructor. Double buffering
can only be turned off for widgets that have a native
window.
</para>
<example id="disabling-double-buffering">
<title>Disabling automatic double buffering</title>
<programlisting>
static void
my_widget_init (MyWidget *widget)
{
...
gtk_widget_set_double_buffered (widget, FALSE);
...
}
</programlisting>
</example>
<para>
When is it convenient to disable double buffering? Generally,
this is the case only if your widget gets drawn in such a way
that the different drawing operations do not overlap each
other. For example, this may be the case for a simple image
viewer: it can just draw the image in a single operation.
This would <emphasis>not</emphasis> be the case with a word
processor, since it will need to draw and over-draw the page's
background, then the background for highlighted text, and then
the text itself.
</para>
<para>
Even if you turn off double buffering on a widget, you
can still call
<function>gdk_surface_begin_paint_region()</function> and
<function>gdk_surface_end_paint()</function> by hand to use
temporary drawing buffers.
</para>
</refsect2>
</refsect1>
</refentry>

View File

@@ -827,7 +827,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;

View File

@@ -68,6 +68,7 @@
<chapter id="WindowWidgets">
<title>Windows</title>
<xi:include href="xml/gtkroot.xml" />
<xi:include href="xml/gtkwindow.xml" />
<xi:include href="xml/gtkdialog.xml" />
<xi:include href="xml/gtkmessagedialog.xml" />
@@ -99,6 +100,13 @@
<xi:include href="xml/gtkfixed.xml" />
</chapter>
<chapter id="LayoutManagers">
<title>Layout Managers</title>
<xi:include href="xml/gtklayoutmanager.xml" />
<xi:include href="xml/gtklayoutchild.xml" />
<xi:include href="xml/gtkboxlayout.xml" />
</chapter>
<chapter id="DisplayWidgets">
<title>Display Widgets</title>
<xi:include href="xml/gtklabel.xml" />
@@ -344,7 +352,6 @@
<xi:include href="xml/gtkselection.xml" />
<xi:include href="xml/gtktesting.xml" />
<xi:include href="xml/filesystem.xml" />
<xi:include href="xml/gtktransform.xml" />
</part>
<part id="theming">

View File

@@ -424,6 +424,7 @@ gtk_selection_model_select_range
gtk_selection_model_unselect_range
gtk_selection_model_select_all
gtk_selection_model_unselect_all
gtk_selection_model_query_range
<SUBSECTION>
gtk_selection_model_selection_changed
<SUBSECTION Standard>
@@ -675,12 +676,6 @@ gtk_combo_box_new
gtk_combo_box_new_with_entry
gtk_combo_box_new_with_model
gtk_combo_box_new_with_model_and_entry
gtk_combo_box_get_wrap_width
gtk_combo_box_set_wrap_width
gtk_combo_box_get_row_span_column
gtk_combo_box_set_row_span_column
gtk_combo_box_get_column_span_column
gtk_combo_box_set_column_span_column
gtk_combo_box_get_active
gtk_combo_box_set_active
gtk_combo_box_get_active_iter
@@ -695,6 +690,7 @@ gtk_combo_box_popdown
gtk_combo_box_get_popup_accessible
gtk_combo_box_get_row_separator_func
gtk_combo_box_set_row_separator_func
GtkSensitivityType
gtk_combo_box_set_button_sensitivity
gtk_combo_box_get_button_sensitivity
gtk_combo_box_get_has_entry
@@ -923,8 +919,6 @@ gtk_entry_new
gtk_entry_new_with_buffer
gtk_entry_get_buffer
gtk_entry_set_buffer
gtk_entry_set_text
gtk_entry_get_text
gtk_entry_get_text_length
gtk_entry_set_visibility
gtk_entry_get_visibility
@@ -937,10 +931,6 @@ gtk_entry_set_activates_default
gtk_entry_get_activates_default
gtk_entry_set_has_frame
gtk_entry_get_has_frame
gtk_entry_set_width_chars
gtk_entry_get_width_chars
gtk_entry_set_max_width_chars
gtk_entry_get_max_width_chars
gtk_entry_set_alignment
gtk_entry_get_alignment
gtk_entry_set_placeholder_text
@@ -1006,6 +996,8 @@ gtk_entry_get_type
<TITLE>GtkPasswordEntry</TITLE>
GtkPasswordEntry
gtk_password_entry_new
gtk_password_entry_set_show_peek_icon
gtk_password_entry_get_show_peek_icon
<SUBSECTION Private>
gtk_password_entry_get_type
</SECTION>
@@ -1306,6 +1298,8 @@ gtk_file_filter_get_type
<TITLE>GtkFilterListModel</TITLE>
GtkFilterListModel
gtk_filter_list_model_new
gtk_filter_list_model_new_for_type
gtk_filter_list_model_set_model
gtk_filter_list_model_get_model
gtk_filter_list_model_set_filter_func
gtk_filter_list_model_has_filter
@@ -1395,6 +1389,7 @@ gtk_font_chooser_set_font
gtk_font_chooser_get_font_desc
gtk_font_chooser_set_font_desc
gtk_font_chooser_get_font_features
gtk_font_chooser_get_language
gtk_font_chooser_set_language
gtk_font_chooser_get_preview_text
gtk_font_chooser_set_preview_text
@@ -1819,7 +1814,6 @@ gtk_menu_new
gtk_menu_new_from_model
gtk_menu_set_display
gtk_menu_reorder_child
gtk_menu_attach
gtk_menu_popup_at_rect
gtk_menu_popup_at_widget
gtk_menu_popup_at_pointer
@@ -1841,7 +1835,6 @@ gtk_menu_attach_to_widget
gtk_menu_detach
gtk_menu_get_attach_widget
gtk_menu_get_for_attach_widget
GtkMenuPositionFunc
GtkMenuDetachFunc
<SUBSECTION Standard>
GTK_MENU
@@ -2281,11 +2274,6 @@ gtk_range_set_increments
gtk_range_set_range
gtk_range_get_round_digits
gtk_range_set_round_digits
GtkSensitivityType
gtk_range_set_lower_stepper_sensitivity
gtk_range_get_lower_stepper_sensitivity
gtk_range_set_upper_stepper_sensitivity
gtk_range_get_upper_stepper_sensitivity
gtk_range_get_flippable
gtk_range_set_flippable
gtk_range_get_range_rect
@@ -2718,12 +2706,6 @@ gtk_spin_button_get_snap_to_ticks
gtk_spin_button_get_update_policy
gtk_spin_button_get_value
gtk_spin_button_get_wrap
gtk_spin_button_set_text
gtk_spin_button_get_text
gtk_spin_button_set_max_width_chars
gtk_spin_button_get_max_width_chars
gtk_spin_button_set_width_chars
gtk_spin_button_get_width_chars
GTK_INPUT_ERROR
<SUBSECTION Standard>
GTK_SPIN_BUTTON
@@ -4400,6 +4382,9 @@ gtk_snapshot_push_clip
gtk_snapshot_push_rounded_clip
gtk_snapshot_push_cross_fade
gtk_snapshot_push_blend
gtk_snapshot_push_blur
gtk_snapshot_push_shadow
gtk_snapshot_push_debug
gtk_snapshot_pop
gtk_snapshot_save
gtk_snapshot_restore
@@ -4411,6 +4396,7 @@ gtk_snapshot_rotate
gtk_snapshot_rotate_3d
gtk_snapshot_scale
gtk_snapshot_scale_3d
gtk_snapshot_perspective
gtk_snapshot_append_node
gtk_snapshot_append_cairo
gtk_snapshot_append_texture
@@ -4426,6 +4412,8 @@ gtk_snapshot_render_frame
gtk_snapshot_render_focus
gtk_snapshot_render_layout
gtk_snapshot_render_insertion_cursor
<SUBSECTION Private>
gtk_snapshot_get_type
</SECTION>
<SECTION>
@@ -4493,6 +4481,7 @@ gtk_widget_set_parent
gtk_widget_set_parent_surface
gtk_widget_get_parent_surface
gtk_widget_get_toplevel
gtk_widget_get_root
gtk_widget_get_ancestor
gtk_widget_is_ancestor
gtk_widget_translate_coordinates
@@ -4515,7 +4504,6 @@ gtk_widget_get_cursor
gtk_widget_set_cursor
gtk_widget_set_cursor_from_name
gtk_widget_mnemonic_activate
gtk_widget_send_focus_change
gtk_widget_class_set_accessible_type
gtk_widget_class_set_accessible_role
gtk_widget_get_accessible
@@ -4553,7 +4541,6 @@ gtk_widget_get_allocated_width
gtk_widget_get_allocated_height
gtk_widget_get_allocation
gtk_widget_get_allocated_baseline
gtk_widget_get_allocated_size
gtk_widget_get_width
gtk_widget_get_height
gtk_widget_compute_bounds
@@ -4610,6 +4597,8 @@ gtk_widget_get_first_child
gtk_widget_get_last_child
gtk_widget_insert_before
gtk_widget_insert_after
gtk_widget_set_layout_manager
gtk_widget_get_layout_manager
<SUBSECTION>
gtk_widget_get_path
@@ -4706,8 +4695,6 @@ gtk_window_activate_focus
gtk_window_activate_default
gtk_window_set_modal
gtk_window_set_default_size
gtk_window_set_gravity
gtk_window_get_gravity
gtk_window_set_hide_on_close
gtk_window_get_hide_on_close
GtkWindowPosition
@@ -4755,20 +4742,14 @@ gtk_window_set_urgency_hint
gtk_window_set_accept_focus
gtk_window_set_focus_on_map
gtk_window_set_startup_id
gtk_window_set_role
gtk_window_get_decorated
gtk_window_get_deletable
gtk_window_get_default_icon_list
gtk_window_get_default_icon_name
gtk_window_get_default_size
gtk_window_get_destroy_with_parent
gtk_window_get_icon
gtk_window_get_icon_list
gtk_window_get_icon_name
gtk_window_get_mnemonic_modifier
gtk_window_get_modal
gtk_window_get_position
gtk_window_get_role
gtk_window_get_size
gtk_window_get_title
gtk_window_get_transient_for
@@ -4782,15 +4763,8 @@ gtk_window_get_focus_on_map
gtk_window_get_group
gtk_window_has_group
gtk_window_get_window_type
gtk_window_move
gtk_window_resize
gtk_window_set_default_icon_list
gtk_window_set_default_icon
gtk_window_set_default_icon_from_file
gtk_window_set_default_icon_name
gtk_window_set_icon
gtk_window_set_icon_list
gtk_window_set_icon_from_file
gtk_window_set_icon_name
gtk_window_set_auto_startup_notification
gtk_window_get_mnemonics_visible
@@ -5899,38 +5873,6 @@ gtk_mount_operation_get_type
GtkMountOperationPrivate
</SECTION>
<SECTION>
<FILE>gtktransform</FILE>
<TITLE>3D transformations</TITLE>
GtkTransformType;
GtkTransform;
gtk_transform_ref
gtk_transform_unref
<SUBSECTION>
gtk_transform_print
gtk_transform_to_string
gtk_transform_to_matrix
<SUBSECTION>
gtk_transform_identity
gtk_transform_transform
gtk_transform_matrix
gtk_transform_translate
gtk_transform_translate_3d
gtk_transform_rotate
gtk_transform_rotate_3d
gtk_transform_scale
gtk_transform_scale_3d
<SUBSECTION>
gtk_transform_equal
<SUBSECTION>
gtk_transform_get_transform_type
gtk_transform_get_next
<SUBSECTION Private>
GTK_TYPE_TRANSFORM
gdk_transform_get_type
gtk_transform_new
</SECTION>
<SECTION>
<FILE>gtkorientable</FILE>
<TITLE>Orientable</TITLE>
@@ -6277,6 +6219,10 @@ gtk_color_chooser_get_use_alpha
gtk_color_chooser_set_use_alpha
gtk_color_chooser_add_palette
<SUBSECTION>
gtk_hsv_to_rgb
gtk_rgb_to_hsv
<SUBSECTION Standard>
GTK_TYPE_COLOR_CHOOSER
GTK_COLOR_CHOOSER
@@ -6394,6 +6340,7 @@ gtk_stack_add_named
gtk_stack_add_titled
gtk_stack_get_child_by_name
gtk_stack_get_page
gtk_stack_get_pages
gtk_stack_page_get_child
gtk_stack_set_visible_child
gtk_stack_get_visible_child
@@ -6424,6 +6371,7 @@ GTK_STACK_GET_CLASS
<SUBSECTION Private>
gtk_stack_get_type
gtk_stack_page_get_type
</SECTION>
<SECTION>
@@ -6585,6 +6533,7 @@ gtk_popover_get_type
<TITLE>GtkPopoverMenu</TITLE>
GtkPopoverMenu
gtk_popover_menu_new
gtk_popover_menu_add_submenu
gtk_popover_menu_open_submenu
<SUBSECTION Standard>
@@ -6703,8 +6652,8 @@ gtk_gesture_single_get_type
<SECTION>
<FILE>gtkeventcontrollerlegacy</FILE>
<TITLE>GtkEventControllerlegacy</TITLE>
GtkEventControllerlegacy
<TITLE>GtkEventControllerLegacy</TITLE>
GtkEventControllerLegacy
gtk_event_controller_legacy_new
<SUBSECTION Standard>
@@ -6745,6 +6694,8 @@ gtk_event_controller_scroll_get_type
<TITLE>GtkEventControllerMotion</TITLE>
GtkEventControllerMotion
gtk_event_controller_motion_new
gtk_event_controller_motion_get_pointer_origin
gtk_event_controller_motion_get_pointer_target
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_MOTION
@@ -6763,6 +6714,12 @@ gtk_event_controller_motion_get_type
<TITLE>GtkEventControllerKey</TITLE>
GtkEventControllerKey
gtk_event_controller_key_new
gtk_event_controller_key_set_im_context
gtk_event_controller_key_get_im_context
gtk_event_controller_key_forward
gtk_event_controller_key_get_group
gtk_event_controller_key_get_focus_origin
gtk_event_controller_key_get_focus_target
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_KEY
@@ -7196,3 +7153,65 @@ gtk_media_stream_error_valist
GTK_TYPE_MEDIA_STREAM
gtk_media_stream_get_type
</SECTION>
<SECTION>
<FILE>gtkroot</FILE>
<TITLE>GtkRoot</TITLE>
GtkRoot
gtk_root_get_for_surface
gtk_root_get_focus
gtk_root_set_focus
<SUBSECTION>
gtk_root_install_properties
<SUBSECTION Private>
gtk_root_get_type
</SECTION>
<SECTION>
<FILE>gtklayoutmanager</FILE>
GtkLayoutManager
GtkLayoutManagerClass
gtk_layout_manager_measure
gtk_layout_manager_allocate
gtk_layout_manager_get_request_mode
gtk_layout_manager_get_widget
gtk_layout_manager_get_layout_child
gtk_layout_manager_layout_changed
<SUBSECTION Standard>
GTK_TYPE_LAYOUT_MANAGER
gtk_layout_manager_get_type
</SECTION>
<SECTION>
<FILE>gtklayoutchild</FILE>
GtkLayoutChild
GtkLayoutChildClass
gtk_layout_child_get_layout_manager
gtk_layout_child_get_child_widget
<SUBSECTION Standard>
GTK_TYPE_LAYOUT_CHILD
gtk_layout_child_get_type
</SECTION>
<SECTION>
<FILE>gtkboxlayout</FILE>
GtkBoxLayout
gtk_box_layout_new
gtk_box_layout_set_homogeneous
gtk_box_layout_get_homogeneous
gtk_box_layout_set_spacing
gtk_box_layout_get_spacing
gtk_box_layout_set_baseline_position
gtk_box_layout_get_baseline_position
<SUBSECTION Standard>
GTK_TYPE_BOX_LAYOUT
gtk_box_layout_get_type
</SECTION>

View File

@@ -137,6 +137,7 @@ gtk_radio_tool_button_get_type
gtk_range_get_type
gtk_recent_manager_get_type
gtk_revealer_get_type
gtk_root_get_type
gtk_scale_button_get_type
gtk_scale_get_type
gtk_scrollable_get_type

View File

@@ -289,6 +289,28 @@
</para>
</section>
<section>
<title>Stop using gdk_pointer_warp()</title>
<para>
Warping the pointer is disorienting and unfriendly to users.
GTK 4 does not support it. In special circumstances (such as when
implementing remote connection UIs) it can be necessary to
warp the pointer; in this case, use platform APIs such as XWarpPointer
directly.
</para>
</section>
<section>
<title>Adapt to coordinate api changes</title>
<para>
A number of coordinate apis in GTK 3 had _double variants:
gdk_device_get_position(), gdk_device_get_surface_at_position(),
gdk_surface_get_device_position(). These have been changed to use
doubles, and the _double variants have been removed. Update your
code accordingly.
</para>
</section>
<section>
<title>Adapt to GdkKeymap API changes</title>
<para>
@@ -321,12 +343,22 @@
</section>
<section>
<title>Adapt to GtkHeaderBar API changes</title>
<title>Adapt to GtkHeaderBar and GtkActionBar API changes</title>
<para>
The gtk_header_bar_set_show_close_button() function has been renamed to
the more accurate name gtk_header_bar_set_show_title_buttons(). The corresponding
getter and the property itself have also been renamed.
</para>
<para>
The ::pack-type child properties of GtkHeaderBar and GtkActionBar have
been removed. If you need to programmatically place children, use the
pack_start() and pack_end() APIs. In ui files, use the type attribute
on the child element.
</para>
<para>
gtk4-builder-tool can help with this conversion, with the --3to4 option
of the simplify command.
</para>
</section>
<section>
@@ -608,7 +640,7 @@
</section>
<section>
<title>Adapt to changes in the API of GtkEntry and GtkSearchEntry</title>
<title>Adapt to changes in the API of GtkEntry, GtkSearchEntry adn GtkSpinButton</title>
<para>
The GtkEditable has been made more useful, and the core functionality of
GtkEntry has been broken out as a GtkText widget. GtkEntry, GtkSearchEntry,
@@ -620,7 +652,8 @@
<para>
Use GtkEditable API for editable functionality, and widget-specific APIs for
things that go beyond the common interface. For password entries, use
GtkPasswordEntry.
GtkPasswordEntry. As an example, gtk_spin_button_set_max_width_chars()
has been removed in favor of gtk_editable_set_max_width_chars().
</para>
</section>

View File

@@ -47,8 +47,7 @@ this reference manual for details.
<qandaentry>
<question><para>
Where can I get help with GTK, submit a bug report, or make a feature
request?
Where can I get help with GTK, submit a bug report, or make a feature request?
</para></question>
<answer>
@@ -63,13 +62,14 @@ See the <link linkend="gtk-resources">documentation on this topic</link>.
<qandaentry>
<question><para>How do I port from one GTK
version to another?</para></question>
<question><para>
How do I port from one GTK version to another?
</para></question>
<answer>
<para>
See <xref linkend="gtk-migrating-2-to-3"/>.
See <xref linkend="migrating"/>.
You may also find useful information in the documentation for
specific widgets and functions.
</para>
@@ -88,8 +88,7 @@ against the documentation.
<qandaentry>
<question><para>
How does memory management work in GTK? Should I free data returned
from functions?
How does memory management work in GTK? Should I free data returned from functions?
</para></question>
<answer>
@@ -528,10 +527,9 @@ the call away if it appears that the value is not being used.
</para>
<para>
A common workaround for this problem is to store the result in a volatile
variable, which keeps the compiler from optimizing the call away.
GLib provides the g_type_ensure() function to work around this problem.
<informalexample><programlisting>
volatile GType dummy = GTK_TYPE_BLAH;
g_type_ensure (GTK_TYPE_BLAH);
</programlisting></informalexample>
</para>
</answer>
@@ -546,32 +544,9 @@ How do I create a transparent toplevel window ?
<answer>
<para>
To make a window transparent, it needs to use a visual which supports that.
This is done by getting the RGBA visual of the screen with
gdk_screen_get_rgba_visual() and setting it on the window. Note that
gdk_screen_get_rgba_visual() will return %NULL if transparent windows
are not supported on the screen, you should fall back to
gdk_screen_get_system_visual() in that case. Additionally, note that this
will change from screen to screen, so it needs to be repeated whenever the
window is moved to a different screen.
<informalexample><programlisting>
GdkVisual *visual;
visual = gdk_screen_get_rgba_visual (screen);
if (visual == NULL)
visual = gdk_screen_get_system_visual (screen);
gtk_widget_set_visual (GTK_WIDGET (window), visual);
</programlisting></informalexample>
To fill the alpha channel on the window simply use cairos
RGBA drawing capabilities.
</para>
<para>
Note that the presence of an RGBA visual is no guarantee that the
window will actually appear transparent on screen. On X11, this
requires a compositing manager to be running. See
gdk_display_is_composited() for a way to find out if the alpha
channel will be respected.
Any toplevel window can be transparent.
It is just a matter of setting a transparent background
in the CSS style for it.
</para>
</answer>
</qandaentry>
@@ -587,9 +562,19 @@ channel will be respected.
<answer>
<para>
See <link linkend="TreeWidget">tree widget overview</link> &mdash; you
should use the #GtkTreeView widget. (A list is just a tree with no branches,
so the tree widget is used for lists as well).
This question has different answers, depending on the size of the dataset
and the required formatting flexibility.
</para>
<para>
If you want to display a large amount of data in a uniform way, your
best option is a #GtkTreeView widget. See <link linkend="TreeWidget">tree
widget overview</link>. A list is just a tree with no branches, so the treeview
widget is used for lists as well.
</para>
<para>
If you want to display a small amount of items, but need flexible formatting
and widgetry inside the list, then you probably want to use a #GtkListBox,
which uses regular widgets for display.
</para>
</answer>
</qandaentry>
@@ -620,7 +605,11 @@ single-line text entry, see #GtkEntry.
<answer>
<para>
#GtkImage can display images in just about any format GTK understands.
GTK has two widgets that are dedicated to displaying images. #GtkImage, for
small, fixed-size icons and #GtkPicture for content images.
</para>
<para>
Both can display images in just about any format GTK understands.
You can also use #GtkDrawingArea if you need to do something more complex,
such as draw text or graphics over the top of the image.
</para>
@@ -653,9 +642,10 @@ How do I change the color of a widget?
</para></question>
<answer><para>
See gtk_widget_override_color() and gtk_widget_override_background_color().
You can also change the appearance of a widget by installing a
custom style provider, see gtk_style_context_add_provider().
The background color of a widget is determined by the CSS style that applies
to it. To change that, you can set style classes on the widget, and provide
custom CSS to change the appearance. Such CSS can be loaded with
gtk_css_provider_load_from_file() and its variants. See gtk_style_context_add_provider().
</para></answer>
</qandaentry>
@@ -665,16 +655,6 @@ How do I change the font of a widget?
</para></question>
<answer><para>
This has several possible answers, depending on what exactly you want to
achieve. One option is gtk_widget_override_font().
<informalexample><programlisting>
PangoFontDesc *font_desc = pango_font_description_new (<!-- -->);
pango_font_description_set_size (font_desc, 40);
gtk_widget_override_font (widget, font);
pango_font_description_free (font_desc);
</programlisting></informalexample>
</para>
<para>
If you want to make the text of a label larger, you can use
gtk_label_set_markup():
<informalexample><programlisting>
@@ -939,32 +919,28 @@ How do I use cairo to draw in GTK applications ?
</para></question>
<answer><para>
The #GtkWidget::draw signal gets a ready-to-use cairo context
as parameter that you should use.
</para>
<para>
All drawing in GTK is normally done in a draw handler, and GTK
creates a temporary pixmap for double-buffering the drawing.
It is possible to turn off double-buffering, with
gtk_widget_set_double_buffered(), but this is not ideal,
since it can cause some flickering.
Use gtk_snapshot_append_cairo() in your #GtkWidget::snapshot signal handler
to optain a cairo context and draw with that.
</para>
</answer>
</qandaentry>
<qandaentry>
<question><para>
Can I improve the performance of my application by using the
Glitz or GL backend of cairo ?
Can I improve the performance of my application by using another backend
of cairo (such as GL) ?
</para></question>
<answer><para>
No. The GDK X11 backend uses the cairo X backend (and the other
GDK backends use their respective native cairo backends). The
GTK developers believe that the best way to improving the GDK
drawing performance is to optimize the cairo X backend and the
relevant code paths in the X server that is uses (mostly the
Render extension).
No. Most drawing in GTK is not done via cairo anymore (but instead
by the GL or Vulkan renderers of GSK).
</para>
<para>
If you use cairo for drawing your own widgets, gtk_snapshot_append_cairo()
will choose the most appropriate surface type for you.
</para>
<para>
If you are interested in using GL for your own drawing, see #GtkGLArea.
</para></answer>
</qandaentry>
@@ -974,8 +950,11 @@ Can I use cairo to draw on a #GdkPixbuf ?
</para></question>
<answer><para>
No, at least not yet. The cairo image surface does not support the
pixel format used by GdkPixbuf.
No. The cairo image surface does not support the pixel format used by GdkPixbuf.
</para>
<para>
If you need to get cairo drawing into a format that can be displayed efficiently
by GTK, you may want to use an image surface and gdk_memory_texture_new().
</para></answer>
</qandaentry>

View File

@@ -150,11 +150,8 @@ see for example <link
linkend="gtk-window-iconify">gtk_window_iconify()</link> or <link
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
Keep in mind that <link
linkend="gtk-window-move">gtk_window_move()</link> and window sizing
are ultimately controlled by the window manager as well and most
window managers <emphasis>will</emphasis> ignore certain requests from
time to time, in the interests of good user interface.
Keep in mind that most window managers <emphasis>will</emphasis> ignore
certain requests from time to time, in the interests of good user interface.
</para>
<!--

View File

@@ -226,7 +226,7 @@ create_entry (void)
widget = gtk_entry_new ();
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_entry_set_text (GTK_ENTRY (widget), "Entry");
gtk_editable_set_text (GTK_EDITABLE (widget), "Entry");
gtk_editable_set_position (GTK_EDITABLE (widget), -1);
return new_widget_info ("entry", widget, SMALL);
@@ -320,7 +320,7 @@ create_combo_box_entry (void)
g_object_unref (model);
child = gtk_bin_get_child (GTK_BIN (widget));
gtk_entry_set_text (GTK_ENTRY (child), "Combo Box Entry");
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
@@ -399,7 +399,7 @@ create_search_bar (void)
widget = gtk_search_bar_new ();
entry = gtk_search_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "Search Bar");
gtk_editable_set_text (GTK_EDITABLE (entry), "Search Bar");
gtk_container_add (GTK_CONTAINER (widget), entry);
gtk_widget_show (entry);

View File

@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
@@ -58,7 +58,7 @@ find_word (GtkButton *button,
const gchar *word;
word = gtk_button_get_label (button);
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void

View File

@@ -22,25 +22,21 @@
<property name="stack">stack</property>
</object>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkMenuButton" id="gears">
<property name="direction">none</property>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
</object>
</child>

View File

@@ -25,7 +25,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;

View File

@@ -13,14 +13,12 @@
<property name="stack">stack</property>
</object>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
</object>
</child>

View File

@@ -29,7 +29,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
@@ -56,7 +56,7 @@ find_word (GtkButton *button,
const gchar *word;
word = gtk_button_get_label (button);
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void

View File

@@ -13,25 +13,21 @@
<property name="stack">stack</property>
</object>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkMenuButton" id="gears">
<property name="direction">none</property>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
</object>
</child>

View File

@@ -31,7 +31,7 @@ search_text_changed (GtkEntry *entry,
GtkTextBuffer *buffer;
GtkTextIter start, match_start, match_end;
text = gtk_entry_get_text (entry);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
if (text[0] == '\0')
return;
@@ -58,7 +58,7 @@ find_word (GtkButton *button,
const gchar *word;
word = gtk_button_get_label (button);
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
gtk_editable_set_text (GTK_EDITABLE (win->searchentry), word);
}
static void

View File

@@ -24,25 +24,21 @@
<property name="stack">stack</property>
</object>
</child>
<child>
<child type="end">
<object class="GtkToggleButton" id="search">
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
<child>
<child type="end">
<object class="GtkMenuButton" id="gears">
<property name="direction">none</property>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
<packing/>
</child>
</object>
</child>

View File

@@ -364,7 +364,7 @@ combo_changed (GtkComboBox *combo,
str = g_strjoinv (",", accels);
g_strfreev (accels);
gtk_entry_set_text (entry, str);
gtk_editable_set_text (GTK_EDITABLE (entry), str);
}
static void
@@ -389,7 +389,7 @@ response (GtkDialog *dialog,
if (!action)
return;
str = gtk_entry_get_text (entry);
str = gtk_editable_get_text (GTK_EDITABLE (entry));
accels = g_strsplit (str, ",", 0);
gtk_application_set_accels_for_action (gtk_window_get_application (user_data), action, (const gchar **) accels);

View File

@@ -22,6 +22,9 @@ typedef enum { /* Sync changes with broadway.js */
BROADWAY_NODE_CLIP = 10,
BROADWAY_NODE_KEEP_ALL = 11,
BROADWAY_NODE_KEEP_THIS = 12,
BROADWAY_NODE_TRANSFORM = 13,
BROADWAY_NODE_DEBUG = 14,
BROADWAY_NODE_REUSE = 15,
} BroadwayNodeType;
static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
@@ -38,6 +41,8 @@ static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
"CLIP",
"KEEP_ALL",
"KEEP_THIS",
"TRANSLATE",
"DEBUG",
};
typedef enum {

View File

@@ -35,7 +35,6 @@
#include <string.h>
#endif
typedef struct {
int id;
guint32 tag;
@@ -126,23 +125,56 @@ struct BroadwaySurface {
gint32 transient_for;
guint32 texture;
BroadwayNode *nodes;
GHashTable *node_lookup;
};
struct _BroadwayTexture {
grefcount refcount;
guint32 id;
GBytes *bytes;
};
static void broadway_server_resync_surfaces (BroadwayServer *server);
static void send_outstanding_roundtrips (BroadwayServer *server);
static void broadway_server_ref_texture (BroadwayServer *server,
guint32 id);
static GType broadway_server_get_type (void);
G_DEFINE_TYPE (BroadwayServer, broadway_server, G_TYPE_OBJECT)
static void
broadway_node_free (BroadwayNode *node)
broadway_texture_free (BroadwayTexture *texture)
{
g_bytes_unref (texture->bytes);
g_free (texture);
}
static void
broadway_node_unref (BroadwayServer *server,
BroadwayNode *node)
{
int i;
for (i = 0; i < node->n_children; i++)
broadway_node_free (node->children[i]);
g_free (node);
if (g_ref_count_dec (&node->refcount))
{
for (i = 0; i < node->n_children; i++)
broadway_node_unref (server, node->children[i]);
if (node->texture_id)
broadway_server_release_texture (server, node->texture_id);
g_free (node);
}
}
static BroadwayNode *
broadway_node_ref (BroadwayNode *node)
{
g_ref_count_inc (&node->refcount);
return node;
}
gboolean
@@ -204,7 +236,7 @@ broadway_server_init (BroadwayServer *server)
server->surface_id_hash = g_hash_table_new (NULL, NULL);
server->id_counter = 0;
server->textures = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
(GDestroyNotify)g_bytes_unref);
(GDestroyNotify)broadway_texture_free);
root = g_new0 (BroadwaySurface, 1);
root->id = server->id_counter++;
@@ -241,10 +273,12 @@ broadway_server_class_init (BroadwayServerClass * class)
}
static void
broadway_surface_free (BroadwaySurface *surface)
broadway_surface_free (BroadwayServer *server,
BroadwaySurface *surface)
{
if (surface->nodes)
broadway_node_free (surface->nodes);
broadway_node_unref (server, surface->nodes);
g_hash_table_unref (surface->node_lookup);
g_free (surface);
}
@@ -1477,7 +1511,7 @@ broadway_server_destroy_surface (BroadwayServer *server,
server->surfaces = g_list_remove (server->surfaces, surface);
g_hash_table_remove (server->surface_id_hash,
GINT_TO_POINTER (id));
broadway_surface_free (surface);
broadway_surface_free (server, surface);
}
}
@@ -1605,53 +1639,242 @@ broadway_server_has_client (BroadwayServer *server)
return server->output != NULL;
}
#define NODE_SIZE_COLOR 1
#define NODE_SIZE_FLOAT 1
#define NODE_SIZE_POINT 2
#define NODE_SIZE_MATRIX 16
#define NODE_SIZE_SIZE 2
#define NODE_SIZE_RECT (NODE_SIZE_POINT + NODE_SIZE_SIZE)
#define NODE_SIZE_RRECT (NODE_SIZE_RECT + 4 * NODE_SIZE_SIZE)
#define NODE_SIZE_COLOR_STOP (NODE_SIZE_FLOAT + NODE_SIZE_COLOR)
#define NODE_SIZE_SHADOW (NODE_SIZE_COLOR + 3 * NODE_SIZE_FLOAT)
static guint32
rotl (guint32 value, int shift)
{
if ((shift &= 32 - 1) == 0)
return value;
return (value << shift) | (value >> (32 - shift));
}
static BroadwayNode *
decode_nodes (BroadwayServer *server,
BroadwaySurface *surface,
int len,
guint32 data[],
GHashTable *client_texture_map,
int *pos)
{
BroadwayNode *node;
guint32 type, id;
guint32 i, n_stops, n_shadows, n_chars;
guint32 size, n_children;
gint32 texture_offset;
guint32 hash;
guint32 transform_type;
g_assert (*pos < len);
size = 0;
n_children = 0;
texture_offset = -1;
type = data[(*pos)++];
id = data[(*pos)++];
switch (type) {
case BROADWAY_NODE_REUSE:
node = g_hash_table_lookup (surface->node_lookup, GINT_TO_POINTER(id));
g_assert (node != NULL);
return broadway_node_ref (node);
break;
case BROADWAY_NODE_COLOR:
size = NODE_SIZE_RECT + NODE_SIZE_COLOR;
break;
case BROADWAY_NODE_BORDER:
size = NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR;
break;
case BROADWAY_NODE_INSET_SHADOW:
case BROADWAY_NODE_OUTSET_SHADOW:
size = NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_FLOAT;
break;
case BROADWAY_NODE_TEXTURE:
texture_offset = 4;
size = 5;
break;
case BROADWAY_NODE_CONTAINER:
size = 1;
n_children = data[*pos];
break;
case BROADWAY_NODE_ROUNDED_CLIP:
size = NODE_SIZE_RRECT;
n_children = 1;
break;
case BROADWAY_NODE_CLIP:
size = NODE_SIZE_RECT;
n_children = 1;
break;
case BROADWAY_NODE_TRANSFORM:
transform_type = data[(*pos)];
size = 1;
if (transform_type == 0) {
size += NODE_SIZE_POINT;
} else if (transform_type == 1) {
size += NODE_SIZE_MATRIX;
} else {
g_assert_not_reached();
}
n_children = 1;
break;
case BROADWAY_NODE_LINEAR_GRADIENT:
size = NODE_SIZE_RECT + 2 * NODE_SIZE_POINT;
n_stops = data[*pos + size++];
size += n_stops * NODE_SIZE_COLOR_STOP;
break;
case BROADWAY_NODE_SHADOW:
size = 1;
n_shadows = data[*pos];
size += n_shadows * NODE_SIZE_SHADOW;
n_children = 1;
break;
case BROADWAY_NODE_OPACITY:
size = NODE_SIZE_FLOAT;
n_children = 1;
break;
case BROADWAY_NODE_DEBUG:
n_chars = data[*pos];
size = 1 + (n_chars + 3) / 4;
n_children = 1;
break;
default:
g_assert_not_reached ();
}
node = g_malloc (sizeof(BroadwayNode) + (size - 1) * sizeof(guint32) + n_children * sizeof (BroadwayNode *));
g_ref_count_init (&node->refcount);
node->type = type;
node->id = id;
node->texture_id = 0;
node->n_children = n_children;
node->children = (BroadwayNode **)((char *)node + sizeof(BroadwayNode) + (size - 1) * sizeof(guint32));
node->n_data = size;
for (i = 0; i < size; i++)
{
node->data[i] = data[(*pos)++];
if (i == texture_offset)
{
node->texture_id = GPOINTER_TO_INT (g_hash_table_lookup (client_texture_map, GINT_TO_POINTER (node->data[i])));
broadway_server_ref_texture (server, node->texture_id);
node->data[i] = node->texture_id;
}
}
for (i = 0; i < n_children; i++)
node->children[i] = decode_nodes (server, surface, len, data, client_texture_map, pos);
hash = node->type << 16;
for (i = 0; i < size; i++)
hash ^= rotl (node->data[i], i);
for (i = 0; i < n_children; i++)
hash ^= rotl (node->children[i]->hash, i);
node->hash = hash;
return node;
}
static void
init_node_lookup (BroadwaySurface *surface,
BroadwayNode *node)
{
int i;
g_hash_table_insert (surface->node_lookup, GINT_TO_POINTER(node->id), node);
for (i = 0; i < node->n_children; i++)
init_node_lookup (surface, node->children[i]);
}
/* passes ownership of nodes */
void
broadway_server_surface_set_nodes (BroadwayServer *server,
gint id,
BroadwayNode *root)
broadway_server_surface_update_nodes (BroadwayServer *server,
gint id,
guint32 data[],
int len,
GHashTable *client_texture_map)
{
BroadwaySurface *surface;
int pos = 0;
BroadwayNode *root;
surface = broadway_server_lookup_surface (server, id);
if (surface == NULL)
return;
root = decode_nodes (server, surface, len, data, client_texture_map, &pos);
if (server->output != NULL)
broadway_output_surface_set_nodes (server->output, surface->id,
root,
surface->nodes);
if (surface->nodes)
broadway_node_free (surface->nodes);
broadway_node_unref (server, surface->nodes);
surface->nodes = root;
g_hash_table_remove_all (surface->node_lookup);
init_node_lookup (surface, surface->nodes);
}
guint32
broadway_server_upload_texture (BroadwayServer *server,
GBytes *texture)
GBytes *bytes)
{
guint32 id;
BroadwayTexture *texture;
texture = g_new0 (BroadwayTexture, 1);
g_ref_count_init (&texture->refcount);
texture->id = ++server->next_texture_id;
texture->bytes = g_bytes_ref (bytes);
id = ++server->next_texture_id;
g_hash_table_replace (server->textures,
GINT_TO_POINTER (id),
g_bytes_ref (texture));
GINT_TO_POINTER (texture->id),
texture);
if (server->output)
broadway_output_upload_texture (server->output, id, texture);
broadway_output_upload_texture (server->output, texture->id, texture->bytes);
return id;
return texture->id;
}
static void
broadway_server_ref_texture (BroadwayServer *server,
guint32 id)
{
BroadwayTexture *texture;
texture = g_hash_table_lookup (server->textures, GINT_TO_POINTER (id));
if (texture)
g_ref_count_inc (&texture->refcount);
}
void
broadway_server_release_texture (BroadwayServer *server,
guint32 id)
{
g_hash_table_remove (server->textures, GINT_TO_POINTER (id));
BroadwayTexture *texture;
if (server->output)
broadway_output_release_texture (server->output, id);
texture = g_hash_table_lookup (server->textures, GINT_TO_POINTER (id));
if (texture && g_ref_count_dec (&texture->refcount))
{
g_hash_table_remove (server->textures, GINT_TO_POINTER (id));
if (server->output)
broadway_output_release_texture (server->output, id);
}
}
gboolean
@@ -1801,6 +2024,7 @@ broadway_server_new_surface (BroadwayServer *server,
surface->width = width;
surface->height = height;
surface->is_temp = is_temp;
surface->node_lookup = g_hash_table_new (g_direct_hash, g_direct_equal);
g_hash_table_insert (server->surface_id_hash,
GINT_TO_POINTER (surface->id),
@@ -1835,9 +2059,12 @@ broadway_server_resync_surfaces (BroadwayServer *server)
/* First upload all textures */
g_hash_table_iter_init (&iter, server->textures);
while (g_hash_table_iter_next (&iter, &key, &value))
broadway_output_upload_texture (server->output,
GPOINTER_TO_INT (key),
(GBytes *)value);
{
BroadwayTexture *texture = value;
broadway_output_upload_texture (server->output,
GPOINTER_TO_INT (key),
texture->bytes);
}
/* Then create all surfaces */
for (l = server->surfaces; l != NULL; l = l->next)

View File

@@ -19,12 +19,16 @@ typedef struct _BroadwayServerClass BroadwayServerClass;
#define BROADWAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BROADWAY_TYPE_SERVER, BroadwayServerClass))
typedef struct _BroadwayNode BroadwayNode;
typedef struct _BroadwayTexture BroadwayTexture;
struct _BroadwayNode {
grefcount refcount;
guint32 type;
guint32 id;
guint32 hash; /* deep hash */
guint32 n_children;
BroadwayNode **children;
guint32 texture_id;
guint32 n_data;
guint32 data[1];
};
@@ -99,9 +103,11 @@ void broadway_server_release_texture (BroadwayServer *
guint32 id);
cairo_surface_t * broadway_server_create_surface (int width,
int height);
void broadway_server_surface_set_nodes (BroadwayServer *server,
void broadway_server_surface_update_nodes (BroadwayServer *server,
gint id,
BroadwayNode *root);
guint32 data[],
int len,
GHashTable *client_texture_map);
gboolean broadway_server_surface_move_resize (BroadwayServer *server,
gint id,
gboolean with_move,

File diff suppressed because it is too large Load Diff

View File

@@ -215,116 +215,6 @@ get_client_serial (BroadwayClient *client, guint32 daemon_serial)
return client_serial;
}
#define NODE_SIZE_COLOR 1
#define NODE_SIZE_FLOAT 1
#define NODE_SIZE_POINT 2
#define NODE_SIZE_SIZE 2
#define NODE_SIZE_RECT (NODE_SIZE_POINT + NODE_SIZE_SIZE)
#define NODE_SIZE_RRECT (NODE_SIZE_RECT + 4 * NODE_SIZE_SIZE)
#define NODE_SIZE_COLOR_STOP (NODE_SIZE_FLOAT + NODE_SIZE_COLOR)
#define NODE_SIZE_SHADOW (NODE_SIZE_COLOR + 3 * NODE_SIZE_FLOAT)
static guint32
rotl (guint32 value, int shift)
{
if ((shift &= 32 - 1) == 0)
return value;
return (value << shift) | (value >> (32 - shift));
}
static BroadwayNode *
decode_nodes (BroadwayClient *client,
int len, guint32 data[], int *pos)
{
BroadwayNode *node;
guint32 type;
guint32 i, n_stops, n_shadows;
guint32 size, n_children;
gint32 texture_offset;
guint32 hash;
g_assert (*pos < len);
size = 0;
n_children = 0;
texture_offset = -1;
type = data[(*pos)++];
switch (type) {
case BROADWAY_NODE_COLOR:
size = NODE_SIZE_RECT + NODE_SIZE_COLOR;
break;
case BROADWAY_NODE_BORDER:
size = NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR;
break;
case BROADWAY_NODE_INSET_SHADOW:
case BROADWAY_NODE_OUTSET_SHADOW:
size = NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_FLOAT;
break;
case BROADWAY_NODE_TEXTURE:
texture_offset = 4;
size = 5;
break;
case BROADWAY_NODE_CONTAINER:
size = 1;
n_children = data[*pos];
break;
case BROADWAY_NODE_ROUNDED_CLIP:
size = NODE_SIZE_RRECT;
n_children = 1;
break;
case BROADWAY_NODE_CLIP:
size = NODE_SIZE_RECT;
n_children = 1;
break;
case BROADWAY_NODE_LINEAR_GRADIENT:
size = NODE_SIZE_RECT + 2 * NODE_SIZE_POINT;
n_stops = data[*pos + size++];
size += n_stops * NODE_SIZE_COLOR_STOP;
break;
case BROADWAY_NODE_SHADOW:
size = 1;
n_shadows = data[*pos];
size += n_shadows * NODE_SIZE_SHADOW;
n_children = 1;
break;
case BROADWAY_NODE_OPACITY:
size = NODE_SIZE_FLOAT;
n_children = 1;
break;
default:
g_assert_not_reached ();
}
node = g_malloc (sizeof(BroadwayNode) + (size - 1) * sizeof(guint32) + n_children * sizeof (BroadwayNode *));
node->type = type;
node->n_children = n_children;
node->children = (BroadwayNode **)((char *)node + sizeof(BroadwayNode) + (size - 1) * sizeof(guint32));
node->n_data = size;
for (i = 0; i < size; i++)
{
node->data[i] = data[(*pos)++];
if (i == texture_offset)
node->data[i] = GPOINTER_TO_INT (g_hash_table_lookup (client->textures,
GINT_TO_POINTER (node->data[i])));
}
for (i = 0; i < n_children; i++)
node->children[i] = decode_nodes (client, len, data, pos);
hash = node->type << 16;
for (i = 0; i < size; i++)
hash ^= rotl (node->data[i], i);
for (i = 0; i < n_children; i++)
hash ^= rotl (node->children[i]->hash, i);
node->hash = hash;
return node;
}
static void
client_handle_request (BroadwayClient *client,
BroadwayRequest *request)
@@ -400,13 +290,10 @@ client_handle_request (BroadwayClient *client,
{
gsize array_size = request->base.size - sizeof (BroadwayRequestSetNodes) + sizeof(guint32);
int n_data = array_size / sizeof(guint32);
int pos = 0;
BroadwayNode *node;
node = decode_nodes (client, n_data, request->set_nodes.data, &pos);
broadway_server_surface_set_nodes (server, request->set_nodes.id,
node);
broadway_server_surface_update_nodes (server, request->set_nodes.id,
request->set_nodes.data, n_data,
client->textures);
}
break;
case BROADWAY_REQUEST_UPLOAD_TEXTURE:

View File

@@ -36,9 +36,6 @@ static void gdk_broadway_device_get_state (GdkDevice *device,
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
static void gdk_broadway_device_warp (GdkDevice *device,
gdouble x,
gdouble y);
static void gdk_broadway_device_query_state (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,
@@ -73,7 +70,6 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
device_class->get_history = gdk_broadway_device_get_history;
device_class->get_state = gdk_broadway_device_get_state;
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
device_class->warp = gdk_broadway_device_warp;
device_class->query_state = gdk_broadway_device_query_state;
device_class->grab = gdk_broadway_device_grab;
device_class->ungrab = gdk_broadway_device_ungrab;
@@ -110,7 +106,7 @@ gdk_broadway_device_get_state (GdkDevice *device,
{
gdouble x, y;
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{
@@ -126,13 +122,6 @@ gdk_broadway_device_set_surface_cursor (GdkDevice *device,
{
}
static void
gdk_broadway_device_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
}
static void
gdk_broadway_device_query_state (GdkDevice *device,
GdkSurface *surface,

View File

@@ -380,7 +380,7 @@ gdk_broadway_display_ensure_texture (GdkDisplay *display,
data = g_new0 (BroadwayTextureData, 1);
data->id = id;
data->display = g_object_ref (display);
g_object_set_data_full (G_OBJECT (texture), "broadway-data", data, (GDestroyNotify)broadway_texture_data_free);
g_object_set_data_full (G_OBJECT (texture), "broadway-data", data, (GDestroyNotify)broadway_texture_data_free);
}
return data->id;

View File

@@ -64,6 +64,8 @@ gdk_broadway_draw_context_end_frame (GdkDrawContext *draw_context,
g_array_unref (self->nodes);
self->nodes = NULL;
/* We now sent all new texture refs to the daemon via the nodes, so we can drop them here */
g_ptr_array_unref (self->node_textures);
self->node_textures = NULL;
}

View File

@@ -501,12 +501,6 @@ gdk_broadway_surface_set_title (GdkSurface *surface,
{
}
static void
gdk_broadway_surface_set_role (GdkSurface *surface,
const gchar *role)
{
}
static void
gdk_broadway_surface_set_startup_id (GdkSurface *surface,
const gchar *startup_id)
@@ -1232,6 +1226,9 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
mv_resize = get_move_resize_data (gdk_surface_get_display (surface), TRUE);
if (mv_resize->moveresize_surface != NULL)
return; /* already a drag operation in progress */
mv_resize->is_resize = TRUE;
mv_resize->moveresize_button = button;
mv_resize->resize_edge = edge;
@@ -1272,6 +1269,9 @@ gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
mv_resize = get_move_resize_data (gdk_surface_get_display (surface), TRUE);
if (mv_resize->moveresize_surface != NULL)
return; /* already a drag operation in progress */
mv_resize->is_resize = FALSE;
mv_resize->moveresize_button = button;
mv_resize->moveresize_x = root_x;
@@ -1352,7 +1352,6 @@ gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass)
impl_class->set_urgency_hint = gdk_broadway_surface_set_urgency_hint;
impl_class->set_geometry_hints = gdk_broadway_surface_set_geometry_hints;
impl_class->set_title = gdk_broadway_surface_set_title;
impl_class->set_role = gdk_broadway_surface_set_role;
impl_class->set_startup_id = gdk_broadway_surface_set_startup_id;
impl_class->set_transient_for = gdk_broadway_surface_set_transient_for;
impl_class->get_frame_extents = gdk_broadway_surface_get_frame_extents;

View File

@@ -20,8 +20,6 @@ void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
GObject * gdk_event_get_user_data (const GdkEvent *event);
guint32 gdk_display_get_last_seen_time (GdkDisplay *display);
void gdk_display_set_double_click_time (GdkDisplay *display,
@@ -40,4 +38,8 @@ PangoDirection gdk_unichar_direction (gunichar ch);
PangoDirection gdk_find_base_dir (const char *text,
int len);
void gdk_surface_set_widget (GdkSurface *surface,
gpointer widget);
gpointer gdk_surface_get_widget (GdkSurface *surface);
#endif /* __GDK__PRIVATE_H__ */

View File

@@ -33,6 +33,8 @@
#include "gdk-private.h"
#include "gdkconstructor.h"
#ifndef HAVE_XCONVERTCASE
#include "gdkkeysyms.h"
#endif
@@ -51,12 +53,12 @@
* This section describes the GDK initialization functions and miscellaneous
* utility functions, as well as deprecation facilities.
*
* The GDK and GTK+ headers annotate deprecated APIs in a way that produces
* The GDK and GTK headers annotate deprecated APIs in a way that produces
* compiler warnings if these deprecated APIs are used. The warnings
* can be turned off by defining the macro %GDK_DISABLE_DEPRECATION_WARNINGS
* before including the glib.h header.
*
* GDK and GTK+ also provide support for building applications against
* GDK and GTK also provide support for building applications against
* defined subsets of deprecated or new APIs. Define the macro
* %GDK_VERSION_MIN_REQUIRED to specify up to what version
* you want to receive warnings about deprecated APIs. Define the
@@ -108,14 +110,6 @@
* of deprecated GDK APIs.
*/
typedef struct _GdkPredicate GdkPredicate;
struct _GdkPredicate
{
GdkEventFunc func;
gpointer data;
};
typedef struct _GdkThreadsDispatch GdkThreadsDispatch;
struct _GdkThreadsDispatch
@@ -307,11 +301,11 @@ gdk_should_use_portal (void)
* locked for performance reasons. So e.g. you must coordinate
* accesses to the same #GHashTable from multiple threads.
*
* GTK+, however, is not thread safe. You should only use GTK+ and GDK
* GTK, however, is not thread safe. You should only use GTK and GDK
* from the thread gtk_init() and gtk_main() were called on.
* This is usually referred to as the “main thread”.
*
* Signals on GTK+ and GDK types, as well as non-signal callbacks, are
* Signals on GTK and GDK types, as well as non-signal callbacks, are
* emitted in the main thread.
*
* You can schedule work in the main thread safely from other threads

View File

@@ -30,7 +30,7 @@
*
* [Cairo](http://cairographics.org) is a graphics
* library that supports vector graphics and image compositing that
* can be used with GDK. GTK+ does all of its drawing using cairo.
* can be used with GDK and GTK.
*
* GDK does not wrap the cairo API, instead it allows to create cairo
* contexts which can be used to draw on #GdkSurfaces. Additional

120
gdk/gdkconstructor.h Normal file
View File

@@ -0,0 +1,120 @@
/*
If G_HAS_CONSTRUCTORS is true then the compiler support *both* constructors and
destructors, in a sane way, including e.g. on library unload. If not you're on
your own.
Some compilers need #pragma to handle this, which does not work with macros,
so the way you need to use this is (for constructors):
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(my_constructor)
#endif
G_DEFINE_CONSTRUCTOR(my_constructor)
static void my_constructor(void) {
...
}
*/
#ifndef __GTK_DOC_IGNORE__
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
#define G_HAS_CONSTRUCTORS 1
#define G_DEFINE_CONSTRUCTOR(_func) static void __attribute__((constructor)) _func (void);
#define G_DEFINE_DESTRUCTOR(_func) static void __attribute__((destructor)) _func (void);
#elif defined (_MSC_VER) && (_MSC_VER >= 1500)
/* Visual studio 2008 and later has _Pragma */
#define G_HAS_CONSTRUCTORS 1
/* We do some weird things to avoid the constructors being optimized
* away on VS2015 if WholeProgramOptimization is enabled. First we
* make a reference to the array from the wrapper to make sure its
* references. Then we use a pragma to make sure the wrapper function
* symbol is always included at the link stage. Also, the symbols
* need to be extern (but not dllexport), even though they are not
* really used from another object file.
*/
/* We need to account for differences between the mangling of symbols
* for Win32 (x86) and x64 programs, as symbols on Win32 are prefixed
* with an underscore but symbols on x64 are not.
*/
#ifdef _WIN64
#define G_MSVC_SYMBOL_PREFIX ""
#else
#define G_MSVC_SYMBOL_PREFIX "_"
#endif
#define G_DEFINE_CONSTRUCTOR(_func) G_MSVC_CTOR (_func, G_MSVC_SYMBOL_PREFIX)
#define G_DEFINE_DESTRUCTOR(_func) G_MSVC_DTOR (_func, G_MSVC_SYMBOL_PREFIX)
#define G_MSVC_CTOR(_func,_sym_prefix) \
static void _func(void); \
extern int (* _array ## _func)(void); \
int _func ## _wrapper(void) { _func(); g_slist_find (NULL, _array ## _func); return 0; } \
__pragma(comment(linker,"/include:" _sym_prefix # _func "_wrapper")) \
__pragma(section(".CRT$XCU",read)) \
__declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _wrapper;
#define G_MSVC_DTOR(_func,_sym_prefix) \
static void _func(void); \
extern int (* _array ## _func)(void); \
int _func ## _constructor(void) { atexit (_func); g_slist_find (NULL, _array ## _func); return 0; } \
__pragma(comment(linker,"/include:" _sym_prefix # _func "_constructor")) \
__pragma(section(".CRT$XCU",read)) \
__declspec(allocate(".CRT$XCU")) int (* _array ## _func)(void) = _func ## _constructor;
#elif defined (_MSC_VER)
#define G_HAS_CONSTRUCTORS 1
/* Pre Visual studio 2008 must use #pragma section */
#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
section(".CRT$XCU",read)
#define G_DEFINE_CONSTRUCTOR(_func) \
static void _func(void); \
static int _func ## _wrapper(void) { _func(); return 0; } \
__declspec(allocate(".CRT$XCU")) static int (*p)(void) = _func ## _wrapper;
#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
section(".CRT$XCU",read)
#define G_DEFINE_DESTRUCTOR(_func) \
static void _func(void); \
static int _func ## _constructor(void) { atexit (_func); return 0; } \
__declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
#elif defined(__SUNPRO_C)
/* This is not tested, but i believe it should work, based on:
* http://opensource.apple.com/source/OpenSSL098/OpenSSL098-35/src/fips/fips_premain.c
*/
#define G_HAS_CONSTRUCTORS 1
#define G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA 1
#define G_DEFINE_DESTRUCTOR_NEEDS_PRAGMA 1
#define G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(_func) \
init(_func)
#define G_DEFINE_CONSTRUCTOR(_func) \
static void _func(void);
#define G_DEFINE_DESTRUCTOR_PRAGMA_ARGS(_func) \
fini(_func)
#define G_DEFINE_DESTRUCTOR(_func) \
static void _func(void);
#else
/* constructors not supported for this compiler */
#endif
#endif /* __GTK_DOC_IGNORE__ */

View File

@@ -529,7 +529,7 @@ gdk_device_get_state (GdkDevice *device,
}
/**
* gdk_device_get_position_double:
* gdk_device_get_position:
* @device: pointer device to query status about.
* @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
* @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
@@ -540,9 +540,9 @@ gdk_device_get_state (GdkDevice *device,
* unless there is an ongoing grab on them. See gdk_device_grab().
**/
void
gdk_device_get_position_double (GdkDevice *device,
gdouble *x,
gdouble *y)
gdk_device_get_position (GdkDevice *device,
double *x,
double *y)
{
GdkDisplay *display;
gdouble tmp_x, tmp_y;
@@ -568,33 +568,7 @@ gdk_device_get_position_double (GdkDevice *device,
}
/**
* gdk_device_get_position:
* @device: pointer device to query status about.
* @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
* @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
*
* Gets the current location of @device. As a slave device
* coordinates are those of its master pointer, This function
* may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
* unless there is an ongoing grab on them, see gdk_device_grab().
**/
void
gdk_device_get_position (GdkDevice *device,
gint *x,
gint *y)
{
gdouble tmp_x, tmp_y;
gdk_device_get_position_double (device, &tmp_x, &tmp_y);
if (x)
*x = round (tmp_x);
if (y)
*y = round (tmp_y);
}
/**
* gdk_device_get_surface_at_position_double:
* gdk_device_get_surface_at_position:
* @device: pointer #GdkDevice to query info to.
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
* relative to the surface origin, or %NULL.
@@ -613,9 +587,9 @@ gdk_device_get_position (GdkDevice *device,
* device position, or %NULL.
**/
GdkSurface *
gdk_device_get_surface_at_position_double (GdkDevice *device,
gdouble *win_x,
gdouble *win_y)
gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y)
{
gdouble tmp_x, tmp_y;
GdkSurface *surface;
@@ -642,43 +616,6 @@ gdk_device_get_surface_at_position_double (GdkDevice *device,
return surface;
}
/**
* gdk_device_get_surface_at_position:
* @device: pointer #GdkDevice to query info to.
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
* relative to the surface origin, or %NULL.
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
* relative to the surface origin, or %NULL.
*
* Obtains the surface underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the surface tree under @device is not known to GDK (for example, belongs to another application).
*
* As a slave device coordinates are those of its master pointer, This
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
* unless there is an ongoing grab on them, see gdk_device_grab().
*
* Returns: (nullable) (transfer none): the #GdkSurface under the
* device position, or %NULL.
**/
GdkSurface *
gdk_device_get_surface_at_position (GdkDevice *device,
gint *win_x,
gint *win_y)
{
gdouble tmp_x, tmp_y;
GdkSurface *surface;
surface =
gdk_device_get_surface_at_position_double (device, &tmp_x, &tmp_y);
if (win_x)
*win_x = round (tmp_x);
if (win_y)
*win_y = round (tmp_y);
return surface;
}
/**
* gdk_device_get_history: (skip)
* @device: a #GdkDevice
@@ -1425,34 +1362,6 @@ gdk_device_ungrab (GdkDevice *device,
GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_);
}
/**
* gdk_device_warp:
* @device: the device to warp.
* @x: the X coordinate of the destination.
* @y: the Y coordinate of the destination.
*
* Warps @device in @display to the point @x,@y,
* unless the device is confined to a surface by a grab,
* in which case it will be moved
* as far as allowed by the grab. Warping the pointer
* creates events as if the user had moved the mouse
* instantaneously to the destination.
*
* Note that the pointer should normally be under the
* control of the user. This function was added to cover
* some rare use cases like keyboard navigation support
* for the color picker in the #GtkColorSelectionDialog.
**/
void
gdk_device_warp (GdkDevice *device,
gint x,
gint y)
{
g_return_if_fail (GDK_IS_DEVICE (device));
GDK_DEVICE_GET_CLASS (device)->warp (device, x, y);
}
/* Private API */
void
_gdk_device_reset_axes (GdkDevice *device)

View File

@@ -167,25 +167,13 @@ void gdk_device_get_state (GdkDevice *device,
gdouble *axes,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
void gdk_device_get_position (GdkDevice *device,
gint *x,
gint *y);
void gdk_device_get_position (GdkDevice *device,
double *x,
double *y);
GDK_AVAILABLE_IN_ALL
GdkSurface *
gdk_device_get_surface_at_position
(GdkDevice *device,
gint *win_x,
gint *win_y);
GDK_AVAILABLE_IN_ALL
void gdk_device_get_position_double (GdkDevice *device,
gdouble *x,
gdouble *y);
GDK_AVAILABLE_IN_ALL
GdkSurface *
gdk_device_get_surface_at_position_double
(GdkDevice *device,
gdouble *win_x,
gdouble *win_y);
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_history (GdkDevice *device,
GdkSurface *surface,
@@ -236,11 +224,6 @@ GDK_DEPRECATED_FOR(gdk_seat_ungrab)
void gdk_device_ungrab (GdkDevice *device,
guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_device_warp (GdkDevice *device,
gint x,
gint y);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);

View File

@@ -86,9 +86,6 @@ struct _GdkDeviceClass
GdkSurface *surface,
GdkCursor *cursor);
void (* warp) (GdkDevice *device,
gdouble x,
gdouble y);
void (* query_state) (GdkDevice *device,
GdkSurface *surface,
GdkSurface **child_surface,

View File

@@ -70,7 +70,7 @@
*
* You can use gdk_display_manager_get() to obtain the #GdkDisplayManager
* singleton, but that should be rarely necessary. Typically, initializing
* GTK+ opens a display that you can work with without ever accessing the
* GTK opens a display that you can work with without ever accessing the
* #GdkDisplayManager.
*
* The GDK library can be built with support for multiple backends.

View File

@@ -67,10 +67,6 @@
/* Private variable declarations
*/
static GdkEventFunc _gdk_event_func = NULL; /* Callback for events */
static gpointer _gdk_event_data = NULL;
static GDestroyNotify _gdk_event_notify = NULL;
static void gdk_event_constructed (GObject *object);
static void gdk_event_finalize (GObject *object);
@@ -153,14 +149,16 @@ gdk_event_class_init (GdkEventClass *klass)
void
_gdk_event_emit (GdkEvent *event)
{
if (gdk_event_get_event_type (event) == GDK_NOTHING)
{
g_warning ("Ignoring GDK_NOTHING events; they're good for nothing");
return;
}
if (gdk_drag_handle_source_event (event))
return;
if (gdk_surface_handle_event (event))
return;
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
gdk_surface_handle_event (event);
}
/*********************************************
@@ -415,33 +413,6 @@ _gdk_event_queue_flush (GdkDisplay *display)
}
}
/**
* gdk_event_handler_set:
* @func: the function to call to handle events from GDK.
* @data: user data to pass to the function.
* @notify: the function to call when the handler function is removed, i.e. when
* gdk_event_handler_set() is called with another event handler.
*
* Sets the function to call to handle all events from GDK.
*
* Note that GTK+ uses this to install its own event handler, so it is
* usually not useful for GTK+ applications. (Although an application
* can call this function then call gtk_main_do_event() to pass
* events to GTK+.)
**/
void
gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify)
{
if (_gdk_event_notify)
(*_gdk_event_notify) (_gdk_event_data);
_gdk_event_func = func;
_gdk_event_data = data;
_gdk_event_notify = notify;
}
/**
* gdk_event_new:
* @type: a #GdkEventType
@@ -593,8 +564,8 @@ gdk_event_copy (const GdkEvent *event)
g_object_ref (new_event->any.device);
if (new_event->any.source_device)
g_object_ref (new_event->any.source_device);
if (new_event->any.user_data)
g_object_ref (new_event->any.user_data);
if (new_event->any.target)
g_object_ref (new_event->any.target);
switch ((guint) event->any.type)
{
@@ -602,6 +573,13 @@ gdk_event_copy (const GdkEvent *event)
case GDK_LEAVE_NOTIFY:
if (event->crossing.child_surface != NULL)
g_object_ref (event->crossing.child_surface);
if (event->crossing.related_target)
g_object_ref (event->crossing.related_target);
break;
case GDK_FOCUS_CHANGE:
if (event->focus_change.related_target)
g_object_ref (event->focus_change.related_target);
break;
case GDK_DRAG_ENTER:
@@ -663,6 +641,11 @@ gdk_event_finalize (GObject *object)
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
g_clear_object (&event->crossing.child_surface);
g_clear_object (&event->crossing.related_target);
break;
case GDK_FOCUS_CHANGE:
g_clear_object (&event->focus_change.related_target);
break;
case GDK_DRAG_ENTER:
@@ -704,7 +687,7 @@ gdk_event_finalize (GObject *object)
g_clear_object (&event->any.device);
g_clear_object (&event->any.source_device);
g_clear_object (&event->any.user_data);
g_clear_object (&event->any.target);
G_OBJECT_CLASS (gdk_event_parent_class)->finalize (object);
}
@@ -1933,16 +1916,39 @@ gdk_event_get_scancode (GdkEvent *event)
}
void
gdk_event_set_user_data (GdkEvent *event,
GObject *user_data)
gdk_event_set_target (GdkEvent *event,
GObject *target)
{
g_set_object (&event->any.user_data, user_data);
g_set_object (&event->any.target, target);
}
GObject *
gdk_event_get_user_data (const GdkEvent *event)
gdk_event_get_target (const GdkEvent *event)
{
return event->any.user_data;
return event->any.target;
}
void
gdk_event_set_related_target (GdkEvent *event,
GObject *target)
{
if (event->any.type == GDK_ENTER_NOTIFY ||
event->any.type == GDK_LEAVE_NOTIFY)
g_set_object (&event->crossing.related_target, target);
else if (event->any.type == GDK_FOCUS_CHANGE)
g_set_object (&event->focus_change.related_target, target);
}
GObject *
gdk_event_get_related_target (const GdkEvent *event)
{
if (event->any.type == GDK_ENTER_NOTIFY ||
event->any.type == GDK_LEAVE_NOTIFY)
return event->crossing.related_target;
else if (event->any.type == GDK_FOCUS_CHANGE)
return event->focus_change.related_target;
return NULL;
}
/**
@@ -2009,6 +2015,11 @@ gdk_event_get_crossing_mode (const GdkEvent *event,
*mode = event->crossing.mode;
return TRUE;
}
else if (event->any.type == GDK_FOCUS_CHANGE)
{
*mode = event->focus_change.mode;
return TRUE;
}
return FALSE;
}
@@ -2035,6 +2046,11 @@ gdk_event_get_crossing_detail (const GdkEvent *event,
*detail = event->crossing.detail;
return TRUE;
}
else if (event->any.type == GDK_FOCUS_CHANGE)
{
*detail = event->focus_change.detail;
return TRUE;
}
return FALSE;
}

View File

@@ -125,18 +125,6 @@ typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
typedef struct _GdkEventSequence GdkEventSequence;
typedef union _GdkEvent GdkEvent;
/**
* GdkEventFunc:
* @event: the #GdkEvent to process.
* @data: (closure): user data set when the event handler was installed with
* gdk_event_handler_set().
*
* Specifies the type of function passed to gdk_event_handler_set() to
* handle all GDK events.
*/
typedef void (*GdkEventFunc) (GdkEvent *event,
gpointer data);
/**
* GdkEventType:
* @GDK_NOTHING: a special code to indicate a null event.
@@ -446,11 +434,6 @@ gboolean gdk_events_get_center (GdkEvent *event1,
gdouble *x,
gdouble *y);
GDK_AVAILABLE_IN_ALL
void gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify);
GDK_AVAILABLE_IN_ALL
void gdk_event_set_display (GdkEvent *event,
GdkDisplay *display);

View File

@@ -61,7 +61,7 @@ struct _GdkEventAny
GdkDevice *device;
GdkDevice *source_device;
GdkDisplay *display;
GObject *user_data;
GObject *target;
};
/*
@@ -303,6 +303,7 @@ struct _GdkEventCrossing
GdkNotifyType detail;
gboolean focus;
guint state;
GObject *related_target;
};
/*
@@ -312,6 +313,8 @@ struct _GdkEventCrossing
* @send_event: %TRUE if the event was sent explicitly.
* @in: %TRUE if the surface has gained the keyboard focus, %FALSE if
* it has lost the focus.
* @mode: the crossing mode
* @detail: the kind of crossing that happened
*
* Describes a change of keyboard focus.
*/
@@ -319,6 +322,9 @@ struct _GdkEventFocus
{
GdkEventAny any;
gint16 in;
GdkCrossingMode mode;
GdkNotifyType detail;
GObject *related_target;
};
/*
@@ -632,8 +638,12 @@ union _GdkEvent
GdkEventPadGroupMode pad_group_mode;
};
void gdk_event_set_user_data (GdkEvent *event,
GObject *user_data);
void gdk_event_set_target (GdkEvent *event,
GObject *user_data);
GObject * gdk_event_get_target (const GdkEvent *event);
void gdk_event_set_related_target (GdkEvent *event,
GObject *user_data);
GObject * gdk_event_get_related_target (const GdkEvent *event);
#endif /* __GDK_EVENTS_PRIVATE_H__ */

View File

@@ -179,7 +179,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
* This signal is emitted as the second step of toolkit and
* application processing of the frame. Any work to update
* sizes and positions of application elements should be
* performed. GTK+ normally handles this internally.
* performed. GTK normally handles this internally.
*/
signals[LAYOUT] =
g_signal_new (g_intern_static_string ("layout"),
@@ -197,7 +197,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
* This signal is emitted as the third step of toolkit and
* application processing of the frame. The frame is
* repainted. GDK normally handles this internally and
* produces expose events, which are turned into GTK+
* produces expose events, which are turned into GTK
* #GtkWidget::draw signals.
*/
signals[PAINT] =
@@ -230,7 +230,7 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
* @clock: the frame clock emitting the signal
*
* This signal is emitted after processing of the frame is
* finished, and is handled internally by GTK+ to resume normal
* finished, and is handled internally by GTK to resume normal
* event processing. Applications should not handle this signal.
*/
signals[RESUME_EVENTS] =
@@ -289,7 +289,7 @@ gdk_frame_clock_get_frame_time (GdkFrameClock *frame_clock)
* content and want to continually request the
* %GDK_FRAME_CLOCK_PHASE_UPDATE phase for a period of time,
* you should use gdk_frame_clock_begin_updating() instead, since
* this allows GTK+ to adjust system parameters to get maximally
* this allows GTK to adjust system parameters to get maximally
* smooth animations.
*/
void

View File

@@ -298,7 +298,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
* @width: The width of the region to draw
* @height: The height of the region to draw
*
* This is the main way to draw GL content in GTK+. It takes a render buffer ID
* This is the main way to draw GL content in GTK. It takes a render buffer ID
* (@source_type == #GL_RENDERBUFFER) or a texture id (@source_type == #GL_TEXTURE)
* and draws it onto @cr with an OVER operation, respecting the current clip.
* The top left corner of the rectangle specified by @x, @y, @width and @height

View File

@@ -145,7 +145,7 @@ struct _GdkSurface
GdkSurface *parent;
GdkSurface *transient_for;
gpointer user_data;
gpointer widget;
gint x;
gint y;

View File

@@ -264,7 +264,7 @@ gdk_seat_get_capabilities (GdkSeat *seat)
* commonly.
*
* Grabs are used for operations which need complete control over the
* events corresponding to the given capabilities. For example in GTK+ this
* events corresponding to the given capabilities. For example in GTK this
* is used for Drag and Drop operations, popup menus and such.
*
* Note that if the event mask of a #GdkSurface has selected both button press
@@ -350,7 +350,7 @@ gdk_seat_get_slaves (GdkSeat *seat,
* Returns the master device that routes pointer events.
*
* Returns: (transfer none) (nullable): a master #GdkDevice with pointer
* capabilities. This object is owned by GTK+ and must not be freed.
* capabilities. This object is owned by GTK and must not be freed.
**/
GdkDevice *
gdk_seat_get_pointer (GdkSeat *seat)
@@ -370,7 +370,7 @@ gdk_seat_get_pointer (GdkSeat *seat)
* Returns the master device that routes keyboard events.
*
* Returns: (transfer none) (nullable): a master #GdkDevice with keyboard
* capabilities. This object is owned by GTK+ and must not be freed.
* capabilities. This object is owned by GTK and must not be freed.
**/
GdkDevice *
gdk_seat_get_keyboard (GdkSeat *seat)
@@ -405,7 +405,7 @@ gdk_seat_device_removed (GdkSeat *seat,
*
* Returns the #GdkDisplay this seat belongs to.
*
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK+
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK
* and must not be freed.
**/
GdkDisplay *

File diff suppressed because it is too large Load Diff

View File

@@ -491,9 +491,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_focus (GdkSurface *surface,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_user_data (GdkSurface *surface,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_get_accept_focus (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_accept_focus (GdkSurface *surface,
@@ -573,9 +570,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_set_title (GdkSurface *surface,
const gchar *title);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_role (GdkSurface *surface,
const gchar *role);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_startup_id (GdkSurface *surface,
const gchar *startup_id);
GDK_AVAILABLE_IN_ALL
@@ -595,9 +589,6 @@ GDK_AVAILABLE_IN_ALL
GdkCursor *gdk_surface_get_device_cursor (GdkSurface *surface,
GdkDevice *device);
GDK_AVAILABLE_IN_ALL
void gdk_surface_get_user_data (GdkSurface *surface,
gpointer *data);
GDK_AVAILABLE_IN_ALL
void gdk_surface_get_geometry (GdkSurface *surface,
gint *x,
gint *y,
@@ -646,18 +637,12 @@ GDK_AVAILABLE_IN_ALL
gint gdk_surface_get_scale_factor (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_get_device_position (GdkSurface *surface,
GdkSurface * gdk_surface_get_device_position (GdkSurface *surface,
GdkDevice *device,
gint *x,
gint *y,
double *x,
double *y,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_get_device_position_double (GdkSurface *surface,
GdkDevice *device,
gdouble *x,
gdouble *y,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_get_parent (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_surface_get_toplevel (GdkSurface *surface);
@@ -666,9 +651,6 @@ GDK_AVAILABLE_IN_ALL
GList * gdk_surface_get_children (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GList * gdk_surface_peek_children (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GList * gdk_surface_get_children_with_user_data (GdkSurface *surface,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_icon_list (GdkSurface *surface,
@@ -740,31 +722,31 @@ void gdk_surface_register_dnd (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
gint button,
gint x,
gint y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_resize_drag_for_device (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_move_drag (GdkSurface *surface,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
gint button,
gint x,
gint y,
guint32 timestamp);
GDK_AVAILABLE_IN_ALL
void gdk_surface_begin_move_drag_for_device (GdkSurface *surface,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
GdkDevice *device,
gint button,
gint x,
gint y,
guint32 timestamp);
/* Interface for dirty-region queueing */
GDK_AVAILABLE_IN_ALL

View File

@@ -136,8 +136,6 @@ struct _GdkSurfaceImplClass
GdkSurfaceHints geom_mask);
void (* set_title) (GdkSurface *surface,
const gchar *title);
void (* set_role) (GdkSurface *surface,
const gchar *role);
void (* set_startup_id) (GdkSurface *surface,
const gchar *startup_id);
void (* set_transient_for) (GdkSurface *surface,

View File

@@ -200,7 +200,7 @@ typedef enum
* @GDK_HYPER_MASK: the Hyper modifier
* @GDK_META_MASK: the Meta modifier
* @GDK_MODIFIER_RESERVED_29_MASK: A reserved bit flag; do not use in your own code
* @GDK_RELEASE_MASK: not used in GDK itself. GTK+ uses it to differentiate
* @GDK_RELEASE_MASK: not used in GDK itself. GTK uses it to differentiate
* between (keyval, modifiers) pairs from key press and release events.
* @GDK_MODIFIER_MASK: a mask covering all modifier types.
*
@@ -454,7 +454,7 @@ typedef enum {
* GdkSurfaceTypeHint:
* @GDK_SURFACE_TYPE_HINT_NORMAL: Normal toplevel window.
* @GDK_SURFACE_TYPE_HINT_DIALOG: Dialog window.
* @GDK_SURFACE_TYPE_HINT_MENU: Window used to implement a menu; GTK+ uses
* @GDK_SURFACE_TYPE_HINT_MENU: Window used to implement a menu; GTK uses
* this hint only for torn-off menus, see #GtkTearoffMenuItem.
* @GDK_SURFACE_TYPE_HINT_TOOLBAR: Window used to implement toolbars.
* @GDK_SURFACE_TYPE_HINT_SPLASHSCREEN: Window used to display a splash
@@ -514,7 +514,7 @@ typedef enum
*
* An enumeration describing the way in which a device
* axis (valuator) maps onto the predefined valuator
* types that GTK+ understands.
* types that GTK understands.
*
* Note that the X and Y axes are not really needed; pointer devices
* report their location via the x/y members of events regardless. Whether

View File

@@ -37,7 +37,7 @@
*
* A macro that should be defined before including the gdk.h header.
* If it is defined, no compiler warnings will be produced for uses
* of deprecated GDK and GTK+ APIs.
* of deprecated GDK and GTK APIs.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
@@ -54,6 +54,7 @@
#define GDK_VERSION_3_92 (G_ENCODE_VERSION (3, 92))
#define GDK_VERSION_3_94 (G_ENCODE_VERSION (3, 94))
/**
* GDK_VERSION_4_0:
*
@@ -137,6 +138,13 @@
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_92
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -1008,7 +1008,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
.pNext = NULL,
.pApplicationName = g_get_application_name (),
.applicationVersion = 0,
.pEngineName = "GTK+",
.pEngineName = "GTK",
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
.apiVersion = VK_API_VERSION_1_0
},

View File

@@ -160,6 +160,7 @@ gdkx11_inc = include_directories('x11')
gdkwayland_inc = include_directories('wayland')
wlinc = include_directories('.')
win32rcinc = include_directories('win32/rc')
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros]

View File

@@ -125,7 +125,7 @@ gdk_quartz_device_core_get_state (GdkDevice *device,
{
gdouble x_pos, y_pos;
gdk_surface_get_device_position_double (window, device, &x_pos, &y_pos, mask);
gdk_surface_get_device_position (window, device, &x_pos, &y_pos, mask);
if (axes)
{

View File

@@ -1739,17 +1739,6 @@ gdk_quartz_surface_set_title (GdkSurface *window,
}
}
static void
gdk_quartz_surface_set_role (GdkSurface *window,
const gchar *role)
{
if (GDK_SURFACE_DESTROYED (window) ||
SURFACE_IS_TOPLEVEL (window))
return;
/* FIXME: Implement */
}
static void
gdk_quartz_surface_set_startup_id (GdkSurface *window,
const gchar *startup_id)
@@ -2754,7 +2743,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
impl_class->set_urgency_hint = gdk_quartz_surface_set_urgency_hint;
impl_class->set_geometry_hints = gdk_quartz_surface_set_geometry_hints;
impl_class->set_title = gdk_quartz_surface_set_title;
impl_class->set_role = gdk_quartz_surface_set_role;
impl_class->set_startup_id = gdk_quartz_surface_set_startup_id;
impl_class->set_transient_for = gdk_quartz_surface_set_transient_for;
impl_class->get_frame_extents = gdk_quartz_surface_get_frame_extents;

View File

@@ -321,7 +321,7 @@ gdk_wayland_device_get_state (GdkDevice *device,
{
gdouble x, y;
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
gdk_surface_get_device_position (surface, device, &x, &y, mask);
if (axes)
{
@@ -517,13 +517,6 @@ gdk_wayland_device_set_surface_cursor (GdkDevice *device,
gdk_wayland_device_update_surface_cursor (device);
}
static void
gdk_wayland_device_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
}
static void
get_coordinates (GdkDevice *device,
double *x,
@@ -621,9 +614,9 @@ emulate_crossing (GdkSurface *surface,
gdk_event_set_device (event, device);
gdk_event_set_source_device (event, device);
gdk_surface_get_device_position_double (surface, device,
&event->crossing.x, &event->crossing.y,
&event->crossing.state);
gdk_surface_get_device_position (surface, device,
&event->crossing.x, &event->crossing.y,
&event->crossing.state);
event->crossing.x_root = event->crossing.x;
event->crossing.y_root = event->crossing.y;
@@ -871,7 +864,6 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
device_class->get_history = gdk_wayland_device_get_history;
device_class->get_state = gdk_wayland_device_get_state;
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor;
device_class->warp = gdk_wayland_device_warp;
device_class->query_state = gdk_wayland_device_query_state;
device_class->grab = gdk_wayland_device_grab;
device_class->ungrab = gdk_wayland_device_ungrab;

View File

@@ -2447,8 +2447,7 @@ gdk_wayland_surface_map (GdkSurface *surface)
GDK_SURFACE_IMPL_WAYLAND (attached_grab_surface->impl);
grab_device = gdk_seat_get_pointer (attached_impl->grab_input_seat);
transient_for =
gdk_device_get_surface_at_position (grab_device,
NULL, NULL);
gdk_device_get_surface_at_position (grab_device, NULL, NULL);
}
}
else
@@ -2465,8 +2464,13 @@ gdk_wayland_surface_map (GdkSurface *surface)
* position of the device that holds the grab.
*/
if (impl->position_method == POSITION_METHOD_NONE && grab_device)
gdk_surface_get_device_position (transient_for, grab_device,
&surface->x, &surface->y, NULL);
{
double px, py;
gdk_surface_get_device_position (transient_for, grab_device,
&px, &py, NULL);
surface->x = round (px);
surface->y = round (py);
}
}
else
{
@@ -3182,12 +3186,6 @@ gdk_wayland_surface_set_title (GdkSurface *surface,
gdk_wayland_surface_sync_title (surface);
}
static void
gdk_wayland_surface_set_role (GdkSurface *surface,
const gchar *role)
{
}
static void
gdk_wayland_surface_set_startup_id (GdkSurface *surface,
const gchar *startup_id)
@@ -3556,8 +3554,8 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
GdkSurfaceEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
gint x,
gint y,
guint32 timestamp)
{
GdkSurfaceImplWayland *impl;
@@ -3646,8 +3644,8 @@ static void
gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
gint x,
gint y,
guint32 timestamp)
{
GdkSurfaceImplWayland *impl;
@@ -3854,7 +3852,6 @@ _gdk_surface_impl_wayland_class_init (GdkSurfaceImplWaylandClass *klass)
impl_class->set_urgency_hint = gdk_wayland_surface_set_urgency_hint;
impl_class->set_geometry_hints = gdk_wayland_surface_set_geometry_hints;
impl_class->set_title = gdk_wayland_surface_set_title;
impl_class->set_role = gdk_wayland_surface_set_role;
impl_class->set_startup_id = gdk_wayland_surface_set_startup_id;
impl_class->set_transient_for = gdk_wayland_surface_set_transient_for;
impl_class->get_frame_extents = gdk_wayland_surface_get_frame_extents;

View File

@@ -112,14 +112,6 @@ gdk_device_virtual_set_surface_cursor (GdkDevice *device,
g_set_object (&GDK_SURFACE_IMPL_WIN32 (window->impl)->cursor, win32_hcursor);
}
static void
gdk_device_virtual_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
SetCursorPos (x - _gdk_offset_x, y - _gdk_offset_y);
}
static void
gdk_device_virtual_query_state (GdkDevice *device,
GdkSurface *window,
@@ -198,7 +190,6 @@ gdk_device_virtual_class_init (GdkDeviceVirtualClass *klass)
device_class->get_history = gdk_device_virtual_get_history;
device_class->get_state = gdk_device_virtual_get_state;
device_class->set_surface_cursor = gdk_device_virtual_set_surface_cursor;
device_class->warp = gdk_device_virtual_warp;
device_class->query_state = gdk_device_virtual_query_state;
device_class->grab = gdk_device_virtual_grab;
device_class->ungrab = gdk_device_virtual_ungrab;

View File

@@ -21,6 +21,7 @@
#include <windowsx.h>
#include <objbase.h>
#include <math.h>
#include "gdkdevice-win32.h"
#include "gdkwin32.h"
@@ -45,14 +46,14 @@ gdk_device_win32_get_state (GdkDevice *device,
gdouble *axes,
GdkModifierType *mask)
{
gint x_int, y_int;
double x, y;
gdk_surface_get_device_position (window, device, &x_int, &y_int, mask);
gdk_surface_get_device_position (window, device, &x, &y, mask);
if (axes)
{
axes[0] = x_int;
axes[1] = y_int;
axes[0] = round (x);
axes[1] = round (y);
}
}
@@ -63,13 +64,6 @@ gdk_device_win32_set_surface_cursor (GdkDevice *device,
{
}
static void
gdk_device_win32_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
}
static GdkModifierType
get_current_mask (void)
{
@@ -286,7 +280,6 @@ gdk_device_win32_class_init (GdkDeviceWin32Class *klass)
device_class->get_history = gdk_device_win32_get_history;
device_class->get_state = gdk_device_win32_get_state;
device_class->set_surface_cursor = gdk_device_win32_set_surface_cursor;
device_class->warp = gdk_device_win32_warp;
device_class->query_state = gdk_device_win32_query_state;
device_class->grab = gdk_device_win32_grab;
device_class->ungrab = gdk_device_win32_ungrab;

View File

@@ -99,13 +99,6 @@ gdk_device_wintab_set_surface_cursor (GdkDevice *device,
{
}
static void
gdk_device_wintab_warp (GdkDevice *device,
gdouble x,
gdouble y)
{
}
static void
gdk_device_wintab_query_state (GdkDevice *device,
GdkSurface *window,
@@ -291,7 +284,6 @@ gdk_device_wintab_class_init (GdkDeviceWintabClass *klass)
device_class->get_history = gdk_device_wintab_get_history;
device_class->get_state = gdk_device_wintab_get_state;
device_class->set_surface_cursor = gdk_device_wintab_set_surface_cursor;
device_class->warp = gdk_device_wintab_warp;
device_class->query_state = gdk_device_wintab_query_state;
device_class->grab = gdk_device_wintab_grab;
device_class->ungrab = gdk_device_wintab_ungrab;

View File

@@ -883,15 +883,12 @@ gdk_input_other_event (GdkDisplay *display,
GdkDeviceManagerWin32 *device_manager;
GdkDeviceWintab *source_device = NULL;
GdkDeviceGrabInfo *last_grab;
GdkEventMask masktest;
guint key_state;
POINT pt;
GdkSurfaceImplWin32 *impl;
PACKET packet;
gint root_x, root_y;
gint num_axes;
gint x, y;
double x, y;
guint translated_buttons, button_diff, button_mask;
/* Translation from tablet button state to GDK button state for
* buttons 1-3 - swap button 2 and 3.
@@ -911,7 +908,7 @@ gdk_input_other_event (GdkDisplay *display,
g_object_ref (window);
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("gdk_input_other_event: window=%p %+d%+d\n",
g_print ("gdk_input_other_event: window=%p %+g%+g\n",
window ? GDK_SURFACE_HWND (window) : NULL, x, y));
if (msg->message == WT_PACKET || msg->message == WT_CSRCHANGE)

View File

@@ -38,6 +38,8 @@
#include <dwmapi.h>
#include "gdkwin32langnotification.h"
static int debug_indent = 0;
/**
@@ -536,6 +538,7 @@ _gdk_win32_display_open (const gchar *display_name)
NULL);
_gdk_device_manager->display = _gdk_display;
_gdk_win32_lang_notification_init ();
_gdk_drag_init ();
_gdk_drop_init ();
@@ -701,6 +704,7 @@ gdk_win32_display_finalize (GObject *object)
_gdk_win32_display_finalize_cursors (display_win32);
_gdk_win32_dnd_exit ();
_gdk_win32_lang_notification_exit ();
g_ptr_array_free (display_win32->monitors, TRUE);

View File

@@ -29,6 +29,7 @@
#include <io.h>
#include <fcntl.h>
#include <math.h>
/*
* Support for OLE-2 drag and drop added at Archaeopteryx Software, 2001
@@ -1717,6 +1718,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GdkDrag *drag;
GdkWin32Drag *drag_win32;
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
double px, py;
int x_root, y_root;
g_return_val_if_fail (surface != NULL, NULL);
@@ -1731,9 +1733,9 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
gdk_device_get_position (device, &x_root, &y_root);
x_root += dx;
y_root += dy;
gdk_device_get_position (device, &px, &px);
x_root = round (px) + dx;
y_root = round (py) + dy;
drag_win32->start_x = x_root;
drag_win32->start_y = y_root;
@@ -1840,7 +1842,6 @@ gdk_win32_drag_find_window (GdkDrag *drag,
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
find_window_enum_arg a;
HWND result;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
@@ -2439,7 +2440,6 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
{
drag_win32->util_data.last_x += dx;
drag_win32->util_data.last_y += dy;
gdk_device_warp (pointer, drag_win32->util_data.last_x, drag_win32->util_data.last_y);
}
if (drag_win32->drag_surface)

View File

@@ -1090,7 +1090,6 @@ static void
gdk_win32_drop_finish (GdkDrop *drop,
GdkDragAction action)
{
GdkDrag *drag;
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
g_return_if_fail (drop != NULL);
@@ -1103,12 +1102,6 @@ gdk_win32_drop_finish (GdkDrop *drop,
if (drop_win32->protocol == GDK_DRAG_PROTO_OLE2)
return;
/* FIXME: remove?
drag = gdk_drop_get_drag (drop);
if (drag != NULL)
_gdk_win32_local_drag_drop_response (drag, action);
*/
}
#if 0

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