Compare commits

..

374 Commits

Author SHA1 Message Date
Emmanuele Bassi
24b69a9a10 examples: Update to bind settings inside UI definitions 2021-09-09 19:22:48 +01:00
Emmanuele Bassi
043eea6ae3 docs: Document the settings binding in GtkBuilder UI files
And clean up the structure while we're at it.
2021-09-09 19:22:06 +01:00
Emmanuele Bassi
181fce8342 Support binding properties to GSettings keys in GtkBuilder
We already support binding properties; by adding new attributes to the
`property` element we can automatically call g_settings_bind() on the
object ourselves.
2021-09-09 19:12:40 +01:00
Boyuan Yang
db3858a204 Update Chinese (China) translation 2021-09-05 20:33:21 +00:00
Daniel Șerbănescu
07bff74544 Update Romanian translation
(cherry picked from commit bb72acf9cd)
2021-09-05 18:43:44 +00:00
Daniel Șerbănescu
b4262883a8 Update Romanian translation
(cherry picked from commit 63d829bbc1)
2021-09-05 18:34:37 +00:00
Matthias Clasen
563c85e222 Merge branch 'matthiasc/for-master' into 'master'
inspector: Cosmetics

See merge request GNOME/gtk!3925
2021-09-05 17:26:13 +00:00
Matthias Clasen
d75246a543 inspector: Cosmetics
Make some settings entries smaller, and make the
scales match in size. Also, inline adjustments
in the ui file, since we can do that now.
2021-09-05 12:59:11 -04:00
Matthias Clasen
b3856a3ea0 Merge branch 'matthiasc/for-master' into 'master'
Avoid hand-rolled color glyph information

See merge request GNOME/gtk!3924
2021-09-05 16:12:34 +00:00
Matthias Clasen
bd4d24f8ed Bump pango req to 1.49.1
We are using pango api that was introduced in 1.49.1
without ifdefs, so we should require it.
2021-09-05 10:58:50 -04:00
Matthias Clasen
65ce3eb207 Avoid hand-rolled color glyph information
Followup to b244f31337. Pango provides color glyph
information for us now, so we don't need to steal a
bit anymore.
2021-09-05 10:58:50 -04:00
Anders Jonsson
865ac44963 Update Swedish translation
(cherry picked from commit 19af960163)
2021-09-05 14:11:51 +00:00
Yaron Shahrabani
55a935db53 Update Hebrew translation 2021-09-05 13:45:49 +00:00
Matthias Clasen
6fefae3dbb Merge branch 'better-font-rendering-demo' into 'master'
gtk-demo: Improve the font rendering demo

See merge request GNOME/gtk!3923
2021-09-05 04:21:29 +00:00
Matthias Clasen
f7c84ddc7f gtk-demo: Font rendering - Add some bling
Fade the outlines and pixels in and out.
2021-09-04 23:41:44 -04:00
Matthias Clasen
f4a4dd2615 gtk-demo: Font rendering - expand docs 2021-09-04 23:05:55 -04:00
Matthias Clasen
b718d99d1f gtk-demo: Font rendering - Add keynav
Add mnemonics to most controls, and make
Ctrl+/- change the zoom.
2021-09-04 23:00:17 -04:00
Matthias Clasen
c7215d1199 gtk-demo: Font rendering - add outlines
Should outlines as well.
2021-09-04 22:56:07 -04:00
Matthias Clasen
24d69ef125 gtk-demo: Font rendering - better start
Turn antialiasing on initially, and turn the
extents and grid off. Otherwise we show pretty
shocking rendering right from the start.
2021-09-04 22:56:07 -04:00
Matthias Clasen
7c3fbdecf2 gtk-demo: Font rendering - improve the grid
Allow changing the character shown in the grid.
2021-09-04 22:56:07 -04:00
Matthias Clasen
b77938f40f Cosmetics
Remove an unused object from the font rendering
demo ui file.
2021-09-04 22:55:47 -04:00
Matthias Clasen
f703744564 Merge branch 'ebassi/accel-parse-doc' into 'master'
Improve the gtk_accelerator_parse() docs

See merge request GNOME/gtk!3921
2021-09-04 23:39:10 +00:00
Matthias Clasen
a3ccff3773 Merge branch 'text-fixes' into 'master'
textview: fix pango context invalidation

See merge request GNOME/gtk!3922
2021-09-04 21:39:30 +00:00
Asier Sarasua Garmendia
9869082c1c Update Basque translation
(cherry picked from commit 0768addbb3)
2021-09-04 20:54:41 +00:00
Matthias Clasen
754212d0f9 textview: Invalidate Pango contexts
We need to invalidate the Pango contexts when
font settings change. Use the new helper
gtk_widget_update_pango_context to make it less
likely that we forget to update some things.
2021-09-04 15:42:05 -04:00
Matthias Clasen
a9b81577c6 widget: Provide a helper for updating pango contexts 2021-09-04 15:42:05 -04:00
Matthias Clasen
eaa2dada54 Rename an internal function
It occupies a name I want to reuse for something else.
2021-09-04 15:42:05 -04:00
Matthias Clasen
ce2b2128bb Revert "gsk: Add font options to text nodes"
This reverts commit f1347f5841.
2021-09-04 15:42:05 -04:00
Matthias Clasen
41c25b8809 Revert "gsk: Add font options to the glyph cache"
This reverts commit 6599cb001f.
2021-09-04 15:42:05 -04:00
Matthias Clasen
b5ff35ff3e Revert "gsk: Pass font options along"
This reverts commit 299c7c3514.
2021-09-04 15:42:05 -04:00
Matthias Clasen
06423d807f Revert "gtk: Pass font options along"
This reverts commit 062a15310a.
2021-09-04 15:42:05 -04:00
Goran Vidović
0395395d52 Update Croatian translation
(cherry picked from commit 6fe3b21a01)
2021-09-04 18:12:03 +00:00
Emmanuele Bassi
c3ca48b249 Improve the gtk_accelerator_parse() docs
We need to escape the modifiers in angular brackets, or Markdown will
consider them as HTML tags.

We also should document the modifiers we're parsing.
2021-09-04 18:56:08 +01:00
Boyuan Yang
464e0aed04 Update Chinese (China) translation 2021-09-04 17:38:16 +00:00
Goran Vidović
d46e4fcecd Update Croatian translation
(cherry picked from commit 543b7defec)
2021-09-04 17:16:26 +00:00
Changwoo Ryu
363fb96e81 Update Korean translation 2021-09-04 09:02:48 +00:00
Changwoo Ryu
2382bd3bb2 Update Korean translation
(cherry picked from commit 0a5af76932)
2021-09-04 08:59:40 +00:00
Anders Jonsson
3b0a9e84ab Update Swedish translation
(cherry picked from commit 2dbcad428a)
2021-09-03 22:59:37 +00:00
Matthias Clasen
850aebea5d Merge branch 'matthiasc/for-master' into 'master'
widget: Redraw when font options change

See merge request GNOME/gtk!3917
2021-09-03 18:16:33 +00:00
Matthias Clasen
26e632e549 widget: Redraw when font options change
Its the right thing to do, even if it is a rare event.
2021-09-03 13:56:29 -04:00
Matthias Clasen
64d2d7074f Merge branch 'small-text-fixes' into 'master'
gsk: Pass font options down

See merge request GNOME/gtk!3908
2021-09-03 17:21:08 +00:00
Matthias Clasen
062a15310a gtk: Pass font options along
Pass the widget's font options along when we
are creating text nodes.
2021-09-03 12:52:05 -04:00
Matthias Clasen
299c7c3514 gsk: Pass font options along
Use the font options from the text node when
looking up glyphs.
2021-09-03 12:52:05 -04:00
Matthias Clasen
6599cb001f gsk: Add font options to the glyph cache
The cairo_t that we create to render glyphs for
the glyph cache needs to match the font options
that are supposedly governing how glyphs are
drawn.

Since we allow font options to be different per
widget in gtk, we need to have them at least at
the level of individual render nodes. Adding them
to the lookup key for the glyph cache has the
side effect of solving another problem: We are
not flushing the cache when font options change.
2021-09-03 12:52:05 -04:00
Matthias Clasen
f1347f5841 gsk: Add font options to text nodes
Since font options affect how the glyphs get rendered,
we need to pass the font options down from the gtk level
to where the glyph cache is populated.

Add a new gsk_text_node_new_full api that takes a
cairo_font_options_t in addition to the other parameters.
2021-09-03 12:43:35 -04:00
Matthias Clasen
f3ccf62463 gtk-demo: Improve the font rendering demo
Add a toggle for antialiasing, and make the metrics
hinting turn on rounding of positions, to match what
we do with settings now.
2021-09-03 11:29:44 -04:00
Matthias Clasen
44fea33c5d Merge branch 'wip/exalm/buttons' into 'master'
Allow custom children on GtkMenuButton

Closes #4205

See merge request GNOME/gtk!3904
2021-09-03 14:49:09 +00:00
Alexander Mikhaylenko
8b48cf11f9 menubutton: Support custom children
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4205
2021-09-03 17:52:46 +05:00
Matthias Clasen
e681fdd958 Merge branch 'matthiasc/for-master' into 'master'
Add a README in gtk/compose

See merge request GNOME/gtk!3916
2021-09-03 00:55:45 +00:00
Matthias Clasen
d4b7a78c54 Add a README in gtk/compose 2021-09-02 20:10:19 -04:00
Matthias Clasen
a45cbad553 Merge branch 'wip/smcv/transparent-is-transparent' into 'master'
reftest-compare: Treat colour channels as undefined if alpha is zero

Closes #4227

See merge request GNOME/gtk!3914
2021-09-02 22:19:27 +00:00
Simon McVittie
16b9a30655 reftest-compare: Treat colour channels as undefined if alpha is zero
If the alpha channel is zero, it doesn't matter what the values of the
red, green and blue channels are: the pixel is still fully transparent.
On most architectures, fully transparent pixels end up all-zeroes
(fully transparent black), matching what's in the reference PNG file;
but on mips*el the blend-difference and blend-normal tests get all-ones
(fully transparent white) and a test failure.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4227
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-09-02 22:34:48 +01:00
Jiri Grönroos
82a184a7b7 Update Finnish translation
(cherry picked from commit 33a4ae12ef)
2021-09-02 16:06:57 +00:00
Aurimas Černius
9e198a59b6 Updated Lithuanian translation 2021-09-02 13:51:39 +03:00
Matthias Clasen
c002678085 Merge branch 'fix-gst-subproject' into 'master'
media: Check for gstreamer verion instead of using cc.links()

See merge request GNOME/gtk!3910
2021-09-02 01:33:06 +00:00
Matthias Clasen
486cffc361 Merge branch 'hint-metrics-setting' into 'master'
Add a gtk-hint-font-metrics setting

See merge request GNOME/gtk!3912
2021-09-01 23:15:50 +00:00
Matthias Clasen
67495fcc77 Update settings tests
We have a new setting, so the test that is counting
settings needs an update.
2021-09-01 17:16:08 -04:00
Matthias Clasen
b26a370ce4 Add a gtk-hint-font-metrics setting
This lets people switch back to font rendering that is closer
to what GTK 3 does. It is not perfect - subpixel antialiasing
is not going to work. But it give us an Escape hatch while
we shake out the bugs in our linear layout.

Related: #3787
2021-09-01 15:52:07 -04:00
Matthias Clasen
4dc0e67ac7 Merge branch 'color-glyph-info' into 'master'
Use color glyph information from Pango

See merge request GNOME/gtk!3909
2021-09-01 16:59:38 +00:00
Xavier Claessens
2c060663cf media: Check for gstreamer verion instead of using cc.links()
This fix error when gstgl_dep comes from a subproject because in that
case it cannot be used in compiler checks.
2021-09-01 12:04:05 -04:00
Matthias Clasen
76a8eb4960 Merge branch 'matthiasc/for-master' into 'master'
Initial support for new Pango attributes

See merge request GNOME/gtk!3911
2021-09-01 15:06:26 +00:00
Matthias Clasen
ad3dad1965 Initial support for new Pango attributes
This is still missing the GtkTextTag hookup,
but it fixes the build.
2021-09-01 10:32:45 -04:00
Danial Behzadi
172d97de05 Update Persian translation 2021-09-01 09:42:39 +00:00
Daniel Mustieles
4c967d5b45 Updated Spanish translation 2021-09-01 11:02:13 +02:00
Matthias Clasen
b244f31337 Use color glyph information from Pango
Pango now sets a bit in PangoGlyphVisAttr for
color glyphs, so we don't need to do that
ourselves anymore.
2021-09-01 01:47:06 -04:00
Nathan Follens
8550a04bf4 Update Dutch translation
(cherry picked from commit 9aa08dd1b8)
2021-08-31 15:55:14 +00:00
eshagh shahidani
cb38ead48e Update Persian translation
(cherry picked from commit 7691c94a37)
2021-08-31 14:42:34 +00:00
Matthias Clasen
9713c3394d Merge branch 'matthiasc/for-master' into 'master'
editable: Clarify the docs

See merge request GNOME/gtk!3906
2021-08-31 13:15:47 +00:00
Matthias Clasen
fa57b006c9 editable: Clarify the docs
Make it clear that your class must have all the editable properties
already before you call the (confusingly named) function
gtk_editable_install_properties.
2021-08-31 08:41:45 -04:00
Matthias Clasen
9f73f0234a Merge branch 'default-settings-non-debug' into 'master'
Revert "reftests: Enforce default settings"

See merge request GNOME/gtk!3903
2021-08-30 18:09:28 +00:00
Matthias Clasen
a4f067481c gdk: Make GDK_DEBUG=default-settings unconditional
Our tests use this settings, so we should respect it
in non-debug builds as well.
2021-08-30 11:01:55 -04:00
Matthias Clasen
733fb527fa Revert "reftests: Enforce default settings"
This reverts commit 4e4f57e091.

This should not be necessary, since we have GDK_DEBUG=default-settings.
2021-08-30 11:01:22 -04:00
Matthias Clasen
3667c6b053 Merge branch 'wip/smcv/compose-files' into 'master'
Fix Compose handling on big-endian host architectures

Closes #4217

See merge request GNOME/gtk!3902
2021-08-30 12:52:54 +00:00
Simon McVittie
1071818df8 compose: Update sequences from libX11 1.7.2
This adds support for sequences like <Compose>,G,u -> capital G with
breve. Previously, only a capital U was accepted for E, G, I and O
(but a lower-case u was accepted for A and U for some reason).

Signed-off-by: Simon McVittie <smcv@debian.org>
2021-08-30 13:09:27 +01:00
Simon McVittie
11c2d9ea30 compose: Document how to get compose-parse input from libX11 source
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-08-30 13:09:05 +01:00
Simon McVittie
52cdf3056d compose: Generate endian-dependent compact Compose data
The GtkComposeTable cache is always in big-endian format and is
byteswapped on load for the more common little-endian CPUs, but
init_builtin_table() in GtkIMContextSimple can't byteswap the built-in
data without copying it, which is undesirable. Pregenerate both big-
and little-endian compose data, and compile the correct flavour into
each build of GTK. This fixes failure of the composetable test when
building for a big-endian architecture such as s390x and (traditional,
big-endian) powerpc.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4217
Signed-off-by: Simon McVittie <smcv@debian.org>
2021-08-30 11:29:46 +01:00
Benjamin Otte
32899a1edd Merge branch 'wip/otte/for-master' into 'master'
fontbutton: Make sure the window is on the same display

See merge request GNOME/gtk!3901
2021-08-30 04:37:49 +00:00
Benjamin Otte
119458f13e contentdeserializer: Fix some API awkwardness
Allow uninitialized GValues to be passed. Makes life easier for the
inspector code I'm writing.
2021-08-30 06:02:16 +02:00
Benjamin Otte
2863095f06 node-editor: Allow dragging and dropping the center picture
Dragging will just drag the render node.

Dropping will replace the current contents of the textview with the
dropped node.

Neat side effect: You can drag the node onto itself to do a
deserialize/serialize of the current text.
2021-08-30 06:02:16 +02:00
Benjamin Otte
cbc050b9ed recorder: Make the render nodes in the list draggable
You can (soon) drag any of the nodes directly into the node-editor.
2021-08-30 06:02:16 +02:00
Benjamin Otte
18affbd390 dragicon: Add a default drag icon for GskRenderNode
Somebody should make this default drag icon machinery pluggable.
2021-08-30 06:02:16 +02:00
Benjamin Otte
0b7a36ce33 rendernode: Add (de)serialization support for render nodes
This includes our own new mime type for render nodes, too.
2021-08-30 06:02:15 +02:00
Benjamin Otte
1957915940 rendernode: Add GValue functions for render nodes
This is needed as GskRenderNode is its own fundamental type and has its
own GValue infrastructure. And I want to put render nodes into the
clipboard which uses GValues.
2021-08-30 06:02:15 +02:00
Benjamin Otte
552b71d4e2 stylecontext: Remove unneeded headers 2021-08-30 06:02:15 +02:00
Benjamin Otte
480112f9aa fontbutton: Destroy dialog in unrealize()
This way, we can be sure it's always using the right display.

We can also be sure that it doesn't leak.
2021-08-30 06:02:15 +02:00
Benjamin Otte
9a2f4d8026 fontbutton: Make sure the window is on the same display
We don't want the font buttons created by the inspector to run on the
default display.
2021-08-30 06:02:15 +02:00
Benjamin Otte
3b15f32335 Merge branch 'wip/otte/symbolic-paintable' into 'master'
Add GtkSymbolicPaintable

See merge request GNOME/gtk!3895
2021-08-30 03:54:35 +00:00
Benjamin Otte
7404a6fc4f Merge branch 'wip/otte/G_TYPE_POINTER' into 'master'
Get rid of G_TYPE_POINTER

See merge request GNOME/gtk!3900
2021-08-30 03:50:30 +00:00
Benjamin Otte
91d1ec41c2 symbolicpaintable: Refactor default colors path 2021-08-30 05:29:04 +02:00
Benjamin Otte
9237c8be67 icontheme: Refactor gtk_icon_theme_lookup_symbolic_colors()
With the new enum, the code looks much cleaner.
2021-08-30 04:52:47 +02:00
Benjamin Otte
6c87d362c5 enums: Add a GtkSymbolicColor enum
That way we don't nedmagic numbres to index the colors array.

Use it in the symbolic paintable demo.
2021-08-30 04:36:16 +02:00
Baurzhan Muftakhidinov
4f31d3587d Update Kazakh translation
(cherry picked from commit 37d2d407a1)
2021-08-29 17:09:01 +00:00
Baurzhan Muftakhidinov
29a2f4021a Update Kazakh translation
(cherry picked from commit 9e62fd82ea)
2021-08-29 07:41:58 +00:00
Benjamin Otte
e2d321a16a searchengine: Rename private headers
The code uses G_TYPE_POINTER and I got all sorts of scared.
2021-08-29 06:52:28 +02:00
Benjamin Otte
7366f5099a filesystemmodel: Don't use G_TYPE_POINTER
It's a GError, use G_TYPE_ERROR.
2021-08-29 06:52:28 +02:00
Benjamin Otte
4fbef5f466 placessidebar: Don't use G_TYPE_POINTER
We have a type for lists of GFiles. We invented it for DND.

Keep the annotation info, so bindings don't have to know this.
2021-08-29 06:52:28 +02:00
Benjamin Otte
2e48ff3362 pathbar: Use correct GType in signal 2021-08-29 06:52:28 +02:00
Benjamin Otte
7cdbdb663c gtk-demo: Add a symbolic paintable demo
Don't click the button!
2021-08-29 04:29:53 +02:00
Benjamin Otte
1b390d3857 gtk-demo: Explicitly pass nuclear icon colors 2021-08-29 04:29:53 +02:00
Benjamin Otte
2808f9c75b gtk: Port icontheme to GtkSymbolicPaintable 2021-08-29 04:29:53 +02:00
Benjamin Otte
49d109c29e gtk: Add the GtkSymbolicPaintable interface 2021-08-29 04:29:53 +02:00
Benjamin Otte
36dd959bf9 build: Check that introspection is enabled for docs build 2021-08-29 04:29:53 +02:00
Benjamin Otte
2f9a67b8a1 docs: Fix vfunc references
vfunc references should just use the object name, not the
class/interface/iface name.
2021-08-29 04:29:02 +02:00
Matthias Clasen
6d5d9ea073 Merge branch 'text-selection-missing' into 'master'
ngl: Avoid a coordinate overflow

Closes #4214

See merge request GNOME/gtk!3897
2021-08-28 21:21:02 +00:00
Matthias Clasen
1cfd340cae ngl: Avoid a coordinate overflow
This was showing up as big text selections going
missing sporadically.

Fixes: #4214
2021-08-28 15:42:30 -04:00
Matthias Clasen
369ccfc34f Merge branch 'matthiasc/for-master' into 'master'
Draw negatively sloped carets correctly

See merge request GNOME/gtk!3892
2021-08-28 17:18:21 +00:00
Matthias Clasen
e556513de6 Merge branch 'menu-accel' into 'master'
window: Prefer menu bars when handling F10

See merge request GNOME/gtk!3893
2021-08-28 17:17:43 +00:00
Matthias Clasen
79dc1a2a4d Merge branch 'randr' into 'master'
x11: Fix handling of `RRScreenChangeNotify`/`RRNotify` events

See merge request GNOME/gtk!3894
2021-08-28 17:17:00 +00:00
Ian Douglas Scott
9e5a501c73 x11: Fix handling of RRScreenChangeNotify/RRNotify events
It seems these are sent with `xwindow` set to the root window, so this
was failing to find a surface and get the screen from that.

I'm not sure if there's a reason not to get the screen this way
elsewhere in the function, but it seems this should be correct.

This fixes the behavior of `gdk_x11_display_get_monitors()`, which
wasn't correctly changing when monitors were added or removed. For
instance, this python code was always showing the same number of
monitors when one was turned off and on, but updates correctly with this
change applied:

```python
import gi
gi.require_version("GLib", "2.0")
gi.require_version("Gdk", "4.0")
gi.require_version("Gtk", "4.0")
from gi.repository import GLib, Gdk, Gtk

def f():
    print(len(Gdk.Display.get_default().get_monitors()))
    return True
GLib.timeout_add_seconds(1, f)

GLib.MainLoop().run()
```
2021-08-27 18:07:39 -07:00
Enrico Nicoletto
2db8d7f6a2 Update Brazilian Portuguese translation
(cherry picked from commit cd9735eab1)
2021-08-28 01:00:39 +00:00
Enrico Nicoletto
94c3f4d4fc Update Brazilian Portuguese translation
(cherry picked from commit 8f5a1471cc)
2021-08-28 00:44:38 +00:00
Florian Müllner
3fa26861cd window: Prefer menu bars when handling F10
Focusing the first widget in the titlebar is a good fallback,
but a "real" menubar or :primary menu button should take
precedence.
2021-08-28 00:19:23 +02:00
Matthias Clasen
ef2b0ccd6c Draw negatively sloped carets correctly
The code for handling negatively sloped caret
positions was not tested, and naturally did
not work. Fix it.
2021-08-27 17:20:35 -04:00
Matthias Clasen
f1702d24e7 Merge branch 'css-line-decoration' into 'master'
textview: Apply line decoration from css

See merge request GNOME/gtk!3890
2021-08-27 01:37:57 +00:00
Matthias Clasen
3a50ff57d8 Clean up the code
Avoid compiler warnings, and make the code
a bit more compact.
2021-08-26 20:45:17 -04:00
Matthias Clasen
8ac2e8d495 textview: Apply font features from css
We were forgetting to propagate these values from
CSS to the default attributes. Share the code for
getting these values out of a GtkCssStyle.
2021-08-26 20:21:23 -04:00
Matthias Clasen
e56cf85fd1 textview: Apply text transform from css
We were forgetting to propagate these values from
CSS to the default attributes.
2021-08-26 18:53:30 -04:00
Matthias Clasen
1c6aef1862 textview: Apply line decoration from css
We were forgetting to propagate these values from
CSS to the default attributes.
2021-08-26 18:46:57 -04:00
Matthias Clasen
4653cbe56e Merge branch 'css-letter-spacing' into 'master'
textview: Don't forget to collect css letterspacing

Closes #4207

See merge request GNOME/gtk!3889
2021-08-26 19:37:55 +00:00
Matthias Clasen
93148d302f textview: Don't forget to collect css letterspacing
There are more properties missing, this is just
the start.

Fixes: #4207
2021-08-26 15:01:23 -04:00
Andika Triwidada
a443ba91ce Update Indonesian translation
(cherry picked from commit 85ad1db8ef)
2021-08-26 14:40:16 +00:00
Hugo Carvalho
d8daef2de7 Update Portuguese translation
(cherry picked from commit 6e467de751)
2021-08-26 14:30:04 +00:00
Hugo Carvalho
845d43c77a Update Portuguese translation
(cherry picked from commit ae5b6395ad)
2021-08-26 14:12:59 +00:00
Andika Triwidada
f8dbcc472b Update Indonesian translation
(cherry picked from commit dcc899b621)
2021-08-26 13:39:00 +00:00
Marek Černocký
0f0f75f6b1 Updated Czech translation 2021-08-26 15:07:54 +02:00
Timm Bäder
4e2e2d84fc Merge branch 'clang-fallthrough' into 'master'
build: fix implicit-fallthrough errors with clang

See merge request GNOME/gtk!3887
2021-08-26 11:15:28 +00:00
Jordi Mas
887885b6e0 Update Catalan translation 2021-08-26 13:10:32 +02:00
Matthias Clasen
a868a5c434 Merge branch 'matthiasc/for-master' into 'master'
More markup demos

See merge request GNOME/gtk!3888
2021-08-26 06:15:06 +00:00
Christoph Reiter
a0c147d246 build: fix implicit-fallthrough errors with clang
The clang build fails due to -Werror=implicit-fallthrough being
on by default and some fallthrough cases not being marked as such.

Use G_GNUC_FALLTHROUGH or duplicate the code in those cases.
2021-08-26 07:08:38 +02:00
Matthias Clasen
38040c96d6 More markup demos
Showing more of what Pango can do.
2021-08-25 19:38:59 -04:00
Matthias Clasen
989ecf69ad Merge branch 'new-pango-attributes' into 'master'
Support new pango attributes

See merge request GNOME/gtk!3878
2021-08-25 20:11:45 +00:00
Matthias Clasen
9d26399143 Merge branch 'treeexpander-claim-gestures' into 'master'
GtkTreeExpander: claim expander-icon gestures

Closes #4199

See merge request GNOME/gtk!3886
2021-08-25 19:11:23 +00:00
Matthias Clasen
b9cad7cc54 textview: Implement new pango attributes
Implement the word and sentence attributes.
2021-08-25 14:57:13 -04:00
Matthias Clasen
357b97b5a6 Support new pango attributes
Support new Pango attributes for segmentation
in GtkBuilder.
2021-08-25 14:57:13 -04:00
Jan Lukas Gernert
318160d836 GtkTreeExpander: claim expander-icon gestures
Claim the pressed, released and canceled gestures
meant for the expander-icon of the TreeExpander.
This avoids selecting the row when expanding or collapsing it.

Closes #4199
2021-08-25 17:50:12 +02:00
Matthias Clasen
5e90d63373 Merge branch 'sloped-caret' into 'master'
Implement sloped caret drawing

See merge request GNOME/gtk!3880
2021-08-25 13:43:24 +00:00
Jordi Mas
0b7f1e488f Update Catalan translation 2021-08-25 15:17:27 +02:00
Matthias Clasen
e281bbbb55 Merge branch 'treeexpander-indent-property' into 'master'
GtkTreeExpander: indent-without-expander property

Closes #4175

See merge request GNOME/gtk!3858
2021-08-25 11:48:59 +00:00
Matthias Clasen
892bacee52 Merge branch '4195-include-gdkprivate-h' into 'master'
gdkmacoseventsource: Include "gdk-private.h"

Closes #4195

See merge request GNOME/gtk!3882
2021-08-25 11:48:11 +00:00
Matthias Clasen
2f1db4b77c Use pango_layout_get_caret_pos
This new api returns rectangles for sloped carets,
in contrast to pango_layout_get_cursor_pos, which
always returns a rectangle with a width of zero.
2021-08-25 06:53:53 -04:00
Matthias Clasen
f90e9b26f8 Implement sloped caret drawing
Prepare for Pango to return slope information for carets.

While we are at it, improve the shape of our carets a bit.
2021-08-25 06:53:53 -04:00
Matthias Clasen
ad71f454bd Merge branch 'fix-gettext' into 'master'
Fix wrong gettext ITS target

See merge request GNOME/gtk!3881
2021-08-25 10:51:57 +00:00
Rafał Dzięgiel
c66bd791c4 Fix wrong gettext ITS target
The installed ITS rule filename is "gtk4builder.its". The .loc file
is wrongly pointing to old "gtkbuilder.its" which makes gettext fail
on systems without GTK3 installed.
2021-08-25 10:08:50 +02:00
Fran Dieguez
40bceef3ca Update Galician translation
(cherry picked from commit 410ea1049b)
2021-08-25 07:26:55 +00:00
Fran Dieguez
9d79f55dc9 Update Galician translation
(cherry picked from commit 09a5828ccf)
2021-08-25 06:12:43 +00:00
Matthias Clasen
c5c1cf6d55 Merge branch 'wip/otte/for-master' into 'master'
wayland: Better error on eglGetDisplay() failure

See merge request GNOME/gtk!3879
2021-08-25 04:24:55 +00:00
Peter Bloomfield
9eb8aa9a32 gdkmacoseventsource: Include "gdk-private.h"
_gdk_macos_event_source_new() calls g_source_set_static_name(), which
for GLib versions before 2.69.1 is a macro defined in gdk-private.h.

Fixes #4195

modified:   gdk/macos/gdkmacoseventsource.c
2021-08-24 16:55:52 -04:00
Benjamin Otte
95931a7e6c wayland: Better error on eglGetDisplay() failure
Goals:

1. Provide as much information as possible in the error message, so
   users can try to fix their system themselves.
2. Try to formulate the error message in a way that explains that this
   is not something GTK can fix, but a lower layer problem.

Related: #4193
2021-08-24 19:55:22 +00:00
Yuri Chornoivan
d9daaed43f Update Ukrainian translation
(cherry picked from commit 6377b23bd6)
2021-08-24 17:29:02 +00:00
Matthias Clasen
b9c51e65c1 Merge branch 'wip/carlosg/gesture-state-in-entries' into 'master'
Claim clicks further at GtkEntry/GtkSearchEntry

