Compare commits

..

471 Commits

Author SHA1 Message Date
Emmanuele Bassi 70997c51bc Depend on G-I 1.67.1
Contains various fixes that allow building GTK without introspection
warnings.
2020-04-27 14:30:41 +01:00
Emmanuele Bassi c31727d0dc Add g-i as a subproject
If the version of Meson is high enough, we can use gobject-introspection
as a Meson sub-project.
2020-04-27 14:26:20 +01:00
Matthias Clasen 789586c385 Merge branch 'BUG_filechooser_async_data_loss_GTK4' into 'master'
GtkFilechooserWidget: prevent oblivious selection of file

See merge request GNOME/gtk!1688
2020-04-27 13:22:47 +00:00
Matthias Clasen bedf3a2db9 Merge branch 'wip/exalm/tnum' into 'master'
mediacontrols: Use tabular figures for time and duration

See merge request GNOME/gtk!1774
2020-04-27 12:59:35 +00:00
Alexander Mikhaylenko 422c78badf mediacontrols: Use tabular figures for time and duration
In particular, this prevents gtk4-widget-factory from jumping every
second.
2020-04-27 17:28:20 +05:00
Matthias Clasen b3710279bc Merge branch '2657-avoid-use-after-free-suggestion' into 'master'
Resolve "Use-after-free crash in `thaw_updates()`"

Closes #2657

See merge request GNOME/gtk!1771
2020-04-27 12:16:54 +00:00
Matthias Clasen 5a25c7fd64 Merge branch 'matthiasc/for-master' into 'master'
Miscellaneous bug fixes

Closes #2666 and #2016

See merge request GNOME/gtk!1773
2020-04-27 12:11:37 +00:00
Matthias Clasen 429e0bfaec filechooser: Correct an annotation
Clarify that gtk_file_chooser_add_filter is only taking
ownership of a floating reference, which translates to
"transfer none", not "transfer full".

Fixes: #2016
2020-04-27 00:35:47 -04:00
Matthias Clasen fc450e313b placesview: Fix translator comments
These comments were applied to the wrong strings
by xgettext.

Fixes: #2666
2020-04-27 00:23:49 -04:00
Matthias Clasen f18eef7e6f filechooser: Fix type-to-search
We need to capture the keys and forward them
to the search entry, for anything to happen.
2020-04-27 00:14:38 -04:00
Matthias Clasen bf1a9b2b0d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1772
2020-04-27 03:30:30 +00:00
Matthias Clasen a3368ab7e9 widget-factory: Revamp transition effects
Use a quick crossfade for the main pages, and use
the rotation for the small stack on page 2, where
it looks less out of place.
2020-04-26 22:30:34 -04:00
Matthias Clasen 1ae898bf0b gtk-demo: Add a shortcuts window
Its not very impressive here, but still good to have.
2020-04-26 22:14:10 -04:00
Matthias Clasen 91c7b24815 icon-browser: Add a gear menu
Add an about dialog, and make the inspector available.
2020-04-26 22:00:18 -04:00
Matthias Clasen af2903d263 widget-factory: Improve the textview on page 3
Remove an extra frame, make the buttons linked, and
add tooltips.
2020-04-26 21:13:16 -04:00
Matthias Clasen 9ca2a09427 widget-factory: Move the password entry
Move the password entry to the other entries. That
fits the overall organization better, and makes all
the typographical styles fit.
2020-04-26 20:54:09 -04:00
Matthias Clasen 50b930fb1c widget-factory: Make the list on page 2 grow to the bottom
Add a few more items to the list to make it fill up the space.
2020-04-26 20:35:51 -04:00
Matthias Clasen 3ed285ab71 widget-factory: Show typographical style classes
This nicely fills the gap on page 1.
2020-04-26 20:25:11 -04:00
Matthias Clasen 34862dbbb6 gtk-demo: Include pango version in about dialog
This is useful information.
2020-04-26 20:02:10 -04:00
Matthias Clasen 1bdaa99347 widget-factory: Include pango version in about dialog
This is useful information.
2020-04-26 20:01:31 -04:00
Matthias Clasen ad22c463b8 widget-factory: Add a password entry
Thats a new widget that was missing.
2020-04-26 19:34:36 -04:00
Emmanuele Bassi 62d98ac60c Merge branch 'patch-1' into 'master'
Remove a "-" from comment

See merge request GNOME/gtk!1770
2020-04-26 21:42:10 +00:00
Peter Bloomfield b9155dcb1a file-system-model: Refactor a helper
Push more common code into the helper for
gtk_file_system_model_query_done() and
gtk_file_system_model_one_query_done().
2020-04-26 17:38:49 -04:00
Peter Bloomfield d85f02a994 file-system-model: Avoid use-after free
This is a possible fix for https://gitlab.gnome.org/GNOME/gtk/-/issues/2657

Use a NULL return from g_file_query_info_finish() to detect cancellation
of the query, and avoid derferencing a stale pointer.
2020-04-26 16:47:23 -04:00
scootergrisen 01ebd00f97 Remove a "-" 2020-04-26 20:44:04 +00:00
Matthias Clasen 7da995da1d Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1768
2020-04-26 20:24:37 +00:00
Matthias Clasen dc99a7aa61 stackswitcher: Drop the Private struct 2020-04-26 15:48:46 -04:00
Matthias Clasen 508ed21786 progressbar: Drop the Private struct 2020-04-26 15:44:44 -04:00
Matthias Clasen 2356c9b503 overlay: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen bf77694557 linkbutton: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen 5bd2b49064 fontchooserdialog: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen a78e0f1188 fontchooserwidget: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen 7ede3b919c calendar: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen 2ea7f47089 separator: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen 9156be6bf1 viewport: Drop the Private struct 2020-04-26 15:38:09 -04:00
Matthias Clasen 0b6cd34b1d Merge branch 'matthiasc/for-master' into 'master'
widget-factory improvements

See merge request GNOME/gtk!1767
2020-04-26 19:20:47 +00:00
Matthias Clasen e1b25eaf5a wayland: Fall back to an unthemed default cursor
In the absence of icon themes (such as in a freshly
created toolbox container), we should not just fall back
to "no cursor", since that makes it hard even to close
the application. Fall back to an included default cursor
of last resort.
2020-04-26 14:42:45 -04:00
Matthias Clasen 7eeeb3f229 gdk: Include a default cursor as resource
Provide a fallback cursor of last resort. Otherwise,
we end up with no visible cursor if there is no
cursor theme installed, wihch is less than helpful.
2020-04-26 14:41:52 -04:00
Matthias Clasen 7ca8efa0f5 vulkan: Update error codes enum
Do the silly update exercise.
2020-04-26 14:08:40 -04:00
Matthias Clasen 9f579edfdb widget-factory: Put a video widget in
The designers wanted the frame column gone for a long
time, since inset/outset/groove etc are not the coolest
features anymore.

Keep one frame, and put a GtkVideo in it.

This opens up some real estate on page 1. Suggestions
welcome for how to fill it.
2020-04-26 14:08:40 -04:00
Matthias Clasen 2dfd1404ff inspector: Make the resource tab play videos
We can do this easily, so why not. This can be
seen in action with gtk-logo.webm, e.g. in gtk4-demo.
2020-04-26 14:08:40 -04:00
Matthias Clasen f6af2d63b0 widget-factory: Implement the print action
Implement enough here to show a print dialog.
2020-04-26 14:08:35 -04:00
Matthias Clasen 764e43b871 Merge branch 'wip/exalm/windowcontrols-fix' into 'master'
Adwaita: remove margin from GtkWindowControls when empty

See merge request GNOME/gtk!1766
2020-04-26 16:11:49 +00:00
Alexander Mikhaylenko 7874b29ec2 Adwaita: remove margin from GtkWindowControls when empty 2020-04-26 20:24:20 +05:00
Matthias Clasen 8de774dde1 widget-factory: Make print a window action
We want to pass the parent window when opening
a print dialog, so this is naturally a window
action.
2020-04-26 10:45:40 -04:00
Matthias Clasen a8e04ee81d Merge branch 'matthiasc/for-master' into 'master'
More reftest fixes

See merge request GNOME/gtk!1765
2020-04-26 14:30:10 +00:00
Matthias Clasen 8410e6f129 widget-factory: Some cosmetics
Hook the Print button on page 3 up to the app.print
action. This doesn't do anything now, but we might
use it to show a print dialog.
2020-04-26 10:02:11 -04:00
Matthias Clasen ecf8e6f692 widget-factory: Improve the layout on page 3
Make the entries in the third column expand,
to align things.
2020-04-26 10:00:14 -04:00
Matthias Clasen dde32b5098 reftests: Remove window-show-contents-on-map from xfails
This test passes now.
2020-04-26 09:47:16 -04:00
Matthias Clasen 2571a2af18 reftests: Fix the window-show-contents-on-map test
Despite the name, the test was not in fact showing
contents on map anymore, since widgets are visible
by default. Setting visible to FALSE makes the test
work as expected again.
2020-04-26 09:47:16 -04:00
Matthias Clasen fa2a8ac1bb reftests: Remove window-show-contents-on-map from xfails
This test passes now.
2020-04-26 09:18:54 -04:00
Matthias Clasen ccc38746d5 Merge branch 'clipboard-demo-fixes' into 'master'
More gtk-demo fixes

See merge request GNOME/gtk!1764
2020-04-26 13:17:42 +00:00
Matthias Clasen 56565b12d8 reftests: Fix the window-show-contents-on-map test
Despite the name, the test was not in fact showing
contents on map anymore, since widgets are visible
by default. Setting visible to FALSE makes the test
work as expected again.
2020-04-26 09:16:25 -04:00
Matthias Clasen 7f1e82d1bc Merge branch 'wip/exalm/titlebuttons' into 'master'
GtkWindowControls + GtkHeaderBar cleanups

See merge request GNOME/gtk!1755
2020-04-26 13:09:35 +00:00
Alexander Mikhaylenko b5d61eb2c8 docs: Add GtkWindowControls to docs 2020-04-26 15:13:15 +05:00
Alexander Mikhaylenko 5321f8f195 headerbar: Use GtkWindowControls
Now that the title buttons are encapsulated in a separate widget, use
it in the header bar.

Hide them when empty, so that they don't add extra spacing.
2020-04-26 15:13:15 +05:00
Alexander Mikhaylenko 4aa8f6f73c Add GtkWindowControls
Move some code out of GtkHeaderBar and into a separate widget, making it
reusable in process.

See https://gitlab.gnome.org/GNOME/gtk/issues/2242
2020-04-26 15:13:15 +05:00
Matthias Clasen 6f7bd37aeb widget-factory: Update copyright year 2020-04-26 00:45:06 -04:00
Matthias Clasen f645c063fb gtk-demo: Update copyright year 2020-04-26 00:44:48 -04:00
Matthias Clasen 44e31855ca gtk-demo: Remove the colorsel demo
We already have a color selector demo in "Pickers".
2020-04-26 00:28:13 -04:00
Matthias Clasen c6fc7d88c2 gtk-demo: Minor cosmetic fixes
Some minor cosmetic fixes to some of the demos.
2020-04-26 00:28:13 -04:00
Matthias Clasen f6c8af6609 gtk-demo: Improve the dnd demo
The DND demo didn't have DND, since it was first created!
Time to fix this. Copying most of testdnd3.c here.
2020-04-26 00:28:13 -04:00
Matthias Clasen 796bc9bde1 Merge branch 'clipboard-demo-fixes' into 'master'
Clipboard demo fixes

See merge request GNOME/gtk!1762
2020-04-26 02:13:33 +00:00
Matthias Clasen f8f391ceb9 gtk-demo: Polish the clipboard demo
The DND part of this demo was broken by recent
icon theme changes. Make it work again.

And make the demo nicer by breaking out a
DemoImage widget.
2020-04-25 21:29:39 -04:00
Matthias Clasen 637890517b Move the idle sizer to the gtkroot.c
This is needed since we already have a second GtkRoot
implementation with GtkDragIcon, and DND is causing
critical warnings due to this.
2020-04-25 21:03:57 -04:00
Matthias Clasen ae7fd6f129 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1761
2020-04-25 19:26:36 +00:00
Matthias Clasen 99d7130da3 reftests: Remove background-image-multiple from xfails
It no longer fails.
2020-04-25 13:26:14 -04:00
Matthias Clasen b64f889cd9 fixed: Fix an oversight in size requisition
We need to take orientation into account when applying
child transforms. This is what broke the background-image-multiple
reftest.
2020-04-25 13:18:34 -04:00
Matthias Clasen ba1633ce75 Merge branch 'matthiasc/for-master' into 'master'
Fix menu keynav

See merge request GNOME/gtk!1760
2020-04-25 16:56:18 +00:00
Matthias Clasen ac3e604bb6 reftests: Use transform syntax
This is supposed to fix the background-image-multiple
reftest, but it doesn't. There's an actual bug here.
2020-04-25 12:47:17 -04:00
Matthias Clasen fdc4335eba menu: Dismiss submenus during keynav
We need to dismiss submenus explicitly on left arrow,
otherwise the grab interferes with our keynav.
2020-04-25 12:14:04 -04:00
Matthias Clasen 4936e7f859 Cosmetics
Reduce casting.
2020-04-25 11:54:29 -04:00
Matthias Clasen 8b64e29ba6 menu: Ignore leaves due to grabs
When we open a submenu we get a leave due to the grab,
but we don't want to unset the active item then.
2020-04-25 11:46:43 -04:00
Matthias Clasen 95424d3f44 Merge branch 'matthiasc/for-master' into 'master'
Don't autoinclude backend-specific headers

See merge request GNOME/gtk!1759
2020-04-25 15:37:41 +00:00
Piotr Drąg 9cc5eb6161 Update POTFILES.in 2020-04-25 13:38:18 +02:00
Matthias Clasen 79e1c66657 gsk: Don't autoinclude backend-specific headers
Don't install headers for code that we don't build.
And don't include those headers in gsk.h.

Just as we do in gdk, require applications to include
the backend-specific headers they need explicitly.

Update the one affected demo, gtk4-node-editor.
2020-04-24 21:40:30 -04:00
Matthias Clasen 02fa948914 widget-factory: Improve the theme selector
Implement the "Current style" choice using
gtk_settings_reset_property, so we go back to
following the settings changes.
2020-04-24 21:12:20 -04:00
Matthias Clasen b54178e6a4 Merge branch 'wip/carlosg/input-fixes' into 'master'
Some input fixes

See merge request GNOME/gtk!1757
2020-04-25 00:29:33 +00:00
Matthias Clasen bb50b2cec9 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1758
2020-04-24 23:07:23 +00:00
Matthias Clasen 1d86a89ccf testsuite: Take textview-border-windows out of xfails
The textview-border-window reftest passes now, so
take it out of the xfails.
2020-04-24 18:35:22 -04:00
Matthias Clasen c192038027 reftests: Avoid text caret from interfering
We are comparing a transparent label to a transparent
text view, so need to make sure the caret does not show
up in the text view to ruin the comparison.
2020-04-24 18:33:57 -04:00
Carlos Garnacho 2c23546ba9 gtktexthandle: Set parent through API call
The GtkWidget::parent property went readonly, use the API call
to ensure the text handle has a parent set.
2020-04-25 00:09:41 +02:00
Carlos Garnacho 9ed579505d gtktreeview: Ensure to transiently prelight on touch input
Some machinery (like clicking on expander) relies on prelight state
being up to date, but we don't set prelight on touch events. Do that
transiently, as long as a row is clicked.

Fixes tapping on expanders.
2020-04-24 23:14:51 +02:00
Carlos Garnacho 41b7f03d55 gdk/wayland: Ensure to clean up stale touchpoint data on surface destroy
If the wl_surface receiving touch events is destroyed, we will get no
wl_touch.up event to remove the touchpoint from our internal accounting.
Check for this, and drop touchpoints happening in surfaces that do
disappear during operation.
2020-04-24 23:11:00 +02:00
Carlos Garnacho 67e1acd4d7 gtkpopover: Roll back properly if presenting the popup fails
If the popover fails to be shown, it would internally undo visible
and mapped state. If we just proceed as normal, the widget enters
in inconsistent state, and a grab remains issued on the invisible
widget, preventing further input from the input device.
2020-04-24 23:06:52 +02:00
Carlos Garnacho d104efe06e gtkwindow: Correct device check
This function to revoke implicit grabs may be called with a NULL
device, which means all devices should be revoked. Fix the check
so this actually happens.

Fixes implicit grabs (maybe) being unset in result to a GTK grab.
2020-04-24 23:04:27 +02:00
Carlos Garnacho 2a877a9be5 gtkwindowgroup: Take default group into account when listing windows
Otherwise, no windows belong to the default group, paradoxically.
2020-04-24 23:03:13 +02:00
Matthias Clasen cb14fcca4c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1756
2020-04-24 20:50:01 +00:00
Carlos Garnacho 777fd92eba gtkpadcontroller: Avoid filling action list with empty elements
We don't need to set the array size if we are adding elements afterwards.
2020-04-24 22:21:08 +02:00
Carlos Garnacho ccfffb2578 demos: Initialize brush size in "paint" demo
Otherwise lines end up with 0 thickness.
2020-04-24 22:20:09 +02:00
Matthias Clasen 894e1d0885 testsuite: Take border-color-transparent out of xfails
The border-color-transparent reftest passes now, so
take it out of the xfails.
2020-04-24 15:20:58 -04:00
Matthias Clasen c8d4a48c03 reftests: Avoid theme influence
Reset to defaults in background-color-transparent,
to avoid theme influence in the results.
2020-04-24 15:19:24 -04:00
Matthias Clasen 7ce964a455 reftests: Avoid decorations
Window decorations always cause trouble between ci
and local test runs, so turn them off for the
background-color-transparent reftest.
2020-04-24 15:18:02 -04:00
Alexander Mikhaylenko 2791c522d8 headerbar: Remove decoration-layout-set property
It's unnecessary and only complicates the API. Use decoration-layout if
it's not NULL, and GtkSettings otherwise.
2020-04-24 23:54:07 +05:00
Alexander Mikhaylenko 18114bafe0 headerbar: Remove title button separators
They have had opacity: 0 for a while, just remove them.
2020-04-24 23:54:07 +05:00
Alexander Mikhaylenko 197fe80857 testsuite: Fix swapped params in notify test
The expected and counted params are swapped in literally every call, so
swapping the params to match them.
2020-04-24 23:54:07 +05:00
Matthias Clasen 8871327b08 Merge branch 'grab-leftovers' into 'master'
Drop gtk_widget_has_grab

See merge request GNOME/gtk!1752
2020-04-23 19:24:59 +00:00
Matthias Clasen b2deab6adf Drop gtk_widget_has_grab
This was just a leftover in our public api.
All other grab-related apis are gone.
2020-04-23 14:10:44 -04:00
Benjamin Otte 389575ee18 Merge branch 'wip/exalm/window-headerbar' into 'master'
First steps for #2242

See merge request GNOME/gtk!1739
2020-04-23 15:26:30 +00:00
Matthias Clasen fd47e86689 Merge branch 'focus-ring-experiment' into 'master'
Tweak visible focus behavior

See merge request GNOME/gtk!1750
2020-04-23 15:20:54 +00:00
Alexander Mikhaylenko 7c4694ca3c window: Stop listening to headerbar title changes
Remove another dependency.
2020-04-23 19:26:10 +05:00
Alexander Mikhaylenko 610d5794ac headerbar: Update window buttons automatically
Update the layout when any of the following properties changes:
 * modal
 * transient-for
 * resizable
 * deletable

Stop updating it from GtkWindow, make that function static.
2020-04-23 19:26:10 +05:00
Matthias Clasen b0f2cd02ad window: Tweak visible focus behavior
Only turn on visible focus when a key event actually leads
to a change in focus location (ie, 'keynav').

Make the visible focus disappear after 5 seconds of no
keyboard interaction, to avoid permanent focus ring
distraction.

As an extra bonus, make it so that we make the focus
visible while the Alt key is pressed. This gives us
a 'find my focus!' shortcut, and goes well with the
prexisting use of Alt for finding mnemonics.

Discussed in: #2644
2020-04-23 09:33:26 -04:00
Jakub Steiner 7fe51a876c Merge branch 'wip/jimmac/uniform-checkboxes' into 'master'
Adwaita: lower glyph contrast for checkboxes

See merge request GNOME/gtk!1745
2020-04-23 11:44:47 +00:00
Jakub Steiner 424a86a6a6 Adwaita: lower glyph contrast for checkboxes
- stylistic choice didn't sit well with majority of the design team
2020-04-23 10:53:02 +02:00
Matthias Clasen 861bff44a8 Merge branch 'matthiasc/for-master' into 'master'
menusectionbox: Improve circular button spacing

Closes #2626

See merge request GNOME/gtk!1743
2020-04-23 04:02:12 +00:00
Matthias Clasen f4b1762072 Adwaita: Add padding to circular button rows in menus
The lack of this was negatively affecting the spacing
of these buttons.

Fixes: #2626
2020-04-22 22:42:04 -04:00
Matthias Clasen ba45d7a991 menusectionbox: Improve circular button spacing
In the n == 2 case, we want to avoid the buttons being
drawn all the way out to the ends of the box, but in the
n >= 3 case, that is exactly what we want for the first
and last button.
2020-04-22 22:16:46 -04:00
Benjamin Otte 8b1e857a67 Merge branch 'fix-icontheme-invalidation' into 'master'
Fix icontheme invalidation

See merge request GNOME/gtk!1733
2020-04-23 00:13:26 +00:00
Matthias Clasen 94906d076a Drop gtk_widget_reset_style
There was a single call left that should not be necessary.
Also drop no longer used attached-window functionality.
2020-04-22 19:30:48 -04:00
Matthias Clasen a199060728 Drop gtk_style_context_reset_widgets
This is no longer used.
2020-04-22 19:30:48 -04:00
Matthias Clasen 7b4378bc46 widget: Update when font settings change
Update the pango context when font-related settings
change, using the new GtkSystemSetting mechanism.
2020-04-22 19:30:48 -04:00
Matthias Clasen 679863af4f image: Invalidate icon helper when icon theme changes
This is necessary to drop the cached image.
2020-04-22 19:30:48 -04:00
Matthias Clasen a59cb5dfa6 icontheme: Call gtk_system_setting_changed
When the icon theme changes, we want to both initiate
a css SOURCE change (since css values may depend on the
icon theme), as well as calling gtk_system_setting_changed,
since widgets need to drop cached images, e.g. in GtkIconHelper.
2020-04-22 19:30:48 -04:00
Matthias Clasen 4b13d99cfe settings: Call gtk_system_setting_changed
Replace calls to gtk_style_context_reset_widgets by
gtk_system_setting_changed, with the appropriate setting,
and add style invalidation where required.
2020-04-22 19:29:59 -04:00
Matthias Clasen 129b8bb7f1 window: Use gtk_system_setting_change
Propagate GTK_SYSTEM_SETTING_DISPLAY when the display
of the window changes.
2020-04-22 19:29:15 -04:00
Matthias Clasen 723d57eeb5 widget: Add a system_setting_changed vfunc
This gives us a hook to walk the widget tree whenever a global
setting changes and do per-widget invalidations. This will
replace gtk_style_context_reset_widgets().
2020-04-22 19:29:15 -04:00
Matthias Clasen 58ca3b05c9 css: Compare icon theme serials
When comparing to icon theme image values for equality,
take the serial of the icon theme at compute time into
account.
2020-04-22 19:22:41 -04:00
Emmanuele Bassi 21fcef7306 Merge branch 'ci-custom-layout' into 'master'
Fix annotations for GtkCustomLayout

See merge request GNOME/gtk!1740
2020-04-22 19:23:17 +00:00
Matthias Clasen fe6ef5256b icontheme: Keep a serial
This will let us identify when we have to re-lookup
icons because they may have changed despite the theme
object being the same.
2020-04-22 15:18:16 -04:00
Emmanuele Bassi c0d18ebff2 Fix annotations for GtkCustomLayout
Silence the warnings from the introspection scanner.
2020-04-22 19:24:45 +01:00
Alexander Mikhaylenko 451c3279ee window: Introduce actions for window buttons
Add the following actions:
 * window.close
 * window.toggle-maximize
 * window.minimize

Ensure they are disabled when not appropriate, such as for modal windows.

Use them in GtkHeaderBar.
2020-04-22 23:01:12 +05:00
Alexander Mikhaylenko 016eac0645 header-bar: Track window icon changes
Listen to icon-name changes if it's in a GtkWindow. This allows to remove a
special case for headerbar-as-titlebar from GtkWindow.
2020-04-22 23:01:12 +05:00
Alexander Mikhaylenko cead405831 header-bar: Don't assume there's only one icon
Instead of tracking the titlebar icon widget, and updating it when the icon
changes, update the window buttons completely.
2020-04-22 23:01:12 +05:00
Matthias Clasen 2ddff872cd css: Drop the -gtk-icon-theme property
We want to always use the current icon theme, and only
have the minimum amount of custom properties.
2020-04-22 12:35:30 -04:00
Matthias Clasen 7aeef71a49 css: Get the icon theme via the settings
We don't have a css value for it anymore, but we
still need the current icon theme to interpret
icon names.
2020-04-22 12:35:30 -04:00
Matthias Clasen 98611735ec Stop using the -gtk-icon-theme style property
We want to just use the current icon theme, always.
2020-04-22 12:35:22 -04:00
Alexander Mikhaylenko 2240eb5c99 header-bar: Stop showing application menu
The application menu isn't particular relevant anymore, and the support for
showing fallback appmenu as a headerbar icon is one of the things tying
GtkWindow to GtkHeaderBar.

Remove support for "menu" window decoration element completely, update
GtkHeaderBar docs.
2020-04-22 21:30:19 +05:00
Alexander Larsson e75bc2833d icon-theme: Fix deadlock in GktIconTheme dispose
When freeing the display GtkIconTheme and that was the last owner we
ran into a deadlock, because we unref the "next-to-last" ref inside a
gtk_icon_theme_ref_aquire/release() pair, which makes the final unref
to happen in the release(), while the ref lock still was held.
The unref triggers dispose which tries to NULL out the ref, but that then
deadlocks on the mutex being held by the caller already.

We fix this by moving the release unref outside the lock. This is safe
because refcounts are atomic, and we *do* own the ref.
2020-04-22 12:20:57 -04:00
Jakub Steiner bca608c531 Merge branch 'wip/jimmac/HC-slider-border' into 'master'
HC: fix switch slider borders