See merge request GNOME/gtk!3873
2021-08-24 17:20:20 +00:00
Matthias Clasen
da5eb92f47 Merge branch 'matthiasc/for-master' into 'master'
Revert "imwayland: Tweak preedit text"

Closes #4123

See merge request GNOME/gtk!3877
2021-08-24 17:19:42 +00:00
Matthias Clasen
03ed585f6f tests: Rewrite PangoAttribute introspection
We can use the new binding helpers to make this
a little less bothersome. That way, it will need
tweaks less often (only when new fundamental types
are introduced).
2021-08-24 12:53:48 -04:00
Matthias Clasen
51f953a1aa Revert "imwayland: Tweak preedit text"
This reverts commit d84a028455.

IBus uses the same character now.

Fixes: #4123
2021-08-24 12:53:48 -04:00
Emmanuele Bassi
93fb07d808 Merge branch 'expander-ref-leak' into 'master'
Release an extra reference on GtkExpander:child

See merge request GNOME/gtk!3876
2021-08-24 13:20:48 +00:00
Emmanuele Bassi
5e311d4d85 Release an extra reference on GtkExpander:child
The child of a GtkExpander is owned directly by the expander whenever
the "expanded" flag is unset.

We are adding an additional reference to the child of an expander when
expander is not expanded.

Additionally, if a GtkExpander is disposed while not expanded, we need
to explicitly release the reference on the child widget that we own.

This reference leak was masked in GTK3 by GtkContainer removing each
child from the parent container by recursively calling
gtk_widget_destroy().
2021-08-24 11:28:59 +01:00
Carlos Garnacho
e652054d50 gtkpasswordentry: Add a "catchall" click gesture handler
This gesture is set on the whole widget surface, since there's
multiple input targets inside an entry (icons, the GtkText itself)
it makes sense to consider the full entry an area handling clicks.
Ensure these events don't propagate further up, and result in other
actions.
2021-08-24 01:13:29 +02:00
Carlos Garnacho
58c31b8627 gtkpasswordentry: Consume click events after pressing on icon
This may result in user actions, so the gesture should consume the
events.
2021-08-24 01:12:31 +02:00
Matthias Clasen
b945033b41 Merge branch 'fix-docs' into 'master'
Fix documentation for gtk_icon_view_create_drag_icon

Closes #4190

See merge request GNOME/gtk!3875
2021-08-23 20:40:17 +00:00
Qiu Wenbo
92d2867170 docs: Fix documentation for gtk_icon_view_create_drag_icon
Fixes: #4190
2021-08-24 00:24:08 +08:00
Matthias Clasen
5d38c8c558 Merge branch 'wip/kalev/pre-compiled-css-detection' into 'master'
build: Fix detection for pre-compiled css files

See merge request GNOME/gtk!3874
2021-08-23 14:57:19 +00:00
Kalev Lember
552a4b2c82 build: Fix detection for pre-compiled css files
The default theme changed from Adwaita to Default and this tripped up
the logic to detect if the tarball builds contain pre-built css files or
not. Fix this by looking at pre-compiled css files in themes/Default/
instead of themes/Adwaita/.
2021-08-23 16:15:48 +02:00
Carlos Garnacho
7a4afb08bd gtksearchentry: Add a "catchall" click gesture handler
This gesture is set on the whole widget surface, since there's
multiple input targets inside an entry (icons, the GtkText itself)
it makes sense to consider the full entry an area handling clicks.
Ensure these events don't propagate further up, and result in other
actions.
2021-08-23 15:38:33 +02:00
Carlos Garnacho
c5cd1ac630 gtkentry: Add a "catchall" click gesture handler
This gesture is set on the whole widget surface, since there's
multiple input targets inside an entry (icons, the GtkText itself)
it makes sense to consider the full entry an area handling clicks.
Ensure these events don't propagate further up, and result in other
actions.
2021-08-23 15:38:33 +02:00
Carlos Garnacho
90edb76415 gtksearchentry: Consume click events after pressing on icon
This results in user actions, so the gesture should consume the
events.
2021-08-23 15:38:33 +02:00
Carlos Garnacho
8f397502df gtktext: Set claimed state on button1 click gesture
All possible ramifications after button1 press (move cursor,
begin drag, begin dnd, select word/line, ...) result in user
actions. The right thing after that is consuming the events,
set the gesture state for that.
2021-08-23 15:28:27 +02:00
Jan Lukas Gernert
1cb17d8613 GtkTreeExpander: indent-for-icon property
A property to determine if the TreeExpander should indent the child
by the width of an expander-icon when it is not expandable.

Closes #4175
2021-08-23 07:54:45 +02:00
Jan Lukas Gernert
88e796bb45 Add 4.6 version macros 2021-08-23 07:54:27 +02:00
Matthias Clasen
1310bf0218 Merge branch 'matthiasc/for-master' into 'master'
NEWS: Updates

See merge request GNOME/gtk!3872
2021-08-22 21:16:02 +00:00
Matthias Clasen
4efeaa844f NEWS: Updates 2021-08-22 16:41:22 -04:00
Matthias Clasen
24685612a9 Merge branch 'css-text-transform' into 'master'
css: Implement text-transform

See merge request GNOME/gtk!3862
2021-08-22 20:40:50 +00:00
Matthias Clasen
bf21df4195 Add an example for text transforms
Show some transformed text in the markup demo.
2021-08-22 15:57:50 -04:00
Matthias Clasen
417b3f9c6b Implement text transforms for GtkTextView
Add a property to GtkTextTag and do all the
legwork to translate it to the Pango attribute.
2021-08-22 15:57:50 -04:00
Matthias Clasen
2d84a1c63e css: Implement text-transform
Implement the text-transform property from
https://www.w3.org/TR/css-text-3/#text-transform-property
using a new Pango attribute.
2021-08-22 15:57:50 -04:00
Matthias Clasen
5ab9a29bc4 Merge branch 'bump-pango' into 'master'
Bump the pango dependency

See merge request GNOME/gtk!3871
2021-08-22 19:57:21 +00:00
Matthias Clasen
383ea0d86a Merge branch 'css-line-height2' into 'master'
Implement CSS line-height

See merge request GNOME/gtk!3833
2021-08-22 19:47:10 +00:00
Matthias Clasen
df8f75bb8f Merge branch 'matthiasc/for-master' into 'master'
windowhandle: Quiet a compiler warning

See merge request GNOME/gtk!3868
2021-08-22 19:28:01 +00:00
Matthias Clasen
ba95ef63da Drop PANGO_VERSION_CHECK checks
We require Pango 1.49 now.
2021-08-22 15:26:23 -04:00
Matthias Clasen
bea4aa31ea Bump Pango dep
Require Pango 1.49, so we can support new attributes
without too much ifdeffery.
2021-08-22 15:23:42 -04:00
Matthias Clasen
6c19a8352f gtk-demo: Add a line height demo
Add an example for widely spaced text to the markup demo.
2021-08-22 15:15:50 -04:00
Matthias Clasen
e3df89b524 gtk-demo: Improve markup demo
The font sizes demo had the space between the font-size spans,
causing us to have a run with just a default sized space between
the words, which in turn leads to wobbly cursor sizes. Avoid that
by including the space in the preceding span.

Also, make it bigger.
2021-08-22 15:15:50 -04:00
Matthias Clasen
a9003f7ac0 gtk-demo: Set line height from markup
Keep the import-markup code in sync with GtkTextBuffer.
2021-08-22 15:15:50 -04:00
Matthias Clasen
2cc06f60c5 textview: Set line height from markup
Note that we ignore the absolute-line-height
attribute for now.
2021-08-22 15:15:50 -04:00
Matthias Clasen
4759afcc3e textview: Set line height from css
Set the line height in the default attributes from
the CSS style. This makes line height work in
GtkTextView.
2021-08-22 15:15:50 -04:00
Matthias Clasen
66b297e408 textview: Add line height plumbing
This adds a line-height property to GtkTexttag and a
line_height field to GtkTextAttributes, and translates
it to a pango attribute.
2021-08-22 15:15:50 -04:00
Matthias Clasen
bbd2b255a3 css: Document line-height as supported 2021-08-22 15:15:50 -04:00
Matthias Clasen
8b2f28eee3 css: Add parser tests for line-height 2021-08-22 15:15:50 -04:00
Matthias Clasen
ae767dc5bf css: Translate line-height to a Pango
Pango 1.50 introduces a line-height attribute. Use it.
This is enough to make line-height work for labels
and entries.
2021-08-22 15:15:50 -04:00
Matthias Clasen
d923402934 css: Add line-height property
This adds the plumbing to parse the line-height
property from CSS. Widgets are not picking it
up yet.
2021-08-22 15:15:50 -04:00
Benjamin Otte
9667f889b3 Merge branch 'clipboard-set-docs' into 'master'
docs: Expand gdk_clipboard_set() docs

See merge request GNOME/gtk!3865
2021-08-22 18:49:13 +00:00
Benjamin Otte
d2ea7af335 docs: Expand gdk_clipboard_set() docs 2021-08-22 18:49:12 +00:00
Matthias Clasen
f95e9407a9 Fix up test output for new version
Annoying that this test has to be touched every time
we bump the version.
2021-08-22 14:48:12 -04:00
Matthias Clasen
7be3c2974a windowhandle: Quiet a compiler warning
gesture was left uninitialized in the default case.
2021-08-22 14:19:14 -04:00
Matthias Clasen
5444f604cb Merge branch 'matthiasc/for-master' into 'master'
Bump version to 4.5

See merge request GNOME/gtk!3867
2021-08-22 17:53:34 +00:00
Matthias Clasen
94e68b0e36 Bump version to 4.5
4.4 has been branched off.
2021-08-22 13:06:29 -04:00
Matthias Clasen
910d86f958 NEWS: Updates 2021-08-22 13:06:15 -04:00
Matthias Clasen
fd885e42b0 Merge branch 'drop-gl' into 'master'
gsk: Drop the gl renderer

See merge request GNOME/gtk!3863
2021-08-22 17:04:25 +00:00
Matthias Clasen
ea31ae31c1 tests: Remove an outdated comment
It refers to a file that no longer exists.
2021-08-22 12:29:59 -04:00
Matthias Clasen
00763e5af3 media: Don't include gsk/gl/gskglrenderer.h 2021-08-22 12:29:40 -04:00
Matthias Clasen
1bf5aab18c testutils: Don't include gsk/gl/gskglrenderer.h 2021-08-22 12:29:13 -04:00
Matthias Clasen
210a709246 Merge branch 'matthiasc/for-master' into 'master'
Handle new pango attribute type

See merge request GNOME/gtk!3866
2021-08-22 15:22:14 +00:00
Matthias Clasen
5feba67a3d Handle new pango attribute type
Update all the places where we switch over
PangoAttrType to handle PANGO_ATTR_TEXT_TRANSFORM,
and do nothing for now - text-transform support
will land in 4.6.
2021-08-22 11:04:28 -04:00
Matthias Clasen
e9e373913e gsk: Drop the gl renderer
ngl supports all the same platforms as gl
now, and has seen more improvements in the
last cycle.
2021-08-20 22:58:30 -04:00
Matthias Clasen
f1f197e3b9 4.4.0 2021-08-20 15:10:25 -04:00
Matthias Clasen
cedb6183e9 Fix imcontext tests
We should force our internal im context for these
tests, so we don't depend on the environment.
2021-08-20 15:10:25 -04:00
Matthias Clasen
0415d46c0f Merge branch 'matthiasc/for-master' into 'master'
NEWS: Updates

See merge request GNOME/gtk!3861
2021-08-20 14:21:39 +00:00
Matthias Clasen
68388331c7 NEWS: Updates 2021-08-20 09:54:02 -04:00
Matthias Clasen
92817b0603 Merge branch 'cut-shortcut-activation-short' into 'master'
shortcutcontroller: Only do round-robin for mnemonics

Closes #4130

See merge request GNOME/gtk!3824
2021-08-20 13:50:51 +00:00
Matthias Clasen
f8a1726ffa shortcutcontroller: Only do round-robin for mnemonics
Don't do round-robin activation unless we are looking
for mnemonics, where this is an expected feature.

Fixes: #4130
2021-08-20 09:26:37 -04:00
Matthias Clasen
be34f27026 Merge branch 'matthiasc/for-master' into 'master'
gdk: Add a missing annotation

Closes #4097

See merge request GNOME/gtk!3860
2021-08-20 13:22:01 +00:00
Emmanuele Bassi
12c5518e2b Merge branch 'master' into 'master'
a11y: Send correct object reference for the root accessible

See merge request GNOME/gtk!3800
2021-08-20 13:18:37 +00:00
Matthias Clasen
d8ab5c3c45 gdk: Add a missing annotation
Mark an array as zero-terminated.

Fixes: #4097
2021-08-20 08:57:27 -04:00
Matthias Clasen
36d1c9e8b7 Merge branch 'add-support-for-windows-pointer-input-stack-gtk4' into 'master'
Add support for Windows Pointer Input Stack

Closes #262, #3162, #729, and #537

See merge request GNOME/gtk!3684
2021-08-20 11:31:16 +00:00
Matthias Clasen
45c047f5c0 Merge branch 'block-cursor-fixes' into 'master'
textview: Don't eat block cursors

See merge request GNOME/gtk!3857
2021-08-20 06:18:07 +00:00
Matthias Clasen
da1232caaf textview: Don't eat block cursors
We need to render even an empty paragraph when
it has a block cursor at the end. This fixes block
cursors not showing up in empty lines.
2021-08-20 01:57:31 -04:00
Matthias Clasen
fff5a83957 Merge branch 'matthiasc/for-master' into 'master'
window: Make resizeability changes work

See merge request GNOME/gtk!3856
2021-08-19 21:19:40 +00:00
Matthias Clasen
f5b6488eb2 window: Make resizeability changes work
We were forgetting to update the toplevel
properties here.
2021-08-19 16:03:58 -04:00
Luca Bacci
c02bae9e08 Move the _gdk_win32_pointer_input_api global variable into GdkWin32Display 2021-08-19 16:29:45 +02:00
Matthias Clasen
58e65ae7dd windows: Update the docs for env vars
We've replaced some env vars with a new one.
Update the docs to match.
2021-08-19 15:57:44 +02:00
Luca Bacci
3977518f00 Fix typo 2021-08-19 15:57:44 +02:00
Luca Bacci
8adee3dace Disable visual feedback for pen ad touch 2021-08-19 15:57:43 +02:00
Luca Bacci
09ad930da4 Filter out spurious mouse messages while handling pen or touch input 2021-08-19 15:57:43 +02:00
Luca Bacci
52f7bb6950 Add _gdk_win32_get_cursor_pos utility 2021-08-19 15:57:42 +02:00
Luca Bacci
68db945e47 Handle WinPointer input 2021-08-19 15:57:41 +02:00
Luca Bacci
b54f4cf5d4 Initialize WinPointer and enumerate devices 2021-08-19 15:57:41 +02:00
Luca Bacci
9a8a9451b1 Add new GdkDeviceWinpointer type 2021-08-19 15:57:40 +02:00
Luca Bacci
fffa903ce9 Add winpointer.h header file for type declarations 2021-08-19 15:57:39 +02:00
Luca Bacci
ab08885a32 Add entry for WinPointer in GdkWin32TabletInputAPI enum 2021-08-19 15:57:38 +02:00
Luca Bacci
ad3995b1b9 Make room for other API's than Wintab 2021-08-19 15:57:38 +02:00
Luca Bacci
75cc0710ac Remove _gdk_input_ignore_wintab variable
Also remove unused variable _gdk_max_colors
2021-08-19 15:57:37 +02:00
Luca Bacci
7cec7054e2 Rename some Wintab-related functions 2021-08-19 15:57:36 +02:00
Luca Bacci
fe280e578f Set active physical device when using the mouse 2021-08-19 15:57:36 +02:00
Luca Bacci
a32973f56b Move use of _gdk_win32_get_next_tick from synthesize_crossing_events to its callers 2021-08-19 15:57:35 +02:00
Luca Bacci
7762311911 Add a physical_device argument to send_crossing_event et al 2021-08-19 15:57:34 +02:00
Luca Bacci
edd73ffbed Raise _WIN32_WINNT macro to target Windows 7 API 2021-08-19 15:57:33 +02:00
Matthias Clasen
fca87d93e9 Updates 2021-08-19 01:47:43 -04:00
Matthias Clasen
c2fe2c0385 Merge branch 'better-word-selection' into 'master'
textview: Improve word selection

Closes #4177

See merge request GNOME/gtk!3855
2021-08-19 04:51:11 +00:00
Matthias Clasen
8aa25046dc textview: Improve word selection
Avoid selecting a whole extra paragraph when a select-by-words
selection is extended beyond the end of the previous paragraph.

Fixes: #4177
2021-08-19 00:33:03 -04:00
Matthias Clasen
27a07ed89c Merge branch 'matthiasc/for-master' into 'master'
Cosmetics

See merge request GNOME/gtk!3854
2021-08-19 02:49:23 +00:00
Matthias Clasen
071a6bcc06 Cosmetics 2021-08-18 22:33:23 -04:00
Benjamin Otte
f98ac6590d Merge branch 'wip/otte/for-master' into 'master'
demo: Add a dnd special-case for textures

See merge request GNOME/gtk!3853
2021-08-19 01:42:26 +00:00
Benjamin Otte
6b733d2943 gtk-demo: Make clipboard demo paste from clipboard
The old code was just pasting local clipboard data that we put there
ourselves and was causing criticals on remote clipboard data. Now the
code does the proper async paste.
2021-08-19 03:16:48 +02:00
Benjamin Otte
6f165efcdb contentprovider: Switch wrong order in type check
We can provide textures as a paintable - we can't provide paintables as
textures.
2021-08-19 03:16:48 +02:00
Benjamin Otte
7bc1c9a562 demo: Add a dnd special-case for textures
If the DND/clipboard machinery knows a texture is a texture, it will try
to serialize it. Paintables can't be serialized, so it wouldn't try.
2021-08-19 03:16:48 +02:00
Matthias Clasen
1596fdeba3 Merge branch 'matthiasc/for-master' into 'master'
infobar: Update buildable docs

Closes #4164

See merge request GNOME/gtk!3852
2021-08-18 22:05:07 +00:00
Matthias Clasen
1599b659cf infobar: Update buildable docs
Document the current state of GtkBuilder support in
GtkInfoBar, not what we had in GTK3.

Fixes: #4164
2021-08-18 17:42:54 -04:00
Matthias Clasen
bb65564c7d Merge branch 'seat-v7' into 'master'
gdk/wayland: add support for wl_seat version 7

See merge request GNOME/gtk!3842
2021-08-18 21:10:30 +00:00
Matthias Clasen
03031b3dc1 Merge branch 'fix/wm_class2' into 'master'
x11: ensure WM class is not null even if display is initialized early

See merge request GNOME/gtk!3808
2021-08-18 18:24:37 +00:00
Benjamin Otte
b7636ebbc0 Merge branch 'win32-drop-local-dnd' into 'master'
gdk/win32: Drop local DnD protocol

See merge request GNOME/gtk!3830
2021-08-18 14:27:14 +00:00
Matthias Clasen
5707b80a69 Merge branch 'win32-check-shader-support' into 'master'
GDK-Win32: Reject GL context if shaders aren't supported (fix issue #4165)

Closes #4165

See merge request GNOME/gtk!3850
2021-08-18 12:19:57 +00:00
Matthias Clasen
81e5d4c327 Merge branch 'master' into 'master'
gtkbuilderparser: Fix duplicate object id detection

See merge request GNOME/gtk!3848
2021-08-18 12:00:41 +00:00
Ye Moran
f8111125ef gtkbuilderparser: Fix duplicate object id detection 2021-08-18 12:00:40 +00:00
Matthias Clasen
c020e83890 Merge branch 'matthiasc/for-master' into 'master'
Add a custom input test

See merge request GNOME/gtk!3851
2021-08-18 03:24:41 +00:00
Matthias Clasen
f6659fea8d imcontext: Improve docs
Add some more docs around GtkIMContext.
2021-08-17 22:33:26 -04:00
Matthias Clasen
a06858ccd9 Add a custom input test
This shows the minimal work required to hook up an
im context to a custom widget.
2021-08-17 22:33:26 -04:00
Emmanuele Bassi
c6c48d327c Merge branch 'wip/exalm/query-action-transfer' into 'master'
widget: Fix gtk_widget_class_query_action() annotations

See merge request GNOME/gtk!3843
2021-08-17 17:56:40 +00:00
Chun-wei Fan
5d0f188615 GDK-Win32: Reject WGL context if shaders aren't supported
When we initialize OpenGL, check whether we have OpenGL  2.0 or later; if not,
check whether we have the 'GL_ARB_shader_objects' extension, since we must be
able to support shaders if using OpenGL for GTK.

If we don't support shaders, as some Windows graphics drivers do not support
OpenGL adequately, notably older Intel drivers, reject and destroy the GL
context that we created, and so fallback to the Cairo GSK renderer, so that
things continue to run, albeit with an expected warning message that the GL
context cannot be realized.

Also, when we could not make the created dummy WGL context current during
initialization, make sure that we destroy the dummy WGL context as well.

Fixes issue #4165.
2021-08-17 16:25:09 +08:00
Benjamin Otte
78fcc8feb8 Merge branch 'wip/otte/for-master' into 'master'
gdk: Include Vulkan error code in vulkan_strerror()

See merge request GNOME/gtk!3844
2021-08-12 12:36:28 +00:00
Benjamin Otte
27cad85247 gdk: Include Vulkan error code in vulkan_strerror() 2021-08-12 14:19:30 +02:00
Simon Ser
ad0c1d4dbe gdk/wayland: add support for wl_seat version 7
Version 7 requires wl_keyboard keymaps to be mapped with
MAP_PRIVATE, so that the compositor can share the same keymap
file between multiple clients.
2021-08-11 16:37:03 +02:00
Simon Ser
00abaed89a gdk/wayland: add support for wl_seat version 6
Version 6 adds two new wl_touch events, which can be ignored.
2021-08-11 16:36:57 +02:00
Alexander Mikhaylenko
342f02711b widget: Fix gtk_widget_class_query_action() annotations
Add transfer none on all out values as they aren't being copied.
2021-08-11 14:33:38 +05:00
Matthias Clasen
d9c48a8d01 Merge branch 'matthiasc/for-master' into 'master'
Handle the new line height pango attribute

See merge request GNOME/gtk!3840
2021-08-10 15:08:20 +00:00
Matthias Clasen
d757696116 ci: Add libjpeg-turbo-devel to the Fedora image
This was getting downloaded from sourceforge every
time for the docs build, and that started failing.
2021-08-10 08:22:52 -04:00
Matthias Clasen
528ebfabf0 Handle the new line height pango attribute
Update all the places where we switch over PangoAttributeType
to handle (and ignore, for now) the new line height attribute.
2021-08-10 08:22:52 -04:00
Vincent Bernat
2ebde276d1 x11: ensure WM class is not null even if display is initialized early
With gtkmm, when using `Application()`, the display is initialized
before we know the application name and therefore, the program class
associated to the display is NULL.

Instead of providing a default value, we set it equal to program name
when NULL. Moreover, we give up on capitalizing the class name to keep
the code super simple. Also, not using a capitalized name is
consistent with `gdk_x11_display_open()`. If someone has a good reason
to use a capitalized name, here is how to do it.

```c
  class_hint = XAllocClassHint ();
  class_hint->res_name = (char *) g_get_prgname ();
  if (display_x11->program_class)
    {
      class_hint->res_class = (char *) g_strdup (display_x11->program_class);
    }
  else if (class_hint->res_name && class_hint->res_name[0])
    {
      class_hint->res_class = (char *) g_strdup (class_hint->res_name);
      class_hint->res_class[0] = g_ascii_toupper (class_hint->res_class[0]);
    }
  XSetClassHint (xdisplay, impl->xid, class_hint);
  g_free (class_hint->res_class);
  XFree (class_hint);
```

Fix eff53c023a ("x11: set a default value for program_class")
2021-08-10 09:14:36 +02:00
Matthias Clasen
04f3c8054b Merge branch 'callback-annotation-again' into 'master'
widget: Change callback scope

See merge request GNOME/gtk!3796
2021-08-10 01:16:56 +00:00
Benjamin Otte
ea07bf7536 Merge branch 'wip/otte/for-master' into 'master'
ngl: Make current when unrealizing

See merge request GNOME/gtk!3835
2021-08-08 01:09:31 +00:00
Benjamin Otte
80e6f1ca8c ngl: Make current when unrealizing
The profiler (at least) discards GL objects and we want to discard them
on the right context.
2021-08-08 02:17:08 +02:00
Matthias Clasen
54d29568ec Merge branch 'matthiasc/for-master' into 'master'
Cosmetics: Tweak css parser error messages

See merge request GNOME/gtk!3834
2021-08-07 22:48:32 +00:00
Matthias Clasen
4e1ea58503 Cosmetics: Tweak css parser error messages
These show up in tooltips, so they should a) be capitalized
and b) not end with a period.
2021-08-07 18:18:10 -04:00
Andre Klapper
90c429a91c Belarusian translation: Remove broken translation string 2021-08-07 19:10:23 +02:00
Andre Klapper
4b28e038e0 Khmer translation: Strip some invisible bytes from setting translations 2021-08-07 19:10:22 +02:00
Matthias Clasen
8df694a358 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Spruce up the hypertext demo

See merge request GNOME/gtk!3832
2021-08-07 16:56:56 +00:00
Yaron Shahrabani
eb8778e1cd Update Hebrew translation
(cherry picked from commit 11e6ce1751)
2021-08-07 16:51:55 +00:00
Matthias Clasen
256f3a0d60 gtk-demo: Spruce up the hypertext demo
Use the newish allow-breaks pango attribute
to make the text break better.
2021-08-07 12:35:17 -04:00
Danial Behzadi
54c087e7ec Update Persian translation 2021-08-07 14:48:55 +00:00
Danial Behzadi
69a99b89f9 Update Persian translation
(cherry picked from commit b467881274)
2021-08-07 14:45:02 +00:00
Matthias Clasen
f328ab9d83 Merge branch 'wip/chergert/revert-top-margin' into 'master'
Revert "textview: fix yoffset position when top_margin is set"

See merge request GNOME/gtk!3828
2021-08-06 13:13:21 +00:00
Chun-wei Fan
8acce5f294 gdk/win32: Drop local DnD protocol
It is basically not used by default and is pretty much broken at this point, so
it's about time to drop it.

Let's focus on fixing the OLE2 DnD protocol.
2021-08-06 17:16:27 +08:00
Matthias Clasen
bdbe0acd1f Merge branch 'matthiasc/for-master' into 'master'
settings: Default gtk-split-cursor to FALSE

See merge request GNOME/gtk!3827
2021-08-05 19:17:54 +00:00
Christian Hergert
fc701baef8 Revert "textview: fix yoffset position when top_margin is set"
This reverts commit 908b1e5e12.

This commit broke top-margin altogether.
2021-08-05 11:52:45 -07:00
Matthias Clasen
a457a81fd9 Merge branch 'matthiasc/for-master' into 'master'
text: Move setup code out of a loop

See merge request GNOME/gtk!3826
2021-08-05 18:45:39 +00:00
Matthias Clasen
4cc7977d36 settings: Default gtk-split-cursor to FALSE
According to Owen, this was the intention when the setting
was added in 2001. It only took us 20 years to fix the
default value.
2021-08-05 14:05:28 -04:00
Matthias Clasen
e5e7f5dd88 ci: Disable treeview-headers-hidden reftest
Somebody needs to figure out why it fails in ci so
frequently.
2021-08-05 12:41:04 -04:00
Matthias Clasen
916886312a Merge branch 'wip/exalm/shadow-extents' into 'master'
Shrink shadow extents

See merge request GNOME/gtk!3825
2021-08-05 16:39:52 +00:00
Matthias Clasen
8ff94ea1f2 text: Move setup code out of a loop
Just a cleanup, no functional change.
2021-08-05 12:31:18 -04:00
Matthias Clasen
053bd0cd31 Merge branch 'fix-tab-not-captured-in-popover' into 'master'
popovermenu: Cycle around focus also with (Shift+)Tab

Closes #3915

See merge request GNOME/gtk!3732
2021-08-05 02:07:43 +00:00
vanadiae
a3ce574193 popover: Cycle around focus with (Shift+)Tab
Same thing as the previous popovermenu commit, except for the base popover
because the popovermenu needs special behaviour with e.g. sides arrow so
we need to have the "cycle around" for regular popovers here too.
2021-08-04 12:11:44 +02:00
vanadiae
ef92adc87d popovermenu: Cycle around focus also with (Shift+)Tab
Currently when moving the focus with (Shift+)Tab, it also traverses the window's
widgets, although it would be expected that the focus stays within the popover,
as it's (almost) like it's a separate window. This would be consistent with
the behaviour of the Up/down arrows, which do cycle around the focus once it
reaches the end.

So this commit makes the popovermenu cycle around focus in any direction, apart
from left/right because they are used to open and close submenus and it wouldn't
make sense anyway to cycle horizontally as there's usually only one widget per
line.
2021-08-04 12:11:44 +02:00
Alexander Mikhaylenko
46a9538b6a Shrink shadow extents
Long time ago, Cairo shadows in both GTK3 and 4 were drawn at a size about
twice their radius. Eventually this was fixed but the shadow extents are
still calculated for the previous size and appear unreasonably large: for
example, 141px for a 50px radius shadow. This can get very noticeable in
places such as invisible window frame which gets included into screenshots.

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3419 just divides the
radius by 2 when drawing a shadow with Cairo, do the same when calculating
extents.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3841
2021-08-04 14:47:17 +05:00
Matthias Clasen
ca547b8716 Merge branch 'combobox-keynav' into 'master'
treepopover: Add keynav

See merge request GNOME/gtk!3822
2021-08-03 11:20:56 +00:00
Matthias Clasen
04ea51e843 treepopover: Start adding keynav
Arrange for the items to be focusable, and add keyboard
activation. Still missing: cycling focus inside the
popover.
2021-08-02 23:49:05 -04:00
Matthias Clasen
f7dc0dda4e Merge branch 'big-keysyms' into 'master'
imcontext: Treat keysyms as 32bit values

Closes #4149

See merge request GNOME/gtk!3819
2021-08-03 01:05:16 +00:00
Matthias Clasen
8713843022 Merge branch 'surround-test' into 'master'
Remove an unimplemented function

Closes #4151

See merge request GNOME/gtk!3820
2021-08-03 01:00:13 +00:00
Matthias Clasen
6563b05d60 Add some GtkIMContext tests
For now, these check that the surrounding handling
in GtkText and GtkTextView is sane.

Fixes: #4151
2021-08-02 20:44:40 -04:00
Matthias Clasen
d119c55b72 textview: Fix the get_surrounding implementation
This was, sadly, returning garbage.
2021-08-02 20:44:40 -04:00
Matthias Clasen
253e25a73c Add a private getter for the textview key controller
This will be used in tests.
2021-08-02 20:44:40 -04:00
Matthias Clasen
c63774967f Remove an unimplemented function
_gtk_entry_get_im_context does not exist.
2021-08-02 20:44:40 -04:00
Matthias Clasen
bbc36448fb imcontext: Treat keysyms as 32bit values
Our compose table format is still limited to 16bit
values for keysyms, but what we see in key events
can be 32bit values, and we treat them as such now.

Fixes: #4149
2021-08-02 19:16:18 -04:00
Matthias Clasen
5df323fb64 Merge branch 'fix-custom-widget-menu-focus' into 'master'
menusectionbox: Passthrough the focus function of custom widgets' gizmo

Closes gnome-text-editor#93

See merge request GNOME/gtk!3817
2021-08-02 22:21:08 +00:00
Matthias Clasen
0f2c5f13be Merge branch 'wip/otte/for-master' into 'master'
video: Use cross-fade transition to avoid resizes

See merge request GNOME/gtk!3815
2021-08-02 22:19:39 +00:00
Matthias Clasen
58180ad3be Merge branch 'fix-4144' into 'master'
gtkgesturerotate: Fix assertion

Closes #4144

See merge request GNOME/gtk!3818
2021-08-02 22:17:20 +00:00
James Westman
fb0229890b gtkgesturerotate: Fix assertion
Fixes #4144. An assertion would be printed when GtkGestureRotate was
used with a touchscreen.
2021-08-02 16:38:35 -05:00
vanadiae
9099888398 menusectionbox: Passthrough the focus function of custom widgets' gizmo
It broke keyboard focusing any widget added through the custom widget
menu feature. So for example if you put e.g. a custom check box widget
in a menu, you won't be able to focus it.

This is because the gizmo is mostly used to custom drawing with e.g.
CSS for small visual elements like scale markers. That's probably why
gizmo's default focus overrides block the focus from going through
the children. So this commit fixes it by overriding those and passing
the focus through the children.
2021-08-02 21:20:32 +02:00
Benjamin Otte
882855f865 video: Use cross-fade transition to avoid resizes
Slide animations cause changes in the size requests due to the
behavior of GtkRevealer. We can avoid those by using cross-fades, which
don't have that problem.

Besides, cross-fades look better anyway.
2021-08-02 20:11:32 +02:00
Matthias Clasen
f59d2ae89d Merge branch 'input-tweaks' into 'master'
imcontext: Tweak Compose sequence preedit

Closes #10, #4127, and #4124

See merge request GNOME/gtk!3799
2021-08-02 18:07:46 +00:00
Matthias Clasen
7c3a53a171 Merge branch 'fix-double-underscore-mnemonic' into 'master'
label: Ignore __ for mnemonics

Closes #4129

See merge request GNOME/gtk!3814
2021-08-02 03:54:29 +00:00
Matthias Clasen
1e22572716 Avoid pango deprecations
This function has been deprecated on the main
branch of pango. Since we don't want to bump our
pango dependency to 1.49 yet, ignore the deprecation.
2021-08-01 23:20:01 -04:00
Matthias Clasen
8a25f54e1f Add more label parsing tests
Test various combinations of underline and markup
parsing.
2021-08-01 23:19:00 -04:00
Matthias Clasen
c51f2fc0ec label: Ignore __ for mnemonics
We were not ignoring double underscores for mnemonics
in one place, as we should.

Fixes: #4129
2021-08-01 22:14:12 -04:00
Matthias Clasen
2a528df977 Merge branch 'titlebar-gesture' into 'master'
Delegate titlebar action to the compositor if possible

See merge request GNOME/gtk!3797
2021-08-02 01:14:08 +00:00
Piotr Drąg
84684bd56e Update Polish translation 2021-08-01 14:21:25 +02:00
Matthias Clasen
e1606ce8eb Merge branch 'color-glyph-fixes' into 'master'
gsk: Make color glyphs

Closes #4141

See merge request GNOME/gtk!3812
2021-07-31 20:54:39 +00:00
Matthias Clasen
47072e0441 Merge branch 'fix-iconhelper' into 'master'
iconhelper: Fix the paintable implementation

Closes #4140

See merge request GNOME/gtk!3809
2021-07-31 20:35:08 +00:00
Matthias Clasen
915c229396 gsk: Use harfbuzz for color fonts
harfbuzz has all the information we need, so we
can avoid poking directly at freetype apis. Also
drop the caching of color glyph information until
it turns out to be a problem.
2021-07-31 16:34:38 -04:00
Matthias Clasen
0bf46b4845 Bump the harfbuzz dep
We need 2.1.0, which has the hb_ot_color apis that we
are going to use in the next commit.
2021-07-31 16:34:38 -04:00
Matthias Clasen
a7a2dbc3ea gsk: Cache per-glyph color information
We don't really want to load the bitmaps every time
we create a render node, so do it once and cache the
information on the PangoFont.
2021-07-31 16:34:38 -04:00
Matthias Clasen
7e8f586859 ngl: Use per-glyph color information
Decide per-glyph whether we need color nor not.

Fixes: #4141
2021-07-31 16:34:24 -04:00
Matthias Clasen
bb9dccd773 gsk: Mark color glyphs
Steal a bit from PangoGlyphVisAttr to mark glyphs
that have color.
2021-07-31 16:34:24 -04:00
Emmanuele Bassi
7b743e662e Merge branch 'update-docs' into 'master'
docs: Update the URL for related documentation

See merge request GNOME/gtk!3813
2021-07-31 18:39:52 +00:00
Emmanuele Bassi
769dc53c05 docs: Update the URLs of related projects for GTK
And install the gi-docgen project file as well.
2021-07-31 19:08:34 +01:00
Emmanuele Bassi
1a4554daf3 docs: Update the URLs of related projects for GSK
And install the gi-docgen project file.
2021-07-31 19:07:18 +01:00
Emmanuele Bassi
6c0633ef61 docs: Update the URL for related documentation
And install the gi-docgen project files for GDK.
2021-07-31 19:05:33 +01:00
Emmanuele Bassi
4d020a3875 Merge branch 'docs-trigger' into 'master'
ci: Trigger a pages build

See merge request GNOME/gtk!3811
2021-07-31 17:16:26 +00:00
Emmanuele Bassi
316cc55e69 ci: Trigger a pages build
Do not publish the API reference directly, but trigger a CI pipeline for
the docs-gtk-org branch, which will then do the publishing.
2021-07-31 17:13:27 +01:00
Emmanuele Bassi
95f2634ea9 Merge branch 'iter-is-valid-docs' into 'master'
docs: Fix iter_is_valid() description

See merge request GNOME/gtk!3810
2021-07-31 13:07:07 +00:00
Emmanuele Bassi
95c032f531 docs: Fix iter_is_valid() description
Drop the "WARNING" and the block quote, and follow the existing
documentation style guidelines.
2021-07-31 13:41:13 +01:00
Matthias Clasen
744955753f iconhelper: Fix the paintable implementation
get_current_image was recursing due to an obvious typo.

Fixes: #4140
2021-07-31 08:27:17 -04:00
Matthias Clasen
ae5e7dc65d Merge branch 'glyph-cache-mystery' into 'master'
ngl: Bypass pango for glyph cache rendering

See merge request GNOME/gtk!3807
2021-07-31 00:38:41 +00:00
Matthias Clasen
ed41c46926 ngl: Bypass pango for glyph cache rendering
We can just use cairo directly here,
and cut out some layers of pango in the middle.
2021-07-30 19:46:07 -04:00
Matthias Clasen
a460fb2734 Merge branch 'check-activate' into 'master'
checkbutton: Some fixes when used with GActions

See merge request GNOME/gtk!3805
2021-07-30 23:39:17 +00:00
Matthias Clasen
39ddce6ba3 Merge branch 'fix/wm_class' into 'master'
x11: set a default value for program_class

Closes #4138

See merge request GNOME/gtk!3806
2021-07-30 23:25:08 +00:00
Matthias Clasen
8da7e3bdc3 Merge branch 'wip/otte/for-master' into 'master'
widget-factory: Expand the video to cover the whole frame

See merge request GNOME/gtk!3804
2021-07-30 22:43:29 +00:00
Vincent Bernat
eff53c023a x11: set a default value for program_class
This was also the behaviour with GTK 3. We use the capitalized program
name.

Fixes #4138

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
2021-07-30 23:22:32 +02:00
Benjamin Otte
99e4a6a2d6 widget-factory: Propagate natural size for text styles
This avoids them requiring scrolling.
2021-07-30 20:54:58 +02:00
Benjamin Otte
c06817b951 widget-factory: Make frames cooler
Instead of havoing a label for the video frame that clashes with the
background of the video, add a frame around the text styles box and add
a label for them. As a side benefit, it also makes it more obvious that
it is scrollable.

Note: Most of this patch is just reindenting.
2021-07-30 20:43:02 +02:00
Benjamin Otte
e765aaa3f4 widget-factory: Expand the video to cover the whole frame
1. This looks way cooler.

2. Since the frame is rounded, it adds a very visible test for our
   clipping of rounded rectangles.
2021-07-30 20:37:34 +02:00
Florian Müllner
1728aa581c checkbutton: Activate when moving focus
Currently we update the :active property on both the previous and
new focus button. That "visually activate" the button and will
emit ::toggled, but if the button is associated with an action,
the action state won't change.

Fix that by activating the new focus instead of explicitly fiddling
with the :active property.
2021-07-30 20:34:24 +02:00
Florian Müllner
c50475de34 checkbutton: Delegate ::activate to the helper if appropriate
If the button is associated with an action, the action is currently
only activated when the button is clicked, not when it is activated.
2021-07-30 20:34:24 +02:00
Mike Gorse
5d7ecb7a6e a11y: Remove unneeded check 2021-07-30 08:58:27 -05:00
Matthias Clasen
06348a8517 Merge branch 'wip/chergert/fix-4134' into 'master'
textview: fix yoffset position when top_margin is set

Closes #4134

See merge request GNOME/gtk!3801
2021-07-30 13:41:30 +00:00
Matthias Clasen
c4dbb8f01e imcontext: Code cleanup 2021-07-29 20:37:58 -04:00
Matthias Clasen
e67b2cb54b composetable: Allow multiple dead keys
Remove the limitation on the number of dead keys
that we match, and allow the result be be multiple
characters.

Regenerate the builtin sequences, since this changes
what dead key sequences we can reproduce algorithmically.

Update tests to match.

Fixes: #10
2021-07-29 20:37:30 -04:00
Christian Hergert
908b1e5e12 textview: fix yoffset position when top_margin is set
This doesn't need to be included in the calculation or it will cause the
yoffset to continually shift while the window is resized.

Fixes #4134
2021-07-29 16:45:04 -07:00
Matthias Clasen
539391ce6c composetable: Change an API
Make gtk_check_algorithmically take a GString
for the result. This is in preparation for allowing
multi-character results here, in the future.

Update all callers.
2021-07-29 17:29:25 -04:00
Mike Gorse
7fc90aed26 a11y: Send correct object reference for the root accessible 2021-07-29 15:55:58 -05:00
Florian Müllner
23e79d2eb2 gtk/windowhandle: Delegate titlebar action to the compositor if possible
Delegating the action to the compositor not only improves consistency
with server-side decorations, but also allows for actions that aren't
available client-side (like lower-in-middle-click).

https://gitlab.gnome.org/GNOME/mutter/-/issues/602
2021-07-29 21:39:32 +02:00
Florian Müllner
0c7b1431d7 gdk/toplevel: Add gdk_toplevel_titlebar_gesture()
Where supported, this allows delegating the titlebar action to the
compositor instead of trying to replicate its behavior client-side.

https://gitlab.gnome.org/GNOME/mutter/-/issues/602
2021-07-29 21:39:32 +02:00
Matthias Clasen
b6c0155836 imcontext: Handle Escape in Compose sequence
Treat Escape the same in hex sequences and in
Compose sequence: reset the state.
2021-07-29 08:39:17 -04:00
Matthias Clasen
76d67b586c imcontext: Tweak Compose sequence handling
When we don't have any matches for a Compose sequence
anymore, beep, and keep the preedit as it was for the
last match.

Fixes: #4127
2021-07-29 08:24:14 -04:00
Matthias Clasen
914edb1472 composetable: Add a prefix api
Add a function that computes the longest prefix
of a buffer for which a compose table has matches.
2021-07-29 08:23:40 -04:00
Matthias Clasen
dbf5033f94 composetable: Reduce the scope of a variable
'prefix' is not a good name for a file-scope variable,
move it into the sole function using it.
2021-07-29 08:22:52 -04:00
Matthias Clasen
cc6ecc8b62 Merge branch 'source-static-name' into 'master'
Avoid copying static debug strings

See merge request GNOME/gtk!3789
2021-07-29 11:59:02 +00:00
Matthias Clasen
b7e6922605 imcontext: Tweak Compose sequence preedit
When sequences contain multiple Compose keys,
don't hide the first one. This is a very fringe
case, but it matches the behavior of IBus.

Fixes: #4124
2021-07-29 07:36:48 -04:00
Matthias Clasen
05eaffb9f2 ci: Collect tools test output
This should help understanding why some of them fail.
2021-07-28 22:42:46 -04:00
Matthias Clasen
67b568f464 testsuite: Set TEST_RESULT_DIR for tools tests 2021-07-28 22:42:46 -04:00
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Florian Müllner
bc386c9a60 widget: Change callback scope
Look who changed his mind since commit 8e2ffb3b46 :-)

The "call" scope means that the callback is only used during the
function call itself (here: gtk_widget_class_install_action()).

That's clearly wrong here, as the callback is invoked every time
the action is activated.

Arguably the "notified" scope is a better match here, where the
lack of a GDestroyNotify parameter suggests that the callback may
be used forever (which is the case here).

Related: #3498
2021-07-28 21:48:01 +02:00
Matthias Clasen
db8b3419c2 Merge branch 'compose-parse-msvc' into 'master'
compose-parse.c: Include stdlib.h (fix build on Visual Studio)

See merge request GNOME/gtk!3794
2021-07-28 10:38:25 +00:00
Fabio Tomat
0f5ba5192a Update Friulian translation
(cherry picked from commit 16aa8dbad7)
2021-07-28 09:11:33 +00:00
Chun-wei Fan
108c423d70 compose-parse.c: Include stdlib.h
That is needed for exit(), and it may not have been included by the
other headers.
2021-07-28 15:18:36 +08:00
Emmanuele Bassi
dded10a396 Merge branch 'gi-fix' into 'master'
gdk: add missing Since annotation

See merge request GNOME/gtk!3790
2021-07-27 17:38:28 +00:00
Marc-André Lureau
1b080826db gdk: add missing Since annotation
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-07-27 21:01:31 +04:00
Matthias Clasen
910f23ea19 Merge branch 'wip/otte/widgetfactory-dnd' into 'master'
Improve DND

See merge request GNOME/gtk!3785
2021-07-27 04:12:58 +00:00
Benjamin Otte
f1b50baba1 widget-factory: Add images that support dnd
Just use the bottom left notebook for a GtkPicture with custom drag
source and drop target.
2021-07-27 04:40:57 +02:00
Matthias Clasen
4453597946 widget-factory: Some new backgrounds
Snowy wasn't ideal because of the aspect ratio.
Replace it by beach and nyc.
2021-07-27 04:40:42 +02:00
Benjamin Otte
192bfa10cb droptarget: Make formats construct-only writable
This way, it can be set in GtkBuilder.

Also make sure to only ever look at the GTypes set in the formats, as
GtkDropTarget cannot deal with mime types.
2021-07-27 04:28:04 +02:00
Benjamin Otte
0781429dc5 builder: Add support for GdkContentFormats 2021-07-27 04:28:04 +02:00
Benjamin Otte
d760332f00 testsuite: Add contentformat tests 2021-07-27 04:28:04 +02:00
Benjamin Otte
131be5f2e8 contentformats: Add gdk_content_formats_parse() 2021-07-27 04:13:42 +02:00
Matthias Clasen
57a95c540c Merge branch 'matthiasc/for-master' into 'master'
ngl: Cosmetics

See merge request GNOME/gtk!3786
2021-07-26 18:21:56 +00:00
Matthias Clasen
09deb1d757 ngl: Cosmetics
Use the macro we already have to check that colors
are fully transparent.
2021-07-26 13:42:10 -04:00
Benjamin Otte
6a5d555f58 contentformats: Change the format of gdk_content_formats_to_string()
Now, we just print a whitespace-separated list of GTypes and mime types.

This makes this neat for 2 things:

1. Parsing it (see next commit)
2. Using it in GtkBuilder (see commits after that)

In particular, the common case of supporting a single GType (or mime
type) looks like just printing the GType (or mime type), which in
GtkBuilder looks like
<property name="formats">GdkTexture</property>
2021-07-26 02:28:49 +02:00
Benjamin Otte
f5dc71021f dnd: Guard drags with a reference when finishing
Usually the "dnd-finished" signal will be used to unref the GdkDrag. In
those cases, we would lose the object, so that when we do the final
drag_drop_done() afterwards, we wouldn't have a remaining reference.

With the reference guard, this now works.
2021-07-26 02:18:54 +02:00
356 changed files with 64456 additions and 70074 deletions

View File

@@ -7,6 +7,7 @@ stages:
- analysis
- docs
- flatpak
- publish
- deploy
.cache-paths: &cache-paths
@@ -24,7 +25,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v32"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v33"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -57,6 +58,7 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/report*.xml"
- "${CI_PROJECT_DIR}/_build/report*.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
@@ -336,14 +338,11 @@ reference:
paths:
- _reference
pages:
stage: deploy
publish-docs:
stage: publish
needs: ['reference']
script:
- mv _reference/ public/
- cp .gitlab-ci/pages/* public/
artifacts:
paths:
- public
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
only:
- master
refs:
- master

View File

@@ -48,7 +48,9 @@ RUN dnf -y install \
libcloudproviders-devel \
libepoxy-devel \
libffi-devel \
libjpeg-turbo-devel \
libmount-devel \
libpng-devel \
librsvg2 \
libselinux-devel \
libubsan \

View File

@@ -40,7 +40,7 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
if ! pkg-config --atleast-version=2.65.0 glib-2.0; then
if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
meson setup _glib_build _glib
meson compile -C _glib_build
@@ -48,7 +48,7 @@ if ! pkg-config --atleast-version=2.65.0 glib-2.0; then
fi
pkg-config --modversion glib-2.0
if ! pkg-config --atleast-version=1.47.0 pango; then
if ! pkg-config --atleast-version=1.49.1 pango; then
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
meson setup _pango_build _pango
meson compile -C _pango_build

81
NEWS
View File

@@ -1,3 +1,84 @@
Overview of Changes
===================
* gsk:
- Drop the GL renderer in favor of NGL
* css:
- Add support for line-height
- Add support for text-transform
* GtkTextView:
- Add support for line height
- Add support for text transforms
* Build:
- Require Pango 1.49
Overview of Changes in 4.4.0
============================
* Input:
- Match IBus for display of Compose sequences
- Match IBus for handling of mismatches
- Handle Escape in Compose sequences
- Allow multiple dead keys
- Support 32bit keysyms
* GtkCheckButton:
- Activate when moving focus
* GtkLabel:
- Propertly ignore double underscores for mnemonics
* GtkPopoverMenu:
- Fix focus cycling
* GtkTextView:
- Improve word selection
- Fix block cursors on empty lines
* GdkToplevel:
- Support the gnome-shell titlebar gesture protocol
* GdkDropTarget:
- Allow creating drop targets in ui files
* gsk:
- Handle partial color fonts correctly
- Use harfbuzz for color font information
- Avoid pango for glyph cache rendering
- Shrink shadow extents
* Settings:
- Change the default for gtk-split-cursor to FALSE
* Demos:
- Small improvements to widget-factory
- gtk-demo: Improve the hypertext demo
- gtk-dem: Improve the clipboard demo
* X11:
- Set WM_CLASS on toplevels
* Wayland:
- Support wl_seat v7
* Windows:
- Drop the local DND protocol
- Avoid WGL if shaders don't work
- Use WinPointer API
* Translation updates:
Belarusian
Friulian
Hebrew
Khmer
Persian
Polish
Overview of Changes in 4.3.2
============================

View File

@@ -321,6 +321,7 @@
<file>paintable_emblem.c</file>
<file>paintable_mediastream.c</file>
<file>paintable_svg.c</file>
<file>paintable_symbolic.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>peg_solitaire.c</file>

View File

@@ -100,7 +100,11 @@ prepare_drag (GtkDragSource *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);
/* Textures can be serialized, paintables can't, so special case the textures */
if (GDK_IS_TEXTURE (paintable))
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, paintable);
else
return gdk_content_provider_new_typed (GDK_TYPE_PAINTABLE, paintable);
}
static gboolean
@@ -129,7 +133,11 @@ copy_image (GtkWidget *widget,
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (demo->image));
GValue value = G_VALUE_INIT;
g_value_init (&value, GDK_TYPE_PAINTABLE);
/* Textures can be serialized, paintables can't, so special case the textures */
if (GDK_IS_TEXTURE (paintable))
g_value_init (&value, GDK_TYPE_TEXTURE);
else
g_value_init (&value, GDK_TYPE_PAINTABLE);
g_value_set_object (&value, paintable);
gdk_clipboard_set_value (clipboard, &value);
g_value_unset (&value);
@@ -138,24 +146,46 @@ copy_image (GtkWidget *widget,
g_object_unref (paintable);
}
static void
paste_image_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
DemoImage *demo = DEMO_IMAGE (data);
const GValue *value;
value = gdk_clipboard_read_value_finish (clipboard, result, NULL);
if (value == NULL)
{
gtk_widget_error_bell (GTK_WIDGET (demo));
g_object_unref (demo);
return;
}
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), g_value_get_object (value));
g_object_unref (demo);
}
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;
GType type;
g_value_init (&value, GDK_TYPE_PAINTABLE);
if (!gdk_content_provider_get_value (content, &value, NULL))
return;
if (gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GDK_TYPE_TEXTURE))
type = GDK_TYPE_TEXTURE;
else
type = GDK_TYPE_PAINTABLE;
paintable = GDK_PAINTABLE (g_value_get_object (&value));
gtk_image_set_from_paintable (GTK_IMAGE (demo->image), paintable);
g_value_unset (&value);
gdk_clipboard_read_value_async (clipboard,
type,
G_PRIORITY_DEFAULT,
NULL,
paste_image_cb,
g_object_ref (widget));
}
static void

View File

@@ -131,6 +131,19 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
#define VOID_ATTR(attr_name) \
{ \
tag = gtk_text_tag_table_lookup (table, #attr_name); \
if (!tag) \
{ \
tag = gtk_text_tag_new (#attr_name); \
g_object_set (tag, #attr_name, TRUE, NULL); \
gtk_text_tag_table_add (table, tag); \
g_object_unref (tag); \
} \
gtk_text_buffer_apply_tag (buffer, tag, start, end); \
}
fg_alpha = bg_alpha = 1.;
attrs = pango_attr_iterator_get_attrs (iter);
@@ -255,6 +268,29 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
INT_ATTR (insert_hyphens);
break;
case PANGO_ATTR_LINE_HEIGHT:
FLOAT_ATTR (line_height);
break;
case PANGO_ATTR_ABSOLUTE_LINE_HEIGHT:
break;
case PANGO_ATTR_WORD:
VOID_ATTR (word);
break;
case PANGO_ATTR_SENTENCE:
VOID_ATTR (sentence);
break;
case PANGO_ATTR_BASELINE_SHIFT:
INT_ATTR (baseline_shift);
break;
case PANGO_ATTR_FONT_SCALE:
INT_ATTR (font_scale);
break;
case PANGO_ATTR_SHAPE:
case PANGO_ATTR_ABSOLUTE_SIZE:
case PANGO_ATTR_GRAVITY:
@@ -263,6 +299,10 @@ insert_tags_for_attributes (GtkTextBuffer *buffer,
case PANGO_ATTR_BACKGROUND_ALPHA:
break;
case PANGO_ATTR_TEXT_TRANSFORM:
INT_ATTR (text_transform);
break;
case PANGO_ATTR_INVALID:
default:
g_assert_not_reached ();

View File

@@ -1,6 +1,11 @@
/* Pango/Font Rendering
*
* Demonstrates various aspects of font rendering.
* Demonstrates various aspects of font rendering,
* such as hinting, antialiasing and grid alignment.
*
* The demo lets you explore font rendering options
* interactively to get a feeling for they affect the
* shape and positioning of the glyphs.
*/
#include <gtk/gtk.h>
@@ -10,16 +15,21 @@ static GtkWidget *font_button = NULL;
static GtkWidget *entry = NULL;
static GtkWidget *image = NULL;
static GtkWidget *hinting = NULL;
static GtkWidget *anti_alias = NULL;
static GtkWidget *hint_metrics = NULL;
static GtkWidget *up_button = NULL;
static GtkWidget *down_button = NULL;
static GtkWidget *text_radio = NULL;
static GtkWidget *show_grid = NULL;
static GtkWidget *show_extents = NULL;
static GtkWidget *show_pixels = NULL;
static GtkWidget *show_outlines = NULL;
static PangoContext *context;
static int scale = 9;
static int scale = 7;
static double pixel_alpha = 1.0;
static double outline_alpha = 0.0;
static void
update_image (void)
@@ -37,6 +47,8 @@ update_image (void)
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
cairo_antialias_t antialias;
cairo_path_t *path;
if (!context)
context = gtk_widget_create_pango_context (image);
@@ -65,6 +77,13 @@ update_image (void)
hintmetrics = CAIRO_HINT_METRICS_OFF;
cairo_font_options_set_hint_metrics (fopt, hintmetrics);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (anti_alias)))
antialias = CAIRO_ANTIALIAS_GRAY;
else
antialias = CAIRO_ANTIALIAS_NONE;
cairo_font_options_set_antialias (fopt, antialias);
pango_context_set_round_glyph_positions (context, hintmetrics == CAIRO_HINT_METRICS_ON);
pango_cairo_context_set_font_options (context, fopt);
cairo_font_options_destroy (fopt);
pango_context_changed (context);
@@ -85,10 +104,14 @@ update_image (void)
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_source_rgba (cr, 0, 0, 0, pixel_alpha);
cairo_move_to (cr, 10, 10);
pango_cairo_show_layout (cr, layout);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path (cr);
cairo_destroy (cr);
g_object_unref (layout);
@@ -127,7 +150,7 @@ update_image (void)
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_extents)))
{
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (logical.x)) - 0.5,
@@ -140,7 +163,7 @@ update_image (void)
cairo_line_to (cr, scale * (10 + pango_units_to_double (logical.x + logical.width)) + 1,
scale * (10 + pango_units_to_double (baseline)) - 0.5);
cairo_stroke (cr);
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
@@ -149,8 +172,36 @@ update_image (void)
cairo_stroke (cr);
}
for (int i = 0; i < path->num_data; i += path->data[i].header.length)
{
cairo_path_data_t *data = &path->data[i];
switch (data->header.type)
{
case CAIRO_PATH_CURVE_TO:
data[3].point.x *= scale; data[3].point.y *= scale;
data[2].point.x *= scale; data[2].point.y *= scale;
data[1].point.x *= scale; data[1].point.y *= scale;
break;
case CAIRO_PATH_LINE_TO:
case CAIRO_PATH_MOVE_TO:
data[1].point.x *= scale; data[1].point.y *= scale;
break;
case CAIRO_PATH_CLOSE_PATH:
break;
default:
g_assert_not_reached ();
}
}
cairo_set_source_rgba (cr, 0, 0, 1, outline_alpha);
cairo_move_to (cr, scale * 20 - 0.5, scale * 20 - 0.5);
cairo_append_path (cr, path);
cairo_stroke (cr);
cairo_surface_destroy (surface);
cairo_destroy (cr);
cairo_path_destroy (path);
}
else
{
@@ -158,10 +209,26 @@ update_image (void)
PangoLayoutRun *run;
PangoGlyphInfo *g;
int i, j;
GString *str;
gunichar ch;
if (*text == '\0')
text = " ";
ch = g_utf8_get_char (text);
str = g_string_new ("");
for (i = 0; i < 4; i++)
{
g_string_append_unichar (str, ch);
g_string_append_unichar (str, 0x200c);
}
layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, "aaaa", -1);
pango_layout_set_text (layout, str->str, -1);
g_string_free (str, TRUE);
pango_layout_get_extents (layout, &ink, &logical);
pango_extents_to_pixels (&logical, NULL);
@@ -176,7 +243,7 @@ update_image (void)
cairo_set_source_rgb (cr, 0, 0, 0);
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[i]);
g = &(run->glyphs->glyphs[2*i]);
g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
}
@@ -184,7 +251,7 @@ update_image (void)
{
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[i]);
g = &(run->glyphs->glyphs[2*i]);
g->geometry.x_offset = i * (PANGO_SCALE / 4);
g->geometry.y_offset = j * (PANGO_SCALE / 4);
}
@@ -203,7 +270,6 @@ update_image (void)
cairo_surface_destroy (surface);
}
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
@@ -211,6 +277,78 @@ update_image (void)
pango_font_description_free (desc);
}
static gboolean fading = FALSE;
static double start_pixel_alpha;
static double end_pixel_alpha;
static double start_outline_alpha;
static double end_outline_alpha;
static gint64 start_time;
static gint64 end_time;
static double
ease_out_cubic (double t)
{
double p = t - 1;
return p * p * p + 1;
}
static gboolean
change_alpha (GtkWidget *widget,
GdkFrameClock *clock,
gpointer user_data)
{
gint64 now = g_get_monotonic_time ();
double t;
t = ease_out_cubic ((now - start_time) / (double) (end_time - start_time));
pixel_alpha = start_pixel_alpha + (end_pixel_alpha - start_pixel_alpha) * t;
outline_alpha = start_outline_alpha + (end_outline_alpha - start_outline_alpha) * t;
update_image ();
if (now >= end_time)
{
fading = FALSE;
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
}
static void
start_alpha_fade (void)
{
gboolean pixels;
gboolean outlines;
if (fading)
return;
pixels = gtk_check_button_get_active (GTK_CHECK_BUTTON (show_pixels));
outlines = gtk_check_button_get_active (GTK_CHECK_BUTTON (show_outlines));
start_pixel_alpha = pixel_alpha;
if (pixels && outlines)
end_pixel_alpha = 0.5;
else if (pixels)
end_pixel_alpha = 1;
else
end_pixel_alpha = 0;
start_outline_alpha = outline_alpha;
if (outlines)
end_outline_alpha = 1.0;
else
end_outline_alpha = 0.0;
start_time = g_get_monotonic_time ();
end_time = start_time + G_TIME_SPAN_SECOND / 2;
fading = TRUE;
gtk_widget_add_tick_callback (window, change_alpha, NULL, NULL);
}
static void
update_buttons (void)
{
@@ -218,20 +356,26 @@ update_buttons (void)
gtk_widget_set_sensitive (down_button, scale > 1);
}
static void
scale_up (void)
static gboolean
scale_up (GtkWidget *widget,
GVariant *args,
gpointer user_data)
{
scale += 1;
update_buttons ();
update_image ();
return TRUE;
}
static void
scale_down (void)
static gboolean
scale_down (GtkWidget *widget,
GVariant *args,
gpointer user_data)
{
scale -= 1;
update_buttons ();
update_image ();
return TRUE;
}
GtkWidget *
@@ -252,20 +396,26 @@ do_fontrendering (GtkWidget *do_widget)
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
hinting = GTK_WIDGET (gtk_builder_get_object (builder, "hinting"));
anti_alias = GTK_WIDGET (gtk_builder_get_object (builder, "antialias"));
hint_metrics = GTK_WIDGET (gtk_builder_get_object (builder, "hint_metrics"));
text_radio = GTK_WIDGET (gtk_builder_get_object (builder, "text_radio"));
show_grid = GTK_WIDGET (gtk_builder_get_object (builder, "show_grid"));
show_extents = GTK_WIDGET (gtk_builder_get_object (builder, "show_extents"));
show_pixels = GTK_WIDGET (gtk_builder_get_object (builder, "show_pixels"));
show_outlines = GTK_WIDGET (gtk_builder_get_object (builder, "show_outlines"));
g_signal_connect (up_button, "clicked", G_CALLBACK (scale_up), NULL);
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_grid, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_pixels, "notify::active", G_CALLBACK (start_alpha_fade), NULL);
g_signal_connect (show_outlines, "notify::active", G_CALLBACK (start_alpha_fade), NULL);
update_image ();