See merge request GNOME/gtk!1737
2020-04-22 11:47:54 +00:00
Jakub Steiner 9fe6bc0792 HC: fix switch slider borders
- HC got caught up on a condition made for color (suggested) buttons.
  the rule just made the slider a tag lighter on dark probably due to the
  overlaid AA making it stronger. Got rid of it for now, if someone cares
  enough we can reintroduce an exception (that doesn't break HC).
2020-04-22 11:59:40 +02:00
Matthias Clasen e026a04e03 Merge branch 'fix-placesview-popover' into 'master'
placesview: Fix up the address entry help popover

Closes #2642

See merge request GNOME/gtk!1731
2020-04-21 22:27:57 +00:00
Emmanuele Bassi 30c386dde9 Merge branch 'missing-annotation' into 'master'
widget: Add missing callback annotation

See merge request GNOME/gtk!1732
2020-04-21 21:56:43 +00:00
Matthias Clasen 0ff67fa854 Merge branch 'wip/chergert/fix-toggle-caret-visibility' into 'master'
textview: fix assertion when toggling caret visibility

Closes #2647

See merge request GNOME/gtk!1736
2020-04-21 21:11:53 +00:00
Christian Hergert 55dd737ea0 textview: fix assertion when toggling caret visibility
When toggling caret visibility (with F7) we would hit an assertion if the
cursor is currently blinking. This adjusts things to ensure that we should
be showing the carent when scheduling our blink timeouts.

Fixes #2647
2020-04-21 13:39:50 -07:00
Matthias Clasen c09b5ea7b4 Merge branch 'menu-section-title' into 'master'
Menu section title

See merge request GNOME/gtk!1735
2020-04-21 19:35:44 +00:00
Matthias Clasen 1edfd80528 Adwaita: Some styling for menu section titles
More fine-tuning needed.
2020-04-21 14:55:14 -04:00
Matthias Clasen 654af88529 Change the approach to menu section titles
Put the label below the separator, and give
it the title style class.
2020-04-21 14:48:39 -04:00
Florian Müllner 8e2ffb3b46 widget: Add missing callback annotation
GI can only figure out the correct scope if there's a GDestroyNotify
or GAsyncReadyCallback parameter.
2020-04-21 16:35:07 +02:00
Claudio Saavedra e818bf8514 docs: migration guide fixes 2020-04-21 15:37:45 +03:00
Claudio Saavedra 0af16a77fc docs: fix typo 2020-04-21 14:49:13 +03:00
Matthias Clasen 0ebcf8c02e placesview: Fix up the address entry help popover
Popovers without parent don't work anymore. Set a
parent, a fix up the position.

Fixes: #2642
2020-04-21 07:43:52 -04:00
Jakub Steiner 76b16720fc Merge branch 'wip/jimmac/hc-public-colors' into 'master'
HC: export public colors

Closes #2641

See merge request GNOME/gtk!1730
2020-04-21 11:08:28 +00:00
Jakub Steiner 89ebe9e456 HC: export public colors
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2641
2020-04-21 12:39:34 +02:00
Matthias Clasen af7537ac79 3.98.3 2020-04-21 00:32:23 -04:00
Matthias Clasen 6185cf95fb Fix label accessibility
Emit accessible change signals after setting the
new selection limits. This was broken in
commit f6bedd0d5e, and showed up as broken
accessibility tests.
2020-04-20 23:16:23 -04:00
Matthias Clasen fbcd0212ea Merge branch 'container-focus-cleanup' into 'master'
Strip down GtkContainer

See merge request GNOME/gtk!1722
2020-04-20 21:20:57 +00:00
Matthias Clasen b55195fa2e Move the idle sizer to GtkWindow
This was only living in gtkcontainer.c for historic
reasons. Move it closer to where it belongs, and
rename it from 'idle' to 'layout', since it is
really about the layout phase of the frame clock,
nowadays.
2020-04-20 16:30:45 -04:00
Matthias Clasen 841c4a8cfe container: Cosmetic doc cleanup
Remove remnants of child properties from the
documentation. They no longer exist.
2020-04-20 16:30:45 -04:00
Matthias Clasen d756c6e282 Move set_focus_child to GtkWidget
Move the set_focus_child vfunc from GtkContainer
to GtkWidget. This removes the last focus functionality
from GtkContainer.

Update the two users.
2020-04-20 16:30:43 -04:00
Matthias Clasen eeb41c82d1 NEWS: More updates 2020-04-20 16:29:30 -04:00
Matthias Clasen ecf313097c Merge branch 'wip/carlosg/grabbing-popovers' into 'master'
gtkpopover: Set GTK grab on autohide popovers

Closes #2446

See merge request GNOME/gtk!1729
2020-04-20 19:01:55 +00:00
Carlos Garnacho b20f21df24 gtkpopover: Set GTK grab on autohide popovers
These popovers handle clicks outside the widget, and expect input
to be routed through it when it is shown. This pretty much matches
the characteristics of GTK grabs, and setting one up will ensure
the cancellation of event controllers that were active at the time
of showing the popover.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2446
2020-04-20 20:28:05 +02:00
Matthias Clasen 2869f80bc0 Merge branch 'docs-work' into 'master'
Docs work

See merge request GNOME/gtk!1727
2020-04-20 05:33:02 +00:00
Matthias Clasen b4c79bad34 Assorted documentation fixes 2020-04-20 00:38:58 -04:00
Matthias Clasen 013cc09651 widget: Remove some leftovers
gtk_widget_can_activate_accel is gone, so remove the
vfunc and declaration.
2020-04-19 23:44:50 -04:00
Matthias Clasen cd077d1aa6 Merge branch 'BUG_regression_select_folder_GTK4' into 'master'
GtkFileChooserWidget: fix refactor regression

Closes #2635

See merge request GNOME/gtk!1726
2020-04-19 23:15:28 +00:00
Nelson Benítez León 66e802596a GtkFileChooserWidget: fix refactor regression
Commit 4a3742979d which removed
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER slipped
a bad g_assert() refactoring, which is causing
a crash when selecting a folder in a GtkFileChooserButton
dialog.

Fixes #2635
2020-04-19 18:00:37 -04:00
Matthias Clasen e91907d427 Docs: Various tweaks
Tweak the docs for library initialization, versioning
and settings, and remove some outdated information.
2020-04-19 16:26:25 -04:00
Matthias Clasen dbf12d87a1 Add GtkShortcutLabel to the docs 2020-04-19 15:41:51 -04:00
Matthias Clasen 0b6af3bf23 Add GtkCenterLayout to the docs 2020-04-19 15:38:31 -04:00
Matthias Clasen bc7da45902 docs: Restructure a bit
Split the overview sections off into its own "concepts part.
2020-04-19 13:15:05 -04:00
Matthias Clasen a3de542274 Merge branch 'matthiasc/for-master' into 'master'
Remove GdkGeometry from public API

See merge request GNOME/gtk!1720
2020-04-19 16:40:03 +00:00
Matthias Clasen 7f3125fc69 Some minor documentation fixes 2020-04-19 10:42:10 -04:00
Matthias Clasen 70fed08e8f Remove GdkGeometry from public API
The api to configure surfaces is now GdkToplevelLayout
and GdkPopupLayout. Unfortunately, there's still quite
a bit of internal use of GdkGeometry that will take some
time to clean up, so move it go gdkinternals.h for now.
2020-04-19 10:42:10 -04:00
Matthias Clasen 3c987f073e Remove GdkGeometry from public API
The api to configure surfaces is now GdkToplevelLayout
and GdkPopupLayout. Unfortunately, there's still quite
a bit of internal use of GdkGeometry that will take some
time to clean up, so move it go gdkinternals.h for now.
2020-04-19 10:41:18 -04:00
Timm Bäder ef832fd770 Merge branch 'fix-infobar-styling' into 'master'
Adwaita: Fix and simplify infobar styling

See merge request GNOME/gtk!1711
2020-04-19 13:11:13 +00:00
nana-4 2afd10b537 Adwaita: Fix and simplify infobar styling
- Apply sizing regardless of style class.
- Fix bottom border not reaching the bottom corners.
- Remove unnecessary style overrides that should have been removed
  during the redesign.
2020-04-19 20:10:52 +09:00
Timm Bäder f1da4cfae1 Merge branch 'theme-link-styling-fixes' into 'master'
Adwaita: Fix link styling

See merge request GNOME/gtk!1721
2020-04-19 08:37:15 +00:00
nana-4 47bfa49118 Adwaita: Fix link styling
- Fix broken visited link styling by avoiding invalid selector
  `:link:visited` - CSS :link and :visited are mutually exclusive.
- In link button, move %link from the child label to the parent button,
  so that the hover/active effect is applied within the whole button and
  the visited style is applied correctly.
- Remove invalid selectors `:backdrop:backdrop`.
2020-04-19 15:21:40 +09:00
Matthias Clasen 2cd152c2ed Merge branch 'fix-css-filter-transitions' into 'master'
css: Allow transitioning between different units again

See merge request GNOME/gtk!1719
2020-04-19 02:00:26 +00:00
Matthias Clasen a7cad79092 css: Allow transitioning between different units again
This turns out to be necessary for transitioning filters,
and we run into criticals if transitioning numbers
unexpectedly returns NULL. I've observed that with

* {
  filter: invert(80%);
}

This was broken in c9e972eecb.
2020-04-18 21:10:32 -04:00
Matthias Clasen 661b8c3d1a Merge branch 'matthiasc/for-master' into 'master'
css: Give none singletons unique names

See merge request GNOME/gtk!1718
2020-04-18 22:52:15 +00:00
Matthias Clasen 853de6c511 Merge branch 'wip/fix-multi-popup-hide' into 'master'
Fix autohiding popup chain

See merge request GNOME/gtk!1717
2020-04-18 22:33:52 +00:00
Matthias Clasen 45bcffd637 statusbar: Don't use a frame
This frame serves no purpose anymore, and now that frames
draw frames, it shows up annoyingly.
2020-04-18 17:29:13 -04:00
Matthias Clasen 1e7c56db19 Merge branch 'focus-adjustment' into 'master'
Drop container focus adjustments

See merge request GNOME/gtk!1716
2020-04-18 20:59:50 +00:00
Jonas Ådahl ab59459f7a wayland: Don't continue showing if xdg_popup creation failed
We don't create a grabbing popup if it's not the top most one, as that
is a protocol violation, and complain if anything attempts to do it.
What we didn't do is handle this gracefully in the code that tries to
create said popup.

Fix this by dropping the attempt to show the popup on the floor, instead
of setting various state making it look like it succeeded. This won't
actually fix anything, but it'll result in a bit more accurate warnings
logged, as the state more correctly corresponds to the reality.
2020-04-18 22:57:25 +02:00
Jonas Ådahl 0a79eb02ac surface: Hide chained autohiding popups together
When we autohide a popup surface with a grab, hide all other auto hiding
popups up the popup chain. The end result is that when you click outside
a menu with submenus open, the whole menu chain is dismissed.
2020-04-18 22:33:52 +02:00
Jonas Ådahl aa72318581 popover: Fix indentation 2020-04-18 22:33:29 +02:00
Matthias Clasen 0bc6a5c791 Merge branch 'BUG_sibebarplaces_avoid_click_focus_GTK4' into 'master'
GtkPlacesSidebar: avoid location clicks to grab focus

See merge request GNOME/gtk!1715
2020-04-18 19:51:29 +00:00
Matthias Clasen ef8e8ba14d css: Give none singletons unique names
This makes for a less confusing experience in gdb.
2020-04-18 15:24:13 -04:00
Matthias Clasen b55b1773c0 docs: Mention focus adjustments in the migration guide 2020-04-18 14:59:52 -04:00
Matthias Clasen 1c472cca00 Drop gtk_container_set_focus_[hv]adjustment
This functionality should be provided by scrollables, see
for example by the recently added GtkViewport:scroll-to-focus.
2020-04-18 14:59:44 -04:00
Matthias Clasen 8c0fbb2294 tests: Stop using focus adjustments
Set scroll-to-focus instead, in testgtk.
2020-04-18 14:52:50 -04:00
Matthias Clasen ee4a7798c9 flowbox: Stop setting focus adjustments 2020-04-18 14:45:29 -04:00
Matthias Clasen b339bde6a5 inspector: Use the new scroll-to-focus 2020-04-18 14:43:48 -04:00
Matthias Clasen 13b6b9f2b4 scrolledwindow: Stop setting focus adjustments
Stop setting focus adjustments on the automatically
generated viewport.
2020-04-18 14:43:48 -04:00
Matthias Clasen b315dce757 Add a test for scroll-to-focus 2020-04-18 14:43:48 -04:00
Matthias Clasen 66347fa3bf viewport: Add GtkViewport:scroll-to-focus
And implement this property by listening for focus
changes, and updating the adjustments. This is a
replacement for setting focus adjustments on containers.
2020-04-18 14:43:48 -04:00
Nelson Benítez León 2c7d54791c GtkPlacesSidebar: avoid location clicks to grab focus
Sibebar location rows should not grab focus on click.

Fixes filechooser issue #1469
2020-04-18 14:43:02 -04:00
Matthias Clasen af858d51a8 Merge branch 'css-docs' into 'master'
Shorten CSS docs

See merge request GNOME/gtk!1712
2020-04-18 18:39:01 +00:00
Matthias Clasen 84fd7cf704 Shorten CSS docs
Fold the two CSS chapters into one, make more compact
tables of selectors and properties, and stop explaining
general CSS syntax.
2020-04-18 12:34:17 -04:00
Matthias Clasen 250036259a widget-factory: Make color swatches non-focusable 2020-04-18 03:29:13 -04:00
Matthias Clasen 8e45e15a11 colorchooser: Fix a crash
Don't crash when we start removing custom colors
that happen to be currently selected.
2020-04-18 03:29:13 -04:00
Matthias Clasen 323394e8b5 emojichooser: Drop focus adjustment setting
It is not needed here, we are now scrolling
differently.
2020-04-18 03:29:13 -04:00
Matthias Clasen d53f3a54b1 filechooser: Cosmetic doc changes 2020-04-17 20:08:21 -04:00
Matthias Clasen e880abfaf3 drawingarea: Cosmetic docs fix 2020-04-17 20:05:04 -04:00
Matthias Clasen 16906eb0a9 NEWS: More updates 2020-04-17 19:57:15 -04:00
Matthias Clasen 6a4f788976 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #1899 and #2627

See merge request GNOME/gtk!1709
2020-04-17 23:34:15 +00:00
Emmanuele Bassi 6b79f691ef Merge branch 'ebassi/for-master' into 'master'
cups: Disable deprecation warnings

See merge request GNOME/gtk!1710
2020-04-17 23:28:18 +00:00
Matthias Clasen 49f2012d24 migration docs: Updates
Mention shadow type, relief, aspect frame.
2020-04-17 18:46:12 -04:00
Emmanuele Bassi 18c11ac94f cups: Disable deprecation warnings
It seems newer releases of CUPS removed the ability to disable
deprecation warnings by defining a pre-processor symbol, so we
have to resort to the usual begin/end ignore deprecation pragmas
to avoid a ton of deprecation warnings.
2020-04-17 23:38:06 +01:00
Emmanuele Bassi 25237095c9 Merge branch 'for-master' into 'master'
For master

See merge request GNOME/gtk!1708
2020-04-17 22:11:28 +00:00
Matthias Clasen 19dbbf6fa5 aspectframe: Modernize
Make GtkAspectFrame not derive from GtkFrame anymore,
since frames now always draw, well, a frame. Also,
add proper setters for the properties of GtkAspectFrame.

Update our sole user.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2627
2020-04-17 17:38:52 -04:00
Emmanuele Bassi dd23a37ca1 Reconcile documentation with declaration and definition
The arguments name in the documentation must match declaration and
definition, or gtk-doc and g-ir-scanner will get very cross at us.
2020-04-17 22:34:10 +01:00
Emmanuele Bassi d46e1288a4 Copy axes when rewriting events 2020-04-17 22:23:32 +01:00
Matthias Clasen b5d17d2f9b Adwaita: Add focus to expander
We were not drawing a focus indication at all for
expanders. Bring it back. Also, make the color plane
focus snug.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/1899
2020-04-17 16:24:44 -04:00
Matthias Clasen 5a362c6759 nodeeditor: Don't set has-focus
That is now a readonly property. Set focus-widget
on the toplevel instead.
2020-04-17 16:17:01 -04:00
Matthias Clasen 3e19b9502d Merge branch 'menu-section-title' into 'master'
popovermenu: Reinstate section title handling

See merge request GNOME/gtk!1707
2020-04-17 19:27:02 +00:00
Matthias Clasen 39793e8043 Merge branch 'matthiasc/for-master' into 'master'
gsk: Fall back to cairo if compiling shaders fails

See merge request GNOME/gtk!1706
2020-04-17 18:17:32 +00:00
Matthias Clasen 79267674ff popovermenu: Reinstate section title handling
We were creating a hbox with separators around the label,
but forgot to arrange sizing to prevent the separators from
shrinking into nothingness.
2020-04-17 13:53:56 -04:00
Matthias Clasen c920796967 gsk: Fall back to cairo if compiling shaders fails
There was already some fallback in place here, but
in other places we were just asserting.
2020-04-17 13:42:33 -04:00
Matthias Clasen 908590e032 Merge branch 'matthiasc/for-master' into 'master'
gsk: Fall back to cairo if compiling shaders fails

See merge request GNOME/gtk!1705
2020-04-17 17:41:08 +00:00
Matthias Clasen 416d82c81e widget-factory: Add a menu section title
If you can't see it, you can't theme it.
2020-04-17 13:29:56 -04:00
Matthias Clasen d4e53b14cb Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1703
2020-04-17 16:23:29 +00:00
Matthias Clasen 96f9f9585f reftests: Stop using shadow-type 2020-04-17 11:06:16 -04:00
Matthias Clasen ad7118ef9a calendar: Fix focus keynav
This broke when the calendar was broken into widgets.
2020-04-17 10:57:36 -04:00
Matthias Clasen 909120ec78 Drop GtkReliefStyle
We are not using this enum anymore.
2020-04-17 10:57:36 -04:00
Matthias Clasen 12d5fdd457 menubutton: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen df1816a29c button: Drop relief
We are only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen fdbbef863d Drop GtkShadowType
We are not using this enum anymore.
2020-04-17 10:57:36 -04:00
Matthias Clasen 47ac0db66c viewport: Drop shadow-type
The viewport draws a frame at the same place as
the scrolled window, so there is really no need
to have that ability in both. Just drop the frame
from viewports.
2020-04-17 10:57:36 -04:00
Matthias Clasen edae2a8dc5 frame: Drop shadow-type
Frames that don't draw frames are not very useful,
so just drop the shadow-type property.
2020-04-17 10:57:36 -04:00
Matthias Clasen ffbc58d328 treeviewcolumn: Stop using a frame
There is no desire to draw a frame here, so don't use a GtkFrame.
2020-04-17 10:57:36 -04:00
Matthias Clasen 285aa226e5 scrolledwindow: Drop shadow-type
We were only using this as a boolean, so change it
to a boolean property named has-frame.
2020-04-17 10:57:36 -04:00
Matthias Clasen f297d0684d scrolledwindow: Document the .frame style class 2020-04-17 10:57:36 -04:00
Timm Bäder c7d871570f Revert "modelbutton: Emit ::clicked() before closing the popover"
This reverts commit 57f913b753.
2020-04-17 16:43:17 +02:00
Matthias Clasen 7caed3a462 Merge branch 'assorted-menu-fixes' into 'master'
Assorted menu fixes

See merge request GNOME/gtk!1704
2020-04-17 14:12:20 +00:00
Timm Bäder f4acde371e snapshot: Avoid a save/restore pair if we can 2020-04-17 15:21:00 +02:00
Timm Bäder aad67743b9 label: Ignore setting attrs from NULL to NULL 2020-04-17 15:21:00 +02:00
Timm Bäder 1886648652 text: unconditionally unref attr list
pango_attr_list_unref() works on NULL
2020-04-17 15:21:00 +02:00
Timm Bäder 67c2665028 text: Avoid creating a PangoAttrList we don't need
It's going to be empty, unless we have preedit_attrs
2020-04-17 15:21:00 +02:00
Timm Bäder dda7a850da meson: Use summary()
Instead of doing our own. Bumps the dependency to 0.53 though.
2020-04-17 15:21:00 +02:00
Timm Bäder b8ef164c2b meson: Trivial formattting 2020-04-17 15:21:00 +02:00
Timm Bäder 5d61abd748 label: Redraw when text attrs are affected by css change
GtkWidget doesn't do it automatically and probably shouldn't
2020-04-17 15:21:00 +02:00
Timm Bäder 9f6ec5b7d4 label: Don't create an unnecessary attribute list 2020-04-17 15:21:00 +02:00
Timm Bäder 78e6475f9f label: Only parse mnemonic attributes if we need to 2020-04-17 15:21:00 +02:00
Timm Bäder 6289f7eecd label: Ignore AFFECTS_ATTRS css changes if we can
It's only interesting if we either already have attributes, or the new
style adds some.
2020-04-17 15:21:00 +02:00
Timm Bäder 9ad0dbb145 label: Inline function into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder db9fbb3918 label: Remove some unused quarks 2020-04-17 15:21:00 +02:00
Timm Bäder afaa352142 label: Remove priv pointer 2020-04-17 15:21:00 +02:00
Timm Bäder 3b7cb31157 label: Stop connecting to notify::gtk-enable-accels
Leftover from when GtkAccelLabel was a GtkLabel subclass. GtkAccelLabel
connects to this itself these days though.
2020-04-17 15:21:00 +02:00
Timm Bäder f0b33cdc53 label: Set underline text and markup in one step
Try to unify the way we parse the mnemonic character
2020-04-17 15:21:00 +02:00
Timm Bäder 203b0c9c9d label: Fold set_pattern_internal into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder 1ea24e98c1 adwaita: don't extent %link in linkbuttons
We already do that for the label inside the button.
2020-04-17 15:21:00 +02:00
Timm Bäder 36248c609d label: Remove GtkLabel:track-visited-links
Always track visited state of links. This way all visited links in all
labels look the same. Whether the theme wants to style :visited is the
theme's business.
2020-04-17 15:21:00 +02:00
Timm Bäder f6bedd0d5e label: Remove a11y-only properties
Update them manually instead.
2020-04-17 15:21:00 +02:00
Timm Bäder 8f96b38539 label: Fold function into only caller
This makes it more obvious that gtk_label_setup_mnemonic() depends on
the root of the widget and it therefore makes sense to call it in
::root/::unroot.
2020-04-17 15:21:00 +02:00
Timm Bäder 813be8a921 label: Don't normalize booleans in internal setters
We almost always pass a literal TRUE/FALSE to them.
2020-04-17 15:21:00 +02:00
Timm Bäder 21ac2330af stylecontext: Remove get_pango_attributes
Make the only caller use GtkCssNode API.
2020-04-17 15:21:00 +02:00
Timm Bäder 584a71ae96 cssstyle: Only create PangoAttrList if there are attribtues
Don't allocate a new GString if we never need it and therefore don't
create the PangoAttrList if we have no attributes anyway. Update callers
to handle the possible NULL return value.
2020-04-17 15:21:00 +02:00
Timm Bäder 2e14ea84f3 label: Pull all pango attributes from the theme
Dont' force an underline attribute here. Just ask the theme for the
text-decoration.
2020-04-17 15:21:00 +02:00
Timm Bäder 4737495e3c label: Fix an old TODO comment 2020-04-17 15:21:00 +02:00
Timm Bäder 57f913b753 modelbutton: Emit ::clicked() before closing the popover
The clicked handler might still need the popover.
2020-04-17 15:21:00 +02:00
Timm Bäder 4851081a77 label: Remove public pattern API 2020-04-17 15:21:00 +02:00
Timm Bäder 13fde6f4cd label: Shorten set_markup_internal a bit 2020-04-17 15:21:00 +02:00
Timm Bäder 1db53e6676 label: Avoid duplicating a string
We only use str_for_accel if with_uline is TRUE.
2020-04-17 15:21:00 +02:00
Timm Bäder 74b5eaa700 label: Pass <markup> length directly when parsing markup 2020-04-17 15:21:00 +02:00
Timm Bäder b16157bc0d label: Remove a double if (needs_root) check
The code is clearer and shorter this way.
2020-04-17 15:21:00 +02:00
Timm Bäder 7a98e79d90 label: Use widget API to add style class 2020-04-17 15:21:00 +02:00
Timm Bäder c588d8f858 label: Clear select info before creating a new one
E.g. set_markup_internal will create a new select_info, but then we were
destroying it again, just to recreate it later.
2020-04-17 15:21:00 +02:00
Timm Bäder 23cffdfe42 label: Save a few LOC 2020-04-17 15:21:00 +02:00
Timm Bäder 99998d25f8 label: Save links in an array
Stop using GList for this.
2020-04-17 15:21:00 +02:00
Timm Bäder ca47e96d35 widget: Return an array from list_devices
To forther reduce the GList usage in the code base.
2020-04-17 15:21:00 +02:00
Timm Bäder e583349956 accelgroup: Restructure gtk_accelerator_name
To fix invalid reads and make the function a bit shorter while we're at
it.

Fixes #2602
2020-04-17 15:21:00 +02:00
Timm Bäder 7bc4daae2f main: Stop using GList when propagating events
There are still some cases missing.
2020-04-17 15:21:00 +02:00
Matthias Clasen 3469a63453 widget-factory: Use a model for the complex menu
We had the model already in the ui file, but weren't
using it.
2020-04-17 09:07:17 -04:00
Matthias Clasen 17cb92889a modelbutton: Don't show accels without text
We don't want to show accelerators in iconic buttons.
2020-04-17 09:04:26 -04:00
Matthias Clasen 4a20a3fdb2 widget-factory: Catch errors
This speeds up the debugging when doing quick experimental
changes to widget-factory.ui.
2020-04-17 08:55:56 -04:00
Matthias Clasen 726a7ac705 inspector: Fix a crash
Don't crash while picking. The event signal broke
when GdkEvent was turned into a type instance,
since the automatic marshallers don't know how to
deal with that. Manually set the right marshaller.
2020-04-17 08:37:45 -04:00
Matthias Clasen 60329c3cda Merge branch 'event-types' into 'master'
Rework event types

Closes #2585

See merge request GNOME/gtk!1702
2020-04-16 20:36:24 +00:00
Emmanuele Bassi f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Emmanuele Bassi 96cfb12946 Fix annotations for GtkEventController 2020-04-16 19:40:00 +01:00
Emmanuele Bassi 5abb6f2a61 Fix annotation for gtk_show_uri_full()
The callback is now an asynchronous closure.
2020-04-16 19:40:00 +01:00
Emmanuele Bassi 0d065bca6d Fix compiler warning
Newer versions of GCC are fairly aggressive with NULL checks.
2020-04-16 19:40:00 +01:00
Matthias Clasen b3b194532d Merge branch 'matthiasc/for-master' into 'master'
themes: Fix HighContrast dependencies

See merge request GNOME/gtk!1701
2020-04-16 18:05:19 +00:00
Matthias Clasen 1d1e1c5e83 Merge branch 'css-focus-changes' into 'master'
Add a focus-within state

See merge request GNOME/gtk!1700
2020-04-16 18:01:29 +00:00
Matthias Clasen d36e41c6b8 themes: Fix HighContrast dependencies
HighContrast themes now depend on sass files from Adwaita.
2020-04-16 12:40:37 -04:00
Matthias Clasen 4516bfbc88 Adwaita: Some adjustments for :focus-within
Use :focus-within for focus in entries, since the
actual focus is on the text within, and :focus for
notebooks, since we don't want to draw an outline
around the notebook when the focus is in content.
2020-04-16 12:31:17 -04:00
Matthias Clasen 5095e87bb7 testsuite: Add some checks for focus states
This is some opportunistic checking in a test that
is really about focus chains, but better than nothing.
2020-04-16 12:31:17 -04:00
Matthias Clasen 54b99d281b Add a focus-within state
This is used for widgets that contain the focus widget,
reserving the focused state for the focus location itself.

This aligns our focus state handling with
https://www.w3.org/TR/selectors-4/
2020-04-16 12:31:01 -04:00
Matthias Clasen 3cb023d0df Merge branch 'monitor-signals-x11' into 'master'
x11: emit ::enter/leave-monitor

See merge request GNOME/gtk!1699
2020-04-16 15:43:47 +00:00
Olivier Fourdan 86f295f929 x11: emit ::enter/leave-monitor
For the X11 backend, keep a list of monitors for which the surface
intersects the monitor area.

Whenever the X11 surface is configured, check against the list of
monitors to determine whether it enters a new monitor or if it left a
monitor, to emit the corresponding ::enter/leave-monitor signals just
like a Wayland compositor would.

As monitors can be added, removed or reconfigured at any time, redo
those checks whenever any of these events occur.
2020-04-16 16:23:57 +02:00
Matthias Clasen e83d87c20a Add :focus-visible to css docs 2020-04-15 23:14:34 -04:00
Matthias Clasen 03080f29b9 css: use :focus-visible instead of :focus(visible)
This is aligning our language with
https://www.w3.org/TR/selectors-4/
2020-04-15 23:09:36 -04:00
Matthias Clasen 3d988d5fe9 Merge branch 'matthiasc/for-master' into 'master'
window: Don't set is-active twice

See merge request GNOME/gtk!1698
2020-04-15 22:26:25 +00:00
Matthias Clasen dbd578eaef window: Don't set is-active twice
We are listening to focus change events for this
no need to duplicate the work in ::state-changed.
2020-04-15 17:08:15 -04:00
Nelson Benítez León 45d7051dff GtkFilechooserWidget: prevent oblivious selection of file
which could happen after confirming the "file overwrite"
dialog and may result in a different file being overwritten
causing data loss.

The oblivious file selection can be done by a mouse
click or keyboard press sent inadvertently just after
confirming the "file overwrite" dialog (and before the
enclosing GtkfilechooserDialog is closed).

Fixed by adding a flag to ignore any button/key press
events sent to the file list. We set this flag just
after the user accepts the "file overwrite" dialog (which
means the enclosing GtkfilechooserDialog is about to
get closed). And we restablish the flag when the dialog
is shown again (in its map() handler).

Fixes data loss issue #2288
2020-04-15 16:46:43 -04:00
Matthias Clasen ec848dc83f Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #2612

See merge request GNOME/gtk!1695
2020-04-15 19:28:32 +00:00
Matthias Clasen d7bdfae8bb Updates to NEWS 2020-04-15 15:22:53 -04:00
Matthias Clasen 8e9406a082 Move key event rewriting
Stop rewriting key and focus events on the GDK side.
Instead deliver them as they are, and propagate them
from the root on the gtk side, in gtkmain.c. And
stop complaining about focus events on popups - we
can just ignore them if we have no use for them.
2020-04-15 14:56:32 -04:00
Matthias Clasen 031b248c20 window: Fix setting :is-active
We want to listen to focus events from the windowing
system here, relying on crossing events for this doesn't
work.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2612
2020-04-15 14:43:00 -04:00
Matthias Clasen a2a194f71e eventcontroller: Fix signal marshallers
GdkEvent is no longer a GObject. Any signals taking
events as arguments need to have their marshallers
fixed. Thankfully, we have few of these left.
2020-04-15 14:36:04 -04:00
Jakub Steiner bb8c2016a8 Merge branch 'wip/jimmac/drop-text-shadow' into 'master'
Adwaita: drop text shadows for buttons

Closes #2280

See merge request GNOME/gtk!1693
2020-04-15 17:21:32 +00:00
Jakub Steiner b6353a6369 Adwaita: drop text shadows for buttons
- People seem to misunderstand the unsharp-mask-like increase
  of visual contrast for "fuziness". That is not the reason for
  the change. The stylistic change of just going with flat
  text label allows to simplify the code and drop complexity.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2280
2020-04-15 18:27:49 +02:00
Matthias Clasen 6882121341 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1694
2020-04-15 16:23:14 +00:00
Jakub Steiner 97ceb03008 Merge branch 'wip/jimmac/checkradio-focus' into 'master'
Adwaita: check & radio focus ring

See merge request GNOME/gtk!1690
2020-04-15 15:47:14 +00:00
Jakub Steiner a5234f2d09 Merge branch 'wip/jimmac/active-state-for-checkradios' into 'master'
Adwaita: fix active state for radios & checkboxes

Closes #2493

See merge request GNOME/gtk!1689
2020-04-15 15:47:09 +00:00
Jakub Steiner faaf80dd46 Merge branch 'wip/jimmac/levelbar-punch' into 'master'
Adwaita: no edge highlight

Closes #2494

See merge request GNOME/gtk!1691
2020-04-15 15:45:05 +00:00
Matthias Clasen b072ad9993 widget-factory: Add menu style class in popovers
We have a hand-rolled popover menu on page 3 that looks
really bad right now. Adding the menu style class makes
it all better.
2020-04-15 11:36:09 -04:00
Jakub Steiner 90fb58e923 Merge branch 'wip/jimmac/treeview-borders' into 'master'
Adwaita: slightly increase contrast for treeview borders

Closes #2238

See merge request GNOME/gtk!1692
2020-04-15 15:35:32 +00:00
Jakub Steiner e6fcac29b5 Adwaita: slightly increase contrast for treeview borders
- sligtly increase contrast for the treeview borders
- FIXME: High Contrast seems to drop the borders completely,
  there might be some trickery for using border-left-color and
  border-top-color this way as even forcing the color 'red' seems
  to render invisible on HC.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2238
2020-04-15 14:55:33 +02:00
Matthias Clasen 71f8649f7f docs: Small revision of input handling overview
Remove a vestigial touch events section.
2020-04-15 08:08:12 -04:00
Jakub Steiner 3f9ee61a36 Adwaita: no edge highlight
- Levelbars and progressbars are indicators, not controls. They don't
  need no affordance signifier. Make it flat!

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2494
2020-04-15 13:56:12 +02:00
Jakub Steiner 097b585bbc Adwaita: check & radio focus ring
- this slipped through Frederik's patch
2020-04-15 13:45:59 +02:00
Jakub Steiner ed2a4e2d93 Adwaita: fix active state for radios & checkboxes
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/2493
2020-04-15 13:34:41 +02:00
Matthias Clasen fb2502fa5f Merge branch 'emoji-keynav' into 'master'
Emoji keynav

See merge request GNOME/gtk!1687
2020-04-15 05:34:03 +00:00
Matthias Clasen c4e66ec485 Merge branch 'arnaudb/fix-typo' into 'master'
Fix typo in IconTheme.

See merge request GNOME/gtk!1686
2020-04-14 19:27:34 +00:00
Matthias Clasen 4e6b62e564 emojichooser: link sections for keynav
Make Up/Down jump between sections in the Emoji grid.
2020-04-14 15:07:58 -04:00
Matthias Clasen 8f75df1cb3 flowbox: Add a private api to disable move-cursor
Without this, it seems impossible to make cross-section
keynav in the Emoji chooser work. I've tried, but got
lost between the focus, grab_focus, move_cursor and
keynav-failed vfuncs and signals, and their competing
implementations GtkFlowBox and GtkEmojiChooser.
2020-04-14 15:07:47 -04:00
Matthias Clasen 037b0259d8 flowbox: Remove can-focus handling
With the new meaning of can-focus, this doesn't make
sense anymore.
2020-04-14 15:07:10 -04:00
Arnaud Bonatti 8c769ea3f3 Fix typo in IconTheme.
The add_search_path() method was
using the resource_path property
in place of the search_path one.
2020-04-14 20:43:06 +02:00
Matthias Clasen 7179e8d5f3 emojichooser: Improve keynav, again
When the focus is moved to one of the Emoji children,
scroll it into view.
2020-04-14 13:25:20 -04:00
Matthias Clasen 325a485315 emojichooser: Improve keynav
Add an action to scroll to the next or previous section,
and bind it to Ctrl-n/Ctrl-p.
2020-04-14 13:25:20 -04:00
Emin Tufan Çetin 54300e1cc3 Update Turkish translation 2020-04-14 16:09:12 +00:00
Sabri Ünal db2e07758f Update Turkish translation 2020-04-14 16:01:18 +00:00
Matthias Clasen eb5b3083ff Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!1685
2020-04-14 14:07:54 +00:00
Matthias Clasen cd42227c29 Merge branch 'library-versioning' into 'master'
build: Prepare library versioning

See merge request GNOME/gtk!1684
2020-04-14 14:00:42 +00:00
Matthias Clasen 6870159c1d build: Prepare library versioning
Set version and soversion separately for the library.
When we do the 4.0 release, we will set:

gtk_soversion = '1'
gtk_library_version = '1.0.0'

See https://gitlab.gnome.org/GNOME/gtk/-/issues/1963
2020-04-14 09:15:31 -04:00
Matthias Clasen a072e16297 appchooserwidget: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen 78ac2f2d5b lockbutton: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen 9f5955e1b1 expander: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen fa759272b0 colorswatch: Drop the Private struct 2020-04-13 20:04:32 -04:00
Matthias Clasen d802b35578 Merge branch 'wip/matthiasc/monitor-signals' into 'master'
Add enter/leave signals for monitors

See merge request GNOME/gtk!1680
2020-04-13 23:25:55 +00:00
Matthias Clasen fdf812b7d7 Merge branch 'use-gtk-doc-for-gtk4' into 'master'
Use gtk-doc from the gtk-doc-for-gtk4 branch

See merge request GNOME/gtk!1683
2020-04-13 23:21:57 +00:00
Matthias Clasen 1205f74106 Always use gtk-doc as a subproject for now
We need the support for actions syntax, among
other things.
2020-04-13 16:40:57 -04:00
Matthias Clasen 906c3c570a Switch the gtk-doc subproject to the gtk-doc-for-gtk4 branch
This branch contains assorted fixes and enhancements that
are needed to build the gtk4 docs.
2020-04-13 16:40:11 -04:00
Mathieu H 57a56538eb Remove the blacklist list in convert-emoji.c since now it is supported 2020-04-13 16:29:02 -04:00
Aurimas Černius 6fbc9e8c3e Updated Lithuanian translation 2020-04-13 22:43:30 +03:00
Matthias Clasen d27adb10a0 surface: Document coordinate systems a bit
Mention that sizes are in application pixels.

Also, remove some X11-specific docs.
2020-04-13 09:29:11 -04:00
Matthias Clasen f97180beee inspector: Show scales other than 2
We were hardcoding that monitor scales can only be
1 or 2. Not true.
2020-04-13 09:17:46 -04:00
Matthias Clasen 209398d736 wayland: emit ::enter/leave-monitor
These signals directly mirror the surface_enter/leave events
of the Wayland protocol, so this is very staightforward.
2020-04-13 07:54:31 -04:00
Matthias Clasen 3ee18b88b9 gdk: Add ::enter/leave-monitor signals
These are useful to keep track of what monitors a window is on.
2020-04-13 07:54:31 -04:00
Matthias Clasen 64b0c63190 Merge branch 'modal-buttons' into 'master'
Modal buttons

See merge request GNOME/gtk!1679
2020-04-13 11:15:14 +00:00
Matthias Clasen 8ff540eb4c appchooserbutton: Drop the Private struct 2020-04-13 01:08:52 -04:00
Matthias Clasen 9194b7388f Add a GtkAppChooserButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-13 00:43:19 -04:00
Matthias Clasen 6831d3e28e fontbutton: Drop the Private struct 2020-04-13 00:32:50 -04:00
Matthias Clasen 800f1c03d5 Add a GtkFontButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-13 00:28:34 -04:00
Matthias Clasen 7a0355fcb1 colorbutton: Drop the Private struct 2020-04-13 00:28:11 -04:00
Matthias Clasen 15d58a868a Add a GtkColorButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-13 00:17:00 -04:00
Matthias Clasen 61f21fc9e9 filechooserbutton: Make dialog modal by default
This is the expected behavior, so default to it.
2020-04-13 00:12:30 -04:00
Matthias Clasen 9e068d3a46 filechooserbutton: Drop the Private struct 2020-04-12 23:57:49 -04:00
Matthias Clasen 2aa136a19c Add a GtkFileChooserButton:modal property
Nowadays, dialogs are expected to be attached, typically,
and that only happens when they are marked as modal.
2020-04-12 23:45:03 -04:00
Matthias Clasen 1dfd514f7f Merge branch 'matthiasc/for-master' into 'master'
Adwaita: visible focus outline for color swatches

See merge request GNOME/gtk!1678
2020-04-13 03:42:26 +00:00
Matthias Clasen 08fbd012ec window: Make resize cursors work for modal dialogs
We were inadvertedly not letting the grab_widget determine
a cursor. This was showing up as resize cursors not appearing.
2020-04-12 22:18:50 -04:00
Matthias Clasen 638508fa20 gtk-demo: Group the OpenGL demos 2020-04-12 21:58:07 -04:00
Matthias Clasen ce6c7bae51 gtk-demo: Add a gears demo 2020-04-12 20:52:15 -04:00
Matthias Clasen 19f7b7ed40 Adwaita: visible focus outline for color swatches
Make the focus outline for color swatches visible
again.
2020-04-12 20:13:50 -04:00
Matthias Clasen e3dba28666 Merge branch 'arnaudb/better-substitution' into 'master'
Fix some gtk-builder-tool substitutions.

See merge request GNOME/gtk!1675
2020-04-12 22:53:54 +00:00
Matthias Clasen 88aa548965 Merge branch 'matthiasc/for-master' into 'master'
text: Fix placing the cursor on click

See merge request GNOME/gtk!1673
2020-04-12 22:07:20 +00:00
Matthias Clasen 17a9b13af2 text: Be more careful with cached layouts
If we call any functions that may call ensure_layout
themeselves, we risk having the cached layout pulled
out from underneath. Better play it safe and take a
reference.
2020-04-12 17:32:57 -04:00
Matthias Clasen 1efa781a19 window: Cosmetic cleanup
Use a convenience function to get the current event time.
2020-04-12 17:32:13 -04:00
Matthias Clasen 0a19d7ef08 textview: Fix an erroneous unref
This was left behind by accident in 0ee58e9ef4.
2020-04-12 17:32:13 -04:00
Arnaud Bonatti 926fb208ba Coding style improvements. 2020-04-12 21:21:24 +02:00
Arnaud Bonatti e76dee07c5 Fix tests for margin-left and margin-right. 2020-04-12 19:28:33 +02:00
Arnaud Bonatti 11a43cf554 Replace also margin-left and margin-right. 2020-04-12 19:28:29 +02:00
Arnaud Bonatti a7218da202 Fix tests for hexpand and vexpand. 2020-04-12 19:28:29 +02:00
Arnaud Bonatti ed362fcc5b Fix --3to4 tests for margin substitution. 2020-04-12 19:28:29 +02:00
Arnaud Bonatti 17ec74da35 Fix a gtk-builder-tool substitution.
The margin-left and margin-right properties have been
removed in favor of margin-start and margin-end ones.
2020-04-12 19:28:29 +02:00
Matthias Clasen 754d6d1a04 wayland: Avoid criticals when unsetting transient parents
Must not check the display when parent is NULL.
2020-04-12 12:10:18 -04:00
Matthias Clasen ff53d5ba11 stylecontext: Respect cursor aspect ratio everywhere
We were using the new cursor aspect ratio setting in
the snapshotting code, but not in gtk_render_insertion_cursor.

Make them both behave the same.
2020-04-12 11:44:13 -04:00
Matthias Clasen 7233a70d47 reftest: get backtraces
In the hope of making ci-only failures less of a black hole,
add a backtrace to the messsage for criticals.

This could eventually go into GLib (pass backtrace symbols along
as a log field for criticals), but for now this will do.
2020-04-12 11:44:13 -04:00
Emmanuele Bassi 12990b3520 Merge branch 'ci-error-report' into 'master'
ci: Count 'ERROR' codes as failures

See merge request GNOME/gtk!1674
2020-04-12 13:58:55 +00:00
Emmanuele Bassi 95d807ab61 ci: Count 'ERROR' codes as failures
Otherwise they'll be dropped from our reports.
2020-04-12 14:28:59 +01:00
Matthias Clasen 8a1a96a47e text: Fix placing the cursor on click
Commit c297d45b8a accidentally removed the
check for the right modifier mask, causing us to
always extend the selection.
2020-04-12 09:19:12 -04:00
sicklylife c31916081f Update Japanese translation 2020-04-12 08:53:45 +00:00
Piotr Drąg 0a1e19f4e3 Update POTFILES.in 2020-04-12 10:45:54 +02:00
Matthias Clasen 7d3f3b7ab8 Merge branch 'show-uri-async' into 'master'
Redo gtk_show_uri_on_window

See merge request GNOME/gtk!1671
2020-04-12 02:27:38 +00:00
Matthias Clasen 432b741ab7 gtk: Port all users to the new gtk_show_uri()
We were only handling the error in one place anyway.
2020-04-11 22:10:08 -04:00
Matthias Clasen 703f18ce66 Redo gtk_show_uri_on_window
Make this a full async function, and add a simple wrapper.

Call gtk_show_uri_full() if you need control over the
results, and use gtk_show_uri() if you are fine with
ignoring any errors.
2020-04-11 21:56:32 -04:00
Matthias Clasen 4da82bde7b Merge branch 'current-event-apis' into 'master'
Current event apis

See merge request GNOME/gtk!1668
2020-04-12 00:24:14 +00:00
Matthias Clasen feee281cf8 Drop gtk_get_current_ apis
We have event controller apis to replace these.
There is one remaining use of gtk_get_current_event_time
in gtkwindow.c, so we can't drop the implementation yet.

Add a section in the migration guide for this.
2020-04-11 17:29:27 -04:00
Matthias Clasen 443fd4d63d tests: Stop using gtk_get_current_ apis
Replace these by equivalent event controller
apis where needed.
2020-04-11 17:29:27 -04:00
Matthias Clasen 4b346538e2 gtk: Port widgets away from gtk_get_current_ apis
This commit handles complicated cases where we selections.
We handle this by adding extend and modify parameters to
the ::move-cursor signals, and adjust the bindings
accordingly.
2020-04-11 17:29:27 -04:00
Matthias Clasen 0ee58e9ef4 gtk: Port widgets away from gtk_get_current_ apis
Use the event controller equivalents where needed.
This commit covers the simple cases.
2020-04-11 17:29:27 -04:00
Matthias Clasen bd56bc9055 Add gtk_event_controller_get_current_event[_state]
For now these are private, to replace internal uses
of gtk_get_current_event[_state], but we may want to
make them public.
2020-04-11 17:29:27 -04:00
Matthias Clasen 3e7e862415 gtk: Just use current time for showing urls
We don't really have an event anywhere close in most
cases, and we already pass GDK_CURRENT_TIME in half
the cases anyway.

If we want to be serious about this, we need to pass
the event itself, since future focus-stealing protocols
may not rely on just a timestamp.
2020-04-11 17:29:27 -04:00
Matthias Clasen 4eeb413047 entrycompletion: Remove an unused field
No point in storing a device that is never used.
2020-04-11 17:29:27 -04:00
Matthias Clasen 661f3466c2 Merge branch 'matthiasc/for-master' into 'master'
broadway: Fix the build

See merge request GNOME/gtk!1670
2020-04-11 21:16:11 +00:00
Matthias Clasen e735554ced broadway: Fix the build
We need to depend on gdkenum_h, since we are (indirectly)
including gdkenumtypes.h in the broadway server build.
2020-04-11 16:24:05 -04:00
Matthias Clasen 520ea7c39d Merge branch 'jjardon/more_licenses' into 'master'
gtk/gtkaboutdialog: Add some more very common licenses:

See merge request GNOME/gtk!1667
2020-04-11 16:47:32 +00:00
Javier Jardón ffa345e4ab gtk/gtkaboutdialog: Add some more very common licenses:
- BSD 3-Clause "New" or "Revised" license
- Apache License 2.0
- Mozilla Public License 2.0
2020-04-11 16:49:09 +01:00
Emmanuele Bassi e072d9b28b Merge branch 'gsk-public-symbols' into 'master'
Install all headers with public symbols

Closes #2607

See merge request GNOME/gtk!1666
2020-04-11 15:21:11 +00:00
Matthias Clasen 9f5b04e65c Merge branch 'action-docs' into 'master'
Action docs

See merge request GNOME/gtk!1665
2020-04-11 15:12:22 +00:00
Emmanuele Bassi d08310096c Conditionally include the GSK broadway and vulkan symbols
In case GTK is built without these features.
2020-04-11 15:42:51 +01:00
Emmanuele Bassi 20d0d6fae2 Revert "Do not install GSK headers for missing backends"
This reverts commit cd5cded430.

The headers are public, but the symbols availability is conditional on
the GTK build.
2020-04-11 15:41:47 +01:00
Matthias Clasen 6b9ac1043b Document actions 2020-04-11 10:07:31 -04:00
Matthias Clasen c5b4066714 gdk: Small documentation fixes 2020-04-11 10:07:31 -04:00
Matthias Clasen b09b2dd2cd testsuite: Make actions test order-independent
We only want to check that the actions are what we
expect, not that they are registered in a particular
order.
2020-04-11 10:07:31 -04:00
Matthias Clasen 72a0828101 Merge branch 'respect-window-cursors' into 'master'
window: Respect widget cursors

See merge request GNOME/gtk!1663
2020-04-10 18:56:44 +00:00
Matthias Clasen 7379c34a39 window: Respect widget cursors
gtk_widget_set_cursor can be used on a GtkWindow; we
should not blow away the result when temporarily installing
resize cursors.
2020-04-10 14:36:55 -04:00
Matthias Clasen 6cd1b9955b Merge branch 'remove-style-reset' into 'master'
Remove gtk_style_context_reset_widgets

See merge request GNOME/gtk!1662
2020-04-10 17:36:03 +00:00
Matthias Clasen a6a31827bc Remove gtk_style_context_reset_widgets
This should never be necessary to call from the outside.
Whenever we fail to update styles properly, it is a bug.
2020-04-10 12:45:28 -04:00
Matthias Clasen 84939a612c Merge branch 'reduce-style-context-use' into 'master'
Use gtk_widget_add/remove_css_class more

See merge request GNOME/gtk!1661
2020-04-10 16:43:05 +00:00
Matthias Clasen 394ea32e93 Use gtk_widget_add/remove_css_class more
Replace most uses of gtk_style_context_add/remove_class
by the new APIs. The only remaining uses of the old API
are in save/restore situations.
2020-04-10 12:09:57 -04:00
Matthias Clasen 2bd36d490b Merge branch 'fix-accel-length' into 'master'
accelgroup: Fix an invalid write

Closes #2602

See merge request GNOME/gtk!1660
2020-04-10 13:27:07 +00:00
Matthias Clasen ad1bc75dd2 accelgroup: Fix an invalid write
This was lost by accident in d110fddbce.

Fixes: #2602
2020-04-10 08:24:03 -04:00
Piotr Drąg 7505c1fd7c Update POTFILES.in and POTFILES.skip 2020-04-10 13:56:58 +02:00
Matthias Clasen 8780906b93 Merge branch 'fix-radiobuttons' into 'master'
radiobutton: Fix selection on focus-in

Closes #2326

See merge request GNOME/gtk!1658
2020-04-10 04:17:37 +00:00
Matthias Clasen 0ed2e970be Merge branch 'popover-initial-focus' into 'master'
Popover initial focus

See merge request GNOME/gtk!1657
2020-04-10 04:17:15 +00:00
Matthias Clasen 58253d567f radiobutton: Fix selection on focus-in
We need to unselect the previously selected button
to preserve radioness.

Fixes: #2326
2020-04-09 22:38:30 -04:00
Matthias Clasen c09c61769c modelbutton: Catch focus-in more carefully
We need to unset the propagation limit on the focus
controller, else we miss the focus-in when the focus
enters the popover upon initial popup, when it comes
from the parent button.
2020-04-09 22:22:28 -04:00
Matthias Clasen 9b5dc35650 popovermenu: Remove debug spew 2020-04-09 21:41:02 -04:00
Matthias Clasen 3c9ada14fe Merge branch 'label-double-focus' into 'master'
Avoid double focus in labels

Closes #135

See merge request GNOME/gtk!1656
2020-04-10 01:34:49 +00:00
Matthias Clasen 6b4d6c3771 Merge branch 'scale-button-double-focus' into 'master'
scalebutton: Don't derive from GtkButton

See merge request GNOME/gtk!1655
2020-04-10 01:21:25 +00:00
Matthias Clasen b15f16e8db Adwaita: Don't render focus around labels with links
This avoids the 'double outline' problem for labels
with links.

Fixes: #135
2020-04-09 21:19:36 -04:00
Matthias Clasen e3b9dfef1c label: Improve link styling
Add a .link style class on labels that contain links,
so we can avoid the focus outline around the label
when individual links are focused, and use the link
node when rendering the focus on links.
2020-04-09 21:19:22 -04:00
Matthias Clasen 822c2aba36 scalebutton: Don't derive from GtkButton
Make GtkScaleButton a widget that has a toggle button
as a child, just like all the other button widgets now.
The immediate benefit of this arrangement is to avoid
the "double focus" problem when we pop up the popup.

Update accessible, demos and tests to match.
2020-04-09 20:43:45 -04:00
Matthias Clasen a11f9fea76 Merge branch 'wip/matthiasc/can-focus' into 'master'
Implement new focus behavior

See merge request GNOME/gtk!1652
2020-04-10 00:26:53 +00:00
Matthias Clasen f16c829190 Mention focus changes in the migration guide 2020-04-09 18:26:31 -04:00
Matthias Clasen 16c820c2f0 Small documentation tweaks
Update the docs for GtkWidget:can-focus and :focus-on-click.
2020-04-09 18:26:31 -04:00
Matthias Clasen 72ae6daa1e Move focus to the parent if a popover is dismissed
This is better than just dropping focus altogether,
and is expected behavior in most cases.
2020-04-09 18:26:31 -04:00
Matthias Clasen 35ba24d2e8 Update a11y test results 2020-04-09 18:26:10 -04:00
Matthias Clasen 508cb6160c a11y: Fix focusable state
The :can-focus property is no longer very useful to
give an indication of what is focusable, since it is
TRUE for almost all widgets now. Patch things up
to by looking at known widget types.
2020-04-09 18:14:15 -04:00
Matthias Clasen b9a76ddd75 Fix the tools tests to not set can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen 038190c5a8 Disable focus-chain test that depends on the environment
The color editor shows a color picker button only if it
finds a suitable implementation, which it does not in ci.
So disable the focus-chain test for page 3.
2020-04-09 17:50:29 -04:00
Matthias Clasen 2ae08e632c color editor: Make the sample non-focusable again
This is one of the situations, where can-focus can still
be used to tweak focus behavior of leaf widgets. Color
swatches are focusable by default to allow selecting colors
with the keyboard. But when used as color samples, they
should not take focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen 99eed078bd Remove focusable-container tests
Like the previous commit, these tests were relying
on setting :can-focus to make an unsuspecting container
focusable, which does not work anymore.
2020-04-09 17:50:29 -04:00
Matthias Clasen 6720552afd Remove the focus test
This test was expecting to make existing widgets like
GtkBox focusable by setting :can-focus. That just doesn't
work anymore.

The focus chain testing that is done here is already
better covered by test-focus-chain, so lets just remove this.
2020-04-09 17:50:29 -04:00
Matthias Clasen 6f01508aa8 Fix up focus chain result
The notebook grab_focus change in the previous commit made
backwards tabbing work as expected, and thereby changed the
output of one of the focus-chain tests.
2020-04-09 17:50:29 -04:00
Matthias Clasen 632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen 22e1827f84 Change the default value of GtkWidget:can-focus
Make widgets can-focus by default, and change the semantics
of can-focus to be recursive . If it is set to FALSE, focus
can not enter the widget or its descendents at all anymore.

This commit temporarily breaks focus behavior of widgets
that did not expect to receive focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen 3c39613d9c widget: Add common focus vfunc implementations
Privately export a number of implementations for the focus
and grab_focus vfuncs that cover many common cases.
2020-04-09 17:50:29 -04:00
Matthias Clasen 46ff9f891a gizmo: Allow passing changing focus behavior
We need this in popovers. Maybe it could be done better
by defining one-off custom widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen 97ff1b83dc widget: Make the :has-focus property readonly
The only place where this should be set is when making
a widget the focus-widget of a window. We still keep
the property around in readonly form, since there are
a few places where we rely on property notification
for it.
2020-04-09 17:50:29 -04:00
Matthias Clasen 9416856420 testsuite: Stop setting :has-focus
This is not necessary, whenever we want to set the initial
focus in a ui file, we can set GtkWindow:focus-widget.
2020-04-09 17:50:29 -04:00
Matthias Clasen c1459cc45b widget: Drop the :is-focus property
This property doesn't carry any new information compared
to GtkWindow:focus-widget. We still keep the gtk_widget_is_focus
getter, as a convenient shortcut.
2020-04-09 17:50:29 -04:00
Matthias Clasen 4fe8c037c7 reftests: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen b1afe5ff23 a11y tests: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen bbd4fb8798 testsuite: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen b3b29e37fd inspector: Drop more uses of can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen f996ba6585 inspector: Remove can-focus from ui files 2020-04-09 17:50:29 -04:00
Matthias Clasen 7ca36cd2d4 Stop setting can-focus in ui files
None of these settings are necessary.
2020-04-09 17:50:29 -04:00
Matthias Clasen 2a18f2150d window: Make set_focus equal to grab_focus
Make gtk_window_set_focus call gtk_widget_grab_focus internally.
This means that set_focus can now end up putting the focus on
a child of the passed-in widget, and makes the focus-widget
property work for setting initial focus to (the child of) an
entry in a ui file.
2020-04-09 17:50:28 -04:00
Matthias Clasen a65fd81106 root: Reorganize focus handling
Make :focus-widget a GtkWindow property and add vfuncs
to the GtkRoot interface instead of the property.
2020-04-09 17:50:28 -04:00
Matthias Clasen ff8217db40 Add more focus chain tests
Test page 2 and 3 of widget-factory as well, and try other directions.
2020-04-09 17:50:28 -04:00
Matthias Clasen a3861bf9a0 Fix running focus-chain tests in ci
The widget-factory ui files require geettings
(for the color chooser), so set GSETTINGS_SCHEMA_DIR.
2020-04-09 17:50:28 -04:00
Matthias Clasen b86c1446a4 notbook: Fix a bug in focus handling
After the header widget was introduced, focus would get
stuck in a loop between actions and tabs.

This could be seen in the notebook on page 3 of
widget-factory.
2020-04-09 17:50:28 -04:00
Matthias Clasen 9ce58bdb0c coloreditor: Draw a focus around the color plane
Not doing it was just an oversight.
2020-04-09 14:11:18 -04:00
Matthias Clasen 9f252f0ceb colorplane: Set a css name
Every widget should have one.
2020-04-09 14:10:23 -04:00
Matthias Clasen 7008a531bb Merge branch 'wip/xdg-popup-move' into 'master'
Wayland popup moving

See merge request GNOME/gtk!1017
2020-04-08 23:59:02 +00:00
Jonas Ådahl 458b8a6554 wayland: Move transient-for field to GdkWaylandToplevel
A toplevel will only ever be transient-for to another toplevel, and only
a toplevel will ever be transient-for, so move the field into the
GdkWaylandToplevel, and make it a pointer to another GdkWaylandToplevel.
2020-04-08 23:32:47 +02:00
Jonas Ådahl 307cc69adb wayland: Add surface to toplevel list only if toplevel
It was using another check (has parent) to do this, but now we have a
much more obvious way of creating surfaces, so we can use the type
directly.
2020-04-08 23:32:47 +02:00
Jonas Ådahl ab6b5ae568 wayland: Remove own pointer to the popup parent
It's there already as the GdkSurface::parent, no need to duplicate.
2020-04-08 23:32:47 +02:00
Jonas Ådahl 0e601c0a70 wayland: Move toplevel/popup/drag surface definitions higher up
We them up there, so that code higher up compared to where they are
defined now can make use of them. Also add a few macros for type
checking and casting.
2020-04-08 23:32:47 +02:00
Jonas Ådahl 5425edff82 wayland: Move popups with xdg_popup.reposition
The third version of xdg-shell introduces support for explicit popup
repositioning. If available, make use of this to implement popup
repositioning.

Note that this does *NOT* include atomic parent-child state
synchronization. For that,
https://gitlab.freedesktop.org/wayland/wayland-protocols/issues/13 will
be needed.

This currently uses my own fork of wayland-protocols which adds meson
support, so that we can use it as a subproject. Eventually when
wayland-protocols' meson support lands upstream, we should change it to
point there.

Silence some meson warnings while at it to make CI happy.

This also bumps the glib requirement, since g_warning_once() is used.
2020-04-08 23:32:47 +02:00
Jonas Ådahl 213c471bb7 build: Change wrap revisions to use master instead of origin/master
Using origin/master crashes meson.
2020-04-08 23:32:47 +02:00
Jakub Steiner 9ae0fe7f3a Merge branch 'Gtk4_blue_focus_rings' into 'master'
Blue outlines / focus rings

See merge request GNOME/gtk!1629
2020-04-08 21:12:57 +00:00
Frederik F abe6876f7c Blue outlines / focus rings
- introduce two new colors: $focus_border_color for focused / outlined elements and $_coloured_focus_border_color for focused / outlined elements with a colored background color, like suggested/destructive buttons or selected elements
- set outline / focus color, offset and style accordingly for all widgets
- adapt entry focus color
2020-04-08 21:12:57 +00:00
Matthias Clasen 53d74fd2dc Merge branch 'render-node-types' into 'master'
Turn GskRenderNode into a fundamental type

See merge request GNOME/gtk!1649
2020-04-08 20:55:14 +00:00
Emmanuele Bassi 3f0a830f3c Properly annotate the render node constructors
Now that the GskRenderNode subclasses are recognised as proper
sub-types, we can annotate the constructors with their type. The C API
remains the same.
2020-04-08 16:17:08 +01:00
Emmanuele Bassi e0323fcdc2 Add get_type() functions for GskRenderNode subclasses
The introspection scanner tries to match a type name with a get_type()
function, in order to correctly identify a type as a class.

If the function is not available, we have two choices:

 - add some special case inside the introspection scanner, similar to
   how GParamSpec subclasses are handled in GObject
 - add a simple get_type() function

The latter is the simplest approach, and we don't need to change that
much, since we still register all render nodes at once.
2020-04-08 16:07:04 +01:00
Emmanuele Bassi cd5cded430 Do not install GSK headers for missing backends
Broadway and Vulkan renderers are optional; if GTK hasn't been built
with their GSK renderers, we should not install their headers.
2020-04-08 15:41:21 +01:00
Emmanuele Bassi 54e4e6cd23 Improve the gtktypefuncs.inc generator
Remove the plug/socket exception, and add exceptions for non-X11
windowing systems.

Additionally, speed up the file generation by avoiding string
concatenation in Python.
2020-04-08 15:41:19 +01:00
Emmanuele Bassi 59852d3425 Add missing transfer annotation 2020-04-08 15:40:15 +01:00
Emmanuele Bassi d701a89281 Turn GskRenderNode into a derivable type
Language bindings—especially ones based on introspection—cannot deal
with custom type hiearchies. Luckily for us, GType has a derivable type
with low overhead: GTypeInstance.

By turning GskRenderNode into a GTypeInstance, and creating derived
types for each class of node, we can provide an introspectable API to
our non-C API consumers, with no functional change to the C API itself.
2020-04-08 15:40:15 +01:00
Emmanuele Bassi 5e095cd208 Add macro for exported variables
The logic is based on the similar macro in GLib, but with the
appropriate GDK symbols.
2020-04-08 15:40:15 +01:00
Emmanuele Bassi d2bdf3d5a1 Merge branch 'ci-meson-bump' into 'master'
ci: Update the version of Meson in our Docker image

See merge request GNOME/gtk!1651
2020-04-08 12:17:50 +00:00
Emmanuele Bassi e692385baa ci: Update the version of Meson in our Docker image
Needed for !1017.
2020-04-08 12:26:58 +01:00
Matthias Clasen 1e8df851e9 Merge branch 'matthiasc/for-master' into 'master'
Remove an unused backend includes

See merge request GNOME/gtk!1648
2020-04-07 20:30:43 +00:00
Matthias Clasen 904db0a8f7 Merge branch 'imcontextsimple-drop-ifdefs' into 'master'
impcontextsimple: Drop ifdef'ed platform dependencies

See merge request GNOME/gtk!1647
2020-04-07 19:27:51 +00:00
Matthias Clasen 6b7cc8baa6 Remove an unused backend includes
These includes are just leftovers.

Every time where we do an #ifdef GDK_WINDOWING... in gtk/,
something went wrong. Don't do it needlessly.
2020-04-07 15:13:18 -04:00
Matthias Clasen 71fe843d99 impcontextsimple: Drop ifdef'ed platform dependencies
The proper way to do this would be to adapt the tables
to have the right data for the platform. Since 4.0 is
a new start in many ways, lets clean this up.
2020-04-07 14:54:04 -04:00
Matthias Clasen 552a681816 Merge branch 'private-x11-types' into 'master'
Do not parse all GDK-X11 source files

See merge request GNOME/gtk!1646
2020-04-07 18:18:55 +00:00
Emmanuele Bassi 2f0016eb08 Rename gdkx11keys.h
The header is now private, so it should follow the same naming scheme
for private GDK-X11 headers.
2020-04-07 18:12:58 +01:00
Emmanuele Bassi f87291cac2 Hide GdkX11Keymap's GType function
It's not a public object.
2020-04-07 18:10:01 +01:00
Emmanuele Bassi 37c3ba2645 Do not parse all GDK-X11 source files
We don't need all of them, only the ones that contain public API. This
allows us to reduce the chance of a stray symbol getting incorrectly
added to the introspection data.
2020-04-07 18:06:08 +01:00
Matthias Clasen ba05787a06 Merge branch 'attribute-docs' into 'master'
entry: Document buildable support

See merge request GNOME/gtk!1643
2020-04-07 04:15:33 +00:00
Matthias Clasen 12b97ffd24 entry: Document buildable support 2020-04-06 23:33:22 -04:00
Matthias Clasen 1ae60cb713 entry: Add <attributes> support
Make entries support the same <attributes> syntax
as labels.

Closes: #1335
2020-04-06 22:59:54 -04:00
Matthias Clasen 3371e3aa49 Move label attribute parser code
We want to reuse the parser for <attributes> in several
widgets, so move it to a shared place.
2020-04-06 22:59:45 -04:00
579 changed files with 37065 additions and 26788 deletions
+5 -5
View File
@@ -27,14 +27,14 @@ variables:
style-check-diff:
extends: .only-default
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
stage: .pre
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
@@ -66,7 +66,7 @@ fedora-x86_64:
<<: *cache-paths
release-build:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
@@ -168,7 +168,7 @@ flatpak-master:icon-browser:
<<: *flatpak-master
static-scan:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
stage: analysis
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
@@ -181,7 +181,7 @@ static-scan:
allow_failure: true
reference:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v15
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
stage: docs
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
+1 -1
View File
@@ -82,7 +82,7 @@ RUN dnf -y install \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson==0.52.1
RUN pip3 install meson==0.53.1
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
+20 -20
View File
@@ -174,7 +174,7 @@ ul.images li {
<div class="failures">
<h4><a name="{{ suite_result.suite_name }}-failed">Failures</a></h4>
<ul class="failed">
{% for failure in suite_result.failures if failure.result in [ 'FAIL', 'UNEXPECTEDPASS' ] %}
{% for failure in suite_result.failures if failure.result in [ 'ERROR', 'FAIL', 'UNEXPECTEDPASS' ] %}
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
{% if failure.stdout %}
Output: <pre>{{ failure.stdout }}</pre>
@@ -207,24 +207,6 @@ ul.images li {
</div>
<div class="successes">
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-expected-fail">Expected failures</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
@@ -244,6 +226,24 @@ ul.images li {
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
</div>
</div>
@@ -331,7 +331,7 @@ for name, units in suites.items():
print('Processing {} suite {}:'.format(project_name, suite_name))
def if_failed(unit):
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT', 'ERROR',]:
return True
return False
+1 -1
View File
@@ -70,7 +70,7 @@ for name, units in suites.items():
print('Processing suite {} (units: {})'.format(name, len(units)))
def if_failed(unit):
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
if unit['result'] in ['ERROR', 'FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
return True
return False
+76
View File
@@ -1,3 +1,79 @@
Overview of Changes in GTK 3.98.3
=================================
* GtkEntry:
- Support setting attributes in ui files
* GtkScaleButton:
- Don't derive from GtkButton
* GtkAboutDialog:
- Support more common licenses
* GtkEmojiChooser:
- Improve keyboard navigation
* GtkLabel:
- Remove pattern API
* GtkAspectFrame:
- Modernize and simplify
* Chooser buttons:
- Make dialogs modal by default
* Various widgets:
- Replace shadow-type and relief properties by
a simpler has-frame
* CSS:
- Use :focus-visible instead of :focus(visible)
- Add support for :focus-within
* Focus handling
- Fix crossing event generation
- Fix focus handling in various widgets
- Change :can-focus to be recursive
- Fix GtkWindow:is-active setting
* Scrolling
- gtk_container_set_focus_[hv]adjustment has been removed
- gtk_viewport_set_scroll_to_focus has been added
* Accessibility:
- Add a cursor-aspect-ratio setting
- Set focus-related states properly
* Themes:
- Use blue focus outlines more
- Numerous minor improvements
* Wayland:
- Fix .Compose file loading
- Support popup repositioning
- Fix problems with autohide popovers
* GDK:
- Remove GdkKeymap from public API, replaced by
GdkDevice properties
- Add full keyboard translation state to key events
- Simplify modifier support, drop GdkModifierIntent
- Move key event matching to GDK
- Add GdkSurface::enter/leave-monitor signals
- Turn GskEvent into a derivable type, and make
it introspectable
* GSK:
- Turn GskRenderNode into a derivable type, and make
it introspectable
- Fall back to cairo if compiling shaders fails
* Translation updates:
- Japanese
- Lithuanian
- Turkish
Overview of Changes in GTK 3.98.2
=================================
@@ -613,19 +613,19 @@ create_widget_func (gpointer item,
if (GTK_IS_CONSTRAINT (item) || GTK_IS_CONSTRAINT_GUIDE (item))
{
button = gtk_button_new_from_icon_name ("document-edit-symbolic");
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (row_edit), win);
g_object_set_data (G_OBJECT (row), "edit", button);
gtk_container_add (GTK_CONTAINER (box), button);
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
gtk_container_add (GTK_CONTAINER (box), button);
}
else if (GTK_IS_WIDGET (item))
{
button = gtk_button_new_from_icon_name ("edit-delete-symbolic");
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
gtk_button_set_has_frame (GTK_BUTTON (button), FALSE);
g_signal_connect (button, "clicked", G_CALLBACK (row_delete), win);
gtk_container_add (GTK_CONTAINER (box), button);
}
+2 -2
View File
@@ -214,7 +214,7 @@ constraint_view_add_child (ConstraintView *view,
label = gtk_label_new (name);
frame = gtk_frame_new (NULL);
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "child");
gtk_widget_add_css_class (frame, "child");
gtk_widget_set_name (frame, name);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_set_parent (frame, GTK_WIDGET (view));
@@ -257,7 +257,7 @@ constraint_view_add_guide (ConstraintView *view,
G_BINDING_DEFAULT);
frame = gtk_frame_new (NULL);
gtk_style_context_add_class (gtk_widget_get_style_context (frame), "guide");
gtk_widget_add_css_class (frame, "guide");
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
+1 -1
View File
@@ -61,7 +61,7 @@
</child>
<child>
<object class="GtkScrolledWindow">
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<child>
<object class="GtkTextView">
<property name="hexpand">1</property>
+1 -1
View File
@@ -26,7 +26,7 @@
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="vexpand">1</property>
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="min-content-width">150</property>
<layout>
<property name="left-attach">0</property>
+12 -14
View File
@@ -131,13 +131,11 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
GtkAlign valign, halign;
gboolean is_left, is_right, is_top, is_bottom;
gboolean has_left, has_right, has_top, has_bottom;
GtkStyleContext *context;
context = gtk_widget_get_style_context (child);
has_left = gtk_style_context_has_class (context, GTK_STYLE_CLASS_LEFT);
has_right = gtk_style_context_has_class (context, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_style_context_has_class (context, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_style_context_has_class (context, GTK_STYLE_CLASS_BOTTOM);
has_left = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_LEFT);
has_right = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_RIGHT);
has_top = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_TOP);
has_bottom = gtk_widget_has_css_class (child, GTK_STYLE_CLASS_BOTTOM);
is_left = is_right = is_top = is_bottom = FALSE;
@@ -160,24 +158,24 @@ blur_overlay_child_update_style_classes (BlurOverlay *overlay,
is_bottom = (child_allocation->y + child_allocation->height == height);
if (has_left && !is_left)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_LEFT);
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_LEFT);
else if (!has_left && is_left)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LEFT);
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_LEFT);
if (has_right && !is_right)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_RIGHT);
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_RIGHT);
else if (!has_right && is_right)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_RIGHT);
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_RIGHT);
if (has_top && !is_top)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_TOP);
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_TOP);
else if (!has_top && is_top)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_TOP);
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_TOP);
if (has_bottom && !is_bottom)
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_BOTTOM);
gtk_widget_remove_css_class (child, GTK_STYLE_CLASS_BOTTOM);
else if (!has_bottom && is_bottom)
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BOTTOM);
gtk_widget_add_css_class (child, GTK_STYLE_CLASS_BOTTOM);
}
static void
+6 -200
View File
@@ -12,6 +12,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
#include "demoimage.h"
static GtkWidget *window = NULL;
@@ -93,147 +94,6 @@ paste_button_clicked (GtkWidget *button,
gdk_clipboard_read_text_async (clipboard, NULL, paste_received, entry);
}
static GdkPaintable *
get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
GtkIconTheme *icon_theme;
GtkIconPaintable *icon;
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_PAINTABLE:
return g_object_ref (gtk_image_get_paintable (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon = gtk_icon_theme_lookup_icon (icon_theme,
icon_name,
NULL,
48, 1,
gtk_widget_get_direction (GTK_WIDGET (image)),
0);
if (icon == NULL)
return NULL;
return GDK_PAINTABLE (icon);
case GTK_IMAGE_EMPTY:
case GTK_IMAGE_GICON:
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
return NULL;
}
}
static void
drag_begin (GtkDragSource *source,
GdkDrag *drag,
GtkWidget *widget)
{
GdkPaintable *paintable;
paintable = get_image_paintable (GTK_IMAGE (widget));
if (paintable)
{
gtk_drag_source_set_icon (source, paintable, -2, -2);
g_object_unref (paintable);
}
}
static GdkContentProvider *
prepare_drag (GtkDragSource *source,
double x,
double y,
GtkWidget *image)
{
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (image));
if (!GDK_IS_TEXTURE (paintable))
return NULL;
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, paintable);
}
static gboolean
drag_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y,
GtkImage *image)
{
GdkTexture *texture = g_value_get_object (value);
gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (texture));
return TRUE;
}
static void
copy_image (GSimpleAction *action,
GVariant *value,
gpointer data)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
if (GDK_IS_TEXTURE (paintable))
gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
if (paintable)
g_object_unref (paintable);
}
static void
paste_image_received (GObject *source,
GAsyncResult *result,
gpointer data)
{
GdkTexture *texture;
texture = gdk_clipboard_read_texture_finish (GDK_CLIPBOARD (source), result, NULL);
if (texture == NULL)
return;
gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
static void
paste_image (GSimpleAction *action,
GVariant *value,
gpointer data)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
gdk_clipboard_read_texture_async (clipboard, NULL, paste_image_received, data);
}
static void
pressed_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
GtkWidget *image)
{
GtkWidget *popover;
GMenu *menu;
GMenuItem *item;
menu = g_menu_new ();
item = g_menu_item_new (_("_Copy"), "clipboard.copy");
g_menu_append_item (menu, item);
item = g_menu_item_new (_("_Paste"), "clipboard.paste");
g_menu_append_item (menu, item);
popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (menu));
gtk_widget_set_parent (popover, image);
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &(GdkRectangle) { x, y, 1, 1});
gtk_popover_popup (GTK_POPOVER (popover));
g_object_unref (menu);
}
GtkWidget *
do_clipboard (GtkWidget *do_widget)
{
@@ -243,14 +103,6 @@ do_clipboard (GtkWidget *do_widget)
GtkWidget *label;
GtkWidget *entry, *button;
GtkWidget *image;
GtkGesture *gesture;
GActionEntry entries[] = {
{ "copy", copy_image, NULL, NULL, NULL },
{ "paste", paste_image, NULL, NULL, NULL },
};
GActionGroup *actions;
GtkDragSource *source;
GtkDropTarget *dest;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
@@ -320,62 +172,16 @@ do_clipboard (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), hbox);
/* Create the first image */
image = gtk_image_new_from_icon_name ("dialog-warning");
gtk_image_set_pixel_size (GTK_IMAGE (image), 48);
image = demo_image_new ("dialog-warning");
gtk_container_add (GTK_CONTAINER (hbox), image);
/* make image a drag source */
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
/* accept drops on image */
dest = gtk_drop_target_new (GDK_TYPE_TEXTURE, GDK_ACTION_COPY);
g_signal_connect (dest, "drop", G_CALLBACK (drag_drop), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
/* context menu on image */
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
actions = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
gtk_widget_insert_action_group (image, "clipboard", actions);
g_object_unref (actions);
/* Create the second image */
image = gtk_image_new_from_icon_name ("process-stop");
gtk_image_set_pixel_size (GTK_IMAGE (image), 48);
image = demo_image_new ("process-stop");
gtk_container_add (GTK_CONTAINER (hbox), image);
/* make image a drag source */
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
/* accept drops on image */
dest = gtk_drop_target_new (GDK_TYPE_TEXTURE, GDK_ACTION_COPY);
g_signal_connect (dest, "drop", G_CALLBACK (drag_drop), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
/* context menu on image */
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
actions = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
gtk_widget_insert_action_group (image, "clipboard", actions);
g_object_unref (actions);
/* Create the third image */
image = demo_image_new ("weather-clear");
gtk_container_add (GTK_CONTAINER (hbox), image);
}
if (!gtk_widget_get_visible (window))
-119
View File
@@ -1,119 +0,0 @@
/* Color Chooser
*
* A GtkColorChooser lets the user choose a color. There are several
* implementations of the GtkColorChooser interface in GTK. The
* GtkColorChooserDialog is a prebuilt dialog containing a
* GtkColorChooserWidget.
*/
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static GtkWidget *da;
static GdkRGBA color;
static GtkWidget *frame;
/* draw callback for the drawing area
*/
static void
draw_function (GtkDrawingArea *drawing_area,
cairo_t *cr,
int width,
int height,
gpointer data)
{
gdk_cairo_set_source_rgba (cr, &color);
cairo_paint (cr);
}
static void
response_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
if (response_id == GTK_RESPONSE_OK)
{
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
gtk_widget_queue_draw (da);
}
gtk_widget_destroy (GTK_WIDGET (dialog));
}
static void
change_color_callback (GtkWidget *button,
gpointer data)
{
GtkWidget *dialog;
dialog = gtk_color_chooser_dialog_new ("Changing color", GTK_WINDOW (window));
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
g_signal_connect (dialog, "response",
G_CALLBACK (response_cb), NULL);
gtk_widget_show (dialog);
}
GtkWidget *
do_colorsel (GtkWidget *do_widget)
{
GtkWidget *vbox;
GtkWidget *button;
if (!window)
{
color.red = 0;
color.blue = 1;
color.green = 0;
color.alpha = 1;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Color Chooser");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox, 12);
gtk_widget_set_margin_end (vbox, 12);
gtk_widget_set_margin_top (vbox, 12);
gtk_widget_set_margin_bottom (vbox, 12);
gtk_container_add (GTK_CONTAINER (window), vbox);
/*
* Create the color swatch area
*/
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (vbox), frame);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 200);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 200);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_function, NULL, NULL);
gtk_container_add (GTK_CONTAINER (frame), da);
button = gtk_button_new_with_mnemonic ("_Change the above color");
gtk_widget_set_halign (button, GTK_ALIGN_END);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (change_color_callback), NULL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}
+12 -4
View File
@@ -12,6 +12,10 @@
<gresource prefix="/builder">
<file>demo.ui</file>
</gresource>
<gresource prefix="/clipboard">
<file>demoimage.c</file>
<file>demoimage.h</file>
</gresource>
<gresource prefix="/css_accordion">
<file>css_accordion.css</file>
<file>reset.css</file>
@@ -104,6 +108,10 @@
<file>gtkfishbowl.c</file>
<file>gtkfishbowl.h</file>
</gresource>
<gresource prefix="/gears">
<file>gtkgears.c</file>
<file>gtkgears.h</file>
</gresource>
<gresource prefix="/iconscroll">
<file>iconscroll.ui</file>
</gresource>
@@ -150,7 +158,6 @@
<file>assistant.c</file>
<file>builder.c</file>
<file>clipboard.c</file>
<file>colorsel.c</file>
<file>combobox.c</file>
<file>constraints.c</file>
<file>constraints2.c</file>
@@ -176,6 +183,7 @@
<file>font_features.c</file>
<file>fontplane.c</file>
<file>fontrendering.c</file>
<file>gears.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
<file>headerbar.c</file>
@@ -272,9 +280,6 @@
<gresource prefix="/modelbutton">
<file>modelbutton.ui</file>
</gresource>
<gresource prefix="/dnd">
<file>dnd.css</file>
</gresource>
<gresource prefix="/tagged_entry">
<file>demotaggedentry.c</file>
<file>demotaggedentry.h</file>
@@ -304,4 +309,7 @@
<file>icons/16x16/status/battery-caution-charging-symbolic.symbolic.png</file>
<file>icons/16x16/categories/applications-other.png</file>
</gresource>
<gresource prefix="/org/gtk/Demo4/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>
</gresources>
+1 -1
View File
@@ -166,7 +166,7 @@
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
+259
View File
@@ -0,0 +1,259 @@
#include "demoimage.h"
#include <glib/gi18n.h>
struct _DemoImage {
GtkWidget parent_instance;
GtkWidget *image;
GtkWidget *popover;
};
enum {
PROP_ICON_NAME = 1
};
G_DEFINE_TYPE(DemoImage, demo_image, GTK_TYPE_WIDGET)
static GdkPaintable *
get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
GtkIconTheme *icon_theme;
GtkIconPaintable *icon;
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_PAINTABLE:
return g_object_ref (gtk_image_get_paintable (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon = gtk_icon_theme_lookup_icon (icon_theme,
icon_name,
NULL,
48, 1,
gtk_widget_get_direction (GTK_WIDGET (image)),
0);
if (icon == NULL)
return NULL;
return GDK_PAINTABLE (icon);
case GTK_IMAGE_EMPTY:
case GTK_IMAGE_GICON:
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
return NULL;
}
}
static void
drag_begin (GtkDragSource *source,
GdkDrag *drag,
gpointer data)
{
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
DemoImage *demo = DEMO_IMAGE (widget);
GdkPaintable *paintable;
paintable = get_image_paintable (GTK_IMAGE (demo->image));
if (paintable)
{
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
g_object_unref (paintable);
}
}
static GdkContentProvider *
prepare_drag (GtkDragSource *source,
double x,
double y,
gpointer data)
{
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
DemoImage *demo = DEMO_IMAGE (widget);
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
}
static gboolean
drag_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y,
gpointer data)
{
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
DemoImage *demo = DEMO_IMAGE (widget);
GdkPaintable *paintable = g_value_get_object (value);
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), paintable);
return TRUE;
}
static void
copy_image (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
DemoImage *demo = DEMO_IMAGE (widget);
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
GValue value = G_VALUE_INIT;
g_value_init (&value, GDK_TYPE_PAINTABLE);
g_value_set_object (&value, paintable);
gdk_clipboard_set_value (clipboard, &value);
g_value_unset (&value);
if (paintable)
g_object_unref (paintable);
}
static void
paste_image (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
DemoImage *demo = DEMO_IMAGE (widget);
GdkContentProvider *content = gdk_clipboard_get_content (clipboard);
GValue value = G_VALUE_INIT;
GdkPaintable *paintable;
g_value_init (&value, GDK_TYPE_PAINTABLE);
if (!gdk_content_provider_get_value (content, &value, NULL))
return;
paintable = GDK_PAINTABLE (g_value_get_object (&value));
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), paintable);
g_value_unset (&value);
}
static void
pressed_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
gpointer data)
{
DemoImage *demo = DEMO_IMAGE (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)));
gtk_popover_popup (GTK_POPOVER (demo->popover));
}
static void
demo_image_init (DemoImage *demo)
{
GMenu *menu;
GMenuItem *item;
GtkDragSource *source;
GtkDropTarget *dest;
GtkGesture *gesture;
demo->image = gtk_image_new ();
gtk_image_set_pixel_size (GTK_IMAGE (demo->image), 48);
gtk_widget_set_parent (demo->image, GTK_WIDGET (demo));
menu = g_menu_new ();
item = g_menu_item_new (_("_Copy"), "clipboard.copy");
g_menu_append_item (menu, item);
item = g_menu_item_new (_("_Paste"), "clipboard.paste");
g_menu_append_item (menu, item);
demo->popover = gtk_popover_menu_new_from_model (G_MENU_MODEL (menu));
gtk_widget_set_parent (demo->popover, GTK_WIDGET (demo));
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), NULL);
gtk_widget_add_controller (GTK_WIDGET (demo), GTK_EVENT_CONTROLLER (source));
dest = gtk_drop_target_new (GDK_TYPE_PAINTABLE, GDK_ACTION_COPY);
g_signal_connect (dest, "drop", G_CALLBACK (drag_drop), NULL);
gtk_widget_add_controller (GTK_WIDGET (demo), GTK_EVENT_CONTROLLER (dest));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), NULL);
gtk_widget_add_controller (GTK_WIDGET (demo), GTK_EVENT_CONTROLLER (gesture));
}
static void
demo_image_dispose (GObject *object)
{
DemoImage *demo = DEMO_IMAGE (object);
g_clear_pointer (&demo->image, gtk_widget_unparent);
g_clear_pointer (&demo->popover, gtk_widget_unparent);
G_OBJECT_CLASS (demo_image_parent_class)->dispose (object);
}
static void
demo_image_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
DemoImage *demo = DEMO_IMAGE (object);
switch (prop_id)
{
case PROP_ICON_NAME:
g_value_set_string (value, gtk_image_get_icon_name (GTK_IMAGE (demo->image)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo_image_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
DemoImage *demo = DEMO_IMAGE (object);
switch (prop_id)
{
case PROP_ICON_NAME:
gtk_image_set_from_icon_name (GTK_IMAGE (demo->image),
g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo_image_class_init (DemoImageClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo_image_dispose;
object_class->get_property = demo_image_get_property;
object_class->set_property = demo_image_set_property;
g_object_class_install_property (object_class, PROP_ICON_NAME,
g_param_spec_string ("icon-name", "Icon name", "Icon name",
NULL, G_PARAM_READWRITE));
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, copy_image);
gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, paste_image);
}
GtkWidget *
demo_image_new (const char *icon_name)
{
return g_object_new (DEMO_TYPE_IMAGE, "icon-name", icon_name, NULL);
}
+13
View File
@@ -0,0 +1,13 @@
#pragma once
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define DEMO_TYPE_IMAGE (demo_image_get_type ())
G_DECLARE_FINAL_TYPE(DemoImage, demo_image, DEMO, IMAGE, GtkWidget)
GtkWidget * demo_image_new (const char *icon_name);
G_END_DECLS
+1 -1
View File
@@ -472,7 +472,7 @@ demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *tag,
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_button_set_has_frame (GTK_BUTTON (tag->button), FALSE);
gtk_container_add (GTK_CONTAINER (tag->box), tag->button);
g_signal_connect (tag->button, "clicked", G_CALLBACK (on_button_clicked), tag);
}
+329 -224
View File
@@ -1,202 +1,126 @@
/* Drag-and-Drop
*
* I can't believe its not glade!
*
* Try right-clicking in the window.
* This demo shows dragging colors and widgets.
* The items in this demo can be moved, recolored
* and rotated.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <string.h>
typedef struct _GtkDemoWidget GtkDemoWidget;
struct _GtkDemoWidget
static GdkContentProvider *
prepare (GtkDragSource *source,
double x,
double y)
{
GType type;
union {
char *text;
gboolean active;
};
};
GtkWidget *canvas;
GtkWidget *item;
static gpointer
copy_demo_widget (gpointer data)
{
GtkDemoWidget *demo = g_memdup (data, sizeof (GtkDemoWidget));
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = gtk_widget_pick (canvas, x, y, GTK_PICK_DEFAULT);
if (demo->type == GTK_TYPE_LABEL)
demo->text = g_strdup (demo->text);
if (!GTK_IS_LABEL (item))
return NULL;
return demo;
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
return gdk_content_provider_new_typed (GTK_TYPE_WIDGET, item);
}
static void
free_demo_widget (gpointer data)
drag_begin (GtkDragSource *source,
GdkDrag *drag)
{
GtkDemoWidget *demo = data;
GtkWidget *canvas;
GtkWidget *item;
if (demo->type == GTK_TYPE_LABEL)
g_free (demo->text);
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = g_object_get_data (G_OBJECT (canvas), "dragged-item");
g_free (demo);
gtk_widget_set_opacity (item, 0.5);
}
#define GTK_TYPE_DEMO_WIDGET (gtk_demo_widget_get_type ())
static GType gtk_demo_widget_get_type (void);
G_DEFINE_BOXED_TYPE (GtkDemoWidget, gtk_demo_widget, copy_demo_widget, free_demo_widget)
static GtkDemoWidget *
serialize_widget (GtkWidget *widget)
static void
drag_end (GtkDragSource *source,
GdkDrag *drag)
{
GtkDemoWidget *demo;
GtkWidget *canvas;
GtkWidget *item;
demo = g_new0 (GtkDemoWidget, 1);
demo->type = G_OBJECT_TYPE (widget);
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = g_object_get_data (G_OBJECT (canvas), "dragged-item");
g_object_set_data (G_OBJECT (canvas), "dragged-item", NULL);
if (GTK_IS_LABEL (widget))
{
demo->text = g_strdup (gtk_label_get_text (GTK_LABEL (widget)));
}
else if (GTK_IS_SPINNER (widget))
{
g_object_get (widget, "spinning", &demo->active, NULL);
}
else
{
g_print ("Type %s not supported\n", g_type_name (demo->type));
}
return demo;
gtk_widget_set_opacity (item, 1.0);
}
static GtkWidget *
deserialize_widget (GtkDemoWidget *demo)
static void
drag_cancel (GtkDragSource *source,
GdkDrag *drag,
GdkDragCancelReason reason)
{
GtkWidget *widget = NULL;
drag_end (source, drag);
}
if (demo->type == GTK_TYPE_LABEL)
{
widget = gtk_label_new (demo->text);
}
else if (demo->type == GTK_TYPE_SPINNER)
{
widget = g_object_new (demo->type, "spinning", demo->active, NULL);
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
}
else
{
g_print ("Type %s not supported\n", g_type_name (demo->type));
}
typedef struct {
double x, y;
double angle;
double delta;
} TransformData;
return widget;
static void
apply_transform (GtkWidget *item)
{
GtkWidget *canvas = gtk_widget_get_parent (item);
TransformData *data;
GskTransform *transform;
data = g_object_get_data (G_OBJECT (item), "transform-data");
transform = gsk_transform_rotate (gsk_transform_translate (NULL, &(graphene_point_t){data->x, data->y}),
data->angle + data->delta);
gtk_fixed_set_child_transform (GTK_FIXED (canvas), item, transform);
gsk_transform_unref (transform);
}
static gboolean
drag_drop (GtkDropTarget *target,
const GValue *value,
double x,
double y)
{
GtkWidget *item;
TransformData *transform_data;
GtkWidget *canvas;
GtkWidget *last_child;
item = g_value_get_object (value);
transform_data = g_object_get_data (G_OBJECT (item), "transform-data");
transform_data->x = x;
transform_data->y = y;
canvas = gtk_widget_get_parent (item);
last_child = gtk_widget_get_last_child (canvas);
if (item != last_child)
gtk_widget_insert_after (item, canvas, last_child);
apply_transform (item);
return TRUE;
}
static double pos_x, pos_y;
static void
new_label_cb (GtkWidget *button,
gpointer data)
{
GtkFixed *fixed = data;
GtkWidget *widget;
widget = gtk_label_new ("Label");
gtk_fixed_put (fixed, widget, pos_x, pos_y);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static GtkWidget * canvas_item_new (double x, double y);
static void
new_spinner_cb (GtkWidget *button,
gpointer data)
new_item_cb (GtkWidget *button, gpointer data)
{
GtkFixed *fixed = data;
GtkWidget *widget;
GtkWidget *canvas = data;
GtkWidget *item;
widget = gtk_spinner_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
gtk_spinner_start (GTK_SPINNER (widget));
gtk_fixed_put (fixed, widget, pos_x, pos_y);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
copy_cb (GtkWidget *button, GtkWidget *child)
{
GdkClipboard *clipboard;
GtkDemoWidget *demo;
demo = serialize_widget (child);
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gdk_clipboard_set (clipboard, GTK_TYPE_DEMO_WIDGET, demo);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
delete_cb (GtkWidget *button, GtkWidget *child)
{
gtk_widget_destroy (child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
cut_cb (GtkWidget *button, GtkWidget *child)
{
copy_cb (button, child);
delete_cb (button, child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
value_read (GObject *source,
GAsyncResult *res,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
GError *error = NULL;
const GValue *value;
GtkDemoWidget *demo;
GtkWidget *widget = NULL;
value = gdk_clipboard_read_value_finish (clipboard, res, &error);
if (value == NULL)
{
g_print ("error: %s\n", error->message);
g_error_free (error);
return;
}
if (!G_VALUE_HOLDS (value, GTK_TYPE_DEMO_WIDGET))
{
g_print ("can't handle clipboard contents\n");
return;
}
demo = g_value_get_boxed (value);
widget = deserialize_widget (demo);
gtk_fixed_put (GTK_FIXED (data), widget, pos_x, pos_y);
}
static void
paste_cb (GtkWidget *button, GtkWidget *fixed)
{
GdkClipboard *clipboard;
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
if (gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET))
{
g_print ("Paste %s\n", g_type_name (GTK_TYPE_DEMO_WIDGET));
gdk_clipboard_read_value_async (clipboard, GTK_TYPE_DEMO_WIDGET, 0, NULL, value_read, fixed);
}
else
g_print ("Don't know how to handle clipboard contents\n");
item = canvas_item_new (pos_x, pos_y);
gtk_container_add (GTK_CONTAINER (canvas), item);
apply_transform (item);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
@@ -204,14 +128,15 @@ paste_cb (GtkWidget *button, GtkWidget *fixed)
static void
edit_label_done (GtkWidget *entry, gpointer data)
{
GtkWidget *fixed = gtk_widget_get_parent (entry);
GtkWidget *canvas = gtk_widget_get_parent (entry);
GtkWidget *label;
int x, y;
gtk_fixed_get_child_position (GTK_FIXED (fixed), entry, &x, &y);
gtk_fixed_get_child_position (GTK_FIXED (canvas), entry, &x, &y);
label = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "label"));
gtk_label_set_text (GTK_LABEL (label), gtk_editable_get_text (GTK_EDITABLE (entry)));
gtk_widget_show (label);
gtk_widget_destroy (entry);
}
@@ -219,10 +144,10 @@ edit_label_done (GtkWidget *entry, gpointer data)
static void
edit_cb (GtkWidget *button, GtkWidget *child)
{
GtkWidget *fixed = gtk_widget_get_parent (child);
GtkWidget *canvas = gtk_widget_get_parent (child);
int x, y;
gtk_fixed_get_child_position (GTK_FIXED (fixed), child, &x, &y);
gtk_fixed_get_child_position (GTK_FIXED (canvas), child, &x, &y);
if (GTK_IS_LABEL (child))
{
@@ -233,21 +158,23 @@ edit_cb (GtkWidget *button, GtkWidget *child)
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
gtk_editable_set_width_chars (GTK_EDITABLE (entry), 12);
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
gtk_fixed_put (GTK_FIXED (canvas), entry, x, y);
gtk_widget_grab_focus (entry);
}
else if (GTK_IS_SPINNER (child))
{
gboolean active;
g_object_get (child, "spinning", &active, NULL);
g_object_set (child, "spinning", !active, NULL);
gtk_widget_hide (child);
}
if (button)
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
delete_cb (GtkWidget *button, GtkWidget *child)
{
gtk_widget_destroy (child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
pressed_cb (GtkGesture *gesture,
int n_press,
@@ -266,7 +193,6 @@ pressed_cb (GtkGesture *gesture,
GtkWidget *menu;
GtkWidget *box;
GtkWidget *item;
GdkClipboard *clipboard;
pos_x = x;
pos_y = y;
@@ -278,20 +204,16 @@ pressed_cb (GtkGesture *gesture,
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (menu), box);
item = gtk_button_new_with_label ("New Label");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
g_signal_connect (item, "clicked", G_CALLBACK (new_label_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("New Spinner");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
g_signal_connect (item, "clicked", G_CALLBACK (new_spinner_cb), widget);
item = gtk_button_new_with_label ("New");
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
g_signal_connect (item, "clicked", G_CALLBACK (new_item_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Edit");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
@@ -299,25 +221,8 @@ pressed_cb (GtkGesture *gesture,
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Cut");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (cut_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Copy");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (copy_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Paste");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gtk_widget_set_sensitive (item,
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
g_signal_connect (item, "clicked", G_CALLBACK (paste_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Delete");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_button_set_has_frame (GTK_BUTTON (item), FALSE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
@@ -346,6 +251,165 @@ released_cb (GtkGesture *gesture,
}
}
static GtkWidget *
canvas_new (void)
{
GtkWidget *canvas;
GtkDragSource *source;
GtkDropTarget *dest;
GtkGesture *gesture;
canvas = gtk_fixed_new ();
gtk_widget_set_hexpand (canvas, TRUE);
gtk_widget_set_vexpand (canvas, TRUE);
gtk_widget_add_css_class (canvas, "frame");
source = gtk_drag_source_new ();
gtk_drag_source_set_actions (source, GDK_ACTION_MOVE);
g_signal_connect (source, "prepare", G_CALLBACK (prepare), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), NULL);
g_signal_connect (source, "drag-end", G_CALLBACK (drag_end), NULL);
g_signal_connect (source, "drag-cancel", G_CALLBACK (drag_cancel), NULL);
gtk_widget_add_controller (canvas, GTK_EVENT_CONTROLLER (source));
dest = gtk_drop_target_new (GTK_TYPE_WIDGET, GDK_ACTION_MOVE);
g_signal_connect (dest, "drop", G_CALLBACK (drag_drop), NULL);
gtk_widget_add_controller (canvas, GTK_EVENT_CONTROLLER (dest));
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), NULL);
g_signal_connect (gesture, "released", G_CALLBACK (released_cb), NULL);
gtk_widget_add_controller (canvas, GTK_EVENT_CONTROLLER (gesture));
return canvas;
}
static void
set_color (GtkWidget *item,
GdkRGBA *color)
{
char *css;
char *str;
GtkStyleContext *context;
GtkCssProvider *provider;
str = gdk_rgba_to_string (color);
css = g_strdup_printf ("* { background: %s; padding: 10px; }", str);
context = gtk_widget_get_style_context (item);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (item), GTK_STYLE_PROVIDER (provider), 800);
g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
g_free (str);
g_free (css);
}
static gboolean
item_drag_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y)
{
GtkWidget *item = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
set_color (item, g_value_get_boxed (value));
return TRUE;
}
static void
angle_changed (GtkGestureRotate *gesture,
double angle,
double delta)
{
GtkWidget *item = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
TransformData *data = g_object_get_data (G_OBJECT (item), "transform-data");
data->delta = angle / M_PI * 180.0;
apply_transform (item);
}
static void
rotate_done (GtkGesture *gesture)
{
GtkWidget *item = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
TransformData *data = g_object_get_data (G_OBJECT (item), "transform-data");
data->angle = data->angle + data->delta;
data->delta = 0;
}
static void
click_done (GtkGesture *gesture)
{
GtkWidget *item = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
GtkWidget *canvas = gtk_widget_get_parent (item);
GtkWidget *last_child;
last_child = gtk_widget_get_last_child (canvas);
if (item != last_child)
gtk_widget_insert_after (item, canvas, last_child);
}
static int n_items = 0;
static GtkWidget *
canvas_item_new (double x,
double y)
{
GtkWidget *widget;
char *label;
char *id;
TransformData *transform_data;
GdkRGBA rgba;
GtkDropTarget *dest;
GtkGesture *gesture;
n_items++;
label = g_strdup_printf ("Item %d", n_items);
id = g_strdup_printf ("item%d", n_items);
gdk_rgba_parse (&rgba, "yellow");
widget = gtk_label_new (label);
gtk_widget_add_css_class (widget, "frame");
gtk_widget_set_name (widget, id);
set_color (widget, &rgba);
transform_data = g_new0 (TransformData, 1);
transform_data->x = x;
transform_data->y = y;
transform_data->angle = 0.0;
g_object_set_data_full (G_OBJECT (widget), "transform-data", transform_data, g_free);
g_free (label);
g_free (id);
dest = gtk_drop_target_new (GDK_TYPE_RGBA, GDK_ACTION_COPY);
g_signal_connect (dest, "drop", G_CALLBACK (item_drag_drop), NULL);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (dest));
gesture = gtk_gesture_rotate_new ();
g_signal_connect (gesture, "angle-changed", G_CALLBACK (angle_changed), NULL);
g_signal_connect (gesture, "end", G_CALLBACK (rotate_done), NULL);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
gesture = gtk_gesture_click_new ();
g_signal_connect (gesture, "released", G_CALLBACK (click_done), NULL);
gtk_widget_add_controller (widget, GTK_EVENT_CONTROLLER (gesture));
return widget;
}
static GtkWidget *window = NULL;
GtkWidget *
@@ -353,37 +417,78 @@ do_dnd (GtkWidget *do_widget)
{
if (!window)
{
GtkWidget *vbox, *fixed;
GtkGesture *multipress;
GtkCssProvider *provider;
GtkWidget *sw;
GtkWidget *canvas;
GtkWidget *widget;
GtkWidget *box, *box2, *box3;
const char *colors[] = {
"red", "green", "blue", "magenta", "orange", "gray", "black", "yellow",
"white", "gray", "brown", "pink", "cyan", "bisque", "gold", "maroon",
"navy", "orchid", "olive", "peru", "salmon", "silver", "wheat",
NULL
};
int i;
int x, y;
widget = gtk_color_button_new ();
gtk_widget_destroy (widget);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drag-and-drop");
gtk_window_set_title (GTK_WINDOW (window), "Drag-and-Drop");
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box);
fixed = gtk_fixed_new ();
gtk_container_add (GTK_CONTAINER (vbox), fixed);
gtk_widget_set_hexpand (fixed, TRUE);
gtk_widget_set_vexpand (fixed, TRUE);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (box), box2);
multipress = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (multipress), 0);
g_signal_connect (multipress, "pressed", G_CALLBACK (pressed_cb), NULL);
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);
gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
canvas = canvas_new ();
gtk_container_add (GTK_CONTAINER (box2), canvas);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
n_items = 0;
x = y = 40;
for (i = 0; i < 4; i++)
{
GtkWidget *item;
item = canvas_item_new (x, y);
gtk_container_add (GTK_CONTAINER (canvas), item);
apply_transform (item);
x += 150;
y += 100;
}
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER);
gtk_container_add (GTK_CONTAINER (box), sw);
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box3, "linked");
gtk_container_add (GTK_CONTAINER (sw), box3);
for (i = 0; colors[i]; i++)
{
GdkRGBA rgba;
GtkWidget *swatch;
gdk_rgba_parse (&rgba, colors[i]);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"selectable", FALSE,
NULL);
gtk_container_add (GTK_CONTAINER (box3), swatch);
}
}
if (!gtk_widget_get_visible (window))
-3
View File
@@ -1,3 +0,0 @@
spinner.demo {
opacity: 1;
}
-2
View File
@@ -214,7 +214,6 @@ do_drawingarea (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_vexpand (frame, TRUE);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -235,7 +234,6 @@ do_drawingarea (GtkWidget *do_widget)
frame = gtk_frame_new (NULL);
gtk_widget_set_vexpand (frame, TRUE);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (vbox), frame);
da = gtk_drawing_area_new ();
+1 -2
View File
@@ -366,8 +366,7 @@ do_editable_cells (GtkWidget *do_widget)
gtk_label_new ("Shopping list (you can edit the cells!)"));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+1 -1
View File
@@ -59,7 +59,7 @@ do_expander (GtkWidget *do_widget)
gtk_widget_set_vexpand (expander, TRUE);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
+1 -1
View File
@@ -62,7 +62,7 @@ create_blurred_button (void)
{
GtkWidget *w = gtk_button_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
gtk_widget_add_css_class (w, "blurred-button");
return w;
}
+1 -1
View File
@@ -49,7 +49,7 @@
<child type="end">
<object class="GtkToggleButton" id="changes_allow">
<property name="icon-name">changes-allow</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<signal name="notify::active" handler="fishbowl_changes_toggled_cb"/>
</object>
</child>
+1 -1
View File
@@ -52,7 +52,7 @@ create_faces (void)
/* Add a face */
faces[i].face = gtk_frame_new (NULL);
gtk_widget_set_size_request (faces[i].face, face_size, face_size);
gtk_style_context_add_class (gtk_widget_get_style_context (faces[i].face), faces[i].css_class);
gtk_widget_add_css_class (faces[i].face, faces[i].css_class);
gtk_container_add (GTK_CONTAINER (fixed), faces[i].face);
/* Set up the transformation for each face */
-2
View File
@@ -189,8 +189,6 @@ gtk_font_plane_init (GtkFontPlane *plane)
{
GtkGesture *gesture;
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
gesture = gtk_gesture_drag_new ();
g_signal_connect (gesture, "drag-begin",
G_CALLBACK (plane_drag_gesture_begin), plane);
+1 -1
View File
@@ -193,7 +193,7 @@
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-height">1</property>
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
+137
View File
@@ -0,0 +1,137 @@
/* OpenGL/Gears
*
* This is a classic OpenGL demo, running in a GtkGLArea.
*/
#include <stdlib.h>
#include <gtk/gtk.h>
#include "gtkgears.h"
/************************************************************************
* DEMO CODE *
************************************************************************/
static void
on_axis_value_change (GtkAdjustment *adjustment,
gpointer data)
{
GtkGears *gears = GTK_GEARS (data);
int axis = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (adjustment), "axis"));
gtk_gears_set_axis (gears, axis, gtk_adjustment_get_value (adjustment));
}
static GtkWidget *
create_axis_slider (GtkGears *gears,
int axis)
{
GtkWidget *box, *label, *slider;
GtkAdjustment *adj;
const char *text;
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
switch (axis)
{
case GTK_GEARS_X_AXIS:
text = "X";
break;
case GTK_GEARS_Y_AXIS:
text = "Y";
break;
case GTK_GEARS_Z_AXIS:
text = "Z";
break;
default:
g_assert_not_reached ();
}
label = gtk_label_new (text);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
g_signal_connect (adj, "value-changed",
G_CALLBACK (on_axis_value_change),
gears);
slider = gtk_scale_new (GTK_ORIENTATION_VERTICAL, adj);
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_container_add (GTK_CONTAINER (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
GtkWidget *
do_gears (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *box, *hbox, *fps_label, *gears, *overlay, *frame;
int i;
if (!window)
{
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Gears");
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (window), 640, 640);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
overlay = gtk_overlay_new ();
gtk_widget_set_margin_start (overlay, 12);
gtk_widget_set_margin_end (overlay, 12);
gtk_widget_set_margin_top (overlay, 12);
gtk_widget_set_margin_bottom (overlay, 12);
gtk_container_add (GTK_CONTAINER (window), overlay);
frame = gtk_frame_new (NULL);
gtk_widget_set_halign (frame, GTK_ALIGN_START);
gtk_widget_set_valign (frame, GTK_ALIGN_START);
gtk_widget_add_css_class (frame, "app-notification");
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), frame);
fps_label = gtk_label_new ("");
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (frame), fps_label);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (overlay), box);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (box), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
gears = gtk_gears_new ();
gtk_widget_set_hexpand (gears, TRUE);
gtk_widget_set_vexpand (gears, TRUE);
gtk_container_add (GTK_CONTAINER (hbox), gears);
for (i = 0; i < GTK_GEARS_N_AXIS; i++)
gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i));
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
gtk_box_set_spacing (GTK_BOX (hbox), 6);
gtk_container_add (GTK_CONTAINER (box), hbox);
gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label));
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}
+1 -1
View File
@@ -1,4 +1,4 @@
/* OpenGL Area
/* OpenGL/OpenGL Area
*
* GtkGLArea is a widget that allows custom drawing using OpenGL calls.
*/
+1 -1
View File
@@ -42,7 +42,7 @@ do_headerbar (GtkWidget *do_widget)
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (box), "linked");
gtk_widget_add_css_class (box, "linked");
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
gtk_container_add (GTK_CONTAINER (box), button);
+25
View File
@@ -0,0 +1,25 @@
<interface>
<object class="GtkShortcutsWindow" id="help_overlay">
<child>
<object class="GtkShortcutsSection">
<child>
<object class="GtkShortcutsGroup">
<property name="title">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">F1</property>
<property name="title">Show About Dialog</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="accelerator">&lt;Control&gt;q</property>
<property name="title">Quit</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>
+1 -2
View File
@@ -277,8 +277,7 @@ do_iconview (GtkWidget *do_widget)
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
-5
View File
@@ -360,7 +360,6 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -379,7 +378,6 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -396,7 +394,6 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -418,7 +415,6 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -441,7 +437,6 @@ do_images (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), frame);
+9 -13
View File
@@ -44,7 +44,6 @@ do_infobar (GtkWidget *do_widget)
GtkWidget *frame;
GtkWidget *bar;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *label;
GtkWidget *actions;
GtkWidget *button;
@@ -52,11 +51,13 @@ do_infobar (GtkWidget *do_widget)
if (!window)
{
actions = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (actions, "linked");
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Info Bars");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
@@ -131,23 +132,18 @@ do_infobar (GtkWidget *do_widget)
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (actions), button);
frame = gtk_frame_new ("Info bars");
frame = gtk_frame_new ("An example of different info bars");
gtk_widget_set_margin_top (frame, 8);
gtk_widget_set_margin_bottom (frame, 8);
gtk_container_add (GTK_CONTAINER (vbox), frame);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_widget_set_margin_start (vbox2, 8);
gtk_widget_set_margin_end (vbox2, 8);
gtk_widget_set_margin_top (vbox2, 8);
gtk_widget_set_margin_bottom (vbox2, 8);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_set_halign (actions, GTK_ALIGN_CENTER);
/* Standard message dialog */
label = gtk_label_new ("An example of different info bars");
gtk_container_add (GTK_CONTAINER (vbox2), label);
gtk_container_add (GTK_CONTAINER (vbox2), actions);
gtk_widget_set_margin_start (actions, 8);
gtk_widget_set_margin_end (actions, 8);
gtk_widget_set_margin_top (actions, 8);
gtk_widget_set_margin_bottom (actions, 8);
gtk_container_add (GTK_CONTAINER (frame), actions);
}
if (!gtk_widget_get_visible (window))
+15 -5
View File
@@ -1,7 +1,7 @@
/* Links
*
* GtkLabel can show hyperlinks. The default action is to call
* gtk_show_uri_on_window() on their URI, but it is possible to override
* gtk_show_uri() on their URI, but it is possible to override
* this with a custom handler.
*/
@@ -30,6 +30,8 @@ activate_link (GtkWidget *label,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Keyboard navigation");
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
"The term <i>keynav</i> is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
@@ -56,21 +58,29 @@ do_links (GtkWidget *do_widget)
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Links");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
"title=\"plain text\">text</a> may be marked up\n"
"as hyperlinks, which can be clicked\n"
"or activated via <a href=\"keynav\">keynav</a>\n"
"and they work fine with other markup, like when\n"
"title=\"plain text\">text</a> may be marked up "
"as hyperlinks, which can be clicked "
"or activated via <a href=\"keynav\">keynav</a> "
"and they work fine with other markup, like when "
"searching on <a href=\"http://www.google.com/\">"
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
"</a>.");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (label), 40);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_wrap_mode (GTK_LABEL (label), PANGO_WRAP_WORD);
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 20);
gtk_widget_set_margin_bottom (label, 20);
gtk_container_add (GTK_CONTAINER (window), label);
gtk_widget_show (label);
}
+1 -2
View File
@@ -272,8 +272,7 @@ do_list_store (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), label);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
+8 -10
View File
@@ -40,7 +40,7 @@
<object class="GtkButton" id="button2">
<property name="receives-default">1</property>
<property name="valign">baseline</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<child>
<object class="GtkLabel" id="source_name">
<property name="valign">baseline</property>
@@ -109,7 +109,7 @@
<object class="GtkLinkButton" id="resent_by_button">
<property name="label" translatable="0">reshareer</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="uri">http://www.gtk.org</property>
</object>
</child>
@@ -126,7 +126,7 @@
<object class="GtkButton" id="expand_button">
<property name="label" translatable="yes">Expand</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<signal name="clicked" handler="expand_clicked" swapped="yes"/>
</object>
</child>
@@ -138,14 +138,14 @@
<object class="GtkButton" id="reply-button">
<property name="label" translatable="yes">Reply</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
</object>
</child>
<child>
<object class="GtkButton" id="reshare-button">
<property name="label" translatable="yes">Reshare</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<signal name="clicked" handler="reshare_clicked" swapped="yes"/>
</object>
</child>
@@ -153,7 +153,7 @@
<object class="GtkButton" id="favorite-buttton">
<property name="label" translatable="yes">Favorite</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<signal name="clicked" handler="favorite_clicked" swapped="yes"/>
</object>
</child>
@@ -161,7 +161,7 @@
<object class="GtkMenuButton" id="more-button">
<property name="receives-default">1</property>
<property name="menu-model">menu1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="label" translatable="yes">More...</property>
</object>
</child>
@@ -185,7 +185,6 @@
<property name="spacing">8</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="n_reshares_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
@@ -198,7 +197,6 @@ Reshares</property>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="n_favorites_label">
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
@@ -225,7 +223,7 @@ FAVORITES</property>
<object class="GtkButton" id="button5">
<property name="label" translatable="yes">Details</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="dim-label"/>
</style>
+14 -3
View File
@@ -55,6 +55,8 @@ activate_about (GSimpleAction *action,
glib_major_version,
glib_minor_version,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
@@ -70,7 +72,7 @@ activate_about (GSimpleAction *action,
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
"program-name", "GTK Demo",
"version", version,
"copyright", "© 1997—2019 The GTK Team",
"copyright", "© 1997—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK widgets",
@@ -612,8 +614,6 @@ display_text (const char *resource)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (sw), textview);
return sw;
@@ -1186,6 +1186,14 @@ main (int argc, char **argv)
{ "quit", activate_quit, NULL, NULL, NULL },
{ "inspector", activate_inspector, NULL, NULL, NULL },
};
struct {
const gchar *action_and_target;
const gchar *accelerators[2];
} accels[] = {
{ "app.about", { "F1", NULL } },
{ "app.quit", { "<Control>q", NULL } },
};
int i;
/* Most code in gtk-demo is intended to be exemplary, but not
* these few lines, which are just a hack so gtk-demo will work
@@ -1203,6 +1211,9 @@ main (int argc, char **argv)
app_entries, G_N_ELEMENTS (app_entries),
app);
for (i = 0; i < G_N_ELEMENTS (accels); i++)
gtk_application_set_accels_for_action (app, accels[i].action_and_target, accels[i].accelerators);
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0, G_OPTION_ARG_NONE, "Show program version", NULL);
g_application_add_main_option (G_APPLICATION (app), "run", 0, 0, G_OPTION_ARG_STRING, "Run an example", "EXAMPLE");
g_application_add_main_option (G_APPLICATION (app), "list", 0, 0, G_OPTION_ARG_NONE, "List examples", NULL);
+4
View File
@@ -6,6 +6,10 @@
<attribute name="label" translatable="yes">_Inspector</attribute>
<attribute name="action">app.inspector</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About GTK Demo</attribute>
<attribute name="action">app.about</attribute>
+2 -1
View File
@@ -5,7 +5,6 @@ demos = files([
'assistant.c',
'builder.c',
'clipboard.c',
'colorsel.c',
'combobox.c',
'constraints.c',
'constraints2.c',
@@ -28,6 +27,7 @@ demos = files([
'fishbowl.c',
'fixed.c',
'fontrendering.c',
'gears.c',
'gestures.c',
'glarea.c',
'headerbar.c',
@@ -89,6 +89,7 @@ extra_demo_sources = files(['main.c',
'gtkgears.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c'])
if harfbuzz_dep.found() and pangoft_dep.found()
+1
View File
@@ -339,6 +339,7 @@ drawing_area_init (DrawingArea *area)
gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture));
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
area->brush_size = 1;
}
static GtkWidget *
-3
View File
@@ -172,7 +172,6 @@ do_panes (GtkWidget *do_widget)
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 60, 60);
gtk_paned_add1 (GTK_PANED (hpaned), frame);
@@ -180,12 +179,10 @@ do_panes (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER(frame), button);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 80, 60);
gtk_paned_add2 (GTK_PANED (hpaned), frame);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 60, 80);
gtk_paned_add2 (GTK_PANED (vpaned), frame);
+1 -1
View File
@@ -74,7 +74,7 @@ do_password_entry (GtkWidget *do_widget)
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");
gtk_widget_add_css_class (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);
+1 -2
View File
@@ -190,8 +190,7 @@ do_rotated_text (GtkWidget *do_widget)
/* Add a drawing area */
drawing_area = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (box), drawing_area);
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
GTK_STYLE_CLASS_VIEW);
gtk_widget_add_css_class (drawing_area, GTK_STYLE_CLASS_VIEW);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
rotated_text_draw,
+1 -1
View File
@@ -1,4 +1,4 @@
/* Scale
/* Scales
*
* GtkScale is a way to select a value from a range.
* Scales can have marks to help pick special values,
+1
View File
@@ -20,6 +20,7 @@
</object>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Scales</property>
<property name="resizable">0</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="row-spacing">10</property>
+1 -1
View File
@@ -63,7 +63,7 @@ do_sidebar (GtkWidget *do_widget)
if (i == 0)
{
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "icon-dropshadow");
gtk_widget_add_css_class (widget, "icon-dropshadow");
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
}
else
+4 -3
View File
@@ -279,7 +279,8 @@ start_puzzle (GdkPaintable *paintable)
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
if (aspect_ratio == 0.0)
aspect_ratio = 1.0;
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, aspect_ratio, FALSE);
gtk_aspect_frame_set_ratio (GTK_ASPECT_FRAME (frame), aspect_ratio);
gtk_aspect_frame_set_obey_child (GTK_ASPECT_FRAME (frame), FALSE);
/* Add shortcuts so people can use the arrow
* keys to move the puzzle */
@@ -419,7 +420,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
gtk_widget_set_margin_bottom (tweaks, 10);
choices = gtk_flow_box_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (choices), GTK_STYLE_CLASS_VIEW);
gtk_widget_add_css_class (choices, GTK_STYLE_CLASS_VIEW);
add_choice (choices, puzzle);
add_choice (choices, gtk_nuclear_animation_new ());
media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
@@ -466,7 +467,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
gtk_container_add (GTK_CONTAINER (window), frame);
start_puzzle (puzzle);
+1 -1
View File
@@ -1,4 +1,4 @@
/* Spin Button
/* Spin Buttons
*
* GtkSpinButton provides convenient ways to input data
* that can be seen as a value in a range. The examples
+2
View File
@@ -2,6 +2,7 @@
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Stack</property>
<property name="resizable">0</property>
<child>
<object class="GtkGrid">
<child>
@@ -25,6 +26,7 @@
<object class="GtkImage">
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="pixel-size">100</property>
<property name="icon-name">org.gtk.Demo4</property>
</object>
</property>
+2 -2
View File
@@ -25,7 +25,7 @@ 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");
gtk_widget_add_css_class (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);
@@ -98,7 +98,7 @@ do_tagged_entry (GtkWidget *do_widget)
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");
gtk_widget_add_css_class (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);
+1 -2
View File
@@ -408,8 +408,7 @@ do_tree_store (GtkWidget *do_widget)
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+68 -1
View File
@@ -1,3 +1,4 @@
#include "config.h"
#include <gtk/gtk.h>
#include "iconbrowserapp.h"
@@ -28,9 +29,75 @@ quit_activated (GSimpleAction *action,
g_application_quit (G_APPLICATION (app));
}
static void
inspector_activated (GSimpleAction *action,
GVariant *parameter,
gpointer app)
{
gtk_window_set_interactive_debugging (TRUE);
}
static void
about_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkApplication *app = user_data;
const gchar *authors[] = {
"The GTK Team",
NULL
};
char *icon_theme;
char *version;
GString *s;
g_object_get (gtk_settings_get_default (),
"gtk-icon-theme-name", &icon_theme,
NULL);
s = g_string_new ("");
g_string_append (s, "System libraries\n");
g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
glib_major_version,
glib_minor_version,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
g_string_append_printf (s, "\nIcon theme\n\t%s", icon_theme);
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
PACKAGE_VERSION,
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
"program-name", "GTK Icon Browser",
"version", version,
"copyright", "© 1997—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to browse themed icons",
"authors", authors,
"logo-icon-name", "org.gtk.Demo4",
"title", "About GTK Icon Browser",
"system-information", s->str,
NULL);
g_string_free (s, TRUE);
g_free (version);
g_free (icon_theme);
}
static GActionEntry app_entries[] =
{
{ "quit", quit_activated, NULL, NULL, NULL }
{ "quit", quit_activated, NULL, NULL, NULL },
{ "inspector", inspector_activated, NULL, NULL, NULL },
{ "about", about_activated, NULL, NULL, NULL }
};
static void
+19
View File
@@ -1,5 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="gear_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Inspector</attribute>
<attribute name="action">app.inspector</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About GTK Icon Browser</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<object class="IconStore" id="store"/>
<object class="GtkTreeModelFilter" id="filter_model">
<property name="child-model">store</property>
@@ -36,6 +48,13 @@
</child>
</object>
</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>
</child>
<child type="end">
<object class="GtkToggleButton" id="search">
<style>
+7
View File
@@ -24,6 +24,13 @@
#include "gtkrendererpaintableprivate.h"
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/gl/gskglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
#endif
#ifdef GDK_RENDERING_VULKAN
#include "gsk/vulkan/gskvulkanrenderer.h"
#endif
#ifndef NODE_EDITOR_SOURCE_DIR
#define NODE_EDITOR_SOURCE_DIR "." /* Fallback */
+1 -1
View File
@@ -83,6 +83,7 @@
<property name="title" translatable="yes">GTK Node Editor</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<property name="focus-widget">text_view</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="title" translatable="yes">GTK Node Editor</property>
@@ -139,7 +140,6 @@
<object class="GtkTextView" id="text_view">
<property name="wrap-mode">word</property>
<property name="monospace">1</property>
<property name="has-focus">1</property>
<property name="top-margin">6</property>
<property name="left-margin">6</property>
<property name="right-margin">6</property>
Binary file not shown.
+120 -46
View File
@@ -40,9 +40,6 @@ change_dark_state (GSimpleAction *action,
g_simple_action_set_state (action, state);
}
static char *current_theme;
static gboolean current_dark;
static void
change_theme_state (GSimpleAction *action,
GVariant *state,
@@ -53,6 +50,8 @@ change_theme_state (GSimpleAction *action,
const char *theme;
gboolean prefer_dark = FALSE;
g_simple_action_set_state (action, state);
s = g_variant_get_string (state, NULL);
if (strcmp (s, "adwaita") == 0)
@@ -77,8 +76,9 @@ change_theme_state (GSimpleAction *action,
}
else if (strcmp (s, "current") == 0)
{
theme = current_theme;
prefer_dark = current_dark;
gtk_settings_reset_property (settings, "gtk-theme-name");
gtk_settings_reset_property (settings, "gtk-application-prefer-dark-theme");
return;
}
else
return;
@@ -87,8 +87,6 @@ change_theme_state (GSimpleAction *action,
"gtk-theme-name", theme,
"gtk-application-prefer-dark-theme", prefer_dark,
NULL);
g_simple_action_set_state (action, state);
}
static GtkWidget *page_stack;
@@ -101,7 +99,7 @@ change_transition_state (GSimpleAction *action,
GtkStackTransitionType transition;
if (g_variant_get_boolean (state))
transition = GTK_STACK_TRANSITION_TYPE_ROTATE_LEFT_RIGHT;
transition = GTK_STACK_TRANSITION_TYPE_CROSSFADE;
else
transition = GTK_STACK_TRANSITION_TYPE_NONE;
@@ -267,6 +265,8 @@ activate_about (GSimpleAction *action,
glib_major_version,
glib_minor_version,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
@@ -282,7 +282,7 @@ activate_about (GSimpleAction *action,
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
"program-name", "GTK Widget Factory",
"version", version,
"copyright", "© 1997—2019 The GTK Team",
"copyright", "© 1997—2020 The GTK Team",
"license-type", GTK_LICENSE_LGPL_2_1,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK themes and widgets",
@@ -325,6 +325,97 @@ activate_inspector (GSimpleAction *action,
gtk_window_set_interactive_debugging (TRUE);
}
static void
print_operation_done (GtkPrintOperation *op,
GtkPrintOperationResult res,
gpointer data)
{
GError *error = NULL;
switch (res)
{
case GTK_PRINT_OPERATION_RESULT_ERROR:
gtk_print_operation_get_error (op, &error);
g_print ("Printing failed: %s\n", error->message);
g_clear_error (&error);
break;
case GTK_PRINT_OPERATION_RESULT_APPLY:
break;
case GTK_PRINT_OPERATION_RESULT_CANCEL:
g_print ("Printing was canceled\n");
break;
case GTK_PRINT_OPERATION_RESULT_IN_PROGRESS:
return;
default:
g_assert_not_reached ();
break;
}
g_object_unref (op);
}
static void
print_operation_begin (GtkPrintOperation *op,
GtkPrintContext *context,
gpointer data)
{
gtk_print_operation_set_n_pages (op, 1);
}
static void
print_operation_page (GtkPrintOperation *op,
GtkPrintContext *context,
int page,
gpointer data)
{
cairo_t *cr;
double width;
double aspect_ratio;
GdkSnapshot *snapshot;
GdkPaintable *paintable;
GskRenderNode *node;
g_print ("Save the trees!\n");
cr = gtk_print_context_get_cairo_context (context);
width = gtk_print_context_get_width (context);
snapshot = gtk_snapshot_new ();
paintable = gtk_widget_paintable_new (GTK_WIDGET (data));
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
gdk_paintable_snapshot (paintable, snapshot, width, width / aspect_ratio);
node = gtk_snapshot_free_to_node (snapshot);
gsk_render_node_draw (node, cr);
gsk_render_node_unref (node);
g_object_unref (paintable);
}
static void
activate_print (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWindow *window = GTK_WINDOW (user_data);
GtkPrintOperation *op;
GtkPrintOperationResult res;
op = gtk_print_operation_new ();
gtk_print_operation_set_allow_async (op, TRUE);
g_signal_connect (op, "begin-print", G_CALLBACK (print_operation_begin), NULL);
g_signal_connect (op, "draw-page", G_CALLBACK (print_operation_page), window);
g_signal_connect (op, "done", G_CALLBACK (print_operation_done), NULL);
res = gtk_print_operation_run (op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, window, NULL);
if (res == GTK_PRINT_OPERATION_RESULT_IN_PROGRESS)
return;
print_operation_done (op, res, NULL);
}
static void
spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
{
@@ -442,24 +533,17 @@ on_entry_icon_release (GtkEntry *entry,
#define EPSILON (1e-10)
static gboolean
on_scale_button_query_tooltip (GtkWidget *button,
gint x,
gint y,
gboolean keyboard_mode,
GtkTooltip *tooltip,
gpointer user_data)
static void
on_scale_button_value_changed (GtkScaleButton *button,
gdouble value,
gpointer user_data)
{
GtkScaleButton *scale_button = GTK_SCALE_BUTTON (button);
GtkAdjustment *adjustment;
gdouble val;
gchar *str;
AtkImage *image;
image = ATK_IMAGE (gtk_widget_get_accessible (button));
adjustment = gtk_scale_button_get_adjustment (scale_button);
val = gtk_scale_button_get_value (scale_button);
adjustment = gtk_scale_button_get_adjustment (button);
val = gtk_scale_button_get_value (button);
if (val < (gtk_adjustment_get_lower (adjustment) + EPSILON))
{
@@ -478,32 +562,21 @@ on_scale_button_query_tooltip (GtkWidget *button,
str = g_strdup_printf (C_("volume percentage", "%d%%"), percent);
}
gtk_tooltip_set_text (tooltip, str);
atk_image_set_image_description (image, str);
gtk_widget_set_tooltip_text (GTK_WIDGET (button), str);
atk_object_set_description (gtk_widget_get_accessible (GTK_WIDGET (button)), str);
g_free (str);
return TRUE;
}
static void
on_scale_button_value_changed (GtkScaleButton *button,
gdouble value,
gpointer user_data)
{
gtk_widget_trigger_tooltip_query (GTK_WIDGET (button));
}
static void
on_record_button_toggled (GtkToggleButton *button,
gpointer user_data)
{
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (button));
if (gtk_toggle_button_get_active (button))
gtk_style_context_remove_class (context, "destructive-action");
gtk_widget_remove_css_class (GTK_WIDGET (button), "destructive-action");
else
gtk_style_context_add_class (context, "destructive-action");
gtk_widget_add_css_class (GTK_WIDGET (button), "destructive-action");
}
static void
@@ -857,6 +930,7 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
gdk_rgba_parse (&rgba, color);
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"can-focus", FALSE,
"selectable", FALSE,
"halign", GTK_ALIGN_END,
"valign", GTK_ALIGN_CENTER,
@@ -975,6 +1049,7 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
"rgba", &rgba,
"selectable", FALSE,
"can-focus", FALSE,
"halign", GTK_ALIGN_END,
"valign", GTK_ALIGN_CENTER,
"margin-start", 6,
@@ -1732,6 +1807,7 @@ activate (GApplication *app)
{ "open", activate_open, NULL, NULL, NULL },
{ "record", activate_record, NULL, NULL, NULL },
{ "lock", activate_lock, NULL, NULL, NULL },
{ "print", activate_print, NULL, NULL, NULL },
};
struct {
const gchar *action_and_target;
@@ -1754,11 +1830,7 @@ activate (GApplication *app)
gint i;
GPermission *permission;
GAction *action;
g_object_get (gtk_settings_get_default (),
"gtk-theme-name", &current_theme,
"gtk-application-prefer-dark-theme", &current_dark,
NULL);
GError *error = NULL;
g_type_ensure (my_text_view_get_type ());
@@ -1774,7 +1846,6 @@ activate (GApplication *app)
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
"on_entry_icon_release", (GCallback)on_entry_icon_release,
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
"on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip,
"on_record_button_toggled", (GCallback)on_record_button_toggled,
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
@@ -1787,7 +1858,11 @@ activate (GApplication *app)
NULL);
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
if (!gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", &error))
{
g_critical ("%s", error->message);
g_clear_error (&error);
}
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), window);
@@ -2096,7 +2171,6 @@ main (int argc, char *argv[])
{ "water", NULL, NULL, "true", NULL },
{ "dessert", NULL, "s", "'bars'", NULL },
{ "pay", NULL, "s", NULL, NULL },
{ "print", activate_action, NULL, NULL, NULL },
{ "share", activate_action, NULL, NULL, NULL },
{ "labels", activate_action, NULL, NULL, NULL },
{ "new", activate_action, NULL, NULL, NULL },
@@ -35,4 +35,7 @@
<file>icons/16x16/emotes/face-monkey-symbolic.symbolic.png</file>
<file>icons/16x16/apps/preferences-desktop-locale-symbolic.symbolic.png</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory4">
<file>gtk-logo.webm</file>
</gresource>
</gresources>
+175 -71
View File
@@ -37,7 +37,7 @@
</section>
</submenu>
<item>
<attribute name="label" translatable="yes">Slide Pages</attribute>
<attribute name="label" translatable="yes">Transition Pages</attribute>
<attribute name="action">win.transition</attribute>
</item>
</section>
@@ -460,7 +460,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="margin-bottom">10</property>
<child>
<object class="GtkStack" id="toplevel_stack">
<property name="transition-duration">1000</property>
<property name="transition-duration">250</property>
<child>
<object class="GtkStackPage">
<property name="name">page1</property>
@@ -539,6 +539,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
</object>
</child>
<child>
<object class="GtkPasswordEntry">
<property name="halign">fill</property>
<property name="show-peek-icon">1</property>
<property name="placeholder-text" translatable="yes">Password…</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="hexpand">0</property>
@@ -864,7 +871,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="label" translatable="yes">link button</property>
<property name="receives-default">1</property>
<property name="has-tooltip">1</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="uri">http://www.gtk.org</property>
</object>
</child>
@@ -1042,57 +1049,95 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkBox" id="box26">
<property name="orientation">vertical</property>
<property name="homogeneous">1</property>
<property name="spacing">6</property>
<property name="spacing">10</property>
<property name="hexpand">1</property>
<child>
<object class="GtkFrame" id="frame1">
<style>
<class name="border-inset"/>
</style>
<property name="valign">start</property>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Inset&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Video&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<child>
<object class="GtkVideo">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="autoplay">0</property>
<property name="loop">1</property>
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="frame2">
<style>
<class name="border-outset"/>
</style>
<child type="label">
<object class="GtkLabel" id="label2">
<property name="label" translatable="yes">&lt;b&gt;Outset&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="frame3">
<style>
<class name="border-groove"/>
</style>
<child type="label">
<object class="GtkLabel" id="label17">
<property name="label" translatable="yes">&lt;b&gt;Groove&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkFrame" id="frame4">
<style>
<class name="border-ridge"/>
</style>
<child type="label">
<object class="GtkLabel" id="label18">
<property name="label" translatable="yes">&lt;b&gt;Ridge&lt;/b&gt;</property>
<property name="use-markup">1</property>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel">
<property name="label">Large Title</property>
<style><class name="large-title"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 1</property>
<style><class name="title-1"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 2</property>
<style><class name="title-2"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 3</property>
<style><class name="title-3"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Title 4</property>
<style><class name="title-4"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Heading</property>
<style><class name="heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Body</property>
<style><class name="body"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption Heading</property>
<style><class name="caption-heading"/></style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Caption</property>
<style><class name="Caption"/></style>
</object>
</child>
</object>
</child>
</object>
@@ -1113,7 +1158,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width-request">150</property>
<property name="vscrollbar-policy">always</property>
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTreeView" id="treeview1">
@@ -1187,7 +1232,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow2">
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkTextView" id="textview1">
@@ -1449,7 +1494,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkButton" id="page2dismiss">
<property name="focus-on-click">0</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="icon-name">window-close-symbolic</property>
</object>
</child>
@@ -1510,7 +1555,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="value">.5</property>
<property name="halign">center</property>
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
<layout>
<property name="left-attach">0</property>
@@ -1532,8 +1576,8 @@ microphone-sensitivity-medium-symbolic</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkStack" id="stack">
<property name="transition-type">crossfade</property>
<property name="transition-duration">1000</property>
<property name="transition-type">rotate-left-right</property>
<property name="transition-duration">250</property>
<child>
<object class="GtkStackPage">
<property name="name">page1</property>
@@ -1598,10 +1642,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-height">200</property>
<property name="hexpand">0</property>
<property name="vexpand">1</property>
<child>
<object class="GtkListBox" id="listbox">
<property name="selection-mode">none</property>
@@ -1801,6 +1846,46 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow7">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 7</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow8">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Row 8</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="hexpand">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
@@ -2000,7 +2085,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow3">
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="margin-top">6</property>
<property name="height-request">226</property>
<child>
@@ -2106,7 +2191,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">always</property>
<property name="height-request">300</property>
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<child>
<object class="GtkTreeView" id="charletree">
<property name="enable-grid-lines">vertical</property>
@@ -2172,7 +2257,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="vexpand">1</property>
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<child>
<object class="GtkListBox" id="munsell">
<property name="selection-mode">multiple</property>
@@ -2272,7 +2357,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkMenuButton">
<property name="icon-name">view-more-symbolic</property>
<property name="popover">new_style_menu</property>
<property name="menu-model">new_style_menu_model</property>
</object>
</child>
</object>
@@ -2483,6 +2568,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkButton" id="print_button">
<property name="label">Print</property>
<property name="action-name">win.print</property>
</object>
</child>
</object>
@@ -2495,37 +2581,47 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton" id="toolbutton1">
<property name="icon-name">document-open-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ⌘</property>
</object>
</child>
<child>
<object class="GtkButton" id="toolbutton2">
<property name="icon-name">send-to-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ⚽</property>
</object>
</child>
<child>
<object class="GtkButton" id="toolbutton3">
<property name="icon-name">view-fullscreen-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ⤢</property>
</object>
</child>
<child>
<object class="GtkButton" id="toolbutton4">
<property name="icon-name">star-new-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Insert ☆</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="has-frame">1</property>
<property name="hexpand">1</property>
<child>
<object class="GtkTextView" id="tooltextview"/>
@@ -2535,10 +2631,6 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
@@ -2549,18 +2641,24 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkButton" id="cutbutton">
<property name="sensitive">0</property>
<property name="icon-name">edit-cut-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Cut</property>
</object>
</child>
<child>
<object class="GtkButton" id="copybutton">
<property name="sensitive">0</property>
<property name="icon-name">edit-copy-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Copy</property>
</object>
</child>
<child>
<object class="GtkButton" id="pastebutton">
<property name="sensitive">0</property>
<property name="icon-name">edit-paste-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Paste</property>
</object>
</child>
</object>
@@ -2570,14 +2668,14 @@ microphone-sensitivity-medium-symbolic</property>
<property name="sensitive">0</property>
<property name="valign">end</property>
<property name="icon-name">edit-delete-symbolic</property>
<property name="focus-on-click">0</property>
<property name="tooltip-text" translatable="yes">Delete</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkOverlay">
<child type="overlay">
@@ -2640,7 +2738,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover2</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@@ -2665,7 +2763,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkButton">
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="focus-on-click">0</property>
<property name="icon-name">window-close-symbolic</property>
<signal name="clicked" handler="tab_close_cb" object="closable_page_1"/>
@@ -2697,7 +2795,7 @@ microphone-sensitivity-medium-symbolic</property>
</child>
<child>
<object class="GtkButton">
<property name="relief">none</property>
<property name="has-frame">0</property>
<property name="focus-on-click">0</property>
<property name="icon-name">window-close-symbolic</property>
<signal name="clicked" handler="tab_close_cb" object="closable_page_2"/>
@@ -2755,15 +2853,17 @@ microphone-sensitivity-medium-symbolic</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<property name="halign">center</property>
<property name="halign">fill</property>
<child>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="placeholder-text" translatable="yes">Name…</property>
<property name="completion">name_completion</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="show-emoji-icon">1</property>
<property name="placeholder-text" translatable="yes">Age…</property>
</object>
@@ -2784,7 +2884,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@@ -3142,7 +3242,7 @@ bad things might happen.</property>
<child>
<object class="GtkScrolledWindow">
<property name="valign">start</property>
<property name="shadow-type">in</property>
<property name="has-frame">1</property>
<property name="min-content-height">70</property>
<property name="max-content-height">120</property>
<property name="min-content-width">100</property>
@@ -3231,6 +3331,8 @@ bad things might happen.</property>
<widget name="listboxrow4"/>
<widget name="listboxrow5"/>
<widget name="listboxrow6"/>
<widget name="listboxrow7"/>
<widget name="listboxrow8"/>
</widgets>
</object>
<object class="GtkSizeGroup">
@@ -3276,7 +3378,7 @@ bad things might happen.</property>
<property name="valign">center</property>
<property name="popover">notebook_info_popover3</property>
<property name="icon-name">emblem-important-symbolic</property>
<property name="relief">none</property>
<property name="has-frame">0</property>
<style>
<class name="circular"/>
</style>
@@ -3286,6 +3388,7 @@ bad things might happen.</property>
</child>
</object>
<object class="GtkPopover" id="new_style_menu">
<style><class name="menu"/></style>
<child>
<object class="GtkStack">
<child>
@@ -3307,7 +3410,7 @@ bad things might happen.</property>
</object>
</property>
<property name="iconic">1</property>
<property name="action-name">app.print</property>
<property name="action-name">win.print</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<style>
@@ -3530,7 +3633,7 @@ bad things might happen.</property>
<attribute name="display-hint">circular-buttons</attribute>
<item>
<attribute name="verb-icon">printer-symbolic</attribute>
<attribute name="action">app.print</attribute>
<attribute name="action">win.print</attribute>
</item>
<item>
<attribute name="verb-icon">emblem-shared-symbolic</attribute>
@@ -3597,6 +3700,7 @@ bad things might happen.</property>
</submenu>
</section>
<section>
<attribute name="label" translatable="yes">Size</attribute>
<item>
<attribute name="label" translatable="yes">Large</attribute>
<attribute name="action">app.size</attribute>
+3 -10
View File
@@ -171,8 +171,6 @@ gdk_rgba_get_type
<TITLE>GdkSurface</TITLE>
<FILE>gdksurface</FILE>
GdkSurface
GdkSurfaceHints
GdkGeometry
GdkGravity
GdkSurfaceEdge
GdkSurfaceTypeHint
@@ -190,7 +188,6 @@ gdk_surface_get_height
gdk_surface_translate_coordinates
gdk_surface_begin_resize_drag
gdk_surface_begin_move_drag
gdk_surface_constrain_size
gdk_surface_beep
gdk_surface_get_scale_factor
gdk_surface_set_opaque_region
@@ -515,6 +512,9 @@ gdk_key_event_get_consumed_modifiers
gdk_key_event_get_layout
gdk_key_event_get_level
gdk_key_event_is_modifier
GdkEventMatch
gdk_key_event_matches
gdk_key_event_get_match
gdk_focus_event_get_in
gdk_touch_event_get_emulating_pointer
gdk_crossing_event_get_mode
@@ -537,11 +537,6 @@ gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
<SUBSECTION>
GdkEventMatch
gdk_event_matches
gdk_event_get_match
<SUBSECTION Standard>
GDK_TYPE_EVENT
GDK_TYPE_EVENT_MASK
@@ -657,8 +652,6 @@ gdk_toplevel_set_transient_for
gdk_toplevel_set_modal
gdk_toplevel_set_icon_list
gdk_toplevel_show_window_menu
gdk_toplevel_set_accept_focus
gdk_toplevel_set_focus_on_map
gdk_toplevel_set_decorated
gdk_toplevel_set_deletable
gdk_toplevel_supports_edge_constraints
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -203,12 +203,12 @@
<title>Hierarchical drawing</title>
<para>
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.
During the Paint phase GTK receives a single #GdkSurface::render signal on
the toplevel surface. The signal handler will create a snapshot object
(which is a helper for creating a scene graph) and call the
#GtkWidget::snapshot() vfunc, 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>
@@ -217,7 +217,7 @@
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.
to regenerate it the next time it needs to produce a snapshot.
</para>
</refsect2>
+9 -3
View File
@@ -19,11 +19,15 @@
</bookinfo>
<part id="gtk">
<title>GTK Overview</title>
<title>Introduction</title>
<xi:include href="overview.xml"/>
<xi:include href="xml/getting_started.xml"/>
<xi:include href="resources.xml" />
<xi:include href="xml/question_index.xml" />
</part>
<part id="concepts">
<title>GTK Concepts</title>
<xi:include href="xml/drawing-model.xml" />
<xi:include href="xml/input-handling.xml" />
<xi:include href="xml/actions.xml" />
@@ -113,9 +117,10 @@
<xi:include href="xml/gtklayoutchild.xml" />
<xi:include href="xml/gtkbinlayout.xml" />
<xi:include href="xml/gtkboxlayout.xml" />
<xi:include href="xml/gtkcustomlayout.xml" />
<xi:include href="xml/gtkcenterlayout.xml" />
<xi:include href="xml/gtkfixedlayout.xml" />
<xi:include href="xml/gtkgridlayout.xml" />
<xi:include href="xml/gtkcustomlayout.xml" />
<xi:include href="xml/gtkconstraintlayout.xml" />
<xi:include href="xml/gtkconstraint.xml" />
<xi:include href="xml/gtkconstraintguide.xml" />
@@ -280,6 +285,7 @@
<xi:include href="xml/gtkshortcutssection.xml" />
<xi:include href="xml/gtkshortcutsgroup.xml" />
<xi:include href="xml/gtkshortcutsshortcut.xml" />
<xi:include href="xml/gtkshortcutlabel.xml" />
</chapter>
<chapter id="MiscObjects">
@@ -291,6 +297,7 @@
<xi:include href="xml/gtksnapshot.xml" />
<xi:include href="xml/gtktooltip.xml" />
<xi:include href="xml/gtkwidgetpaintable.xml" />
<xi:include href="xml/gtkwindowcontrols.xml" />
</chapter>
<chapter id="AbstractObjects">
@@ -371,7 +378,6 @@
<part id="theming">
<title>Theming in GTK</title>
<xi:include href="css-overview.xml" />
<xi:include href="css-properties.xml" />
<xi:include href="xml/gtkstylecontext.xml" />
<xi:include href="xml/gtkcssprovider.xml" />
<xi:include href="xml/gtkstyleprovider.xml" />
+98 -37
View File
@@ -74,6 +74,8 @@ gtk_accel_label_get_accel
gtk_accel_label_refetch
gtk_accel_label_set_label
gtk_accel_label_get_label
gtk_accel_label_get_use_underline
gtk_accel_label_set_use_underline
<SUBSECTION Standard>
GTK_ACCEL_LABEL
GTK_IS_ACCEL_LABEL
@@ -180,6 +182,7 @@ GTK_ASSISTANT_GET_CLASS
<SUBSECTION Private>
GtkAssistantPrivate
gtk_assistant_get_type
gtk_assistant_page_get_type
</SECTION>
<SECTION>
@@ -187,7 +190,14 @@ gtk_assistant_get_type
<TITLE>GtkAspectFrame</TITLE>
GtkAspectFrame
gtk_aspect_frame_new
gtk_aspect_frame_set
gtk_aspect_frame_set_xalign
gtk_aspect_frame_get_xalign
gtk_aspect_frame_set_yalign
gtk_aspect_frame_get_yalign
gtk_aspect_frame_set_ratio
gtk_aspect_frame_get_ratio
gtk_aspect_frame_set_obey_child
gtk_aspect_frame_get_obey_child
<SUBSECTION Standard>
GTK_ASPECT_FRAME
GTK_IS_ASPECT_FRAME
@@ -196,7 +206,6 @@ GTK_ASPECT_FRAME_CLASS
GTK_IS_ASPECT_FRAME_CLASS
GTK_ASPECT_FRAME_GET_CLASS
<SUBSECTION Private>
GtkAspectFramePrivate
gtk_aspect_frame_get_type
</SECTION>
@@ -520,8 +529,8 @@ gtk_button_new
gtk_button_new_with_label
gtk_button_new_with_mnemonic
gtk_button_new_from_icon_name
gtk_button_set_relief
gtk_button_get_relief
gtk_button_set_has_frame
gtk_button_get_has_frame
gtk_button_get_label
gtk_button_set_label
gtk_button_get_use_underline
@@ -553,6 +562,12 @@ gtk_calendar_mark_day
gtk_calendar_unmark_day
gtk_calendar_get_day_is_marked
gtk_calendar_clear_marks
gtk_calendar_get_show_day_names
gtk_calendar_set_show_day_names
gtk_calendar_get_show_heading
gtk_calendar_set_show_heading
gtk_calendar_get_show_week_numbers
gtk_calendar_set_show_week_numbers
<SUBSECTION>
gtk_calendar_get_date
@@ -599,6 +614,8 @@ gtk_color_button_new
gtk_color_button_new_with_rgba
gtk_color_button_set_title
gtk_color_button_get_title
gtk_color_button_set_modal
gtk_color_button_get_modal
<SUBSECTION Standard>
GTK_COLOR_BUTTON
GTK_IS_COLOR_BUTTON
@@ -692,10 +709,6 @@ gtk_container_add
gtk_container_remove
gtk_container_foreach
gtk_container_get_children
gtk_container_get_focus_vadjustment
gtk_container_set_focus_vadjustment
gtk_container_get_focus_hadjustment
gtk_container_set_focus_hadjustment
gtk_container_child_type
gtk_container_forall
@@ -1155,6 +1168,8 @@ gtk_file_chooser_button_get_title
gtk_file_chooser_button_set_title
gtk_file_chooser_button_get_width_chars
gtk_file_chooser_button_set_width_chars
gtk_file_chooser_button_get_modal
gtk_file_chooser_button_set_modal
<SUBSECTION Standard>
GTK_FILE_CHOOSER_BUTTON
@@ -1269,6 +1284,8 @@ gtk_font_button_set_use_size
gtk_font_button_get_use_size
gtk_font_button_set_title
gtk_font_button_get_title
gtk_font_button_set_modal
gtk_font_button_get_modal
<SUBSECTION Standard>
GTK_FONT_BUTTON
GTK_IS_FONT_BUTTON
@@ -1366,13 +1383,11 @@ GtkFrame
GtkFrameClass
gtk_frame_new
gtk_frame_set_label
gtk_frame_set_label_widget
gtk_frame_set_label_align
gtk_frame_set_shadow_type
gtk_frame_get_label
gtk_frame_get_label_align
gtk_frame_set_label_widget
gtk_frame_get_label_widget
gtk_frame_get_shadow_type
gtk_frame_set_label_align
gtk_frame_get_label_align
<SUBSECTION Standard>
GTK_FRAME
GTK_IS_FRAME
@@ -1585,7 +1600,6 @@ gtk_label_set_text
gtk_label_set_attributes
gtk_label_set_markup
gtk_label_set_markup_with_mnemonic
gtk_label_set_pattern
gtk_label_set_justify
gtk_label_set_xalign
gtk_label_set_yalign
@@ -1626,8 +1640,6 @@ gtk_label_set_use_markup
gtk_label_set_use_underline
gtk_label_set_single_line_mode
gtk_label_get_current_uri
gtk_label_set_track_visited_links
gtk_label_get_track_visited_links
gtk_label_set_extra_menu
gtk_label_get_extra_menu
@@ -1706,8 +1718,10 @@ gtk_menu_button_set_icon_name
gtk_menu_button_get_icon_name
gtk_menu_button_set_label
gtk_menu_button_get_label
gtk_menu_button_set_relief
gtk_menu_button_get_relief
gtk_menu_button_set_has_frame
gtk_menu_button_get_has_frame
gtk_menu_button_get_use_underline
gtk_menu_button_set_use_underline
gtk_menu_button_popup
gtk_menu_button_popdown
GtkMenuButtonCreatePopupFunc
@@ -2199,8 +2213,8 @@ GtkCornerType
gtk_scrolled_window_get_placement
gtk_scrolled_window_set_placement
gtk_scrolled_window_unset_placement
gtk_scrolled_window_get_shadow_type
gtk_scrolled_window_set_shadow_type
gtk_scrolled_window_get_has_frame
gtk_scrolled_window_set_has_frame
gtk_scrolled_window_get_kinetic_scrolling
gtk_scrolled_window_set_kinetic_scrolling
gtk_scrolled_window_get_capture_button_press
@@ -2298,6 +2312,7 @@ GtkSettingsValue
gtk_settings_get_default
gtk_settings_get_for_display
gtk_settings_reset_property
GtkSystemSetting
<SUBSECTION Standard>
GtkSettingsClass
GTK_IS_SETTINGS
@@ -3837,8 +3852,8 @@ gtk_list_store_get_type
<TITLE>GtkViewport</TITLE>
GtkViewport
gtk_viewport_new
gtk_viewport_set_shadow_type
gtk_viewport_get_shadow_type
gtk_viewport_set_scroll_to_focus
gtk_viewport_get_scroll_to_focus
<SUBSECTION Standard>
GTK_VIEWPORT
GTK_IS_VIEWPORT
@@ -3967,7 +3982,9 @@ gtk_widget_allocate
gtk_widget_class_add_shortcut
gtk_widget_class_add_binding
gtk_widget_class_add_binding_signal
gtk_widget_can_activate_accel
gtk_widget_class_add_binding_action
gtk_widget_class_set_layout_manager_type
gtk_widget_class_get_layout_manager_type
gtk_widget_activate
gtk_widget_is_focus
gtk_widget_grab_focus
@@ -4053,7 +4070,6 @@ gtk_widget_get_state_flags
gtk_widget_has_default
gtk_widget_has_focus
gtk_widget_has_visible_focus
gtk_widget_has_grab
gtk_widget_is_drawable
gtk_widget_set_receives_default
gtk_widget_get_receives_default
@@ -4086,7 +4102,6 @@ gtk_widget_set_css_classes
<SUBSECTION>
gtk_widget_get_style_context
gtk_widget_reset_style
gtk_widget_class_get_css_name
gtk_widget_class_set_css_name
@@ -4275,6 +4290,27 @@ GtkWindowGroupPrivate
gtk_window_group_get_type
</SECTION>
<SECTION>
<FILE>gtkwindowcontrols</FILE>
<TITLE>GtkWindowControls</TITLE>
GtkWindowControls
gtk_window_controls_new
gtk_window_controls_get_side
gtk_window_controls_set_side
gtk_window_controls_get_decoration_layout
gtk_window_controls_set_decoration_layout
gtk_window_controls_get_empty
<SUBSECTION Standard>
GTK_WINDOW_CONTROLS
GTK_IS_WINDOW_CONTROLS
GTK_TYPE_WINDOW_CONTROLS
GTK_WINDOW_CONTROLS_CLASS
GTK_IS_WINDOW_CONTROLS_CLASS
GTK_WINDOW_CONTROLS_GET_CLASS
<SUBSECTION Private>
gtk_window_controls_get_type
</SECTION>
<SECTION>
<FILE>gtkmain</FILE>
<TITLE>General</TITLE>
@@ -4287,12 +4323,6 @@ gtk_init_check
<SUBSECTION>
GTK_PRIORITY_RESIZE
<SUBSECTION>
gtk_get_current_event
gtk_get_current_event_time
gtk_get_current_event_state
gtk_get_current_event_device
<SUBSECTION Private>
gtk_init_abi_check
gtk_init_check_abi_check
@@ -4437,7 +4467,6 @@ gtk_style_context_get_margin
gtk_style_context_lookup_color
gtk_style_context_remove_provider
gtk_style_context_remove_provider_for_display
gtk_style_context_reset_widgets
gtk_style_context_restore
gtk_style_context_save
gtk_style_context_add_class
@@ -4539,11 +4568,9 @@ GtkMovementStep
GtkOrientation
GtkPackType
GtkPositionType
GtkReliefStyle
GtkScrollStep
GtkScrollType
GtkSelectionMode
GtkShadowType
GtkStateFlags
GtkSortType
GtkIconSize
@@ -5112,7 +5139,9 @@ gtk_mount_operation_set_parent
gtk_mount_operation_get_parent
gtk_mount_operation_set_display
gtk_mount_operation_get_display
gtk_show_uri_on_window
gtk_show_uri_full
gtk_show_uri_full_finish
gtk_show_uri
<SUBSECTION Standard>
GTK_IS_MOUNT_OPERATION
GTK_IS_MOUNT_OPERATION_CLASS
@@ -5342,6 +5371,8 @@ gtk_app_chooser_button_get_show_dialog_item
gtk_app_chooser_button_set_show_dialog_item
gtk_app_chooser_button_get_heading
gtk_app_chooser_button_set_heading
gtk_app_chooser_button_get_modal
gtk_app_chooser_button_set_modal
<SUBSECTION Standard>
GTK_TYPE_APP_CHOOSER_BUTTON
@@ -5815,6 +5846,14 @@ gtk_event_controller_get_propagation_limit
gtk_event_controller_set_propagation_limit
gtk_event_controller_get_widget
gtk_event_controller_reset
gtk_event_controller_get_name
gtk_event_controller_set_name
<SUBSECTION>
gtk_event_controller_get_current_event
gtk_event_controller_get_current_event_device
gtk_event_controller_get_current_event_state
gtk_event_controller_get_current_event_time
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER
@@ -5983,6 +6022,7 @@ gtk_mnemonic_trigger_get_keyval
GtkAlternativeTrigger
gtk_alternative_trigger_new
gtk_alternative_trigger_get_first
gtk_alternative_trigger_get_second
<SUBSECTION>
GtkNeverTrigger
@@ -6068,7 +6108,7 @@ GtkShortcutManagerInterface
<TITLE>GtkShortcutController</TITLE>
GtkShortcutController
gtk_shortcut_controller_new
gtk_shortcut_controller_new_with_model
gtk_shortcut_controller_new_for_model
GtkShortcutScope
GtkShortcutManager
GtkShortcutManagerInterface
@@ -6449,8 +6489,8 @@ GTK_SHORTCUTS_SHORTCUT_GET_CLASS
GtkShortcutLabel
gtk_shortcut_label_new
gtk_shortcut_label_get_accelerator
gtk_shortcut_label_get_disabled_text
gtk_shortcut_label_set_accelerator
gtk_shortcut_label_get_disabled_text
gtk_shortcut_label_set_disabled_text
<SUBSECTION Private>
@@ -6634,6 +6674,27 @@ GTK_TYPE_BOX_LAYOUT
gtk_box_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkcenterlayout</FILE>
GtkCenterLayout
gtk_center_layout_new
gtk_center_layout_set_orientation
gtk_center_layout_get_orientation
gtk_center_layout_set_baseline_position
gtk_center_layout_get_baseline_position
gtk_center_layout_set_start_widget
gtk_center_layout_get_start_widget
gtk_center_layout_set_center_widget
gtk_center_layout_get_center_widget
gtk_center_layout_set_end_widget
gtk_center_layout_get_end_widget
<SUBSECTION Standard>
GTK_TYPE_CENTER_LAYOUT
gtk_center_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkcustomlayout</FILE>
GtkCustomLayout
+2
View File
@@ -41,6 +41,7 @@ gtk_cell_renderer_spinner_get_type
gtk_cell_renderer_text_get_type
gtk_cell_renderer_toggle_get_type
gtk_cell_view_get_type
gtk_center_layout_get_type
gtk_check_button_get_type
gtk_color_button_get_type
gtk_color_chooser_get_type
@@ -213,4 +214,5 @@ gtk_viewport_get_type
gtk_volume_button_get_type
gtk_widget_get_type
gtk_window_get_type
gtk_window_controls_get_type
gtk_window_group_get_type
+6 -11
View File
@@ -73,6 +73,12 @@
between different events by looking at their type, using
gdk_event_get_event_type().
</para>
<para>
Some events, such as touch events or button press-release pairs,
are connected in to each other in an “event sequence” that
univocally identifies events that are related to the same
interaction.
</para>
<para>
When GTK creates a GdkSurface, it connects to the #GdkSurface::event
signal on it, which receives all of these input events. Surfaces have
@@ -181,17 +187,6 @@
</para>
</refsect2>
<refsect2>
<title>Touch events</title>
<para>
Touch events are emitted as events of type %GDK_TOUCH_BEGIN,
%GDK_TOUCH_UPDATE or %GDK_TOUCH_END, those events contain an
“event sequence” that univocally identifies the physical touch
until it is lifted from the device.
</para>
</refsect2>
<refsect2>
<title>Keyboard input</title>
-2
View File
@@ -23,7 +23,6 @@ private_headers = [
'gtkcolorscaleprivate.h',
'gtkcolorswatchprivate.h',
'gtkcomboboxprivate.h',
'gtkcontainerprivate.h',
'gtkconstraintexpressionprivate.h',
'gtkconstraintguideprivate.h',
'gtkconstraintlayoutprivate.h',
@@ -343,7 +342,6 @@ content_files = [
'building.xml',
'compiling.xml',
'css-overview.xml',
'css-properties.xml',
'drawing-model.xml',
'glossary.xml',
'gtk4-broadwayd.xml',
+66 -8
View File
@@ -299,8 +299,9 @@
in GTK 4.
</para>
<para>
GdkEvent is now a strictly read-only boxed type, and you
can no longer change any of its fields.
GdkEvent is now a strictly read-only type, and you
can no longer change any of its fields, or construct new
events.
</para>
</section>
@@ -308,7 +309,7 @@
<title>Stop using gdk_surface_set_event_compression</title>
<para>
Event compression is now always enabled. If you need to see the uncoalesced
motion history, use gdk_event_get_motion_history().
motion history, use gdk_motion_event_get_history() on the latest motion event.
</para>
</section>
@@ -318,8 +319,8 @@
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.
warp the pointer; in this case, use platform APIs such as
<function>XWarpPointer()</function> directly.
</para>
</section>
@@ -339,6 +340,15 @@
</para>
</section>
<section>
<title>Stop using gtk_get_current_... APIs</title>
<para>
The function gtk_get_current_event() and its variants have been
replaced by equivalent event controller APIs:
gtk_event_controller_get_current_event(), etc.
</para>
</section>
<section>
<title>Adapt to surface API changes</title>
<para>
@@ -389,7 +399,7 @@
Any APIs that deal with global (or root) coordinates have been
removed in GTK4, since not all backends support them. You should
replace your use of such APIs with surface-relative equivalents.
Examples of this are gdk_surfae_get_origin(), gdk_surface_move()
Examples of this are gdk_surface_get_origin(), gdk_surface_move()
or gdk_event_get_root_coords().
</para>
</section>
@@ -418,8 +428,8 @@
<para>
If you need to do forward or backward mapping between key codes
and key values, use gdk_display_map_keycode() and gdk_display_map_keyval(),
which is the replacement for gdk_keymap_get_entries_for_keycode()
and gdk_keymap_get_entries_for_keycode().
which are the replacements for gdk_keymap_get_entries_for_keycode()
and gdk_keymap_get_entries_for_keyval().
</para>
</section>
@@ -470,6 +480,28 @@
</para>
</section>
<section>
<title>Focus handling changes</title>
<para>
The semantics of the #GtkWidget:can-focus property have changed.
In GTK 3, this property only meant that the widget itself would not
accept keyboard input, but its children still might (in the case of
containers). In GTK 4, if :can-focus is %FALSE, the focus cannot enter
the widget or any of its descendents, and the default value has changed
from %FALSE to %TRUE.
</para>
<para>
The recommended way to influence focus behavior of custom widgets
in GTK 4 is to override the focus() and grab_focus() vfuncs.
</para>
<para>
The feature to automatically keep the focus widget scrolled into view
with gtk_container_set_focus_vadjustment() has been removed from
GtkContainer, and is provided by scrollables instead. In the common case
that the scrollable is a #GtkViewport, use #GtkViewport:scroll-to-focus.
</para>
</section>
<section>
<title>Stop using GtkEventBox</title>
<para>
@@ -537,6 +569,12 @@
and always use the context's current state. Update all callers
to omit the state argument.
</para>
<para>
The most commonly used GtkStyleContext API, gtk_style_context_add_class(),
has been moved to GtkWidget as gtk_widget_add_css_class(), as have the
corresponding gtk_style_context_remove_class() and
gtk_style_context_has_class() APIs.
</para>
</section>
<section>
@@ -561,6 +599,17 @@
</para>
</section>
<section>
<title>Stop using GtkShadowType and GtkRelief properties</title>
<para>
The shadow-type properties in GtkScrolledWindow, GtkViewport,
and GtkFrame, as well as the relief properties in GtkButton
and its subclasses have been removed. GtkScrolledWindow, GtkButton
and GtkMenuButton have instead gained a boolean has-frame
property.
</para>
</section>
<section>
<title>Adapt to GtkWidget's size request changes</title>
<para>
@@ -1011,6 +1060,15 @@
</para>
</section>
<section>
<title>GtkAspectFrame is no longer a frame</title>
<para>
GtkAspectFrame is no longer derived from GtkFrame and does not
place a label and frame around its child anymore. It still lets
you control the aspect ratio of its child.
</para>
</section>
<section>
<title>Stop using custom tooltip windows</title>
<para>
+3 -2
View File
@@ -3,8 +3,9 @@ if get_option('gtk_doc')
error('Building the GTK documentation requires Meson 0.52.0')
endif
# Use gtk-doc as a sub-project if the version isn't new enough
dependency('gtk-doc', version: '>=1.32',
# Use gtk-doc as a sub-project from the gtk-doc-for-gtk4 branch
# for the time being
dependency('gtk-doc', version: '>=1.99',
fallback: ['gtk-doc', 'dummy_dep'],
default_options: ['tests=false'])
+5 -19
View File
@@ -455,7 +455,6 @@ create_text_view (void)
GtkWidget *text_view;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
text_view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (widget), text_view);
/* Bad hack to add some size to the widget */
@@ -476,7 +475,6 @@ create_tree_view (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
gtk_tree_store_append (store, &iter, NULL);
gtk_tree_store_set (store, &iter, 0, "Line One", 1, FALSE, 2, "A", -1);
@@ -520,7 +518,6 @@ create_icon_view (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
list_store = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
gtk_list_store_append (list_store, &iter);
pixbuf = gdk_pixbuf_new_from_file ("folder.png", NULL);
@@ -665,27 +662,19 @@ create_panes (void)
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
pane = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_pack1 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
g_object_new (GTK_TYPE_FRAME, NULL),
FALSE, FALSE);
gtk_paned_pack2 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
g_object_new (GTK_TYPE_FRAME, NULL),
FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (hbox),
pane);
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_pack1 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
g_object_new (GTK_TYPE_FRAME, NULL),
FALSE, FALSE);
gtk_paned_pack2 (GTK_PANED (pane),
g_object_new (GTK_TYPE_FRAME,
"shadow-type", GTK_SHADOW_IN,
NULL),
g_object_new (GTK_TYPE_FRAME, NULL),
FALSE, FALSE);
gtk_container_add (GTK_CONTAINER (hbox),
pane);
@@ -1226,7 +1215,7 @@ create_sidebar (void)
stack = gtk_stack_new ();
gtk_widget_set_size_request (stack, 120, 120);
view = gtk_label_new ("Sidebar");
gtk_style_context_add_class (gtk_widget_get_style_context (view), "view");
gtk_widget_add_css_class (view, "view");
gtk_widget_set_halign (view, GTK_ALIGN_FILL);
gtk_widget_set_valign (view, GTK_ALIGN_FILL);
gtk_widget_show (view);
@@ -1259,7 +1248,6 @@ create_list_box (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_BROWSE);
@@ -1312,7 +1300,6 @@ create_flow_box (void)
WidgetInfo *info;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
box = gtk_flow_box_new ();
gtk_flow_box_set_min_children_per_line (GTK_FLOW_BOX (box), 2);
@@ -1351,7 +1338,6 @@ create_gl_area (void)
GtkWidget *gears;
widget = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_IN);
gears = gtk_gears_new ();
gtk_container_add (GTK_CONTAINER (widget), gears);
-1
View File
@@ -143,7 +143,6 @@ activate (GtkApplication *app,
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (window), frame);
drawing_area = gtk_drawing_area_new ();
+10 -10
View File
@@ -100,7 +100,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY,
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
@@ -119,7 +119,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY,
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
@@ -141,7 +141,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_motion_new (surface,
event = gdk_motion_event_new (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
NULL,
@@ -165,7 +165,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_button_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS
event = gdk_button_event_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS
? GDK_BUTTON_PRESS
: GDK_BUTTON_RELEASE,
surface,
@@ -188,7 +188,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_discrete_scroll_new (surface,
event = gdk_scroll_event_new_discrete (surface,
gdk_seat_get_pointer (seat),
gdk_seat_get_pointer (seat),
NULL,
@@ -243,7 +243,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
state |= GDK_BUTTON1_MASK;
event = gdk_event_touch_new (event_type,
event = gdk_touch_event_new (event_type,
GUINT_TO_POINTER (message->touch.sequence_id),
surface,
gdk_seat_get_pointer (seat),
@@ -271,7 +271,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_event_key_new (message->base.type == BROADWAY_EVENT_KEY_PRESS
event = gdk_key_event_new (message->base.type == BROADWAY_EVENT_KEY_PRESS
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
surface,
@@ -298,7 +298,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface)
{
event = gdk_event_configure_new (surface,
event = gdk_configure_event_new (surface,
message->configure_notify.width,
message->configure_notify.height);
@@ -329,7 +329,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (surface)
{
event = gdk_event_focus_new (surface,
event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
FALSE);
@@ -340,7 +340,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (surface)
{
event = gdk_event_focus_new (surface,
event = gdk_focus_event_new (surface,
gdk_seat_get_keyboard (seat),
gdk_seat_get_keyboard (seat),
TRUE);
+1
View File
@@ -27,6 +27,7 @@
#include <gdk/gdksurfaceprivate.h>
#include "gdkbroadwaysurface.h"
#include "gdkinternals.h"
G_BEGIN_DECLS
+1 -1
View File
@@ -67,7 +67,7 @@ libgdk_broadway = static_library('gdk-broadway',
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
clienthtml_h, broadwayjs_h,
clienthtml_h, broadwayjs_h, gdkconfig, gdkenum_h,
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
include_directories: [confinc, gdkinc, include_directories('.')],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', ],
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

+1 -1
View File
@@ -505,7 +505,7 @@ generate_grab_broken_event (GdkDisplay *display,
{
GdkEvent *event;
event = gdk_event_grab_broken_new (surface,
event = gdk_grab_broken_event_new (surface,
device,
device,
grab_surface,
+24 -24
View File
@@ -915,12 +915,12 @@ gdk_drop_emit_enter_event (GdkDrop *self,
g_warn_if_fail (!priv->entered);
event = gdk_event_drag_new (GDK_DRAG_ENTER,
priv->surface,
priv->device,
self,
time,
0, 0);
event = gdk_dnd_event_new (GDK_DRAG_ENTER,
priv->surface,
priv->device,
self,
time,
0, 0);
priv->entered = TRUE;
@@ -939,12 +939,12 @@ gdk_drop_emit_motion_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
event = gdk_event_drag_new (GDK_DRAG_MOTION,
priv->surface,
priv->device,
self,
time,
x, y);
event = gdk_dnd_event_new (GDK_DRAG_MOTION,
priv->surface,
priv->device,
self,
time,
x, y);
gdk_drop_do_emit_event (event, dont_queue);
}
@@ -959,12 +959,12 @@ gdk_drop_emit_leave_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
event = gdk_event_drag_new (GDK_DRAG_LEAVE,
priv->surface,
priv->device,
self,
time,
0, 0);
event = gdk_dnd_event_new (GDK_DRAG_LEAVE,
priv->surface,
priv->device,
self,
time,
0, 0);
priv->entered = FALSE;
@@ -984,12 +984,12 @@ gdk_drop_emit_drop_event (GdkDrop *self,
g_warn_if_fail (priv->entered);
g_warn_if_fail (priv->state == GDK_DROP_STATE_NONE);
event = gdk_event_drag_new (GDK_DROP_START,
priv->surface,
priv->device,
self,
time,
x, y);
event = gdk_dnd_event_new (GDK_DROP_START,
priv->surface,
priv->device,
self,
time,
x, y);
priv->state = GDK_DROP_STATE_DROPPING;
+2095 -1294
View File
File diff suppressed because it is too large Load Diff
+79 -14
View File
@@ -41,6 +41,10 @@ G_BEGIN_DECLS
#define GDK_TYPE_EVENT (gdk_event_get_type ())
#define GDK_TYPE_EVENT_SEQUENCE (gdk_event_sequence_get_type ())
#define GDK_IS_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_EVENT))
#define GDK_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_EVENT, GdkEvent))
#define GDK_IS_EVENT_TYPE(event, type) (gdk_event_get_event_type ((event)) == (type))
/**
* GDK_PRIORITY_EVENTS:
@@ -98,9 +102,38 @@ G_BEGIN_DECLS
*/
#define GDK_BUTTON_SECONDARY (3)
typedef struct _GdkEventSequence GdkEventSequence;
typedef struct _GdkEvent GdkEvent;
typedef struct _GdkEventSequence GdkEventSequence;
typedef union _GdkEvent GdkEvent;
#define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
#define GDK_TYPE_CONFIGURE_EVENT (gdk_configure_event_get_type())
#define GDK_TYPE_CROSSING_EVENT (gdk_crossing_event_get_type())
#define GDK_TYPE_DELETE_EVENT (gdk_delete_event_get_type())
#define GDK_TYPE_DND_EVENT (gdk_dnd_event_get_type())
#define GDK_TYPE_FOCUS_EVENT (gdk_focus_event_get_type())
#define GDK_TYPE_GRAB_BROKEN_EVENT (gdk_grab_broken_event_get_type())
#define GDK_TYPE_KEY_EVENT (gdk_key_event_get_type())
#define GDK_TYPE_MOTION_EVENT (gdk_motion_event_get_type())
#define GDK_TYPE_PAD_EVENT (gdk_pad_event_get_type())
#define GDK_TYPE_PROXIMITY_EVENT (gdk_proximity_event_get_type())
#define GDK_TYPE_SCROLL_EVENT (gdk_scroll_event_get_type())
#define GDK_TYPE_TOUCH_EVENT (gdk_touch_event_get_type())
#define GDK_TYPE_TOUCHPAD_EVENT (gdk_touchpad_event_get_type())
typedef struct _GdkButtonEvent GdkButtonEvent;
typedef struct _GdkConfigureEvent GdkConfigureEvent;
typedef struct _GdkCrossingEvent GdkCrossingEvent;
typedef struct _GdkDeleteEvent GdkDeleteEvent;
typedef struct _GdkDNDEvent GdkDNDEvent;
typedef struct _GdkFocusEvent GdkFocusEvent;
typedef struct _GdkGrabBrokenEvent GdkGrabBrokenEvent;
typedef struct _GdkKeyEvent GdkKeyEvent;
typedef struct _GdkMotionEvent GdkMotionEvent;
typedef struct _GdkPadEvent GdkPadEvent;
typedef struct _GdkProximityEvent GdkProximityEvent;
typedef struct _GdkScrollEvent GdkScrollEvent;
typedef struct _GdkTouchEvent GdkTouchEvent;
typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
/**
* GdkEventType:
@@ -297,7 +330,6 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GType gdk_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gdk_event_sequence_get_type (void) G_GNUC_CONST;
@@ -348,9 +380,13 @@ gboolean gdk_event_get_axis (GdkEvent *event,
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_pointer_emulated (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_button_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint gdk_button_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_scroll_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkScrollDirection gdk_scroll_event_get_direction (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_scroll_event_get_deltas (GdkEvent *event,
@@ -359,6 +395,8 @@ void gdk_scroll_event_get_deltas (GdkEvent *event,
GDK_AVAILABLE_IN_ALL
gboolean gdk_scroll_event_is_stop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_key_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keyval (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_key_event_get_keycode (GdkEvent *event);
@@ -371,18 +409,30 @@ guint gdk_key_event_get_level (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_key_event_is_modifier (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_focus_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_focus_event_get_in (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_touch_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_touch_event_get_emulating_pointer (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_crossing_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkCrossingMode gdk_crossing_event_get_mode (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_crossing_event_get_focus (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_configure_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height);
GDK_AVAILABLE_IN_ALL
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase
gdk_touchpad_event_get_gesture_phase (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
@@ -392,26 +442,41 @@ void gdk_touchpad_event_get_deltas (GdkEvent *event,
double *dx,
double *dy);
GDK_AVAILABLE_IN_ALL
double gdk_touchpad_pinch_event_get_angle_delta (GdkEvent *event);
double gdk_touchpad_event_get_pinch_angle_delta (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
double gdk_touchpad_pinch_event_get_scale (GdkEvent *event);
double gdk_touchpad_event_get_pinch_scale (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
guint gdk_pad_button_event_get_button (GdkEvent *event);
GType gdk_pad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gdk_pad_axis_event_get_value (GdkEvent *event,
guint *index,
double *value);
guint gdk_pad_event_get_button (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
void gdk_pad_event_get_axis_value (GdkEvent *event,
guint *index,
double *value);
GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_drag_event_get_drop (GdkEvent *event);
void gdk_pad_event_get_group_mode (GdkEvent *event,
guint *group,
guint *mode);
GDK_AVAILABLE_IN_ALL
GType gdk_dnd_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDrop * gdk_dnd_event_get_drop (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_grab_broken_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_grab_broken_event_get_grab_surface (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_grab_broken_event_get_implicit (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GList * gdk_event_get_motion_history (GdkEvent *event);
GType gdk_motion_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GList * gdk_motion_event_get_history (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_delete_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GType gdk_proximity_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_triggers_context_menu (GdkEvent *event);
+191 -301
View File
@@ -30,74 +30,98 @@
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
G_BEGIN_DECLS
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventTouch GdkEventTouch;
typedef struct _GdkEventScroll GdkEventScroll;
typedef struct _GdkEventKey GdkEventKey;
typedef struct _GdkEventFocus GdkEventFocus;
typedef struct _GdkEventCrossing GdkEventCrossing;
typedef struct _GdkEventConfigure GdkEventConfigure;
typedef struct _GdkEventProximity GdkEventProximity;
typedef struct _GdkEventDND GdkEventDND;
typedef struct _GdkEventSetting GdkEventSetting;
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
typedef struct _GdkEventTouchpadSwipe GdkEventTouchpadSwipe;
typedef struct _GdkEventTouchpadPinch GdkEventTouchpadPinch;
typedef struct _GdkEventPadButton GdkEventPadButton;
typedef struct _GdkEventPadAxis GdkEventPadAxis;
typedef struct _GdkEventPadGroupMode GdkEventPadGroupMode;
#define GDK_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_EVENT, GdkEventClass))
/*
* GdkEventAny:
* @type: the type of the event.
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
typedef struct _GdkEventClass GdkEventClass;
/*< private >
* GdkEvent:
* @ref_count: the reference count of the event
* @event_type: the specialized event type
* @surface: the surface of the event
* @device: the device of the event
* @source_device: the source device
* @time: a serial identifier of the event that can be used to order
* two events
* @flags: event flags
*
* Contains the fields which are common to all event structs.
* Any event pointer can safely be cast to a pointer to a #GdkEventAny to
* access these fields.
* The abstract type for all windowing system events.
*/
struct _GdkEventAny
struct _GdkEvent
{
int ref_count;
GdkEventType type;
GTypeInstance parent_instance;
grefcount ref_count;
/* Specialised event type */
GdkEventType event_type;
/* The surface of the event */
GdkSurface *surface;
guint32 time;
guint16 flags;
guint pointer_emulated : 1;
guint touch_emulating : 1;
guint scroll_is_stop : 1;
guint key_is_modifier : 1;
guint focus_in : 1;
/* The devices associated to the event */
GdkDevice *device;
GdkDevice *source_device;
guint32 time;
guint16 flags;
};
/*< private >
* GdkEventClass:
* @finalize: a function called when the last reference held on an event is
* released; implementations of GdkEvent must chain up to the parent class
*
* The base class for events.
*/
struct _GdkEventClass
{
GTypeClass parent_class;
void (* finalize) (GdkEvent *event);
GdkModifierType (* get_state) (GdkEvent *event);
gboolean (* get_position) (GdkEvent *event,
double *x,
double *y);
GdkEventSequence * (* get_sequence) (GdkEvent *event);
GdkDeviceTool * (* get_tool) (GdkEvent *event);
gboolean (* get_axes) (GdkEvent *event,
double **axes,
guint *n_axes);
};
/*
* GdkEventMotion:
* @type: the type of the event.
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* GdkDeleteEvent:
*
* Generated when a surface is deleted.
*/
struct _GdkDeleteEvent
{
GdkEvent parent_instance;
};
/*
* GdkMotionEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) set during the motion
* event. See #GdkModifierType.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
* @history: (element-type GdkTimeCoord): a list of time and coordinates
* for other motion events that were compressed before delivering the
* current event
*
* Generated when the pointer moves.
*/
struct _GdkEventMotion
struct _GdkMotionEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
double x;
double y;
@@ -107,15 +131,7 @@ struct _GdkEventMotion
};
/*
* GdkEventButton:
* @type: the type of the event (%GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* GdkButtonEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
@@ -123,16 +139,19 @@ struct _GdkEventMotion
* Normally button 1 is the left mouse button, 2 is the middle button,
* and 3 is the right button. On 2-button mice, the middle button can
* often be simulated by pressing both mouse buttons together.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse.
* @tool: a #GdkDeviceTool
*
* Used for button press and button release events. The
* @type field will be one of %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE,
*/
struct _GdkEventButton
struct _GdkButtonEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
guint button;
double x;
@@ -142,25 +161,16 @@ struct _GdkEventButton
};
/*
* GdkEventTouch:
* @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
* %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
* the mouse
* GdkTouchEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType
* @x: the x coordinate of the pointer relative to the surface
* @y: the y coordinate of the pointer relative to the surface
* @axes: @x, @y translated to the axes of the event's device, or %NULL
* if @device is the mouse
* @sequence: the event sequence that the event belongs to
* @emulating_pointer: whether the event should be used for emulating
* pointer event
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* screen
* @emulated: whether the event is the result of a pointer emulation
*
* Used for touch events.
* @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
@@ -173,22 +183,21 @@ struct _GdkEventButton
* (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
* several active sequences at the same time.
*/
struct _GdkEventTouch
struct _GdkTouchEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
double x;
double y;
double *axes;
GdkEventSequence *sequence;
gboolean touch_emulating;
gboolean pointer_emulated;
};
/*
* GdkEventScroll:
* @type: the type of the event (%GDK_SCROLL).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* GdkScrollEvent:
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @state: (type GdkModifierType): a bit-mask representing the state of
@@ -197,10 +206,11 @@ struct _GdkEventTouch
* @direction: the direction to scroll to (one of %GDK_SCROLL_UP,
* %GDK_SCROLL_DOWN, %GDK_SCROLL_LEFT, %GDK_SCROLL_RIGHT or
* %GDK_SCROLL_SMOOTH).
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* @delta_x: the x coordinate of the scroll delta
* @delta_y: the y coordinate of the scroll delta
* @pointer_emulated: whether the scroll event was the result of
* a pointer emulation
* @tool: a #GdkDeviceTool
*
* Generated from button presses for the buttons 4 to 7. Wheel mice are
* usually configured to generate button press events for buttons 4 and 5
@@ -211,18 +221,30 @@ struct _GdkEventTouch
* these, the scroll deltas can be obtained with
* gdk_event_get_scroll_deltas().
*/
struct _GdkEventScroll
struct _GdkScrollEvent
{
GdkEventAny any;
GdkEvent parent_instance;
double x;
double y;
GdkModifierType state;
GdkScrollDirection direction;
double delta_x;
double delta_y;
gboolean pointer_emulated;
gboolean is_stop;
GdkDeviceTool *tool;
};
/*
* GdkTranslatedKey:
* @keyval: the translated key symbol
* @consumed: the consumed modifiers
* @layout: the keyboard layout
* @level: the layout level
*
* Describes a translated key code.
*/
typedef struct {
guint keyval;
GdkModifierType consumed;
@@ -231,11 +253,7 @@ typedef struct {
} GdkTranslatedKey;
/*
* GdkEventKey:
* @type: the type of the event (%GDK_KEY_PRESS or %GDK_KEY_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* GdkKeyEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
@@ -245,41 +263,40 @@ typedef struct {
*
* Describes a key press or key release event.
*/
struct _GdkEventKey
struct _GdkKeyEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
guint32 keycode;
gboolean key_is_modifier;
GdkTranslatedKey translated[2];
};
/*
* GdkEventCrossing:
* @type: the type of the event (%GDK_ENTER_NOTIFY or %GDK_LEAVE_NOTIFY).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @child_surface: the surface that was entered or left.
* @time: the time of the event in milliseconds.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* GdkCrossingEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @mode: the crossing mode (%GDK_CROSSING_NORMAL, %GDK_CROSSING_GRAB,
* %GDK_CROSSING_UNGRAB, %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB or
* %GDK_CROSSING_STATE_CHANGED). %GDK_CROSSING_GTK_GRAB, %GDK_CROSSING_GTK_UNGRAB,
* and %GDK_CROSSING_STATE_CHANGED were added in 2.14 and are always synthesized,
* never native.
* @x: the x coordinate of the pointer relative to the surface.
* @y: the y coordinate of the pointer relative to the surface.
* @detail: the kind of crossing that happened (%GDK_NOTIFY_INFERIOR,
* %GDK_NOTIFY_ANCESTOR, %GDK_NOTIFY_VIRTUAL, %GDK_NOTIFY_NONLINEAR or
* %GDK_NOTIFY_NONLINEAR_VIRTUAL).
* @focus: %TRUE if @surface is the focus surface or an inferior.
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
* @child_surface: the surface that was entered or left.
*
* Generated when the pointer enters or leaves a surface.
*/
struct _GdkEventCrossing
struct _GdkCrossingEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkModifierType state;
GdkCrossingMode mode;
double x;
@@ -290,10 +307,7 @@ struct _GdkEventCrossing
};
/*
* GdkEventFocus:
* @type: the type of the event (%GDK_FOCUS_CHANGE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* GdkFocusEvent:
* @in: %TRUE if the surface has gained the keyboard focus, %FALSE if
* it has lost the focus.
* @mode: the crossing mode
@@ -301,19 +315,15 @@ struct _GdkEventCrossing
*
* Describes a change of keyboard focus.
*/
struct _GdkEventFocus
struct _GdkFocusEvent
{
GdkEventAny any;
gint16 in;
GdkCrossingMode mode;
GdkNotifyType detail;
GdkEvent parent_instance;
gboolean focus_in;
};
/*
* GdkEventConfigure:
* @type: the type of the event (%GDK_CONFIGURE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* GdkConfigureEvent:
* @x: the new x coordinate of the surface, relative to its parent.
* @y: the new y coordinate of the surface, relative to its parent.
* @width: the new width of the surface.
@@ -321,9 +331,10 @@ struct _GdkEventFocus
*
* Generated when a surface size or position has changed.
*/
struct _GdkEventConfigure
struct _GdkConfigureEvent
{
GdkEventAny any;
GdkEvent parent_instance;
int x;
int y;
int width;
@@ -331,36 +342,23 @@ struct _GdkEventConfigure
};
/*
* GdkEventProximity:
* @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @device: the master device that the event originated from. Use
* gdk_event_get_source_device() to get the slave device.
* GdkProximityEvent:
* @tool: the #GdkDeviceTool associated to the event
*
* Proximity events are generated when using GDKs wrapper for the
* XInput extension. The XInput extension is an add-on for standard X
* that allows you to use nonstandard devices such as graphics tablets.
* A proximity event indicates that the stylus has moved in or out of
* contact with the tablet, or perhaps that the users finger has moved
* in or out of contact with a touch screen.
*
* This event type will be used pretty rarely. It only is important for
* XInput aware programs that are drawing their own cursor.
* A proximity event indicates that a tool of a graphic tablet, or similar
* devices that report proximity, has moved in or out of contact with the
* tablet, or perhaps that the users finger has moved in or out of contact
* with a touch screen.
*/
struct _GdkEventProximity
struct _GdkProximityEvent
{
GdkEventAny any;
GdkEvent parent_instance;
GdkDeviceTool *tool;
};
/*
* GdkEventGrabBroken:
* @type: the type of the event (%GDK_GRAB_BROKEN)
* @surface: the surface which received the event, i.e. the surface
* that previously owned the grab
* @send_event: %TRUE if the event was sent explicitly.
* GdkGrabBrokenEvent:
* @keyboard: %TRUE if a keyboard grab was broken, %FALSE if a pointer
* grab was broken
* @implicit: %TRUE if the broken grab was implicit
@@ -372,67 +370,39 @@ struct _GdkEventProximity
* when the grab surface becomes unviewable (i.e. it or one of its ancestors
* is unmapped), or if the same application grabs the pointer or keyboard
* again. Note that implicit grabs (which are initiated by button presses)
* can also cause #GdkEventGrabBroken events.
* can also cause #GdkGrabBrokenEvent events.
*/
struct _GdkEventGrabBroken {
GdkEventAny any;
struct _GdkGrabBrokenEvent
{
GdkEvent parent_instance;
gboolean keyboard;
gboolean implicit;
GdkSurface *grab_surface;
};
/*
* GdkEventDND:
* @type: the type of the event (%GDK_DRAG_ENTER, %GDK_DRAG_LEAVE,
* %GDK_DRAG_MOTION or %GDK_DROP_START)
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* GdkDNDEvent:
* @drop: the #GdkDrop for the current DND operation.
* @time: the time of the event in milliseconds.
* @x: the X coordinate of the pointer
* @y: the Y coordinate of the pointer
*
* Generated during DND operations.
*/
struct _GdkEventDND {
GdkEventAny any;
struct _GdkDNDEvent
{
GdkEvent parent_instance;
GdkDrop *drop;
double x;
double y;
};
/*
* GdkEventTouchpadSwipe:
* @type: the type of the event (%GDK_TOUCHPAD_SWIPE)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the swipe
* @time: the time of the event in milliseconds
* @x: The X coordinate of the pointer
* @y: The Y coordinate of the pointer
* @dx: Movement delta in the X axis of the swipe focal point
* @dy: Movement delta in the Y axis of the swipe focal point
* GdkTouchpadEvent:
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
*
* Generated during touchpad swipe gestures.
*/
struct _GdkEventTouchpadSwipe {
GdkEventAny any;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
double x;
double y;
double dx;
double dy;
};
/*
* GdkEventTouchpadPinch:
* @type: the type of the event (%GDK_TOUCHPAD_PINCH)
* @surface: the surface which received the event
* @send_event: %TRUE if the event was sent explicitly
* @phase: (type GdkTouchpadGesturePhase): the current phase of the gesture
* @n_fingers: The number of fingers triggering the pinch
* @time: the time of the event in milliseconds
@@ -440,18 +410,17 @@ struct _GdkEventTouchpadSwipe {
* @y: The Y coordinate of the pointer
* @dx: Movement delta in the X axis of the swipe focal point
* @dy: Movement delta in the Y axis of the swipe focal point
* @angle_delta: The angle change in radians, negative angles
* @angle_delta: For pinch events, the angle change in radians, negative angles
* denote counter-clockwise movements
* @scale: The current scale, relative to that at the time of
* @scale: For pinch events, the current scale, relative to that at the time of
* the corresponding %GDK_TOUCHPAD_GESTURE_PHASE_BEGIN event
* @state: (type GdkModifierType): a bit-mask representing the state of
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
* buttons. See #GdkModifierType.
*
* Generated during touchpad swipe gestures.
* Generated during touchpad gestures.
*/
struct _GdkEventTouchpadPinch {
GdkEventAny any;
struct _GdkTouchpadEvent
{
GdkEvent parent_instance;
GdkModifierType state;
gint8 phase;
gint8 n_fingers;
@@ -463,99 +432,20 @@ struct _GdkEventTouchpadPinch {
double scale;
};
/*
* GdkEventPadButton:
* @type: the type of the event (%GDK_PAD_BUTTON_PRESS or %GDK_PAD_BUTTON_RELEASE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group the button belongs to. A %GDK_SOURCE_TABLET_PAD device
* may have one or more groups containing a set of buttons/rings/strips each.
* @button: The pad button that was pressed.
* @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD button presses and releases.
*/
struct _GdkEventPadButton {
GdkEventAny any;
guint group;
guint button;
guint mode;
};
struct _GdkPadEvent
{
GdkEvent parent_instance;
/*
* GdkEventPadAxis:
* @type: the type of the event (%GDK_PAD_RING or %GDK_PAD_STRIP).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group the ring/strip belongs to. A %GDK_SOURCE_TABLET_PAD
* device may have one or more groups containing a set of buttons/rings/strips
* each.
* @index: number of strip/ring that was interacted. This number is 0-indexed.
* @mode: The current mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
* @value: The current value for the given axis.
*
* Generated during %GDK_SOURCE_TABLET_PAD interaction with tactile sensors.
*/
struct _GdkEventPadAxis {
GdkEventAny any;
guint group;
guint index;
guint mode;
guint button;
guint index;
double value;
};
/*
* GdkEventPadGroupMode:
* @type: the type of the event (%GDK_PAD_GROUP_MODE).
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @time: the time of the event in milliseconds.
* @group: the pad group that is switching mode. A %GDK_SOURCE_TABLET_PAD
* device may have one or more groups containing a set of buttons/rings/strips
* each.
* @mode: The new mode of @group. Different groups in a %GDK_SOURCE_TABLET_PAD
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD mode switches in a group.
*/
struct _GdkEventPadGroupMode {
GdkEventAny any;
guint group;
guint mode;
};
void gdk_event_init_types (void);
/*
* GdkEvent:
*
* The GdkEvent struct is private and should only be accessed
* using the accessor functions.
*/
union _GdkEvent
{
GdkEventAny any;
GdkEventMotion motion;
GdkEventButton button;
GdkEventTouch touch;
GdkEventScroll scroll;
GdkEventKey key;
GdkEventCrossing crossing;
GdkEventFocus focus_change;
GdkEventConfigure configure;
GdkEventProximity proximity;
GdkEventDND dnd;
GdkEventGrabBroken grab_broken;
GdkEventTouchpadSwipe touchpad_swipe;
GdkEventTouchpadPinch touchpad_pinch;
GdkEventPadButton pad_button;
GdkEventPadAxis pad_axis;
GdkEventPadGroupMode pad_group_mode;
};
GdkEvent * gdk_event_button_new (GdkEventType type,
GdkEvent * gdk_button_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -567,7 +457,7 @@ GdkEvent * gdk_event_button_new (GdkEventType type,
double y,
double *axes);
GdkEvent * gdk_event_motion_new (GdkSurface *surface,
GdkEvent * gdk_motion_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@@ -577,7 +467,7 @@ GdkEvent * gdk_event_motion_new (GdkSurface *surface,
double y,
double *axes);
GdkEvent * gdk_event_crossing_new (GdkEventType type,
GdkEvent * gdk_crossing_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -588,14 +478,14 @@ GdkEvent * gdk_event_crossing_new (GdkEventType type,
GdkCrossingMode mode,
GdkNotifyType notify);
GdkEvent * gdk_event_proximity_new (GdkEventType type,
GdkEvent * gdk_proximity_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
guint32 time);
GdkEvent * gdk_event_key_new (GdkEventType type,
GdkEvent * gdk_key_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -606,18 +496,18 @@ GdkEvent * gdk_event_key_new (GdkEventType type,
GdkTranslatedKey *translated,
GdkTranslatedKey *no_lock);
GdkEvent * gdk_event_focus_new (GdkSurface *surface,
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in);
GdkEvent * gdk_event_configure_new (GdkSurface *surface,
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
int width,
int height);
GdkEvent * gdk_event_delete_new (GdkSurface *surface);
GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_event_scroll_new (GdkSurface *surface,
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@@ -627,7 +517,7 @@ GdkEvent * gdk_event_scroll_new (GdkSurface *surface,
double delta_y,
gboolean is_stop);
GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface,
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkDeviceTool *tool,
@@ -636,7 +526,7 @@ GdkEvent * gdk_event_discrete_scroll_new (GdkSurface *surface,
GdkScrollDirection direction,
gboolean emulated);
GdkEvent * gdk_event_touch_new (GdkEventType type,
GdkEvent * gdk_touch_event_new (GdkEventType type,
GdkEventSequence *sequence,
GdkSurface *surface,
GdkDevice *device,
@@ -648,7 +538,7 @@ GdkEvent * gdk_event_touch_new (GdkEventType type,
double *axes,
gboolean emulating);
GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface,
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -660,7 +550,7 @@ GdkEvent * gdk_event_touchpad_swipe_new (GdkSurface *surface,
double dx,
double dy);
GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface,
GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -674,7 +564,7 @@ GdkEvent * gdk_event_touchpad_pinch_new (GdkSurface *surface,
double scale,
double angle_delta);
GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -683,7 +573,7 @@ GdkEvent * gdk_event_pad_ring_new (GdkSurface *surface,
guint mode,
double value);
GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
@@ -692,7 +582,7 @@ GdkEvent * gdk_event_pad_strip_new (GdkSurface *surface,
guint mode,
double value);
GdkEvent * gdk_event_pad_button_new (GdkEventType type,
GdkEvent * gdk_pad_event_new_button (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
@@ -701,14 +591,14 @@ GdkEvent * gdk_event_pad_button_new (GdkEventType type,
guint button,
guint mode);
GdkEvent * gdk_event_pad_group_mode_new (GdkSurface *surface,
GdkEvent * gdk_pad_event_new_group_mode (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
guint32 time,
guint group,
guint mode);
GdkEvent * gdk_event_drag_new (GdkEventType type,
GdkEvent * gdk_dnd_event_new (GdkEventType type,
GdkSurface *surface,
GdkDevice *device,
GdkDrop *drop,
@@ -716,12 +606,12 @@ GdkEvent * gdk_event_drag_new (GdkEventType type,
double x,
double y);
GdkEvent * gdk_event_grab_broken_new (GdkSurface *surface,
GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
GdkDevice *device,
GdkDevice *source_device,
GdkSurface *grab_surface,
gboolean implicit);
G_END_DECLS
#endif /* __GDK_EVENTS_PRIVATE_H__ */
+41
View File
@@ -185,6 +185,11 @@ gboolean gdk_surface_handle_event (GdkEvent *event);
GdkSeat * gdk_surface_get_seat_from_event (GdkSurface *surface,
GdkEvent *event);
void gdk_surface_enter_monitor (GdkSurface *surface,
GdkMonitor *monitor);
void gdk_surface_leave_monitor (GdkSurface *surface,
GdkMonitor *monitor);
/*****************************************
* Interfaces provided by windowing code *
*****************************************/
@@ -296,6 +301,42 @@ void gdk_surface_get_geometry (GdkSurface *surface,
GdkGLContext *gdk_surface_get_shared_data_gl_context (GdkSurface *surface);
typedef enum
{
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
GDK_HINT_BASE_SIZE = 1 << 3,
GDK_HINT_ASPECT = 1 << 4,
GDK_HINT_RESIZE_INC = 1 << 5,
GDK_HINT_WIN_GRAVITY = 1 << 6,
GDK_HINT_USER_POS = 1 << 7,
GDK_HINT_USER_SIZE = 1 << 8
} GdkSurfaceHints;
struct _GdkGeometry
{
gint min_width;
gint min_height;
gint max_width;
gint max_height;
gint base_width;
gint base_height;
gint width_inc;
gint height_inc;
gdouble min_aspect;
gdouble max_aspect;
GdkGravity win_gravity;
};
GDK_AVAILABLE_IN_ALL
void gdk_surface_constrain_size (GdkGeometry *geometry,
GdkSurfaceHints flags,
gint width,
gint height,
gint *new_width,
gint *new_height);
/*
* GdkSeatGrabPrepareFunc:
* @seat: the #GdkSeat being grabbed
+82 -67
View File
@@ -76,6 +76,8 @@ enum {
SIZE_CHANGED,
RENDER,
EVENT,
ENTER_MONITOR,
LEAVE_MONITOR,
LAST_SIGNAL
};
@@ -471,6 +473,9 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
* @height: the new height
*
* Emitted when the size of @surface is changed.
*
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*/
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
@@ -525,13 +530,51 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
0,
g_signal_accumulator_true_handled,
NULL,
_gdk_marshal_BOOLEAN__BOXED,
_gdk_marshal_BOOLEAN__POINTER,
G_TYPE_BOOLEAN,
1,
GDK_TYPE_EVENT);
g_signal_set_va_marshaller (signals[EVENT],
G_OBJECT_CLASS_TYPE (object_class),
_gdk_marshal_BOOLEAN__BOXEDv);
_gdk_marshal_BOOLEAN__POINTERv);
/**
* GdkSurface::enter-montor:
* @surface: the #GdkSurface
* @monitor: the monitor
*
* Emitted when @surface starts being present on the monitor.
*/
signals[ENTER_MONITOR] =
g_signal_new (g_intern_static_string ("enter-monitor"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
1,
GDK_TYPE_MONITOR);
/**
* GdkSurface::leave-montor:
* @surface: the #GdkSurface
* @monitor: the monitor
*
* Emitted when @surface stops being present on the monitor.
*/
signals[LEAVE_MONITOR] =
g_signal_new (g_intern_static_string ("leave-monitor"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
1,
GDK_TYPE_MONITOR);
}
static void
@@ -1941,9 +1984,8 @@ gdk_surface_get_geometry (GdkSurface *surface,
*
* Returns the width of the given @surface.
*
* On the X11 platform the returned size is the size reported in the
* most-recently-processed configure event, rather than the current
* size on the X server.
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*
* Returns: The width of @surface
*/
@@ -1961,9 +2003,8 @@ gdk_surface_get_width (GdkSurface *surface)
*
* Returns the height of the given @surface.
*
* On the X11 platform the returned size is the size reported in the
* most-recently-processed configure event, rather than the current
* size on the X server.
* Surface size is reported in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*
* Returns: The height of @surface
*/
@@ -2742,6 +2783,18 @@ gdk_synthesize_surface_state (GdkSurface *surface,
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
}
static void
hide_popup_chain (GdkSurface *surface)
{
GdkSurface *parent;
gdk_surface_hide (surface);
parent = surface->parent;
if (parent->autohide)
hide_popup_chain (parent);
}
static gboolean
check_autohide (GdkEvent *event)
{
@@ -2771,7 +2824,7 @@ check_autohide (GdkEvent *event)
if (grab_surface != gdk_event_get_surface (event) &&
grab_surface->autohide)
{
gdk_surface_hide (grab_surface);
hide_popup_chain (grab_surface);
return TRUE;
}
}
@@ -2782,53 +2835,6 @@ check_autohide (GdkEvent *event)
return FALSE;
}
static gboolean
is_keyboard_event (GdkEvent *event)
{
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
case GDK_FOCUS_CHANGE:
return TRUE;
default:;
}
return FALSE;
}
static GdkEvent *
rewrite_event_for_toplevel (GdkEvent *event)
{
GdkSurface *surface;
surface = gdk_event_get_surface (event);
if (!surface->parent)
return gdk_event_ref (event);
while (surface->parent)
surface = surface->parent;
if (gdk_event_get_event_type (event) == GDK_FOCUS_CHANGE)
return gdk_event_focus_new (surface,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_focus_event_get_in (event));
else
{
return gdk_event_key_new (gdk_event_get_event_type (event),
surface,
gdk_event_get_device (event),
gdk_event_get_source_device (event),
gdk_event_get_time (event),
gdk_key_event_get_keycode (event),
gdk_event_get_modifier_state (event),
gdk_key_event_is_modifier (event),
&event->key.translated[0],
&event->key.translated[1]);
}
}
static void
add_event_mark (GdkEvent *event,
gint64 time,
@@ -2846,7 +2852,7 @@ add_event_mark (GdkEvent *event,
g_type_class_unref (class);
kind = value ? value->value_nick : "event";
switch (event_type)
switch ((int) event_type)
{
case GDK_MOTION_NOTIFY:
{
@@ -2938,21 +2944,16 @@ gdk_surface_handle_event (GdkEvent *event)
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
int width, height;
gdk_configure_event_get_size (event, &width, &height);
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
event->configure.width, event->configure.height);
width, height);
handled = TRUE;
}
else
{
GdkEvent *emitted;
if (is_keyboard_event (event))
emitted = rewrite_event_for_toplevel (event);
else
emitted = gdk_event_ref (event);
g_signal_emit (gdk_event_get_surface (emitted), signals[EVENT], 0, emitted, &handled);
gdk_event_unref (emitted);
g_signal_emit (gdk_event_get_surface (event), signals[EVENT], 0, event, &handled);
}
if (GDK_PROFILER_IS_RUNNING)
@@ -3035,3 +3036,17 @@ gdk_surface_get_seat_from_event (GdkSurface *surface,
}
return gdk_display_get_default_seat (surface->display);
}
void
gdk_surface_enter_monitor (GdkSurface *surface,
GdkMonitor *monitor)
{
g_signal_emit (surface, signals[ENTER_MONITOR], 0, monitor);
}
void
gdk_surface_leave_monitor (GdkSurface *surface,
GdkMonitor *monitor)
{
g_signal_emit (surface, signals[LEAVE_MONITOR], 0, monitor);
}
-137
View File
@@ -38,44 +38,6 @@
G_BEGIN_DECLS
/* Size restriction enumeration.
*/
/**
* GdkSurfaceHints:
* @GDK_HINT_POS: indicates that the program has positioned the surface
* @GDK_HINT_MIN_SIZE: min size fields are set
* @GDK_HINT_MAX_SIZE: max size fields are set
* @GDK_HINT_BASE_SIZE: base size fields are set
* @GDK_HINT_ASPECT: aspect ratio fields are set
* @GDK_HINT_RESIZE_INC: resize increment fields are set
* @GDK_HINT_WIN_GRAVITY: surface gravity field is set
* @GDK_HINT_USER_POS: indicates that the surfaces position was explicitly set
* by the user
* @GDK_HINT_USER_SIZE: indicates that the surfaces size was explicitly set by
* the user
*
* Used to indicate which fields of a #GdkGeometry struct should be paid
* attention to. Also, the presence/absence of @GDK_HINT_POS,
* @GDK_HINT_USER_POS, and @GDK_HINT_USER_SIZE is significant, though they don't
* directly refer to #GdkGeometry fields. @GDK_HINT_USER_POS will be set
* automatically by #GtkWindow if you call gtk_window_move().
* @GDK_HINT_USER_POS and @GDK_HINT_USER_SIZE should be set if the user
* specified a size/position using a --geometry command-line argument;
* gtk_window_parse_geometry() automatically sets these flags.
*/
typedef enum
{
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
GDK_HINT_BASE_SIZE = 1 << 3,
GDK_HINT_ASPECT = 1 << 4,
GDK_HINT_RESIZE_INC = 1 << 5,
GDK_HINT_WIN_GRAVITY = 1 << 6,
GDK_HINT_USER_POS = 1 << 7,
GDK_HINT_USER_SIZE = 1 << 8
} GdkSurfaceHints;
/**
* GdkSurfaceEdge:
* @GDK_SURFACE_EDGE_NORTH_WEST: the top left corner.
@@ -115,97 +77,6 @@ typedef enum
GDK_FULLSCREEN_ON_ALL_MONITORS
} GdkFullscreenMode;
/**
* GdkGeometry:
* @min_width: minimum width of surface (or -1 to use requisition, with
* #GtkWindow only)
* @min_height: minimum height of surface (or -1 to use requisition, with
* #GtkWindow only)
* @max_width: maximum width of surface (or -1 to use requisition, with
* #GtkWindow only)
* @max_height: maximum height of surface (or -1 to use requisition, with
* #GtkWindow only)
* @base_width: allowed surface widths are @base_width + @width_inc * N where N
* is any integer (-1 allowed with #GtkWindow)
* @base_height: allowed surface widths are @base_height + @height_inc * N where
* N is any integer (-1 allowed with #GtkWindow)
* @width_inc: width resize increment
* @height_inc: height resize increment
* @min_aspect: minimum width/height ratio
* @max_aspect: maximum width/height ratio
* @win_gravity: surface gravity, see gtk_window_set_gravity()
*
* The #GdkGeometry struct gives the window manager information about
* a surfaces geometry constraints. Normally you would set these on
* the GTK+ level using gtk_window_set_geometry_hints(). #GtkWindow
* then sets the hints on the #GdkSurface it creates.
*
* gdk_surface_set_geometry_hints() expects the hints to be fully valid already
* and simply passes them to the window manager; in contrast,
* gtk_window_set_geometry_hints() performs some interpretation. For example,
* #GtkWindow will apply the hints to the geometry widget instead of the
* toplevel window, if you set a geometry widget. Also, the
* @min_width/@min_height/@max_width/@max_height fields may be set to -1, and
* #GtkWindow will substitute the size request of the surface or geometry widget.
* If the minimum size hint is not provided, #GtkWindow will use its requisition
* as the minimum size. If the minimum size is provided and a geometry widget is
* set, #GtkWindow will take the minimum size as the minimum size of the
* geometry widget rather than the entire surface. The base size is treated
* similarly.
*
* The canonical use-case for gtk_window_set_geometry_hints() is to get a
* terminal widget to resize properly. Here, the terminal text area should be
* the geometry widget; #GtkWindow will then automatically set the base size to
* the size of other widgets in the terminal window, such as the menubar and
* scrollbar. Then, the @width_inc and @height_inc fields should be set to the
* size of one character in the terminal. Finally, the base size should be set
* to the size of one character. The net effect is that the minimum size of the
* terminal will have a 1x1 character terminal area, and only terminal sizes on
* the character grid will be allowed.
*
* Heres an example of how the terminal example would be implemented, assuming
* a terminal area widget called terminal and a toplevel window toplevel:
*
* |[<!-- language="C" -->
* GdkGeometry hints;
*
* hints.base_width = terminal->char_width;
* hints.base_height = terminal->char_height;
* hints.min_width = terminal->char_width;
* hints.min_height = terminal->char_height;
* hints.width_inc = terminal->char_width;
* hints.height_inc = terminal->char_height;
*
* gtk_window_set_geometry_hints (GTK_WINDOW (toplevel),
* GTK_WIDGET (terminal),
* &hints,
* GDK_HINT_RESIZE_INC |
* GDK_HINT_MIN_SIZE |
* GDK_HINT_BASE_SIZE);
* ]|
*
* The other useful fields are the @min_aspect and @max_aspect fields; these
* contain a width/height ratio as a floating point number. If a geometry widget
* is set, the aspect applies to the geometry widget rather than the entire
* window. The most common use of these hints is probably to set @min_aspect and
* @max_aspect to the same value, thus forcing the window to keep a constant
* aspect ratio.
*/
struct _GdkGeometry
{
gint min_width;
gint min_height;
gint max_width;
gint max_height;
gint base_width;
gint base_height;
gint width_inc;
gint height_inc;
gdouble min_aspect;
gdouble max_aspect;
GdkGravity win_gravity;
};
/**
* GdkSurfaceState:
* @GDK_SURFACE_STATE_WITHDRAWN: the surface is not shown
@@ -362,14 +233,6 @@ void gdk_surface_freeze_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_thaw_updates (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_constrain_size (GdkGeometry *geometry,
GdkSurfaceHints flags,
gint width,
gint height,
gint *new_width,
gint *new_height);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_support_multidevice (GdkSurface *surface,
gboolean support_multidevice);
+3
View File
@@ -61,6 +61,9 @@ G_DEFINE_BOXED_TYPE (GdkToplevelLayout, gdk_toplevel_layout,
* Used together with gdk_toplevel_present() to describe
* how a toplevel surface should be placed and behave on-screen.
*
* The size is in application pixels, not
* device pixels (see gdk_surface_get_scale_factor()).
*
* Returns: (transfer full): newly created instance of #GdkToplevelLayout
*/
GdkToplevelLayout *
+22
View File
@@ -557,4 +557,26 @@ struct _GdkKeymapKey
G_END_DECLS
/*< private >
* GDK_EXTERN_VAR:
*
* A macro to annotate extern variables so that they show up properly in
* Windows DLLs.
*/
#ifndef GDK_EXTERN_VAR
# ifdef G_PLATFORM_WIN32
# ifdef GTK_COMPILATION
# ifdef DLL_EXPORT
# define GDK_EXTERN_VAR __declspec(dllexport)
# else /* !DLL_EXPORT */
# define GDK_EXTERN_VAR extern
# endif /* !DLL_EXPORT */
# else /* !GTK_COMPILATION */
# define GDK_EXTERN_VAR extern __declspec(dllimport)
# endif /* !GTK_COMPILATION */
# else /* !G_PLATFORM_WIN32 */
# define GDK_EXTERN_VAR _GDK_EXTERN
# endif /* !G_PLATFORM_WIN32 */
#endif /* GDK_EXTERN_VAR */
#endif /* __GDK_TYPES_H__ */
+15 -1
View File
@@ -97,7 +97,7 @@ gdk_vulkan_strerror (VkResult result)
{
/* If your compiler brought you here with a warning about missing
* enumeration values, you're running a newer Vulkan version than
* the GTK developers )or you are a GTK developer) and have
* the GTK developers (or you are a GTK developer) and have
* encountered a newly added Vulkan error message.
* You want to add it to this enum now.
*
@@ -208,6 +208,20 @@ gdk_vulkan_strerror (VkResult result)
#if VK_HEADER_VERSION >= 131
case VK_ERROR_UNKNOWN:
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
#endif
#if VK_HEADER_VERSION >= 135
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
return "Acceleration structure serialized with version as the version information is not compatible with device.";
case VK_THREAD_IDLE_KHR:
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
case VK_THREAD_DONE_KHR:
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
case VK_OPERATION_DEFERRED_KHR:
return "A deferred operation was requested and at least some of the work was deferred.";
case VK_OPERATION_NOT_DEFERRED_KHR:
return "A deferred operation was requested and no operations were deferred.";
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
#endif
case VK_RESULT_RANGE_SIZE:
case VK_RESULT_MAX_ENUM:
+1 -1
View File
@@ -25,7 +25,7 @@ srcdir = sys.argv[1]
xml = '''<?xml version='1.0' encoding='UTF-8'?>
<gresources>
<gresource prefix='/org/gtk/libgdk'>
<file alias='cursor/default'>default_cursor.png</file>
'''
def get_files(subdir,extension):
+10 -1
View File
@@ -162,6 +162,8 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
int *height,
int *scale)
{
GdkTexture *texture;
if (gdk_cursor_get_name (cursor))
{
struct wl_cursor *c;
@@ -199,10 +201,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
}
else
{
GdkTexture *texture = gdk_cursor_get_texture (cursor);
cairo_surface_t *surface;
struct wl_buffer *buffer;
texture = gdk_cursor_get_texture (cursor);
from_texture:
surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
if (surface == NULL)
{
@@ -241,6 +245,11 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
hotspot_x, hotspot_y,
width, height,
scale);
else
{
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
goto from_texture;
}
none:
*hotspot_x = 0;
+45 -29
View File
@@ -589,7 +589,7 @@ emulate_crossing (GdkSurface *surface,
double x, y;
gdk_surface_get_device_position (surface, device, &x, &y, &state);
event = gdk_event_crossing_new (type,
event = gdk_crossing_event_new (type,
surface,
device,
device,
@@ -614,7 +614,7 @@ emulate_touch_crossing (GdkSurface *surface,
{
GdkEvent *event;
event = gdk_event_crossing_new (type,
event = gdk_crossing_event_new (type,
surface,
device,
source,
@@ -633,7 +633,7 @@ emulate_focus (GdkSurface *surface,
gboolean focus_in,
guint32 time_)
{
GdkEvent *event = gdk_event_focus_new (surface, device, device, focus_in);
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
}
@@ -1360,7 +1360,7 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source;
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_event_discrete_scroll_new (seat->pointer_info.focus,
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
seat->master_pointer,
source,
NULL,
@@ -1382,7 +1382,7 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
GdkDevice *source;
source = get_scroll_device (seat, seat->pointer_info.frame.source);
event = gdk_event_scroll_new (seat->pointer_info.focus,
event = gdk_scroll_event_new (seat->pointer_info.focus,
seat->master_pointer,
source,
NULL,
@@ -1498,7 +1498,7 @@ pointer_handle_enter (void *data,
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
seat->pointer_info.enter_serial = serial;
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY,
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
@@ -1541,7 +1541,7 @@ pointer_handle_leave (void *data,
_gdk_wayland_display_update_serial (display_wayland, serial);
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY,
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
@@ -1586,7 +1586,7 @@ pointer_handle_motion (void *data,
seat->pointer_info.surface_x = wl_fixed_to_double (sx);
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
event = gdk_event_motion_new (seat->pointer_info.focus,
event = gdk_motion_event_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
NULL,
@@ -1649,7 +1649,7 @@ pointer_handle_button (void *data,
if (state)
seat->pointer_info.press_serial = serial;
event = gdk_event_button_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
event = gdk_button_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
@@ -1914,7 +1914,7 @@ keyboard_handle_enter (void *data,
g_object_ref (seat->keyboard_focus);
seat->repeat_key = 0;
event = gdk_event_focus_new (seat->keyboard_focus,
event = gdk_focus_event_new (seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
TRUE);
@@ -1949,7 +1949,7 @@ keyboard_handle_leave (void *data,
_gdk_wayland_display_update_serial (display, serial);
event = gdk_event_focus_new (seat->keyboard_focus,
event = gdk_focus_event_new (seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
FALSE);
@@ -2075,7 +2075,7 @@ deliver_key_event (GdkWaylandSeat *seat,
no_lock = translated;
}
event = gdk_event_key_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
event = gdk_key_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
seat->keyboard_focus,
seat->master_keyboard,
seat->keyboard,
@@ -2313,6 +2313,22 @@ gdk_wayland_seat_remove_touch (GdkWaylandSeat *seat,
g_hash_table_remove (seat->touches, GUINT_TO_POINTER (id));
}
void
gdk_wayland_seat_clear_touchpoints (GdkWaylandSeat *seat,
GdkSurface *surface)
{
GHashTableIter iter;
GdkWaylandTouchData *touch;
g_hash_table_iter_init (&iter, seat->touches);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
{
if (touch->surface == surface)
g_hash_table_iter_remove (&iter);
}
}
static void
mimic_pointer_emulating_touch_info (GdkDevice *device,
GdkWaylandTouchData *touch)
@@ -2375,7 +2391,7 @@ touch_handle_down (void *data,
touch->y = wl_fixed_to_double (y);
touch->touch_down_serial = serial;
event = gdk_event_touch_new (GDK_TOUCH_BEGIN,
event = gdk_touch_event_new (GDK_TOUCH_BEGIN,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2418,7 +2434,7 @@ touch_handle_up (void *data,
_gdk_wayland_display_update_serial (display, serial);
touch = gdk_wayland_seat_get_touch (seat, id);
event = gdk_event_touch_new (GDK_TOUCH_END,
event = gdk_touch_event_new (GDK_TOUCH_END,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2463,7 +2479,7 @@ touch_handle_motion (void *data,
if (touch->initial_touch)
mimic_pointer_emulating_touch_info (seat->touch_master, touch);
event = gdk_event_touch_new (GDK_TOUCH_UPDATE,
event = gdk_touch_event_new (GDK_TOUCH_UPDATE,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2509,7 +2525,7 @@ touch_handle_cancel (void *data,
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &touch))
{
event = gdk_event_touch_new (GDK_TOUCH_CANCEL,
event = gdk_touch_event_new (GDK_TOUCH_CANCEL,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
@@ -2541,7 +2557,7 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
event = gdk_event_touchpad_swipe_new (seat->pointer_info.focus,
event = gdk_touchpad_event_new_swipe (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
_time,
@@ -2638,7 +2654,7 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
seat->pointer_info.time = _time;
event = gdk_event_touchpad_pinch_new (seat->pointer_info.focus,
event = gdk_touchpad_event_new_pinch (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
_time,
@@ -3469,7 +3485,7 @@ tablet_tool_handle_proximity_in (void *data,
gdk_wayland_device_tablet_clone_tool_axes (tablet, tool->tool);
gdk_wayland_mimic_device_axes (tablet->master, tablet->current_device);
event = gdk_event_proximity_new (GDK_PROXIMITY_IN,
event = gdk_proximity_event_new (GDK_PROXIMITY_IN,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@@ -3500,7 +3516,7 @@ tablet_tool_handle_proximity_out (void *data,
g_message ("proximity out, seat %p, tool %d", tool->seat,
gdk_device_tool_get_tool_type (tool->tool)));
event = gdk_event_proximity_new (GDK_PROXIMITY_OUT,
event = gdk_proximity_event_new (GDK_PROXIMITY_OUT,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@@ -3537,7 +3553,7 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkEvent *event;
event = gdk_event_button_new (evtype,
event = gdk_button_event_new (evtype,
tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
@@ -3603,7 +3619,7 @@ tablet_tool_handle_motion (void *data,
tablet->pointer_info.surface_x,
tablet->pointer_info.surface_y));
event = gdk_event_motion_new (tablet->pointer_info.focus,
event = gdk_motion_event_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tool->tool,
@@ -3765,7 +3781,7 @@ tablet_tool_handle_wheel (void *data,
return;
/* Send smooth event */
event = gdk_event_scroll_new (tablet->pointer_info.focus,
event = gdk_scroll_event_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tablet->current_tool->tool,
@@ -3777,7 +3793,7 @@ tablet_tool_handle_wheel (void *data,
_gdk_wayland_display_deliver_event (seat->display, event);
/* Send discrete event */
event = gdk_event_discrete_scroll_new (tablet->pointer_info.focus,
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tablet->current_tool->tool,
@@ -3888,7 +3904,7 @@ tablet_pad_ring_handle_frame (void *data,
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
event = gdk_event_pad_ring_new (seat->keyboard_focus,
event = gdk_pad_event_new_ring (seat->keyboard_focus,
pad->device,
pad->device,
time,
@@ -3963,7 +3979,7 @@ tablet_pad_strip_handle_frame (void *data,
g_message ("tablet pad strip handle frame, strip = %p",
wp_tablet_pad_strip));
event = gdk_event_pad_strip_new (seat->keyboard_focus,
event = gdk_pad_event_new_strip (seat->keyboard_focus,
pad->device,
pad->device,
time,
@@ -4089,7 +4105,7 @@ tablet_pad_group_handle_mode (void *data,
group->current_mode = mode;
n_group = g_list_index (pad->mode_groups, group);
event = gdk_event_pad_group_mode_new (seat->keyboard_focus,
event = gdk_pad_event_new_group_mode (seat->keyboard_focus,
pad->device,
pad->device,
time,
@@ -4201,7 +4217,7 @@ tablet_pad_handle_button (void *data,
g_assert (group != NULL);
n_group = g_list_index (pad->mode_groups, group);
event = gdk_event_pad_button_new (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
event = gdk_pad_event_new_button (state == ZWP_TABLET_PAD_V2_BUTTON_STATE_PRESSED
? GDK_PAD_BUTTON_PRESS
: GDK_PAD_BUTTON_RELEASE,
GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus,
@@ -5031,7 +5047,7 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
GDK_CURRENT_TIME);
}
event = gdk_event_touch_new (GDK_TOUCH_CANCEL,
event = gdk_touch_event_new (GDK_TOUCH_CANCEL,
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
touch->surface,
seat->touch_master,
+10 -1
View File
@@ -431,6 +431,7 @@ gdk_registry_handle_global (void *data,
else if (strcmp (interface, "xdg_wm_base") == 0)
{
display_wayland->xdg_wm_base_id = id;
display_wayland->xdg_wm_base_version = version;
}
else if (strcmp (interface, "zxdg_shell_v6") == 0)
{
@@ -659,7 +660,8 @@ _gdk_wayland_display_open (const gchar *display_name)
display_wayland->xdg_wm_base =
wl_registry_bind (display_wayland->wl_registry,
display_wayland->xdg_wm_base_id,
&xdg_wm_base_interface, 1);
&xdg_wm_base_interface,
MIN (display_wayland->xdg_wm_base_version, 3));
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
&xdg_wm_base_listener,
display_wayland);
@@ -2537,6 +2539,13 @@ get_monitor_for_output (GdkWaylandDisplay *display_wayland,
return NULL;
}
GdkMonitor *
gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output)
{
return (GdkMonitor *)get_monitor_for_output (GDK_WAYLAND_DISPLAY (display), output);
}
static void
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
guint32 id)
+1
View File
@@ -86,6 +86,7 @@ struct _GdkWaylandDisplay
guint32 serial;
uint32_t xdg_wm_base_id;
int xdg_wm_base_version;
uint32_t zxdg_shell_v6_id;
GdkWaylandShellVariant shell_variant;
+2
View File
@@ -163,6 +163,8 @@ guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland
struct wl_output *output);
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
int monitor_num);
GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output);
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
GdkSeat *seat);
+3
View File
@@ -43,4 +43,7 @@ GType gdk_wayland_seat_get_type (void) G_GNUC_CONST;
void gdk_wayland_seat_update_cursor_scale (GdkWaylandSeat *seat);
void gdk_wayland_seat_clear_touchpoints (GdkWaylandSeat *seat,
GdkSurface *surface);
#endif /* __GDK_WAYLAND_SEAT_H__ */
+263 -113
View File
@@ -59,6 +59,7 @@ static guint signals[LAST_SIGNAL];
typedef enum _PopupState
{
POPUP_STATE_IDLE,
POPUP_STATE_WAITING_FOR_REPOSITIONED,
POPUP_STATE_WAITING_FOR_CONFIGURE,
POPUP_STATE_WAITING_FOR_FRAME,
} PopupState;
@@ -94,6 +95,9 @@ struct _GdkWaylandSurface
EGLSurface egl_surface;
EGLSurface dummy_egl_surface;
uint32_t reposition_token;
uint32_t received_reposition_token;
PopupState popup_state;
unsigned int initial_configure_received : 1;
@@ -103,8 +107,6 @@ struct _GdkWaylandSurface
unsigned int awaiting_frame_frozen : 1;
unsigned int is_drag_surface : 1;
GdkSurfaceTypeHint hint;
GdkSurface *transient_for;
GdkSurface *popup_parent;
int pending_buffer_offset_x;
int pending_buffer_offset_y;
@@ -167,12 +169,18 @@ struct _GdkWaylandSurface
int y;
int width;
int height;
uint32_t repositioned_token;
gboolean has_repositioned_token;
} popup;
gboolean is_initial_configure;
uint32_t serial;
gboolean is_dirty;
} pending;
uint32_t last_configure_serial;
int state_freeze_count;
struct {
@@ -190,6 +198,76 @@ struct _GdkWaylandSurfaceClass
GdkSurfaceClass parent_class;
};
G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE)
typedef struct _GdkWaylandToplevel GdkWaylandToplevel;
struct _GdkWaylandToplevel
{
GdkWaylandSurface parent_instance;
GdkWaylandToplevel *transient_for;
};
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandToplevelClass;
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
GType gdk_wayland_toplevel_get_type (void) G_GNUC_CONST;
#define GDK_IS_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_TOPLEVEL))
#define GDK_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_TOPLEVEL, GdkWaylandToplevel))
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type ())
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
gdk_wayland_toplevel_iface_init))
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandPopup;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandPopupClass;
static void gdk_wayland_popup_iface_init (GdkPopupInterface *iface);
GType gdk_wayland_popup_get_type (void) G_GNUC_CONST;
#define GDK_IS_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_POPUP))
#define GDK_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_POPUP, GdkWaylandPopup))
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type ())
G_DEFINE_TYPE_WITH_CODE (GdkWaylandPopup, gdk_wayland_popup, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
gdk_wayland_popup_iface_init))
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandDragSurface;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandDragSurfaceClass;
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
#define GDK_IS_WAYLAND_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_SURFACE))
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
gdk_wayland_drag_surface_iface_init))
static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
int width,
int height,
@@ -221,16 +299,6 @@ static void update_popup_layout_state (GdkSurface *surface,
static gboolean gdk_wayland_surface_is_exported (GdkSurface *surface);
G_DEFINE_TYPE (GdkWaylandSurface, gdk_wayland_surface, GDK_TYPE_SURFACE)
GType gdk_wayland_toplevel_get_type (void) G_GNUC_CONST;
GType gdk_wayland_popup_get_type (void) G_GNUC_CONST;
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type ())
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type ())
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
static void
gdk_wayland_surface_init (GdkWaylandSurface *impl)
{
@@ -438,6 +506,7 @@ frame_callback (void *data,
switch (impl->popup_state)
{
case POPUP_STATE_IDLE:
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
case POPUP_STATE_WAITING_FOR_CONFIGURE:
break;
case POPUP_STATE_WAITING_FOR_FRAME:
@@ -632,6 +701,9 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
"display", display,
"frame-clock", frame_clock,
NULL);
display_wayland->toplevels = g_list_prepend (display_wayland->toplevels,
surface);
g_warn_if_fail (!parent);
break;
case GDK_SURFACE_POPUP:
surface = g_object_new (GDK_TYPE_WAYLAND_POPUP,
@@ -678,10 +750,6 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
gdk_wayland_surface_set_title (surface, get_default_title ());
if (parent == NULL)
display_wayland->toplevels = g_list_prepend (display_wayland->toplevels, surface);
impl->transient_for = parent;
gdk_wayland_surface_create_surface (surface);
@@ -772,8 +840,6 @@ gdk_wayland_surface_dispose (GObject *object)
impl = GDK_WAYLAND_SURFACE (surface);
g_clear_object (&impl->popup_parent);
if (impl->event_queue)
{
GdkWaylandDisplay *display_wayland =
@@ -825,7 +891,7 @@ gdk_wayland_surface_resize (GdkSurface *surface,
GdkDisplay *display;
GdkEvent *event;
event = gdk_event_configure_new (surface, width, height);
event = gdk_configure_event_new (surface, width, height);
gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface);
@@ -903,6 +969,7 @@ gdk_wayland_surface_sync_parent (GdkSurface *surface,
GdkSurface *parent)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (impl);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkWaylandSurface *impl_parent = NULL;
@@ -913,8 +980,8 @@ gdk_wayland_surface_sync_parent (GdkSurface *surface,
if (!is_realized_toplevel (surface))
return;
if (impl->transient_for)
impl_parent = GDK_WAYLAND_SURFACE (impl->transient_for);
if (toplevel->transient_for)
impl_parent = GDK_WAYLAND_SURFACE (toplevel->transient_for);
else if (parent)
impl_parent = GDK_WAYLAND_SURFACE (parent);
@@ -1134,6 +1201,8 @@ surface_enter (void *data,
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("surface enter, surface %p output %p", surface, output));
@@ -1141,6 +1210,9 @@ surface_enter (void *data,
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
gdk_wayland_surface_update_scale (surface);
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
gdk_surface_enter_monitor (surface, monitor);
}
static void
@@ -1150,6 +1222,8 @@ surface_leave (void *data,
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("surface leave, surface %p output %p", surface, output));
@@ -1158,6 +1232,9 @@ surface_leave (void *data,
if (impl->display_server.outputs)
gdk_wayland_surface_update_scale (surface);
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
gdk_surface_leave_monitor (surface, monitor);
}
static const struct wl_surface_listener surface_listener = {
@@ -1282,8 +1359,17 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
impl->pending.serial);
}
if (impl->pending.popup.has_repositioned_token)
impl->received_reposition_token = impl->pending.popup.repositioned_token;
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
if (impl->received_reposition_token != impl->reposition_token)
return;
else
gdk_surface_thaw_updates (surface);
G_GNUC_FALLTHROUGH;
case POPUP_STATE_WAITING_FOR_CONFIGURE:
impl->popup_state = POPUP_STATE_WAITING_FOR_FRAME;
break;
@@ -1306,6 +1392,10 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
width, height,
impl->popup.layout);
if (!impl->pending.popup.has_repositioned_token &&
!impl->pending.is_initial_configure)
g_signal_emit_by_name (surface, "popup-layout-changed");
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -1318,6 +1408,7 @@ gdk_wayland_surface_configure (GdkSurface *surface)
{
gdk_surface_thaw_updates (surface);
impl->initial_configure_received = TRUE;
impl->pending.is_initial_configure = TRUE;
}
if (is_realized_popup (surface))
@@ -1327,6 +1418,8 @@ gdk_wayland_surface_configure (GdkSurface *surface)
else
g_warn_if_reached ();
impl->last_configure_serial = impl->pending.serial;
memset (&impl->pending, 0, sizeof (impl->pending));
}
@@ -1368,7 +1461,7 @@ gdk_wayland_surface_handle_close (GdkSurface *surface)
GDK_DISPLAY_NOTE (display, EVENTS, g_message ("close %p", surface));
event = gdk_event_delete_new (surface);
event = gdk_delete_event_new (surface);
_gdk_wayland_display_deliver_event (display, event);
}
@@ -1663,9 +1756,31 @@ xdg_popup_done (void *data,
gdk_surface_hide (surface);
}
static void
xdg_popup_repositioned (void *data,
struct xdg_popup *xdg_popup,
uint32_t token)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("repositioned %p", surface));
if (impl->popup_state != POPUP_STATE_WAITING_FOR_REPOSITIONED)
{
g_warning ("Unexpected xdg_popup.repositioned event, probably buggy compositor");
return;
}
impl->pending.popup.repositioned_token = token;
impl->pending.popup.has_repositioned_token = TRUE;
}
static const struct xdg_popup_listener xdg_popup_listener = {
xdg_popup_configure,
xdg_popup_done,
xdg_popup_repositioned,
};
static void
@@ -2052,7 +2167,8 @@ static gpointer
create_dynamic_positioner (GdkSurface *surface,
int width,
int height,
GdkPopupLayout *layout)
GdkPopupLayout *layout,
gboolean ack_parent_configure)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkSurface *parent = surface->parent;
@@ -2129,6 +2245,30 @@ create_dynamic_positioner (GdkSurface *surface,
xdg_positioner_set_constraint_adjustment (positioner,
constraint_adjustment);
if (xdg_positioner_get_version (positioner) >=
XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION)
xdg_positioner_set_reactive (positioner);
if (ack_parent_configure &&
xdg_positioner_get_version (positioner) >=
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
{
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (parent);
int parent_width;
int parent_height;
parent_width = parent->width - (parent_impl->margin_left +
parent_impl->margin_right);
parent_height = parent->height - (parent_impl->margin_top +
parent_impl->margin_bottom);
xdg_positioner_set_parent_size (positioner,
parent_width,
parent_height);
xdg_positioner_set_parent_configure (positioner,
parent_impl->last_configure_serial);
}
return positioner;
}
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
@@ -2194,7 +2334,7 @@ can_map_grabbing_popup (GdkSurface *surface,
return top_most_popup == parent;
}
static void
static gboolean
gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
GdkSurface *parent,
GdkWaylandSeat *grab_input_seat,
@@ -2208,32 +2348,32 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
gpointer positioner;
if (!impl->display_server.wl_surface)
return;
return FALSE;
if (!is_realized_shell_surface (parent))
return;
return FALSE;
if (is_realized_toplevel (surface))
{
g_warning ("Can't map popup, already mapped as toplevel");
return;
return FALSE;
}
if (is_realized_popup (surface))
{
g_warning ("Can't map popup, already mapped");
return;
return FALSE;
}
if (grab_input_seat &&
!can_map_grabbing_popup (surface, parent))
{
g_warning ("Tried to map a grabbing popup with a non-top most parent");
return;
return FALSE;
}
gdk_surface_freeze_updates (surface);
positioner = create_dynamic_positioner (surface, width, height, layout);
positioner = create_dynamic_positioner (surface, width, height, layout, FALSE);
switch (display->shell_variant)
{
@@ -2307,13 +2447,14 @@ gdk_wayland_surface_create_xdg_popup (GdkSurface *surface,
freeze_popup_toplevel_state (surface);
}
g_set_object (&impl->popup_parent, parent);
display->current_popups = g_list_append (display->current_popups, surface);
if (grab_input_seat)
{
display->current_grabbing_popups =
g_list_prepend (display->current_grabbing_popups, surface);
}
return TRUE;
}
static GdkWaylandSeat *
@@ -2396,9 +2537,8 @@ unmap_popups_for_surface (GdkSurface *surface)
for (l = display_wayland->current_popups; l; l = l->next)
{
GdkSurface *popup = l->data;
GdkWaylandSurface *popup_impl = GDK_WAYLAND_SURFACE (popup);
if (popup_impl->popup_parent == surface)
if (popup->parent == surface)
{
g_warning ("Tried to unmap the parent of a popup");
gdk_surface_hide (popup);
@@ -2501,6 +2641,9 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
{
switch (impl->popup_state)
{
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
gdk_surface_thaw_updates (surface);
G_GNUC_FALLTHROUGH;
case POPUP_STATE_WAITING_FOR_CONFIGURE:
case POPUP_STATE_WAITING_FOR_FRAME:
thaw_popup_toplevel_state (surface);
@@ -2540,6 +2683,14 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
static void
gdk_wayland_surface_hide (GdkSurface *surface)
{
GdkSeat *seat;
seat = gdk_display_get_default_seat (surface->display);
if (surface->autohide)
gdk_seat_ungrab (seat);
gdk_wayland_seat_clear_touchpoints (GDK_WAYLAND_SEAT (seat), surface);
gdk_wayland_surface_hide_surface (surface);
_gdk_surface_clear_update_area (surface);
}
@@ -2602,6 +2753,7 @@ do_queue_relayout (GdkSurface *surface,
GdkPopupLayout *layout)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
struct xdg_positioner *positioner;
g_assert (is_realized_popup (surface));
g_assert (impl->popup_state == POPUP_STATE_IDLE ||
@@ -2612,7 +2764,41 @@ do_queue_relayout (GdkSurface *surface,
impl->popup.unconstrained_width = width;
impl->popup.unconstrained_height = height;
queue_relayout_fallback (surface, layout);
if (!impl->display_server.xdg_popup ||
xdg_popup_get_version (impl->display_server.xdg_popup) <
XDG_POPUP_REPOSITION_SINCE_VERSION)
{
g_warning_once ("Compositor doesn't support moving popups, "
"relying on remapping");
queue_relayout_fallback (surface, layout);
return;
}
positioner = create_dynamic_positioner (surface,
width, height, layout,
TRUE);
xdg_popup_reposition (impl->display_server.xdg_popup,
positioner,
++impl->reposition_token);
xdg_positioner_destroy (positioner);
gdk_surface_freeze_updates (surface);
switch (impl->popup_state)
{
case POPUP_STATE_IDLE:
freeze_popup_toplevel_state (surface);
break;
case POPUP_STATE_WAITING_FOR_FRAME:
break;
case POPUP_STATE_WAITING_FOR_CONFIGURE:
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
default:
g_assert_not_reached ();
}
impl->popup_state = POPUP_STATE_WAITING_FOR_REPOSITIONED;
}
static gboolean
@@ -2623,6 +2809,9 @@ is_relayout_finished (GdkSurface *surface)
if (!impl->initial_configure_received)
return FALSE;
if (impl->reposition_token != impl->received_reposition_token)
return FALSE;
return TRUE;
}
@@ -2648,11 +2837,13 @@ gdk_wayland_surface_map_popup (GdkSurface *surface,
grab_input_seat = find_grab_input_seat (surface, parent);
else
grab_input_seat = NULL;
gdk_wayland_surface_create_xdg_popup (surface,
parent,
grab_input_seat,
width, height,
layout);
if (!gdk_wayland_surface_create_xdg_popup (surface,
parent,
grab_input_seat,
width, height,
layout))
return;
impl->popup.layout = gdk_popup_layout_copy (layout);
impl->popup.unconstrained_width = width;
@@ -2707,6 +2898,7 @@ reposition_popup (GdkSurface *surface,
case POPUP_STATE_WAITING_FOR_FRAME:
do_queue_relayout (surface, width, height, layout);
break;
case POPUP_STATE_WAITING_FOR_REPOSITIONED:
case POPUP_STATE_WAITING_FOR_CONFIGURE:
g_warn_if_reached ();
break;
@@ -3172,44 +3364,46 @@ gdk_wayland_surface_set_startup_id (GdkSurface *surface,
}
static gboolean
check_transient_for_loop (GdkSurface *surface,
GdkSurface *parent)
check_transient_for_loop (GdkWaylandToplevel *toplevel,
GdkWaylandToplevel *parent)
{
while (parent)
{
GdkWaylandSurface *impl;
if (!GDK_IS_WAYLAND_SURFACE (parent))
return FALSE;
impl = GDK_WAYLAND_SURFACE (parent);
if (impl->transient_for == surface)
if (parent->transient_for == toplevel)
return TRUE;
parent = impl->transient_for;
parent = parent->transient_for;
}
return FALSE;
}
static void
gdk_wayland_surface_set_transient_for (GdkSurface *surface,
GdkSurface *parent)
gdk_wayland_toplevel_set_transient_for (GdkWaylandToplevel *toplevel,
GdkSurface *parent)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
g_return_if_fail (!parent || GDK_IS_WAYLAND_TOPLEVEL (parent));
g_return_if_fail (!parent ||
gdk_surface_get_display (GDK_SURFACE (toplevel)) == gdk_surface_get_display (parent));
g_assert (parent == NULL ||
gdk_surface_get_display (surface) == gdk_surface_get_display (parent));
if (check_transient_for_loop (surface, parent))
if (parent)
{
g_warning ("Setting %p transient for %p would create a loop", surface, parent);
return;
GdkWaylandToplevel *parent_toplevel = GDK_WAYLAND_TOPLEVEL (parent);
if (check_transient_for_loop (toplevel, parent_toplevel))
{
g_warning ("Setting %p transient for %p would create a loop",
toplevel, parent);
return;
}
}
unset_transient_for_exported (surface);
unset_transient_for_exported (GDK_SURFACE (toplevel));
impl->transient_for = parent;
if (parent)
toplevel->transient_for = GDK_WAYLAND_TOPLEVEL (parent);
else
toplevel->transient_for = NULL;
gdk_wayland_surface_sync_parent (surface, NULL);
gdk_wayland_surface_sync_parent (GDK_SURFACE (toplevel), NULL);
}
static void
@@ -3635,7 +3829,8 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
double x, y;
uint32_t serial;
switch ((guint) event->any.type)
GdkEventType event_type = gdk_event_get_event_type (event);
switch ((guint) event_type)
{
case GDK_BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
@@ -4097,7 +4292,7 @@ gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface,
return FALSE;
}
gdk_wayland_surface_set_transient_for (surface, NULL);
gdk_wayland_toplevel_set_transient_for (GDK_WAYLAND_TOPLEVEL (impl), NULL);
impl->imported_transient_for =
zxdg_importer_v1_import (display_wayland->xdg_importer, parent_handle_str);
@@ -4169,22 +4364,6 @@ create_dnd_surface (GdkDisplay *display)
#define LAST_PROP 1
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandPopup;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandPopupClass;
static void gdk_wayland_popup_iface_init (GdkPopupInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandPopup, gdk_wayland_popup, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
gdk_wayland_popup_iface_init))
static void
gdk_wayland_popup_init (GdkWaylandPopup *popup)
{
@@ -4294,22 +4473,6 @@ gdk_wayland_popup_iface_init (GdkPopupInterface *iface)
iface->get_position_y = gdk_wayland_popup_get_position_y;
}
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandToplevel;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandToplevelClass;
static void gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandToplevel, gdk_wayland_toplevel, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
gdk_wayland_toplevel_iface_init))
static void
gdk_wayland_toplevel_init (GdkWaylandToplevel *toplevel)
{
@@ -4322,6 +4485,7 @@ gdk_wayland_toplevel_set_property (GObject *object,
GParamSpec *pspec)
{
GdkSurface *surface = GDK_SURFACE (object);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
switch (prop_id)
{
@@ -4336,7 +4500,8 @@ gdk_wayland_toplevel_set_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
gdk_wayland_surface_set_transient_for (surface, g_value_get_object (value));
gdk_wayland_toplevel_set_transient_for (toplevel,
g_value_get_object (value));
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
@@ -4376,6 +4541,7 @@ gdk_wayland_toplevel_get_property (GObject *object,
{
GdkSurface *surface = GDK_SURFACE (object);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
switch (prop_id)
{
@@ -4392,7 +4558,7 @@ gdk_wayland_toplevel_get_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
g_value_set_object (value, impl->transient_for);
g_value_set_object (value, toplevel->transient_for);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_MODAL:
@@ -4617,22 +4783,6 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
}
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandDragSurface;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandDragSurfaceClass;
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
gdk_wayland_drag_surface_iface_init))
static void
gdk_wayland_drag_surface_init (GdkWaylandDragSurface *surface)
{
+3 -7
View File
@@ -37,10 +37,6 @@ gdk_wayland_deps = [
wlegldep,
]
# wayland protocols
proto_dir = dependency('wayland-protocols').get_pkgconfig_variable('pkgdatadir')
assert(proto_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc')
wayland_scanner = find_program('wayland-scanner')
# Format:
@@ -68,14 +64,14 @@ foreach p: proto_sources
if proto_stability == 'stable'
output_base = proto_name
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
elif proto_stability == 'private'
output_base = proto_name
input = 'protocol/@0@.xml'.format(proto_name)
input = files('protocol/@0@.xml'.format(proto_name))
else
proto_version = p.get(2)
output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version)
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
endif
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
+8 -6
View File
@@ -1063,7 +1063,7 @@ gdk_input_other_event (GdkDisplay *display,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
event = gdk_event_button_new (event_type,
event = gdk_button_event_new (event_type,
window,
device_manager->core_pointer,
GDK_DEVICE (source_device),
@@ -1077,10 +1077,11 @@ gdk_input_other_event (GdkDisplay *display,
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB button %s:%d %g,%g\n",
(event->any.type == GDK_BUTTON_PRESS ?
(event->event_type == GDK_BUTTON_PRESS ?
"press" : "release"),
event->button.button,
event->button.x, event->button.y));
((GdkButtonEvent *) event)->button,
((GdkButtonEvent *) event)->x,
((GdkButtonEvent *) event)->y));
}
else
{
@@ -1097,7 +1098,7 @@ gdk_input_other_event (GdkDisplay *display,
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
| GDK_BUTTON5_MASK));
event = gdk_event_motion_new (window,
event = gdk_motion_event_new (window,
device_manager->core_pointer,
GDK_DEVICE (source_device),
NULL,
@@ -1108,7 +1109,8 @@ gdk_input_other_event (GdkDisplay *display,
axes);
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("WINTAB motion: %g,%g\n",
event->motion.x, event->motion.y));
((GdkMotionEvent *) event)->x,
((GdkMotionEvent *) event)->y));
}
return event;
+2 -1
View File
@@ -2515,7 +2515,8 @@ gdk_win32_drag_handle_event (GdkDrag *drag,
if (!drag_win32->handle_events)
{
/* FIXME: remove this functionality once gtk no longer calls DnD after drag_done() */
g_warning ("Got an event %d for drag context %p, even though it's done!", event->any.type, drag);
g_warning ("Got an event %d for drag context %p, even though it's done!",
event->event_type, drag);
return FALSE;
}
+15 -19
View File
@@ -207,7 +207,7 @@ generate_focus_event (GdkDeviceManagerWin32 *device_manager,
device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->core_keyboard;
source_device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->system_keyboard;
event = gdk_event_focus_new (window, device, source_device, in);
event = gdk_focus_event_new (window, device, source_device, in);
_gdk_win32_append_event (event);
}
@@ -233,7 +233,7 @@ generate_grab_broken_event (GdkDeviceManagerWin32 *device_manager,
source_device = device_manager->system_pointer;
}
event = gdk_event_grab_broken_new (window,
event = gdk_grab_broken_event_new (window,
device,
source_device,
grab_window,
@@ -885,12 +885,8 @@ decode_key_lparam (LPARAM lParam)
static void
fixup_event (GdkEvent *event)
{
if (event->any.surface)
g_object_ref (event->any.surface);
if (((event->any.type == GDK_ENTER_NOTIFY) ||
(event->any.type == GDK_LEAVE_NOTIFY)) &&
(event->crossing.child_surface != NULL))
g_object_ref (event->crossing.child_surface);
if (event->surface)
g_object_ref (event->surface);
}
void
@@ -1080,7 +1076,7 @@ send_crossing_event (GdkDisplay *display,
pt = *screen_pt;
ScreenToClient (GDK_SURFACE_HWND (window), &pt);
event = gdk_event_crossing_new (type,
event = gdk_crossing_event_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
@@ -1589,7 +1585,7 @@ generate_button_event (GdkEventType type,
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_event_button_new (type,
event = gdk_button_event_new (type,
window,
device_manager->core_pointer,
device_manager->system_pointer,
@@ -2133,7 +2129,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0;
translated.layout = 0;
translated.level = 0;
event = gdk_event_key_new (GDK_KEY_PRESS,
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
@@ -2336,7 +2332,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0;
translated.layout = group;
translated.level = 0;
event = gdk_event_key_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
event = gdk_key_event_new ((msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)
? GDK_KEY_PRESS
: GDK_KEY_RELEASE,
window,
@@ -2413,7 +2409,7 @@ gdk_event_translate (MSG *msg,
translated.consumed = 0;
translated.layout = get_active_group ();
translated.level = 0;
event = gdk_event_key_new (GDK_KEY_PRESS,
event = gdk_key_event_new (GDK_KEY_PRESS,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
@@ -2427,7 +2423,7 @@ gdk_event_translate (MSG *msg,
_gdk_win32_append_event (event);
/* Build a key release event. */
event = gdk_event_key_new (GDK_KEY_RELEASE,
event = gdk_key_event_new (GDK_KEY_RELEASE,
window,
device_manager_win32->core_keyboard,
device_manager_win32->system_keyboard,
@@ -2641,7 +2637,7 @@ gdk_event_translate (MSG *msg,
current_x = (gint16) GET_X_LPARAM (msg->lParam) / impl->surface_scale;
current_y = (gint16) GET_Y_LPARAM (msg->lParam) / impl->surface_scale;
event = gdk_event_motion_new (window,
event = gdk_motion_event_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@@ -2767,7 +2763,7 @@ gdk_event_translate (MSG *msg,
*/
delta_y *= -1.0;
event = gdk_event_scroll_new (window,
event = gdk_scroll_event_new (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@@ -2790,7 +2786,7 @@ gdk_event_translate (MSG *msg,
? GDK_SCROLL_RIGHT
: GDK_SCROLL_LEFT;
event = gdk_event_discrete_scroll_new (window,
event = gdk_scroll_event_new_discrete (window,
device_manager_win32->core_pointer,
device_manager_win32->system_pointer,
NULL,
@@ -3425,7 +3421,7 @@ gdk_event_translate (MSG *msg,
if (GDK_SURFACE_DESTROYED (window))
break;
event = gdk_event_delete_new (window);
event = gdk_delete_event_new (window);
_gdk_win32_append_event (event);
@@ -3459,7 +3455,7 @@ gdk_event_translate (MSG *msg,
if (window == NULL || GDK_SURFACE_DESTROYED (window))
break;
event = gdk_event_delete_new (window);
event = gdk_delete_event_new (window);
_gdk_win32_append_event (event);

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