View File

@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="scale_adj">
<property name="upper">24</property>
<property name="step-increment">1</property>
<property name="page-increment">4</property>
</object>
<object class="GtkWindow" id="window">
<property name="default-width">1080</property>
<property name="default-height">430</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="title">
@@ -87,35 +82,62 @@
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<object class="GtkCheckButton" id="show_pixels">
<property name="label">Show _Pixels</property>
<property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">3</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<object class="GtkCheckButton" id="show_outlines">
<property name="label">Show _Outline</property>
<property name="use-underline">1</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="label">_Hinting</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">hinting</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
</object>
</child>
<layout>
<property name="column">4</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<property name="label">Hint Metrics</property>
<object class="GtkCheckButton" id="antialias">
<property name="label">_Antialias</property>
<property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">4</property>
<property name="row">1</property>
@@ -123,21 +145,31 @@
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="label">Show Extents</property>
<property name="active">1</property>
<object class="GtkCheckButton" id="hint_metrics">
<property name="label">Hint _Metrics</property>
<property name="use-underline">1</property>
<layout>
<property name="column">5</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="label">Show _Extents</property>
<property name="use-underline">1</property>
<layout>
<property name="column">6</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<property name="label">Show Grid</property>
<property name="label">Show _Grid</property>
<property name="use-underline">1</property>
<layout>
<property name="column">5</property>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
@@ -148,8 +180,19 @@
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Control&gt;plus</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
<layout>
<property name="column">6</property>
<property name="column">7</property>
<property name="row">0</property>
</layout>
</object>
@@ -160,8 +203,19 @@
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Control&gt;minus</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
<layout>
<property name="column">6</property>
<property name="column">7</property>
<property name="row">1</property>
</layout>
</object>
@@ -170,7 +224,7 @@
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="column">7</property>
<property name="column">8</property>
</layout>
</object>
</child>

View File

@@ -61,12 +61,26 @@ show_page (GtkTextView *text_view,
int page)
{
GtkTextBuffer *buffer;
GtkTextIter iter;
GtkTextIter iter, start;
GtkTextMark *mark;
GtkWidget *child;
GtkTextChildAnchor *anchor;
GtkEventController *controller;
GtkTextTag *bold, *mono, *nobreaks;
buffer = gtk_text_view_get_buffer (text_view);
bold = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD,
"scale", PANGO_SCALE_X_LARGE,
NULL);
mono = gtk_text_buffer_create_tag (buffer, NULL,
"family", "monospace",
NULL);
nobreaks = gtk_text_buffer_create_tag (buffer, NULL,
"allow-breaks", FALSE,
NULL);
gtk_text_buffer_set_text (buffer, "", 0);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
gtk_text_buffer_begin_irreversible_action (buffer);
@@ -104,17 +118,22 @@ show_page (GtkTextView *text_view,
}
else if (page == 2)
{
GtkTextTag *tag;
mark = gtk_text_buffer_create_mark (buffer, "mark", &iter, TRUE);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD,
"scale", PANGO_SCALE_X_LARGE,
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, tag, NULL);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"family", "monospace",
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, " /tag/ ", -1, tag, NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, bold, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
gtk_text_buffer_move_mark (buffer, mark, &iter);
gtk_text_buffer_insert_with_tags (buffer, &iter, "tag", -1, mono, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
child = gtk_image_new_from_icon_name ("audio-volume-high-symbolic");
@@ -132,20 +151,26 @@ show_page (GtkTextView *text_view,
"behavior of mouse and key presses, “lock” a range of text so the "
"user can't edit it, or countless other things.\n", -1);
insert_link (buffer, &iter, "Go back", 1);
gtk_text_buffer_delete_mark (buffer, mark);
}
else if (page == 3)
{
GtkTextTag *tag;
mark = gtk_text_buffer_create_mark (buffer, "mark", &iter, TRUE);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD,
"scale", PANGO_SCALE_X_LARGE,
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext", -1, tag, NULL);
tag = gtk_text_buffer_create_tag (buffer, NULL,
"family", "monospace",
NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, " /ˈhaɪ pərˌtɛkst/ ", -1, tag, NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext", -1, bold, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
gtk_text_buffer_move_mark (buffer, mark, &iter);
gtk_text_buffer_insert_with_tags (buffer, &iter, "ˈhaɪ pərˌtɛkst", -1, mono, NULL);
gtk_text_buffer_insert (buffer, &iter, " /", -1);
gtk_text_buffer_get_iter_at_mark (buffer, &start, mark);
gtk_text_buffer_apply_tag (buffer, nobreaks, &start, &iter);
gtk_text_buffer_insert (buffer, &iter, " ", -1);
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
child = gtk_image_new_from_icon_name ("audio-volume-high-symbolic");
@@ -159,6 +184,8 @@ show_page (GtkTextView *text_view,
"Machine-readable text that is not sequential but is organized "
"so that related items of information are connected.\n", -1);
insert_link (buffer, &iter, "Go back", 1);
gtk_text_buffer_delete_mark (buffer, mark);
}
gtk_text_buffer_end_irreversible_action (buffer);
}
@@ -358,7 +385,7 @@ do_hypertext (GtkWidget *do_widget)
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);

View File

@@ -58,7 +58,7 @@ do_markup (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 680);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
stack = gtk_stack_new ();

View File

@@ -1,5 +1,9 @@
Text sizes: <span size="xx-small">tiny</span> <span size="x-small">very small</span> <span size="small">small</span> <span size="medium">normal</span> <span size="large">large</span> <span size="x-large">very large</span> <span size="xx-large">huge</span>
Text sizes: <span size="xx-small">tiny </span><span size="x-small">very small </span><span size="small">small </span><span size="medium">normal </span><span size="large">large </span><span size="x-large">very large </span><span size="xx-large">huge</span>
Text styles: <span style="normal">Normal</span> <span style="italic">Italic</span> <span style="oblique">Olique</span>
Text weights: <span weight="thin">thin</span> <span weight="light">light</span> <span weight="normal">normal</span> <span weight="bold">bold</span> <span weight="ultraheavy">ultraheavy</span>
Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span> and <span background="pink">backgrounds</span>
@@ -15,6 +19,12 @@ OpenType font features: <span font_desc="sans regular" font_features="dlig=0">fe
Shortcuts: <tt>Monospace</tt> <b>Bold</b> <i>Italic</i> <big>Big</big> <small>Small</small> <u>Underlined</u> <s>Strikethrough</s> Super<sup>script</sup> Sub<sub>script</sub>
<span allow_breaks="false">A</span> hy­phen­ation al­go­rithm is a set of rules, espe­ci­ally one co­di­fied for im­ple­men­tation in a com­pu­ter pro­gram, that de­ci­des at which points a word can be bro­ken over two lines with a hy­phen. For ex­am­ple, a hy­phen­ation al­go­rithm might de­cide that im­peach­ment can be broken as <span allow_breaks="false">impeach‧ment</span> or <span allow_breaks="false">im‧peachment</span> but not <span allow_breaks="false">impe‧achment.</span>
hy­phen­ation al­go­rithm is a <span allow_breaks="false" style="italic">set of rules</span>, espe­ci­ally one co­di­fied for im­ple­men­tation in a com­pu­ter pro­gram, that de­ci­des at which points a word can be bro­ken over two lines with a hy­phen. For ex­am­ple, a hy­phen­ation al­go­rithm might de­cide that im­peach­ment can be broken as impeach‧ment or im‧peachment but not impe‧achment.
<span insert_hyphens="false">one/two three/four five/six seven/eight nine/ten</span>
<span line_height='1.33'>Line height: This is an example of widely spaced text. It was achieved by setting the line-height factor to 1.33. You can set the line-height factor to any value between 0 and 10.
Note that the line height affects the spacing between paragraphs as well as between the wrapped lines inside a paragraph.</span>
Transforms: <span text_transform='uppercase'>straße</span> <span text_transform='capitalize'>up, up and away</span>

View File

@@ -67,6 +67,7 @@ demos = files([
'paintable_animated.c',
'paintable_emblem.c',
'paintable_mediastream.c',
'paintable_symbolic.c',
'panes.c',
'password_entry.c',
'peg_solitaire.c',

View File

@@ -45,26 +45,27 @@ struct _GtkNuclearIconClass
* so that it can be called from all the other demos, too.
*/
void
gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double width,
double height,
double rotation,
gboolean draw_background)
gtk_nuclear_snapshot (GtkSnapshot *snapshot,
const GdkRGBA *foreground,
const GdkRGBA *background,
double width,
double height,
double rotation)
{
#define RADIUS 0.3
cairo_t *cr;
double size;
if (draw_background)
gtk_snapshot_append_color (snapshot,
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
&GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_append_color (snapshot,
background,
&GRAPHENE_RECT_INIT (0, 0, width, height));
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
(height - size) / 2.0,
size, size));
gdk_cairo_set_source_rgba (cr, foreground);
cairo_translate (cr, width / 2.0, height / 2.0);
cairo_scale (cr, size, size);
cairo_rotate (cr, rotation);
@@ -94,9 +95,10 @@ gtk_nuclear_icon_snapshot (GdkPaintable *paintable,
*/
gtk_nuclear_snapshot (snapshot,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, /* yellow */
width, height,
nuclear->rotation,
TRUE);
nuclear->rotation);
}
static GdkPaintableFlags

View File

@@ -4,10 +4,11 @@
#include <gtk/gtk.h>
void gtk_nuclear_snapshot (GtkSnapshot *snapshot,
const GdkRGBA *foreground,
const GdkRGBA *background,
double width,
double height,
double rotation,
gboolean draw_background);
double rotation);
GdkPaintable * gtk_nuclear_icon_new (double rotation);
GdkPaintable * gtk_nuclear_animation_new (gboolean draw_background);

View File

@@ -65,9 +65,12 @@ gtk_nuclear_animation_snapshot (GdkPaintable *paintable,
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
nuclear->draw_background
? &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 } /* yellow */
: &(GdkRGBA) { 0, 0, 0, 0 }, /* transparent */
width, height,
2 * G_PI * nuclear->progress / MAX_PROGRESS,
nuclear->draw_background);
2 * G_PI * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintable *

View File

@@ -73,9 +73,10 @@ gtk_nuclear_media_stream_snapshot (GdkPaintable *paintable,
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, /* yellow */
width, height,
2 * G_PI * nuclear->progress / DURATION,
TRUE);
2 * G_PI * nuclear->progress / DURATION);
}
static GdkPaintable *

View File

@@ -0,0 +1,208 @@
/* Paintable/Symbolic Paintable
*
* GdkPaintables can be made to follow the theme's colors. GTK calls
* icons that do this symbolic icons, paintables that want to have
* the same effect can implement the GtkSymbolicPaintable interface.
*
* We will adapt the original paintable example by adding the ability
* to recolor the paintable based on the symbolic colors.
*/
#include <gtk/gtk.h>
#include "paintable.h"
static GtkWidget *window = NULL;
/* First, add the boilerplate for the object itself.
* This part would normally go in the header.
*/
#define GTK_TYPE_NUCLEAR_SYMBOLIC (gtk_nuclear_symbolic_get_type ())
G_DECLARE_FINAL_TYPE (GtkNuclearSymbolic, gtk_nuclear_symbolic, GTK, NUCLEAR_SYMBOLIC, GObject)
/* Declare a few warning levels, so we can pick colors based on them */
typedef enum
{
WARNING_NONE,
WARNING_ALERT,
WARNING_EMERGENCY
} WarningLevel;
/* Declare the struct. */
struct _GtkNuclearSymbolic
{
GObject parent_instance;
WarningLevel warning_level;
};
struct _GtkNuclearSymbolicClass
{
GObjectClass parent_class;
};
/* Add a function to draw the nuclear icon in the given colors */
static void
gtk_nuclear_symbolic_snapshot_symbolic (GtkSymbolicPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height,
const GdkRGBA *colors,
gsize n_colors)
{
GtkNuclearSymbolic *self = GTK_NUCLEAR_SYMBOLIC (paintable);
static const GdkRGBA transparent = { 0, };
const GdkRGBA *bg_color;
/* select the right background color from the warning level */
switch (self->warning_level)
{
case WARNING_NONE:
bg_color = &transparent;
break;
case WARNING_ALERT:
bg_color = &colors[GTK_SYMBOLIC_COLOR_WARNING];
break;
case WARNING_EMERGENCY:
bg_color = &colors[GTK_SYMBOLIC_COLOR_ERROR];
break;
default:
/* This should never happen, but we better do defensive coding
* with this critical icon */
g_assert_not_reached ();
bg_color = &transparent;
break;
}
/* Draw the icon with the selected warning color */
gtk_nuclear_snapshot (snapshot,
&colors[GTK_SYMBOLIC_COLOR_FOREGROUND],
bg_color,
width, height,
0);
}
static void
gtk_nuclear_symbolic_symbolic_paintable_init (GtkSymbolicPaintableInterface *iface)
{
iface->snapshot_symbolic = gtk_nuclear_symbolic_snapshot_symbolic;
}
/* We need to implement the functionality required by the GdkPaintable interface */
static void
gtk_nuclear_symbolic_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
/* Calling this function without passing a color is a neat trick
* to make GTK use default colors and otherwise forward the call
* to the snapshotting function above.
*/
gtk_symbolic_paintable_snapshot_symbolic (GTK_SYMBOLIC_PAINTABLE (paintable),
snapshot,
width, height,
NULL, 0);
}
static GdkPaintableFlags
gtk_nuclear_symbolic_get_flags (GdkPaintable *paintable)
{
/* This image has a static size, but the contents may change:
* We draw different things when the warning level changes.
*/
return GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_nuclear_symbolic_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gtk_nuclear_symbolic_snapshot;
iface->get_flags = gtk_nuclear_symbolic_get_flags;
}
/* When defining the GType, we need to implement bot the GdkPaintable
* and the GtkSymbolicPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkNuclearSymbolic, gtk_nuclear_symbolic, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_nuclear_symbolic_paintable_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_SYMBOLIC_PAINTABLE,
gtk_nuclear_symbolic_symbolic_paintable_init))
static void
gtk_nuclear_symbolic_class_init (GtkNuclearSymbolicClass *klass)
{
}
static void
gtk_nuclear_symbolic_init (GtkNuclearSymbolic *nuclear)
{
}
/* And finally, we add the simple constructor we declared in the header. */
GdkPaintable *
gtk_nuclear_symbolic_new (void)
{
return g_object_new (GTK_TYPE_NUCLEAR_SYMBOLIC, NULL);
}
/* Add some fun feature to the button */
static void
nuclear_button_clicked (GtkButton *button,
GtkNuclearSymbolic *nuclear)
{
if (nuclear->warning_level >= WARNING_EMERGENCY)
{
/* On maximum warning level, reset the warning */
nuclear->warning_level = WARNING_NONE;
/* And sometimes (but not always to confuse people)
* close the window.
*/
if (g_random_boolean ())
gtk_window_close (GTK_WINDOW (window));
}
else
{
/* Otherwise just increase the warning level */
nuclear->warning_level++;
}
/* Don't forget to emit the signal causing the paintable to redraw.
* Changing the warning level changes the background color after all.
*/
gdk_paintable_invalidate_contents (GDK_PAINTABLE (nuclear));
}
GtkWidget *
do_paintable_symbolic (GtkWidget *do_widget)
{
GdkPaintable *nuclear;
GtkWidget *image, *button;
if (!window)
{
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Don't click!");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
button = gtk_button_new ();
gtk_window_set_child (GTK_WINDOW (window), button);
nuclear = gtk_nuclear_symbolic_new ();
image = gtk_image_new_from_paintable (nuclear);
gtk_button_set_child (GTK_BUTTON (button), image);
g_signal_connect (button, "clicked", G_CALLBACK (nuclear_button_clicked), nuclear);
g_object_unref (nuclear);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -24,7 +24,6 @@
#include "gtkrendererpaintableprivate.h"
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/gl/gskglrenderer.h"
#include "gsk/ngl/gsknglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
@@ -61,7 +60,7 @@ struct _NodeEditorWindow
GtkWidget *renderer_listbox;
GListStore *renderers;
GdkPaintable *paintable;
GskRenderNode *node;
GFileMonitor *file_monitor;
@@ -168,7 +167,6 @@ static void
text_changed (GtkTextBuffer *buffer,
NodeEditorWindow *self)
{
GskRenderNode *node;
char *text;
GBytes *bytes;
GtkTextIter iter;
@@ -179,10 +177,12 @@ text_changed (GtkTextBuffer *buffer,
text_buffer_remove_all_tags (self->text_buffer);
bytes = g_bytes_new_take (text, strlen (text));
g_clear_pointer (&self->node, gsk_render_node_unref);
/* If this is too slow, go fix the parser performance */
node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
self->node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
g_bytes_unref (bytes);
if (node)
if (self->node)
{
/* XXX: Is this code necessary or can we have API to turn nodes into paintables? */
GtkSnapshot *snapshot;
@@ -191,10 +191,9 @@ text_changed (GtkTextBuffer *buffer,
guint i;
snapshot = gtk_snapshot_new ();
gsk_render_node_get_bounds (node, &bounds);
gsk_render_node_get_bounds (self->node, &bounds);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- bounds.origin.x, - bounds.origin.y));
gtk_snapshot_append_node (snapshot, node);
gsk_render_node_unref (node);
gtk_snapshot_append_node (snapshot, self->node);
paintable = gtk_snapshot_free_to_paintable (snapshot, &bounds.size);
gtk_picture_set_paintable (GTK_PICTURE (self->picture), paintable);
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i++)
@@ -338,15 +337,9 @@ text_view_query_tooltip_cb (GtkWidget *widget,
}
static gboolean
load_file_contents (NodeEditorWindow *self,
GFile *file)
load_bytes (NodeEditorWindow *self,
GBytes *bytes)
{
GBytes *bytes;
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
if (bytes == NULL)
return FALSE;
if (!g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
{
g_bytes_unref (bytes);
@@ -362,6 +355,105 @@ load_file_contents (NodeEditorWindow *self,
return TRUE;
}
static gboolean
load_file_contents (NodeEditorWindow *self,
GFile *file)
{
GBytes *bytes;
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
if (bytes == NULL)
return FALSE;
return load_bytes (self, bytes);
}
static GdkContentProvider *
on_picture_drag_prepare_cb (GtkDragSource *source,
double x,
double y,
NodeEditorWindow *self)
{
if (self->node == NULL)
return NULL;
return gdk_content_provider_new_typed (GSK_TYPE_RENDER_NODE, self->node);
}
static void
on_picture_drop_read_done_cb (GObject *source,
GAsyncResult *res,
gpointer data)
{
NodeEditorWindow *self = data;
GOutputStream *stream = G_OUTPUT_STREAM (source);
GdkDrop *drop = g_object_get_data (source, "drop");
GdkDragAction action = 0;
GBytes *bytes;
if (g_output_stream_splice_finish (stream, res, NULL) >= 0)
{
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (stream));
if (load_bytes (self, bytes))
action = GDK_ACTION_COPY;
}
g_object_unref (self);
gdk_drop_finish (drop, action);
g_object_unref (drop);
return;
}
static void
on_picture_drop_read_cb (GObject *source,
GAsyncResult *res,
gpointer data)
{
NodeEditorWindow *self = data;
GdkDrop *drop = GDK_DROP (source);
GInputStream *input;
GOutputStream *output;
input = gdk_drop_read_finish (drop, res, NULL, NULL);
if (input == NULL)
{
g_object_unref (self);
gdk_drop_finish (drop, 0);
return;
}
output = g_memory_output_stream_new_resizable ();
g_object_set_data (G_OBJECT (output), "drop", drop);
g_object_ref (drop);
g_output_stream_splice_async (output,
input,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
G_PRIORITY_DEFAULT,
NULL,
on_picture_drop_read_done_cb,
self);
g_object_unref (output);
g_object_unref (input);
}
static gboolean
on_picture_drop_cb (GtkDropTargetAsync *dest,
GdkDrop *drop,
double x,
double y,
NodeEditorWindow *self)
{
gdk_drop_read_async (drop,
(const char *[2]) { "application/x-gtk-render-node", NULL },
G_PRIORITY_DEFAULT,
NULL,
on_picture_drop_read_cb,
g_object_ref (self));
return TRUE;
}
static void
file_changed_cb (GFileMonitor *monitor,
GFile *file,
@@ -736,6 +828,7 @@ node_editor_window_finalize (GObject *object)
g_array_free (self->errors, TRUE);
g_clear_pointer (&self->node, gsk_render_node_unref);
g_clear_object (&self->renderers);
G_OBJECT_CLASS (node_editor_window_parent_class)->finalize (object);
@@ -778,12 +871,9 @@ node_editor_window_realize (GtkWidget *widget)
NULL,
"Default");
#endif
node_editor_window_add_renderer (self,
gsk_gl_renderer_new (),
"OpenGL");
node_editor_window_add_renderer (self,
gsk_ngl_renderer_new (),
"NGL");
"OpenGL");
#ifdef GDK_RENDERING_VULKAN
node_editor_window_add_renderer (self,
gsk_vulkan_renderer_new (),
@@ -848,6 +938,8 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, testcase_save_clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, testcase_name_entry_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, dark_mode_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
}
static GtkWidget *

View File

@@ -200,6 +200,19 @@
<property name="can-shrink">0</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare_cb" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkDropTargetAsync">
<property name="actions">copy</property>
<property name="formats">application/x-gtk-render-node</property>
<signal name="drop" handler="on_picture_drop_cb" swapped="no"/>
</object>
</child>
</object>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 MiB

View File

@@ -696,6 +696,37 @@ on_range_to_changed (GtkSpinButton *to)
gtk_spin_button_set_value (from, v2);
}
static GdkContentProvider *
on_picture_drag_prepare (GtkDragSource *source,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
return gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, gtk_picture_get_paintable (GTK_PICTURE (picture)));
}
static gboolean
on_picture_drop (GtkDropTarget *dest,
const GValue *value,
double x,
double y,
gpointer unused)
{
GtkWidget *picture;
GdkPaintable *paintable;
picture = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (dest));
paintable = g_value_get_object (value);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
return TRUE;
}
static void
info_bar_response (GtkWidget *infobar, int response_id)
{
@@ -1182,7 +1213,7 @@ populate_flowbox (GtkWidget *flowbox)
GtkWidget *child;
int i;
const char *resources[] = {
"sunset.jpg", "snowy.jpg", "portland-rose.jpg"
"sunset.jpg", "portland-rose.jpg", "beach.jpg", "nyc.jpg"
};
if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (flowbox), "populated")))
@@ -2040,6 +2071,8 @@ activate (GApplication *app)
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
"on_range_to_changed", (GCallback)on_range_to_changed,
"on_picture_drag_prepare", (GCallback)on_picture_drag_prepare,
"on_picture_drop", (GCallback)on_picture_drop,
"tab_close_cb", (GCallback)tab_close_cb,
"increase_icon_size", (GCallback)increase_icon_size,
"decrease_icon_size", (GCallback)decrease_icon_size,

View File

@@ -115,7 +115,8 @@
<gresource prefix="/org/gtk/WidgetFactory4">
<file>gtk-logo.webm</file>
<file>sunset.jpg</file>
<file>snowy.jpg</file>
<file>portland-rose.jpg</file>
<file>nyc.jpg</file>
<file>beach.jpg</file>
</gresource>
</gresources>

View File

@@ -1051,22 +1051,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="spacing">10</property>
<property name="hexpand">1</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="valign">start</property>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Video&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<object class="GtkFrame">
<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">1</property>
<property name="loop">1</property>
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
@@ -1075,66 +1062,78 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<object class="GtkFrame">
<child type="label">
<object class="GtkLabel" id="label1">
<property name="label" translatable="yes">&lt;b&gt;Text Styles&lt;/b&gt;</property>
<property name="use-markup">1</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<object class="GtkScrolledWindow">
<property name="vexpand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="propagate-natural-height">1</property>
<property name="propagate-natural-width">1</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 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>
@@ -1251,8 +1250,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box6">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1265,8 +1277,21 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box7">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1278,10 +1303,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</child>
<child>
<object class="GtkNotebookPage">
<property name="position">2</property>
<property name="child">
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<child>
<object class="GtkDragSource">
<property name="actions">copy</property>
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
</object>
</child>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture</property>
<signal name="drop" handler="on_picture_drop" swapped="no"/>
</object>
</child>
</object>
</property>
<property name="tab">
@@ -1299,7 +1336,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox" id="box9">
<object class="GtkBox" id="box8">
<property name="orientation">vertical</property>
</object>
</property>

View File

@@ -13,7 +13,7 @@ devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[theme]
name = "basic"

View File

@@ -13,7 +13,7 @@ devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[theme]
name = "basic"

View File

@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."cairo-1.0"]
name = "Cairo"

View File

@@ -1,11 +1,15 @@
expand_content_md_files = [
]
gdk4_toml = configure_file(input: 'gdk4.toml.in', output: 'gdk4.toml', configuration: toml_conf)
gdk4x11_toml = configure_file(input: 'gdk4-x11.toml.in', output: 'gdk4-x11.toml', configuration: toml_conf)
gdk4wayland_toml = configure_file(input: 'gdk4-wayland.toml.in', output: 'gdk4-wayland.toml', configuration: toml_conf)
if get_option('gtk_doc')
gdk4_toml = configure_file(
input: 'gdk4.toml.in',
output: 'gdk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4',
)
custom_target('gdk4-doc',
input: [ gdk4_toml, gdk_gir[0] ],
output: 'gdk4',
@@ -28,6 +32,14 @@ if get_option('gtk_doc')
)
if x11_enabled
gdk4x11_toml = configure_file(
input: 'gdk4-x11.toml.in',
output: 'gdk4-x11.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4-x11',
)
custom_target('gdk4-x11-doc',
input: [ gdk4x11_toml, gdk_x11_gir[0] ],
output: 'gdk4-x11',
@@ -52,6 +64,14 @@ if get_option('gtk_doc')
endif
if wayland_enabled
gdk4wayland_toml = configure_file(
input: 'gdk4-wayland.toml.in',
output: 'gdk4-wayland.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gdk4-wayland',
)
custom_target('gdk4-wayland-doc',
input: [ gdk4wayland_toml, gdk_wayland_gir[0] ],
output: 'gdk4-wayland',

View File

@@ -3,11 +3,14 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
]

View File

@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable/"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Graphene-1.0"]
name = "Graphene"

View File

@@ -1,6 +1,12 @@
gsk4_toml = configure_file(input: 'gsk4.toml.in', output: 'gsk4.toml', configuration: toml_conf)
if get_option('gtk_doc')
gsk4_toml = configure_file(
input: 'gsk4.toml.in',
output: 'gsk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gsk4',
)
custom_target('gsk4-doc',
input: [ gsk4_toml, gsk_gir[0] ],
output: 'gsk4',

View File

@@ -3,11 +3,14 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
]

View File

@@ -162,6 +162,8 @@ done with
|caret-color|[CSS Basic User Interface Level 3](https://www.w3.org/TR/css3-ui/#caret-color) | CSS allows an auto value |
|-gtk-secondary-caret-color|[Color](https://www.w3.org/TR/css-color-3/#valuea-def-color) | used for the secondary caret in bidirectional text |
|letter-spacing| [CSS Text Level 3](https://www.w3.org/TR/css3-text/#letter-spacing) | |
|text-transform| [CSS Text Level 3](https://www.w3.org/TR/css-text-3/#text-transform-property) | CSS allows full-width and full-size-kana. Since 4.6 |
|line-height| [CSS Inline Layout Level 3](https://www.w3.org/TR/css-inline-3/#line-height-property) | Since 4.6 |
|text-decoration-line| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-line-property) | |
|text-decoration-color| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-color-property) | |
|text-decoration-style| [CSS Text Decoration Level 3](https://www.w3.org/TR/css-text-decor-3/#text-decoration-style-property) | CSS allows dashed and dotted |

View File

@@ -14,7 +14,7 @@ search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://developer.gnome.org/gobject/stable"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Graphene-1.0"]
name = "Graphene"

View File

@@ -137,6 +137,14 @@ capture phase, and key bindings locally, during the target phase.
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
and they are managed by `GtkShortcutController`.
## Text input
When actual text input is needed (i.e. not just keyboard shortcuts),
input method support can be added to a widget by connecting an input
method context and listening to its `::commit` signal. To create a new
input method context, use gtk_im_multicontext_new(), to provide it with
input, use gtk_event_controller_key_set_im_context().
## Event controllers and gestures
Event controllers are standalone objects that can perform

View File

@@ -27,9 +27,15 @@ expand_content_md_files = [
'visual_index.md'
]
gtk4_toml = configure_file(input: 'gtk4.toml.in', output: 'gtk4.toml', configuration: toml_conf)
if get_option('gtk_doc')
gtk4_toml = configure_file(
input: 'gtk4.toml.in',
output: 'gtk4.toml',
configuration: toml_conf,
install: true,
install_dir: docs_dir / 'gtk4',
)
custom_target('gtk4-doc',
input: [ gtk4_toml, gtk_gir[0] ],
output: 'gtk4',

View File

@@ -3,11 +3,14 @@
// A map between namespaces and base URLs for their online documentation
baseURLs = [
[ 'Gdk', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4/' ],
[ 'GdkWayland', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-wayland/' ],
[ 'GdkX11', 'https://gnome.pages.gitlab.gnome.org/gtk/gdk4-x11/' ],
[ 'Gsk', 'https://gnome.pages.gitlab.gnome.org/gtk/gsk4/' ],
[ 'Gtk', 'https://gnome.pages.gitlab.gnome.org/gtk/gtk4/' ],
[ 'Pango', 'https://gnome.pages/gitlab.gnome.org/pango/pango/' ],
[ 'PangoCairo', 'https://gnome.pages.gitlab.gnome.org/pango/pangocairo/' ],
[ 'GLib', 'https://docs.gtk.org/glib/' ],
[ 'GObject', 'https://docs.gtk.org/gobject/' ],
[ 'Gio', 'https://docs.gtk.org/gio/' ],
[ 'Gdk', 'https://docs.gtk.org/gdk4/' ],
[ 'GdkWayland', 'https://docs.gtk.org/gdk4-wayland/' ],
[ 'GdkX11', 'https://docs.gtk.org/gdk4-x11/' ],
[ 'Gsk', 'https://docs.gtk.org/gsk4/' ],
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
]

View File

@@ -14,14 +14,19 @@ instructions, binary downloads, etc, can be found
The Win32 GDK backend can be influenced with some additional environment
variables.
### GDK_IGNORE_WINTAB
### GDK_WIN32_TABLET_INPUT_API
If this variable is set, GTK doesn't use the Wintab API for tablet support.
If this variable is set, it determines the API that GTK uses for tablet support.
The possible values are:
### GDK_USE_WINTAB
`none`
: Disables tablet support
If this variable is set, GTK uses the Wintab API for tablet support.
This is the default.
`wintab`
: Use the Wintab API
`winpointer`
: Use the Windows Pointer Input Stack API. This is the default.
## Windows-specific handling of cursors

View File

@@ -5,6 +5,10 @@ gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
docs_dir = gtk_datadir / 'doc'
if get_option('gtk_doc') and not build_gir
error('API reference requires introspection.')
endif
subdir('gdk')
subdir('gsk')
subdir('gtk')

View File

@@ -7,10 +7,6 @@
struct _ExampleAppPrefs
{
GtkDialog parent;
GSettings *settings;
GtkWidget *font;
GtkWidget *transition;
};
G_DEFINE_TYPE (ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
@@ -19,41 +15,20 @@ static void
example_app_prefs_init (ExampleAppPrefs *prefs)
{
gtk_widget_init_template (GTK_WIDGET (prefs));
prefs->settings = g_settings_new ("org.gtk.exampleapp");
g_settings_bind (prefs->settings, "font",
prefs->font, "font",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (prefs->settings, "transition",
prefs->transition, "active-id",
G_SETTINGS_BIND_DEFAULT);
}
static void
example_app_prefs_dispose (GObject *object)
{
ExampleAppPrefs *prefs;
prefs = EXAMPLE_APP_PREFS (object);
g_clear_object (&prefs->settings);
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
}
static void
example_app_prefs_class_init (ExampleAppPrefsClass *class)
{
G_OBJECT_CLASS (class)->dispose = example_app_prefs_dispose;
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/exampleapp/prefs.ui");
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
}
ExampleAppPrefs *
example_app_prefs_new (ExampleAppWindow *win)
{
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
return g_object_new (EXAMPLE_APP_PREFS_TYPE,
"transient-for", win,
"use-header-bar", TRUE,
NULL);
}

View File

@@ -28,6 +28,7 @@
</child>
<child>
<object class="GtkFontButton" id="font">
<property name="font" bind-settings-schema="org.gtk.exampleapp" bind-settings-key="font"/>
<layout>
<property name="column">1</property>
<property name="row">0</property>
@@ -48,6 +49,7 @@
</child>
<child>
<object class="GtkComboBoxText" id="transition">
<property name="active-id" bind-settings-schema="org.gtk.exampleapp" bind-settings-key="transition"/>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="crossfade">Fade</item>

View File

@@ -33,6 +33,7 @@
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include <gdk/gdktextureprivate.h>
#include "gdk-private.h"
#include <glib.h>
#include <glib/gprintf.h>
@@ -463,7 +464,7 @@ gdk_broadway_display_flush_in_idle (GdkDisplay *display)
if (broadway_display->idle_flush_id == 0)
{
broadway_display->idle_flush_id = g_idle_add (flush_idle, g_object_ref (display));
g_source_set_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
gdk_source_set_static_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
}
}

View File

@@ -57,4 +57,11 @@ guint gdk_parse_debug_var (const char *variable,
# define g_memdup2(mem,size) g_memdup((mem),(size))
#endif
void gdk_source_set_static_name_by_id (guint tag,
const char *name);
#if !GLIB_CHECK_VERSION(2, 69, 1)
#define g_source_set_static_name(source, name) g_source_set_name ((source), (name))
#endif
#endif /* __GDK__PRIVATE_H__ */

View File

@@ -132,7 +132,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
};
@@ -414,3 +414,17 @@ gdk_find_base_dir (const char *text,
return dir;
}
void
gdk_source_set_static_name_by_id (guint tag,
const char *name)
{
GSource *source;
g_return_if_fail (tag > 0);
source = g_main_context_find_source_by_id (NULL, tag);
if (source == NULL)
return;
g_source_set_static_name (source, name);
}

View File

@@ -635,7 +635,7 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
/**
* gdk_clipboard_read_async:
* @clipboard: a `GdkClipboard`
* @mime_types: a %NULL-terminated array of mime types to choose from
* @mime_types: (array zero-terminated=1): a %NULL-terminated array of mime types to choose from
* @io_priority: the I/O priority of the request
* @cancellable: (nullable): optional `GCancellable` object
* @callback: (scope async): callback to call when the request is satisfied
@@ -1253,9 +1253,15 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
* @...: value contents conforming to @type
*
* Sets the clipboard to contain the value collected from the given varargs.
*
* Values should be passed the same way they are passed to other value
* collecting APIs, such as [`method@GObject.Object.set`] or
* [`id@g_signal_emit`].
*
* ```c
* gdk_clipboard_set (clipboard, GTK_TYPE_TEXT_BUFFER, buffer);
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
*
* gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
* ```
*/
void

View File

@@ -553,6 +553,8 @@ gdk_content_deserialize_async (GInputStream *stream,
Deserializer *deserializer;
g_return_if_fail (G_IS_INPUT_STREAM (stream));
g_return_if_fail (mime_type != NULL);
g_return_if_fail (G_TYPE_IS_VALUE_TYPE (type));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
@@ -591,7 +593,10 @@ gdk_content_deserialize_finish (GAsyncResult *result,
g_return_val_if_fail (GDK_IS_CONTENT_DESERIALIZER (result), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
deserializer = GDK_CONTENT_DESERIALIZER (result);
g_return_val_if_fail (G_VALUE_HOLDS (value, G_VALUE_TYPE (&deserializer->value)), FALSE);
if (G_VALUE_TYPE (value) == 0)
g_value_init (value, G_VALUE_TYPE (&deserializer->value));
else
g_return_val_if_fail (G_VALUE_HOLDS (value, G_VALUE_TYPE (&deserializer->value)), FALSE);
if (deserializer->error)
{

View File

@@ -179,6 +179,76 @@ gdk_content_formats_new_for_gtype (GType type)
return gdk_content_formats_new_take (data, 1, NULL, 0);
}
/**
* gdk_content_formats_parse:
* @string: the string to parse
*
* Parses the given @string into `GdkContentFormats` and
* returns the formats.
*
* Strings printed via [method@Gdk.ContentFormats.to_string]
* can be read in again successfully using this function.
*
* If @string does not describe valid content formats, %NULL
* is returned.
*
* Returns: (nullable): the content formats if @string is valid
*
* Since: 4.4
*/
GdkContentFormats *
gdk_content_formats_parse (const char *string)
{
GdkContentFormatsBuilder *builder;
char **split;
gsize i;
g_return_val_if_fail (string != NULL, NULL);
split = g_strsplit_set (string, "\t\n\f\r ", -1); /* same as g_ascii_isspace() */
builder = gdk_content_formats_builder_new ();
/* first the GTypes */
for (i = 0; split[i] != NULL; i++)
{
GType type;
if (split[i][0] == 0)
continue;
type = g_type_from_name (split[i]);
if (type != 0)
gdk_content_formats_builder_add_gtype (builder, type);
else
break;
}
/* then the mime types */
for (; split[i] != NULL; i++)
{
const char *mime_type;
if (split[i][0] == 0)
continue;
mime_type = gdk_intern_mime_type (split[i]);
if (mime_type)
gdk_content_formats_builder_add_mime_type (builder, mime_type);
else
break;
}
if (split[i] != NULL)
{
g_strfreev (split);
gdk_content_formats_builder_unref (builder);
return NULL;
}
g_strfreev (split);
return gdk_content_formats_builder_free_to_formats (builder);
}
/**
* gdk_content_formats_ref:
* @formats: a `GdkContentFormats`
@@ -227,10 +297,8 @@ gdk_content_formats_unref (GdkContentFormats *formats)
*
* Prints the given @formats into a string for human consumption.
*
* This is meant for debugging and logging.
*
* The form of the representation may change at any time and is
* not guaranteed to stay identical.
* The result of this function can later be parsed with
* [func@Gdk.ContentFormats.parse].
*/
void
gdk_content_formats_print (GdkContentFormats *formats,
@@ -241,20 +309,18 @@ gdk_content_formats_print (GdkContentFormats *formats,
g_return_if_fail (formats != NULL);
g_return_if_fail (string != NULL);
g_string_append (string, "{ ");
for (i = 0; i < formats->n_gtypes; i++)
{
if (i > 0)
g_string_append (string, ", ");
g_string_append (string, " ");
g_string_append (string, g_type_name (formats->gtypes[i]));
}
for (i = 0; i < formats->n_mime_types; i++)
{
if (i > 0 || formats->n_gtypes > 0)
g_string_append (string, ", ");
g_string_append (string, " ");
g_string_append (string, formats->mime_types[i]);
}
g_string_append (string, " }");
}
/**
@@ -263,6 +329,8 @@ gdk_content_formats_print (GdkContentFormats *formats,
*
* Prints the given @formats into a human-readable string.
*
* The resulting string can be parsed with [func@Gdk.ContentFormats.parse].
*
* This is a small wrapper around [method@Gdk.ContentFormats.print]
* to help when debugging.
*

View File

@@ -40,6 +40,8 @@ GdkContentFormats * gdk_content_formats_new (const char
guint n_mime_types);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_content_formats_new_for_gtype (GType type);
GDK_AVAILABLE_IN_4_4
GdkContentFormats * gdk_content_formats_parse (const char *string);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_content_formats_ref (GdkContentFormats *formats);
GDK_AVAILABLE_IN_ALL

View File

@@ -80,7 +80,7 @@ gdk_content_provider_value_get_value (GdkContentProvider *provider,
{
GdkContentProviderValue *content = GDK_CONTENT_PROVIDER_VALUE (provider);
if (G_VALUE_HOLDS (value, G_VALUE_TYPE (&content->value)))
if (G_VALUE_HOLDS (&content->value, G_VALUE_TYPE (value)))
{
g_value_copy (&content->value, value);
return TRUE;

View File

@@ -29,6 +29,7 @@
#include "gdkinternals.h"
#include "gdkframeclockprivate.h"
#include "gdk.h"
#include "gdk-private.h"
#include "gdkprofilerprivate.h"
#ifdef G_OS_WIN32
@@ -307,12 +308,15 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
{
GSource *source;
priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
min_interval,
gdk_frame_clock_flush_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
g_source_set_name_by_id (priv->flush_idle_id, "[gtk] gdk_frame_clock_flush_idle");
source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
}
if (!priv->in_paint_idle &&
@@ -324,7 +328,7 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
gdk_frame_clock_paint_idle,
g_object_ref (clock_idle),
(GDestroyNotify) g_object_unref);
g_source_set_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
}
}
}

View File

@@ -856,6 +856,8 @@ gdk_gl_context_set_is_legacy (GdkGLContext *context,
* is not, this function will return %FALSE.
*
* Returns: %TRUE if the two GL contexts are compatible.
*
* Since: 4.4
*/
gboolean
gdk_gl_context_is_shared (GdkGLContext *self,

View File

@@ -70,17 +70,17 @@ typedef enum {
* snapshot at or 0 if none. This is purely a hint. The object must still
* be able to render at any size.
* @get_intrinsic_aspect_ratio: The preferred aspect ratio for this object
* or 0 if none. If both [vfunc@Gdk.PaintableInterface.get_intrinsic_width]
* and [vfunc@Gdk.PaintableInterface.get_intrinsic_height] return non-zero
* or 0 if none. If both [vfunc@Gdk.Paintable.get_intrinsic_width]
* and [vfunc@Gdk.Paintable.get_intrinsic_height] return non-zero
* values, this function should return the aspect ratio computed from those.
*
* The list of functions that can be implemented for the `GdkPaintable`
* interface.
*
* Note that apart from the [vfunc@Gdk.PaintableInterface.snapshot] function,
* Note that apart from the [vfunc@Gdk.Paintable.snapshot] function,
* no virtual function of this interface is mandatory to implement, though it
* is a good idea to implement [vfunc@Gdk.PaintableInterface.get_current_image]
* for non-static paintables and [vfunc@Gdk.PaintableInterface.get_flags] if the
* is a good idea to implement [vfunc@Gdk.Paintable.get_current_image]
* for non-static paintables and [vfunc@Gdk.Paintable.get_flags] if the
* image is not dynamic as the default implementation returns no flags and
* that will make the implementation likely quite slow.
*/

View File

@@ -78,6 +78,13 @@ gdk_toplevel_default_show_window_menu (GdkToplevel *toplevel,
return FALSE;
}
static gboolean
gdk_toplevel_default_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture)
{
return FALSE;
}
static gboolean
gdk_toplevel_default_supports_edge_constraints (GdkToplevel *toplevel)
{
@@ -114,6 +121,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
iface->supports_edge_constraints = gdk_toplevel_default_supports_edge_constraints;
iface->inhibit_system_shortcuts = gdk_toplevel_default_inhibit_system_shortcuts;
iface->restore_system_shortcuts = gdk_toplevel_default_restore_system_shortcuts;
iface->titlebar_gesture = gdk_toplevel_default_titlebar_gesture;
/**
* GdkToplevel:state: (attributes org.gtk.Property.get=gdk_toplevel_get_state)
@@ -716,3 +724,13 @@ gdk_toplevel_begin_move (GdkToplevel *toplevel,
x, y,
timestamp);
}
gboolean
gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture)
{
g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
return GDK_TOPLEVEL_GET_IFACE (toplevel)->titlebar_gesture (toplevel,
gesture);
}

View File

@@ -115,6 +115,13 @@ typedef enum
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 15
} GdkToplevelState;
typedef enum
{
GDK_TITLEBAR_GESTURE_DOUBLE_CLICK = 1,
GDK_TITLEBAR_GESTURE_RIGHT_CLICK = 2,
GDK_TITLEBAR_GESTURE_MIDDLE_CLICK = 3
} GdkTitlebarGesture;
#define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ())
@@ -196,6 +203,10 @@ void gdk_toplevel_begin_move (GdkToplevel *toplevel,
double y,
guint32 timestamp);
GDK_AVAILABLE_IN_4_4
gboolean gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_H__ */

View File

@@ -38,6 +38,8 @@ struct _GdkToplevelInterface
double x,
double y,
guint32 timestamp);
gboolean (* titlebar_gesture) (GdkToplevel *toplevel,
GdkTitlebarGesture gesture);
};
typedef enum

View File

@@ -94,6 +94,14 @@
*/
#define GDK_VERSION_4_4 (G_ENCODE_VERSION (4, 4))
/**
* GDK_VERSION_4_6:
*
* A macro that evaluates to the 4.6 version of GDK, in a format
* that can be used by the C pre-processor.
*/
#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
@@ -221,4 +229,18 @@
# define GDK_DEPRECATED_IN_4_4_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_6
# define GDK_AVAILABLE_IN_4_6 GDK_UNAVAILABLE(4, 6)
#else
# define GDK_AVAILABLE_IN_4_6 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_6
# define GDK_DEPRECATED_IN_4_6 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_6_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_6 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -117,104 +117,104 @@ gdk_vulkan_strerror (VkResult result)
switch (result)
{
case VK_SUCCESS:
return "Command successfully completed.";
return "Command successfully completed. (VK_SUCCESS)";
case VK_NOT_READY:
return "A fence or query has not yet completed.";
return "A fence or query has not yet completed. (VK_NOT_READY)";
case VK_TIMEOUT:
return "A wait operation has not completed in the specified time.";
return "A wait operation has not completed in the specified time. (VK_TIMEOUT)";
case VK_EVENT_SET:
return "An event is signaled.";
return "An event is signaled. (VK_EVENT_SET)";
case VK_EVENT_RESET:
return "An event is unsignaled.";
return "An event is unsignaled. (VK_EVENT_RESET)";
case VK_INCOMPLETE:
return "A return array was too small for the result.";
return "A return array was too small for the result. (VK_INCOMPLETE)";
case VK_SUBOPTIMAL_KHR:
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully.";
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully. (VK_SUBOPTIMAL_KHR)";
case VK_ERROR_OUT_OF_HOST_MEMORY:
return "A host memory allocation has failed.";
return "A host memory allocation has failed. (VK_ERROR_OUT_OF_HOST_MEMORY)";
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
return "A device memory allocation has failed.";
return "A device memory allocation has failed. (VK_ERROR_OUT_OF_DEVICE_MEMORY)";
case VK_ERROR_INITIALIZATION_FAILED:
return "Initialization of an object could not be completed for implementation-specific reasons.";
return "Initialization of an object could not be completed for implementation-specific reasons. (VK_ERROR_INITIALIZATION_FAILED)";
case VK_ERROR_DEVICE_LOST:
return "The logical or physical device has been lost.";
return "The logical or physical device has been lost. (VK_ERROR_DEVICE_LOST)";
case VK_ERROR_MEMORY_MAP_FAILED:
return "Mapping of a memory object has failed.";
return "Mapping of a memory object has failed. (VK_ERROR_MEMORY_MAP_FAILED)";
case VK_ERROR_LAYER_NOT_PRESENT:
return "A requested layer is not present or could not be loaded.";
return "A requested layer is not present or could not be loaded. (VK_ERROR_LAYER_NOT_PRESENT)";
case VK_ERROR_EXTENSION_NOT_PRESENT:
return "A requested extension is not supported.";
return "A requested extension is not supported. (VK_ERROR_EXTENSION_NOT_PRESENT)";
case VK_ERROR_FEATURE_NOT_PRESENT:
return "A requested feature is not supported.";
return "A requested feature is not supported. (VK_ERROR_FEATURE_NOT_PRESENT)";
case VK_ERROR_INCOMPATIBLE_DRIVER:
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.";
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons. (VK_ERROR_INCOMPATIBLE_DRIVER)";
case VK_ERROR_TOO_MANY_OBJECTS:
return "Too many objects of the type have already been created.";
return "Too many objects of the type have already been created. (VK_ERROR_TOO_MANY_OBJECTS)";
case VK_ERROR_FORMAT_NOT_SUPPORTED:
return "A requested format is not supported on this device.";
return "A requested format is not supported on this device. (VK_ERROR_FORMAT_NOT_SUPPORTED)";
#if VK_HEADER_VERSION >= 24
case VK_ERROR_FRAGMENTED_POOL:
return "A requested pool allocation has failed due to fragmentation of the pools memory.";
return "A requested pool allocation has failed due to fragmentation of the pools memory. (VK_ERROR_FRAGMENTED_POOL)";
#endif
case VK_ERROR_SURFACE_LOST_KHR:
return "A surface is no longer available.";
return "A surface is no longer available. (VK_ERROR_SURFACE_LOST_KHR)";
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again.";
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again. (VK_ERROR_NATIVE_WINDOW_IN_USE_KHR)";
case VK_ERROR_OUT_OF_DATE_KHR:
return "A surface has changed in such a way that it is no longer compatible with the swapchain.";
return "A surface has changed in such a way that it is no longer compatible with the swapchain. (VK_ERROR_OUT_OF_DATE_KHR)";
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image.";
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image. (VK_ERROR_INCOMPATIBLE_DISPLAY_KHR)";
case VK_ERROR_VALIDATION_FAILED_EXT:
return "The application caused the validation layer to fail.";
return "The application caused the validation layer to fail. (VK_ERROR_VALIDATION_FAILED_EXT)";
case VK_ERROR_INVALID_SHADER_NV:
return "One or more shaders failed to compile or link.";
return "One or more shaders failed to compile or link. (VK_ERROR_INVALID_SHADER_NV)";
#if VK_HEADER_VERSION >= 39
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
return "A pool memory allocation has failed.";
return "A pool memory allocation has failed. (VK_ERROR_OUT_OF_POOL_MEMORY_KHR)";
#endif
#if VK_HEADER_VERSION >= 54
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
return "An external handle is not a valid handle of the specified type.";
return "An external handle is not a valid handle of the specified type. (VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR)";
#endif
#if VK_HEADER_VERSION >= 64
case VK_ERROR_NOT_PERMITTED_EXT:
return "The caller does not have sufficient privileges.";
return "The caller does not have sufficient privileges. (VK_ERROR_NOT_PERMITTED_EXT)";
#endif
#if VK_HEADER_VERSION >= 72
case VK_ERROR_FRAGMENTATION_EXT:
return "A descriptor pool creation has failed due to fragmentation";
return "A descriptor pool creation has failed due to fragmentation. (VK_ERROR_FRAGMENTATION_EXT)";
#endif
#if VK_HEADER_VERSION >= 89
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT:
return "Invalid DRM format modifier plane layout";
return "Invalid DRM format modifier plane layout (VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT)";
#endif
#if VK_HEADER_VERSION >= 97
case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT:
return "Invalid device address";
return "Invalid device address (VK_ERROR_INVALID_DEVICE_ADDRESS_EXT)";
#endif
#if VK_HEADER_VERSION >= 105
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access.";
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access. (VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT)";
#endif
#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.";
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred. (VK_ERROR_UNKNOWN)";
#endif
#if VK_HEADER_VERSION >= 135
#if VK_HEADER_VERSION < 162
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
return "This error was removed by the Vulkan gods.";
return "This error was removed by the Vulkan gods. (VK_ERROR_INCOMPATIBLE_VERSION_KHR)";
#endif
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.";
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call. (VK_THREAD_IDLE_KHR)";
case VK_THREAD_DONE_KHR:
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
return "A deferred operation is not complete but there is no work remaining to assign to additional threads. (VK_THREAD_DONE_KHR)";
case VK_OPERATION_DEFERRED_KHR:
return "A deferred operation was requested and at least some of the work was deferred.";
return "A deferred operation was requested and at least some of the work was deferred. (VK_OPERATION_DEFERRED_KHR)";
case VK_OPERATION_NOT_DEFERRED_KHR:
return "A deferred operation was requested and no operations were deferred.";
return "A deferred operation was requested and no operations were deferred. (VK_OPERATION_NOT_DEFERRED_KHR)";
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.";
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed. (VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT)";
#endif
#if VK_HEADER_VERSION < 140
case VK_RESULT_RANGE_SIZE:

View File

@@ -197,7 +197,7 @@ gdk_display_link_source_new (void)
gdk_display_link_source_frame_cb,
source);
g_source_set_name (source, "[gdk] quartz frame clock");
g_source_set_static_name (source, "[gdk] quartz frame clock");
return source;
}

View File

@@ -21,6 +21,7 @@
#include "gdkdeviceprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkmacosdevice-private.h"
#include "gdkmacoscursor-private.h"
@@ -161,7 +162,7 @@ gdk_macos_drag_drop_done (GdkDrag *drag,
gdk_macos_zoomback_timeout,
zb,
(GDestroyNotify) gdk_macos_zoomback_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
g_object_unref (drag);
}
@@ -242,9 +243,11 @@ gdk_macos_drag_drop_performed (GdkDrag *drag,
g_assert (GDK_IS_MACOS_DRAG (self));
g_object_ref (self);
drag_ungrab (self);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, TRUE);
g_object_unref (self);
}
static void

View File

@@ -32,6 +32,8 @@
#include "gdkmacoseventsource-private.h"
#include "gdkmacosdisplay-private.h"
#include "gdk-private.h"
/*
* This file implementations integration between the GLib main loop and
* the native system of the Core Foundation run loop and Cocoa event
@@ -1063,7 +1065,7 @@ _gdk_macos_event_source_new (GdkMacosDisplay *display)
event_poll_fd.fd = -1;
source = g_source_new (&event_funcs, sizeof (GdkMacosEventSource));
g_source_set_name (source, "GDK Quartz event source");
g_source_set_static_name (source, "GDK Quartz event source");
g_source_add_poll (source, &event_poll_fd);
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
g_source_set_can_recurse (source, TRUE);

View File

@@ -460,6 +460,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
pointer->cursor_timeout_id == 0)
{
guint id;
GSource *source;
gdk_wayland_pointer_stop_cursor_animation (pointer);
@@ -467,7 +468,8 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
id = g_timeout_add (next_image_delay,
(GSourceFunc) gdk_wayland_device_update_surface_cursor,
device);
g_source_set_name_by_id (id, "[gtk] gdk_wayland_device_update_surface_cursor");
source = g_main_context_find_source_by_id (NULL, id);
g_source_set_static_name (source, "[gtk] gdk_wayland_device_update_surface_cursor");
pointer->cursor_timeout_id = id;
}
else
@@ -2218,7 +2220,7 @@ deliver_key_event (GdkWaylandSeat *seat,
timeout = (seat->repeat_deadline - now) / 1000L;
seat->repeat_timer = g_timeout_add (timeout, keyboard_repeat, seat);
g_source_set_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
gdk_source_set_static_name_by_id (seat->repeat_timer, "[gtk] keyboard_repeat");
}
static void
@@ -2632,6 +2634,23 @@ touch_handle_cancel (void *data,
GDK_SEAT_NOTE (seat, EVENTS, g_message ("touch cancel"));
}
static void
touch_handle_shape (void *data,
struct wl_touch *touch,
int32_t id,
wl_fixed_t major,
wl_fixed_t minor)
{
}
static void
touch_handle_orientation (void *data,
struct wl_touch *touch,
int32_t id,
wl_fixed_t orientation)
{
}
static void
emit_gesture_swipe_event (GdkWaylandSeat *seat,
GdkTouchpadGesturePhase phase,
@@ -3019,7 +3038,9 @@ static const struct wl_touch_listener touch_listener = {
touch_handle_up,
touch_handle_motion,
touch_handle_frame,
touch_handle_cancel
touch_handle_cancel,
touch_handle_shape,
touch_handle_orientation,
};
static const struct zwp_pointer_gesture_swipe_v1_listener gesture_swipe_listener = {

View File

@@ -87,7 +87,7 @@
#define MIN_SYSTEM_BELL_DELAY_MS 20
#define GTK_SHELL1_VERSION 4
#define GTK_SHELL1_VERSION 5
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define XDG_ACTIVATION_VERSION 1
@@ -240,7 +240,7 @@ _gdk_wayland_display_add_seat (GdkWaylandDisplay *display_wayland,
{
struct wl_seat *seat;
display_wayland->seat_version = MIN (version, 5);
display_wayland->seat_version = MIN (version, 7);
seat = wl_registry_bind (display_wayland->wl_registry,
id, &wl_seat_interface,
display_wayland->seat_version);
@@ -2117,7 +2117,7 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
{
TranslationEntry *entry;
if (GDK_DISPLAY_DEBUG_CHECK (display, DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
if (GDK_WAYLAND_DISPLAY (display)->settings != NULL &&

View File

@@ -290,8 +290,10 @@ data_source_dnd_finished (void *data,
{
GdkDrag *drag = data;
g_object_ref (drag);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, TRUE);
g_object_unref (drag);
}
static void

View File

@@ -32,6 +32,7 @@
#include "gdkprivate-wayland.h"
#include "gdkinternals.h"
#include "gdk-private.h"
#include "gdksurfaceprivate.h"
#include "gdkprofilerprivate.h"
@@ -474,14 +475,28 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
if (!epoxy_has_egl ())
{
gboolean sandboxed = gdk_running_in_sandbox ();
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
sandboxed ? _("libEGL not available in this sandbox")
: _("libEGL not available"));
return NULL;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
dpy = get_egl_display (display_wayland);
gdk_profiler_end_mark (start_time, "get_egl_display", NULL);
if (dpy == NULL)
{
gboolean sandboxed = gdk_running_in_sandbox ();
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Failed to create EGL display"));
sandboxed ? _("Sandbox does not provide an OpenGL implementation")
: _("No OpenGL implementation available"));
return NULL;
}

View File

@@ -542,7 +542,7 @@ _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
context = xkb_context_new (0);
map_str = mmap (NULL, size, PROT_READ, MAP_SHARED, fd, 0);
map_str = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
if (map_str == MAP_FAILED)
{
close(fd);

View File

@@ -4190,6 +4190,65 @@ gdk_wayland_surface_show_window_menu (GdkSurface *surface,
return TRUE;
}
static gboolean
translate_gesture (GdkTitlebarGesture gesture,
enum gtk_surface1_gesture *out_gesture)
{
switch (gesture)
{
case GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_DOUBLE_CLICK;
break;
case GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_RIGHT_CLICK;
break;
case GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_MIDDLE_CLICK;
break;
default:
g_warning ("Not handling unknown titlebar gesture %u", gesture);
return FALSE;
}
return TRUE;
}
static gboolean
gdk_wayland_surface_titlebar_gesture (GdkSurface *surface,
GdkTitlebarGesture gesture)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface;
enum gtk_surface1_gesture gtk_gesture;
GdkSeat *seat;
struct wl_seat *wl_seat;
uint32_t serial;
if (!gtk_surface)
return FALSE;
if (gtk_surface1_get_version (gtk_surface) < GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION)
return FALSE;
if (!translate_gesture (gesture, &gtk_gesture))
return FALSE;
seat = gdk_display_get_default_seat (surface->display);
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat), NULL);
gtk_surface1_titlebar_gesture (impl->display_server.gtk_surface,
serial,
wl_seat,
gtk_gesture);
return TRUE;
}
static gboolean
gdk_wayland_surface_supports_edge_constraints (GdkSurface *surface)
{
@@ -4987,6 +5046,13 @@ gdk_wayland_toplevel_show_window_menu (GdkToplevel *toplevel,
return gdk_wayland_surface_show_window_menu (GDK_SURFACE (toplevel), event);
}
static gboolean
gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
GdkTitlebarGesture gesture)
{
return gdk_wayland_surface_titlebar_gesture (GDK_SURFACE (toplevel), gesture);
}
static gboolean
gdk_wayland_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
{
@@ -5065,6 +5131,7 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
iface->lower = gdk_wayland_toplevel_lower;
iface->focus = gdk_wayland_toplevel_focus;
iface->show_window_menu = gdk_wayland_toplevel_show_window_menu;
iface->titlebar_gesture = gdk_wayland_toplevel_titlebar_gesture;
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;

View File

@@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell1" version="4">
<interface name="gtk_shell1" version="5">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@@ -35,7 +35,7 @@
</request>
</interface>
<interface name="gtk_surface1" version="4">
<interface name="gtk_surface1" version="5">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
@@ -85,6 +85,23 @@
<!-- Version 4 additions -->
<request name="release" type="destructor" since="4"/>
<!-- Version 5 additions -->
<enum name="gesture" since="5">
<entry name="double_click" value="1"/>
<entry name="right_click" value="2"/>
<entry name="middle_click" value="3"/>
</enum>
<enum name="error" since="5">
<entry name="invalid_gesture" value="0"/>
</enum>
<request name="titlebar_gesture" since="5">
<arg name="serial" type="uint"/>
<arg name="seat" type="object" interface="wl_seat"/>
<arg name="gesture" type="uint" enum="gesture"/>
</request>
</interface>
</protocol>

View File

@@ -89,7 +89,7 @@ gdk_device_win32_query_state (GdkDevice *device,
hwnd = NULL;
}
GetCursorPos (&point);
_gdk_win32_get_cursor_pos (&point);
if (hwnd)
ScreenToClient (hwnd, &point);
@@ -177,7 +177,7 @@ _gdk_device_win32_surface_at_position (GdkDevice *device,
HWND hwnd;
RECT rect;
if (!GetCursorPos (&screen_pt))
if (!_gdk_win32_get_cursor_pos (&screen_pt))
return NULL;
/* Use WindowFromPoint instead of ChildWindowFromPoint(Ex).

View File

@@ -0,0 +1,224 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2020 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gdk/gdksurface.h>
#include <windows.h>
#include "gdkwin32.h"
#include "gdkdevice-winpointer.h"
#include "gdkdisplay-win32.h"
G_DEFINE_TYPE (GdkDeviceWinpointer, gdk_device_winpointer, GDK_TYPE_DEVICE)
static GdkModifierType
get_keyboard_mask (void)
{
GdkModifierType mask = 0;
BYTE kbd[256];
GetKeyboardState (kbd);
if (kbd[VK_SHIFT] & 0x80)
mask |= GDK_SHIFT_MASK;
if (kbd[VK_CAPITAL] & 0x80)
mask |= GDK_LOCK_MASK;
if (kbd[VK_CONTROL] & 0x80)
mask |= GDK_CONTROL_MASK;
if (kbd[VK_MENU] & 0x80)
mask |= GDK_ALT_MASK;
return mask;
}
static void
gdk_device_winpointer_set_surface_cursor (GdkDevice *device,
GdkSurface *window,
GdkCursor *cursor)
{
}
void
gdk_device_winpointer_query_state (GdkDevice *device,
GdkSurface *window,
GdkSurface **child_window,
double *win_x,
double *win_y,
GdkModifierType *mask)
{
GdkDeviceWinpointer *device_winpointer;
POINT point;
HWND hwnd, hwndc;
int scale;
device_winpointer = GDK_DEVICE_WINPOINTER (device);
if (window)
{
scale = GDK_WIN32_SURFACE (window)->surface_scale;
hwnd = GDK_SURFACE_HWND (window);
}
else
{
GdkDisplay *display = gdk_device_get_display (device);
scale = GDK_WIN32_DISPLAY (display)->surface_scale;
hwnd = NULL;
}
_gdk_win32_get_cursor_pos (&point);
if (hwnd)
ScreenToClient (hwnd, &point);
if (win_x)
*win_x = point.x / scale;
if (win_y)
*win_y = point.y / scale;
if (!window)
{
if (win_x)
*win_x += _gdk_offset_x;
if (win_y)
*win_y += _gdk_offset_y;
}
if (hwnd && child_window)
{
hwndc = ChildWindowFromPoint (hwnd, point);
if (hwndc && hwndc != hwnd)
*child_window = gdk_win32_handle_table_lookup (hwndc);
else
*child_window = NULL; /* Direct child unknown to gdk */
}
if (mask)
{
*mask = get_keyboard_mask ();
*mask |= device_winpointer->last_button_mask;
}
}
static GdkGrabStatus
gdk_device_winpointer_grab (GdkDevice *device,
GdkSurface *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkSurface *confine_to,
GdkCursor *cursor,
guint32 time_)
{
return GDK_GRAB_SUCCESS;
}
static void
gdk_device_winpointer_ungrab (GdkDevice *device,
guint32 time_)
{
}
static void
screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
{
*client_pt = screen_pt;
ScreenToClient (hwnd, client_pt);
}
static GdkSurface *
gdk_device_winpointer_surface_at_position (GdkDevice *device,
double *win_x,
double *win_y,
GdkModifierType *mask)
{
GdkSurface *surface = NULL;
GdkWin32Surface *impl = NULL;
POINT screen_pt, client_pt;
HWND hwnd;
RECT rect;
if (!_gdk_win32_get_cursor_pos (&screen_pt))
return NULL;
/* Use WindowFromPoint instead of ChildWindowFromPoint(Ex).
* Only WindowFromPoint is able to look through transparent
* layered windows.
*/
hwnd = GetAncestor (WindowFromPoint (screen_pt), GA_ROOT);
/* Verify that we're really inside the client area of the surface */
GetClientRect (hwnd, &rect);
screen_to_client (hwnd, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwnd = NULL;
surface = gdk_win32_handle_table_lookup (hwnd);
if (surface && (win_x || win_y))
{
impl = GDK_WIN32_SURFACE (surface);
if (win_x)
*win_x = client_pt.x / impl->surface_scale;
if (win_y)
*win_y = client_pt.y / impl->surface_scale;
}
return surface;
}
static void
gdk_device_winpointer_init (GdkDeviceWinpointer *device_winpointer)
{
device_winpointer->device_handle = NULL;
device_winpointer->start_cursor_id = 0;
device_winpointer->end_cursor_id = 0;
device_winpointer->origin_x = 0;
device_winpointer->origin_y = 0;
device_winpointer->scale_x = 0.0;
device_winpointer->scale_y = 0.0;
device_winpointer->last_button_mask = 0;
}
static void
gdk_device_winpointer_finalize (GObject *object)
{
GdkDeviceWinpointer *device_winpointer = GDK_DEVICE_WINPOINTER (object);
g_clear_object (&device_winpointer->tool_pen);
g_clear_object (&device_winpointer->tool_eraser);
G_OBJECT_CLASS (gdk_device_winpointer_parent_class)->finalize (object);
}
static void
gdk_device_winpointer_class_init (GdkDeviceWinpointerClass *klass)
{
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gdk_device_winpointer_finalize;
device_class->set_surface_cursor = gdk_device_winpointer_set_surface_cursor;
device_class->grab = gdk_device_winpointer_grab;
device_class->ungrab = gdk_device_winpointer_ungrab;
device_class->surface_at_position = gdk_device_winpointer_surface_at_position;
}

View File

@@ -0,0 +1,67 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2020 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DEVICE_WINPOINTER_H__
#define __GDK_DEVICE_WINPOINTER_H__
#include <gdk/gdkdeviceprivate.h>
#include <windows.h>
#include "winpointer.h"
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE_WINPOINTER (gdk_device_winpointer_get_type ())
#define GDK_DEVICE_WINPOINTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_WINPOINTER, GdkDeviceWinpointer))
#define GDK_DEVICE_WINPOINTER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_WINPOINTER, GdkDeviceWinpointerClass))
#define GDK_IS_DEVICE_WINPOINTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_WINPOINTER))
#define GDK_IS_DEVICE_WINPOINTER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_WINPOINTER))
#define GDK_DEVICE_WINPOINTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_WINPOINTER, GdkDeviceWinpointerClass))
typedef struct _GdkDeviceWinpointer GdkDeviceWinpointer;
typedef struct _GdkDeviceWinpointerClass GdkDeviceWinpointerClass;
struct _GdkDeviceWinpointer
{
GdkDevice parent_instance;
HANDLE device_handle;
UINT32 start_cursor_id;
UINT32 end_cursor_id;
int origin_x;
int origin_y;
double scale_x;
double scale_y;
GdkModifierType last_button_mask;
GdkDeviceTool *tool_pen;
GdkDeviceTool *tool_eraser;
};
struct _GdkDeviceWinpointerClass
{
GdkDeviceClass parent_class;
};
GType gdk_device_winpointer_get_type (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GDK_DEVICE_WINPOINTER_H__ */

View File

@@ -88,7 +88,7 @@ gdk_device_wintab_query_state (GdkDevice *device,
hwnd = NULL;
}
GetCursorPos (&point);
_gdk_win32_get_cursor_pos (&point);
if (hwnd)
ScreenToClient (hwnd, &point);

View File

@@ -29,7 +29,9 @@
#include "gdkdevice-win32.h"
#include "gdkdevice-virtual.h"
#include "gdkdevice-wintab.h"
#include "gdkinput-winpointer.h"
#include "gdkdisplayprivate.h"
#include "gdkdisplay-win32.h"
#include "gdkseatdefaultprivate.h"
#define WINTAB32_DLL "Wintab32.dll"
@@ -371,9 +373,6 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
wintab_contexts = NULL;
if (_gdk_input_ignore_wintab)
return;
n = GetSystemDirectory (&dummy, 0);
if (n <= 0)
@@ -684,10 +683,13 @@ wintab_default_display_notify_cb (GdkDisplayManager *display_manager)
static void
gdk_device_manager_win32_constructed (GObject *object)
{
GdkWin32Display *display_win32;
GdkDeviceManagerWin32 *device_manager;
GdkSeat *seat;
GdkDisplayManager *display_manager = NULL;
GdkDisplay *default_display = NULL;
const char *api_preference = NULL;
gboolean have_api_preference = TRUE;
display_win32 = GDK_WIN32_DISPLAY (_gdk_display);
device_manager = GDK_DEVICE_MANAGER_WIN32 (object);
device_manager->core_pointer =
@@ -728,18 +730,59 @@ gdk_device_manager_win32_constructed (GObject *object)
gdk_seat_default_add_physical_device (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
g_object_unref (seat);
/* Only call Wintab init stuff after the default display
* is globally known and accessible through the display manager
* singleton. Approach lifted from gtkmodules.c.
*/
display_manager = gdk_display_manager_get ();
g_assert (display_manager != NULL);
default_display = gdk_display_manager_get_default_display (display_manager);
g_assert (default_display == NULL);
_gdk_device_manager = device_manager;
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (wintab_default_display_notify_cb),
NULL);
api_preference = g_getenv ("GDK_WIN32_TABLET_INPUT_API");
if (g_strcmp0 (api_preference, "none") == 0)
{
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_NONE;
}
else if (g_strcmp0 (api_preference, "wintab") == 0)
{
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
}
else if (g_strcmp0 (api_preference, "winpointer") == 0)
{
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINPOINTER;
}
else
{
/* No user preference, default to WinPointer. If unsuccessful,
* try to initialize other API's in sequence until one succeeds.
*/
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINPOINTER;
have_api_preference = FALSE;
}
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
{
gboolean init_successful = gdk_winpointer_initialize ();
if (!init_successful && !have_api_preference)
{
/* Try Wintab */
display_win32->tablet_input_api = GDK_WIN32_TABLET_INPUT_API_WINTAB;
}
}
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
{
GdkDisplayManager *display_manager = NULL;
GdkDisplay *default_display = NULL;
/* Only call Wintab init stuff after the default display
* is globally known and accessible through the display manager
* singleton. Approach lifted from gtkmodules.c.
*/
display_manager = gdk_display_manager_get ();
g_assert (display_manager != NULL);
default_display = gdk_display_manager_get_default_display (display_manager);
g_assert (default_display == NULL);
g_signal_connect (display_manager, "notify::default-display",
G_CALLBACK (wintab_default_display_notify_cb),
NULL);
}
}
static void
@@ -752,7 +795,7 @@ gdk_device_manager_win32_class_init (GdkDeviceManagerWin32Class *klass)
}
void
_gdk_input_set_tablet_active (void)
_gdk_wintab_set_tablet_active (void)
{
GList *tmp_list;
HCTX *hctx;
@@ -763,7 +806,7 @@ _gdk_input_set_tablet_active (void)
if (!wintab_contexts)
return; /* No tablet devices found, or Wintab not initialized yet */
GDK_NOTE (INPUT, g_print ("_gdk_input_set_tablet_active: "
GDK_NOTE (INPUT, g_print ("_gdk_wintab_set_tablet_active: "
"Bringing Wintab contexts to the top of the overlap order\n"));
tmp_list = wintab_contexts;
@@ -866,7 +909,7 @@ gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager,
}
GdkEvent *
gdk_input_other_event (GdkDisplay *display,
gdk_wintab_make_event (GdkDisplay *display,
MSG *msg,
GdkSurface *window)
{
@@ -894,7 +937,7 @@ gdk_input_other_event (GdkDisplay *display,
if (window != wintab_window)
{
g_warning ("gdk_input_other_event: not wintab_window?");
g_warning ("gdk_wintab_make_event: not wintab_window?");
return NULL;
}
@@ -905,7 +948,7 @@ gdk_input_other_event (GdkDisplay *display,
g_object_ref (window);
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("gdk_input_other_event: window=%p %+g%+g\n",
g_print ("gdk_wintab_make_event: window=%p %+g%+g\n",
window ? GDK_SURFACE_HWND (window) : NULL, x, y));
if (msg->message == WT_PACKET || msg->message == WT_CSRCHANGE)

View File

@@ -40,6 +40,8 @@ struct _GdkDeviceManagerWin32
/* Fake physical devices */
GdkDevice *system_pointer;
GdkDevice *system_keyboard;
GList *winpointer_devices;
GList *wintab_devices;
/* Bumped up every time a wintab device enters the proximity
@@ -56,8 +58,8 @@ struct _GdkDeviceManagerWin32Class
GType gdk_device_manager_win32_get_type (void) G_GNUC_CONST;
void _gdk_input_set_tablet_active (void);
GdkEvent * gdk_input_other_event (GdkDisplay *display,
void _gdk_wintab_set_tablet_active (void);
GdkEvent * gdk_wintab_make_event (GdkDisplay *display,
MSG *msg,
GdkSurface *window);

View File

@@ -18,7 +18,6 @@
#include "config.h"
#define _WIN32_WINNT 0x0600
#define VK_USE_PLATFORM_WIN32_KHR
#include "gdk.h"
@@ -535,7 +534,6 @@ _gdk_win32_display_open (const char *display_name)
_gdk_win32_lang_notification_init ();
_gdk_drag_init ();
_gdk_drop_init ();
_gdk_display->clipboard = gdk_win32_clipboard_new (_gdk_display);
_gdk_display->primary_clipboard = gdk_clipboard_new (_gdk_display);

View File

@@ -99,6 +99,12 @@ typedef struct _GdkWin32User32DPIFuncs
funcADACE areDACEqual;
} GdkWin32User32DPIFuncs;
typedef enum {
GDK_WIN32_TABLET_INPUT_API_NONE,
GDK_WIN32_TABLET_INPUT_API_WINTAB,
GDK_WIN32_TABLET_INPUT_API_WINPOINTER
} GdkWin32TabletInputAPI;
/* Detect running architecture */
typedef BOOL (WINAPI *funcIsWow64Process2) (HANDLE, USHORT *, USHORT *);
typedef struct _GdkWin32KernelCPUFuncs
@@ -159,7 +165,9 @@ struct _GdkWin32Display
GdkWin32ShcoreFuncs shcore_funcs;
GdkWin32User32DPIFuncs user32_dpi_funcs;
GdkWin32TabletInputAPI tablet_input_api;
/* Cursor Items (GdkCursor->GdkWin32HCursor) */
GHashTable *cursors;
/* The cursor that is used by current grab (if any) */

View File

@@ -27,6 +27,8 @@
#include "config.h"
#include <string.h>
#include "gdk-private.h"
#include <io.h>
#include <fcntl.h>
#include <math.h>
@@ -156,9 +158,6 @@
* drag window) in response to this, as all the functions
* that GDK could perform here are already handled by the
* OS driving the DnD process via DoDragDrop() call.
* The LOCAL protocol, on the other hand, does a lot,
* similar to what X11 backend does with XDND - it sends
* GDK_DRAG_LEAVE and GDK_DRAG_ENTER, emits GDK_DRAG_MOTION.
*
* GDK_BUTTON_RELEASE checks the
* released button - if it's the button that was used to
@@ -179,11 +178,7 @@
* the OS notifies the process about these things happening.
* For X11 backend that is done in Xdnd event filters,
* for W32 backend this is done in IDropSource/IDropTarget
* object methods for the OLE2 protocol, whereas for the
* LOCAL protocol these events are emitted only by GDK itself
* (with the exception of WM_DROPFILES message, which causes
* GDK to create a drop context and then immediately finish
* the drag, providing the list of files it got from the message).
* object methods for the OLE2 protocol.
*
*/
@@ -485,17 +480,6 @@ process_dnd_queue (gboolean timed,
return FALSE;
}
void
_gdk_win32_local_drag_drop_response (GdkDrag *drag,
GdkDragAction action)
{
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_drop_response: 0x%p\n",
drag));
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, action != 0);
}
static gboolean
do_drag_drop_response (gpointer user_data)
{
@@ -712,16 +696,6 @@ _gdk_win32_dnd_thread_main (gpointer data)
return NULL;
}
/* For the LOCAL protocol */
typedef enum {
GDK_DRAG_STATUS_DRAG,
GDK_DRAG_STATUS_MOTION_WAIT,
GDK_DRAG_STATUS_ACTION_WAIT,
GDK_DRAG_STATUS_DROP
} GdkDragStatus;
static gboolean use_ole2_dnd = TRUE;
static gboolean drag_context_grab (GdkDrag *drag);
G_DEFINE_TYPE (GdkWin32Drag, gdk_win32_drag, GDK_TYPE_DRAG)
@@ -789,8 +763,7 @@ gdk_drag_new (GdkDisplay *display,
GdkSurface *surface,
GdkContentProvider *content,
GdkDragAction actions,
GdkDevice *device,
GdkDragProtocol protocol)
GdkDevice *device)
{
GdkWin32Drag *drag_win32;
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
@@ -810,8 +783,6 @@ gdk_drag_new (GdkDisplay *display,
else
drag_win32->scale = gdk_win32_display_get_monitor_scale_factor (display_win32, NULL, NULL);
drag_win32->protocol = protocol;
return drag;
}
@@ -1079,21 +1050,6 @@ maybe_emit_action_changed (GdkWin32Drag *drag_win32,
}
}
void
_gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GdkDragAction actions)
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
if (drag_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
GDK_NOTE (DND, g_print ("_gdk_win32_local_drag_give_feedback: 0x%p\n",
drag));
maybe_emit_action_changed (drag_win32, actions);
}
static gboolean
give_feedback (gpointer user_data)
{
@@ -1668,30 +1624,20 @@ enum_formats_new (GArray *formats)
void
_gdk_drag_init (void)
{
HRESULT hr;
CoInitializeEx (NULL, COINIT_APARTMENTTHREADED);
if (g_strcmp0 (getenv ("GDK_WIN32_OLE2_DND"), "0") == 0)
use_ole2_dnd = FALSE;
hr = OleInitialize (NULL);
if (use_ole2_dnd)
{
HRESULT hr;
hr = OleInitialize (NULL);
if (! SUCCEEDED (hr))
g_error ("OleInitialize failed");
}
if (! SUCCEEDED (hr))
g_error ("OleInitialize failed");
}
void
_gdk_win32_dnd_exit (void)
{
if (use_ole2_dnd)
{
OleUninitialize ();
}
OleUninitialize ();
CoUninitialize ();
}
@@ -1721,6 +1667,9 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
double px, py;
int x_root, y_root;
GdkWin32DnDThreadDoDragDrop *ddd;
source_drag_context *source_ctx;
data_object *data_obj;
g_return_val_if_fail (surface != NULL, NULL);
@@ -1728,8 +1677,7 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
surface,
content,
actions,
device,
use_ole2_dnd ? GDK_DRAG_PROTO_OLE2 : GDK_DRAG_PROTO_LOCAL);
device);
drag_win32 = GDK_WIN32_DRAG (drag);
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
@@ -1753,121 +1701,35 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
return FALSE;
}
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{
GdkWin32DnDThreadDoDragDrop *ddd = g_new0 (GdkWin32DnDThreadDoDragDrop, 1);
source_drag_context *source_ctx;
data_object *data_obj;
ddd = g_new0 (GdkWin32DnDThreadDoDragDrop, 1);
source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
data_obj = data_object_new (drag);
source_ctx = source_context_new (drag, gdk_drag_get_formats (drag));
data_obj = data_object_new (drag);
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
ddd->base.opaque_context = drag_win32;
ddd->src_context = source_ctx;
ddd->src_object = data_obj;
ddd->allowed_drop_effects = 0;
if (actions & GDK_ACTION_COPY)
ddd->allowed_drop_effects |= DROPEFFECT_COPY;
if (actions & GDK_ACTION_MOVE)
ddd->allowed_drop_effects |= DROPEFFECT_MOVE;
if (actions & GDK_ACTION_LINK)
ddd->allowed_drop_effects |= DROPEFFECT_LINK;
ddd->base.item_type = GDK_WIN32_DND_THREAD_QUEUE_ITEM_DO_DRAG_DROP;
ddd->base.opaque_context = drag_win32;
ddd->src_context = source_ctx;
ddd->src_object = data_obj;
ddd->allowed_drop_effects = 0;
if (actions & GDK_ACTION_COPY)
ddd->allowed_drop_effects |= DROPEFFECT_COPY;
if (actions & GDK_ACTION_MOVE)
ddd->allowed_drop_effects |= DROPEFFECT_MOVE;
if (actions & GDK_ACTION_LINK)
ddd->allowed_drop_effects |= DROPEFFECT_LINK;
g_hash_table_replace (clipdrop->active_source_drags, g_object_ref (drag), ddd);
increment_dnd_queue_counter ();
g_async_queue_push (clipdrop->dnd_queue, ddd);
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
g_hash_table_replace (clipdrop->active_source_drags, g_object_ref (drag), ddd);
increment_dnd_queue_counter ();
g_async_queue_push (clipdrop->dnd_queue, ddd);
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id, thread_wakeup_message, 0, 0));
drag_win32->util_data.state = GDK_WIN32_DND_PENDING;
}
drag_win32->util_data.state = GDK_WIN32_DND_PENDING;
move_drag_surface (drag, x_root, y_root);
return drag;
}
/* TODO: remove this?
* window finder is only used by our gdk_drag_update() to
* find the window at drag coordinates - which is
* something IDropSourceNotify already gives us.
* Unless, of course, we keep the LOCAL protocol around.
*/
typedef struct {
int x;
int y;
HWND ignore;
HWND result;
} find_window_enum_arg;
static BOOL CALLBACK
find_window_enum_proc (HWND hwnd,
LPARAM lparam)
{
RECT rect;
POINT tl, br;
find_window_enum_arg *a = (find_window_enum_arg *) lparam;
if (hwnd == a->ignore)
return TRUE;
if (!IsWindowVisible (hwnd))
return TRUE;
tl.x = tl.y = 0;
ClientToScreen (hwnd, &tl);
GetClientRect (hwnd, &rect);
br.x = rect.right;
br.y = rect.bottom;
ClientToScreen (hwnd, &br);
if (a->x >= tl.x && a->y >= tl.y && a->x < br.x && a->y < br.y)
{
a->result = hwnd;
return FALSE;
}
else
return TRUE;
}
/* Finds the HWND under cursor. Local DnD protocol
* uses this function, since local protocol is implemented
* entirely in GDK and cannot rely on the OS to notify
* drop targets about drags that move over them.
*/
static HWND
gdk_win32_drag_find_window (GdkDrag *drag,
GdkSurface *drag_surface,
int x_root,
int y_root)
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
find_window_enum_arg a;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
a.x = x_root * drag_win32->scale - _gdk_offset_x;
a.y = y_root * drag_win32->scale - _gdk_offset_y;
a.ignore = drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL;
a.result = INVALID_HANDLE_VALUE;
GDK_NOTE (DND,
g_print ("gdk_win32_drag_find_window: %p %+d%+d\n",
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
a.x, a.y));
EnumWindows (find_window_enum_proc, (LPARAM) &a);
GDK_NOTE (DND,
g_print ("gdk_win32_drag_find_window: %p %+d%+d: %p\n",
(drag_surface ? GDK_SURFACE_HWND (drag_surface) : NULL),
x_root, y_root,
a.result));
return a.result;
}
static DWORD
manufacture_keystate_from_GMT (GdkModifierType state)
{
@@ -1889,100 +1751,6 @@ manufacture_keystate_from_GMT (GdkModifierType state)
return key_state;
}
/* This only works if dest_window our window and the DnD operation
* is currently local to the application.
*/
static GdkDrop *
_gdk_win32_get_drop_for_dest_window (HWND dest_window)
{
GdkSurface *drop_surface = gdk_win32_handle_table_lookup (dest_window);
GdkDrop *result = NULL;
if (drop_surface)
result = _gdk_win32_get_drop_for_dest_surface (drop_surface);
return result;
}
static gboolean
gdk_win32_local_drag_motion (GdkDrag *drag,
HWND dest_window,
int x_root,
int y_root,
GdkDragAction possible_actions,
DWORD key_state,
guint32 time_)
{
GdkWin32Drag *drag_win32;
GdkDrop *drop;
GdkDragAction actions;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
g_return_val_if_fail (drag != NULL, FALSE);
drag_win32 = GDK_WIN32_DRAG (drag);
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
actions = gdk_drag_get_actions (drag);
GDK_NOTE (DND, g_print ("gdk_win32_local_drag_motion: @ %+d:%+d possible=%s\n"
" dest=%p (current %p) drop=%p drag=%p:{actions=%s,action=%s}\n",
x_root, y_root,
_gdk_win32_drag_action_to_string (possible_actions),
dest_window, drag_win32->dest_window, drop, drag,
_gdk_win32_drag_action_to_string (actions),
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
if (drag_win32->dest_window != dest_window)
{
/* Send a leave to the last destination */
if (drop)
_gdk_win32_local_drop_target_dragleave (drop, time_);
drag_win32->dest_window = dest_window;
drag_win32->drag_status = GDK_DRAG_STATUS_DRAG;
_gdk_win32_local_drop_target_dragenter (drag,
gdk_win32_handle_table_lookup (dest_window),
x_root,
y_root,
key_state,
time_,
&actions);
drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
maybe_emit_action_changed (drag_win32, actions);
}
/* Send a drag-motion event */
drag_win32->util_data.last_x = x_root;
drag_win32->util_data.last_y = y_root;
if (drop != NULL &&
drag_win32->drag_status == GDK_DRAG_STATUS_DRAG &&
_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, key_state))
{
actions = gdk_drag_get_actions (drag);
drag_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
_gdk_win32_local_drop_target_dragover (drop, drag, x_root, y_root, key_state, time_, &actions);
maybe_emit_action_changed (drag_win32, actions);
}
GDK_NOTE (DND, g_print (" returning %s\n"
" drag=%p:{actions=%s,action=%s}\n",
(drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG) ? "TRUE" : "FALSE",
drag,
_gdk_win32_drag_action_to_string (gdk_drag_get_actions (drag)),
_gdk_win32_drag_action_to_string (gdk_drag_get_selected_action (drag))));
return (drop != NULL && drag_win32->drag_status == GDK_DRAG_STATUS_DRAG);
}
static void
send_source_state_update (GdkWin32Clipdrop *clipdrop,
GdkWin32Drag *drag_win32,
@@ -2003,6 +1771,7 @@ gdk_win32_drag_drop (GdkDrag *drag,
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
gpointer ddd;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
@@ -2011,29 +1780,12 @@ gdk_win32_drag_drop (GdkDrag *drag,
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop\n"));
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
{
GdkDrop *drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
if (drop)
{
GdkDragAction actions;
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
actions = gdk_drag_get_actions (drag);
_gdk_win32_local_drop_target_drop (drop, drag, time_, &actions);
maybe_emit_action_changed (drag_win32, actions);
_gdk_win32_local_drag_drop_response (drag, actions);
}
}
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
if (ddd)
send_source_state_update (clipdrop, drag_win32, ddd);
}
if (ddd)
send_source_state_update (clipdrop, drag_win32, ddd);
}
static void
@@ -2123,6 +1875,8 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
GdkDragAnim *anim;
GdkWin32Clipdrop *clipdrop;
gpointer ddd;
/*
cairo_surface_t *win_surface;
cairo_surface_t *surface;
@@ -2137,23 +1891,16 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
/* FIXME: This is temporary, until the code is fixed to ensure that
* gdk_drag_finish () is called by GTK.
*/
if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
gpointer ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
clipdrop = _gdk_win32_clipdrop_get ();
ddd = g_hash_table_lookup (clipdrop->active_source_drags, drag);
if (success)
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
else
drag_win32->util_data.state = GDK_WIN32_DND_NONE;
if (success)
drag_win32->util_data.state = GDK_WIN32_DND_DROPPED;
else
drag_win32->util_data.state = GDK_WIN32_DND_NONE;
if (ddd)
send_source_state_update (clipdrop, drag_win32, ddd);
}
else if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
{
}
if (ddd)
send_source_state_update (clipdrop, drag_win32, ddd);
drag_win32->handle_events = FALSE;
@@ -2196,7 +1943,7 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
}
static gboolean
@@ -2279,14 +2026,6 @@ gdk_win32_drag_cancel (GdkDrag *drag,
drag,
reason_str));
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
{
GdkDrop *drop = _gdk_win32_get_drop_for_dest_window (drag_win32->dest_window);
if (drop)
_gdk_win32_local_drop_target_dragleave (drop, GDK_CURRENT_TIME);
drop = NULL;
}
gdk_drag_set_cursor (drag, NULL);
drag_context_ungrab (drag);
gdk_drag_drop_done (drag, FALSE);
@@ -2308,28 +2047,6 @@ gdk_win32_drag_drop_performed (GdkDrag *drag,
#define BIG_STEP 20
#define SMALL_STEP 1
static void
gdk_local_drag_update (GdkDrag *drag,
double x_root,
double y_root,
DWORD grfKeyState,
guint32 evtime)
{
GdkWin32Drag *drag_win32 = GDK_WIN32_DRAG (drag);
HWND dest_window;
g_assert (_win32_main_thread == NULL ||
_win32_main_thread == g_thread_self ());
dest_window = gdk_win32_drag_find_window (drag,
drag_win32->drag_surface,
x_root, y_root);
gdk_win32_local_drag_motion (drag, dest_window, x_root, y_root,
gdk_drag_get_actions (drag),
grfKeyState, evtime);
}
static gboolean
gdk_dnd_handle_motion_event (GdkDrag *drag,
GdkEvent *event)
@@ -2339,6 +2056,7 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
DWORD key_state;
double x, y;
double x_root, y_root;
GdkWin32Clipdrop *clipdrop;
GDK_NOTE (DND, g_print ("gdk_dnd_handle_motion_event: 0x%p\n", drag));
@@ -2353,26 +2071,18 @@ gdk_dnd_handle_motion_event (GdkDrag *drag,
key_state = manufacture_keystate_from_GMT (state);
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
{
gdk_local_drag_update (drag, x_root, y_root, key_state,
gdk_event_get_time (event));
}
else if (drag_win32->protocol == GDK_DRAG_PROTO_OLE2)
{
GdkWin32Clipdrop *clipdrop = _gdk_win32_clipdrop_get ();
clipdrop = _gdk_win32_clipdrop_get ();
GDK_NOTE (DND, g_print ("Post WM_MOUSEMOVE keystate=%lu\n", key_state));
GDK_NOTE (DND, g_print ("Post WM_MOUSEMOVE keystate=%lu\n", key_state));
drag_win32->util_data.last_x = x_root;
drag_win32->util_data.last_y = y_root;
drag_win32->util_data.last_x = x_root;
drag_win32->util_data.last_y = y_root;
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id,
WM_MOUSEMOVE,
key_state,
MAKELPARAM (x * drag_win32->scale,
y * drag_win32->scale)));
}
API_CALL (PostThreadMessage, (clipdrop->dnd_thread_id,
WM_MOUSEMOVE,
key_state,
MAKELPARAM (x * drag_win32->scale,
y * drag_win32->scale)));
return TRUE;
}
@@ -2454,11 +2164,6 @@ gdk_dnd_handle_key_event (GdkDrag *drag,
if (drag_win32->drag_surface)
move_drag_surface (drag, drag_win32->util_data.last_x, drag_win32->util_data.last_y);
if (drag_win32->protocol == GDK_DRAG_PROTO_LOCAL)
gdk_local_drag_update (drag, drag_win32->util_data.last_x, drag_win32->util_data.last_y,
manufacture_keystate_from_GMT (state),
gdk_event_get_time (event));
return TRUE;
}

View File

@@ -140,9 +140,6 @@ struct _drop_target_context
IDataObject *data_object;
};
/* TRUE to use OLE2 protocol, FALSE to use local protocol */
static gboolean use_ole2_dnd = TRUE;
static void
gdk_win32_drop_init (GdkWin32Drop *drop)
{
@@ -196,28 +193,6 @@ gdk_drop_new (GdkDisplay *display,
return GDK_DROP (drop_win32);
}
/* Gets the GdkDrop that corresponds to a particular GdkSurface.
* Will be NULL for surfaces that are not registered as drop targets,
* or for surfaces that are currently not under the drag cursor.
* This function is only used for local DnD, where we do have
* a real GdkSurface that corresponds to the HWND under cursor.
*/
GdkDrop *
_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest)
{
GdkWin32Surface *impl;
if (dest == NULL)
return NULL;
impl = GDK_WIN32_SURFACE (dest);
if (impl->drop_target != NULL)
return impl->drop_target->drop;
return impl->drop;
}
#define PRINT_GUID(guid) \
g_print ("%.08lx-%.04x-%.04x-%.02x%.02x-%.02x%.02x%.02x%.02x%.02x%.02x", \
@@ -451,51 +426,6 @@ set_source_actions_helper (GdkDrop *drop,
return actions;
}
void
_gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
GdkSurface *dest_surface,
int x_root,
int y_root,
DWORD grfKeyState,
guint32 time_,
GdkDragAction *actions)
{
GdkDrop *drop;
GdkWin32Drop *drop_win32;
GdkDisplay *display;
GdkDragAction source_actions;
GdkWin32Surface *impl = GDK_WIN32_SURFACE (dest_surface);
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragenter %p @ %d : %d"
" for dest window 0x%p"
". actions = %s\n",
drag, x_root, y_root,
dest_surface,
_gdk_win32_drag_action_to_string (*actions)));
display = gdk_surface_get_display (dest_surface);
drop = gdk_drop_new (display,
gdk_seat_get_pointer (gdk_display_get_default_seat (display)),
drag,
gdk_drag_get_formats (drag),
dest_surface,
GDK_DRAG_PROTO_LOCAL);
drop_win32 = GDK_WIN32_DROP (drop);
impl->drop = drop;
source_actions = set_source_actions_helper (drop, *actions, grfKeyState);
gdk_drop_emit_enter_event (drop, TRUE, x_root, y_root, time_);
drop_win32->last_key_state = grfKeyState;
drop_win32->last_x = x_root;
drop_win32->last_y = y_root;
*actions = filter_actions (drop_win32->actions, source_actions);
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragenter returns with actions %s\n",
_gdk_win32_drag_action_to_string (*actions)));
}
/* The pdwEffect here initially points
* to a DWORD that contains the value of dwOKEffects argument in DoDragDrop,
* i.e. the drag action that the drag source deems acceptable.
@@ -575,55 +505,6 @@ idroptarget_dragenter (LPDROPTARGET This,
return S_OK;
}
gboolean
_gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
int x_root,
int y_root,
DWORD grfKeyState)
{
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
if (x_root != drop_win32->last_x ||
y_root != drop_win32->last_y ||
grfKeyState != drop_win32->last_key_state)
return TRUE;
return FALSE;
}
void
_gdk_win32_local_drop_target_dragover (GdkDrop *drop,
GdkDrag *drag,
int x_root,
int y_root,
DWORD grfKeyState,
guint32 time_,
GdkDragAction *actions)
{
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
GdkDragAction source_actions;
source_actions = set_source_actions_helper (drop, *actions, grfKeyState);
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragover %p @ %d : %d"
", actions = %s\n",
drop, x_root, y_root,
_gdk_win32_drag_action_to_string (*actions)));
if (_gdk_win32_local_drop_target_will_emit_motion (drop, x_root, y_root, grfKeyState))
{
gdk_drop_emit_motion_event (drop, TRUE, x_root, y_root, time_);
drop_win32->last_key_state = grfKeyState;
drop_win32->last_x = x_root;
drop_win32->last_y = y_root;
}
*actions = filter_actions (drop_win32->actions, source_actions);
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragover returns with actions %s\n",
_gdk_win32_drag_action_to_string (*actions)));
}
/* NOTE: This method is called continuously, even if nothing is
* happening, as long as the drag operation is in progress and
* the cursor is above our window.
@@ -681,18 +562,6 @@ idroptarget_dragover (LPDROPTARGET This,
return S_OK;
}
void
_gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
guint32 time_)
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (gdk_drop_get_surface (drop));
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_dragleave %p\n", drop));
gdk_drop_emit_leave_event (drop, TRUE, time_);
g_clear_object (&impl->drop);
}
static HRESULT STDMETHODCALLTYPE
idroptarget_dragleave (LPDROPTARGET This)
{
@@ -708,35 +577,6 @@ idroptarget_dragleave (LPDROPTARGET This)
return S_OK;
}
void
_gdk_win32_local_drop_target_drop (GdkDrop *drop,
GdkDrag *drag,
guint32 time_,
GdkDragAction *actions)
{
GdkWin32Drop *drop_win32 = GDK_WIN32_DROP (drop);
GDK_NOTE (DND, g_print ("_gdk_win32_local_drop_target_drop %p ", drop));
set_source_actions_helper (drop,
*actions,
drop_win32->last_key_state);
drop_win32->drop_finished = FALSE;
gdk_drop_emit_drop_event (drop, TRUE, drop_win32->last_x, drop_win32->last_y, time_);
while (!drop_win32->drop_finished)
g_main_context_iteration (NULL, FALSE);
/* Notify local source of the DnD result
* Special case:
* drop_win32->actions is guaranteed to contain 1 action after gdk_drop_finish ()
*/
*actions = drop_win32->actions;
GDK_NOTE (DND, g_print ("drop with action %s\n", _gdk_win32_drag_action_to_string (*actions)));
}
static HRESULT STDMETHODCALLTYPE
idroptarget_drop (LPDROPTARGET This,
LPDATAOBJECT pDataObj,
@@ -1078,14 +918,6 @@ gdk_win32_drop_status (GdkDrop *drop,
_gdk_win32_drag_action_to_string (preferred)));
drop_win32->actions = actions;
if (drop_win32->protocol == GDK_DRAG_PROTO_OLE2)
return;
drag = gdk_drop_get_drag (drop);
if (drag != NULL)
_gdk_win32_local_drag_give_feedback (drag, actions);
}
static void
@@ -1101,9 +933,6 @@ gdk_win32_drop_finish (GdkDrop *drop,
drop_win32->actions = action;
drop_win32->drop_finished = TRUE;
if (drop_win32->protocol == GDK_DRAG_PROTO_OLE2)
return;
}
#if 0
@@ -1136,6 +965,7 @@ _gdk_win32_surface_register_dnd (GdkSurface *window)
{
drop_target_context *ctx;
HRESULT hr;
GdkWin32Surface *impl;
g_return_if_fail (window != NULL);
@@ -1146,43 +976,30 @@ _gdk_win32_surface_register_dnd (GdkSurface *window)
GDK_NOTE (DND, g_print ("gdk_win32_surface_register_dnd: %p\n", GDK_SURFACE_HWND (window)));
if (!use_ole2_dnd)
{
/* We always claim to accept dropped files, but in fact we might not,
* of course. This function is called in such a way that it cannot know
* whether the window (widget) in question actually accepts files
* (in gtk, data of type text/uri-list) or not.
*/
gdk_win32_display_add_filter (GDK_WIN32_DISPLAY (gdk_display_get_default ()), gdk_dropfiles_filter, NULL);
DragAcceptFiles (GDK_SURFACE_HWND (window), TRUE);
}
impl = GDK_WIN32_SURFACE (window);
/* Return if window is already setup for DND. */
if (impl->drop_target != NULL)
return;
ctx = target_context_new (window);
hr = CoLockObjectExternal ((IUnknown *) &ctx->idt, TRUE, FALSE);
if (!SUCCEEDED (hr))
OTHER_API_FAILED ("CoLockObjectExternal");
else
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
/* Return if window is already setup for DND. */
if (impl->drop_target != NULL)
return;
ctx = target_context_new (window);
hr = CoLockObjectExternal ((IUnknown *) &ctx->idt, TRUE, FALSE);
if (!SUCCEEDED (hr))
OTHER_API_FAILED ("CoLockObjectExternal");
hr = RegisterDragDrop (GDK_SURFACE_HWND (window), &ctx->idt);
if (hr == DRAGDROP_E_ALREADYREGISTERED)
{
g_print ("DRAGDROP_E_ALREADYREGISTERED\n");
CoLockObjectExternal ((IUnknown *) &ctx->idt, FALSE, FALSE);
}
else if (!SUCCEEDED (hr))
OTHER_API_FAILED ("RegisterDragDrop");
else
{
hr = RegisterDragDrop (GDK_SURFACE_HWND (window), &ctx->idt);
if (hr == DRAGDROP_E_ALREADYREGISTERED)
{
g_print ("DRAGDROP_E_ALREADYREGISTERED\n");
CoLockObjectExternal ((IUnknown *) &ctx->idt, FALSE, FALSE);
}
else if (!SUCCEEDED (hr))
OTHER_API_FAILED ("RegisterDragDrop");
else
{
impl->drop_target = ctx;
}
impl->drop_target = ctx;
}
}
}
@@ -1418,10 +1235,3 @@ gdk_win32_drop_class_init (GdkWin32DropClass *klass)
drop_class->read_async = gdk_win32_drop_read_async;
drop_class->read_finish = gdk_win32_drop_read_finish;
}
void
_gdk_drop_init (void)
{
if (g_strcmp0 (getenv ("GDK_WIN32_OLE2_DND"), "0") == 0)
use_ole2_dnd = FALSE;
}

View File

@@ -55,12 +55,15 @@
#include "gdkdevicemanager-win32.h"
#include "gdkdisplay-win32.h"
#include "gdkdeviceprivate.h"
#include "gdkdevice-virtual.h"
#include "gdkdevice-wintab.h"
#include "gdkinput-winpointer.h"
#include "gdkwin32dnd.h"
#include "gdkwin32dnd-private.h"
#include "gdkdisplay-win32.h"
//#include "gdkselection-win32.h"
#include "gdkdragprivate.h"
#include "gdk-private.h"
#include <windowsx.h>
@@ -70,8 +73,9 @@
#endif
#include <objbase.h>
#include <imm.h>
#include <tchar.h>
#include <tpcshrd.h>
#define GDK_MOD2_MASK (1 << 4)
@@ -162,6 +166,10 @@ static int both_shift_pressed[2]; /* to store keycodes for shift keys */
static HHOOK keyboard_hook = NULL;
static UINT aerosnap_message;
static gboolean pen_touch_input;
static POINT pen_touch_cursor_position;
static LONG last_digitizer_time;
static void
track_mouse_event (DWORD dwFlags,
HWND hwnd)
@@ -196,6 +204,18 @@ _gdk_win32_get_next_tick (gulong suggested_tick)
return cur_tick = suggested_tick;
}
BOOL
_gdk_win32_get_cursor_pos (LPPOINT lpPoint)
{
if (pen_touch_input)
{
*lpPoint = pen_touch_cursor_position;
return TRUE;
}
else
return GetCursorPos (lpPoint);
}
static void
generate_focus_event (GdkDeviceManagerWin32 *device_manager,
GdkSurface *window,
@@ -502,7 +522,7 @@ _gdk_events_init (GdkDisplay *display)
#endif
source = g_source_new (&event_funcs, sizeof (GdkWin32EventSource));
g_source_set_name (source, "GDK Win32 event source");
g_source_set_static_name (source, "GDK Win32 event source");
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
event_source = (GdkWin32EventSource *)source;
@@ -1035,11 +1055,12 @@ do_show_window (GdkSurface *window, gboolean hide_window)
static void
send_crossing_event (GdkDisplay *display,
GdkSurface *window,
GdkDevice *physical_device,
GdkSurface *window,
GdkEventType type,
GdkCrossingMode mode,
GdkNotifyType notify_type,
GdkSurface *subwindow,
GdkSurface *subwindow,
POINT *screen_pt,
GdkModifierType mask,
guint32 time_)
@@ -1066,16 +1087,18 @@ send_crossing_event (GdkDisplay *display,
pt = *screen_pt;
ScreenToClient (GDK_SURFACE_HWND (window), &pt);
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer, physical_device);
event = gdk_crossing_event_new (type,
window,
device_manager->core_pointer,
_gdk_win32_get_next_tick (time_),
time_,
mask,
pt.x / impl->surface_scale,
pt.y / impl->surface_scale,
mode,
notify_type);
_gdk_win32_append_event (event);
}
@@ -1118,8 +1141,9 @@ find_common_ancestor (GdkSurface *win1,
void
synthesize_crossing_events (GdkDisplay *display,
GdkSurface *src,
GdkSurface *dest,
GdkDevice *physical_device,
GdkSurface *src,
GdkSurface *dest,
GdkCrossingMode mode,
POINT *screen_pt,
GdkModifierType mask,
@@ -1152,6 +1176,7 @@ synthesize_crossing_events (GdkDisplay *display,
else
notify_type = GDK_NOTIFY_ANCESTOR;
send_crossing_event (display,
physical_device,
a, GDK_LEAVE_NOTIFY,
mode,
notify_type,
@@ -1171,6 +1196,7 @@ synthesize_crossing_events (GdkDisplay *display,
while (win != c && win != NULL)
{
send_crossing_event (display,
physical_device,
win, GDK_LEAVE_NOTIFY,
mode,
notify_type,
@@ -1213,6 +1239,7 @@ synthesize_crossing_events (GdkDisplay *display,
next = b;
send_crossing_event (display,
physical_device,
win, GDK_ENTER_NOTIFY,
mode,
notify_type,
@@ -1232,6 +1259,7 @@ synthesize_crossing_events (GdkDisplay *display,
notify_type = GDK_NOTIFY_INFERIOR;
send_crossing_event (display,
physical_device,
b, GDK_ENTER_NOTIFY,
mode,
notify_type,
@@ -1241,6 +1269,26 @@ synthesize_crossing_events (GdkDisplay *display,
}
}
static void
make_crossing_event (GdkDevice *physical_device,
GdkSurface *surface,
POINT *screen_pt,
guint32 time_)
{
GDK_NOTE (EVENTS, g_print (" mouse_window %p -> %p",
mouse_window ? GDK_SURFACE_HWND (mouse_window) : NULL,
surface ? GDK_SURFACE_HWND (surface) : NULL));
synthesize_crossing_events (_gdk_display,
physical_device,
mouse_window, surface,
GDK_CROSSING_NORMAL,
screen_pt,
0, /* TODO: Set right mask */
time_,
FALSE);
g_set_object (&mouse_window, surface);
}
/* Acquires actual client area size of the underlying native window.
* Rectangle is in GDK screen coordinates (_gdk_offset_* is added).
* Returns FALSE if configure events should be inhibited,
@@ -1525,6 +1573,9 @@ 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;
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
_gdk_device_manager->system_pointer);
event = gdk_button_event_new (type,
window,
device_manager->core_pointer,
@@ -1756,6 +1807,8 @@ gdk_event_translate (MSG *msg,
GdkDeviceGrabInfo *pointer_grab = NULL;
GdkSurface *grab_window = NULL;
crossing_cb_t crossing_cb = NULL;
int button;
char buf[256];
@@ -2178,6 +2231,8 @@ gdk_event_translate (MSG *msg,
g_print (" (%d,%d)",
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
pen_touch_input = FALSE;
g_set_object (&window, find_window_for_mouse_event (window, msg));
/* TODO_CSW?: there used to some synthesize and propagate */
if (GDK_SURFACE_DESTROYED (window))
@@ -2220,6 +2275,8 @@ gdk_event_translate (MSG *msg,
g_print (" (%d,%d)",
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
pen_touch_input = FALSE;
g_set_object (&window, find_window_for_mouse_event (window, msg));
if (pointer_grab == NULL && implicit_grab_surface != NULL)
@@ -2244,11 +2301,12 @@ gdk_event_translate (MSG *msg,
}
synthesize_crossing_events (display,
_gdk_device_manager->system_pointer,
implicit_grab_surface, new_window,
GDK_CROSSING_UNGRAB,
&msg->pt,
0, /* TODO: Set right mask */
msg->time,
_gdk_win32_get_next_tick (msg->time),
FALSE);
g_set_object (&implicit_grab_surface, NULL);
g_set_object (&mouse_window, new_window);
@@ -2277,6 +2335,23 @@ gdk_event_translate (MSG *msg,
(gpointer) msg->wParam,
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
/* Even if we handle WM_POINTER messages, synthetic WM_MOUSEMOVE messages
* are still sent occasionally by the OS, e.g. when a surface is hidden
* or shown. Discard spurious WM_MOUSEMOVE messages while handling pen or
* touch input
*
* See the article
* "Why do I get spurious WM_MOUSEMOVE messages?" by Raymond Chen:
* https://devblogs.microsoft.com/oldnewthing/20031001-00/?p=42343
*
*/
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER &&
( (msg->time - last_digitizer_time) < 200 ||
-(msg->time - last_digitizer_time) < 200 ))
break;
pen_touch_input = FALSE;
new_window = window;
if (pointer_grab != NULL)
@@ -2304,15 +2379,16 @@ gdk_event_translate (MSG *msg,
if (mouse_window != new_window)
{
GDK_NOTE (EVENTS, g_print (" mouse_sinwod %p -> %p",
GDK_NOTE (EVENTS, g_print (" mouse_window %p -> %p",
mouse_window ? GDK_SURFACE_HWND (mouse_window) : NULL,
new_window ? GDK_SURFACE_HWND (new_window) : NULL));
synthesize_crossing_events (display,
_gdk_device_manager->system_pointer,
mouse_window, new_window,
GDK_CROSSING_NORMAL,
&msg->pt,
0, /* TODO: Set right mask */
msg->time,
_gdk_win32_get_next_tick (msg->time),
FALSE);
g_set_object (&mouse_window, new_window);
mouse_window_ignored_leave = NULL;
@@ -2350,6 +2426,9 @@ 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;
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
_gdk_device_manager->system_pointer);
event = gdk_motion_event_new (window,
device_manager_win32->core_pointer,
NULL,
@@ -2375,6 +2454,8 @@ gdk_event_translate (MSG *msg,
GDK_NOTE (EVENTS, g_print (" %d (%ld,%ld)",
HIWORD (msg->wParam), msg->pt.x, msg->pt.y));
pen_touch_input = FALSE;
new_window = NULL;
hwnd = WindowFromPoint (msg->pt);
ignore_leave = FALSE;
@@ -2400,11 +2481,12 @@ gdk_event_translate (MSG *msg,
if (!ignore_leave)
synthesize_crossing_events (display,
_gdk_device_manager->system_pointer,
mouse_window, new_window,
GDK_CROSSING_NORMAL,
&msg->pt,
0, /* TODO: Set right mask */
msg->time,
_gdk_win32_get_next_tick (msg->time),
FALSE);
g_set_object (&mouse_window, new_window);
mouse_window_ignored_leave = ignore_leave ? new_window : NULL;
@@ -2413,6 +2495,213 @@ gdk_event_translate (MSG *msg,
return_val = TRUE;
break;
case WM_POINTERDOWN:
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
gdk_winpointer_should_forward_message (msg))
{
return_val = FALSE;
break;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
{
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
pen_touch_input = TRUE;
last_digitizer_time = msg->time;
}
if (pointer_grab != NULL &&
!pointer_grab->implicit &&
!pointer_grab->owner_events)
g_set_object (&window, pointer_grab->surface);
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam) && mouse_window != window)
crossing_cb = make_crossing_event;
gdk_winpointer_input_events (window, crossing_cb, msg);
*ret_valp = 0;
return_val = TRUE;
break;
case WM_POINTERUP:
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
gdk_winpointer_should_forward_message (msg))
{
return_val = FALSE;
break;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
{
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
pen_touch_input = TRUE;
last_digitizer_time = msg->time;
}
if (pointer_grab != NULL &&
!pointer_grab->implicit &&
!pointer_grab->owner_events)
g_set_object (&window, pointer_grab->surface);
gdk_winpointer_input_events (window, NULL, msg);
impl = GDK_WIN32_SURFACE (window);
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
{
gdk_win32_surface_end_move_resize_drag (window);
}
*ret_valp = 0;
return_val = TRUE;
break;
case WM_POINTERUPDATE:
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
gdk_winpointer_should_forward_message (msg))
{
return_val = FALSE;
break;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
{
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
pen_touch_input = TRUE;
last_digitizer_time = msg->time;
}
if (pointer_grab != NULL &&
!pointer_grab->implicit &&
!pointer_grab->owner_events)
g_set_object (&window, pointer_grab->surface);
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam) && mouse_window != window)
crossing_cb = make_crossing_event;
impl = GDK_WIN32_SURFACE (window);
if (impl->drag_move_resize_context.op != GDK_WIN32_DRAGOP_NONE)
{
gdk_win32_surface_do_move_resize_drag (window, current_root_x, current_root_y);
}
else
{
gdk_winpointer_input_events (window, crossing_cb, msg);
}
*ret_valp = 0;
return_val = TRUE;
break;
case WM_NCPOINTERUPDATE:
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
gdk_winpointer_should_forward_message (msg))
{
return_val = FALSE;
break;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
{
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
pen_touch_input = TRUE;
last_digitizer_time = msg->time;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam) &&
!IS_POINTER_INCONTACT_WPARAM (msg->wParam) &&
mouse_window != NULL)
{
GdkDevice *event_device = NULL;
guint32 event_time = 0;
if (gdk_winpointer_get_message_info (msg, &event_device, &event_time))
{
make_crossing_event(event_device,
NULL,
&pen_touch_cursor_position,
event_time);
}
}
return_val = FALSE; /* forward to DefWindowProc */
break;
case WM_POINTERENTER:
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
gdk_winpointer_should_forward_message (msg))
{
return_val = FALSE;
break;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
{
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
pen_touch_input = TRUE;
last_digitizer_time = msg->time;
}
if (pointer_grab != NULL &&
!pointer_grab->implicit &&
!pointer_grab->owner_events)
g_set_object (&window, pointer_grab->surface);
if (IS_POINTER_NEW_WPARAM (msg->wParam))
{
gdk_winpointer_input_events (window, NULL, msg);
}
*ret_valp = 0;
return_val = TRUE;
break;
case WM_POINTERLEAVE:
if (win32_display->tablet_input_api != GDK_WIN32_TABLET_INPUT_API_WINPOINTER ||
gdk_winpointer_should_forward_message (msg))
{
return_val = FALSE;
break;
}
if (IS_POINTER_PRIMARY_WPARAM (msg->wParam))
{
current_root_x = pen_touch_cursor_position.x = GET_X_LPARAM (msg->lParam);
current_root_y = pen_touch_cursor_position.y = GET_Y_LPARAM (msg->lParam);
pen_touch_input = TRUE;
last_digitizer_time = msg->time;
}
if (!IS_POINTER_INRANGE_WPARAM (msg->wParam))
{
gdk_winpointer_input_events (window, NULL, msg);
}
else if (IS_POINTER_PRIMARY_WPARAM (msg->wParam) && mouse_window != NULL)
{
GdkDevice *event_device = NULL;
guint32 event_time = 0;
if (gdk_winpointer_get_message_info (msg, &event_device, &event_time))
{
make_crossing_event(event_device,
NULL,
&pen_touch_cursor_position,
event_time);
}
}
gdk_winpointer_interaction_ended (msg);
*ret_valp = 0;
return_val = TRUE;
break;
case WM_MOUSEWHEEL:
case WM_MOUSEHWHEEL:
GDK_NOTE (EVENTS, g_print (" %d", (short) HIWORD (msg->wParam)));
@@ -2475,6 +2764,9 @@ gdk_event_translate (MSG *msg,
*/
delta_y *= -1.0;
_gdk_device_virtual_set_active (_gdk_device_manager->core_pointer,
_gdk_device_manager->system_pointer);
event = gdk_scroll_event_new (window,
device_manager_win32->core_pointer,
NULL,
@@ -2508,44 +2800,6 @@ gdk_event_translate (MSG *msg,
return_val = TRUE;
break;
case WM_HSCROLL:
/* Just print more debugging information, don't actually handle it. */
GDK_NOTE (EVENTS,
(g_print (" %s",
(LOWORD (msg->wParam) == SB_ENDSCROLL ? "ENDSCROLL" :
(LOWORD (msg->wParam) == SB_LEFT ? "LEFT" :
(LOWORD (msg->wParam) == SB_RIGHT ? "RIGHT" :
(LOWORD (msg->wParam) == SB_LINELEFT ? "LINELEFT" :
(LOWORD (msg->wParam) == SB_LINERIGHT ? "LINERIGHT" :
(LOWORD (msg->wParam) == SB_PAGELEFT ? "PAGELEFT" :
(LOWORD (msg->wParam) == SB_PAGERIGHT ? "PAGERIGHT" :
(LOWORD (msg->wParam) == SB_THUMBPOSITION ? "THUMBPOSITION" :
(LOWORD (msg->wParam) == SB_THUMBTRACK ? "THUMBTRACK" :
"???")))))))))),
(LOWORD (msg->wParam) == SB_THUMBPOSITION ||
LOWORD (msg->wParam) == SB_THUMBTRACK) ?
(g_print (" %d", HIWORD (msg->wParam)), 0) : 0));
break;
case WM_VSCROLL:
/* Just print more debugging information, don't actually handle it. */
GDK_NOTE (EVENTS,
(g_print (" %s",
(LOWORD (msg->wParam) == SB_ENDSCROLL ? "ENDSCROLL" :
(LOWORD (msg->wParam) == SB_BOTTOM ? "BOTTOM" :
(LOWORD (msg->wParam) == SB_TOP ? "TOP" :
(LOWORD (msg->wParam) == SB_LINEDOWN ? "LINDOWN" :
(LOWORD (msg->wParam) == SB_LINEUP ? "LINEUP" :
(LOWORD (msg->wParam) == SB_PAGEDOWN ? "PAGEDOWN" :
(LOWORD (msg->wParam) == SB_PAGEUP ? "PAGEUP" :
(LOWORD (msg->wParam) == SB_THUMBPOSITION ? "THUMBPOSITION" :
(LOWORD (msg->wParam) == SB_THUMBTRACK ? "THUMBTRACK" :
"???")))))))))),
(LOWORD (msg->wParam) == SB_THUMBPOSITION ||
LOWORD (msg->wParam) == SB_THUMBTRACK) ?
(g_print (" %d", HIWORD (msg->wParam)), 0) : 0));
break;
case WM_MOUSEACTIVATE:
{
if (GDK_IS_DRAG_SURFACE (window))
@@ -2563,6 +2817,16 @@ gdk_event_translate (MSG *msg,
break;
case WM_POINTERACTIVATE:
if (GDK_IS_DRAG_SURFACE (window) ||
_gdk_modal_blocked (window))
{
*ret_valp = PA_NOACTIVATE;
return_val = TRUE;
}
break;
case WM_KILLFOCUS:
if (keyboard_grab != NULL &&
!GDK_SURFACE_DESTROYED (keyboard_grab->surface) &&
@@ -2954,6 +3218,13 @@ gdk_event_translate (MSG *msg,
*ret_valp = 0;
break;
case WM_DESTROY:
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_finalize_surface (window);
return_val = FALSE;
break;
case WM_NCDESTROY:
if ((pointer_grab != NULL && pointer_grab->surface == window) ||
(keyboard_grab && keyboard_grab->surface == window))
@@ -3034,12 +3305,15 @@ gdk_event_translate (MSG *msg,
{
gdk_synthesize_surface_state (window, 0, GDK_TOPLEVEL_STATE_FOCUSED);
/* Bring any tablet contexts to the top of the overlap order when
* one of our windows is activated.
* NOTE: It doesn't seem to work well if it is done in WM_ACTIVATEAPP
* instead
*/
_gdk_input_set_tablet_active ();
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
{
/* Bring any tablet contexts to the top of the overlap order when
* one of our windows is activated.
* NOTE: It doesn't seem to work well if it is done in WM_ACTIVATEAPP
* instead
*/
_gdk_wintab_set_tablet_active ();
}
}
break;
@@ -3056,6 +3330,16 @@ gdk_event_translate (MSG *msg,
GET_Y_LPARAM (msg->lParam), ret_valp);
break;
case WM_TABLET_QUERYSYSTEMGESTURESTATUS:
*ret_valp = TABLET_DISABLE_PRESSANDHOLD |
TABLET_DISABLE_PENTAPFEEDBACK |
TABLET_DISABLE_PENBARRELFEEDBACK |
TABLET_DISABLE_FLICKS |
TABLET_DISABLE_FLICKFALLBACKKEYS;
return_val = TRUE;
break;
/* Handle WINTAB events here, as we know that the device manager will
* use the fixed WT_DEFBASE as lcMsgBase, and we thus can use the
* constants as case labels.
@@ -3078,11 +3362,14 @@ gdk_event_translate (MSG *msg,
/* Fall through */
wintab:
event = gdk_input_other_event (display, msg, window);
if (event)
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINTAB)
{
_gdk_win32_append_event (event);
gdk_event_unref (event);
event = gdk_wintab_make_event (display, msg, window);
if (event)
{
_gdk_win32_append_event (event);
gdk_event_unref (event);
}
}
break;

View File

@@ -277,7 +277,7 @@ gdk_win32_display_init_egl (GdkDisplay *display,
display_win32->egl_disp = egl_disp;
display_win32->egl_version = epoxy_egl_version (egl_disp);
eglBindAPI(EGL_OPENGL_ES_API);
eglBindAPI (EGL_OPENGL_ES_API);
display_win32->hasEglSurfacelessContext =
epoxy_has_egl_extension (egl_disp, "EGL_KHR_surfaceless_context");

View File

@@ -278,6 +278,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
if (best_idx == 0 ||
!wglMakeCurrent (hdc, display_win32->dummy_context_wgl.hglrc))
{
if (display_win32->dummy_context_wgl.hglrc != NULL)
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No GL implementation is available"));
@@ -288,6 +291,22 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
display_win32->wgl_pixel_format = best_idx;
display_win32->gl_version = epoxy_gl_version ();
/* We must have OpenGL/WGL 2.0 or later, or have the GL_ARB_shader_objects extension */
if (display_win32->gl_version < 20)
{
if (!epoxy_has_gl_extension ("GL_ARB_shader_objects"))
{
wglMakeCurrent (NULL, NULL);
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No GL implementation is available"));
return FALSE;
}
}
display_win32->hasWglARBCreateContext =
epoxy_has_wgl_extension (hdc, "WGL_ARB_create_context");
display_win32->hasWglEXTSwapControl =

View File

@@ -42,9 +42,6 @@ HKL _gdk_input_locale;
gboolean _gdk_input_locale_is_ime = FALSE;
UINT _gdk_input_codepage;
int _gdk_input_ignore_wintab = FALSE;
int _gdk_max_colors = 0;
GdkWin32ModalOpKind _modal_operation_in_progress = GDK_WIN32_MODAL_OP_NONE;
HWND _modal_move_resize_window = NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,43 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2021 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_INPUT_WINPOINTER_H__
#define __GDK_INPUT_WINPOINTER_H__
#include "winpointer.h"
gboolean gdk_winpointer_initialize (void);
void gdk_winpointer_initialize_surface (GdkSurface *surface);
void gdk_winpointer_finalize_surface (GdkSurface *surface);
typedef void
(*crossing_cb_t)(GdkDevice *physical_device,
GdkSurface *surface,
POINT *screen_pt,
guint32 time_);
gboolean gdk_winpointer_should_forward_message (MSG *msg);
void gdk_winpointer_input_events (GdkSurface *surface,
crossing_cb_t crossing_cb,
MSG *msg);
gboolean gdk_winpointer_get_message_info (MSG *msg,
GdkDevice **device,
guint32 *time_);
void gdk_winpointer_interaction_ended (MSG *msg);
#endif /* __GDK_INPUT_WINPOINTER_H__ */

View File

@@ -54,11 +54,6 @@ _gdk_win32_surfaceing_init (void)
{
char buf[10];
if (getenv ("GDK_IGNORE_WINTAB") != NULL)
_gdk_input_ignore_wintab = TRUE;
else if (getenv ("GDK_USE_WINTAB") != NULL)
_gdk_input_ignore_wintab = FALSE;
if (gdk_synchronize)
GdiSetBatchLimit (1);
@@ -253,7 +248,6 @@ _gdk_win32_drag_protocol_to_string (GdkDragProtocol protocol)
CASE (NONE);
CASE (WIN32_DROPFILES);
CASE (OLE2);
CASE (LOCAL);
#undef CASE
default: return static_printf ("illegal_%d", protocol);
}

View File

@@ -15,22 +15,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined (_WIN32_WINNT) && WIN32_WINNT < 0x0601
# undef _WIN32_WINNT
# define _WIN32_WINNT 0x0601
# ifdef WINVER
# undef WINVER
# endif
# define WINVER _WIN32_WINNT
#elif !defined (_WIN32_WINNT)
# define _WIN32_WINNT 0x0601
# ifdef WINVER
# undef WINVER
# endif
# define WINVER _WIN32_WINNT
#endif
#include "config.h"
#include "gdkprivate-win32.h"

View File

@@ -25,15 +25,6 @@
#ifndef __GDK_PRIVATE_WIN32_H__
#define __GDK_PRIVATE_WIN32_H__
#ifndef WINVER
/* Vista or newer */
#define WINVER 0x0600
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT WINVER
#endif
#include <gdk/gdkcursorprivate.h>
#include <gdk/win32/gdksurface-win32.h>
#include <gdk/win32/gdkwin32display.h>
@@ -154,13 +145,14 @@ typedef enum
GDK_DRAG_PROTO_NONE = 0,
GDK_DRAG_PROTO_WIN32_DROPFILES,
GDK_DRAG_PROTO_OLE2,
GDK_DRAG_PROTO_LOCAL,
} GdkDragProtocol;
GType _gdk_gc_win32_get_type (void);
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
BOOL _gdk_win32_get_cursor_pos (LPPOINT lpPoint);
void _gdk_surface_init_position (GdkSurface *window);
void _gdk_surface_move_resize_child (GdkSurface *window,
int x,
@@ -250,6 +242,8 @@ void _gdk_other_api_failed (const char *where,
#define WIN32_GDI_FAILED(api) WIN32_API_FAILED (api)
#define OTHER_API_FAILED(api) _gdk_other_api_failed (G_STRLOC, api)
#define WIN32_API_FAILED_LOG_ONCE(api) G_STMT_START { static gboolean logged = 0; if (!logged) { _gdk_win32_api_failed (G_STRLOC , api); logged = 1; }} G_STMT_END
/* These two macros call a GDI or other Win32 API and if the return
* value is zero or NULL, print a warning message. The majority of GDI
* calls return zero or NULL on failure. The value of the macros is nonzero
@@ -313,11 +307,6 @@ extern HWND _modal_move_resize_window;
void _gdk_win32_begin_modal_call (GdkWin32ModalOpKind kind);
void _gdk_win32_end_modal_call (GdkWin32ModalOpKind kind);
/* Options */
extern gboolean _gdk_input_ignore_wintab;
extern int _gdk_max_colors;
/* Convert a pixbuf to an HICON (or HCURSOR). Supports alpha under
* Windows XP, thresholds alpha otherwise.
*/
@@ -442,7 +431,6 @@ BOOL WINAPI GtkShowWindow (GdkSurface *window,
/* Initialization */
void _gdk_win32_surfaceing_init (void);
void _gdk_drag_init (void);
void _gdk_drop_init (void);
void _gdk_events_init (GdkDisplay *display);
#endif /* __GDK_PRIVATE_WIN32_H__ */

View File

@@ -17,8 +17,6 @@
#include "config.h"
#define _WIN32_WINNT 0x0600
#include "gdk.h"
#include "gdkprivate-win32.h"
#include "gdkwin32screen.h"

View File

@@ -43,6 +43,7 @@
#include "gdkmonitorprivate.h"
#include "gdkwin32surface.h"
#include "gdkwin32cursor.h"
#include "gdkinput-winpointer.h"
#include "gdkglcontext-win32.h"
#include "gdkdisplay-win32.h"
#include "gdkdevice-win32.h"
@@ -204,7 +205,6 @@ gdk_surface_win32_finalize (GObject *object)
}
_gdk_win32_surface_unregister_dnd (GDK_SURFACE (surface));
g_clear_object (&surface->drop);
g_assert (surface->transient_owner == NULL);
g_assert (surface->transient_children == NULL);
@@ -646,6 +646,9 @@ _gdk_win32_display_create_surface (GdkDisplay *display,
return NULL;
}
if (display_win32->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER)
gdk_winpointer_initialize_surface (surface);
_gdk_win32_surface_enable_transparency (surface);
_gdk_win32_surface_register_dnd (surface);

View File

@@ -251,10 +251,6 @@ struct _GdkWin32Surface
* For OLE2 protocol only.
*/
drop_target_context *drop_target;
/* Temporarily holds the GdkDrop currently associated with this window.
* For LOCAL protocol only.
*/
GdkDrop *drop;
GdkSurface *transient_owner;
GSList *transient_children;

View File

@@ -93,38 +93,6 @@ struct _GdkWin32DragClass
gpointer _gdk_win32_dnd_thread_main (gpointer data);
GdkDrag *_gdk_win32_find_drag_for_dest_window (HWND dest_window);
GdkDrop *_gdk_win32_get_drop_for_dest_surface (GdkSurface *dest);
gboolean _gdk_win32_local_drop_target_will_emit_motion (GdkDrop *drop,
int x_root,
int y_root,
DWORD grfKeyState);
void _gdk_win32_local_drop_target_dragenter (GdkDrag *drag,
GdkSurface *dest_surface,
int x_root,
int y_root,
DWORD grfKeyState,
guint32 time_,
GdkDragAction *actions);
void _gdk_win32_local_drop_target_dragover (GdkDrop *drop,
GdkDrag *drag,
int x_root,
int y_root,
DWORD grfKeyState,
guint32 time_,
GdkDragAction *actions);
void _gdk_win32_local_drop_target_dragleave (GdkDrop *drop,
guint32 time_);
void _gdk_win32_local_drop_target_drop (GdkDrop *drop,
GdkDrag *drag,
guint32 time_,
GdkDragAction *actions);
void _gdk_win32_local_drag_give_feedback (GdkDrag *drag,
GdkDragAction actions);
void _gdk_win32_local_drag_drop_response (GdkDrag *drag,
GdkDragAction action);
G_END_DECLS

View File

@@ -6,6 +6,7 @@ gdk_win32_sources = files([
'gdkdevicemanager-win32.c',
'gdkdevice-virtual.c',
'gdkdevice-win32.c',
'gdkdevice-winpointer.c',
'gdkdevice-wintab.c',
'gdkdisplay-win32.c',
'gdkdisplaymanager-win32.c',
@@ -16,6 +17,7 @@ gdk_win32_sources = files([
'gdkglcontext-win32-wgl.c',
'gdkglobals-win32.c',
'gdkhdataoutputstream-win32.c',
'gdkinput-winpointer.c',
'gdkkeys-win32.c',
'gdkwin32langnotification.c',
'gdkmain-win32.c',
@@ -51,8 +53,9 @@ if win32_has_egl
gdk_win32_sources += ['gdkglcontext-win32-egl.c']
endif
gdk_win32_deps = [ # FIXME
pangowin32_dep
gdk_win32_deps = [
pangowin32_dep, # FIXME
cc.find_library('hid'),
]
libgdk_win32 = static_library('gdk-win32',
@@ -62,6 +65,8 @@ libgdk_win32 = static_library('gdk-win32',
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
'-DINSIDE_GDK_WIN32',
'-D_WIN32_WINNT=0x0601',
'-DWINVER=0x0601',
] + GDK_WIN32_EGL_CFLAGS,
dependencies: [ gdk_deps, gdk_win32_deps ],
)

320
gdk/win32/winpointer.h Normal file
View File

@@ -0,0 +1,320 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2021 the GTK team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/* This code is derived from portions provided by the mingw-w64 project
* (mingw-w64.org), originally licensed under the Zope Public License
* (ZPL) version 2.1, with modifications made on May 12, 2021.
* Legal notice of the Zope Public License version 2.1 follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions in source code must retain the accompanying copyright
* notice, this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the accompanying
* copyright notice, this list of conditions, and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* 3. Names of the copyright holders must not be used to endorse or promote
* products derived from this software without prior written permission
* from the copyright holders.
* 4. The right to distribute this software or to use it for any purpose does
* not give you the right to use Servicemarks (sm) or Trademarks (tm) of
* the copyright holders. Use of them is covered by separate agreement
* with the copyright holders.
* 5. If any files are modified, you must cause the modified files to carry
* prominent notices stating that you changed the files and the date of
* any change.
*/
#ifndef POINTER_FLAG_NONE
#include <windows.h>
#include <tchar.h>
#define WM_POINTERDEVICECHANGE 0x238
#define WM_POINTERDEVICEINRANGE 0x239
#define WM_POINTERDEVICEOUTOFRANGE 0x23a
#define WM_NCPOINTERUPDATE 0x0241
#define WM_NCPOINTERDOWN 0x0242
#define WM_NCPOINTERUP 0x0243
#define WM_POINTERUPDATE 0x0245
#define WM_POINTERDOWN 0x0246
#define WM_POINTERUP 0x0247
#define WM_POINTERENTER 0x0249
#define WM_POINTERLEAVE 0x024a
#define WM_POINTERACTIVATE 0x024b
#define WM_POINTERCAPTURECHANGED 0x024c
#define WM_TOUCHHITTESTING 0x024d
#define WM_POINTERWHEEL 0x024e
#define WM_POINTERHWHEEL 0x024f
#define DM_POINTERHITTEST 0x0250
#define WM_POINTERROUTEDTO 0x0251
#define WM_POINTERROUTEDAWAY 0x0252
#define WM_POINTERROUTEDRELEASED 0x0253
#define POINTER_FLAG_NONE 0x00000000
#define POINTER_FLAG_NEW 0x00000001
#define POINTER_FLAG_INRANGE 0x00000002
#define POINTER_FLAG_INCONTACT 0x00000004
#define POINTER_FLAG_FIRSTBUTTON 0x00000010
#define POINTER_FLAG_SECONDBUTTON 0x00000020
#define POINTER_FLAG_THIRDBUTTON 0x00000040
#define POINTER_FLAG_FOURTHBUTTON 0x00000080
#define POINTER_FLAG_FIFTHBUTTON 0x00000100
#define POINTER_FLAG_PRIMARY 0x00002000
#define POINTER_FLAG_CONFIDENCE 0x00004000
#define POINTER_FLAG_CANCELED 0x00008000
#define POINTER_FLAG_DOWN 0x00010000
#define POINTER_FLAG_UPDATE 0x00020000
#define POINTER_FLAG_UP 0x00040000
#define POINTER_FLAG_WHEEL 0x00080000
#define POINTER_FLAG_HWHEEL 0x00100000
#define POINTER_FLAG_CAPTURECHANGED 0x00200000
#define POINTER_FLAG_HASTRANSFORM 0x00400000
#define POINTER_MOD_SHIFT (0x0004)
#define POINTER_MOD_CTRL (0x0008)
#define TOUCH_FLAG_NONE 0x00000000
#define TOUCH_MASK_NONE 0x00000000
#define TOUCH_MASK_CONTACTAREA 0x00000001
#define TOUCH_MASK_ORIENTATION 0x00000002
#define TOUCH_MASK_PRESSURE 0x00000004
#define PEN_FLAG_NONE 0x00000000
#define PEN_FLAG_BARREL 0x00000001
#define PEN_FLAG_INVERTED 0x00000002
#define PEN_FLAG_ERASER 0x00000004
#define PEN_MASK_NONE 0x00000000
#define PEN_MASK_PRESSURE 0x00000001
#define PEN_MASK_ROTATION 0x00000002
#define PEN_MASK_TILT_X 0x00000004
#define PEN_MASK_TILT_Y 0x00000008
#define POINTER_MESSAGE_FLAG_NEW 0x00000001
#define POINTER_MESSAGE_FLAG_INRANGE 0x00000002
#define POINTER_MESSAGE_FLAG_INCONTACT 0x00000004
#define POINTER_MESSAGE_FLAG_FIRSTBUTTON 0x00000010
#define POINTER_MESSAGE_FLAG_SECONDBUTTON 0x00000020
#define POINTER_MESSAGE_FLAG_THIRDBUTTON 0x00000040
#define POINTER_MESSAGE_FLAG_FOURTHBUTTON 0x00000080
#define POINTER_MESSAGE_FLAG_FIFTHBUTTON 0x00000100
#define POINTER_MESSAGE_FLAG_PRIMARY 0x00002000
#define POINTER_MESSAGE_FLAG_CONFIDENCE 0x00004000
#define POINTER_MESSAGE_FLAG_CANCELED 0x00008000
#define GET_POINTERID_WPARAM(wParam) (LOWORD (wParam))
#define IS_POINTER_FLAG_SET_WPARAM(wParam, flag) (((DWORD)HIWORD (wParam) &(flag)) == (flag))
#define IS_POINTER_NEW_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_NEW)
#define IS_POINTER_INRANGE_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_INRANGE)
#define IS_POINTER_INCONTACT_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_INCONTACT)
#define IS_POINTER_FIRSTBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_FIRSTBUTTON)
#define IS_POINTER_SECONDBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_SECONDBUTTON)
#define IS_POINTER_THIRDBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_THIRDBUTTON)
#define IS_POINTER_FOURTHBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_FOURTHBUTTON)
#define IS_POINTER_FIFTHBUTTON_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_FIFTHBUTTON)
#define IS_POINTER_PRIMARY_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_PRIMARY)
#define HAS_POINTER_CONFIDENCE_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_CONFIDENCE)
#define IS_POINTER_CANCELED_WPARAM(wParam) IS_POINTER_FLAG_SET_WPARAM (wParam, POINTER_MESSAGE_FLAG_CANCELED)
#define PA_ACTIVATE MA_ACTIVATE
#define PA_NOACTIVATE MA_NOACTIVATE
typedef DWORD POINTER_INPUT_TYPE;
typedef UINT32 POINTER_FLAGS;
typedef UINT32 TOUCH_FLAGS;
typedef UINT32 TOUCH_MASK;
typedef UINT32 PEN_FLAGS;
typedef UINT32 PEN_MASK;
enum tagPOINTER_INPUT_TYPE {
PT_POINTER = 0x00000001,
PT_TOUCH = 0x00000002,
PT_PEN = 0x00000003,
PT_MOUSE = 0x00000004,
PT_TOUCHPAD = 0x00000005
};
typedef enum tagFEEDBACK_TYPE {
FEEDBACK_TOUCH_CONTACTVISUALIZATION = 1,
FEEDBACK_PEN_BARRELVISUALIZATION = 2,
FEEDBACK_PEN_TAP = 3,
FEEDBACK_PEN_DOUBLETAP = 4,
FEEDBACK_PEN_PRESSANDHOLD = 5,
FEEDBACK_PEN_RIGHTTAP = 6,
FEEDBACK_TOUCH_TAP = 7,
FEEDBACK_TOUCH_DOUBLETAP = 8,
FEEDBACK_TOUCH_PRESSANDHOLD = 9,
FEEDBACK_TOUCH_RIGHTTAP = 10,
FEEDBACK_GESTURE_PRESSANDTAP = 11,
FEEDBACK_MAX = 0xffffffff
} FEEDBACK_TYPE;
typedef enum tagPOINTER_BUTTON_CHANGE_TYPE {
POINTER_CHANGE_NONE,
POINTER_CHANGE_FIRSTBUTTON_DOWN,
POINTER_CHANGE_FIRSTBUTTON_UP,
POINTER_CHANGE_SECONDBUTTON_DOWN,
POINTER_CHANGE_SECONDBUTTON_UP,
POINTER_CHANGE_THIRDBUTTON_DOWN,
POINTER_CHANGE_THIRDBUTTON_UP,
POINTER_CHANGE_FOURTHBUTTON_DOWN,
POINTER_CHANGE_FOURTHBUTTON_UP,
POINTER_CHANGE_FIFTHBUTTON_DOWN,
POINTER_CHANGE_FIFTHBUTTON_UP,
} POINTER_BUTTON_CHANGE_TYPE;
typedef struct tagPOINTER_INFO {
POINTER_INPUT_TYPE pointerType;
UINT32 pointerId;
UINT32 frameId;
POINTER_FLAGS pointerFlags;
HANDLE sourceDevice;
HWND hwndTarget;
POINT ptPixelLocation;
POINT ptHimetricLocation;
POINT ptPixelLocationRaw;
POINT ptHimetricLocationRaw;
DWORD dwTime;
UINT32 historyCount;
INT32 InputData;
DWORD dwKeyStates;
UINT64 PerformanceCount;
POINTER_BUTTON_CHANGE_TYPE ButtonChangeType;
} POINTER_INFO;
typedef struct tagPOINTER_TOUCH_INFO {
POINTER_INFO pointerInfo;
TOUCH_FLAGS touchFlags;
TOUCH_MASK touchMask;
RECT rcContact;
RECT rcContactRaw;
UINT32 orientation;
UINT32 pressure;
} POINTER_TOUCH_INFO;
typedef struct tagPOINTER_PEN_INFO {
POINTER_INFO pointerInfo;
PEN_FLAGS penFlags;
PEN_MASK penMask;
UINT32 pressure;
UINT32 rotation;
INT32 tiltX;
INT32 tiltY;
} POINTER_PEN_INFO;
typedef enum {
POINTER_FEEDBACK_DEFAULT = 1,
POINTER_FEEDBACK_INDIRECT = 2,
POINTER_FEEDBACK_NONE = 3
} POINTER_FEEDBACK_MODE;
typedef struct tagUSAGE_PROPERTIES {
USHORT level;
USHORT page;
USHORT usage;
INT32 logicalMinimum;
INT32 logicalMaximum;
USHORT unit;
USHORT exponent;
BYTE count;
INT32 physicalMinimum;
INT32 physicalMaximum;
} USAGE_PROPERTIES, *PUSAGE_PROPERTIES;
typedef struct tagPOINTER_TYPE_INFO {
POINTER_INPUT_TYPE type;
union {
POINTER_TOUCH_INFO touchInfo;
POINTER_PEN_INFO penInfo;
} DUMMYUNIONNAME;
} POINTER_TYPE_INFO, *PPOINTER_TYPE_INFO;
#define POINTER_DEVICE_PRODUCT_STRING_MAX 520
#define PDC_ARRIVAL 0x001
#define PDC_REMOVAL 0x002
#define PDC_ORIENTATION_0 0x004
#define PDC_ORIENTATION_90 0x008
#define PDC_ORIENTATION_180 0x010
#define PDC_ORIENTATION_270 0x020
#define PDC_MODE_DEFAULT 0x040
#define PDC_MODE_CENTERED 0x080
#define PDC_MAPPING_CHANGE 0x100
#define PDC_RESOLUTION 0x200
#define PDC_ORIGIN 0x400
#define PDC_MODE_ASPECTRATIOPRESERVED 0x800
typedef enum tagPOINTER_DEVICE_TYPE {
POINTER_DEVICE_TYPE_INTEGRATED_PEN = 0x00000001,
POINTER_DEVICE_TYPE_EXTERNAL_PEN = 0x00000002,
POINTER_DEVICE_TYPE_TOUCH = 0x00000003,
POINTER_DEVICE_TYPE_TOUCH_PAD = 0x00000004,
POINTER_DEVICE_TYPE_MAX = 0xffffffff
} POINTER_DEVICE_TYPE;
typedef struct tagPOINTER_DEVICE_INFO {
DWORD displayOrientation;
HANDLE device;
POINTER_DEVICE_TYPE pointerDeviceType;
HMONITOR monitor;
ULONG startingCursorId;
USHORT maxActiveContacts;
WCHAR productString[POINTER_DEVICE_PRODUCT_STRING_MAX];
} POINTER_DEVICE_INFO;
typedef struct tagPOINTER_DEVICE_PROPERTY {
INT32 logicalMin;
INT32 logicalMax;
INT32 physicalMin;
INT32 physicalMax;
UINT32 unit;
UINT32 unitExponent;
USHORT usagePageId;
USHORT usageId;
} POINTER_DEVICE_PROPERTY;
typedef enum tagPOINTER_DEVICE_CURSOR_TYPE {
POINTER_DEVICE_CURSOR_TYPE_UNKNOWN = 0x00000000,
POINTER_DEVICE_CURSOR_TYPE_TIP = 0x00000001,
POINTER_DEVICE_CURSOR_TYPE_ERASER = 0x00000002,
POINTER_DEVICE_CURSOR_TYPE_MAX = 0xffffffff
} POINTER_DEVICE_CURSOR_TYPE;
typedef struct tagPOINTER_DEVICE_CURSOR_INFO {
UINT32 cursorId;
POINTER_DEVICE_CURSOR_TYPE cursor;
} POINTER_DEVICE_CURSOR_INFO;
#endif /* POINTER_FLAG_NONE */
#if WINVER < 0x0601
typedef struct tagGESTURECONFIG {
DWORD dwID;
DWORD dwWant;
DWORD dwBlock;
} GESTURECONFIG,*PGESTURECONFIG;
#endif /* WINVER < 0x0601 */
#ifndef MICROSOFT_TABLETPENSERVICE_PROPERTY
#define MICROSOFT_TABLETPENSERVICE_PROPERTY _T("MicrosoftTabletPenServiceProperty")
#endif

View File

@@ -25,6 +25,7 @@
#include "gdkintl.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdk-private.h"
#include <glib.h>
#ifdef HAVE_DESKTOPAPPINFO
@@ -219,7 +220,7 @@ startup_timeout (void *data)
std->timeout_id = 0;
else {
std->timeout_id = g_timeout_add_seconds ((min_timeout + 500)/1000, startup_timeout, std);
g_source_set_name_by_id (std->timeout_id, "[gtk] startup_timeout");
gdk_source_set_static_name_by_id (std->timeout_id, "[gtk] startup_timeout");
}
/* always remove this one, but we may have reinstalled another one. */
@@ -256,7 +257,7 @@ add_startup_timeout (GdkX11Screen *screen,
if (data->timeout_id == 0) {
data->timeout_id = g_timeout_add_seconds (STARTUP_TIMEOUT_LENGTH_SECONDS,
startup_timeout, data);
g_source_set_name_by_id (data->timeout_id, "[gtk] startup_timeout");
gdk_source_set_static_name_by_id (data->timeout_id, "[gtk] startup_timeout");
}
}

View File

@@ -46,6 +46,7 @@ in this Software without prior written authorization from The Open Group.
#include "gdkasync.h"
#include "gdkprivate-x11.h"
#include "gdkdisplay-x11.h"
#include "gdk-private.h"
#include <X11/Xlibint.h>
@@ -171,7 +172,7 @@ send_event_handler (Display *dpy,
{
guint id;
id = g_idle_add (callback_idle, state);
g_source_set_name_by_id (id, "[gtk] callback_idle");
gdk_source_set_static_name_by_id (id, "[gtk] callback_idle");
}
DeqAsyncHandler(state->dpy, &state->async);
@@ -707,7 +708,7 @@ roundtrip_handler (Display *dpy,
{
guint id;
id = g_idle_add (roundtrip_callback_idle, state);
g_source_set_name_by_id (id, "[gtk] roundtrip_callback_idle");
gdk_source_set_static_name_by_id (id, "[gtk] roundtrip_callback_idle");
}
DeqAsyncHandler(state->dpy, &state->async);

View File

@@ -1037,8 +1037,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
if (xevent->type - display_x11->xrandr_event_base == RRScreenChangeNotify ||
xevent->type - display_x11->xrandr_event_base == RRNotify)
{
if (x11_screen)
_gdk_x11_screen_size_changed (x11_screen, xevent);
if (display_x11->screen)
_gdk_x11_screen_size_changed (display_x11->screen, xevent);
}
else
#endif

View File

@@ -884,8 +884,10 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
if (drag_x11->version == 5)
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
g_object_ref (drag);
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
g_object_unref (drag);
}
}
@@ -1862,7 +1864,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
g_object_unref (drag);
}

View File

@@ -1282,7 +1282,10 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
class_hint = XAllocClassHint ();
class_hint->res_name = (char *) g_get_prgname ();
class_hint->res_class = (char *) display_x11->program_class;
if (display_x11->program_class)
class_hint->res_class = (char *) display_x11->program_class;
else
class_hint->res_class = class_hint->res_name;
XSetClassHint (xdisplay, impl->xid, class_hint);
XFree (class_hint);

View File

@@ -89,7 +89,7 @@ get_boolean_default (GdkX11Screen *x11_screen,
char *v;
int i;
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
v = XGetDefault (dpy, "Xft", option);
@@ -114,7 +114,7 @@ get_double_default (GdkX11Screen *x11_screen,
Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
char *v, *e;
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
v = XGetDefault (dpy, "Xft", option);
@@ -141,7 +141,7 @@ get_integer_default (GdkX11Screen *x11_screen,
Display *dpy = GDK_SCREEN_XDISPLAY (x11_screen);
char *v, *e;
if (GDK_DISPLAY_DEBUG_CHECK (GDK_SCREEN_DISPLAY (x11_screen), DEFAULT_SETTINGS))
if (gdk_display_get_debug_flags (GDK_SCREEN_DISPLAY (x11_screen)) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
v = XGetDefault (dpy, "Xft", option);

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