Compare commits

...

1020 Commits

Author SHA1 Message Date
Emmanuele Bassi
258233efa9 WIP: Import the GTK 2 treeview tutorial
The tree view tutorial at http://scentric.net/tutorial should be part of
the GTK API reference.

This is a work in progress import; the tutorial needs heavy editing, and
the overall state of the docbook markup is pretty dire.
2019-01-14 15:49:45 +00:00
Timm Bäder
59bf76dce1 gl renderer: Force blur shadow node children offscreen
This broke the overlay blur demoe when resizing the window to a size
that would completely move the image below a button, causing the
GtkSnapshot code to remove the clip node below the blur node.
2019-01-13 08:41:37 +01:00
Timm Bäder
44a2a49f31 overlay: Directly create cairo_region
Instead of doing a cairo_region_create + union, just pass the rect
directly to cairo_region_create_rectangle
2019-01-13 08:41:37 +01:00
Timm Bäder
69bc42f444 rendernodepaintable: Don't try to snapshot 0×0 nodes
Considering the operations that some of the rendernode constructors
do, nodes with width or height 0 (or both of course) are very well
possible. This would break in the rendernodepaintable when adding a
transform, which divides by width/height of the rendernode.
2019-01-13 08:39:05 +01:00
Timm Bäder
269535c844 overlay: Blur the clipped node, not clip the blurred node
Blurring is a lot more expensive than clipping, so try to blur less by
clipping first.
2019-01-13 08:23:25 +01:00
Timm Bäder
c7f773f3e3 overlay: Trivial indentation fix 2019-01-13 08:23:25 +01:00
Timm Bäder
c6da0c9a7a demo: Fix tranparency overlay demo
We'd like the rose picture to be bigger than 16×16. Also remove the
scrolledwindow since the GtkPicture now automatically scales down the
rose image. This also fixes the picture always being allocated at y=0.
2019-01-13 08:23:25 +01:00
Timm Bäder
d098cd5865 overlay: Don't offset the main window snapshot
We need the node without an offset applied.

Fixes the rose picture being offset in tests/testoverlay
2019-01-13 08:23:25 +01:00
Timm Bäder
4dc8ab58a3 testoverlay: Re-enable blurring
Accidentally disabled in 8b14c8d0a8
2019-01-13 08:23:25 +01:00
Timm Bäder
5680393f9d label: Add missing nullable annotation 2019-01-13 08:23:25 +01:00
Piotr Drąg
aadcec3d1e Update Polish translation 2019-01-12 13:19:35 +01:00
Timm Bäder
5fd936beef spinbutton: Use increment/decrement icon names
And add list-{remove,add}-symbolic as fallback.

Fixes #1569
2019-01-11 18:29:20 +01:00
Timm Bäder
563b80d434 label: Skip updating link state if we have no layout
This can happen whenever the ::activate-link handler sets different
markup on the label, causing all links to be recreated. In this case,
the GtkLabelLink* passed to emit_activate_link is garbage after the
g_signal_emit call and we shouldn't try to do anything with it.

Fixes #1498
2019-01-11 17:46:12 +01:00
Timm Bäder
f4f0f0e6a0 snapshot: Get new GArray item directly
Instead of building it up ourselves, then coping it into the GArray and
then getting the last element of that array.
2019-01-11 17:02:23 +01:00
Emmanuele Bassi
ba9b0c6f7d Use the IEC power symbols for GtkSwitch labels
Unicode 9.0 introduced glyps for the "on" and "off" power states, in the
form of:

 - U+23FD POWER ON SYMBOL, or ⏽
 - U+2B58 HEAVY CIRCLE, or ⭘

With `HEAVY CIRCLE` as "power off symbol" selected to avoid adding yet
another circle to the standard.

Since we moved GtkSwitch to always show glyphs instead of (translatable)
strings, asking the localisation teams to either come up with a suitable
short string to replace the English "ON" and "OFF", or to fall back to
Unicode glyphs, we should ensure we're using the appropriate symbols to
begin with.

See also: gtk!503 for the corresponding gtk-3-24 change.
2019-01-11 15:25:30 +00:00
Timm Bäder
3ce3de98da Merge branch 'wip/muktupavels/listbox-master' into 'master'
listbox: set selected_row before emitting signal

See merge request GNOME/gtk!502
2019-01-11 11:38:27 +00:00
Alberts Muktupāvels
1cd934e105 listbox: set selected_row before emitting signal
Signal emittion was added in 6f857f87dc commit and it seems that
this is only place where selected_row is set after emitting signal.

Because of this gtk_list_box_get_selected_row currently returns NULL
as selected row if selection mode is set to GTK_SELECTION_BROWSE.
2019-01-11 13:19:28 +02:00
Timm Bäder
dc1d3824a2 Merge branch 'wip/dboles/EventControllerKey-docs-4' into 'master'
EventControllerKey: Add missing documentation bits

See merge request GNOME/gtk!454
2019-01-11 09:39:25 +00:00
Matthias Clasen
927e49ed86 switch: Always use I/O
This allows for smaller switches, and goes better with
modern themes that have round switches.
2019-01-10 17:21:48 -05:00
Timm Bäder
d55fc8b7b1 gl renderer: Dont't try to draw glyphs at scale 0
Fixes #1475
2019-01-10 17:14:48 +01:00
Timm Bäder
e72d0a9118 gl glyphcache: Only support one dirty glyph per atlas 2019-01-10 16:49:19 +01:00
Timm Bäder
8b14c8d0a8 testoverlay: Fix fancy effect 2019-01-10 16:49:19 +01:00
Timm Bäder
913b4fcc49 iconcache: Remove unused defines 2019-01-10 16:49:19 +01:00
Timm Bäder
fb7d033953 gl renderer: Remove debug code 2019-01-10 16:49:19 +01:00
Timm Bäder
cfa440bbae gl renderer: Fix hidpi transform nodes 2019-01-10 16:49:19 +01:00
Timm Bäder
7ac9fe3b60 shadowvalue: Remove unused API 2019-01-10 16:49:19 +01:00
Timm Bäder
b0a8b7da63 gl renderer: Only compile the vertex shader once
All our programs use the same vertex shader, so don't compile it over
and over again. This improves startup times by at least 0.001%, I swear.
2019-01-10 16:49:19 +01:00
Timm Bäder
b2ff6e91cd gl renderer: Don't forget the offset when rendering blur nodes 2019-01-10 16:49:19 +01:00
Daniel Mustieles
b4d906c464 Update Spanish translation 2019-01-10 08:50:55 +00:00
Timm Bäder
ae03caacc4 Merge branch 'patch-1' into 'master'
Fix a typo in “popup-context-menu” documentation.

See merge request GNOME/gtk!500
2019-01-10 06:23:09 +00:00
bodqhrohro
ec22646210 Fix a typo in “popup-context-menu” documentation. 2019-01-09 14:24:29 +00:00
Timm Bäder
ba1644cba1 Merge branch 'wip/sadiq/750-gtk4' into 'master'
gtkpopover: Fix popover when parent widget is partially visible

Closes #750

See merge request GNOME/gtk!496
2019-01-09 11:53:45 +00:00
Mohammed Sadiq
d11bc68b27 gtkpopover: Fix popover when parent widget is partially visible
fixes https://gitlab.gnome.org/GNOME/gtk/issues/750
2019-01-09 17:12:23 +05:30
Daniel Mustieles
5720e406b9 Updated Spanish translation 2019-01-09 09:52:53 +01:00
Emmanuele Bassi
b3f8f358b5 Merge branch 'meson-warning' into 'master'
build: Avoid a Meson deprecation warning

See merge request GNOME/gtk!493
2019-01-08 14:59:21 +00:00
Emmanuele Bassi
e458ea2f3d build: Avoid a Meson deprecation warning
Using an empty `configuration_data` object to copy a configuration file
is deprecated since Meson 0.47 (released July 2018); the equivalent
behaviour is available by using `copy: true`.
2019-01-08 14:46:46 +00:00
Benjamin Otte
b6d8d3975e revealer: Handle child-visible properly
The target position is irrelevant for determining if the child should be
visible. When the current position is 0, it needs to be hidden, period.

Fixes #1355
2019-01-08 01:29:41 +01:00
Benjamin Otte
5e96129be1 settings: Don't special case IM modules
The previous fixes made it unnecessary to hardcode IM modules for
different display types. The code now automatically skips system IM
modules for other displays.
2019-01-08 00:41:12 +01:00
Benjamin Otte
0ef7d07880 immodule: Check if module matches display
When loading IM modules from environment variables or GtkSettings, we
would accept "xim" on Wayland. That is a bad idea.
2019-01-08 00:41:12 +01:00
Benjamin Otte
545e95bb5c immodule: Don't load unsupported IM module
The code would technically allow loading the xim module when X11 support
was not compiled in.

This is probably an artificial concern, because it's pretty hard to
compile XIM support without X11 support, but it makes the code clearer,
so there we go.
2019-01-08 00:41:12 +01:00
Benjamin Otte
ca76675a69 immodule: Pass a GdkDisplay for default context ID
After all, the context depends on the display - we want to use the
wayland context for Wayland,  xim for X11 and so on.
2019-01-08 00:41:12 +01:00
Benjamin Otte
16d4ce4d03 immulticontext: Don't have a global_context_id
Context IDs are dependant on the display - both because displays can use
different backends, but also because changing the GtkSetting is a
per-display operation.

So just remove the cache.
If it turns out we need a per-display cache, we can add one to
GtkSettings.
2019-01-08 00:41:12 +01:00
Olivier Fourdan
58e273d056 a11y: Check display in *grab_cell_focus()
Calling the accessibility function `grab_focus()` on a `GtkCell` under
Wayland will cause the client to crash.

This is another case of `gdk_x11_get_server_time()` being called
regardless of the actual windowing backend used.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1507
2019-01-07 21:06:57 +00:00
Carlos Garnacho
1c14285dee flowbox: Accept multipress gesture late
So it's able to operate properly with the DnD gesture set by
gtk_drag_source_set(). We usually just react on button release,
that's the right time to claim the gesture.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1557
2019-01-07 21:01:59 +00:00
Daniel Boles
cd69570e78 searchenginequartz: Fix naming of Beagle @ comment
As funny as that is, it's not very instructive. :P

https://gitlab.gnome.org/GNOME/gtk/merge_requests/490#note_400993
2019-01-07 20:46:08 +00:00
John Ralls
52b9e4703b [GtkSearchEngineQuartz] Limit the returned hits.
When the result set is larger than the limit.
2019-01-07 20:46:08 +00:00
Daniel Boles
d7193eaf8b [GtkSearchEngineQuartz] Resolve the path to a GtkFile* for the hit list.
Instead of a char* path, which the search_hit parser doesn't expect,
causing a crash.

Closes: $https://gitlab.gnome.org/GNOME/gtk/issues/815
2019-01-07 20:46:08 +00:00
Carlos Garnacho
b52dea7a10 Merge branch 'fix-corner-resize' into 'master'
Fix resize corners

See merge request GNOME/gtk!481
2019-01-07 18:14:33 +00:00
Matthias Clasen
7bb5888272 Merge branch 'commit-docs' into 'master'
docs: Move commit style docs to the contribution guide

See merge request GNOME/gtk!358
2019-01-07 16:44:41 +00:00
Ryuta Fujii
4404afc9f3 Update Japanese translation 2019-01-05 01:16:56 +00:00
Ryuta Fujii
dadac6a9e1 Update Japanese translation
(cherry picked from commit 69ddfcf1ed)
2019-01-04 22:21:43 +00:00
Aurimas Černius
210a06174d Updated Lithuanian translation 2019-01-04 23:23:00 +02:00
Timm Bäder
f9a5a474f0 imcontextwayland: (Hopefully) fix if expression 2019-01-04 05:55:26 +01:00
Piotr Drąg
c51f1fda28 Update POTFILES.in 2019-01-03 19:21:09 +01:00
Timm Bäder
ea3d0c0f01 buttonbox: Remove redundant if statement
This used to do something in the past.
2019-01-03 08:57:16 +01:00
Timm Bäder
2c1198f6c2 colorchooser: Remove extra custom color 2019-01-03 08:56:46 +01:00
Timm Bäder
9d3120cc1e popover demo: Fix size-allocate callback signature 2019-01-03 08:56:40 +01:00
Timm Bäder
66d3aa8101 window: Fix state_flags_changed impl name
This is unrelated to GdkSurface and was changed by accident.
2019-01-03 08:56:34 +01:00
Timm Bäder
0530637fef stack: Don't queue an unnecessary redraw
Both queue_allocate and queue_resize already queue a draw.
2019-01-03 08:52:35 +01:00
Timm Bäder
3d6bdb9af3 entry: Remove unused struct 2019-01-03 08:52:08 +01:00
Matthias Clasen
7e7c90961c Check for the session bus before using it
Patch by Chris Allen, #475
2019-01-02 20:35:19 -05:00
Matthias Clasen
3da9280a8a Merge branch 'wip/nbenitezl/move-bookmark-placeholder-index-4' into 'master'
gtkplacessidebar.c: move bookmark at the placeholder index

See merge request GNOME/gtk!459
2019-01-03 01:27:49 +00:00
Matthias Clasen
ed17a8ddd7 Merge branch 'patch-1' into 'master'
Zero-fill new GtkTextIter

See merge request GNOME/gtk!455
2019-01-03 01:02:07 +00:00
Matthias Clasen
cd7e70680c Merge branch 'wip/carlosg/imwayland-for-master' into 'master'
Use zwp_text_input_v3 on gtk4

Closes #1317 and #1525

See merge request GNOME/gtk!462
2019-01-03 00:36:35 +00:00
Matthias Clasen
a80007ac12 Fix XChangeProperty calls
They must be long...

Closes: #1556
2019-01-02 19:26:56 -05:00
Matthias Clasen
dc68d04c32 Fix resize corners
I was stuck in an X session and noticed that my resize corners
all got east or north cursors. It turns out that gnome-shell
does not properly advertise support for edge constraints under X11,
and the absence of that makes the code for determining the edge
under the cursor misbehave.

This change should fix that.
2019-01-02 19:08:02 -05:00
Timm Bäder
bd95e16372 Merge branch 'wip/carlosg/revealer-fix-interrupted-animations-master' into 'master'
revealer: Fully set the target state if unmapped during animation

See merge request GNOME/gtk!466
2019-01-02 08:50:25 +00:00
Timm Bäder
c1e1e2da80 image: Avoid some unnecessary signal connections
Equivalent if fd9879e5ff but for GtkImage.
2018-12-31 12:44:02 +01:00
Timm Bäder
ea8f1469c1 image: Indentation fix 2018-12-31 12:44:02 +01:00
Timm Bäder
1d3aa9207c gl renderer: Add a clip stack
So we can check that the currently set clip is the first one and now
intersect with it. This first clip is always the entire viewport or the
entire render_area and we don't want to end up drawing things to a
texture because of it.
2018-12-31 12:44:02 +01:00
Timm Bäder
b4f2a3416e picture: Avoid some unnecessary signal connections
We don't need to ever invalidate the picture size if the paintable tells
us its size is static. Same for the contents.
2018-12-31 12:44:02 +01:00
Timm Bäder
3b46e2a558 image: Remove private struct from public header 2018-12-31 12:44:02 +01:00
Daniel Boles
480a04131c CellAccessible: Fix return type of row|column_span
See:
 * c876c74eb7
 * 63e0eb5de5
2018-12-30 18:15:11 +00:00
Jordi Mas
171a710a23 Update Catalan translation 2018-12-29 09:31:36 +01:00
Emmanuele Bassi
4f532a414c docs: Clarify the section on dependencies 2018-12-28 18:44:36 +00:00
Emmanuele Bassi
3f567781dd docs: Clarify the section on commit access
The section is about rules for direct commit access to the upstream
repository, so let's be more clear about it.
2018-12-28 18:44:36 +00:00
Emmanuele Bassi
0397c8b628 docs: Clarify autoclosing issues syntax
Link to the GitLab documentation, and clarify that if no single commit
in a merge requests closes an issue, you should add a reference to the
issue in the commit message anyway.
2018-12-28 18:44:36 +00:00
Emmanuele Bassi
3939824d11 docs: Make the contribution guide slightly more friendly
This is an important document for newcomers, so we should err on the
side of being more detailed on what kind of contributions we expect,
and how we expect them.

The text is heavily modelled on the contributing-template by Nadia
Eghbal available here:

  https://github.com/nayafia/contributing-template
2018-12-28 18:44:36 +00:00
Emmanuele Bassi
d7cafca118 docs: Move commit style docs to the contribution guide
There's no point in having a separate file detailing how commits ought
to work, considering we already have a contribution guide.
2018-12-28 18:28:52 +00:00
Jordi Mas
d10709c917 Update Catalan translation 2018-12-28 09:55:51 +01:00
Jordi Mas
e9d4823c57 Update Catalan translation 2018-12-25 09:57:57 +01:00
Jordi Mas
06d764d046 Update Catalan translation 2018-12-24 17:38:01 +01:00
Christoph Reiter
325badc3eb Merge branch 'fix-typo-win32-compilation-speedup-macro-gtk4' into 'master'
Win32: Fix typo on compilation speedup macro define [Gtk4]

See merge request GNOME/gtk!473
2018-12-22 17:54:08 +00:00
Tomasz Miąsko
c665a1d5a5 Annotate values of PRIORITY constants
g-ir-scanner incorrectly evaluates macro definition that include
references to other macro definitions. Provide a correct value as an
annotation.

Differences in generated gir files:

```diff
@@ -19017 +19017 @@
-    <constant name="PRIORITY_REDRAW" value="20" c:type="GDK_PRIORITY_REDRAW">
+    <constant name="PRIORITY_REDRAW" value="120" c:type="GDK_PRIORITY_REDRAW">
@@ -74229,3 +74229,3 @@
     </constant>
-    <constant name="PRIORITY_RESIZE" value="10" c:type="GTK_PRIORITY_RESIZE">
+    <constant name="PRIORITY_RESIZE" value="110" c:type="GTK_PRIORITY_RESIZE">
       <doc xml:space="preserve">Use this priority for functionality related to size allocation.
@@ -106786,3 +106786,3 @@
     <constant name="TEXT_VIEW_PRIORITY_VALIDATE"
-              value="5"
+              value="125"
               c:type="GTK_TEXT_VIEW_PRIORITY_VALIDATE">
```

See !472
2018-12-22 18:52:20 +01:00
Jordi Mas
c7f1a275ac Update Catalan translation 2018-12-22 10:33:41 +01:00
Luca Bacci
a52989842e Win32: Fix typo on compilation speedup macro define
There is a typo, the correct macro to define is WIN32_LEAN_AND_MEAN.
After this change <shellapi.h> must be included in order to use
ExtractIconExW().
2018-12-22 01:18:17 +01:00
Mohammed Sadiq
1df276f263 mediastream: Fix possible memory leak
@error is (transfer full).  So the error passed should be freed if not used
2018-12-20 10:26:56 +05:30
Carlos Garnacho
615f10f7c8 revealer: Fully set the target state if unmapped during animation
If the revealer is told do animate and then unrealize itself, we do
(correctly) stop the animation, but used to do a shortcut where we
just set the target state as current.

Other things are dependent on the animation properly finishing though,
like the contained widget child visibility. This may lead to inconsistent
state where gtk_revealer_get_child_revealed() returns TRUE but the child
widget is unmapped, or vice-versa.

Fully finish the animation here, so the child state is coherent the next
time the revealer is mapped. We can also skip notifying on the property
since it will be handled by gtk_revealer_set_position().
2018-12-19 20:53:40 +01:00
Peter Hutterer
38cba6895a x11: make the tool lookup dependent on the hw id as well
Tools on the same physical item have the same serial number, so the eraser
and the pen part of a single pen share that serial number. With the current
lookup code, we'll always return whichever tool comes first into proximity.

Change the code to use the hw id in addition to the serial number, this way we
can differ between two tools.
2018-12-18 21:41:49 +01:00
Peter Hutterer
e95e045898 x11: don't add unknown tools to our list
Generic tools (Bamboo, built-in tablets) always have the same serial number
assigned by the wacom driver. This includes the touch tool when the wacom
driver handles the touch evdev node (common where users require the wacom
gestures to work).

When the first device is the touch device, a tool is created with that serial.
All future tools now return the touch tool on lookup since they all share the
same serial number. Worse, this happens *across* devices, so the pen
event node gets assigned the touch tool because they all have the same serial.

Since we don't actually care about the touch as a tool, let's skip any unknown
tool. This captures pads as well.
2018-12-18 21:41:09 +01:00
Peter Hutterer
1b730dcf31 x11: get the tool type from the wacom driver properties
Any wacom device currently sets the tool type to UNKNOWN. The wacom driver has
a property that exports the tool type as one of stylus, eraser, cursor, pad or
touch. Only three of those are useful here but that's better than having all
of them as unknown.
2018-12-18 21:41:08 +01:00
Carlos Garnacho
beb9ee6d4a build: wrap IM protocol building under have_wayland altogether
We poke variables that might not be defined if the wayland backend
is disabled.
2018-12-18 20:51:53 +01:00
Carlos Garnacho
8ce6d03c7b imwayland: Respect maximum length of 4000 Bytes on strings being sent.
Hitting the limit will raise protocol errors.
2018-12-18 20:38:44 +01:00
Carlos Garnacho
904202a636 imwayland: Plug leaks
The various strings (pending/current preedit, surrounding, and commit
buffer) are being leaked in the case of GtkIMContext destruction.
2018-12-18 20:38:44 +01:00
Dorota Czaplejewicz
7a0b6a3639 imwayland.c: fix formatting 2018-12-18 20:38:44 +01:00
Dorota Czaplejewicz
b465e04ae2 imwayland: rearrange functions to remove prototypes 2018-12-18 20:38:41 +01:00
Dorota Czaplejewicz
f67627875f imwayland: Handle enter and leave events
Before this patch, imwayland would assume that text-input enter and leave events follow the general (wl_keyboard) focus, and was unable to handle the situation where they would not be provided at the same time.
2018-12-18 20:27:12 +01:00
Carlos Garnacho
8912dc226c imwayland: Collect return value from ::delete-surrounding signal
There's not much we can do about the signal not being handled, but
we should fetch the return value anyway.
2018-12-18 20:27:12 +01:00
Dorota Czaplejewicz
12ac9f351e imwayland: Don't reset serial while text-input is alive
The serial number is a persistent property of the text-input object.
2018-12-18 20:27:12 +01:00
Dorota Czaplejewicz
c4b4e90f98 imwayland: Fix clearing of preedit text in webkitgtk
Fixes webkitgtk misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316#note_312942 , which was introduced in 49b17e6c.
The preedit will be cleared on exit only if it is already present.
2018-12-18 20:27:12 +01:00
Dorota Czaplejewicz
fcf28ded42 imwayland: Fix clearing of preedit text
Fixes terminal emulator misbehaviour as outlined in https://gitlab.gnome.org/GNOME/gtk/issues/1316, which was introduced in 49b17e6c. The original commit cleared preedit text by setting it to an empty string, which still counted as existing preedit. The fix sets preedit string to null, which is correctly understood as not present.
2018-12-18 20:27:12 +01:00
Carlos Garnacho
1e69d248cb modules: Check current context before retrieving surrounding
There may be situations where this might get called while the
currently focused context just went away (eg. after setting the
text widget unsensitive).

Closes: #1317
2018-12-18 20:27:12 +01:00
Dorota Czaplejewicz
c49b29fa53 imwayland: clear preedit on focus out 2018-12-18 20:27:12 +01:00
Dorota Czaplejewicz
024220aee8 imwayland: Add text-input-unstable-v3 support
The wayland input module now represents text-input-unstable-v3 support, while the old module supporting gtk-text-input was renamed to gtkwayland.
2018-12-18 20:27:12 +01:00
Benjamin Otte
1423265610 gstmedia: Implement error handling.
I wonder who forgot that.
Whoops.
2018-12-18 02:04:54 +01:00
Benjamin Otte
89c48a08a0 mediastream: Allow multiple calls to gtk_media_stream_error()
Just ignore all further ones.
2018-12-18 02:04:16 +01:00
Benjamin Otte
c30968861f a11y: Fix function return type
Typo right there.
2018-12-18 01:20:36 +01:00
Daniel Boles
a8ac6f833c RGBA: tiny grammar improvements in to_string doc 2018-12-17 20:49:34 +00:00
Daniel Boles
271acaff53 RGBA: Consistently use “” around inline arg names
instead of being inconsistent and not using them later, which leaves a
bunch of single letters floating among real words, not the prettiest.
2018-12-17 20:49:34 +00:00
Daniel Boles
c35e0cba39 RGBA: Fix example to_string output for reality/CSS
* We don't output spaces anywhere in the code, unlike the doc suggested.
* CSS explicitly forbids whitespace between function names and lparens:
  https://stackoverflow.com/questions/13877198
2018-12-17 20:49:34 +00:00
Nelson Benítez León
65240967e4 gtkplacessidebar.c: move bookmark at the placeholder index
As that index is set in drag_motion_callback() and visually shown
on the widget as a drop target hint.

https://bugzilla.gnome.org/show_bug.cgi?id=787356
https://gitlab.gnome.org/GNOME/gtk/issues/904
2018-12-17 19:19:20 +00:00
Christoph Reiter
a99bd2a422 ci: Update Docker image to Fedora 29 and meson to 0.49.0 2018-12-16 21:33:22 +01:00
Orivej Desh
3ec2d5fa38 Zero-fill new GtkTextIter
iter_init_common() is used on uninitialized GtkTextIter, and since neither it
nor its callers initiliaze its padding fields, they contain garbage.

This is a problem for Go - which checks that structs passed to C functions do
not contain pointers to Go-allocated memory - when the garbage happens to be
such a pointer.  Although Go zero-fills all GtkTextIter that it allocates, this
does not help when GTK functions such as insert_pixbuf_or_widget_segment called
for gtk_text_buffer_create_child_anchor copy garbage from their stack-allocated
GtkTextIter into a clean iter.  To work around this a GtkTextIter has to be
discraded after use in text buffer anchor inserting functions:
https://github.com/gotk3/gotk3/pull/307
2018-12-16 17:03:47 +00:00
Andre Klapper
a0b5b39bbd Replace git.gnome.org by Gitlab URL in <GitRepository> in DOAP file 2018-12-16 00:45:41 +01:00
Andre Klapper
ab52862a5d Replace Bugzilla by Gitlab URL in DOAP file 2018-12-15 23:32:24 +01:00
Daniel Boles
a350192ea2 EventControllerKey: Add missing documentation bits 2018-12-14 23:28:54 +00:00
Emmanuele Bassi
cb0d8d6d90 Remove gtk_widget_show_all() call
Extraneous chunk from 7601bca758.

Cherry picked from gtk-3-24, which has a gtk_widget_show_all() function.
2018-12-14 20:38:03 +00:00
Matthias Clasen
86ad3e8f2a Merge branch 'master' into 'master'
A11y: Add support for AtkTableCell

See merge request GNOME/gtk!411
2018-12-14 19:25:27 +00:00
Mike Gorse
8f29a0633b A11y: Add support for AtkTableCell 2018-12-14 19:25:27 +00:00
António Fernandes
7601bca758 placesview: List only available protocols as available
We display a list of supported protocols in the server_addresses_popover.

However, this curated list contains protocols which may or may not be
available, depending on the respective gvfs backend being installed.

So, populate the list only with protocols which are available.

https://gitlab.gnome.org/GNOME/gtk/issues/1476
2018-12-14 12:30:52 -05:00
António Fernandes
3bbfff9280 placesview: Set .error style if unsupported protocol
When the user types an address with a schema that is not supported,
the Connect button doesn't become sensitive, but there is no visible
feedback at all.

This feels unresponsive and leaves the user clueless.

While it doesn't help explain why the address doesn't work, this will
provide a hint that the input was acknowledged but doesn't work.

https://gitlab.gnome.org/GNOME/gtk/issues/1476
2018-12-14 12:28:47 -05:00
Matthias Clasen
5b049364dc Merge branch 'fix-polygon-svg-recolor' into 'master'
icontheme: Recolor <polygon> elements in SVGs too

See merge request GNOME/gtk!443
2018-12-14 17:02:30 +00:00
Timm Bäder
7997bdc5d7 Merge branch 'demo-combobox-typo-gtk4' into 'master'
demos/gtk-demo/combobox: fix typo

See merge request GNOME/gtk!444
2018-12-13 12:05:14 +00:00
LRN
04aebda1e9 Merge branch 'win32-honest-clipboard-gtk4' into 'master'
GDK W32: Be honest about supported clipboard formats (GTK4)

See merge request GNOME/gtk!399
2018-12-11 13:47:57 +00:00
Jakub Steiner
77792b6475 Revert "Adwaita: GNOME 3.32"
This reverts all GNOME 3.32 styling from master
2018-12-10 21:22:56 +01:00
Christoph Reiter
5612e84551 GDK W32: Always set gtk-font-name to the active UI font. Fixes #1484
This makes apps use "Segoe UI 9" by default instead of whatever matches "Sans 10".
It also cleans up the code and uses some new pango API while at it.

This was previously disabled in 9e686d1fb5 because it led to a poor glyph coverage
on certain versions of Windows which don't default to "Segoe UI 9" (Chinese, Korean, ..)
because the font fallback list was missing in pango.

This is about to get fixed in https://gitlab.gnome.org/GNOME/pango/merge_requests/34
so enable it again when we detect a new enough pango version.

(See !436 for the original MR)
2018-12-10 09:00:50 +01:00
Jeremy Bicha
462193ae26 demos/gtk-demo/combobox: fix typo
Fix typo that prevented the P-S submenu from displaying correctly
2018-12-09 23:30:38 -05:00
Matej Urbančič
80a90a084e Updated Slovenian translation 2018-12-09 21:26:33 +01:00
Christoph Reiter
2f29cb9e6f win32: Don't multiply the scroll event deltas by the Windows scroll lines setting. See #1408
GTK widgets expect the scroll deltas to be 1 or -1 and calculate a scroll value from that.
Multiplying the delta by the Windows scroll line setting (which defaults to 3) results
in a much larger delta and vastly different behaviour for running a GTK app on Windows
vs on Linux. For example text view and tree view scroll by 9 lines per scroll wheel tick
per default this way while on Linux it is around 3.

Remove the multiplication for now.

See !426 for the gtk3 MR
2018-12-08 15:28:37 +01:00
Christoph Reiter
67fdfca3ba GDK W32: set default settings for fontconfig.
Enables hinting, antialiasing and set the subpixel orientation according to the
active clear type setting. This ensures that font rendering with the fontconfig backend
looks similar to the win32 backend, at least with the default system font.

See !437
2018-12-08 14:54:15 +01:00
Philip Chimento
284d909347 icontheme: Recolor <polygon> elements in SVGs too
Otherwise, it's possible to have a symbolic icon where some of the
shapes keep the #bebebe chroma key color.
2018-12-08 01:40:32 +00:00
Timm Bäder
43ef4d7b53 menushell: Listen to non-primary button clicks
Menus should also be deactivated on right-button clicks.
2018-12-07 17:03:45 +01:00
Timm Bäder
3ce45508e1 gl renderer: Track border width state separately 2018-12-07 16:36:10 +01:00
Timm Bäder
57efdcfbbe gl renderer: Ignore subsequent render target ops 2018-12-07 16:36:10 +01:00
Timm Bäder
df817bd118 gl renderer: Ignore viewport ops to the same viewport 2018-12-07 16:36:10 +01:00
Timm Bäder
82a1d4f280 gesturestylus: Use proper syntax when refering to signals 2018-12-07 16:36:10 +01:00
Jakub Steiner
80f2660838 Adwaita: regenerate CSS
- for the previous patch
2018-12-07 12:00:21 +01:00
Jakub Steiner
edd4d2918a Merge branch 'context_menus' into 'master'
Adwaita GTK Theme: Add bigger shadow and border-radius to menus

See merge request GNOME/gtk!432
2018-12-07 09:58:56 +00:00
Jakub Steiner
320d272ec8 Adwaita: buttons & headerbar tweaks
- tone down the button z-depth
- flatter headerbars
2018-12-05 16:21:45 +01:00
Daniel Boles
72d09d22e9 Box, Grid: Improve various bits of documentation
Issue #1495 showed that the docs of GtkGrid retain outdated implications
that (as was once, but is no longer, the case) it is intended to replace
GtkBox, by discussing HfW and widget properties in a way that suggests
GtkBox can't handle them. But of course it does, and it's preferable for
simple single-row/column cases. Worse, we said GtkGrid “provides exactly
the same functionality” for the latter case, but the original point of
that Issues was that it doesn’t, at least for CSS positional selectors!

Box:
• Use an actually meaningful @Short_description.
• Remove unhelpful @See_also references to unrelated containers.
• Remove references to “rectangular area”: it might be another shape
  via CSS, or “rectangular” might falsely imply 2 dimensions of children.
• Mention Orientable:orientation.
• Emphasise usefulness of :[hv]align for allocating in the other axis.
• Don’t say that Grid “provides exactly the same functionality” for a
  single row or column, since (A) it is overkill for that case and (B)
  said Issue proved that it *doesn’t* for CSS child order, for example.

Grid:
• Don’t dwell on widget properties and height-for-width in a way that
  wrongly implies that Box can’t handle those (or Grid can better). In
  fact, just get rid of that bit altogether: Box handles them fine, and
  such wording was only needed years ago for migration from GTK+ 2 to 3.
• Point to GtkBox as being preferred for the simple row/column use case.
2018-12-04 20:43:19 +00:00
Timm Bäder
a2a4603329 Merge branch 'bye-app-menu-gtk4' into 'master'
widget-factory: move app menu contents to primary menu (gtk4)

Closes #916

See merge request GNOME/gtk!365
2018-12-04 14:32:22 +00:00
Timm Bäder
8de1ba2cc4 application: Remove dead assignment 2018-12-04 06:30:47 +01:00
Timm Bäder
2644da106b button: Remove some dead code 2018-12-04 06:30:47 +01:00
Timm Bäder
4860410c4a button: Remove some unnecessary includes 2018-12-04 06:30:47 +01:00
Timm Bäder
4b3a94f382 gl renderer: Fix remaining TODO about offset nodes
All of the nodes should now support offsets.
2018-12-04 06:30:47 +01:00
Timm Bäder
d67dacedba gl renderer: transform nodes: offset 2018-12-04 06:30:47 +01:00
Timm Bäder
e1feb1b712 gl renderer: Clip nodes: offset 2018-12-04 06:30:47 +01:00
Timm Bäder
e8670c89ae gl renderer: Linear gradients: offset 2018-12-04 06:30:47 +01:00
Timm Bäder
b4f918904c gl renderer: Outset shadow nodes: offset 2018-12-04 06:30:47 +01:00
Timm Bäder
aead150ce2 gl renderer: Care about offset when rendering border nodes 2018-12-04 06:30:47 +01:00
Timm Bäder
fd47e57e4b gl renderer: care about offset when rendering shadow nodes 2018-12-04 06:30:47 +01:00
Matthias Clasen
1e129c1dd2 emoji chooser: Actually force Emoji presentation
The previous commit was using the text presentation selector
instead of the Emoji one. Oops.
2018-12-03 21:47:53 -05:00
Timm Bäder
e0a7d28339 testuite Add translucent offscreen rendering test case 2018-12-02 16:15:17 +01:00
Timm Bäder
ad93806005 showrendernode: Fix GtkImage size
Make sure we show the paintable unscaled.
2018-12-02 16:14:31 +01:00
Timm Bäder
2b95a5daee gl renderer: Remove blend shader
It's unused.
2018-12-02 16:04:40 +01:00
Timm Bäder
0681c5d5bc gl renderer: Reset opacity when rendering to a texture
The opacity will already be applied when rendering the final texture.
2018-12-02 16:03:08 +01:00
Timm Bäder
b19926c079 gl renderer: Add function to draw debug rectangle 2018-12-02 14:31:57 +01:00
Timm Bäder
692ed4f994 gl renderer: Refactor render op builder 2018-12-02 14:17:18 +01:00
Timm Bäder
ad759307f8 gl renderer: Add more node types to print_render_node_tree
debugging ++
2018-12-02 13:39:55 +01:00
Timm Bäder
fb6adaaa62 window: Don't try to size-allocate unmapped popovers
The gtk_widget_size_allocate call won't do anything anyway.
2018-12-02 13:25:43 +01:00
Timm Bäder
58a4ae94e9 gl renderer: Use ops_transform_bounds_modelview in more places 2018-12-02 13:25:43 +01:00
Timm Bäder
9df9087a13 gl renderer: Add NodeSample
As a quick way of checking what a particular sample of nodes (e.g. all
offset node children) are made up of.
2018-12-02 13:25:43 +01:00
Timm Bäder
f8df527c68 sizerequest: Directly query new request_mode
We are already inside the function that populates the size request
cache, so do it here instead of implicitly in get_request_mode.
2018-12-02 13:25:43 +01:00
Timm Bäder
71512cf9ad gl renderer: Move geometry calculation further down
We don't need it above, so move it to where it belongs.
2018-12-02 13:25:43 +01:00
Timm Bäder
79cc8fb261 gl renderer: Apply offset with scale 2018-12-02 13:25:43 +01:00
Timm Bäder
2831dbb110 gl renderer: Refactor add_offscreen_ops
Use a graphene_rect_t for the node bounds instead of 4 floats.
This makes it simpler to pass the size in without the offset applied.
2018-12-02 13:25:43 +01:00
Timm Bäder
933acb3682 gl renderer: Add offscreen ops without offset applied
When doing color matrix nodes. This fixes color matrix node with scale =
2.
2018-12-02 13:25:43 +01:00
Timm Bäder
574ebafa46 gl renderer: Reset offset when rendering offscreen
We want to apply the offset to the rendered texture, not to the
offscreen-rendered content.
2018-12-02 13:25:43 +01:00
Timm Bäder
74dd05b45e gl renderer: add render ops for dumping the framebuffer
So offscreen rendering can be properly debugged.
2018-12-02 13:25:43 +01:00
Timm Bäder
3eb2cef421 gl renderer: Set the render region as initial clip
So we avoid creating render ops for things outside of it.
2018-12-02 13:25:43 +01:00
Timm Bäder
94745241c2 GdkGLContext: Fix damage computation with buffer_age
As per the spec:

> The back buffer can
> either be reported as invalid (has an age of 0) or it may be
> reported to contain the contents from n frames prior to the
> current frame.

So a  buffer age of 1 means that the buffer was used in the last frame.
We were handling buffer_age==1 the same as buffer_age==0, i.e. we
returned the full damage for the surface.

[1] https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_buffer_age.txt
2018-12-02 13:25:43 +01:00
Timm Bäder
538491efa1 gl renderer: Fix only_translation check 2018-12-02 13:25:43 +01:00
Matthias Clasen
6f8c4f873d Merge branch 'force-emoji' into 'master'
Force emoji presentation

See merge request GNOME/gtk!431
2018-11-30 21:38:02 +00:00
Matthias Clasen
7a4e9fa4d3 Force emoji presentation
Append a variation selector to the Emoji sequences,
to force Emoji presentation. Without this, some
Emoji come out with text presentation by default.

Closes: Pango #334
2018-11-30 16:20:44 -05:00
Jakub Steiner
f3c704b82e Adwaita: updated switch control
- might be nasty to hide labels with CSS. We can fix properly later.
- the blue border seesm aliased when :checked
2018-11-30 20:55:00 +01:00
frederik.feichtmeier
a6a69dd567 Adapt border-radius and box-shadow of menus to popovers 2018-11-30 11:54:22 +01:00
Jakub Steiner
8921c868a5 Adwaita: shade buttons
- it was a bit too flat
2018-11-29 21:56:45 +01:00
Jakub Steiner
3f8598baa4 Adwaita: button tweaks
- step back on toning down the borders. Flatness !> legibility.
- darker active state for light
- draw gradinets from bottom up, to keep px sized shading regardless
  of button size.
2018-11-29 20:19:41 +01:00
Jakub Steiner
b5fd7b3211 Adwaita: headerbar backdrop state 2018-11-29 14:34:53 +01:00
Jakub Steiner
e9fe9410e0 Adwaita: sync headerbar styling for devel mode 2018-11-29 13:12:44 +01:00
Timm Bäder
904fd5f1fc Remove gtk_widget_intersect
It's been broken for quite a while now and doesn't make sense anymore
these days.
2018-11-29 11:14:26 +01:00
Timm Bäder
f598836d6c popover: Don't recalculate position if unmapped 2018-11-29 08:50:18 +01:00
Timm Bäder
5907ff694f gl renderer: Render non-trivial transforms to a texture
This way we can e.g. render rotated clips, borders, etc.
2018-11-29 08:50:18 +01:00
Timm Bäder
7c020bfaaa inspect-button: Remove custom pick() implementation
This was added to work around the fact that pick() does not look at
insensitive widgets at all, but the replacement didn't properly work
either.
2018-11-29 08:50:18 +01:00
Timm Bäder
2bd02d9185 popover: Get rid of a gtk_widget_get_allocation call
Use _compute_bounds instead.
2018-11-29 08:50:18 +01:00
Timm Bäder
c0cf592336 gl renderer: Cache offscreen textures per node, not size 2018-11-29 08:50:16 +01:00
Timm Bäder
12378f0afa gl renderer: Expand matrix metadata extraction
Instead of getting the translation x/y everytime we use the modelview,
get it once, when extracting the metadata. Do the same with the scale.
And save if the matrix is "simple" at all, i.e. if it only consists of a
translation and/or scale. This will be helpful later when we start
drawing transformed nodes on textures.
2018-11-29 08:23:42 +01:00
Timm Bäder
5ea211bbb1 Revert "gldriver: Don't create surfaces to upload textures"
This reverts commit 6466e53bfc.

This breaks GtkGLArea.
2018-11-29 07:39:11 +01:00
Timm Bäder
c17c18f1ae widget: Remove one translate_coordinates copy
Just use the double version in the integer version.
2018-11-29 07:39:11 +01:00
Jakub Steiner
dbde7b68c0 Adwaita: flatten the headerbar again 2018-11-28 20:28:56 +01:00
frederik.feichtmeier
95f06f6e75 Add bigger shadow and border-radius to menus
Increase the visibility of the box-shadow for menus
Introduce a border-radius variable for menus
Use this variable for all corners of menus except top for the top menus
2018-11-28 17:43:55 +01:00
Jakub Steiner
a26edd59d1 Adwaita: tune button & hederbar colors 2018-11-28 14:22:21 +01:00
Mohammed Sadiq
dcd21e12cd texttag: Replace gtk3-demo reference with gtk4-demo 2018-11-28 16:51:45 +05:30
Jakub Steiner
e5efc84eda Adwaita: buttons & headerbars
- tone down the bottom border contrast (increase bottom lightness,
  decrease overall lightness)
- darken headerbars slightly (might require darkening wm colors when
  dust settles)
2018-11-28 00:16:20 +01:00
Matthias Clasen
8035969860 Merge branch 'master-escape-included-svg' into 'master'
(#1471): base64-encode included SVGs to avoid mis-escaped characters

Closes #1471

See merge request GNOME/gtk!430
2018-11-27 20:25:28 +00:00
Federico Mena Quintero
e5f9bf2e9b (#1471): base64-encode included SVGs to avoid mis-escaped characters
We wrap SVG data from icons within another SVG with extra styling
information.  The wrapped SVG may contain characters that cannot be
part of a data: URL (https://fetch.spec.whatwg.org/#data-urls).

Librsvg 2.45 got more strict in its parsing of data: URLs; whereas
previously it ignored '#' characters in them, now it considers them to
be the start of a fragment identifier, which is not allowed in data:
URLs anyway.

To avoid unallowed characters, we now create a data: URL with a
base-64 encoded SVG.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1471
2018-11-27 13:57:21 -06:00
Timm Bäder
0be4d31217 headerbar: Remove superfluous parentheses 2018-11-27 06:06:28 +01:00
Timm Bäder
eebb849760 widget: Query CSS values later in size_allocate
Move it below the "this widget only changed its position" check.
2018-11-27 06:00:30 +01:00
Timm Bäder
f92745aacf widget: Save baseline without CSS values applied
Similar to what we do with width/height.
2018-11-27 05:59:47 +01:00
Timm Bäder
7aee30bfc2 adwaita: icon-shadow -> -gtk-icon-shadow 2018-11-27 05:41:53 +01:00
Timm Bäder
ef751bc809 gl renderer: Use stack to keep track of modelview matrix
So we can avoid calculating metadata for matrices all the time.
2018-11-27 05:39:27 +01:00
Timm Bäder
fe49f83982 colorplane: Convert crosshair rendering to snapshot
This is slightly different than the cairo version since the
half-transparent lines now overlap but nobody can see that anyway.
2018-11-27 05:37:38 +01:00
Timm Bäder
059d9376da colorscale: Cache hue texture
Otherwise we regenerate a new one on every snapshot() call.
2018-11-27 05:37:38 +01:00
Timm Bäder
6466e53bfc gldriver: Don't create surfaces to upload textures 2018-11-27 05:37:38 +01:00
Timm Bäder
b7963a06ab widget: Parent widgets may also consume motions
This is important when the target widget of an event is not the one that
would otherwise receive the gesture. For example, the GtkSwitch
implementation currently attaches a pan gesture to the switch itself,
but the target widget below the pointer might be the switch slider or
label.

See #1465
2018-11-27 05:37:38 +01:00
Timm Bäder
eeeefb40c7 switch: Shorten size_allocate impl a bit 2018-11-27 05:37:38 +01:00
Jakub Steiner
97d8676b40 Adwaita: help fullcolor app icons
- draw a large dropshadow for aboutboxes
- draw an outline for low res

See issues #1434 and #1445.
2018-11-26 17:33:28 +01:00
Jakub Steiner
6e28d004ae Adwaita: tone down broders, buttons
- very contrasty lines feel dated in today's flat world
- tone down the contrast a little
2018-11-23 17:32:46 +01:00
Jakub Steiner
8d7bf3ad0c Adwaita: list buttons
- tone down buttons when inside lists

Fixes issue #1473
2018-11-22 13:24:49 +01:00
Timm Bäder
d76a0feef6 widget: gdk_display_get_monitor can return NULL
Fixes #1466
2018-11-20 12:45:18 +01:00
Timm Bäder
08a07d4ae5 entry: Shorten finalize implementation
By using g_clear_pointer and g_clear_object where appropriate.
2018-11-20 12:45:18 +01:00
Timm Bäder
b42d99b37e Merge branch 'zbrown/emit-transient-for' into 'master'
window: Actually emit notify::transient-for

See merge request GNOME/gtk!424
2018-11-20 11:29:18 +00:00
Zander Brown
ea487b2233 window: Actually emit notify::transient-for
Because it seems we weren't doing that
2018-11-19 21:17:01 +00:00
Timm Bäder
40ae5c1319 Merge branch 'benzea/foreach-documentation' into 'master'
container: Document that removal from foreach is permissible

Closes #1461

See merge request GNOME/gtk!423
2018-11-19 13:38:34 +00:00
Benjamin Berg
8c9c3e4426 container: Document that removal from foreach is permissible
It is permissable to remove a widget using gtk_container_remove from the
gtk_container_foreach callback handler. Document this fact to make it
more discoverable.

Fixes #1461
2018-11-19 13:58:34 +01:00
Timm Bäder
d0f4fcb6fd Merge branch 'akitouni/gdkvulkan-doc-typo' into 'master'
vulkancontext: fix typos in documentation

See merge request GNOME/gtk!417
2018-11-19 07:41:36 +00:00
Timm Bäder
4142d0a69a Merge branch 'more-nullable' into 'master'
g-i: Add some nullable annotations

See merge request GNOME/gtk!419
2018-11-19 07:40:39 +00:00
Christoph Reiter
b061821f24 g-i: Add some nullable annotations
Based on grepping arg docs for NULL.
See https://gitlab.gnome.org/GNOME/pygobject/issues/261
2018-11-18 13:36:50 +01:00
Abderrahim Kitouni
e0833e492c vulkancontext: fix typos in documentation 2018-11-17 19:35:47 +01:00
Timm Bäder
55faaf1aa1 Merge branch 'jjardon/no_G_TYPE_INSTANCE_GET_PRIVATE' into 'master'
Stop using G_TYPE_INSTANCE_GET_PRIVATE completely

See merge request GNOME/gtk!402
2018-11-15 09:59:01 +00:00
Timm Bäder
7aa02b9e95 Merge branch 'include-ft2build.h' into 'master'
font chooser: Properly include freetype headers

Closes #1432

See merge request GNOME/gtk!413
2018-11-14 13:30:28 +00:00
Timm Bäder
c65c6ba11f widget: Fix size-allocate signal docs 2018-11-13 20:54:18 +01:00
Timm Bäder
359d874ddb Use g_clear_pointer to unparent widgets 2018-11-13 20:53:14 +01:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Timm Bäder
1f1306a53b docs: Add GtkEventControllerLegacy 2018-11-13 15:40:42 +01:00
Timm Bäder
ce3d5fcb0a vulkancontext: Add missing error switch 2018-11-13 15:28:46 +01:00
Timm Bäder
28bd56454d appchooserbutton: Remove priv pointer 2018-11-13 15:19:07 +01:00
Timm Bäder
75deff035b testappchooserbutton: Fix for class hierarchy change 2018-11-13 15:19:07 +01:00
Timm Bäder
87ee7e31a4 appchooserbutton: Inherit from GtkWidget 2018-11-13 15:19:05 +01:00
Timm Bäder
5a3ecb9703 render: Fix a position/size mixup
Fixes the foreigndrawing demo.
2018-11-13 14:10:17 +01:00
Timm Bäder
e656f66720 toolbar: Remove dead code
The size definitely changes, otherwise ->size_allocate does not get
called.
2018-11-13 14:10:17 +01:00
Timm Bäder
0d47a6c970 toolbar: Remove some unused defines 2018-11-13 14:10:16 +01:00
Matthias Clasen
39f8e1e137 wayland: Adapt to settings portal api change
ReadAll now accepts an array of patterns.
2018-11-12 13:51:56 -05:00
Carlos Garnacho
d7c2e5844b Merge branch 'scroll-event-propagation' into 'master'
eventcontrollerscroll: Conditionally propagate ::scroll

Closes #45

See merge request GNOME/gtk!250
2018-11-12 10:05:46 +00:00
Ernestas Kulik
edc4b2f7d0 eventcontrollerscroll: Conditionally propagate ::scroll
Currently, gtk_event_controller_scroll_handle_event() always returns
TRUE if it is handled, which stops the propagation of the event. If
there’s a single GtkEventControllerScroll in the widget hierarchy, that
means that no others will run, depending on the propagation phase. In
Nautilus, this can be observed when adding a scroll controller to the
GtkScrolledWindow (ctrl-scrolling controls the zoom level) - either the
scrolling or the zooming breaks.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/45
2018-11-12 10:35:37 +01:00
Leonardo Taccari
b3ba2961d2 font chooser: Properly include freetype headers
freetype headers should be included via <ft2build.h> and then
indirectly via FT_*_H macros.

Fixes issue #1432.
2018-11-09 22:13:30 +01:00
Timm Bäder
c2c1acc73e calendar: Remove unused struct member 2018-11-09 20:18:13 +01:00
Timm Bäder
c44728282c scrolledwindow: Remove some useless code
This is all being done already be the add_class/remove_class calls
before.
2018-11-09 19:37:55 +01:00
Timm Bäder
85a002bf9f scale: Don't set label css name to "label"
That's already the css name of all labels.
2018-11-09 18:59:30 +01:00
Timm Bäder
6eba544ad4 colorscale: Remove x/y arguments from snapshot_scale
We only pass 0 anyway.
2018-11-09 18:01:58 +01:00
Jakub Steiner
f610fbfc0e Adwaita: use HIG grey for bg_color
- refresh with a light bg color, use the new color palette
2018-11-09 15:37:08 +01:00
Jakub Steiner
1e2d11cc62 Adwaita: fix osd bg color
- don't try deriving from bg_color, osd should be consistent
  for light & dark.

FIxes issue #1449
2018-11-09 11:19:41 +01:00
Adrien Plazas
f1e24ca30a Adwaita: Propagate bg color to titlebar separator descendants
Gives the same background color to all separators descending from a
title bar than to its direct childrens.

This prevents separators which are in a titlebar but not direct children
from the widget with the titlebar style class from being almost
transparent and hence it prevent them from revealing the clear color of
the window's titlebar (black).

https://gitlab.gnome.org/GNOME/gtk/issues/1231
2018-11-09 08:49:38 +01:00
Jakub Steiner
1787f04097 Merge branch 'wip/jimmac/insensitive-progress' into 'master'
Adwaita: draw insensitive progressbars

See merge request GNOME/gtk!360
2018-11-09 07:27:49 +00:00
Jakub Steiner
671f69c6ca Merge branch 'wip/jimmac/hig-colors-gtk4' into 'master'
Adwaita: use new HIG colors

See merge request GNOME/gtk!407
2018-11-09 07:25:05 +00:00
Jakub Steiner
7b51de6bbd Adwaita: use new HIG colors
- blue selection color, success & destructive colors updates
- blueish tint for dark

Addresses issue #1443
2018-11-08 16:58:13 +01:00
Timm Bäder
45b909f2c5 testpopup: Fix GtkEventControllerMotion::motion callback signature 2018-11-08 05:48:14 +01:00
Timm Bäder
0b4ee06f8e eventcontrollerlegact: Fix ::event docs
As discussed in !388.
2018-11-08 05:48:14 +01:00
Timm Bäder
797739198f icontheme: Stop exporting gtk_icon_info_new_for_file 2018-11-08 05:48:14 +01:00
Timm Bäder
0c017ff109 icontheme: Stop exporting gtk_icon_theme_color_symbolic_pixbuf 2018-11-08 05:48:14 +01:00
Timm Bäder
aad3686726 icontheme: Drop remaining emblem code 2018-11-08 05:48:14 +01:00
Timm Bäder
fe7a2635d0 icontheme: Don't reference nonexistent parameter in docs 2018-11-08 05:48:14 +01:00
Timm Bäder
2834b38d2c icontheme: Use a bit field in AsyncSymbolicData
176 -> 144 bytes
2018-11-08 05:48:14 +01:00
Timm Bäder
29563a33ba icontheme: Stop strdup'ing css colors when loading
... symbolic icons.
2018-11-08 05:48:10 +01:00
Timm Bäder
5936d7f8f2 gl renderer: Properly retrieve matrix scale
So rotating offscreen nodes works.
2018-11-08 05:13:50 +01:00
Timm Bäder
481a78eee7 widget: Avoid some more ->priv accesses 2018-11-08 05:13:50 +01:00
Timm Bäder
ac4134c298 range: Remove multipress_gesture member
We don't need it in the instance struct since we only set it up and then
access it in its signal callbacks.
2018-11-08 05:13:50 +01:00
Timm Bäder
145659af93 widget: Some whitespace fixes 2018-11-08 05:13:50 +01:00
Daniel Boles
31b8e0f109 Popover: Minimally document the ::closed signal
This is better than nothing at all. The wording is taken from Carlos's
commit message when he added this shortly before 3.12 (but skip Since).
Skip the bit from his commit message explaining what this replaced; we
don't need to say all the less good things our convenience API replaces.
2018-11-07 20:33:15 +00:00
Daniel Boles
18199a3cef testtreelistmodel: Don't use non-standard function
as per efd3758f6a strcasecmp() is not a C
standard thing (not that we bothered including any header for it anyway)
and so this test failed to build on Windows with Microsoft Visual C.
2018-11-07 20:32:55 +00:00
Daniel Boles
3194c39471 TreeMenu: Don't manually reinvent g_list_index()
g_list_index() "Gets the position of the element containing the given
data (starting from 0)." That is exactly what we were manually doing.
2018-11-07 20:32:55 +00:00
Javier Jardón
9d51a8f53a gtk/gtktoolbutton.c: Document why we need to still use G_TYPE_INSTANCE_GET_PRIVATE
This is the excellent explanation from Emmanuele at
https://gitlab.gnome.org/GNOME/gtk/merge_requests/402#note_361210:
"
Every time you instantiate a type, the instance_init() function is called for each
parent type T_p of your type T; to preserve invariants, the class pointer inside
the instance data is set to the parent type before each invocation, until you hit
your type T. This means that calling GET_CLASS() inside an instance_init() function
will give you a pointer to the class vtable for the parent type T_p while you're
iterating over parent types. What if you want to access the actual class vtable of
the type T, though? Well, you can because the actual signature of instance_init() is:

  void (* GInstanceInitFunc) (GTypeInstance *instance, gpointer g_class);

i.e. all instance_init() functions get passed the instance they are initialising
and the class vtable of the real type you're instantiating.

This is how GtkToolButton works: it "peeks ahead" at instance initialisation time,
to use the button_type class field of the actual type you're instantiating,
and calls g_object_new() with it to store the resulting object in its own private
data structure.

This whole contrived mechanism is needed to allow out-of-tree tool buttons to just
set the button type on their class init, and have their parent class create the
button they want, instead of asking all tool buttons to do this themselves and have
a virtual function called get_button() for GtkToolButton to call whenever it needs
to operate on the button instance.

Now we're coming to a close: we cannot use the G_DEFINE_TYPE macro because the
instance_init() function it creates internally will not pass the class pointer
to your custom instance_init(). Since we cannot use G_DEFINE_TYPE, we also cannot use
G_ADD_PRIVATE either.

This is the reason why, when I ported GTK 3 to the new private instance data structure
macros, I left GtkToolButton alone. I should have left a comment there, because @matthiasc
tried doing that as well, and then had to revert it in commit 1c4a7bd5. So: my bad,
sorry about that.

If we want to drop the G_TYPE_INSTANCE_GET_PRIVATE and the g_type_class_add_private() calls,
we cannot use G_DEFINE_TYPE, but what we can do is unrolling what the macros do themselves:

- add a global GtkToolButton_private_offset variable
- add a static inline gtk_tool_button_get_instance_private() that does return
(G_STRUCT_MEMBER_P (self, GtkToolButton_private_offset));
- call g_type_add_instance_private (g_define_type_id, sizeof (GtkToolButtonPrivate)) inside
gtk_tool_button_get_type() and store the result in GtkToolButton_private_offset
- replace g_type_class_add_private() inside gtk_tool_button_class_init() with
g_type_class_adjust_private_offset (klass, &GtkToolButton_private_offset)
"
2018-11-07 17:50:04 +00:00
Javier Jardón
c37c86a9bf gtk/gtktextview.c: Remove unused GTK_TEXT_VIEW_GET_PRIVATE() macro 2018-11-06 13:45:58 +00:00
Timm Bäder
b4b30b4951 Merge branch 'wip/3v1n0/recent-info-cleanup' into 'master'
gtk-autocleanups: add cleanup function for GtkRecentInfo

See merge request GNOME/gtk!409
2018-11-06 09:52:11 +00:00
Matthias Clasen
54830a2af3 wayland: Fix a thinko in settings portal support
When we decide to fall back because the settings portal
is not present, adhere to that decision elsewhere. And
treat the fontconfig-timestamp like the other special-cased
settings, with G_TYPE_NONE.
2018-11-05 18:34:13 -05:00
Marco Trevisan
9946dd2ab7 gtk-autocleanups: add cleanup function for GtkRecentInfo 2018-11-05 21:37:42 +00:00
Matthias Clasen
5028cb35bc Merge branch 'wip/settings-portal' into 'master'
settings portal

See merge request GNOME/gtk!403
2018-11-04 20:57:26 +00:00
Matthias Clasen
48b569eae0 wayland: Support the settings portal
Under Wayland, we are currently directly using GSettings
for desktop settings. But in a sandbox, we may not have
access to dconf, so this may fail. Use the new settings
portal instead.
2018-11-04 15:44:50 -05:00
Matthias Clasen
8099669466 Move the should_use_portal helper to gdk
We want to use it there too, in the future.
Update all callers.
2018-11-04 08:17:32 -05:00
Matthias Clasen
1c465604d5 Use a simpler sandbox check
No need to use the runtime dir and allocate a string.
We can just check in /.
2018-11-04 08:17:32 -05:00
Matthias Clasen
833442e1e2 Merge branch 'wip/fmuellner/deco-setting' into 'master'
wayland: Remove GNOME Classic-specific workaround

See merge request GNOME/gtk!400
2018-11-02 16:18:25 +00:00
Florian Müllner
1e39f999e3 wayland: Remove GNOME Classic-specific workaround
As GSettings now supports session-specific defaults, GNOME Classic
no longer uses a separate schema and the decoration layout is always
determined by the regular schema.

This essentially reverts commit add67b516c (although the code was
moved since then).

https://gitlab.gnome.org/GNOME/gtk/merge_requests/400
2018-11-02 16:44:33 +01:00
John Ralls
e31187e1cf GdkQuartz: Handle NULL from [NSGraphicsContext currentContext].
By returning a default surface. The situation where there's no
currentContext arises when GtkCSS is trying to determine the
layout sizes so no actual display is necessary.

Closes: #1411
2018-11-01 15:39:27 -07:00
John Ralls
e457a7823c Use [NSGraphicsContext CGContext] instead of graphicsPort after Yosemite. 2018-11-01 15:38:43 -07:00
John Ralls
88c77eb7be Update GDK_OSX versions to current MacOS release. 2018-11-01 15:38:29 -07:00
Piotr Drąg
f57d337fac Update POTFILES.in 2018-10-31 18:46:48 +01:00
Timm Bäder
60b0f48fbc Merge branch 'wip/carlosg/public-legacy-controller' into 'master'
Make legacy controller public

See merge request GNOME/gtk!388
2018-10-31 13:39:08 +00:00
Руслан Ижбулатов
4c6d60ce2b GDK W32: Be honest about supported clipboard formats
Do not lie to W32 about the formats that we provide or accept.

Originally the logic behind such lies was that GdkPixbuf allows us to
convert any supported image to BMP or PNG, and therefore we should
announce that we always provide/accept BMP and PNG along with other
formats.

But that's not how it works. GDK has built-in serializers and
deserializers for all pixbuf formats (where it just invokes GdkPixbuf
API) and will use them automatically to read or write GdkTexture
objects (internally wrapping GdkPixbuf objects where necessary). The
encoding and decoding of images is handled
by GdkContent(De)Serializers, backend has nothing to do with it.

Therefore W32 GDK backend should only offer formats that it can
actually do conversion for by itself (such as image/bmp <-> CF_DIB,
or text/uri-list <-> CFSTR_SHELLIDLIST).
2018-10-31 08:40:50 +00:00
Timm Bäder
b4acf81609 Merge branch '1422-gtkentry-s-minimum-width-is-hardcoded-to-150px-GTK4' into 'master'
gtkentry: set minimum-width to 0 instead of 150

Closes #1422 and evince#1002

See merge request GNOME/gtk!393
2018-10-26 09:25:36 +00:00
Matej Urbančič
62871400b1 Updated Slovenian translation 2018-10-25 22:06:19 +02:00
Matej Urbančič
c4b3337569 Added Slovenian translation 2018-10-25 22:03:51 +02:00
Nelson Benítez León
45e6e0cd04 gtkentry: set minimum-width to 0 instead of 150
and use 150 as natural-width.

Currently there's no way for a GtkEntry to be less
than 150px wide (apart from using "width-chars" property),
this is too much for a default minimum-width, an app
developer may need to have a shorter GtkEntry, for example
when the UI it's been shrunk by the user (see [1]) or when
you want to match the size of another widget (which is less
than 150px) see [2] for Evince bug on using
gtk_combo_box_new_with_model_and_entry() for PDF forms where
GtkEntry of ComboBox is too wide and doesn't match the combo
list width.

Using "width-chars" property may be a workaround to obtain
a short minimum-width for the entry, but is not a proper
solution for the mentioned cases as you may not know how
short your GtkEntry will be, or the fact that using "chars"
as a width unit is not pixel accurate.

Curious note: the commit that introduced the GtkEntry
minimum-width to be 150px is from 20 years ago, see
https://bit.ly/2ySEfK4

[1] This change was already suggested by Benjamin Otte
in a blog comment https://bit.ly/2J96wRo

[2] Fixes issue evince#1002
2018-10-24 23:02:31 +05:00
Timm Bäder
98dd53c2c3 Merge branch 'nirbheek/meson-fallback-dep-fixes' into 'master'
Misc meson fixes for using subproject dependencies

See merge request GNOME/gtk!232
2018-10-24 09:42:12 +00:00
Kristjan SCHMIDT
ad7eaf2bb8 Update Esperanto translation 2018-10-24 08:14:41 +00:00
Jakub Steiner
ef82f1799f Adwaita: prevent devel styling break selection mode
- Selection mode does not get the special devel styling.

- removed teh last-child() selector for it doesn't work anymore.
  Better style all section of the headerbar than none. Proper fix pending.

https://source.puri.sm/Librem5/libhandy/issues/57
2018-10-22 10:31:20 +02:00
Ignacio Casal Quinteiro
1729da8a3e quartz: do not cache the screen in the gdkmonitor
Instead we just cache the monitor number and get
out of it the nsscreen when it is needed. This is
a requirement since it nsscreen it is not supposed
to be cached.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/1312
2018-10-17 10:10:44 +02:00
Matthias Clasen
a3ac3b61ef Merge branch '1397-gtknotebook-built-in-popup-menu-listing-tabs-doesn-t-use-tab-label-text-for-the-last-tab-4' into 'master'
Notebook: Ensure menu label updates with tab_label

Closes #1397

See merge request GNOME/gtk!386
2018-10-16 20:49:42 +00:00
LRN
532a48aa92 Merge branch 'lrn/zorder-gtk4' into 'master'
Don't let the OS maintain relative Z-order for windows (GTK4)

See merge request GNOME/gtk!197
2018-10-15 22:48:14 +00:00
Carlos Garnacho
f3674688bf tests: Drop "saved positions" test in testgtk
This test solely relies on configure events, which aren't supported anymore.
2018-10-15 20:05:54 +02:00
Carlos Garnacho
dd6aa7b870 tests: Drop ::event handler in testgtk
We can use ::size-allocate for it, as window positions in root coordinates
are neither supported nor crucial here.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
21d0e30903 testsuite: Fix gestures tests for the legacy controller
Let it create one with the right propagation phase, so the event propagation
chain stays the same.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
3c73f70dae tests: Use GtkEventControllerMotion in testpopup
Track motion through it, instead of a GtkWidget::event handler.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
65fbd0af4e tests: Remove ::event handler in testwindowsize
We just want widget size here, not windowing configuration events.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
55b32c8a8f gtkwidget: Drop obsolete code
This path is not being hit anymore, gtkmain.c does handle those events
itself.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
bb0e964f56 testsuite: Fix gestures test
Was broken by the removal of the default GtkEventControllerLegacy.
2018-10-15 17:39:04 +02:00
Carlos Garnacho
0f4a6bfbf8 gtkeventcontrollerlegacy: Make public
And move ::event into it, dropping the GtkWidget::event signal.
2018-10-15 17:39:04 +02:00
Daniel Boles
4e884b6056 Notebook: Ensure menu_label updates with tab_label
This was noticed in Firefox and demonstrated using a GtkBuilder ui file.
buildable_add_child() calls set_tab_label(), but the latter did nothing
to update the menu_label corresponding to that tab with the new text.
Using Builder to populate the tab child, only tabs other than last got
the right non-default labels, and even that was mostly coincidental, as
adding the main child called update_labels() via real_insert_page(), so
it took effect when the 2nd last main child is added, updating the rest
but leaving the last with the default label, not that given in Builder.

Fix by factoring out the code from child_reordered() to a new helper
menu_item_recreate() and calling that in set_tab_label(), so that
whenever the tab_label is updated, so is its corresponding menu_label.

This fixes the reported case and presumably others that we could write.

fixes https://gitlab.gnome.org/GNOME/gtk/issues/1397
2018-10-12 23:50:12 +01:00
Daniel Boles
f252bbc02c Notebook: Don't notify 2x from set_tab_label_text
It calls set_tab_label(), which already does that.
2018-10-12 23:40:16 +01:00
Daniel Boles
9cbd3ac017 gtk-demo/main: Suppress implicit fallthru warning
Comments matched to reassure the compiler that fallthrough is
intentional are supposed to precede the case or default keywords, at
least in GCC, so the one here did not suppress the warning with GCC. We
can just the if condition and put the comment at the end to solve that.

https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
2018-10-12 22:19:25 +01:00
Nirbheek Chauhan
4bae7fb0fd .gitignore: Ignore all subdirs in the subprojects dir 2018-10-12 14:23:53 +05:30
Nirbheek Chauhan
b98f5a0823 meson: Always fetch pangoft2_dep from the pango subproject
This ensures that we will use pangoft2 if it is available, and not if
it is not available.

See: https://gitlab.gnome.org/GNOME/pango/merge_requests/6
2018-10-12 13:08:48 +05:30
Nirbheek Chauhan
00c29e1fbe meson: Use proxy-libintl subproject when needed and available
Such as on Windows with MSVC.
2018-10-12 13:08:48 +05:30
Nirbheek Chauhan
de3e5be235 meson: Add a fallback for the harfbuzz dependency
This meson port is not upstream yet, so a wrap file is not included.
Upstream has expressed interest but the port hasn't been tested on all
platforms yet. Will be added when it gets upstreamed.

Link to WIP port: https://github.com/centricular/harfbuzz
2018-10-12 13:08:48 +05:30
Timm Bäder
ae3e6d1949 emojichooser: Pass chooser to add_emoji 2018-10-11 12:27:56 +02:00
Timm Bäder
114efa83c6 widget: Stop adding a legacy event controller
The only event signal left is ::event and everything needing that
connects to it directly.
2018-10-11 12:27:56 +02:00
Timm Bäder
d15df65a9d gl renderer: Save some matrix multiplications
We do this for every single node, which is a little costly, especially
since the common case for the modelview matrix these days is a simple
translation. So, check whether the new modelview matrix is only a
translation matrix and if so, don't do a full matrix multiplication per
node.
2018-10-11 12:27:56 +02:00
Timm Bäder
e0a1311e5b spinbutton: Don't use gfloat in a code sample 2018-10-11 12:27:56 +02:00
Timm Bäder
48e88c6ea4 Merge branch 'file-sealing' into 'master'
gdk: seal in-memory files when possible

See merge request GNOME/gtk!353
2018-10-10 11:12:03 +00:00
Timm Bäder
50c63fc39a Merge branch 'gtkbuilder-tag-end-wrong-type' into 'master'
GtkBuildable: Fix the type of the user_data in GtkBuildable.custom_tag_end

See merge request GNOME/gtk!378
2018-10-10 11:09:25 +00:00
Chun-wei Fan
1ca5b41571 gtkimcontextime.c: Fix Korean input
Commit 64a489ad inadvertently introduced a regression that broke Korean
text input because the changes there resulted that only the last input
string that we have from ImmGetCompositionStringW() for each time the
commit signal is emitted is kept, and also as a result the final Korean
character that is input by hitting space is also lost as a result, as we
didn't check for whether we are done with preediting.

Fix these issues by doing the following when we receive the
WM_IME_COMPOSITION message with GCS_RESULTSTR from Windows:
-Do not emit the commit signal during WM_IME_ENDCOMPOSITION, and...
-Emit the commit signal anyways, as we did before c255ba68, however...
-We still save up the string to commit, because we need to re-compute
 the cursor position when we do ->get_preedit_string(), which needs to
 take the GCS_RESULTSTR string we get from WM_IME_COMPOSITION into
 account as well, so that we avoid getting the Pango criticals that
 occur during Chinese (and most likely Japanese) input as the cursor
 position is out-of-range.

Fixes issue #1350.
2018-10-09 17:10:23 +08:00
Chun-wei Fan
cebf5ed46c testsuite/gtk/filterlistmodel.c: Avoid GCCism
Pointer arithmetic on gpointers (void *) is a GCCism, so avoid that by
being more explicit with things.
2018-10-09 16:26:36 +08:00
Chun-wei Fan
1ca906008e testsuite/gtk/[flatten|sort]listmodel.c: Avoid VLA usage
Visual Studio is unlikely to support VLAs at any point, so avoid using
them and use g_newa() instead.
2018-10-09 16:26:21 +08:00
Robert Ancell
dd69c4e0f2 GtkBuildable: Fix the type of the user_data in GtkBuildable.custom_tag_end
The previous type was a pointer to a pointer, which seems to be a copy-paste
error from GtkBuildable.custom_tag_start which is an out parameter. It was
always cast in use so this is an API break, but not an ABI one.
2018-10-08 11:38:20 +13:00
Daniel Boles
cbb0d7ba69 Merge branch 'master' into 'master'
gtkstack: fix null pointer dereference

See merge request GNOME/gtk!361
2018-10-07 17:28:31 +00:00
Aurimas Černius
cbdb744c40 Updated Lithuanian translation 2018-10-07 16:57:01 +03:00
LRN
10fef2fbb4 Merge branch 'win32-runtime-immodule-swap-gtk4' into 'master'
GDK W32: Support switching IM contexts at runtime (GTK4)

See merge request GNOME/gtk!372
2018-10-07 09:05:16 +00:00
Benjamin Otte
8e2fb9c2be docs: Update GtkSliceListModel 2018-10-07 02:23:40 +00:00
Mohammed Sadiq
f48ed12e78 slicelistmodel: Fix typos in docs 2018-10-07 07:46:58 +05:30
Руслан Ижбулатов
66c0336ead GDK W32: Support switching IM contexts at runtime
This leverages the normal input context switching mechanism in GTK
by making it think that the gtk-im-module setting changed.
The backend returns gtk-im-module value as "ime" if W32
IME API says that an IME is in use. Otherwise it returns
and empty string - this still triggers an input context
switching code, which, not being able to create the desired context
(which is and empty string), falls back to looking at current
keyboard layout (currently that code is still a FIXME).

Paired with the code that signals gtk-im-module change on keyboard layout
switches, this is sufficient to make GTK capable of switching to
the appropriate IM context at runtime. At least, the kinds of context
that specify languages for which they are used automatically by default
(once locale matching is implemented), and the IME context.

Loading other kinds of IM context might still work via specifying
the gtk-im-module setting in gtk ini file, but doing so will likely
make GTK incapable of using the IME context that is used
for Korean, Chinese and Japanese (and some other languages).

Until someone figures out a way to actually change gtk-im-module
setting on Windows at runtime with meaningful values, the behaviour
introduced by this commit seems like a sufficient workaround.
2018-10-06 17:45:30 +00:00
Benjamin Otte
0657a53940 inspector: Highlight CSS node on selection
Fixes #1383
2018-10-06 00:29:31 +02:00
Benjamin Otte
eecd5823d0 docs: Put subsection into right section
The widget observer APIs belong into the widget docs, not the window
docs. Oops.
2018-10-06 00:29:31 +02:00
Benjamin Otte
99b769706c video: Add header include guard 2018-10-06 00:29:31 +02:00
Jakub Steiner
39843ebb3f Adwaita: fix devel styling for sidebar apps
- don't put the gradient/cogged wheel on apps that have a split headerbar
  due to having a sidebar
2018-10-04 20:36:44 +02:00
Jeremy Bicha
52bcf7fd46 widget-factory: Add Keyboard Shortcuts menu item
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/916
2018-09-30 20:43:53 -04:00
Jeremy Bicha
43997fb550 widget-factory: Rename About menu item to About Widget Factory
This follows the recommendation in
https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement
2018-09-30 20:43:51 -04:00
Jeremy Bicha
c59669d376 widget-factory: Move app menu contents to primary menu
GNOME Shell 3.32 will remove support for the app menu
so we need to move its contents to the primary (hamburger)
menu.

widget-factory already had a primary menu.

The only item in the app menu was About.

https://gitlab.gnome.org/GNOME/Initiatives/issues/4
2018-09-30 20:43:41 -04:00
Kristjan SCHMIDT
ac97d2be0c Update Esperanto translation 2018-09-30 10:24:25 +00:00
emersion
e9a67cc6d0 gdk: seal in-memory files when possible
This can be used by compositors to mmap memory without having to
handle SIGBUS.
2018-09-27 23:35:18 +02:00
Hugo Lefeuvre
44655932c4 gtkstack: fix null pointer dereference
The gtk_stack_snapshot_slide() function dereferences the
last_visible_child pointer without proper != NULL ckeck. This might
result in NULL pointer dereference and crash if last_visible_child is
invalid.

Add a != NULL check before dereferencing the pointer.
2018-09-27 09:53:22 -04:00
Jakub Steiner
278f9a9eda Adwaita: draw insensitive progressbars
- keep inheriting stuff from scales, but
  do draw highlights

Addresses issue #1191
2018-09-26 22:43:31 +02:00
Matthias Clasen
a28c7e8839 Merge branch 'wip/sadiq/fixes' into 'master'
docs: Fix inclusion of source files in tutorial

See merge request GNOME/gtk!341
2018-09-26 18:28:23 +00:00
Matthias Clasen
77c8d2df00 Merge branch 'wip/jimmac/nightly-headerbar' into 'master'
Adwaita: tone down the 'devel' styling

See merge request GNOME/gtk!357
2018-09-26 16:11:43 +00:00
Jakub Steiner
aeca5858d8 Adwaita: tone down the 'devel' styling
The selected bg was too prominent and intefered with button styling.
2018-09-26 15:50:58 +02:00
Timm Bäder
89b96a864e Merge branch 'wip/arnaudb/fix-dashed-border-4' into 'master'
Make dashed border-style work correctly

See merge request GNOME/gtk!355
2018-09-25 07:12:58 +00:00
Timm Bäder
26302cada5 Update expected node files
We don't technically hide the arrow nodes anymore.
2018-09-24 21:05:07 +02:00
Arnaud B
42d064c62f Make dashed border-style work correctly
There’s a short-path done for focus rectangles, but it can be taken in other conditions, and then fail occasionally to render a dashed line if the border-width is too big.
2018-09-24 09:39:55 +02:00
Piotr Drąg
273189fc1a Update Polish translation 2018-09-23 18:27:30 +02:00
Timm Bäder
d51abaea2e scalebutton: Remove unused define 2018-09-23 18:01:59 +02:00
Timm Bäder
248708c282 button: Remove key_controller member
Unneeded now.
2018-09-23 17:59:37 +02:00
Timm Bäder
0e2748006a assistant: Remove some unused defines 2018-09-23 17:34:03 +02:00
Timm Bäder
e89bd7dfa2 menu: Remove useless if statement 2018-09-23 17:34:03 +02:00
Timm Bäder
2f6e998a27 menu: Show scroll arrows if necessary 2018-09-23 17:34:03 +02:00
Timm Bäder
7b7296410e menu: Remove arrow visibility flags 2018-09-23 17:34:03 +02:00
Jan Alexander Steffens (heftig)
d90e2733ea GtkApplication: Fix CRITICAL on shutdown when register_session=FALSE
Close https://gitlab.gnome.org/GNOME/gtk/issues/1323#note_327705
2018-09-22 17:56:38 +01:00
Daniel Boles
19bf502fde Merge branch 'master' into 'master'
flattenlistmodel: Fix uninitialized variable warning

See merge request GNOME/gtk!347
2018-09-22 16:52:49 +00:00
Piotr Drąg
2b8e30a8ed Use Unicode apostrophes in new strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2018-09-20 19:01:14 +02:00
Yi-Soo An
4ad8dcebd8 flattenlistmodel: Fix uninitialized variable warning
Variable, added, would be a garbage value if model is NULL and
the following code, if condition, use the uninitialized variable.
A side effect could be occurred by that.

To avoid, the variable is initialized to zero.
2018-09-20 12:45:33 +09:00
Matthias Clasen
a966b90e51 Merge branch 'master' into 'master'
Remove some duplication in testfilechooserbutton

See merge request GNOME/gtk!342
2018-09-19 13:46:50 +00:00
Matthias Clasen
5b2a451e75 Merge branch 'installed-tests' into 'master'
Get GTK+ 4 installed-tests closer to working

See merge request GNOME/gtk!348
2018-09-19 11:59:16 +00:00
Emin Tufan Çetin
8105bde835 Update Turkish translation 2018-09-19 11:13:18 +00:00
Emin Tufan Çetin
2329b62c14 Update Turkish translation 2018-09-19 11:05:05 +00:00
Emin Tufan Çetin
1e1bed056f Update Turkish translation 2018-09-19 10:56:13 +00:00
Simon McVittie
a0d83bdfa7 testsuite: Install accessibility-dump executable alongside tests
The installed-tests want to run this.

Signed-off-by: Simon McVittie <smcv@debian.org>
2018-09-19 09:41:49 +01:00
Simon McVittie
fa8190328d testsuite: Fix installed-test metadata for autotestkeywords
The executable is called autotestkeywords, so we shouldn't try to run
an executable named keywords. Also rename the metadata file to match.

Signed-off-by: Simon McVittie <smcv@debian.org>
2018-09-19 09:40:37 +01:00
Simon McVittie
d19cba429d reftests: Fix path to installed-tests in .test metadata
The installed-tests are now namespaced as gtk-4.0 to avoid colliding
with GTK+ 3, but these files weren't updated.

Signed-off-by: Simon McVittie <smcv@debian.org>
2018-09-19 09:37:06 +01:00
Benjamin Otte
be2609a271 inspector: Handle case where there's no default application 2018-09-19 04:31:29 +02:00
Benjamin Otte
5bf009a203 cssrbtree: Fix a crasher
After removing elements, there were a few cases where the tree wasn't
properly balanced which could further down violate assumptions about the
layout.

Attached is the original testcase that triggered it. I didn't bother
simplifying it.
2018-09-19 04:31:29 +02:00
LRN
93a89a371e Merge branch 'win32-scroll-both-gtk4' into 'master'
GDK W32: send both smooth and discrete scrolling events (GTK4)

See merge request GNOME/gtk!337
2018-09-18 16:43:37 +00:00
Benjamin Otte
60cb315be6 Merge branch 'revealer-support-min-size-master' into 'master'
gtkrevealer: support minimum size of child

Closes #635

See merge request GNOME/gtk!317
2018-09-18 15:19:12 +00:00
Eduard Braun
73728814b0 GDK W32: fix direction of horizontal smooth scrolling events
Commit 359df028be changed the
code to send GDK_SCROLL_SMOOTH with deltas instead of
GDK_SCROLL_(UP|DOWN|LEFT|RIGHT).

Windows defines deltas inversed for vertical direction
(positive values mean the wheel was turned forward)
but not for horizontal direction
(positive values mean the wheel was turned towards the right).

This commit fixes behavior as both axes were inverted previously.
2018-09-18 13:52:36 +00:00
Руслан Ижбулатов
d4098099dd GDK W32: send both smooth and discrete scrolling events
Commit d64467b334 changed the
code to send GDK_SCROLL_SMOOTH with deltas instead of
GDK_SCROLL_(UP|DOWN|LEFT|RIGHT). Change it again, to send
both the GDK_SCROLL_SMOOTH and the GDK_SCROLL_(UP|DOWN|LEFT|RIGHT)
event separately (with the discrete event marked as emulated),
as this is what other backends (such as wayland) do.
2018-09-18 13:52:35 +00:00
Carlos Soriano
57ef793e6d revealer: Support minimum size of child
Up until now when allocating the child it only used the natural size
while the measuring also used the minimum size, resulting in a clipped
child when animating if the child had different minimum size and
natural size. This was an obvious case when using labels that had
ellipsization.

This commit gives full allocation to the child by inverting the size
the revealer reduces from its animation progress.

Code done by Benjamin Otte.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/635
2018-09-18 11:36:29 +02:00
Christoph Reiter
58cdd5139e ci/docker: add lcov so we can create coverage reports
This was requested on IRC; the docker image in the registry is updated already.
2018-09-18 09:55:50 +02:00
Benjamin Otte
2c84049769 treelistmodel: Improve naming a bit
The complexity with model items vs row items is really confusing. Add to
that treelistmodel position vs child model position vs parent position,
and you're so confused, even the best naming can't help.

And once you're there, consider passthrough vs non-passthrough...
2018-09-18 08:03:03 +02:00
Benjamin Otte
29c700d1c7 listmodels: Clarify documentation for function prototypes
Fixes #1341
2018-09-18 08:02:21 +02:00
Mohammed Sadiq
0d7c987b1a Revert "listlistmodel: Fix documentation comment"
This reverts commit 03679d4342.

listlistmodel is private
2018-09-18 10:01:12 +05:30
Mohammed Sadiq
03679d4342 listlistmodel: Fix documentation comment 2018-09-18 09:56:19 +05:30
Georges Basile Stavracas Neto
1a4b60fb36 tree-list-model: Return the correct item type
When passthrough is enabled, it should return the GType
of the child GListModels; when disabled, it should be
GTK_TYPE_TREE_LIST_ROW.

The conditions are inverted however, causing a few
warnings to trigger.

Fix that by returning the correct GType.
2018-09-18 00:51:57 -03:00
Mohammed Sadiq
05b2ae0f31 Merge branch 'wip/sadiq/model-fixes' into 'master'
treelistmodel: Fix memory leak

See merge request GNOME/gtk!344
2018-09-18 02:54:30 +00:00
Mohammed Sadiq
f211d71f74 treelistmodel: Fix memory leak
gtk_tree_list_model_init_node() increases the reference count
of the model passed. Let's not do that, and let it take the
model passed.
2018-09-18 07:50:44 +05:30
Mohammed Sadiq
691ab421fb Merge branch 'wip/sadiq/model-fixes' into 'master'
treelistmodel: Fix signal emission on row destroy

See merge request GNOME/gtk!343
2018-09-18 02:03:58 +00:00
Mohammed Sadiq
9e3e9e83ef treelistmodel: Fix signal emission on row destroy 2018-09-18 07:11:27 +05:30
Manu Cornet
a0056d5ca8 Remove some duplication in testfilechooserbutton
Most of the code creating the two types of dialogs (open file,
choose folder) is the same. This refactors the common code into a
helper method. This also makes it easier to add other chooser types
for this test (e.g. save file).
2018-09-17 12:27:46 +00:00
Rico Tzschichholz
f3e6d00db1 gtk: Fix some g-i annotations warnings 2018-09-17 13:00:36 +02:00
Robert Ancell
e55df03fe2 Merge branch 'toolbar-expand' into 'master'
toolbar: Use hexpand/vexpand Gtk+ properties

See merge request GNOME/gtk!334
2018-09-17 08:59:19 +00:00
Robert Ancell
c8a13a2d8a toolbar: Use hexpand/vexpand Gtk+ properties 2018-09-17 10:25:59 +02:00
Mohammed Sadiq
6971e2923d docs: Fix inclusion of source files in tutorial 2018-09-17 13:39:22 +05:30
Matthias Clasen
231b76bdd1 tree list model: Add docs 2018-09-16 23:07:00 -04:00
Matthias Clasen
57ba4048de Minor doc fix
Clarify some wording.
2018-09-16 23:07:00 -04:00
Benjamin Otte
545c5f18b2 testsuite: Disable some tests for older glib 2018-09-17 04:30:28 +02:00
Benjamin Otte
5571217218 testsuite: Add tests for GtkSortListModel 2018-09-17 03:57:37 +02:00
Benjamin Otte
b92c328425 sortlistmodel: Actually insert unsorted items at the wrong place
We were adding items in reverse order, oops.
2018-09-17 03:57:37 +02:00
Piotr Drąg
8bdcff3320 Update POTFILES.in 2018-09-16 21:02:31 +02:00
Benjamin Otte
9ffd88012d docs: Add missing TreeListModel docs 2018-09-16 19:39:39 +02:00
Matthias Clasen
563fb97f90 Merge branch 'wip/sadiq/fixes' into 'master'
gdkselectioninputstream-x11: Fix memory leak

See merge request GNOME/gtk!340
2018-09-16 17:06:29 +00:00
Benjamin Otte
ee5708f543 testtreelistmodel: Display the file icon, because why not 2018-09-16 18:50:17 +02:00
Benjamin Otte
b7bf04fabd inspector: Update the controllers list to show parent controllers
Now we show all the controllers that are relevant when widget gets sent
events.
2018-09-16 18:50:17 +02:00
Benjamin Otte
b94b8ac38d testtreelistmodel: Make the statusbar display more info
Now display how many items were filtered (if any) and how many
directories remain to be sanned (if any).
2018-09-16 18:50:17 +02:00
Benjamin Otte
afd69db678 testtreelistmodel: Sort files by name 2018-09-16 18:50:17 +02:00
Benjamin Otte
f3834138f7 GtkSortListModel: Add 2018-09-16 18:50:17 +02:00
Benjamin Otte
64b7c123cc testtreelistmodel: Add search
Add a simple search that does a case insensitive substring search of the
file paths.
2018-09-16 18:50:17 +02:00
Benjamin Otte
fcb780ee13 testtreelistmodel: Make the directory loading async
This is way more complicated than it should be, because it requires
manually limiting the number of open file enumerators.

On the other hand, it exhaustively tests the items-changed emission of
all involved listmodels because those signals come in pretty much
randomly.

It's also 50% slower than the sync version, with the caeat that the sync
version only shows the UI after it's done loading, while this version
shows it right away.
2018-09-16 18:50:17 +02:00
Benjamin Otte
65b795b861 testtreelistmodel: Add a hack to handle LONG lists
... and make the lists long by autoexpanding the tree.
2018-09-16 18:50:17 +02:00
Benjamin Otte
64d97b233b GtkSliceListModel: add 2018-09-16 18:50:17 +02:00
Benjamin Otte
db8474e5b1 inspector: Make controllers page use gtk_list_box_bind_model() 2018-09-16 18:50:17 +02:00
Benjamin Otte
5e8983883e inspector: Rename "Gestures" page to "Controllers"
And rename GtkInspectorGestures => GtkInspectorControllers, too.
2018-09-16 18:50:17 +02:00
Benjamin Otte
59006e2e03 inspector: Make gestures page handle all controllers
This requires removing support for gesture groups.
2018-09-16 18:50:17 +02:00
Benjamin Otte
b6acc31d44 GtkMapListModel: add 2018-09-16 18:50:17 +02:00
Benjamin Otte
6d0fe46cba propertylookuplistmodel: Add
This model just takes an object and a property name and recursively
looks it up. In particular, I want it for:

widget, widget.parent, widget.parent.parent, ...
2018-09-16 18:50:17 +02:00
Benjamin Otte
05e752e096 inspector: Turn object tree into a GtkListBox
The code gets rid of the GtkTreeView and replaces it with a GtkListBox.

Most of the logic is now done via GListModel subclasses.

A big change is that this new list is now tracking updates itself and
doesn't need to be manually updated. All code that used to cause rescans
or add forgotten objects to the tree has been removed.

If objects are missing from the object tree, the logic for tracking them
needs to be added.
2018-09-16 18:50:17 +02:00
Benjamin Otte
2237009983 testsuite: Disable some tests with older glib
Fixes CI.
2018-09-16 18:50:17 +02:00
Benjamin Otte
417ac4ab43 inspector: Use a GtkPicture to display render nodes
Instead of the outdated render node view, use modern GTK APIs.
2018-09-16 18:50:17 +02:00
Benjamin Otte
4495eaae84 inspector: Add an icon to the render node list 2018-09-16 18:50:17 +02:00
Benjamin Otte
aba76fe8e9 inspector: Make the render node tree use a ListBox
It used to be a treeview.
2018-09-16 18:50:17 +02:00
Benjamin Otte
867042f88f widget: Add gtk_widget_observe_controllers()
This mirrors gtk_widget_observe_children() - just that it observes the
controllers, not the children.
2018-09-16 18:50:17 +02:00
Benjamin Otte
32ec7dec61 gtk: Add GtkFlattenListModel
We can flatten lists of lists into lists now!
2018-09-16 18:50:17 +02:00
Benjamin Otte
d6161e09cd treelistmodel: Add more API to navigate the tree
This adds functionality from GtkTreeIter into GtkTreeListRow that allows
finding items in the model and getting their position for use in
GtkListBox.
2018-09-16 18:50:17 +02:00
Benjamin Otte
4b5fb5ec79 treelistmodel: Refactor to add GtkTreeListRow
This patch does multiple things:

1. Add a custom persistent per-row object.
2. Move all per-row API to that object. This means notifications are now
   possible.
3. Add a "passthrough" construct-only property to the TreeListModel that
   influences if the model returns these new object or passes through
   the ones from the model.

This greatly simplifies the code needed to be written for widgetry,
because one can just connect the per-row object to the expanders that
expand and collapse rows.

As an added power feature, these objects can also be passed through
further models (like filter models).

It also adds kind of a hack to Adwaita to make the test look neat.
2018-09-16 18:50:17 +02:00
Benjamin Otte
4f70f72349 gtk: Add GtkFilterListModel
This is a GListModel implementation that filters the given source model.
2018-09-16 18:50:17 +02:00
Benjamin Otte
dd94129e27 widget: Add gtk_widget_observe_children()
This creates a listmodel that tracks a widget's children. Doing so turns
adding/removing children from O(1) to O(N) though, so use with caution.
2018-09-16 18:50:17 +02:00
Benjamin Otte
63e5b827ed window: Add gtk_window_get_toplevels()
This one returns a list of all toplevel windows.
2018-09-16 18:50:17 +02:00
Benjamin Otte
573c63973a gtk: Add GtkTreeListModel
This is a GListModel implementation with a neat API that can be used to
implement trees inside GtkListBox.
2018-09-16 18:50:17 +02:00
Mohammed Sadiq
1ce960c85b gdkselectioninputstream-x11: Fix memory leak 2018-09-16 20:08:25 +05:30
Matthias Clasen
d7a5dcba0b gtk_application_inihit: allow no reason
We document this argument as nullable, so treat it as such.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1327
2018-09-13 23:31:48 -04:00
Emin Tufan Çetin
a4b1c6b384 Update Turkish translation 2018-09-11 20:17:29 +00:00
Jakub Steiner
0edec9bcae Merge branch 'adwaita-fixes' into 'master'
Adwaita fixes

See merge request GNOME/gtk!333
2018-09-10 14:29:54 +00:00
Adrien Plazas
7d12a843f2 Adwaita: Set selection mode to headerbars if it's on ancestors
This allows to set the container of the headerbars in selection mode
rather than having to set the mode to each element of the title bar.
2018-09-10 15:51:12 +02:00
Adrien Plazas
867efe2e33 Adwaita: Style separator.sidebar
Let separators be declared as sidebars to have the same style as those
drawn by GtkStackSidebar. This also let them handle the selection-mode
class, whether they are assigned it or they descend from something in
selection mode.

Also drop setting the selection mode color for non-sidebar separators.

This is convenient when building a custom sidebar using a GtkSeparator
and to extend a sidebar to the title bar.
2018-09-10 15:50:43 +02:00
Adrien Plazas
a121bfa7ec Adwaita: Drop the background of nested headerbars
This is needed to work around headerbar sliding animation issues without
refactoring Adwaita's support of titlebars and headerbars as it may
break applications.

https://gitlab.gnome.org/GNOME/gtk/issues/1264
2018-09-10 15:49:37 +02:00
Jakub Steiner
02758cd48d Merge branch 'wip/adwaita/linked-entry-error-state-fix-master' into 'master'
Adwaita: Fix linked elements in error state

See merge request GNOME/gtk!315
2018-09-10 10:47:05 +00:00
Jakub Steiner
005f932d13 Merge branch 'css-fix' into 'master'
win32 theme: Fix css syntax error

See merge request GNOME/gtk!324
2018-09-07 20:35:07 +00:00
Peter Simonyi
4e8c06eb7a win32 theme: Fix css syntax error 2018-09-07 08:31:22 -04:00
Matthias Clasen
ca9aa23619 Add devel style to demos
Lets show this off. Its cool.
2018-09-05 20:10:41 -04:00
Matthias Clasen
ae2c765ffd Fix portal path handling
This was broken when I recently introduced this helper
function.
2018-09-05 19:54:32 -04:00
Benjamin Otte
ab9455ea1b rendernodepaintable: Fix clipping
We need to translate before clipping, otherwise we clip in totally the
wrong place.
2018-09-05 16:25:07 +02:00
Benjamin Otte
89522e6923 iconhelper: Fix drawing of empty and paintable helpers
Empty helpers did try to draw a NULL paintable (not good) and in the
non-null case code used the wrong width/height.
2018-09-05 06:34:32 +02:00
Timm Bäder
506a4ddad5 Merge branch 'gtkbbox-doc-fix' into 'master'
Minor fixes in documentation of gtkbbox

See merge request GNOME/gtk!318
2018-09-04 10:02:05 +00:00
Lennart Buhl
272e4a0a9d Minor fixes in documentation of gtkbbox 2018-09-03 19:53:16 +02:00
Ask Hjorth Larsen
16deffb48d Updated Danish translation of gtk-properties 2018-09-02 23:46:33 +02:00
Ask Hjorth Larsen
a60e951941 Updated Danish translation of gtk 2018-09-02 23:45:47 +02:00
Ask Hjorth Larsen
05306470b0 Updated Danish translation of gtk 2018-09-02 23:19:35 +02:00
Ask Hjorth Larsen
803a8cf333 Updated Danish translation of gtk-properties 2018-09-02 21:42:45 +02:00
Alex Monday
3e5746356e themes: Fix linked elements in error state
Add instructions for color of linked elements border which ajoints
entry, when parent linked entry is in error state.
2018-09-02 14:48:53 +05:00
Daniel Boles
c9f1c56776 Adwaita: Regenerate CSS to get window.devel styles
This step was missed before, again.

SASS 3.6 emits rgba(0, 0, 0, 0) instead of transparent, so it wants to
change those too, but that patch was only committed in March and isn't
being backported to the previous stable, so I don't know if others'
versions will do the same - so until it's shown that anyone else (A) is
regenerating CSS and (B) also has 3.6, I'm skipping those changes. See:
c287f312ac
2018-09-02 09:27:38 +01:00
Piotr Drąg
fc026b95dd Update Polish translation 2018-08-31 19:47:44 +02:00
Matthias Clasen
2bb97bc136 GtkApplication: Improve the docs
Expand the docs for ::register-session a bit.
2018-08-31 13:38:01 -04:00
Matthias Clasen
d4d12171f4 Avoid a pointless goto
We can just return here.
2018-08-31 13:24:17 -04:00
Matthias Clasen
21e484731a Add a helpful comment 2018-08-31 13:23:25 -04:00
Matthias Clasen
b82a32676b GtkApplication: track screensaver state
A number of applications want to track the state of the screensaver.
Make this information available as a boolean property. We only listen
for state changes when ::register-session is set to TRUE.

This is implemented for unsandboxed D-Bus access by talking
directly to org.gnome.ScreenSaver or org.freedesktop.ScreenSaver,
and for sandboxed D-Bus by using a (new) portal API.
A Quartz implementation is missing.
2018-08-30 22:53:36 -04:00
Matthias Clasen
d7228ae025 GtkApplication: Respect GTK_USE_PORTAL
When the environment variable is set, don't connect
to the session manager, but instead rely on the
inhibit portal.
2018-08-30 22:53:36 -04:00
Matthias Clasen
04c02e9aec file chooser portal: use request path utilities
Less code duplication, more sticky toffee!
2018-08-30 22:53:36 -04:00
Matthias Clasen
d6945d81f0 print portal: use request path utilities
Less code duplication, more cookies!
2018-08-30 22:53:36 -04:00
Matthias Clasen
6d6559f982 color picker portal: Add request path utility
Less code duplication, more cake!
2018-08-30 22:53:36 -04:00
Matthias Clasen
b271db253f Add utility functions for portal paths
The paths that we create for requests and sessions
need some icky code to create. Keep it in one place.
2018-08-30 22:53:36 -04:00
Marek Cernocky
eb9f95e9fa Updated Czech translation 2018-08-30 16:51:17 +02:00
Marek Cernocky
d7a5723d66 Updated Czech translation 2018-08-30 14:45:16 +02:00
Jakub Steiner
72498b9e28 Merge branch 'selection-mode-separator' into 'master'
Adwaita: Add color to separator.selection-mode

See merge request GNOME/gtk!309
2018-08-30 07:40:46 +00:00
Matthias Clasen
b904fc6ee0 Add a missing cast
This fixes a warning introduced in the previous commit.
2018-08-29 19:55:58 -04:00
Aurimas Černius
9622ba8a0d Updated Lithuanian translation 2018-08-29 22:23:47 +03:00
Matthias Clasen
3b8d206143 The file chooser is no box anymore
Don't treat it as one, it does not like it.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1297
2018-08-29 13:11:06 -04:00
Anders Jonsson
e027fc9272 Update Swedish translation 2018-08-28 21:11:58 +00:00
Kai Willadsen
ba6c5ef201 FileChooserWidget: Don't show recent items with private hint set 2018-08-28 16:15:45 -04:00
Piotr Drąg
6a8013735d Update Polish translation 2018-08-28 18:49:34 +02:00
Matthias Clasen
c3e72c4d7e Fix a typo
Its Hieroglyphs!

Closes: #1292
2018-08-28 12:24:13 -04:00
Timm Bäder
a6c47cb3ab Merge branch 'revealer-clipping' into 'master'
revealer: Only clip child when animating

See merge request GNOME/gtk!301
2018-08-28 14:49:37 +00:00
Rafael Fontenelle
cc129e564a Update Brazilian Portuguese translation 2018-08-28 03:28:14 +00:00
Timm Bäder
9fbcbc55d7 Revert "paned: Use a GtkIcon as separator"
This reverts commit 749ef4d71c.

The GtkIcon and GtkGizmo measure code is different, the former uses
-gtk-icon-size.
2018-08-27 18:55:31 +02:00
Timm Bäder
00a27c1e28 box: Remove gtk_box_get_size
One function to measure the box in the opposite of its internal
direction is enough.
2018-08-27 18:53:56 +02:00
Timm Bäder
f5f6597abc box: Rename avail_size to for_size everywhere
So we call it like we call it everywhere else.
2018-08-27 18:48:09 +02:00
Timm Bäder
fade0afbef box: Simplify compute_size_for_orientation 2018-08-27 18:45:03 +02:00
Timm Bäder
0082675de8 testoverlaystyleclass: Fix CSS snippet 2018-08-27 18:13:01 +02:00
Timm Bäder
ed8e784879 remove tests/testinput
It's broken and almost the exact same thing as the drawing demo in
gtk4-demo.
2018-08-27 17:56:02 +02:00
Adrien Plazas
a4790b7eaa Adwaita: Add color to separator.selection-mode
This makes separators to look good when separating two header bars in
selection mode.

https://gitlab.gnome.org/GNOME/gtk/issues/1286
2018-08-27 14:07:17 +02:00
Matthias Clasen
ed434519d2 Merge branch 'robertroth/readme-fix' into 'master'
docs: README.commits converted to markdown

See merge request GNOME/gtk!304
2018-08-26 23:48:51 +00:00
Robert Roth
4ed4b4fd6a docs: README.commits converted to markdown 2018-08-26 23:48:51 +00:00
Christian Kirbach
369cb702e4 Update German translation 2018-08-26 17:21:13 +00:00
Timm Bäder
d246abd085 fishbowl: Use a GtkPicture for videos 2018-08-25 08:06:37 +02:00
Timm Bäder
911627fa0b menuitem: Remove duplicate include 2018-08-25 08:06:34 +02:00
Timm Bäder
ec576088bb picture: Fix doc typo 2018-08-25 08:06:28 +02:00
Timm Bäder
ab0b54db76 spinner: Remove private struct
Since priv->active is equivalent to the widget state being CHECKED, we
can as well use that everywhere.
2018-08-25 08:06:21 +02:00
Timm Bäder
fb51f8be9a colorswatch: Remove dead assignment 2018-08-25 08:06:18 +02:00
Timm Bäder
eb22c7c9c3 image: Fix gtkdoc property syntax 2018-08-25 08:06:14 +02:00
Timm Bäder
749ef4d71c paned: Use a GtkIcon as separator
And save a few lines that way.
2018-08-25 08:06:11 +02:00
Timm Bäder
f6fae1dd09 menubutton: Remove outdated line
.menu-button is not a style class we use anywhere.
2018-08-25 08:06:07 +02:00
Timm Bäder
f21abba82f renderborder: Remove unused function 2018-08-25 08:06:03 +02:00
Timm Bäder
bf222a9292 renderborder: Pull some locals into the closest scope
Especially the bounds graphene_rect_t, which is unused in the
non-border-image case.
2018-08-25 08:05:57 +02:00
Timm Bäder
96e465b6d9 checkbutton: Remove snapshot implementation
It just does when the default GtkWidget implementation does anyway:
snapshot all child widgets
2018-08-25 08:05:52 +02:00
Timm Bäder
016de68ceb radiobutton: Save signal IDs like everything else 2018-08-25 08:05:48 +02:00
Timm Bäder
d2178bcb94 fixed: Remove unused struct member 2018-08-25 08:04:43 +02:00
Ernestas Kulik
f40eb8a1fe revealer: Only clip child when animating
Currently, GtkRevealer clips the child if the transition type is
sliding, regardless of whether the animation had already ended. An
example where that is a problem would be in Nautilus: the file
operations popover button is animated on reveal to draw attention, but,
given that the button is in turn stashed inside a revealer with a
sliding animation, things suddenly fall apart.
2018-08-23 11:13:36 +03:00
Matthias Clasen
9e0f43e8cb entry completion: Avoid critical warnings
We must not call move-to-rect unless we have
a transient parent.
2018-08-20 19:15:27 +00:00
Matthias Clasen
3e4d7250a0 Merge branch 'fix-shifted-scrolling' into 'master'
gtkscrolledwindow: Consider shift key presses when decelerating

Closes #770

See merge request GNOME/gtk!286
2018-08-20 18:26:28 +00:00
Rico Tzschichholz
4ebd14c045 gesturestylus: Add missing array g-i annotation for *_get_axes params 2018-08-20 16:57:54 +02:00
Piotr Drąg
ca39b35e2f Update POTFILES.in 2018-08-19 22:05:06 +02:00
Matthias Clasen
a32fb5b849 Merge branch 'kill-subsurface' into 'master'
Kill subsurfaces

See merge request GNOME/gtk!299
2018-08-19 03:50:40 +00:00
Matthias Clasen
eed19c9269 Move tools to a subdirectory
A small step towards splitting up gtk/
2018-08-19 03:41:25 +00:00
Matthias Clasen
e2d691bdb1 gdk: Drop GDK_SURFACE_SUBSURFACE
None of the backends supports this type anymore.
2018-08-18 23:25:12 -04:00
Matthias Clasen
a73f961e65 wayland: drop subsurfaces
We don't use them in GTK+ anymore.
2018-08-18 23:25:05 -04:00
Matthias Clasen
a7aed5af4b Drop gtk_window_set_use_subsurface
This is no longer used.
2018-08-18 23:24:59 -04:00
Matthias Clasen
220a51e7cb entry completion: stop using subsurfaces
Instead, use a popup and gdk_surface_move_to_rect.
I have not tried to reproduce all details of the old
positioning logic, but moving the popup above/below
the entry works as before.
2018-08-18 23:24:53 -04:00
Jonas Ådahl
6df28420d7 tooltip: Implement positioning using gdk_window_move_to_rect()
In order to make tooltip positioning portable, make use of the
move_to_rect API. Some semantical changes are made, as identical
semantics cannot be implemented using the move-to-rect API.

Primarily the implemented semantics are:

Position the tooltip in the center pixels slightly below (defaults to 4
units below) the tooltipped widget. This is always the case for keyboard
driven tooltips; the case where it tries to avoid the pointer cursor is
not implemented.

For pointer position triggered tooltips, implement the following
additional semantics:

Use the current cursor size to determine the padding used to enlarge the
anchor rectangle. This is to try to avoid the cursor overlapping the
tooltip.

If the anchor rectangle is too tall (meaning if we'd be constrained
and flip on the Y axis, it'd flip too far away from the originally
intended position), rely only on the pointer position to position the
tooltip. The approximate pointer cursor rectangle is used as a anchor
rectangle. Ideally we should use the actual pointer cursor rectangle
(image used as well as hotspot coordinate), but we don't have API to
get that information.

If the anchor rectangle isn't to tall, just make sure the tooltip isn't
too far away from the pointer position on the X axis.

Closes: #134
Closes: #432
Closes: #574
Closes: #579
Closes: #878
2018-08-19 01:26:20 +00:00
Matthias Clasen
081b45399f gdk/wayland: Avoid idempotent wl_subsurface.set_position calls
These may not result on wl_surface.frame callbacks, yet we do trigger
a frame clock tick that would get stuck on the lack of such callback.

https://bugzilla.gnome.org/show_bug.cgi?id=784314
https://gitlab.gnome.org/GNOME/gtk/issues/844

Closes: #844
2018-08-19 01:26:20 +00:00
Matthias Clasen
0874a54708 gdk/wayland: Always map windows 'moved-to-rect' as popups
Only popups can make use of the move-to-rect semantics so it makes no
sense to try anything other surface type.
2018-08-19 01:26:20 +00:00
Matthias Clasen
cd40ec2200 gdk/wayland: Don't remap non-subsurface as subsurface
Let's just use the fact that a window was mapped as a subsurface to
remap it above another transient parent instead of relying on the more
complicated 'should-map-as-subsurface' helper function.
2018-08-19 01:26:20 +00:00
Matthias Clasen
62b887e064 Merge branch 'win32-smooth-scrolling-gtk4' into 'master'
GDK W32: Support smooth scrolling (GTK4)

See merge request GNOME/gtk!298
2018-08-18 20:39:56 +00:00
Timm Bäder
ce9ce8a5bc menu: Remove key_controller member
Unused.
2018-08-18 20:54:29 +02:00
Timm Bäder
2322f38bf9 menu: Remove initially_pushed_in flag
Unused.
2018-08-18 20:54:29 +02:00
Timm Bäder
dcb6c9b4cf menu: Remove seen_item_enter flag
Unused.
2018-08-18 20:54:29 +02:00
Timm Bäder
afdeffd820 menu: Remove have_position flag
It's always FALSE.
2018-08-18 20:54:29 +02:00
Timm Bäder
10439aaefe menu: Remove an unnecessary gtk_widget_destroy() call
The unref will already properly free the menu item's resources.
2018-08-18 20:54:29 +02:00
Руслан Ижбулатов
d64467b334 GDK W32: Support smooth scrolling
Set delta_x or delta_y for GdkScrollEvent.
HIWORD (wParam) in WM_MOUSE(H)WHEEL is the scroll delta.
A delta value of WHEEL_DELTA (which is 120) means scrolling
one full unit of something (for example, a line).

The delta should also be multiplied by the value that the
SystemParametersInfo (SPI_GETWHEELSCROLL(LINES|CHARS), 0, &value, 0)
call gives back, unless it gives back 0xffffffff, in which case
it indicates that scrolling is page- or screen-based, not line-based
(GDK doesn't support that at the moment).

Also, all deltas should be inverted, since MS sends negative deltas
when scrolling down (rotating the wheel back, in the direction of
the user).

With deltas set the mode should be set to GDK_SCROLL_SMOOTH.

Fixes issue 1263.
2018-08-18 17:02:39 +00:00
Matthias Clasen
099b967885 Don't fail the build if c++ isn't found
The intention of this check was to skip the keyword
test if no c++ compiler is found. But the meson
docs say that add_languages() will abort unless we
pass required: false.
2018-08-18 02:14:56 +00:00
Matthias Clasen
d13cd9cb67 Merge branch 'fix-shell-colorpicker' into 'master'
colorpickershell: Unpack the tuple returned from PickColor()

See merge request GNOME/gtk!296
2018-08-17 12:35:46 +00:00
Matthias Clasen
79b87cc543 print portal: don't leak window handles
Pointed out by Christian Persch.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1274
2018-08-15 23:21:15 +00:00
Matthias Clasen
3c2aceba63 print portal: Plug a memory leak
Pointed out by Christian Persch.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1271
2018-08-15 23:13:15 +00:00
Matthias Clasen
a01feae15b Use defines for bus names
This helps eradicate typos (we had some here).

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1267
2018-08-15 15:54:34 -07:00
Matthias Clasen
b4d4f73d9f Merge branch 'sort' into 'master'
updateiconcache: Sort list of entries

See merge request GNOME/gtk!297
2018-08-15 22:00:13 +00:00
Matthias Clasen
c1de6219ed font chooser: Remove an unneeded ifdef
We can just always create the axes hashtable.
2018-08-15 14:52:37 -07:00
Bernhard M. Wiedemann
b364827a5b updateiconcache: Sort list of entries
because filesystem readdir order is indeterministic.

Without this patch, building openSUSE's balsa package
had variations between builds in /usr/share/balsa/icon-theme.cache
2018-08-15 03:15:14 +02:00
Matthias Clasen
bbe362d015 Merge branch 'master' into 'master'
window: Fix memory leak

See merge request GNOME/gtk!295
2018-08-13 19:33:56 +00:00
Iain Lane
08f32c6560 colorpickershell: Unpack the tuple returned from PickColor()
When calling PickColor on org.gnome.Shell, we get back an "a{sv}", which
GDBus provides to us as "(a{sv})".

At the minute we're not unpacking this tuple, and so picking fails with
messages like:

  GLib-CRITICAL **: 13:38:19.439: g_variant_lookup_value: assertion 'g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{s*}")) || g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{o*}"))' failed

  Gtk-WARNING **: 13:38:19.439: Picking color failed: No color received

Let's unpack it.
2018-08-13 13:52:41 +01:00
Yi-Soo An
b3c8c8e592 window: Fix memory leak
https://gitlab.gnome.org/GNOME/gtk/issues/1268
2018-08-13 17:21:42 +09:00
Emin Tufan Çetin
ed36933232 Update Turkish translation 2018-08-12 10:47:44 +00:00
Piotr Drąg
a90fc088f2 Update Polish translation 2018-08-12 00:01:28 +02:00
Matthias Clasen
ff6c4ed07e Merge branch 'gtk-4-improve-error-message' into 'master'
gtkplacessidebar: Improve error message when unlocking volume fails

See merge request GNOME/gtk!267
2018-08-07 10:01:09 +00:00
Piotr Drąg
201f635559 Update Polish translation 2018-08-06 19:01:40 +02:00
Matthias Clasen
59077e4843 migration guide: Mention GtkEventBox
Its gone.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1243
2018-08-05 19:53:02 -04:00
Carlos Soriano
3e6a473082 README: Fix Gdk doc website link 2018-08-05 21:59:27 +00:00
Carlos Soriano
580d96620e README: Document nightly docs location
Useful for exposing the documentation early.
2018-08-05 20:41:29 +00:00
segfault
61f50f2410 gtkplacessidebar: Improve error message when unlocking volume fails 2018-08-05 18:59:40 +02:00
Aurimas Černius
61b2f3c996 Updated Lithuanian translation 2018-08-05 16:06:33 +03:00
Timm Bäder
ab30850aad widget: Rename width and height member to {width,height}_request
Because that's much closer to the meaning of those values.
2018-08-05 10:22:11 +02:00
Timm Bäder
f5e04b59e9 main: Pass toplevel_widget directly to GtkWidget API
We already have the toplevel as GtkWidget: toplevel_widget.
2018-08-05 10:22:10 +02:00
Timm Bäder
c67bcf09b9 sizerequestcache: Inline out-var assignments
The additional assignment to the old result variable just adds an
indirection even though we know the point where we assign it in all
cases. Just pass the values out and return in those cases instead.
2018-08-05 10:22:10 +02:00
Timm Bäder
5eba0bc932 widgetprivate: Remove useless prototype
We implement that function lower down in that header file.
2018-08-05 10:22:10 +02:00
Timm Bäder
ff2ba52bc6 pathbar: Remove priv pointer 2018-08-05 10:22:10 +02:00
Timm Bäder
a822d6fce9 menuitem: Don't redraw unnecessarily
The gtk_widget_(un)set_state_flags calls before will do this if
necessary.
2018-08-05 10:22:10 +02:00
Timm Bäder
b749fe4270 menu: Use correct content height 2018-08-05 10:22:10 +02:00
Timm Bäder
933cb857cf menu: Allocate children according to scroll_offset
This was done by simply moving the bin_window before but now we have to
do it ourselves.
2018-08-05 10:22:10 +02:00
Timm Bäder
dde535bbdf levelbar: Don't return a double value from a gboolean function 2018-08-05 10:22:10 +02:00
Timm Bäder
71b36db88d acitonbar: Remove snapshot implementation 2018-08-05 10:22:10 +02:00
Timm Bäder
b5576397f7 modelbutton: Remove snapshot implementation
Previously, GtkBin was only snapshot'ing its one and only child, but
nowadays it doesn't implement snapshot at all and the default
implementation in GtkWidget just snapshots all child widgets, which is
exactly what the implementation in gtkmodelbutton.c was doing.
2018-08-05 10:22:10 +02:00
Matthias Clasen
4e86858405 Make color picker circular
The need for center alignment was pointed out by Timm Baeder.
2018-08-04 21:42:28 -04:00
Sebastian Keller
14b21d78db gtkscrolledwindow: Consider shift key presses when decelerating
Otherwise horizontal scrolling using the shift key would decelerate
vertically.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/770
2018-08-04 16:24:33 +02:00
Mario Blättermann
35829a7272 Update German translation 2018-08-04 11:25:21 +00:00
Ernestas Kulik
0eb60fb03e Merge branch 'sidebar-spinner-visibility' into 'master'
sidebarrow: Hide busy_spinner by default

See merge request GNOME/gtk!285
2018-08-03 10:45:04 +00:00
Ernestas Kulik
94162197a1 sidebarrow: Hide busy_spinner by default
Since the original implementation was likely based on GTK+ 3, the change
in default visibility might have not been considered, which results in
all rows suddenly sporting a visible spinner when opening a fresh file
chooser.
2018-08-03 13:29:07 +03:00
Matthias Clasen
877fffdd5e Merge branch 'fix-app-id' into 'master'
Make xdg-shell's app_id match GApplication's application-id property

Closes #653

See merge request GNOME/gtk!284
2018-08-03 02:09:09 +00:00
Matthias Clasen
8669d31c30 color picker: Also try kwin
use a kwin color picker when we run under kwin.
2018-08-02 20:55:07 -04:00
Matthias Clasen
e76d17a786 Only use the portal color picker when appropriate
This is just moving this check around.
2018-08-02 20:54:21 -04:00
Matthias Clasen
5ab90f1a80 Add a kwin color picker
This uses the org.kde.kwin.ColorPicker interface.
2018-08-02 20:53:37 -04:00
Benjamin Otte
5b1fd111d1 Merge branch 'gbsneto/issue-1258' into 'master'
listbox: Unparent child after removing from sequence

Closes #1258

See merge request GNOME/gtk!283
2018-08-02 14:14:10 +00:00
Georges Basile Stavracas Neto
5596feae9b listbox: Store child iter in a variable when removing
Unparenting a GtkListBoxRow can drop its last reference, which
will free its memory. Right after unparenting, though, we were
accessing the row's iter - which assumes that the row is still
alive. This causes a crash when, for example, binding two or
more models to the listbox.

Fix that by storing the iter in a variable, and not trying to
access it after unparenting. After unparenting, the variables
that are potentially garbage were explicitly assigned NULL for
clarity.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1258
2018-08-02 10:24:12 -03:00
Guido Günther
8fb8303ba0 demos: Make desktop file names match the application id 2018-08-02 12:15:43 +02:00
Guido Günther
06e4c3c991 examples: Use appliction id as desktop file base name 2018-08-02 11:10:21 +02:00
Guido Günther
f25f3b3c47 docs: Explain desktop file id == application_id in migration guide 2018-08-02 11:10:21 +02:00
Guido Günther
72ec8963d7 gdk: Use application_id as xdg_shell's app_id if available
This (manually) reverts commit e1fd87728d

This makes sure xdg_shell's app_id matches the DBus name of the the
appliation when using GtkApplication. It also allows the compositor to
derive the desktop file ID from the app_id:

   https://cgit.freedesktop.org/wayland/wayland-protocols/tree/stable/xdg-shell/xdg-shell.xml?id=298d888ac718eae57ff2245d373d4327074506ea#n598

Closes #653
2018-08-02 11:03:41 +02:00
Benjamin Otte
50d5666db0 container: Remove focus chains
They're prectically unused.

Widgets who want to influcence the focus chain behavior should implement
GtkWidgetClass::focus and deal with focus there.
2018-07-31 22:34:27 +02:00
Benjamin Otte
e06044530f widgetfocus: Fix copy/paste error
This lead to erratic focus behavior with <Tab> in hboxes, where the
smallest child got focus first instead of the leftmost child.
2018-07-31 22:34:27 +02:00
Benjamin Otte
7ce7e5503f colorpicker: Fix gcc warning 2018-07-31 22:34:27 +02:00
Matthias Clasen
0ba307995d Mention gtk_widget_show_all in the migration guide
This function is gone.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1242
2018-07-31 13:38:10 -04:00
Matthias Clasen
ce7956cd50 Merge branch 'issue1214-tooltips-win32-gtk4' into 'master'
Gdk-Win32: Correct handling of transient state changes

See merge request GNOME/gtk!280
2018-07-31 11:37:28 +00:00
Luca Bacci
d29b378fa0 Gdk-Win32: Correct handling of transient state changes
See merge request !248
2018-07-31 11:11:26 +02:00
Benjamin Otte
1129febd7d bindings: Remove GTK_TYPE_IDENTIFIER
bindings now treat identifiers and strings the same way.

The only difference was that one allowed lookup of enum/flags by name
while the other didn't and g_warning()ed. Now both work.
2018-07-31 06:46:36 +02:00
Matthias Clasen
47928b9e14 color picker: Better debug spew
This will help in debugging issues.
2018-07-30 18:12:14 -04:00
Marek Cernocky
01f17836ac Updated Czech translation 2018-07-30 23:14:21 +02:00
Benjamin Otte
7e919aaaa5 gdk: Fix Windows and OS X backend for keyevent.string removal 2018-07-30 20:15:16 +02:00
Benjamin Otte
03a6420c37 treeview: Fix compiler warning 2018-07-30 19:58:38 +02:00
Benjamin Otte
375fbd4e47 gdk: Remove key_event->string and key_event->length
They're unused.
2018-07-30 19:32:38 +02:00
Benjamin Otte
813957a92f gdk: Remove gdk_event_get_string()
You want to use an IM module to get strings out of keypresses, not some
crude hack that only works on X11 and Wayland anyway.
2018-07-30 19:32:38 +02:00
Piotr Drąg
36ed4c2a29 Update POTFILES.skip 2018-07-30 16:31:53 +02:00
Marek Cernocky
8e78b53378 Updated Czech translation 2018-07-30 15:11:26 +02:00
Mohammed Sadiq
76ed6cf9d8 colorpickerportal: Fix memory leak 2018-07-30 18:10:31 +05:30
Carlos Garnacho
a8c6f222ed inspector: Remove unnecessary cast
Pointed out by Timm.
2018-07-30 14:21:22 +02:00
Matthias Clasen
c5afea0c6b Merge branch 'gtk-4-add-spinner-to-sidebar-row' into 'master'
gtkplacessidebar: Show busy spinner in sidebar row during mount ops

See merge request GNOME/gtk!261
2018-07-30 12:04:05 +00:00
Carlos Garnacho
efa42a6932 Merge branch 'wip/carlosg/event-final-cleanup' into 'master'
Wip/carlosg/event final cleanup

See merge request GNOME/gtk!279
2018-07-30 11:25:24 +00:00
Carlos Garnacho
5d1b2f627c tests: Port testwidgetfocus to using a motion controller 2018-07-30 13:14:12 +02:00
Carlos Garnacho
8f6f980e49 demos: Update changedisplay demo to using GtkGesture 2018-07-30 13:14:12 +02:00
Carlos Garnacho
25b3b90920 tests: Port motion-compression to using a motion controller 2018-07-30 13:14:12 +02:00
Carlos Garnacho
71762d3b28 gtkscrolledwindow: Use controller for motion capturing
Perform scrollbar visibility checks through a motion controller,
always based on GtkScrolledView-relative coordinates. The captured
event handler remains though, for a tiny bit of GDK_SCROLL event
handling.
2018-07-30 13:14:12 +02:00
Carlos Garnacho
f15224926a gtkwindow: Replace captured event handler with motion controller 2018-07-30 13:14:12 +02:00
Carlos Garnacho
1570c41efa testsuite: Update window test to use gestures when interactive 2018-07-30 13:14:12 +02:00
Carlos Garnacho
5e0f2d7d20 tests: Use gesture in testtreepos 2018-07-30 13:14:12 +02:00
Carlos Garnacho
88743ab975 tests: Use gesture to popup menu in testiconview 2018-07-30 13:14:12 +02:00
Carlos Garnacho
6f15447633 tests: Update testgrid to use gestures 2018-07-30 13:14:12 +02:00
Carlos Garnacho
85f6995511 demos: Update hypertext demo to use controllers 2018-07-30 13:14:12 +02:00
Carlos Garnacho
4d59a00074 demos: Update search_entry2 demo to use key capturing API
No more GdkEvent juggling.
2018-07-30 13:14:12 +02:00
Carlos Garnacho
2dbb1509d8 demos: drop "Event axes" demo
It's too lowlevel to be practical anymore with gtk4, and there's
the Paint and Gestures demos to demonstrate input capabilities
better than this.
2018-07-30 13:14:12 +02:00
Carlos Garnacho
101c927c40 gtk-demo: Add pad controller handling to "Paint" demo
So it's more lifelike.
2018-07-30 13:14:12 +02:00
Carlos Garnacho
6d3eb18578 gtktreeview: Use key controller on search entry handling
Use a distinct key controller so we correctly handle navigation
across matches and search cancellation. As the events are forwarded
to the search_window, those need to be pushed down the entry manually.
2018-07-30 13:14:12 +02:00
Carlos Garnacho
d301695ba1 gtktreeview: Replace event vmethod with key controller 2018-07-30 13:14:12 +02:00
Carlos Garnacho
ca8008e2c9 gtkcombobox: Use keycontroller on GtkCellEditable implementation 2018-07-30 13:14:12 +02:00
Carlos Garnacho
0d7b4ecb14 gtkentry: Use keycontroller on GtkCellEditable implementation 2018-07-30 13:14:12 +02:00
Carlos Garnacho
9a541d9b91 inspector: Use gestures/controllers for inspect button 2018-07-30 13:14:12 +02:00
Carlos Garnacho
cdfde6673d gtkcombobox: Use controller to handle combobox keybindings in menus
Instead of an ::event callback.
2018-07-30 13:14:12 +02:00
Matthias Clasen
7ef95734af Merge branch 'fix-gs-issue-404' into 'master'
window: Fallback to CSD titlebar in focus-chain

Closes gnome-software#404

See merge request GNOME/gtk!271
2018-07-30 10:53:22 +00:00
Matthias Clasen
de17e3b525 Merge branch 'devel-styling' into 'master'
Devel styling

See merge request GNOME/gtk!168
2018-07-30 10:49:56 +00:00
Jakub Steiner
f8a971a7df Adwaita: devel style
- nightly/development versions of apps should get a styled
  headerbar.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/142
2018-07-30 12:09:41 +02:00
Andrea Azzarone
e1a7629a85 window: Fallback to CSD titlebar in focus-chain
CSD titlebar are included in the focus-chain. The logic used makes sure that the
initial focus avoids the titlebar, but tabbing around will eventually get there.
This logic fails in case the window has no other focusable widgets apart from
the ones in the header-bar. If this happens keynav focus will be lost. To handle
the above scenario, we need to fallback to focus the header-bar (if any).

Fixes: https://gitlab.gnome.org/GNOME/gnome-software/issues/404
2018-07-30 09:30:26 +02:00
Matthias Clasen
7d3b8b0d09 treeview: Get rid of child surfaces
Drop the drag-highlight and drag surfaces. The highlighting
is broken anyway, so just drop it for now. And for dragging
the header button, we can just position it properly, that
works just as well as this reparenting approach.
2018-07-29 15:23:41 -04:00
Piotr Drąg
fff2fabd7a Update Polish translation 2018-07-29 20:33:24 +02:00
Matthias Clasen
73b45ec77e Migration guide: mention size-allocate
Document the new argument here.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1245
2018-07-29 09:11:39 -04:00
Matthias Clasen
8f95a5980e Remove an outdated comment
We no longer have semi-private headers.
2018-07-29 08:45:34 -04:00
Christian Hergert
87d33470ed vulkan: fix warning from g_clear_pointer() changes 2018-07-28 10:54:14 -07:00
Christian Hergert
002e48c469 imwayland: fix potential leak of attr list
This fixes a potential leak of a PangoAttrList that is set when chaining
up to the parent get_preedit_string(). We check to see if the attr list
was created and reuse it instead of leaking the previous value.
2018-07-28 10:54:14 -07:00
Aurimas Černius
f33549da91 Updated Lithuanian translation 2018-07-28 20:35:20 +03:00
Matthias Clasen
f3f32b47cc Merge branch 'wip/gtk-menu-popup-no-more' into 'master'
Remove legacy GtkMenu popup APIs

See merge request GNOME/gtk!270
2018-07-27 18:57:24 +00:00
Matthias Clasen
2c5f2a2bcb Merge branch 'color-picker' into 'master'
Color picker

See merge request GNOME/gtk!273
2018-07-27 18:35:05 +00:00
Matthias Clasen
b6d990af25 tests: Update a11y tests
Some things changed.
2018-07-27 14:23:20 -04:00
Matthias Clasen
16171a232a Add a color picker implementation for gnome-shell
This adds a GtkColorPicker implementation that talks
to gnome-shell to get a color.
2018-07-27 14:23:20 -04:00
Matthias Clasen
031b5cad46 Add a color picker implementation for portals
This adds a GtkColorPicker implementation that talks
to the screnshot portal to get a color.
2018-07-27 14:23:20 -04:00
Matthias Clasen
984274497d color editor: Add a color picker button
The button is shown if we have a GtkColorPicker implemenation.
Currently, there are none, so the button is never shown.
2018-07-27 14:23:20 -04:00
Matthias Clasen
0cc0714312 Add a color picker interface
This will be used in the color chooser, in subsequent commits.
2018-07-27 14:23:19 -04:00
Matthias Clasen
766e2b1e63 testsuite: Update the list of used icons
We use some more now...
2018-07-27 13:37:00 -04:00
Matthias Clasen
c8be597b7f Bring back gtk-orientation icons
These are used in the page setup dialog, so we can't
just drop them.
2018-07-27 13:35:29 -04:00
Jonas Ådahl
4497ac7d75 menu: Remove legacy popup APIs
Remove gtk_menu_popup_for_device() and gtk_menu_popup(), as they cannot
be implemented in a portable manner by all backends. They have been
deprecated for proper alternative APIs for some time, so lets remove
them now before its too late.

While at it, fix the example documentation for mapping a menu.
2018-07-27 17:16:44 +02:00
Jonas Ådahl
af21583d4d tests: Stop using legacy gtk_menu_popup API
Use the new portable APIs, so that menus will be positioned properly on
all backends.
2018-07-27 17:16:44 +02:00
segfault
791da76ae1 gtkplacessidebar: Show busy spinner in sidebar row during mount ops 2018-07-27 16:44:50 +02:00
Matthias Clasen
d398c00d20 Fix up the resource generation for icons
The script was looking in the wrong subdirectories.
2018-07-27 09:08:27 -04:00
Matthias Clasen
cb247276f5 Add emoji category icons
This is a temporary measure to make the check-icon-names
test not fail in ci. We still have to figure out the best
way to include a core icontheme with GTK+.
2018-07-27 08:05:55 -04:00
Matthias Clasen
c6141dffd2 Keep picking up icons as resources
We may need to revisit this at some point. For now,
keep the mechanism in place.

This is a partial revert of 806c659efe.
2018-07-27 08:05:55 -04:00
Daniel Mustieles
755d8f8332 Updated Spanish translation 2018-07-27 13:40:20 +02:00
Matthias Clasen
32de29bb68 testsuite: Sort icon names
This is easier to keep track of.
2018-07-27 07:12:23 -04:00
Timm Bäder
540cb58169 Merge branch 'patch-1' into 'master'
doc: Fix there/their typo

See merge request GNOME/gtk!274
2018-07-27 04:47:04 +00:00
Alcaro
a1a6e6a36a doc: Fix there/their typo 2018-07-27 02:28:45 +00:00
Timm Bäder
798ad9f62a Merge branch 'g-clear-pointer-propagate' into 'master'
Remove GDestroyNotify casts in g_clear_pointer() uses

See merge request GNOME/gtk!269
2018-07-26 07:34:12 +00:00
Matthias Clasen
ad6255a841 Merge branch 'xfixes-timestamp' into 'master'
x11: Ignore old XFixesSelectionNotify events

Closes #14

See merge request GNOME/gtk!259
2018-07-25 11:21:01 +00:00
Ernestas Kulik
6adaf7c33d Remove GDestroyNotify casts in g_clear_pointer() uses
GLib master propagates argument types in g_clear_pointer(), which causes
the usual function pointer casts to GDestroyNotify to trip compiler
warnings. Additionally, this commit changes some cleanup functions where
appropriate (wl_data_source_destroy ->
gtk_primary_selection_source_destroy for struct
gtk_primary_selection_source).
2018-07-25 10:05:39 +03:00
Benjamin Otte
95a4eff6ba render: Make gtk_render_icon() use the snapshot API
This removes a lot of duplicated code.
2018-07-24 20:55:45 +02:00
Benjamin Otte
9675c99043 render: Make gtk_render_frame() and gtk_render_focus() use the snapshot API
This removes a lot of duplicated code.
2018-07-24 20:55:45 +02:00
Benjamin Otte
76d0e1e398 API: Remove gtk_render_frame_gap()
That function does not make sense at all in a CSS world. So better don't
support it anymore.
2018-07-24 20:55:45 +02:00
Benjamin Otte
14408b7485 render: Make gtk_render_background() use the snapshot API
This removes a lot of duplicated code.
2018-07-24 20:55:45 +02:00
Benjamin Otte
2a11baf6ea render: Make gtk_render_check/arrow/handle() use the snapshot API
This removes a lot of duplicated code.
2018-07-24 20:55:45 +02:00
Benjamin Otte
51d40ca023 render: Make gtk_render_layout() use the snapshot API
This removes a lot of duplicated code.
2018-07-24 20:55:45 +02:00
Benjamin Otte
5d9d73b090 testsuite: Fix DragContext => Drag renaming 2018-07-24 20:55:45 +02:00
Benjamin Otte
5f7e093168 gtk: Move GtkGesture declaration to gtktypes.h
That way, headers can use the gesture type without having to include
gtkgesture.h
2018-07-24 20:55:45 +02:00
Benjamin Otte
0f70e6d70a docs: Remove remains of Mir backend 2018-07-24 20:55:45 +02:00
Benjamin Otte
259be23ff2 broadway: Remove unused variable 2018-07-24 20:55:45 +02:00
Daniel Șerbănescu
337eedb513 Update Romanian translation 2018-07-24 18:09:59 +00:00
Nirbheek Chauhan
185354555c Merge branch 'nirbheek/misc-meson-fixes' into 'master'
Fix broadway backend build and graphene as a subproject

Closes #1197 and #1218

See merge request GNOME/gtk!265
2018-07-24 08:29:34 +00:00
Daniel Mustieles
29905d1ce6 Updated Spanish translation 2018-07-24 10:03:20 +02:00
Timm Bäder
73dd73c859 Merge branch 'just-popover-menu-things' into 'master'
Post-gizmo GtkPopoverMenu fixes

See merge request GNOME/gtk!264
2018-07-23 18:55:55 +00:00
Nirbheek Chauhan
cfb0df14cc meson: Update pango and gdk-pixbuf wrap locations
See: https://gitlab.gnome.org/GNOME/gtk/issues/1219
2018-07-23 20:17:04 +05:30
Nirbheek Chauhan
b343abfa51 meson: Support graphene as a fallback dependency
Don't assume graphene_dep is always a pkg-config dependency.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1197
2018-07-23 20:17:04 +05:30
Nirbheek Chauhan
5df4d27752 meson: libgdk-broadway.a depends on broadwayjs.h
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1218

Also fix another dependency error I found.
2018-07-23 20:15:44 +05:30
Daniel Mustieles
bbf5d142b3 Updated Spanish translation 2018-07-23 12:10:24 +02:00
Ernestas Kulik
1fbbaef49e testpopover: Don’t set margin in menu box
The gizmo already provides sufficient padding.
2018-07-23 13:05:57 +03:00
Ernestas Kulik
d88268c142 gtkpopovermenu: Conditionally chain up in gtk_popover_menu_add()
Otherwise the stack gets parented to the wrong widget and the contents
are never drawn.
2018-07-23 13:01:01 +03:00
Ernestas Kulik
49ae68c2c7 gtkpopovermenu: Drop call to gtk_widget_show()
The stack is already visible.
2018-07-23 13:00:11 +03:00
Matthias Clasen
1d72e3e193 Drop builtin icon test
We don't have these icons anymore.
2018-07-22 17:16:20 +00:00
Jason Crain
77c3ef48cf x11: Ignore old XFixesSelectionNotify events
GtkEntryCompletion can rapidly release and claim ownership of the
primary selection. This generates multiple XFixesSelectionNotify events,
first stating that no one owns the selection, then another stating that
we own the selection. The notification that no one owns the selection
causes GtkEntryCompletion to deselect the text, breaking inline
autocompletion.

This fixes it by ignoring any XFixesSelectionNotify with a timestamp
earlier than our clipboard timestamp.

Fixes #14
2018-07-21 15:22:04 -05:00
Bruce Cowan
20deda2bd6 Update British English translation 2018-07-21 11:08:03 +00:00
Benjamin Otte
447b166ed3 Merge branch 'wip/muktupavels/remove-gtk-css-provider-get-default' into 'master'
gtkcssprovider: remove gtk_css_provider_get_default

See merge request GNOME/gtk!256
2018-07-20 14:03:51 +00:00
Christoph Reiter
1b230324ba ci: add hicolor-icon-theme to the docker image
The tests complain about it, not sure if this helps.
2018-07-20 15:04:26 +02:00
Matthias Clasen
806c659efe Drop unused old icons
We don't need to ship the deprecated old stock-id named
icons and the drag cursors - we don't use them from resources
anyway.
2018-07-20 08:06:07 -04:00
Emin Tufan Çetin
51873ebe37 Update Turkish translation 2018-07-20 11:18:15 +00:00
Matthias Clasen
827219e214 Emoji chooser: Also check for hex boxes
We don't want to see those either.
2018-07-19 17:57:19 -04:00
Matthias Clasen
5c9b25c66e moji chooser: Try harder to avoid fallback
We don't want to see any fallback rendering.
The current check was still letting some fallback
combinations through.

Based on work by Julian Sparber.
2018-07-19 17:50:54 -04:00
Matthias Clasen
37e4ae2fbd Quiet a compiler warning
We don't need to handle GDK_CONFIGURE here, so make the
compiler not warn about it.
2018-07-19 17:48:06 -04:00
Matthias Clasen
14f86ae24d testsuite: Add emoji icon names
We check for all icon names that are used in gtk.
2018-07-19 17:48:06 -04:00
Matthias Clasen
849ffebc21 Emoji chooser: Use icons for sections
This is more reliable than using text-style Emoji
which may not be present.

Based on work by Julian Sparber.
2018-07-19 17:47:50 -04:00
Matthias Clasen
7dabc2a42c Merge branch 'master' into 'master'
widgetfactory: add separator tool item to presentation

See merge request GNOME/gtk!249
2018-07-19 18:06:25 +00:00
Matthias Clasen
bef8a3a0e9 Merge branch 'content-provider-autoptr' into 'master'
gdk: Add auto cleanup func for GdkContentProvider

See merge request GNOME/gtk!251
2018-07-19 18:04:24 +00:00
Matthias Clasen
31d2638088 Merge branch 'content-provider-docs' into 'master'
docs: Fix GdkContentProvider documentation

See merge request GNOME/gtk!254
2018-07-19 17:46:36 +00:00
Ernestas Kulik
40019517cf docs: Fix GdkContentProvider documentation
Currently it’s lacking properties, signals and class vfuncs.
2018-07-19 20:05:19 +03:00
Alberts Muktupāvels
7a8f5ca970 gtkcssprovider: remove gtk_css_provider_get_default
This function is unused since cdc6e82720 commit and does not
contain fallback style.

https://gitlab.gnome.org/GNOME/gtk/issues/1226
2018-07-19 19:25:17 +03:00
Benjamin Otte
4063c3dc31 Merge branch 'content-deserializer-fixes' into 'master'
Content deserializer fixes

See merge request GNOME/gtk!252
2018-07-19 13:59:21 +00:00
Ernestas Kulik
96d0368290 gdk: contentdeserializer: Fix deserializer not returning
file_uri_deserializer does not return on success, only on failure. This
commit fixes clipboard reads never finishing for some types.
2018-07-19 15:55:58 +03:00
Ernestas Kulik
9a0ec5b1e0 gdk: contentdeserializer: Fix stream usage
file_uri_deserializer splices a memory stream, as opposed to
string_deserializer, which uses a converter and filter stream. This
commit fixes erroneous use of GMemoryOutputStream as
GFilterOutputStream.
2018-07-19 15:53:08 +03:00
Ernestas Kulik
7b5a0a829a gdk: Add auto cleanup func for GdkContentProvider 2018-07-19 11:28:21 +03:00
Matthias Clasen
1030d9e5b1 docs: Small updates to the migration guide
Mention that event controllers are available in 3.x, amongst others.
2018-07-18 20:22:18 -04:00
Matthias Clasen
0750b4fd28 Merge branch 'places-sidebar-dnd' into 'master'
placessidebar: Take a GdkDrag in _set_drop_targets_visible()

Closes #1220

See merge request GNOME/gtk!247
2018-07-18 00:23:08 +00:00
Günther Wutz
1d4ce5a544 widgetfactory: add separator tool item to presentation 2018-07-17 21:50:19 +02:00
Ernestas Kulik
4b2d63167e placessidebar: Take a GdkDrag in _set_drop_targets_visible()
Since the function is usually called from GtkWidget::drag-{begin,end} handlers,
taking a GdkDrop does not work, especially given that
::drag-action-requested is emitted without checking the type.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1220
2018-07-17 19:19:14 +03:00
Timm Bäder
6fe0a8c6b3 gesturestylus: Clarify a documentation comment
Use the proper gtkdoc syntax for signals.
2018-07-17 17:33:47 +02:00
Timm Bäder
04eb7eef29 Remove icon extents API 2018-07-17 17:33:47 +02:00
Timm Bäder
480a2c2770 widget: Remove another ->priv usage 2018-07-17 17:33:47 +02:00
Timm Bäder
f699fff6e0 sizerequest: Pull locals into closest scope 2018-07-17 17:33:47 +02:00
Timm Bäder
4bc145549d Correctly mark an enum value in a doc comment 2018-07-17 17:33:47 +02:00
Timm Bäder
cf7fa931d3 sizerequest: Only check reported baselines if requested
If the passed-in store locations for the baselines are NULL anyway, we
don't need to check the reported baselines for correctness.
2018-07-17 17:33:47 +02:00
Timm Bäder
392b4d9ac5 gl renderer: Pull a few declarations into the closest scope 2018-07-17 17:33:47 +02:00
Timm Bäder
3f126c7fc8 Remove GTK_CSS_AFFECTS_CLIP
Clips don't exist anymore and this flag is unused outside of the style
property definitions in gtkcssstylepropertyimpl.c
2018-07-17 17:33:47 +02:00
Timm Bäder
960717b273 window: Don't queue an allocate if the css clip changes
clips don't exist anymore.
2018-07-17 17:33:47 +02:00
Timm Bäder
5386cf89f2 GskRoundedRect: Typo 2018-07-17 17:33:47 +02:00
Timm Bäder
b7d948af69 gl renderer: Use a GArray for the shadow cache
It's very small usually, in default Adwaita the only blurred outset
shadow we have is the one for the CSD'd toplevel window.
2018-07-17 17:33:46 +02:00
Timm Bäder
446b2e25d3 Avoid a g_object_get path
We can use gdk_device_get_n_axes instead and will get the same result.
2018-07-17 17:33:46 +02:00
Timm Bäder
17b1e7bae9 docs: Fix scroll and motion controller titles
Controller, not Controler.
2018-07-17 17:33:46 +02:00
Emmanuele Bassi
9dc679370c Merge branch 'legacy-gl' into 'master'
fix the OpenGL renderer for legacy contexts

See merge request GNOME/gtk!240
2018-07-17 11:07:27 +00:00
Piotr Drąg
033cf4bfb7 Update POTFILES.in 2018-07-16 16:35:52 +02:00
Matthias Clasen
bf5f27c6d5 Handle configure events in gdk
The previous attempt at removing configure events entirely
was causing some dialogs not to show up under Wayland.
Presumably due to ordering issues with emitting ::size-change
out of the backend.

Instead, keep configure events in the event queue, but handle
them on the gdk side. This keeps the ordering intact, while
still removing configure events from the api. The dialogs
show up now.
2018-07-15 20:23:45 -04:00
Matthias Clasen
7a1073c3ae Revert "gdk: Drop configure events"
This reverts commit a8926c9d87.
2018-07-15 20:23:45 -04:00
Matthias Clasen
e2fd33f78a Revert "broadway: Stop using configure events"
This reverts commit 9c827cbff4.
2018-07-15 20:23:45 -04:00
Matthias Clasen
89f25d1484 Merge branch 'dnd-cleanups' into 'master'
Dnd cleanups

See merge request GNOME/gtk!243
2018-07-15 22:18:11 +00:00
Matthias Clasen
3c8b3cbf41 win32: Stop accessing GdkDrag members 2018-07-15 16:58:22 -04:00
Matthias Clasen
410d4bca83 wayland: Set actions on drag
We should pass the actions to the newly created
drag in drag_begin.
2018-07-15 16:52:16 -04:00
Matthias Clasen
168523264c x11: Set actions on drag
We should pass the actions to the newly created
drag object in drag_begin.
2018-07-15 16:50:06 -04:00
Matthias Clasen
435f143e2e x11: Rename a file
Keep in line with the parent class.
2018-07-15 16:47:17 -04:00
Matthias Clasen
98ccb67277 drop: stop accessing GdkDrag fields 2018-07-15 16:43:28 -04:00
Matthias Clasen
2d83bb1b91 x11: Stop using GdkDrag fields 2018-07-15 16:43:28 -04:00
Matthias Clasen
298b6ee81a wayland: Stop accessing GdkDrag members 2018-07-15 16:43:28 -04:00
Matthias Clasen
5ce3520a2a Add a GdkDrag::surface property 2018-07-15 16:43:28 -04:00
Matthias Clasen
9cc3e2c8ef gdkdrag: remove an unused member
The drag surface is stored in the subclasses and obtained
by via the get_drag_surface vfunc.
2018-07-15 16:42:07 -04:00
Matthias Clasen
034f89b17f wayland: Drop an unused api
Nothing was calling gdk_wayland_drag_set_source_surface.
2018-07-15 16:42:07 -04:00
Matthias Clasen
1ea09a327a Add a private struct to GdkDrag
This will force subclasses to use proper api.
2018-07-15 16:42:00 -04:00
Matthias Clasen
bc2f484ae9 Revert "GdkDrop: drop the priv struct"
This reverts commit d927c3bee0.

I was wrong. Better to hide the struct fields from subclasses.
2018-07-15 15:58:05 -04:00
Matthias Clasen
228f813c43 dnd: Drop gdk_drag_drop
This is an inconsistently used private api, and just adds
a vfunc indirection for no other benefit.
2018-07-15 15:58:05 -04:00
Matthias Clasen
17386b5cf7 Merge branch 'wip/matthiasc/kill-non-input-events' into 'master'
Wip/matthiasc/kill non input events

See merge request GNOME/gtk!242
2018-07-15 19:50:37 +00:00
Matthias Clasen
288086b899 Fix up some doc mishaps
When GdkWindow was renamed to GdkSurface, 'window managers'
turned into 'surface managers'. Thats not cool.
2018-07-15 15:36:19 -04:00
Matthias Clasen
d148f26658 Drop gdk_surface_withdraw
'withdrawn' is an X11-centric concept, and the function
can just as well be replaced by gdk_surface_hide.
2018-07-15 15:29:58 -04:00
Matthias Clasen
7ca6440f4d gdk: Drop map events
We are really inconsistent about generating these,
and they are not actually used in GTK+. Instead,
add a boolean GdkSurface::mapped property.
2018-07-15 15:10:56 -04:00
Matthias Clasen
1172810768 win32: Stop using expose and configure events
These no longer exist.
2018-07-15 14:07:40 -04:00
Matthias Clasen
9c827cbff4 broadway: Stop using configure events
These no longer exist.
2018-07-15 14:01:59 -04:00
Matthias Clasen
da3aaf39b9 gdk: Drop expose events
Replace expose events with a GdkSurface::expose signal.
This is part of the move to use events only for input.
2018-07-15 13:13:07 -04:00
Matthias Clasen
a8926c9d87 gdk: Drop configure events
Replace configure events with a GdkSurface::size-changed signal.
This is part of the move to use events only for input.
2018-07-15 11:51:09 -04:00
Matthias Clasen
443f8ddf6b popover: Drop some dead code
This will be done differently, using xdg-popup instead
of subsurfaces, so no point in keeping this.
2018-07-15 08:18:08 -04:00
Matthias Clasen
6a7de806dd text display: correct a comment 2018-07-14 13:50:14 -04:00
Elias Aebi
19873e549a gl: implement clipping for legacy contexts 2018-07-14 14:31:50 +02:00
Elias Aebi
05ca6bc189 gl: fix compilation errors for legacy context shaders 2018-07-14 14:24:21 +02:00
Benjamin Otte
cbb1e74bb5 textview: Only create cairo context in gtktextdisplay.c
Everything else is done using GtkSnapshot now, including renaming the
draw_layer vfunc to snapshot_layer.
2018-07-14 05:27:54 +02:00
Benjamin Otte
6afb6bb9d2 x11: Set BackPixmap = None unconditionally
Makes it more obvious what we actually want.

Related: #1134
2018-07-14 05:27:54 +02:00
Piotr Drąg
60afd056e0 Update POTFILES.in 2018-07-13 15:11:45 +02:00
Benjamin Otte
4456b06853 window: Update opaque region if background-color changes
The opaque region is only set when the background color is opaque. So
we need to do something about it when the background color changes.

However, in the case where a size allocation is going to happen, we
already do this update in size_allocate(), so in that case avoid doing
it twice.
2018-07-13 14:56:04 +02:00
Benjamin Otte
2f72353e0e gtk-demo: Update aspect-ratio when selecting new puzzle 2018-07-13 14:56:04 +02:00
Benjamin Otte
88af7b44aa textview: Use snapshot on the sidebars 2018-07-13 14:56:04 +02:00
Benjamin Otte
a7cd1918a8 widgetpaintable: Add a hack to make recursion not infloop
Makes the GUADEC talk not crash that I'm supposed to give in 20 minutes.
2018-07-13 14:56:04 +02:00
Benjamin Otte
bcfd1bbd24 widgetpaintable: Redo implementation
Instead of instantly invalidating, we now cache the old render node and
do the update in an idle handler.
While that gives us a 1 frame delay, it avoids all the tricky things
like queueing resizes while resizing or queueing draws while drawing.

The only remaining issue (and a *big* one at that) is that a nested
widget paintable will now cause the widget to snapshot its previous
render node when creating a new one. And that one will snapshot its
previous render node, and that one will...
And nothing so far breaks this recursion.
2018-07-13 14:56:04 +02:00
Benjamin Otte
1a5e60be7c paintable: Fix return_if_fail() statements
I always switch them up...
2018-07-13 14:56:04 +02:00
Benjamin Otte
3ce3867403 gl: Don't accidentally use ints for float variables
The int was floor()ing the x/y coordinates of glyphs, which could cause
significant repositioning of glyphs when text was scaled via the MVP.
2018-07-13 14:56:04 +02:00
Matthias Clasen
00a61f92b6 docs: Small updates
Remove a few references to no-longer-existing APIs.
2018-07-13 10:13:00 +02:00
Matthias Clasen
986daa8225 Merge branch 'dnd-cleanups' into 'master'
Dnd cleanups

See merge request GNOME/gtk!228
2018-07-13 07:45:57 +00:00
Matthias Clasen
e72ca43a32 Merge branch 'fix-wayland' into 'master'
GtkIMContextSimple: Fix Wayland build when X11 support is disabled

See merge request GNOME/gtk!234
2018-07-12 12:18:59 +00:00
Matthias Clasen
f432c937cc dnd: Drop gdk_drag_abort
This function is never called, so drop it, its vfunc,
and all the backend implementations.
2018-07-12 13:57:45 +02:00
Matthias Clasen
1dd15b5237 dnd: Some documentation updates
Don't mention dnd protocols, and do mention the new,
split objects.
2018-07-12 13:57:45 +02:00
Matthias Clasen
5cdbbc6e61 win32: Build fixes 2018-07-12 13:02:42 +02:00
Matthias Clasen
0e2ac0ebf2 wayland: Rename a source file
Rename gdkdnd-wayland.c to gdkdrag-wayland.c to go along
with gdkdrop-wayland.c.
2018-07-12 13:02:42 +02:00
Matthias Clasen
c73cb2c154 wayland: Drop an unused field
Nothing was using the foreign_dnd_surface anymore, so no
need to create it in the first place.
2018-07-12 13:02:42 +02:00
Matthias Clasen
a756caa106 dnd: Drop suggested_action
The only user of this field was the x11 backend, and it
turns out that it does not need to store the value at all.
2018-07-12 13:02:42 +02:00
Matthias Clasen
da22ba3b86 drag: Split a setter
In preparation for moving the suggested action
to the x11 backend, split the setter off.
2018-07-12 13:02:42 +02:00
Matthias Clasen
7a0a92f2b6 win32: Stop using gdk_drag_get_suggested_action
The suggested action is not set or used in the win32
information, so don't put it in logs either.
2018-07-12 13:02:42 +02:00
Matthias Clasen
d927c3bee0 GdkDrop: drop the priv struct
Its not needed.
2018-07-12 13:02:42 +02:00
Matthias Clasen
59c2efbcd6 Add a GdkDrag::actions property
To go along the GdkDrop::actions property.
2018-07-12 13:02:42 +02:00
Matthias Clasen
94af080fb6 Rename a property
Change GdkDrag::action to GdkDrag::selected-action, which is
more clearly different from actions, and follows the existing
name of the struct field and getter.
2018-07-12 13:02:42 +02:00
Matthias Clasen
40841ec3be GdkDrag: Drop the priv struct
We don't need it.
2018-07-12 13:02:42 +02:00
Matthias Clasen
f69bb2fb2b wayland: set a cursor when starting a drag
Otherwise, we wont have one.
2018-07-12 13:02:42 +02:00
Matthias Clasen
db0b9f61ae dnd: Add a GdkDrag::action property
This lets us drop the ::action-changed signal for the
property change notification. But, can just as well move
the signal class handers which just update the cursor
to the ::action setter. No need to do this in the backends.
2018-07-12 13:02:42 +02:00
Matthias Clasen
63ab523146 wayland: Remove an unused field
GdkDragWayland.suggested_action was entirely unused, so drop it.
2018-07-12 13:02:42 +02:00
Matthias Clasen
b94c3166bf dnd: Rename gtk_drag_begin_with_coordinates
Now that the coordiate-less variant is gone,
rename this back to the shorter gtk_drag_begin.
2018-07-12 13:02:42 +02:00
Daniel Boles
7030e08f9c Merge branch 'master' into 'master'
HighContrast: Restore expander size

Closes #1046

See merge request GNOME/gtk!167
2018-07-09 17:28:49 +00:00
Timm Bäder
2cc6a3ee5c widget factory: Use GtkPicture for background selection
Showing those background images as 16×16 icons doesn't look very nice.
2018-07-08 21:50:59 +02:00
Timm Bäder
3dd188fe7e gl renderer: Cache blurred outset shadow nodes
Since these are particularly expensive to render and we have a pretty
big one used in every client-side decorated window.
2018-07-08 21:50:59 +02:00
Timm Bäder
d41603d82a aboutdialog: Remove priv pointer 2018-07-08 21:50:59 +02:00
Timm Bäder
f7aff03c72 layout: Remove priv pointer 2018-07-08 21:50:59 +02:00
Timm Bäder
a0b8e32462 rendernodes: Fix unconditionally impossible diffs
Some of the _diff implementations did a whole bunch of work just to
throw it away afterwards and invalidate the entire union of the two
render nodes, most notably the two clip nodes. Fix this to only call
gsk_render_node_diff_impossible if the previous if-condition is FALSE
and not always.
2018-07-08 21:50:59 +02:00
Timm Bäder
50f76eb8cc GskRenderer: Add missing nullable annotation 2018-07-08 21:50:59 +02:00
Timm Bäder
9959ea98cd Revert "snapshot: merge container nodes"
This reverts commit 622a150bb4.
2018-07-08 21:50:59 +02:00
Emmanuel Gil Peyrot
8ca3ac1970 GtkIMContextSimple: Fix Wayland build when X11 support is disabled. 2018-07-08 20:11:01 +02:00
Balázs Meskó
27ba2411f0 Update Hungarian translation 2018-07-08 14:04:15 +00:00
Timm Bäder
a6920855ea Implement GtkInspectorLayoutOverlay
To properly replace the old "show layout borders" option.
2018-07-08 11:26:12 +02:00
Timm Bäder
c85e2401fa treeview: Fix column visibility check
This is still fallout from the bin_window removal. We aren't moving the
GdkWindow/GdkSurface anymore so we have to account for the scrolling
ourselves.
2018-07-08 10:32:12 +02:00
Timm Bäder
6fdcafc94a treeview: Move column header widgets when scrolling
Since those are widgets and widgets need to be size-allocate'd properly,
we need to queue an allocate, as well as actually add the hadjustment's
value to the column x position.

Fixes #1202
2018-07-08 10:04:27 +02:00
Timm Bäder
9bab218314 aspectframe: Remove priv pointer 2018-07-08 10:02:43 +02:00
Timm Bäder
2854635850 scalebutton: Remove priv pointer 2018-07-08 09:41:15 +02:00
Timm Bäder
a976aa9740 searchbar: Ignore key presses when unmapped
The purpose of a searchbar is to start a search on visible widgets when
a key is pressed. Starting a search on e.g. a stack page that is not
visible at all is not very useful.
2018-07-08 09:41:15 +02:00
Timm Bäder
074eb2a19d accellabel: Add newline between consecutive if statements 2018-07-08 09:41:15 +02:00
Timm Bäder
96812450fa listbox demo: Hide extra_buttons_box by default
It should only show up when hovering the row.
2018-07-08 09:41:15 +02:00
Timm Bäder
93c688cd93 range: Remove has_origin flag
It's equivalent to the highlight_widget being !NULL.
2018-07-08 09:41:15 +02:00
Timm Bäder
53afc4a9d9 dialog: Remove priv pointer 2018-07-08 09:41:15 +02:00
Timm Bäder
c96077590b dialog: Remove some GtkVBox references 2018-07-08 09:41:15 +02:00
Timm Bäder
6e47d0bf4a GtkSeparatorToolItem: Remove draw flag
We can as well query the current value of the flag using
gtk_style_context_has_class.
2018-07-08 09:41:15 +02:00
Timm Bäder
50b79ae0ab GtkSeparatorToolItem: Remove priv pointer 2018-07-08 09:41:15 +02:00
Timm Bäder
6b4709ea3c GtkApplication: Remove priv pointer 2018-07-08 09:41:15 +02:00
Timm Bäder
f3a83abb54 colorswatch: Remove priv pointer 2018-07-08 09:41:15 +02:00
Timm Bäder
33166b7357 render: Remove gtk_render_slider
The only thing it was doing is render background and frame, which you
get from using a widget for your slider anyway.
2018-07-08 09:41:15 +02:00
Timm Bäder
bb31ce1168 renderborder: Remove some unused API 2018-07-08 09:41:15 +02:00
Timm Bäder
dbf32933bf main: Don't look at first GTK_DISPLAY_DEBUG_CHECK parameter...
... if none of the debug displays have any debug flags set. This way, we
can ignore the first parameter to e.g. GTK_DISPLAY_NOTE, which is
usually a call to gtk_widget_get_display.

Before this patch, gtk_widget_get_display was the slowest part of
gtk_widget_query_size_for_orientation.
2018-07-08 09:41:15 +02:00
Timm Bäder
af8fe182c8 Fix a few documentation warnings 2018-07-08 09:41:15 +02:00
Timm Bäder
731f0d4d01 Merge branch 'gtk-picture-docs' into 'master'
docs: Add GtkPicture to types list

See merge request GNOME/gtk!233
2018-07-07 06:30:37 +00:00
Thomas Bechtold
e42373df89 docs: Add GtkPicture to types list
We want signals, arguments/parameters and position in the hierarchy to
be shown in the documentation for GtkPicture. So fix the types list.

See
https://developer.gnome.org/gtk-doc-manual/unstable/metafiles_types.html.en
2018-07-06 22:14:26 +02:00
Timm Bäder
da8050979e fixed: Remove child list
Use the child widget list from GtkWidget and attach x/y positions via a
qdata.
2018-07-05 19:08:19 +02:00
Timm Bäder
4dd1ff6dd2 GtkLayout: Remove freeze_count member
Unused.
2018-07-05 19:08:19 +02:00
Timm Bäder
8c403c43f0 spinbutton: Keep GParamSpecs around
notify_by_pspec is more efficient and this way the source file is more
in line with the others.
2018-07-05 19:08:19 +02:00
Emmanuele Bassi
2feb5c93ca ci: Update the image for the Flatpak jobs
The gnome-nightly-oci registry was moved to gitlab.gnome.org, so we
need to change the image we use when building Flatpak bundles in our
CI pipeline.
2018-07-04 18:32:59 +01:00
Emmanuele Bassi
9924a92e70 Merge branch '1140-gtk_printer_get_hard_margins_for_paper_size-is-not-external' into 'master'
Resolve "gtk_printer_get_hard_margins_for_paper_size() is not external"

Closes #1140

See merge request GNOME/gtk!229
2018-07-04 16:55:34 +00:00
Kjell Ahlstedt
6c8988e445 gtkprinter: Make gtk_printer_get_hard_margins_for_paper_size() public
The declaration in gtkprinter.h shall be preceded by GDK_AVAILABLE_IN_ALL,
or else the function can't be used in application programs.

Closes #1140
2018-07-04 18:40:33 +02:00
Benjamin Otte
9fb3b84253 rendernode: Make offset nodes use floats
It's OpenGL stuff, use floats.
2018-07-04 15:05:37 +02:00
Benjamin Otte
3439862634 gtkmediafile: Don't leak all the images
We were leaking the GBytes for the image memory, which is a
noticeable memleak to anyone who's casually running a memory monitor.

Go KDE users!

Closes #1200
2018-07-04 15:05:02 +02:00
Benjamin Otte
93c5455796 iconhelper: Plug memleak 2018-07-04 15:04:04 +02:00
Benjamin Otte
e665667bff mediafile: Check if media files are open when trying to play
If no file is open, refuse to play.
2018-07-04 06:15:33 +02:00
Benjamin Otte
3ca59b8701 css: Don't do indirections
We don't need to look up the property by name to query its ID when we
know the ID already because it's inside an enum.
2018-07-04 06:15:33 +02:00
Benjamin Otte
fba0b359d4 css: Report sizes as absolute
All PangoFontDescriptions that GTK creates now use
pango_font_description_set_absolute_size().
2018-07-04 06:15:33 +02:00
Benjamin Otte
e1b6496af7 image: size request is always CONSTANT_SIZE
It's always -gtk-icon-size in both directions, even for paintables.
There's no width-for-height happening.
2018-07-04 06:15:33 +02:00
Daniel Boles
14620423e8 themes: Restore default progressbar min sizes
The min size on the oriented axis used to come from style props with
default values in the source file, used if the theme did not provide a
min size in CSS. When the style props were removed, so was any notion of
a minimal size for proressbars' main axis, meaning that now progressbars
without expand or any other source of min size were just tiny specks.

The right place to do that was always the theme, so in our themes now,
fix that by copying the old default values for the style properties; see:

https://gitlab.gnome.org/GNOME/gtk/issues/1191#note_259393
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-24/gtk/gtkprogressbar.c#L92

The result should be the same in that (A) the min size is now what it is
in GTK+ 3 & (B) an app/user can override the theme exactly the same way.

Close https://gitlab.gnome.org/GNOME/gtk/issues/1192
2018-07-03 18:55:31 +01:00
Daniel Boles
55a1f8ccfd HC: merge dupe selectors; linebreaks for legibility 2018-07-03 18:55:17 +01:00
Timm Bäder
19afe454df Merge branch 'gdk4-dnd-docs' into 'master'
docs: Add new DnD types

See merge request GNOME/gtk!227
2018-07-03 17:28:44 +00:00
Piotr Drąg
7d842cb7fc Update POTFILES.in 2018-07-03 17:11:00 +02:00
Ernestas Kulik
3137d326c5 docs: Add new DnD types
7733f646d6 renamed GdkDragContext to
GdkDrag, which broke the docs, as a reference to
gdk_drag_context_get_type() still exists. This commit renames the type
accordingly and adds GdkDrop.
2018-07-03 12:32:41 +03:00
Matthias Clasen
12464731f1 Merge branch 'dnd-cleanups' into 'master'
Dnd cleanups

See merge request GNOME/gtk!226
2018-07-02 21:19:45 +00:00
Daniel Boles
269a9d8528 Adwaita: Drop some unneeded overrides
The pseudoclasses work fine on the subnodes without having to also apply
`parent:class subnode`.
2018-07-02 22:04:35 +01:00
Daniel Boles
c892d2767a Adwaita: Regenerate CSS for text handle overhaul
Commit b3e91b7111 forgot this.
2018-07-02 22:04:35 +01:00
Matthias Clasen
c8e082f296 win32: Adapt to dnd api changes
Follow the GdkDragContext -> GdkDrag change.
2018-07-02 22:52:59 +02:00
Daniel Boles
51981d562b ScrolledWindow: a couple of spelling/grammar fixes
(A) Put a space in "scrolled window" like the other doc comments
(B) Say "i.e." rather than "ie."
(C) Fix grammar from "makes [...] exactly reaches" to "exactly reach"
2018-07-02 20:14:41 +01:00
Daniel Boles
51b77a425a ScrolledWindow: Fix/improve doc of key bindings
Saying 'key + modifiers' is really weird, so reverse that, and explain
why there are 2 cited and what the difference between them is.
2018-07-02 20:14:41 +01:00
Daniel Boles
ae3163b5e0 ScrolledWindow: Add missing apostrophes 2018-07-02 20:14:41 +01:00
Matthias Clasen
af93646b3e Merge branch 'event-controller-key-docs' into 'master'
eventcontrollerkey: Document key-pressed and key-released

See merge request GNOME/gtk!225
2018-07-02 17:16:04 +00:00
Matthias Clasen
64f5afe608 dnd: Rename headers
Rename gdkdnd.h to gdkdrag.h, to go along with gdkdrop.h

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 15:00:50 +02:00
Matthias Clasen
fb98f939a5 docs: Update dnd section
Add the separate drag and drop apis.
2018-07-02 15:00:50 +02:00
Matthias Clasen
7733f646d6 gdk: Rename GdkDragContext to GdkDrag
This is to go along with the newly introduced GdkDrop.

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 14:59:26 +02:00
Ernestas Kulik
fd69f1cd79 eventcontrollerkey: Document key-pressed and key-released
None of the GtkEventControllerKey signals are documented; this commit
adds documentation for a couple of them.
2018-07-02 12:18:26 +03:00
Daniel Boles
ca94ff10ce testsuite/gtk/defaultvalue: Actually build...& fix
It looks like this got dropped during the move from autotools and never
restored. I can see why, since making it work wasn't a hugely fun task!

Notes on some less then obvious details:
 * PlacesSidebar is private now and didn't seem to be to be particularly
   easy to adapt to, so this moves to checking for it by name, not TYPE.
   I couldn't find a (fast) better way; if you know how, please clean up
 * added 2 casts to avoid warnings from the new type-propagating ref()
 * GdkClipboard and GdkContentProvider need some properties dodged
 * GtkToolItemGroup is gone
 * fixed indentation and used TypeName:property-name syntax in a print()
2018-06-29 20:05:21 +01:00
Matthias Clasen
9c3de51412 Merge branch 'wip/cursor-output-scale-changes' into 'master'
wayland: Update cursor surface scale when output scale changes

See merge request GNOME/gtk!224
2018-06-29 15:08:17 +00:00
Matthias Clasen
d9dcfffce3 Merge branch 'wip/aplazas/modelbutton-markup-master' into 'master'
ModelButton: Add 'use-markup' property

See merge request GNOME/gtk!222
2018-06-29 14:21:24 +00:00
Jonas Ådahl
dfd1372a9b wayland: Update cursor surface scale when output scale changes
Also update the cursor surfaces of every seat when an output changes
scale. This could for example happen when a monitor scale is changed via
Settings.
2018-06-28 12:44:22 +02:00
Benjamin Otte
f3c670ab0c widget: Move opactiy == 0 check
If we check it too early, we will not unset priv->draw_neeeded, which
will then cause queue_draw() calls to not have an effect later. And that
causes changes in opacity to not register.

Closes #1180
2018-06-27 21:50:07 +02:00
Daniel Boles
8aa4b5150e notify test: Remove more nonexistent properties 2018-06-27 17:17:05 +01:00
Timm Bäder
ecaa16c367 notify test: Remove some non-existant properties 2018-06-27 18:03:23 +02:00
Timm Bäder
2f8284a386 testsuite: Remove a GtkColorButton special case
The comment above explains neatly why subclassing GtkButton for
GtkColorButton was a bad idea. Nowadays it's a GtkWidget subclass
containing a GtkButton so let's remove the special case here.
2018-06-27 18:03:23 +02:00
Timm Bäder
73cad1e784 Remove some GtkRecentChooserMenu references
Doesn't exist anymore.
2018-06-27 18:03:23 +02:00
Adrien Plazas
0abd01e288 ModelButton: Add 'use-markup' property
Binds this property to the button's label, allowing a model button to
have text with markup.

This will be convenient for buttons like 'Online Accounts <sup>↗</sup>'.
2018-06-27 17:43:47 +02:00
Rico Tzschichholz
b80942ec88 gdk: Fix some g-i annotations warnings 2018-06-27 09:00:17 +02:00
Timm Bäder
165dab8265 gl renderer: Ignore 0-sized fallback nodes 2018-06-26 21:41:29 +02:00
Emmanuele Bassi
73d736d800 Do not modify a const GdkEvent in place
When deciding whether or not to emulate a press event, we're translating
the last event coordinates and mutating the given event structure
unconditionally.

We should modify the newly created GdkEvent copy, since it's what we're
going to use when emitting the press event.

This avoids mutating a constant GdkEvent and global state, and also
avoids a compiler warning.
2018-06-26 18:06:23 +01:00
Matthias Clasen
88b4076fe5 Docs: Remove more since markers
The idea is that GTK+ 4 will be an epoch, API-wise.
Everything that was around for 4.0 has been there
since the beginning of the epoch and doesn't need
markers.
2018-06-26 12:31:41 -04:00
Matthias Clasen
36396093e6 docs: Document GtkEventControllerKey
The long description was missing.
2018-06-26 12:20:47 -04:00
Matthias Clasen
faba0f0145 Bump version to 3.94.0 2018-06-25 19:55:04 -04:00
Matthias Clasen
8755d884f3 Remove a lot of Since annotations
4.0 will represent a clean epoch. We don't want to have
lots of noise in the docs about 2.x or 3.x.
2018-06-25 19:55:04 -04:00
Matthias Clasen
010f4e90e3 Some updates 2018-06-25 19:06:34 -04:00
Benjamin Otte
0c76264953 reftests: Fix compilation
FOREIGN surfaces are gone.
2018-06-26 00:53:39 +02:00
Benjamin Otte
d13843ee2a gdk: Remove GDK_SURFACE_FOREIGN
We don't create surfaces of that type anymore.
2018-06-26 00:47:40 +02:00
Michael Catanzaro
7869ffbb49 imwayland: Fix a small leak
If the parent get_preedit_string implementation returns a nonnull
zero-length string, then we ignore it, which is almost fine. We have to
free it, though.

Fixes #1174
2018-06-25 22:20:09 +01:00
Matthias Clasen
2f149c378a Merge branch 'master' into 'master'
gtk: also recolor circle and ellipse in symbolic SVG icons.

See merge request GNOME/gtk!214
2018-06-23 19:42:26 +00:00
Jehan
04367acf9b gtk: also recolor circle and ellipse in symbolic SVG icons. 2018-06-23 00:35:17 +02:00
Timm Bäder
1a2052a40e button: Remove unused variable 2018-06-21 20:57:18 +02:00
Timm Bäder
e079fad1d5 scrolledwindow: Avoid a queue_resize path in size-allocate 2018-06-21 20:54:47 +02:00
Samuel Thibault
bada3dbac6 HighContrast: Restore expander size
Expanders used to be 16px high. With the move from the gtk2 rendering
to gtk3 rendering they shrunk to 12px, making them hard to see, because
it's now the icon which is 16px high and the icon contains transparent
borders.

This makes the HighContrast theme use 24px icons instead, to restore
16px expanders. This may expander some containers a bit.

Closes #1046
2018-06-21 16:15:35 +02:00
Daniel Boles
9178423844 TreeView: Get expander size from CSS min-width|height
Rather than hard-coding this, get it from CSS. That way, themes will be
able to set larger expanders than a fixed 16 px, e.g. for accessibility.

See https://gitlab.gnome.org/GNOME/gtk/merge_requests/167
2018-06-21 15:49:00 +02:00
Carlos Garnacho
9df5171962 gtktreeviewcolumn: Implement column dragging through GtkGestureDrag
And remove ::event signal handler.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
b3e91b7111 gtktexthandle: Update to gtk4 rendering/input
GtkTextHandle was neglected by whoever removed the ::draw signal,
leaving it entirely broken. Update to using GtkGizmo so we can
implement snapshot of text handles.

Input has received a revamp too, handling is done through a
GtkGestureDrag and coordinate calculations simplified by storing
the delta to the hotspot on ::begin instead of ::update, as this
value is constant throughout the gesture. Widget state management
on crossing events happens implicitly, so no longer needs to be
done here.

Last but not least, CSS has also been updated so handles are
rendered at the correct size and proportion, and with the padding
that code expects of it.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
ffd89d29df gtkwindow: Queue popover resize on set_popover_position()
So the new position is eventually honored. Fixes magnifier and handles
staying in place after being shown.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
686116ba61 gtkfilechooserwidget: Forward events to filechooser through key controller
Instead of manually calling gtk_binding_set_activate_event() on an ::event
callback in the save entry.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
7fa3183d7f gtkfilechoooserentry: Handle tab completion through key controller 2018-06-21 12:54:03 +02:00
Carlos Garnacho
176fd2fab3 gtkemojicompletion: Use GtkEntry key controller to handle key presses 2018-06-21 12:54:03 +02:00
Carlos Garnacho
419ee6a451 gtkentrycompletion: Properly remove controller from entry
When disconnecting the GtkEntry from the GtkEntryCompletion, we
must remove the controller in order to avoid dangling callbacks.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
2c0d2d332f gtkentrycompletion: Move focus out handling to key controller
We can use the already present key controller to handle focus out.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
5f8fea08ff gtkentrycompletion: Perform event handling on popup through controllers
Instead of a ::event signal handler.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
f92ec7ce41 gtkplacessidebar: Replace ::event signal handlers with gestures
Set up a gesture on the sidebar rows to detect pointer clicks on
it. The row DnD management has been moved to the row widget itself,
it makes more sense even if the drag is began from the sidebar widget.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
ca08cf94d3 gtkwindow: Move map/delete/configure event management to gtkmain
Toplevels are about the only widgets interested in these events,
just handle those without going through the capture/bubble handling
code.
2018-06-21 12:54:03 +02:00
Carlos Garnacho
3d5dc16d63 gtkwindow: Simplify WM drag/resize handling
We still need a drag gesture both on front (capture) and back (bubble)
to handle dragging from both the GtkWindow widget and chrome in the
headerbar. But we can do it through 2 drag gestures, instead of special
event handling code.
2018-06-21 12:52:59 +02:00
Carlos Garnacho
7bfc3a5c74 gtkmenushell: Port to GtkGesture
We still need to poke the current event at places, but this is
better than the ::event vfunc.
2018-06-21 12:50:58 +02:00
Carlos Garnacho
a5414bc404 gtkpopover: Fix key navigation
This has been broken since we switched key event delivery to follow
the same semantics than pointer/touch. There, GTK+ grabs will influence
the topmost widget during event delivery, rendering the toplevel
unable to handle key navigation. The toplevel must handle those key
events in an explicit manner then.

We don't render the keyboard focus rectangle yet, but I assume that's
something else.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
1d97b5fd3c gtkpopover: Port to GtkEventController/GtkGesture
Use GtkEventControllerKey and GtkGestureMultiPress to replace key/button
event handling.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
aa09b0742e gtkwindow: Handle focus in/out through key controller
One less use of ::event in this widget, now mostly left to
map/delete/configure, those puny events.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
c5586f85fb gtkspinbutton: Use GtkEventControllerKey
And drop the ::event vfunc implementation with it.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
3eb1b22651 gtkfontchooser: Use GtkEventControllerKey
Use an event controller on GtkFontChooserDialog, a nice side effect
is that we can use gtk_event_controller_key_forward() and
gtk_search_entry_set_key_capture_widget() instead of passing events
around for dialog search.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
4186a85359 gtkfilechooserwidget: Drop usage of ::event vmethod
Use a key controller set up in the UI file instead.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
aaf1e4995c gtkfilechooserentry: Use GtkEntry key controller for focus-out handling
Expose the GtkEntry key controller in private API, so we don't have to
create yet another one just to handle focus-out.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
e08e15ba51 gtkentry: Use gestures for entry icons
Instead of doing all handling manually in the ::event vfunc,
set up drag/multipress gestures on icon images, and implement
emission of ::icon-press/release and DnD there.

As a side effect, the GdkEvent field in ::icon-press/release
signals has been dropped. Callers that might be interested on it
may still use gtk_get_current_event*().
2018-06-21 12:50:57 +02:00
Carlos Garnacho
7048362e6e gtkbutton: remove keyboard device GTK+ grab
This isn't really necessary, if keyboard focus forcibly goes somewhere
else we will get ::grab-notify, which is sufficient to deactivate the
button again.
2018-06-21 12:50:57 +02:00
Carlos Garnacho
5f0ed088e4 gtkbutton: Use key controller for button (de)activation through keybindings
And stop using GtkWidget::event for good.
2018-06-21 12:50:57 +02:00
Matthias Clasen
5c46c81067 x11: Fix dnd action handling
We were mistakenly assigning an Atom to a flags value.
2018-06-20 18:10:50 -04:00
Daniel Boles
c6fa3c446c EmojiCompletion: Avoid another un/signed warning
The cherry-pick missed this, I guess.
2018-06-20 20:51:50 +01:00
Daniel Boles
f7ebff6aea EmojiCompletion: Avoid un/signed compare warnings
(A) Use gsize to match the result of g_variant_n_children
(B) Use guint for n_matches, like the struct (and all other n_matches)
2018-06-20 20:38:27 +01:00
Daniel Boles
8aeced2c91 themes: Remove leftover bit of .linked workaround
Now that .linked acts like the .path-bar already did, there is no point
in applying the same styles again (with higher specificity).
2018-06-20 20:11:26 +01:00
Timm Bäder
e8fefd92c5 container: Remove SPECIAL_CONTAINER hack
As discussed in !129

Closes !129
2018-06-20 20:47:18 +02:00
Timm Bäder
22390adf11 stackswitcher: Remove icon-size property
This ought to be controlled via css these days.
2018-06-20 20:47:18 +02:00
Timm Bäder
cf9121977f infobar: Remove priv pointer 2018-06-20 20:47:18 +02:00
Timm Bäder
99099a1053 Remove some unnecessary snapshot implementations 2018-06-20 20:47:18 +02:00
Timm Bäder
daba1a7eff fixed: Remove priv pointer 2018-06-20 20:47:17 +02:00
Timm Bäder
f26359db13 listbox: Use widget insert API instead of fiddling with CSS nodes 2018-06-20 20:47:17 +02:00
Timm Bäder
945b844b7c button: Remove ICON_SIZE_BUTTON mention in docs
The icon will have the size given by css, not whatever
GTK_ICON_SIZE_BUTTON was.
2018-06-20 20:47:17 +02:00
Timm Bäder
f33655fa4e adjustment: Only emit ::changed from dispatch_properties_changed 2018-06-20 20:47:17 +02:00
Timm Bäder
ee8ee313c8 adjustment: Remove adjustment_changed_stamp 2018-06-20 20:47:17 +02:00
Timm Bäder
33e113d607 testsuite: Print tested property name in notify test 2018-06-20 20:47:17 +02:00
Timm Bäder
a12d26155f adjustment: Use public setters in set_property 2018-06-20 20:47:17 +02:00
Daniel Boles
cae382c829 themes: Regenerate CSS for recent commits
e.g. the box.linked one, which didn't update the compiled CSS.
2018-06-20 19:26:46 +01:00
Daniel Boles
0a5086d94f HC: Avoid excessive selectors from prev commit
The new rule does not need to affect all those other pseudoclasses. I
just put it in the wrong scope.
2018-06-20 19:26:41 +01:00
Daniel Boles
b103650cb0 HC: Avoid same BG/FG colors in flat treeview entry
Selected rows in tree views in HighContrast have a background colour the
same or nearly as the normal text colour, so we cannot let entries in
such rows have transparent backgrounds, or the text inside the entry
becomes nearly or totally impossible to see.

Dodge this by giving entry.flat inside treeview and with :focus the
$base_color, which is different from the text & so lets that be seen.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/125
2018-06-20 19:13:26 +01:00
Daniel Boles
337e602143 searchenginetracker: Don't leak the hits' GFiles
https://gitlab.gnome.org/GNOME/gtk/merge_requests/206
2018-06-20 17:20:31 +01:00
Matthias Clasen
7ce25293b1 Merge branch 'issue1084' into 'master'
application: Complete the startup sequence before quitting remote instances

Closes #979

See merge request GNOME/gtk!156
2018-06-20 15:34:51 +00:00
Matthias Clasen
cd99f82e0c Merge branch 'master' into 'issue1084'
# Conflicts:
#   gdk/gdk.c
2018-06-20 14:21:24 +00:00
Timm Bäder
29fee2e808 window: Remove priv pointer 2018-06-20 07:49:04 +02:00
Timm Bäder
417b1d8335 pathbar: Remove unused define 2018-06-20 07:48:54 +02:00
Matthias Clasen
443a64a38e docs: Remove a duplicate line in gdk4-sections.txt
This was causing another docs build break.
2018-06-19 17:16:31 -04:00
Matthias Clasen
74455ae75c docs: fix a typo
Invalid syntax in gdk4-sections.txt was causing docs builds to fail.
2018-06-19 17:16:31 -04:00
Daniel Boles
ec096b417c Merge branch '1160-crash-clearing-gtkentry-icon-tooltip-master' into 'master'
Resolve "Crash clearing GtkEntry icon tooltip"

Closes #1160

See merge request GNOME/gtk!205
2018-06-19 20:22:38 +00:00
Benjamin Otte
06bba15f62 win32: Fix typo
This should fix gtk-doc erroring out.
2018-06-19 21:45:44 +02:00
Benjamin Otte
c48be6ef96 Revert "Add aligned allocator functions to GSK"
This reverts commit 8e74eb382f.

This code is not necessary. It worked around a bug in graphene where
graphene was requiring stricter alignment than glib allocators could
guarantee.
2018-06-19 20:00:53 +02:00
Benjamin Otte
0b1f0984f5 Revert "Use aligned allocators for GtkSnapshot"
This reverts commit c02bc22cc5.

This code is not necessary.
The bug causing this problem ws prsent in the graphene library.
2018-06-19 19:52:52 +02:00
Benjamin Otte
6918fb2e4e rendernodepaintable: Fix rendering position
When the given size had an offset, we were moving that offset in the
wrong direction.
2018-06-19 19:44:17 +02:00
Benjamin Otte
3caf8c86c9 dnd: Use a GtkPicture in gtk_dnd_set_icon_paintable()
We don't want to get the paintable scaled down to icon size.

Also set can-shrink = FALSE to replicate GTK3 behavior with size
requests.
2018-06-19 19:44:17 +02:00
Benjamin Otte
8c8dc3aeab snapshot: Compute correct size in gtk_snapshot_to_paintable()
Also, do actually respect the passed in size argument if it isn't NULL.

Fixes text being cut off inside DND icons.
2018-06-19 19:44:17 +02:00
Benjamin Otte
4d4ec2dbfb dnd: gdk_drag_action_is_unique() should return a boolean 2018-06-19 19:44:17 +02:00
Daniel Boles
4f979469f1 a11y/entry: Fix copy-pasteo re 2ndary icon tooltip
The else case was wrongly resetting the accessible description on the
primary icon, which might not exist and can therefore cause a crash.

https://gitlab.gnome.org/GNOME/gtk/issues/1160
2018-06-19 18:37:25 +01:00
Matthias Clasen
87532f0ac3 Merge branch 'wip/carlosg/issue-1159' into 'master'
Fix issue 1159

Closes #1159

See merge request GNOME/gtk!202
2018-06-19 16:40:39 +00:00
Piotr Drąg
0ace7ad219 Update POTFILES.in 2018-06-19 17:52:13 +02:00
myfreeweb
a1bcbdd02a wayland: Use shm_open(SHM_ANON) on FreeBSD
This functionality is similar to Linux's memfd. It creates anonymous shared memory without touching the filesystem, which allows it to work in Capsicum capability mode (sandbox).
2018-06-19 11:45:49 -04:00
Carlos Garnacho
8e3bf65b3b gtkgesture: Check claimed status after event delivery
The claimed status check should happen after ::end is emitted,
as the gesture may deny the sequence that much late. In this
case the event should keep propagating.

https://gitlab.gnome.org/GNOME/gtk/issues/1159

Closes: #1159
2018-06-19 13:47:38 +02:00
Carlos Garnacho
de30a74cdf gtkwidget: Avoid doubly coordinate conversion when emulating press
We are poking again into the event propagation machinery, which
expects events in toplevel coordinates. Since we can't fetch the
original event back at this point, translate the coordinates
back to the toplevel so the emulated press ends up in the right
place.

https://gitlab.gnome.org/GNOME/gtk/issues/1159

Closes: #1159
2018-06-19 13:47:26 +02:00
Benjamin Otte
cbbb7604b6 x11: Set background as transparent as possible
Instead of making the background black, make it transparent black for
RGBA visuals and set a None background otherwise.
2018-06-18 23:49:53 +02:00
Benjamin Otte
9a91d3739d widget: Remove time argument from drag_data_get() vfunc 2018-06-18 23:49:53 +02:00
Benjamin Otte
a2839d157f dnd: Remove unused time arguments 2018-06-18 23:49:53 +02:00
Benjamin Otte
b3d424c2d7 dnd: Remove GdkDragContext.dest_surface
The variable is now unused
2018-06-18 23:49:53 +02:00
Руслан Ижбулатов
bf3ea24489 GDK W32: Remove gdk_win32_surface_foreign_new_for_display
That function is now unused.
2018-06-18 23:49:53 +02:00
Руслан Ижбулатов
997e8c1ae1 GDK W32: Adapt to dest_surface removal, misc changes
* There's no GdkDragContext->dest_surface anymore.
  Add dest_window field to GdkWin32DragContext,
  and use that instead.
* Remove unused function prototypes
* Add more comments
* Rename variables and fields from 'window' to 'surface'
  where appropriate
* Fix header indentation a bit
* Try to ensure that uninitialized/unknown handle variables
  and fields are set to INVALID_HANDLE_VALUE instead of NULL,
  as there may be cases where NULL is a valid handle value.
2018-06-18 23:49:53 +02:00
Benjamin Otte
aa1f0cfd4f dnd: Remove GdkDragContext.is_source
All drag contexts are sources these days, the other ones are GdkDrop
now.
2018-06-18 23:49:53 +02:00
Benjamin Otte
45a6146ca6 x11: Remove gdk_x11_surface_foreign_new_for_display()
People who want to use foreign windows should use X directly.
2018-06-18 23:49:53 +02:00
Benjamin Otte
bc63001deb x11: Store the XID instead of a GdkSurface
This might be foreign Windows and we don't want to create surfaces for
those.

Also, stop using GdkDragContext.dest_surface, that variable is meant to
go away.
2018-06-18 23:49:53 +02:00
Benjamin Otte
47b47f5835 x11: Simplify test
Now that we have gdk_drag_context_get_display(), use it.
2018-06-18 23:49:52 +02:00
Benjamin Otte
1b2dccd143 x11: xdnd_send_event() always returns TRUE
Make it return nothing instead and delete the code that handled the
FALSE case.
2018-06-18 23:49:52 +02:00
Benjamin Otte
7e09aa3caa x11: Don't multiply X values by the scale factor
This is fallout from a too eager change in
bdb442be21.
2018-06-18 23:49:52 +02:00
Benjamin Otte
6633d4130a dnd: Make the base Drag/Drop types abstract
This way, they'll be ignored by the testsuite.

And we don't want to instantiate them anyway, the backends have
their own subclasses.
2018-06-18 23:49:52 +02:00
Benjamin Otte
a960641ace dnd: GdkDragContext is no longer a GdkDrop subclass
This includes a bunch of header cleanup
2018-06-18 23:49:52 +02:00
Benjamin Otte
f982c9c8f8 dnd: Remove gdk_drag_status() and gdk_drag_finish()
Those functions are unused and have been replaced by their equivalents
gdk_drop_status() and gdk_drop_finish().
2018-06-18 23:49:52 +02:00
Benjamin Otte
a1cee7fa65 surface: Kill event masks
In particular, this patch removes:
  gdk_surface_get_events()
  gdk_surface_set_events()
  gdk_surface_get_device_events()
  gdk_surface_set_device_events()

Event masks so far still exist for grabs.
2018-06-18 23:49:52 +02:00
Benjamin Otte
d0ebdf00f8 x11: Store the source surface as an XID
Don't create a foreign GDK surface, just store the XID.

With this, we can avoid GDK APIs that we want to get rid of and just
use the X counterpart.
2018-06-18 23:49:52 +02:00
Benjamin Otte
dd30a288f2 x11: Split drag and drop contexts
While doing so, turn the drop context into a GdkDrop subclass and no
longer pretend to be a GdkDragContext.
2018-06-18 23:49:52 +02:00
Benjamin Otte
005781021e x11: Handle events on drag side differently
Instead of using the filters that the drop side uses, handle events in
the event filter installed by the DragContext.
2018-06-18 23:49:52 +02:00
Benjamin Otte
14f0a25531 x11: Change the way local Drop => Drag is shortcut
This is one step further towards untangling drag and drop parts of X11
DND.
2018-06-18 23:49:52 +02:00
Benjamin Otte
8db379d85b x11: Remove unused argument
The propagate argument is always FALSE, so just use FALSE everywhere.
2018-06-18 23:49:52 +02:00
Benjamin Otte
6b65aaab21 x11: switch a bunch of variable types
GdkDragContext => GdkDrop

This is all in preparation of separation of the drag and drop.

Also, don't check for GDK_DRAG_PROTO_XDND anymore - it's the only
possible value for the protocol on the target side.
2018-06-18 23:49:52 +02:00
Benjamin Otte
905765eed6 broadway: Remove unused variable 2018-06-18 23:49:52 +02:00
Benjamin Otte
e1206763a8 dnd: Remove gdk_drag_context_get_dest_surface()
... and gdk_drag_context_get_source_surface().

In the backends, use direct access to the variables instead.
2018-06-18 23:49:52 +02:00
Benjamin Otte
8a08a325be dnd: Implement gtk_drag_get_source_widget() differently
Instead of keeping a list of source contexts, just use the current
drag's info.
2018-06-18 23:49:52 +02:00
Benjamin Otte
5e159e2ca0 x11: Replace the hardcoded DND filter
Use the new method of connecting to the xevent signal instead.

Also, don't consume the xevent, there might be other code listening for
it. And we don't use PropertyNotify in the generic code path anymore, so
it'll just be ignored there.
2018-06-18 23:49:52 +02:00
Руслан Ижбулатов
392071b66d GDK W32: Remove unused files 2018-06-18 23:49:52 +02:00
Руслан Ижбулатов
8ee4de804c GDK W32: Adapt to GdkDrop and GdkDragContext changes
* Remove clipdrop->dnd_target_state, it's not used anymore
* Remove non-functioning _gdk_dropfiles_store(), store dropfiles
  list in GdkWin32Drop instead
* Fix multiple comment typos
* Fix _gdk_win32_get_clipboard_format_name_as_interned_mimetype() to
  leave names that look like mime/types alone
* Refactor _gdk_win32_add_w32format_to_pairs() to populate
  GdkContentFormatsBuilder directly, instead of making a GList
* Rename context -> drag (still using GdkDragContext type,
  but [almost?] all variables and comments say "drag" now)
* Rename GdkDropContext -> GdkDrop
* Rename some parameter names for clarity
* Rewrite local protocol to look more like OLE2 protocol
  instead of mirroring the structure of the X11 API.
* Add handle_events field to GdkWin32DragContext,
  to shut off event handling (temporary fix until GTK is patched up)
* Remove _gdk_win32_drag_context_find() - the drag object is stored
  in GdkDrop instead. Use _gdk_win32_find_drag_for_dest_surface()
  to get it initially.
* Remove target_ctx_for_window, droptarget context is stored
  in the surface instead.
* Call gdk_drag_context_set_cursor() just like wayland backend does
  (slightly broken for now)
* Clean up the action choosing code (filter source actions by using
  keyboard state, pass that to GTK, get all actions supported by GTK in
  response, match them up with filtered source actions, return the
  result, falling back to COPY in case of multiple actions)
* Check drag_win32->protocol instead of the use_ole2_dnd variable where
  possible
* Remove protocol checks from functions that are only used by the local
  protocol
* Use event state to manufacture the keyboard state for WM_MOUSEMOVE
* Change function names printed by GDK_NOTE to name the actual
  functions, not their theoretical generic GDK stack ancestors
* Consistently use drag_win32 and drop_win32 variables instead of a mix
  of that and win32_drag/win32_drop
* Return FALSE from button handler to ensure that GTK gets the button
  event to break implicit grab
* Emit leave event on failed idroptarget_drop() calls
2018-06-18 23:49:52 +02:00
Benjamin Otte
dcf432d7d0 dnd: Add read_value() and read_text() functions to GdkDrop
These just copy what GdkClipboard does.
2018-06-18 23:49:52 +02:00
Benjamin Otte
ea9d6f0a95 drop: Implement shortcut for local DND
Now that we have the drop->drag, we can use the same shortcut we use in
the clipboard code to shortcut DND operations.
2018-06-18 23:49:52 +02:00
Benjamin Otte
018a17fb8e x11: Pass the drag source when creating a drop context 2018-06-18 23:49:52 +02:00
Benjamin Otte
895f381fd5 x11: Find dest drops differently
Instead of looking at the list of contexts, just look at the current
drop context. There is only one, after all.

Then remove the is_source argument from gdk_drag_context_find().
2018-06-18 23:49:52 +02:00
Benjamin Otte
66bd54d14c wayland: Store the current drag operation
Use it to detect local drags when creating drop objects.
2018-06-18 23:49:52 +02:00
Benjamin Otte
ff38d38444 dnd: Move GdkDragAction to gdktypes.h
That way, both gdkdrag.h and gdkdrop.h can use it without one having to
include the other.
2018-06-18 23:49:52 +02:00
Benjamin Otte
af749532fc gdk: Remove leftover type from autocleanup 2018-06-18 23:49:52 +02:00
Benjamin Otte
7afa0badd8 wayland: Get rid of GdkWaylandSelection
Move data source handling into the DND code instead.
2018-06-18 23:49:52 +02:00
Benjamin Otte
4eb3a9faaa wayland: Split drop context into GdkWaylandDrop
GdkWaylandDrop no longer inherits from GdkDragContext now.
2018-06-18 23:49:52 +02:00
Benjamin Otte
81e1dc9a66 wayland: Remove a bunch of unused functions 2018-06-18 23:49:52 +02:00
Benjamin Otte
c67fb57881 events: Make GdkEventDND have a GdkDrop member
... instead of a GdkDragContext.
2018-06-18 23:49:52 +02:00
Benjamin Otte
81171cc0a2 x11: Refactor DND filter
The filters now return TRUE/FALSE and no longer a GdkFilterReturn. They
also don't conform to the GdkFilterFunc typedef anymore but instead take
the arguments that they need.
2018-06-18 23:49:52 +02:00
Benjamin Otte
aa4e4dd0c7 x11: Use new DND event emitters 2018-06-18 23:49:52 +02:00
Benjamin Otte
7a9afc3a95 win32: Use new DND event emitters 2018-06-18 23:49:52 +02:00
Benjamin Otte
114ab8775a wayland: Use new DND event emitters 2018-06-18 23:49:52 +02:00
Benjamin Otte
657ebd2a78 drop: Add private API for event emission 2018-06-18 23:49:52 +02:00
Benjamin Otte
05bf87cf14 drop: Add GdkDrop:surface property
This replaces gdk_drag_context_get_dest_surface().
2018-06-18 23:49:52 +02:00
Benjamin Otte
4aedf3d003 display: Don't wake up the main loop anymore
This is not needed because GTK must be run in the main thread these days,
which is the same one that runs the main loop. So when this function is
called, the main loop is awake.

https://bugzilla.gnome.org/show_bug.cgi?id=550989
2018-06-18 23:49:52 +02:00
Benjamin Otte
b1f384eec2 x11: Don't sneakily allocate memory in initializers 2018-06-18 23:49:52 +02:00
Benjamin Otte
d02b185a87 dnd: Add gdk_event_get_drop()
And remove gdk_event_get_drag_context().

All GTK code now only uses GdkDrop for dropping.
2018-06-18 23:49:52 +02:00
Benjamin Otte
6048b69145 wayland: Fix drop operations for new semantics 2018-06-18 23:49:52 +02:00
Benjamin Otte
4b85b5299a dnd: Remove GdkDragContext::commit_drag_status() vfunc
The idea behind the vfunc doesn't work as status updates can happen
asynchronously.

A better solution needs to be found.
2018-06-18 23:49:52 +02:00
Benjamin Otte
b00609c21c dnd: Make drag-motion and drag-drop signals use GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
6d7cb2b781 dnd: Make drag-data-received use a GdkDrop 2018-06-18 23:49:52 +02:00
Benjamin Otte
a862ca41c5 drop: Add gdk_drop_get_drag()
For now, it'll always return NULL. We'll fix that later.
2018-06-18 23:49:20 +02:00
Benjamin Otte
314eaf7d10 widget: Make GtkWidgetClass::drag_leave() take a GdkDrop
Drag Contexts are on their way out!
2018-06-18 23:49:20 +02:00
Benjamin Otte
316bd6a333 dnd: Add gdk_drop_finish()
and move the vfunc into GdkDrop.
2018-06-18 23:49:20 +02:00
Benjamin Otte
5b0a6a52c1 dnd: Get rid of gtk_drag_finish()
It's just a wrapper around gdk_drag_finish(), so use that one instead.
2018-06-18 23:49:20 +02:00
Benjamin Otte
13ae11ee01 dnd: Rename gdk_drop_finish() => gdk_drag_finish()
This is a simple rename, so that we can reintroduce gdk_drop_finish()
with the GdkDrop object.
2018-06-18 23:49:19 +02:00
Benjamin Otte
a05af1f0f3 dnd: Move the gdk_drag_status() function
It's now gdk_drop_status().

Also clarify the intended semantics.
2018-06-18 23:49:19 +02:00
Benjamin Otte
b2dc303e5e dnd: Add gdk_drop_get_actions()
This uses the new method without GDK_ACTION_ASK:

Either it is a single action (queryable via gdk_drag_action_is_unique())
or it is not and then the drop target has to make a decision
(potentially by asking someone).
2018-06-18 23:49:19 +02:00
Benjamin Otte
2e27967814 dnd: Make actions a private member variable
Use a setter in the backends.
2018-06-18 23:49:19 +02:00
Benjamin Otte
18c3b725b4 x11: Remove unused variables 2018-06-18 23:49:19 +02:00
Benjamin Otte
6573d08b08 wayland: Set correct variable
This got messed up in commit 7f8a8f221d.
2018-06-18 23:49:19 +02:00
Benjamin Otte
74a8ffc4a8 dnd: Add gdk_drag_action_is_unique()
This will be necessary once we remove the ASK action.
2018-06-18 23:49:19 +02:00
Benjamin Otte
ac44353f9b dnd: Remove GDK_ACTION_DEFAULT and GDK_ACTION_PRIVATE
They're unused and nobody knows what they're supposed to men anyway.
2018-06-18 23:49:19 +02:00
Benjamin Otte
6919d8c532 drop: Move gdk_drop_read_async() to GdkDrop class 2018-06-18 23:49:19 +02:00
Benjamin Otte
f247d268d4 dnd: Add GdkDrop base class for GdkDragContext
The ultimate goal of this patch series is to split GdkDragContext into
GdkDrop + GdkDrag classes for the destination and source side of a dnd
operation.

The refactoring is meant to work something like this:
1. Introduce GdkDrop as a base class
2. Make all drop related code (like GdkEvent) use GdkDrop instead of
   GdkDragContext. Move/duplicate APIs to allow that.
3. Port all drop contexts in the backends from GdkDragContext to GdkDrop
4. Delete all APIs in GdkDragContext that aren't needed anymore.
5. Make GdkDragContext no longer a GdkDrop subclass
6. Rename GdkDragContext to GdkDrag
2018-06-18 23:49:19 +02:00
Matthias Clasen
841a29837e Merge branch 'lrn/misc-gtk4-fixes' into 'master'
Misc GTK4 fixes

See merge request GNOME/gtk!195
2018-06-18 21:37:42 +00:00
Matthias Clasen
7554384b2d Merge branch 'win32-filechooser-fix-file-list-order' into 'master'
win32 file chooser: add missing g_slist_reverse

See merge request GNOME/gtk!199
2018-06-18 20:09:47 +00:00
Timm Bäder
64313f4a4b themes: Don't handle box.linked special
We don't reverse the css nodes anymore in RTL layouts.
2018-06-18 19:39:32 +02:00
Timm Bäder
34f556fc3e filechooserbutton: Remove priv pointer 2018-06-18 17:35:03 +02:00
Timm Bäder
218b39fe01 GtkStyleContext: Remove the frame clock
It's unused within GtkStyleContext.
2018-06-18 17:35:03 +02:00
Timm Bäder
70c8cfa480 dnd: Fix up a comment
The below function does not take a GtkIconHelper anymore.
2018-06-18 17:35:03 +02:00
Timm Bäder
501efeb6b9 colorscale: Remove priv pointer 2018-06-18 17:35:03 +02:00
Timm Bäder
a7d8127d59 fontbutton: Remove priv pointer 2018-06-18 17:35:03 +02:00
Timm Bäder
beb4cb0e37 radiobutton: remove priv pointer 2018-06-18 17:35:03 +02:00
Timm Bäder
346ec706f7 picture: Fix up some docs
Use nullable instead of allow-none consistently, remove trailing
whitespace and fix some c&p problems.
2018-06-18 17:35:03 +02:00
Timm Bäder
d8274856de drawingarea: Clarify some comments 2018-06-18 17:35:03 +02:00
Timm Bäder
3756234708 messagedialog: Remove priv pointer 2018-06-18 17:35:03 +02:00
Timm Bäder
2d6955285c paned: Allocation x/y are always 0
The allocation position we get passed to size_allocate is always 0/0
these days.
2018-06-18 17:35:03 +02:00
Timm Bäder
10a0d6252e paned: Remove handle_pos member
Query the handle bounds on demand instead.
2018-06-18 17:35:03 +02:00
Timm Bäder
f8ddc42638 paned: Chain up in snapshot
No need to snapshot all child widgets ourselves, the implementation in
GtkWidget can just do it for us.
2018-06-18 17:35:02 +02:00
Timm Bäder
e9a9bb069f paned: Remove unnecessary local variable
We can just pass the given allocation on.
2018-06-18 17:35:02 +02:00
Timm Bäder
df79f02310 paned: Don't unnecessarily redraw handle in size_allocate
We size_allocate it after all, which will redraw it.
2018-06-18 17:35:02 +02:00
Timm Bäder
bd99ca2f04 paned: Store GParamSpecs
So we can use the more efficient g_object_notify_by_pspec everywhere.
2018-06-18 17:35:02 +02:00
Timm Bäder
889fcf64b6 Remove gtk_css_node_reverse_children
Not needed anymore.
2018-06-18 17:35:02 +02:00
Timm Bäder
3fadb536d9 toolbar: Stop reordering css nodes based on text direction 2018-06-18 17:35:02 +02:00
Timm Bäder
fb0d8eacc3 headerbar: Stop reordering css nodes depending on text direction 2018-06-18 17:35:02 +02:00
Timm Bäder
fffb3161bc notebook: Stop reversing tabs based on text direction 2018-06-18 17:35:02 +02:00
Timm Bäder
3be2cb8f63 builder: Fix g-i annotations of _get_translation_domain
The return value can be null and is (transfer none).
2018-06-18 17:35:02 +02:00
Timm Bäder
8267605ba2 builder: Use TRUE/FALSE for error return values
Instead of guint and 0/1.
2018-06-18 17:35:02 +02:00
Timm Bäder
da4d8b7d94 builder: Remove priv pointer 2018-06-18 17:35:02 +02:00
Timm Bäder
01d4538223 box: Don't reorder children based on text direction
Make :first-child always be the first child, i.e. the leftest one in LTR
and the rightest one in RTL.
2018-06-18 17:35:02 +02:00
Timm Bäder
da27627696 paned: Don't reorder css nodes based on text direction 2018-06-18 17:35:02 +02:00
Timm Bäder
85e49a1051 center box: Don't reorder css nodes in RTL
So widget order matches css order. We will do the same thing with GtkBox
eventually.
2018-06-18 17:35:02 +02:00
Timm Bäder
798944cb26 scrolledwindow: Remove priv pointer 2018-06-18 17:35:02 +02:00
Matthias Clasen
5a319f66af Merge branch 'window-activate-grab-4-again' into 'master'
gdk: activate surface on keyboard grabs

Closes #85

See merge request GNOME/gtk!174
2018-06-18 11:36:09 +00:00
Nicolai Syvertsen
2d7cfdd7ed win32 file chooser: add missing g_slist_reverse
the list is prepended to so we need to reverse the list
before returning
2018-06-18 09:44:46 +00:00
Samuel Thibault
35417a5a74 gdk: activate surface on keyboard grabs
In 01455399e8 ("gdk: do not deactivate surface on keyboard grabs"), we
made gdk avoid deactivating surfaces when another application takes a
keyboard grab, by using has_focus_window instead of has_focus. That however
broke activating surfaces when the gdk application acquired a grab itself,
in which case has_focus_window is false but has_focus is true.

We thus actually need to use both: surfaces should be activated either
because we have normal keyboard focus, or because we grabbed the keyboard.

This also renames HAS_FOCUS to APPEARS_FOCUSED to better reflect its
role.

Fixes #85
2018-06-18 10:31:15 +02:00
Piotr Drąg
fdfbbc8246 Update Polish translation 2018-06-17 17:24:07 +02:00
Руслан Ижбулатов
b7f9a5419f GDK W32: Use SWP_NOOWNERZORDER everywhere it can be applied
There is no reason why we shouldn't pass this flag every time
Z-order changes. We have separate routines that are used to
maintain relative Z-order, so it should be completely OK to
pass SWP_NOOWNERZORDER to let the OS know that it shouldn't try
to maintain relative Z-order of the windows when raising them.
2018-06-17 10:59:49 +00:00
Руслан Ижбулатов
6cfa799ca1 GDK W32: Don't let TEMP surfaces cause zorder side-effects
Pass SWP_NOOWNERZORDER when rising TEMP surfaces to the top. This ensures that
they don't drag anything else to the top with them. The use-case for this is
a tooltip appearing for a non-foreground surface, causing said surface to rise
above other surfaces, some of which maybe foreground at the moment.

https://bugzilla.gnome.org/show_bug.cgi?id=784766
2018-06-17 10:59:47 +00:00
Руслан Ижбулатов
0db6ee9347 GDK W32: don't unref window iconlist textures
We do not own these textures, nor do we ref them, so it's inappropriate
to unref them.
2018-06-16 18:26:29 +00:00
Руслан Ижбулатов
8a1106c639 W32: Use correct hinstance values
According to the old new thing[0], we should use the instance handle
of the GDK/GTK DLL when registering GDK-specific types in the system.
Using the instance handle for the whole application in these circumstances
is not an error, but can potentially clash with the types registered
by the application itself.

Also, extract window class icons from the GDK/GTK DLL, not from the
application executable.

[0]: https://blogs.msdn.microsoft.com/oldnewthing/20050418-59/?p=35873
2018-06-16 18:24:56 +00:00
Руслан Ижбулатов
6e085b3bf1 Pass the correct data to gdk_content_register_serializer()
The argument is eventually passed to g_conv(), so it should
be the charset, not the mime/type. Without this change the
contentype converter will fail to convert UTF-8 strings to, say,
CP-1251 later on.
2018-06-16 18:23:56 +00:00
Руслан Ижбулатов
6bf88d90f3 W32: don't put a string literal into gtk_libdir
In all other instances gtk_libdir is a dynamically-allocated string,
so dup the literal in this case as well.
2018-06-16 18:22:12 +00:00
Руслан Ижбулатов
fb4d76d380 Add forward declaration for DllMain() in gtkwin32.c 2018-06-16 18:21:42 +00:00
Руслан Ижбулатов
dedc1ee1e5 Use const for media type in devmode_to_settings() 2018-06-16 18:20:49 +00:00
Руслан Ижбулатов
fe76984e89 Add foward declarations to gtk_print_operation_run_without_dialog 2018-06-16 18:20:22 +00:00
Timm Bäder
f6d70f7225 search bar example: remove unused function 2018-06-16 10:16:41 +02:00
Timm Bäder
0b12fd9c1b center box: Remove snapshot implementation 2018-06-16 10:09:12 +02:00
Timm Bäder
7f8106f2a9 gl renderer: call glViewport directly 2018-06-16 10:09:12 +02:00
Timm Bäder
d3ffaa0236 button: Remove measure implementation
This is already done by GtkBin.
2018-06-16 10:09:12 +02:00
Timm Bäder
1b208eb457 combobox: Remove priv pointer 2018-06-16 10:09:12 +02:00
Matthias Clasen
1528665662 Merge branch 'wip/lantw/fix-gtkdoc-build-without-wayland' into 'master'
docs: Fix gtk-doc build when wayland is disabled

See merge request GNOME/gtk!193
2018-06-15 16:27:44 +00:00
Ting-Wei Lan
751c1877b1 docs: Fix gtk-doc build when wayland is disabled
Unconditionally putting 'gdkwayland_inc' in src_dir argument of gtkdoc
call tells gtkdoc-scan to scan source files in a non-existent build
directory, gdk/wayland. To avoid causing build failure when a specific
backend is disabled, we should include directories conditionally.
2018-06-15 23:51:15 +08:00
Matthias Clasen
66e0060836 Merge branch 'design_by' into 'master'
aboutbox: use a more fitting 'design by" role

Closes #1153

See merge request GNOME/gtk!192
2018-06-15 02:00:57 +00:00
Mohammed Sadiq
b2db7bb95b examples: Simplify handling events in search-bar
In search-bar example, we can use gtk_search_bar_set_key_capture_widget()
which would simplify handling keyboard events.
2018-06-14 23:23:17 +05:30
Jakub Steiner
c5fa657631 aboutbox: use a more fitting 'design by" role
- in most cases, authors listed under "artwork by" are actually responsible for
  the design of the app as a whole

Fixes issue #1153
2018-06-14 16:36:38 +02:00
Mohammed Sadiq
bdf3b6f64d Revert "imcontext: Make size arguments be gsize and not int"
This was committed accidently.

This reverts commit eefd2d6f10.
2018-06-14 11:15:14 +05:30
Mohammed Sadiq
6033bc56b4 examples: Fix alignment of search-bar example
The search entry was taking the whole window size.
Let's reduce the size so as to have more natural size.
2018-06-14 11:09:19 +05:30
Benjamin Otte
eefd2d6f10 imcontext: Make size arguments be gsize and not int
Otherwise gcc complains when we use these as arguments to g_new() on
32bit architectures with:

../gtk/gtkcomposetable.c: In function ‘gtk_compose_table_list_add_array’:
/usr/include/glib-2.0/glib/gmem.h:217:10: warning: argument 1 range [2147483648, 4294967295] exceeds maximum object size 2147483647 [-Walloc-size-larger-than=]
      __p = g_##func##_n (__n, __s);   \
      ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gmem.h:279:42: note: in expansion of macro ‘_G_NEW’
 #define g_new0(struct_type, n_structs)   _G_NEW (struct_type, n_structs, malloc0)
                                          ^~~~~~
../gtk/gtkcomposetable.c:851:22: note: in expansion of macro ‘g_new0’
   gtk_compose_seqs = g_new0 (guint16, length);
                      ^~~~~~
/usr/include/glib-2.0/glib/gmem.h:96:10: note: in a call to allocation function ‘g_malloc0_n’ declared here
 gpointer g_malloc0_n      (gsize  n_blocks,
          ^~~~~~~~~~~
2018-06-14 06:37:00 +05:30
Mohammed Sadiq
daf72e2e96 docs: Update getting started docs
We have removed references to private members in our examples.
Let the docs be updated to reflect that.
2018-06-14 05:30:21 +05:30
Mohammed Sadiq
7e98741793 docs: Use gtk_widget_show() to show window
gtk_window_show_all() is no longer available (and no longer needed)
2018-06-13 20:15:20 +05:30
Mohammed Sadiq
d4693b2dc8 snapshot: Trivial typo fix in comment 2018-06-13 19:58:01 +05:30
Rico Tzschichholz
b1f934d3b0 picture: Fix g-i annotation warning 2018-06-13 13:08:28 +02:00
Mohammed Sadiq
fd4bfd5050 build: Fix compiler warnings 2018-06-11 21:12:41 +05:30
Mario Sanchez Prada
07d6c53346 application: Complete startup notification sequence for remote invocations
When a remote instance of a GTK application implementing the Startup
Notification protocol gets spawned it will pass the startup sequence
ID as "platform data" to the main instance. Thus, we need to make sure
that the startup sequence gets completed in that case, since the remote
instance won't do it by itself, since it won't map any top level window.

Checking for this "platform data" in the implementation of the after_emit()
virtual method in the primary instance should be a good place to do so, since
the existence of such data proves that a remote instance has been spawned.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +01:00
Mario Sanchez Prada
479c341545 application: Use the new API to get the startup notification ID
The DESKTOP_STARTUP_ID gets cleared early after the process is spawned,
meaning that it's too late at add_platform_data() to pick it up and send
it over to the primary instance, as it will be always unset at that point.

To solve this, we use the new gdk_display_get_startup_notification_id()
method to pull the startup notification ID for the application, if present,
out of the display and pass it over to that primary instance.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +01:00
Mario Sanchez Prada
938448e0ef display: Add new virtual gdk_display_get_startup_notification_id() method.
Includes implementation for Wayland and X11, which are the only backends
implementing the Startup Notification Protocol, returns NULL otherwise.

https://gitlab.gnome.org/GNOME/gtk/issues/1084
2018-06-11 16:28:24 +01:00
Mario Sanchez Prada
ef3427575f display: Avoid unsetting the DESKTOP_STARTUP_ID variable too late
Similar to what has been done recently for DESKTOP_AUTOSTART_ID [1],
we need to get rid of this call to g_unsetenv() in the displays'
backends for X11 and Wayland, so that it's guarantee to happen any
thread is created, while still being accessible when needed.

Let's stash the value of this environment variable when loading the
GDK library, and provide a private method so that it can be retrieved
from the displays' backend when implementing gdk_display_make_default().

[1] https://gitlab.gnome.org/GNOME/gtk/commit/22269902

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/979
2018-06-11 16:28:24 +01:00
Mohammed Sadiq
0c57e3131f overlay: Use the right property variable name 2018-06-11 17:43:16 +05:30
Benjamin Otte
b22f45b2f6 Merge branch 'wip/sadiq/fixes' into 'master'
overlay: Add support for clipping overlay widgets

See merge request GNOME/gtk!189
2018-06-11 11:55:09 +00:00
Mohammed Sadiq
0d46081645 overlay: Add support for clipping overlay widgets
Sometimes users may want to restrict the growth of child
widgets in a GtkOverlay to grow atmost the size of the overlay.

Let's add a support for that.
2018-06-11 16:24:29 +05:30
770 changed files with 97825 additions and 77459 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/subprojects/*/

View File

@@ -13,7 +13,7 @@ stages:
- subprojects/pango/
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/master:v1
image: registry.gitlab.gnome.org/gnome/gtk/master:v2
stage: build
script:
- bash -x ./.gitlab-ci/test-docker.sh
@@ -44,7 +44,7 @@ msys2-mingw32:
<<: *mingw-defaults
.flatpak-defaults: &flatpak-defaults
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
stage: flatpak
artifacts:
paths:
@@ -64,7 +64,7 @@ flatpak:widget-factory:
<<: *flatpak-defaults
pages:
image: registry.gitlab.gnome.org/gnome/gtk/master:v1
image: registry.gitlab.gnome.org/gnome/gtk/master:v2
stage: deploy
script:
- meson -Ddocumentation=true _build .

View File

@@ -1,6 +1,7 @@
FROM fedora:28
FROM fedora:29
RUN dnf -y install \
hicolor-icon-theme \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
@@ -32,6 +33,7 @@ RUN dnf -y install \
iso-codes \
itstool \
json-glib-devel \
lcov \
libattr-devel \
libepoxy-devel \
libffi-devel \
@@ -68,7 +70,7 @@ RUN dnf -y install \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson
RUN pip3 install meson==0.49.0
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}

View File

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

View File

@@ -1,31 +1,144 @@
If you want to hack on the GTK+ project, you'll need to have the development
tools appropriate for your operating system, including:
# Contribution guidelines
Thank you for considering contributing to the GTK project!
These guidelines are meant for new contributors, regardless of their level
of proficiency; following them allows the maintainers of the GTK project to
more effectively evaluate your contribution, and provide prompt feedback to
you. Additionally, by following these guidelines you clearly communicate
that you respect the time and effort that the people developing GTK put into
managing the project.
GTK is a complex free software GUI toolkit, and it would not exist without
contributions from the free and open source software community. There are
many things that we value:
- bug reporting and fixing
- documentation and examples
- tests
- new features
Please, do not use the issue tracker for support questions. If you have
questions on how to use GTK effectively, you can use:
- the `#gtk+` IRC channel on irc.gnome.org
- the [gtk](https://mail.gnome.org/mailman/listinfo/gtk-list) mailing list,
for general questions on GTK
- the [gtk-app-devel](https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list)
mailing list, for questions on application development with GTK
- the [gtk-devel](https://mail.gnome.org/mailman/listinfo/gtk-devel-list)
mailing list, for questions on developing GTK itself
You can also look at the GTK tag on [Stack
Overflow](https://stackoverflow.com/questions/tagged/gtk).
The issue tracker is meant to be used for actionable issues only.
## How to report bugs
### Security issues
You should not open a new issue for security related questions.
When in doubt, send an email to the [security](mailto:security@gnome.org)
mailing list.
### Bug reports
If you're reporting a bug make sure to list:
0. which version of GTK are you using?
0. which operating system are you using?
0. the necessary steps to reproduce the issue
0. the expected outcome
0. a description of the behavior; screenshots are also welcome
0. a small, self-contained example exhibiting the behavior; if this
is not available, try reproducing the issue using the GTK examples
or interactive tests
If the issue includes a crash, you should also include:
0. the eventual warnings printed on the terminal
0. a backtrace, obtained with tools such as GDB or LLDB
For small issues, such as:
- spelling/grammar fixes in the documentation
- typo correction
- comment clean ups
- changes to metadata files (CI, `.gitignore`)
- build system changes
- source tree clean ups and reorganizations
You should directly open a merge request instead of filing a new issue.
### Features and enhancements
Feature discussion can be open ended and require high bandwidth channels; if
you are proposing a new feature on the issue tracker, make sure to make
an actionable proposal, and list:
0. what you're trying to achieve
0. prior art, in other toolkits or applications
0. design and theming changes
If you're proposing the integration of new features it helps to have
multiple applications using shared or similar code, especially if they have
iterated over it various times.
Each feature should also come fully documented, and with tests.
## Your first contribution
### Prerequisites
If you want to contribute to the GTK project, you will need to have the
development tools appropriate for your operating system, including:
- Python 3.x
- Meson
- Ninja
- Gettext (19.7 or newer)
- a C99 compatible compiler
- a [C99 compatible compiler](https://wiki.gnome.org/Projects/GLib/CompilerRequirements)
Up-to-date instructions about developing GNOME applications and libraries
can be found here:
can be found on [the GNOME Developer Center](https://developer.gnome.org).
* https://developer.gnome.org
The GTK project uses GitLab for code hosting and for tracking issues. More
information about using GitLab can be found [on the GNOME
wiki](https://wiki.gnome.org/GitLab).
Information about using GitLab with GNOME can be found here:
### Dependencies
* https://wiki.gnome.org/GitLab
In order to get GTK from Git installed on your system, you need to have the
required versions of all the software dependencies required by GTK; typically,
this means a recent version of GLib, Cairo, Pango, and ATK, as well as the
platform-specific dependencies for the windowing system you are using (Wayland,
X11, Windows, or macOS).
In order to get Git GTK+ installed on your system, you need to have the
required versions of all the GTK+ dependencies; typically, this means a
recent version of GLib, Cairo, Pango, and ATK, as well as the platform
specific dependencies for the windowing system you are using (Wayland, X11,
Windows, or macOS).
The core dependencies for GTK are:
- [GLib, GObject, and GIO](https://gitlab.gnome.org/GNOME/glib)
- [Cairo](http://cairographics.org)
- [Pango](https://gitlab.gnome.org/GNOME/pango)
- [GdkPixbuf](https://gitlab.gnome.org/GNOME/gdk-pixbuf)
- [Epoxy](https://github.com/anholt/libepoxy)
- [ATK](https://gitlab.gnome.org/GNOME/atk)
- [Graphene](https://github.com/ebassi/graphene)
GTK will attempt to download and build some of these dependencies if it
cannot find them on your system.
Additionally, you may want to look at projects that create a development
environment for you, like [jhbuild](https://wiki.gnome.org/HowDoI/Jhbuild)
and [gvsbuild](https://github.com/wingtk/gvsbuild).
### Getting started
You should start by forking the GTK repository from the GitLab web UI, and
cloning from your fork:
```ssh
```sh
$ git clone https://gitlab.gnome.org/yourusername/gtk.git
$ cd gtk
```
@@ -38,7 +151,7 @@ $ git clone git@gitlab.gnome.org:GNOME/gtk.git
$ cd gtk
```
To compile the Git version of GTK+ on your system, you will need to
To compile the Git version of GTK on your system, you will need to
configure your build using Meson:
```sh
@@ -47,11 +160,6 @@ $ cd _builddir
$ ninja
```
**Note**: For information about submitting patches and pushing changes
to Git, see the `README.md` and `README.commits` files. In particular,
don't, under any circumstances, push anything to Git before reading and
understanding `README.commmits`.
Typically, you should work on your own branch:
```sh
@@ -60,6 +168,99 @@ $ git checkout -b your-branch
Once you've finished working on the bug fix or feature, push the branch
to the Git repository and open a new merge request, to let the GTK
maintainers review your contribution. The [CODE-OWNERS](./docs-CODE-OWNERS)
document contains the list of core contributors to GTK and the areas for
which they are responsible.
maintainers review your contribution.
### Code reviews
Each contribution is reviewed by the core developers of the GTK project.
The [CODE-OWNERS](./docs/CODE-OWNERS) document contains the list of core
contributors to GTK and the areas for which they are responsible; you
should ensure to receive their review and signoff on your changes.
### Commit messages
The expected format for git commit messages is as follows:
```plain
Short explanation of the commit
Longer explanation explaining exactly what's changed, whether any
external or private interfaces changed, what bugs were fixed (with bug
tracker reference if applicable) and so forth. Be concise but not too
brief.
Closes #1234
```
- Always add a brief description of the commit to the _first_ line of
the commit and terminate by two newlines (it will work without the
second newline, but that is not nice for the interfaces).
- First line (the brief description) must only be one sentence and
should start with a capital letter unless it starts with a lowercase
symbol or identifier. Don't use a trailing period either. Don't exceed
72 characters.
- The main description (the body) is normal prose and should use normal
punctuation and capital letters where appropriate. Consider the commit
message as an email sent to the developers (or yourself, six months
down the line) detailing **why** you changed something. There's no need
to specify the **how**: the changes can be inlined.
- When committing code on behalf of others use the `--author` option, e.g.
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
- If your commit is addressing an issue, use the
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
to automatically close the issue when merging the commit with the upstream
repository:
```plain
Closes #1234
Fixes #1234
Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1234
```
- If you have a merge request with multiple commits and none of them
completely fixes an issue, you should add a reference to the issue in
the commit message, e.g. `Bug: #1234`, and use the automatic issue
closing syntax in the description of the merge request.
### Commit access to the GTK repository
GTK is part of the GNOME infrastructure. At the current time, any
person with write access to the GNOME repository can merge changes to
GTK. This is a good thing, in that it encourages many people to work
on GTK, and progress can be made quickly. However, GTK is a fairly
large and complicated project on which many other things depend, so to
avoid unnecessary breakage, and to take advantage of the knowledge
about GTK that has been built up over the years, we'd like to ask
people committing to GTK to follow a few rules:
0. Ask first. If your changes are major, or could possibly break existing
code, you should always ask. If your change is minor and you've been
working on GTK for a while it probably isn't necessary to ask. But when
in doubt, ask. Even if your change is correct, somebody may know a
better way to do things. If you are making changes to GTK, you should
be subscribed to the [gtk-devel](https://mail.gnome.org/mailman/listinfo/gtk-devel-list)
mailing list; this is a good place to ask about intended changes.
The `#gtk+` IRC channel on irc.gnome.org is also a good place to find GTK
developers to discuss changes, but if you live outside of the EU/US time
zones, an email to the gtk-devel mailing list is the most certain and
preferred method.
0. Ask _first_.
0. Always write a meaningful commit message. Changes without a sufficient
commit message will be reverted.
0. Never push to the `master` branch, or any stable branches, directly; you
should always go through a merge request, to ensure that the code is
tested on the CI infrastructure at the very least. A merge request is
also the proper place to get a comprehensive code review from the core
developers of GTK.
If you have been contributing to GTK for a while and you don't have commit
access to the repository, you may ask to obtain it following the [GNOME account
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).

8
NEWS
View File

@@ -27,8 +27,8 @@ Overview of Changes in GTK+ 3.94.0
* Applications can now create their own GtkSnapshot objects for
intermediate rendering.
* Widget event signals have been replaced by event controller, and
some new event controllers have been introduced for this:
* Widget event signals have been replaced by event controllers,
and some new event controllers have been introduced for this:
GtkEventControllerMotion
GtkEventControllerKey
GtkGestureStylus
@@ -68,6 +68,10 @@ Overview of Changes in GTK+ 3.94.0
gtk_widget_draw
gtk_render_icon_surface
* Incomplete transitions:
The ::event signal is not still there, but it will be removed
The DND apis are not finalized yet
* Translation updates:
Croatian
Esperanto

View File

@@ -1,72 +0,0 @@
GTK+ is part of the GNOME git repository. At the current time, any
person with write access to the GNOME repository, can make changes to
GTK+. This is a good thing, in that it encourages many people to work
on GTK+, and progress can be made quickly. However, GTK+ is a fairly
large and complicated package that many other things depend on, so to
avoid unnecessary breakage, and to take advantage of the knowledge
about GTK+ that has been built up over the years, we'd like to ask
people committing to GTK+ to follow a few rules:
0) Ask first. If your changes are major, or could possibly break existing
code, you should always ask. If your change is minor and you've
been working on GTK+ for a while it probably isn't necessary
to ask. But when in doubt, ask. Even if your change is correct,
somebody may know a better way to do things.
If you are making changes to GTK+, you should be subscribed
to gtk-devel-list@gnome.org. (Subscription address:
gtk-devel-list-request@gnome.org.) This is a good place to ask
about intended changes.
#gtk+ on GIMPNet (irc.gimp.org, irc.us.gimp.org, irc.eu.gimp.org, ...)
is also a good place to find GTK+ developers to discuss changes with,
however, email to gtk-devel-list is the most certain and preferred
method.
1) Ask _first_.
2) With git, we no longer maintain a ChangeLog file, but you are expected
to produce a meaningful commit message. Changes without a sufficient
commit message will be reverted. See below for the expected format
of commit messages.
Notes:
* When developing larger features or complicated bug fixes, it is
advisable to work in a branch in your own cloned GTK+ repository.
You may even consider making your repository publically available
so that others can easily test and review your changes.
* The expected format for git commit messages is as follows:
=== begin example commit ===
Short explanation of the commit
Longer explanation explaining exactly what's changed, whether any
external or private interfaces changed, what bugs were fixed (with bug
tracker reference if applicable) and so forth. Be concise but not too brief.
=== end example commit ===
- Always add a brief description of the commit to the _first_ line of
the commit and terminate by two newlines (it will work without the
second newline, but that is not nice for the interfaces).
- First line (the brief description) must only be one sentence and
should start with a capital letter unless it starts with a lowercase
symbol or identifier. Don't use a trailing period either. Don't exceed
72 characters.
- The main description (the body) is normal prose and should use normal
punctuation and capital letters where appropriate. Normally, for patches
sent to a mailing list it's copied from there.
- When committing code on behalf of others use the --author option, e.g.
git commit -a --author "Joe Coder <joe@coder.org>" and --signoff.
Owen Taylor
13 Aug 1998
17 Apr 2001
Matthias Clasen
31 Mar 2009

View File

@@ -31,6 +31,11 @@ Information about mailing lists can be found at
- http://www.gtk.org/mailing-lists.php
Nightly documentation can be found at
- Gtk: https://gnome.pages.gitlab.gnome.org/gtk/gtk/
- Gdk: https://gnome.pages.gitlab.gnome.org/gtk/gdk/
- Gsk: https://gnome.pages.gitlab.gnome.org/gtk/gsk/
Building and installing
-----------------------

View File

@@ -5,7 +5,6 @@
"sdk": "org.gnome.Sdk",
"command": "gtk4-demo",
"tags": ["devel", "development", "nightly"],
"rename-desktop-file": "gtk4-demo.desktop",
"rename-icon": "gtk4-demo",
"desktop-file-name-prefix": "(Development) ",
"finish-args": [

View File

@@ -5,7 +5,6 @@
"sdk": "org.gnome.Sdk",
"command": "gtk4-widget-factory",
"tags": ["devel", "development", "nightly"],
"rename-desktop-file": "gtk4-widget-factory.desktop",
"rename-icon": "gtk4-widget-factory",
"desktop-file-name-prefix": "(Development) ",
"finish-args": [

View File

@@ -455,13 +455,16 @@ demo_application_window_constructed (GObject *object)
}
static void
demo_application_window_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline)
demo_application_window_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget,
width,
height,
baseline);
if (!window->maximized && !window->fullscreen)

View File

@@ -87,14 +87,14 @@ find_toplevel_at_pointer (GdkDisplay *display)
return widget ? gtk_widget_get_toplevel (widget) : NULL;
}
static gboolean
release_event_cb (GtkWidget *widget,
GdkEvent *event,
gboolean *clicked)
static void
released_cb (GtkGestureMultiPress *gesture,
guint n_press,
gdouble x,
gdouble y,
gboolean *clicked)
{
if (gdk_event_get_event_type (event) == GDK_BUTTON_RELEASE)
*clicked = TRUE;
return TRUE;
*clicked = TRUE;
}
/* Asks the user to click on a window, then waits for them click
@@ -132,10 +132,12 @@ query_for_toplevel (GdkDisplay *display,
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
{
GtkGesture *gesture = gtk_gesture_multi_press_new ();
gboolean clicked = FALSE;
g_signal_connect (popup, "event",
G_CALLBACK (release_event_cb), &clicked);
g_signal_connect (gesture, "released",
G_CALLBACK (released_cb), &clicked);
gtk_widget_add_controller (popup, GTK_EVENT_CONTROLLER (gesture));
/* Process events until clicked is set by our button release event handler.
* We pass in may_block=TRUE since we want to wait if there
@@ -144,6 +146,8 @@ query_for_toplevel (GdkDisplay *display,
while (!clicked)
g_main_context_iteration (NULL, TRUE);
gdk_seat_ungrab (gdk_device_get_seat (device));
toplevel = find_toplevel_at_pointer (display);
if (toplevel == popup)
toplevel = NULL;

View File

@@ -120,7 +120,7 @@ get_image_paintable (GtkImage *image)
static void
drag_begin (GtkWidget *widget,
GdkDragContext *context,
GdkDrag *drag,
gpointer data)
{
GdkPaintable *paintable;
@@ -128,17 +128,16 @@ drag_begin (GtkWidget *widget,
paintable = get_image_paintable (GTK_IMAGE (widget));
if (paintable)
{
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
g_object_unref (paintable);
}
}
void
drag_data_get (GtkWidget *widget,
GdkDragContext *context,
GdkDrag *drag,
GtkSelectionData *selection_data,
guint info,
guint time,
gpointer data)
{
GdkPaintable *paintable;
@@ -150,9 +149,8 @@ drag_data_get (GtkWidget *widget,
static void
drag_data_received (GtkWidget *widget,
GdkDragContext *context,
GdkDrop *drop,
GtkSelectionData *selection_data,
guint32 time,
gpointer data)
{
if (gtk_selection_data_get_length (selection_data) > 0)

View File

@@ -144,7 +144,7 @@ create_capital_store (void)
{ NULL, "Jackson" },
{ NULL, "Jefferson City" },
{ NULL, "Juneau" },
{ "K - O" },
{ "K - O", NULL },
{ NULL, "Lansing" },
{ NULL, "Lincoln" },
{ NULL, "Little Rock" },
@@ -154,7 +154,7 @@ create_capital_store (void)
{ NULL, "Nashville" },
{ NULL, "Oklahoma City" },
{ NULL, "Olympia" },
{ NULL, "P - S" },
{ "P - S", NULL },
{ NULL, "Phoenix" },
{ NULL, "Pierre" },
{ NULL, "Providence" },

View File

@@ -161,7 +161,6 @@
<file>editable_cells.c</file>
<file>entry_buffer.c</file>
<file>entry_completion.c</file>
<file>event_axes.c</file>
<file>expander.c</file>
<file>filtermodel.c</file>
<file>fishbowl.c</file>

View File

@@ -1,666 +0,0 @@
/* Touch and Drawing Tablets
*
* Demonstrates advanced handling of event information from exotic
* input devices.
*
* On one hand, this snippet demonstrates management of drawing tablets,
* those contain additional information for the pointer other than
* X/Y coordinates. Tablet pads events are mapped to actions, which
* are both defined and interpreted by the application.
*
* Input axes are dependent on hardware devices, on linux/unix you
* can see the device axes through xinput list <device>. Each time
* a different hardware device is used to move the pointer, the
* master device will be updated to match the axes it provides,
* these changes can be tracked through GdkDevice::changed, or
* checking gdk_event_get_source_device().
*
* On the other hand, this demo handles basic multitouch events,
* each event coming from an specific touchpoint will contain a
* GdkEventSequence that's unique for its lifetime, so multiple
* touchpoints can be tracked.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
typedef struct {
GdkDevice *last_source;
GdkDeviceTool *last_tool;
gdouble *axes;
GdkRGBA color;
gdouble x;
gdouble y;
} AxesInfo;
typedef struct {
GHashTable *pointer_info; /* GdkDevice -> AxesInfo */
GHashTable *touch_info; /* GdkEventSequence -> AxesInfo */
} EventData;
const gchar *colors[] = {
"black",
"orchid",
"fuchsia",
"indigo",
"thistle",
"sienna",
"azure",
"plum",
"lime",
"navy",
"maroon",
"burlywood"
};
static GtkPadActionEntry pad_actions[] = {
{ GTK_PAD_ACTION_BUTTON, 1, -1, N_("Nuclear strike"), "pad.nuke" },
{ GTK_PAD_ACTION_BUTTON, 2, -1, N_("Release siberian methane reserves"), "pad.heat" },
{ GTK_PAD_ACTION_BUTTON, 3, -1, N_("Release solar flare"), "pad.fry" },
{ GTK_PAD_ACTION_BUTTON, 4, -1, N_("De-stabilize Oort cloud"), "pad.fall" },
{ GTK_PAD_ACTION_BUTTON, 5, -1, N_("Ignite WR-104"), "pad.burst" },
{ GTK_PAD_ACTION_BUTTON, 6, -1, N_("Lart whoever asks about this button"), "pad.lart" },
{ GTK_PAD_ACTION_RING, -1, -1, N_("Earth axial tilt"), "pad.tilt" },
{ GTK_PAD_ACTION_STRIP, -1, -1, N_("Extent of weak nuclear force"), "pad.dissolve" },
};
static const gchar *pad_action_results[] = {
"",
"",
"",
"",
"",
"💫",
"",
""
};
static guint cur_color = 0;
static guint pad_action_timeout_id = 0;
static AxesInfo *
axes_info_new (void)
{
AxesInfo *info;
info = g_new0 (AxesInfo, 1);
gdk_rgba_parse (&info->color, colors[cur_color]);
cur_color = (cur_color + 1) % G_N_ELEMENTS (colors);
return info;
}
static EventData *
event_data_new (void)
{
EventData *data;
data = g_new0 (EventData, 1);
data->pointer_info = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_free);
data->touch_info = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_free);
return data;
}
static void
event_data_free (EventData *data)
{
g_hash_table_destroy (data->pointer_info);
g_hash_table_destroy (data->touch_info);
g_free (data);
}
static void
update_axes_from_event (GdkEvent *event,
EventData *data)
{
GdkDevice *device, *source_device;
GdkEventSequence *sequence;
GdkDeviceTool *tool;
GdkEventType type;
gdouble x, y;
AxesInfo *info;
device = gdk_event_get_device (event);
source_device = gdk_event_get_source_device (event);
sequence = gdk_event_get_event_sequence (event);
tool = gdk_event_get_device_tool (event);
type = gdk_event_get_event_type (event);
if (type == GDK_TOUCH_END ||
type == GDK_TOUCH_CANCEL)
{
g_hash_table_remove (data->touch_info, sequence);
return;
}
else if (type == GDK_LEAVE_NOTIFY)
{
g_hash_table_remove (data->pointer_info, device);
return;
}
if (!source_device)
return;
if (!sequence)
{
info = g_hash_table_lookup (data->pointer_info, device);
if (!info)
{
info = axes_info_new ();
g_hash_table_insert (data->pointer_info, device, info);
}
}
else
{
info = g_hash_table_lookup (data->touch_info, sequence);
if (!info)
{
info = axes_info_new ();
g_hash_table_insert (data->touch_info, sequence, info);
}
}
if (info->last_source != source_device)
info->last_source = source_device;
if (info->last_tool != tool)
info->last_tool = tool;
g_clear_pointer (&info->axes, g_free);
if (type == GDK_TOUCH_BEGIN ||
type == GDK_TOUCH_UPDATE)
{
gboolean emulating_pointer;
gdk_event_get_touch_emulating_pointer (event, &emulating_pointer);
if (sequence && emulating_pointer)
g_hash_table_remove (data->pointer_info, device);
}
if (type == GDK_MOTION_NOTIFY ||
type == GDK_BUTTON_PRESS ||
type == GDK_BUTTON_RELEASE)
{
gdouble *axes;
guint n_axes;
gdk_event_get_axes (event, &axes, &n_axes);
info->axes = g_memdup (axes, sizeof (double) * n_axes);
}
if (gdk_event_get_coords (event, &x, &y))
{
info->x = x;
info->y = y;
}
}
static gboolean
event_cb (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
update_axes_from_event (event, user_data);
gtk_widget_queue_draw (widget);
return FALSE;
}
static void
render_arrow (cairo_t *cr,
gdouble x_diff,
gdouble y_diff,
const gchar *label)
{
cairo_save (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_new_path (cr);
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, x_diff, y_diff);
cairo_stroke (cr);
cairo_move_to (cr, x_diff, y_diff);
cairo_show_text (cr, label);
cairo_restore (cr);
}
static void
draw_axes_info (cairo_t *cr,
AxesInfo *info,
int width,
int height)
{
gdouble pressure, tilt_x, tilt_y, distance, wheel, rotation, slider;
GdkAxisFlags axes = gdk_device_get_axes (info->last_source);
cairo_save (cr);
cairo_set_line_width (cr, 1);
gdk_cairo_set_source_rgba (cr, &info->color);
cairo_move_to (cr, 0, info->y);
cairo_line_to (cr, width, info->y);
cairo_move_to (cr, info->x, 0);
cairo_line_to (cr, info->x, height);
cairo_stroke (cr);
cairo_translate (cr, info->x, info->y);
if (!info->axes)
{
cairo_restore (cr);
return;
}
if (axes & GDK_AXIS_FLAG_PRESSURE)
{
cairo_pattern_t *pattern;
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_PRESSURE,
&pressure);
pattern = cairo_pattern_create_radial (0, 0, 0, 0, 0, 100);
cairo_pattern_add_color_stop_rgba (pattern, pressure, 1, 0, 0, pressure);
cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 1, 0);
cairo_set_source (cr, pattern);
cairo_arc (cr, 0, 0, 100, 0, 2 * G_PI);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
}
if (axes & GDK_AXIS_FLAG_XTILT &&
axes & GDK_AXIS_FLAG_YTILT)
{
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_XTILT,
&tilt_x);
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_YTILT,
&tilt_y);
render_arrow (cr, tilt_x * 100, tilt_y * 100, "Tilt");
}
if (axes & GDK_AXIS_FLAG_DISTANCE)
{
double dashes[] = { 5.0, 5.0 };
cairo_text_extents_t extents;
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_DISTANCE,
&distance);
cairo_save (cr);
cairo_move_to (cr, distance * 100, 0);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_set_dash (cr, dashes, 2, 0.0);
cairo_arc (cr, 0, 0, distance * 100, 0, 2 * G_PI);
cairo_stroke (cr);
cairo_move_to (cr, 0, -distance * 100);
cairo_text_extents (cr, "Distance", &extents);
cairo_rel_move_to (cr, -extents.width / 2, 0);
cairo_show_text (cr, "Distance");
cairo_move_to (cr, 0, 0);
cairo_restore (cr);
}
if (axes & GDK_AXIS_FLAG_WHEEL)
{
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_WHEEL,
&wheel);
cairo_save (cr);
cairo_set_line_width (cr, 10);
cairo_set_source_rgba (cr, 0, 0, 0, 0.5);
cairo_new_sub_path (cr);
cairo_arc (cr, 0, 0, 100, 0, wheel * 2 * G_PI);
cairo_stroke (cr);
cairo_restore (cr);
}
if (axes & GDK_AXIS_FLAG_ROTATION)
{
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_ROTATION,
&rotation);
rotation *= 2 * G_PI;
cairo_save (cr);
cairo_rotate (cr, - G_PI / 2);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_set_line_width (cr, 5);
cairo_new_sub_path (cr);
cairo_arc (cr, 0, 0, 100, 0, rotation);
cairo_stroke (cr);
cairo_restore (cr);
}
if (axes & GDK_AXIS_FLAG_SLIDER)
{
cairo_pattern_t *pattern, *mask;
gdk_device_get_axis (info->last_source, info->axes, GDK_AXIS_SLIDER,
&slider);
cairo_save (cr);
cairo_move_to (cr, 0, -10);
cairo_rel_line_to (cr, 0, -50);
cairo_rel_line_to (cr, 10, 0);
cairo_rel_line_to (cr, -5, 50);
cairo_close_path (cr);
cairo_clip_preserve (cr);
pattern = cairo_pattern_create_linear (0, -10, 0, -60);
cairo_pattern_add_color_stop_rgb (pattern, 0, 0, 1, 0);
cairo_pattern_add_color_stop_rgb (pattern, 1, 1, 0, 0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
mask = cairo_pattern_create_linear (0, -10, 0, -60);
cairo_pattern_add_color_stop_rgba (mask, 0, 0, 0, 0, 1);
cairo_pattern_add_color_stop_rgba (mask, slider, 0, 0, 0, 1);
cairo_pattern_add_color_stop_rgba (mask, slider, 0, 0, 0, 0);
cairo_pattern_add_color_stop_rgba (mask, 1, 0, 0, 0, 0);
cairo_mask (cr, mask);
cairo_pattern_destroy (mask);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_stroke (cr);
cairo_restore (cr);
}
cairo_restore (cr);
}
static const gchar *
tool_type_to_string (GdkDeviceToolType tool_type)
{
switch (tool_type)
{
case GDK_DEVICE_TOOL_TYPE_PEN:
return "Pen";
case GDK_DEVICE_TOOL_TYPE_ERASER:
return "Eraser";
case GDK_DEVICE_TOOL_TYPE_BRUSH:
return "Brush";
case GDK_DEVICE_TOOL_TYPE_PENCIL:
return "Pencil";
case GDK_DEVICE_TOOL_TYPE_AIRBRUSH:
return "Airbrush";
case GDK_DEVICE_TOOL_TYPE_MOUSE:
return "Mouse";
case GDK_DEVICE_TOOL_TYPE_LENS:
return "Lens cursor";
case GDK_DEVICE_TOOL_TYPE_UNKNOWN:
default:
return "Unknown";
}
}
static void
draw_device_info (GtkWidget *widget,
cairo_t *cr,
GdkEventSequence *sequence,
gint *y,
AxesInfo *info)
{
PangoLayout *layout;
GString *string;
gint height;
cairo_save (cr);
string = g_string_new (NULL);
g_string_append_printf (string, "Source: %s",
gdk_device_get_name (info->last_source));
if (sequence)
g_string_append_printf (string, "\nSequence: %d",
GPOINTER_TO_UINT (sequence));
if (info->last_tool)
{
const gchar *tool_type;
guint64 serial;
tool_type = tool_type_to_string (gdk_device_tool_get_tool_type (info->last_tool));
serial = gdk_device_tool_get_serial (info->last_tool);
g_string_append_printf (string, "\nTool: %s", tool_type);
if (serial != 0)
g_string_append_printf (string, ", Serial: %" G_GINT64_MODIFIER "x", serial);
}
cairo_move_to (cr, 10, *y);
layout = gtk_widget_create_pango_layout (widget, string->str);
pango_cairo_show_layout (cr, layout);
cairo_stroke (cr);
pango_layout_get_pixel_size (layout, NULL, &height);
gdk_cairo_set_source_rgba (cr, &info->color);
cairo_set_line_width (cr, 10);
cairo_move_to (cr, 0, *y);
*y = *y + height;
cairo_line_to (cr, 0, *y);
cairo_stroke (cr);
cairo_restore (cr);
g_object_unref (layout);
g_string_free (string, TRUE);
}
static void
draw_cb (GtkDrawingArea *da,
cairo_t *cr,
int width,
int height,
gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET (da);
EventData *data = user_data;
AxesInfo *info;
GHashTableIter iter;
gpointer key, value;
gint y = 0;
/* Draw Abs info */
g_hash_table_iter_init (&iter, data->pointer_info);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
info = value;
draw_axes_info (cr, info, width, height);
}
g_hash_table_iter_init (&iter, data->touch_info);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
info = value;
draw_axes_info (cr, info, width, height);
}
/* Draw name, color legend and misc data */
g_hash_table_iter_init (&iter, data->pointer_info);
while (g_hash_table_iter_next (&iter, NULL, &value))
{
info = value;
draw_device_info (widget, cr, NULL, &y, info);
}
g_hash_table_iter_init (&iter, data->touch_info);
while (g_hash_table_iter_next (&iter, &key, &value))
{
info = value;
draw_device_info (widget, cr, key, &y, info);
}
}
static void
update_label_text (GtkWidget *label,
const gchar *text)
{
gchar *markup = NULL;
if (text)
markup = g_strdup_printf ("<span font='48.0'>%s</span>", text);
gtk_label_set_markup (GTK_LABEL (label), markup);
g_free (markup);
}
static gboolean
reset_label_text_timeout_cb (gpointer user_data)
{
GtkWidget *label = user_data;
update_label_text (label, NULL);
pad_action_timeout_id = 0;
return G_SOURCE_REMOVE;
}
static void
update_label_and_timeout (GtkWidget *label,
const gchar *text)
{
if (pad_action_timeout_id)
g_source_remove (pad_action_timeout_id);
update_label_text (label, text);
pad_action_timeout_id = g_timeout_add (200, reset_label_text_timeout_cb, label);
}
static void
on_action_activate (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWidget *label = user_data;
const gchar *result;
gchar *str;
result = g_object_get_data (G_OBJECT (action), "action-result");
if (!parameter)
update_label_and_timeout (label, result);
else
{
str = g_strdup_printf ("%s %.2f", result, g_variant_get_double (parameter));
update_label_and_timeout (label, str);
g_free (str);
}
}
static void
init_pad_controller (GtkWidget *window,
GtkWidget *label)
{
GtkPadController *pad_controller;
GSimpleActionGroup *action_group;
GSimpleAction *action;
gint i;
action_group = g_simple_action_group_new ();
pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
NULL);
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
{
if (pad_actions[i].type == GTK_PAD_ACTION_BUTTON)
{
action = g_simple_action_new (pad_actions[i].action_name, NULL);
}
else
{
action = g_simple_action_new_stateful (pad_actions[i].action_name,
G_VARIANT_TYPE_DOUBLE, NULL);
}
g_signal_connect (action, "activate",
G_CALLBACK (on_action_activate), label);
g_object_set_data (G_OBJECT (action), "action-result",
(gpointer) pad_action_results[i]);
g_action_map_add_action (G_ACTION_MAP (action_group), G_ACTION (action));
g_object_unref (action);
}
gtk_pad_controller_set_action_entries (pad_controller, pad_actions,
G_N_ELEMENTS (pad_actions));
gtk_widget_add_controller (window, GTK_EVENT_CONTROLLER (pad_controller));
g_object_unref (action_group);
}
GtkWidget *
do_event_axes (GtkWidget *toplevel)
{
static GtkWidget *window = NULL;
EventData *event_data;
GtkWidget *label;
GtkWidget *overlay;
GtkWidget *da;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Touch and Drawing Tablets");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_set_support_multidevice (window, TRUE);
event_data = event_data_new ();
g_object_set_data_full (G_OBJECT (window), "gtk-demo-event-data",
event_data, (GDestroyNotify) event_data_free);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 400);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 400);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_cb, event_data, NULL);
gtk_widget_set_can_focus (da, TRUE);
gtk_widget_grab_focus (da);
g_signal_connect (da, "event",
G_CALLBACK (event_cb), event_data);
label = gtk_label_new ("");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_START);
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_container_add (GTK_CONTAINER (overlay), da);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
init_pad_controller (da, label);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -134,7 +134,9 @@ static GtkWidget *
create_video (void)
{
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
GtkWidget *w = gtk_image_new_from_paintable (GDK_PAINTABLE (stream));
GtkWidget *w = gtk_picture_new_for_paintable (GDK_PAINTABLE (stream));
gtk_widget_set_size_request (w, 64, 64);
gtk_media_stream_set_loop (stream, TRUE);
gtk_media_stream_play (stream);
g_object_unref (stream);

View File

@@ -128,9 +128,10 @@ gtk_fishbowl_measure (GtkWidget *widget,
}
static void
gtk_fishbowl_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline)
gtk_fishbowl_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
@@ -147,8 +148,8 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
continue;
gtk_widget_get_preferred_size (child->widget, &child_requisition, NULL);
child_allocation.x = allocation->x + round (child->x * (allocation->width - child_requisition.width));
child_allocation.y = allocation->y + round (child->y * (allocation->height - child_requisition.height));
child_allocation.x = round (child->x * (width - child_requisition.width));
child_allocation.y = round (child->y * (height - child_requisition.height));
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;

View File

@@ -135,55 +135,42 @@ static void set_cursor_if_appropriate (GtkTextView *text_view,
gint x,
gint y);
/* Links can also be activated by clicking or tapping.
*/
static gboolean
event_cb (GtkWidget *text_view,
GdkEvent *ev)
static void
released_cb (GtkGestureMultiPress *gesture,
guint n_press,
gdouble x,
gdouble y,
GtkWidget *text_view)
{
GtkTextIter start, end, iter;
GtkTextBuffer *buffer;
gdouble ex, ey;
int x, y;
GdkEventType type;
int tx, ty;
type = gdk_event_get_event_type (ev);
if (gtk_gesture_single_get_button (GTK_GESTURE_SINGLE (gesture)) > 1)
return;
gdk_event_get_coords (ev, &ex, &ey);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
ex, ey, &x, &y);
if (type == GDK_BUTTON_RELEASE)
{
guint button;
gdk_event_get_button (ev, &button);
if (button != GDK_BUTTON_PRIMARY)
return FALSE;
}
else if (type == GDK_MOTION_NOTIFY)
{
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
return FALSE;
}
else if (type == GDK_TOUCH_END)
{
}
else
return FALSE;
x, y, &tx, &ty);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
/* we shouldn't follow a link if the user has selected something */
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
return FALSE;
return;
if (gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y))
follow_if_link (text_view, &iter);
}
return TRUE;
static void
motion_cb (GtkEventControllerMotion *controller,
gdouble x,
gdouble y,
GtkTextView *text_view)
{
set_cursor_if_appropriate (text_view, x, y);
}
static gboolean hovering_over_link = FALSE;
@@ -259,8 +246,16 @@ do_hypertext (GtkWidget *do_widget)
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
gtk_widget_add_controller (view, controller);
g_signal_connect (view, "event",
G_CALLBACK (event_cb), NULL);
controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ());
g_signal_connect (controller, "released",
G_CALLBACK (released_cb), view);
gtk_widget_add_controller (view, controller);
controller = gtk_event_controller_motion_new ();
g_signal_connect (controller, "motion",
G_CALLBACK (motion_cb), view);
gtk_widget_add_controller (view, controller);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

View File

@@ -154,6 +154,7 @@
</child>
<child>
<object class="GtkBox" id="extra_buttons_box">
<property name="visible">0</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="reply-button">

View File

@@ -831,15 +831,14 @@ load_file (const gchar *demoname,
/* Skipping blank lines */
while (g_ascii_isspace (*p))
p++;
if (*p)
{
p = lines[i];
state++;
/* Fall through */
}
else
if (!*p)
break;
p = lines[i];
state++;
/* Fall through */
case 3:
/* Reading program body */
gtk_text_buffer_insert (source_buffer, &start, p, -1);

View File

@@ -16,6 +16,7 @@
</columns>
</object>
<object class="GtkApplicationWindow" id="window">
<style><class name="devel"/></style>
<property name="default-width">800</property>
<property name="default-height">600</property>
<property name="title">GTK+ Demo</property>

View File

@@ -22,7 +22,6 @@ demos = files([
'editable_cells.c',
'entry_buffer.c',
'entry_completion.c',
'event_axes.c',
'expander.c',
'filtermodel.c',
'fishbowl.c',
@@ -130,7 +129,7 @@ foreach icon_size: [ '16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ]
endforeach
# desktop file
install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir)
install_data('org.gtk.Demo.desktop', install_dir: gtk_applicationsdir)
# GSettings
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)

View File

@@ -3,14 +3,24 @@
* Demonstrates practical handling of drawing tablets in a real world
* usecase.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
enum {
COLOR_SET,
N_SIGNALS
};
static guint area_signals[N_SIGNALS] = { 0, };
typedef struct
{
GtkWidget parent_instance;
cairo_surface_t *surface;
cairo_t *cr;
GdkRGBA draw_color;
GtkPadController *pad_controller;
gdouble brush_size;
} DrawingArea;
typedef struct
@@ -18,8 +28,30 @@ typedef struct
GtkWidgetClass parent_class;
} DrawingAreaClass;
static GtkPadActionEntry pad_actions[] = {
{ GTK_PAD_ACTION_BUTTON, 1, -1, N_("Black"), "pad.black" },
{ GTK_PAD_ACTION_BUTTON, 2, -1, N_("Pink"), "pad.pink" },
{ GTK_PAD_ACTION_BUTTON, 3, -1, N_("Green"), "pad.green" },
{ GTK_PAD_ACTION_BUTTON, 4, -1, N_("Red"), "pad.red" },
{ GTK_PAD_ACTION_BUTTON, 5, -1, N_("Purple"), "pad.purple" },
{ GTK_PAD_ACTION_BUTTON, 6, -1, N_("Orange"), "pad.orange" },
{ GTK_PAD_ACTION_STRIP, -1, -1, N_("Brush size"), "pad.brush_size" },
};
static const gchar *pad_colors[] = {
"black",
"pink",
"green",
"red",
"purple",
"orange"
};
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
static void drawing_area_set_color (DrawingArea *area,
GdkRGBA *color);
static void
drawing_area_ensure_surface (DrawingArea *area,
gint width,
@@ -52,15 +84,16 @@ drawing_area_ensure_surface (DrawingArea *area,
}
static void
drawing_area_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline)
drawing_area_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
DrawingArea *area = (DrawingArea *) widget;
drawing_area_ensure_surface (area, allocation->width, allocation->height);
drawing_area_ensure_surface (area, width, height);
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation, baseline);
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, width, height, baseline);
}
static void
@@ -115,6 +148,82 @@ drawing_area_snapshot (GtkWidget *widget,
cairo_destroy (cr);
}
static void
on_pad_button_activate (GSimpleAction *action,
GVariant *parameter,
DrawingArea *area)
{
const gchar *color = g_object_get_data (G_OBJECT (action), "color");
GdkRGBA rgba;
gdk_rgba_parse (&rgba, color);
drawing_area_set_color (area, &rgba);
}
static void
on_pad_knob_change (GSimpleAction *action,
GVariant *parameter,
DrawingArea *area)
{
gdouble value = g_variant_get_double (parameter);
area->brush_size = value;
}
static void
drawing_area_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel)
{
DrawingArea *area = (DrawingArea *) widget;
GSimpleActionGroup *action_group;
GSimpleAction *action;
GtkWidget *toplevel;
gint i;
if (previous_toplevel && area->pad_controller)
{
gtk_widget_remove_controller (previous_toplevel,
GTK_EVENT_CONTROLLER (area->pad_controller));
area->pad_controller = NULL;
}
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (area));
if (!GTK_IS_WINDOW (toplevel))
return;
action_group = g_simple_action_group_new ();
area->pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
NULL);
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
{
if (pad_actions[i].type == GTK_PAD_ACTION_BUTTON)
{
action = g_simple_action_new (pad_actions[i].action_name, NULL);
g_object_set_data (G_OBJECT (action), "color",
(gpointer) pad_colors[i]);
g_signal_connect (action, "activate",
G_CALLBACK (on_pad_button_activate), area);
}
else
{
action = g_simple_action_new_stateful (pad_actions[i].action_name,
G_VARIANT_TYPE_DOUBLE, NULL);
g_signal_connect (action, "activate",
G_CALLBACK (on_pad_knob_change), area);
}
g_action_map_add_action (G_ACTION_MAP (action_group), G_ACTION (action));
g_object_unref (action);
}
gtk_pad_controller_set_action_entries (area->pad_controller, pad_actions,
G_N_ELEMENTS (pad_actions));
gtk_widget_add_controller (toplevel,
GTK_EVENT_CONTROLLER (area->pad_controller));
}
static void
drawing_area_class_init (DrawingAreaClass *klass)
{
@@ -124,6 +233,14 @@ drawing_area_class_init (DrawingAreaClass *klass)
widget_class->snapshot = drawing_area_snapshot;
widget_class->map = drawing_area_map;
widget_class->unmap = drawing_area_unmap;
widget_class->hierarchy_changed = drawing_area_hierarchy_changed;
area_signals[COLOR_SET] =
g_signal_new ("color-set",
G_TYPE_FROM_CLASS (widget_class),
G_SIGNAL_RUN_FIRST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1, GDK_TYPE_RGBA);
}
static void
@@ -135,12 +252,12 @@ drawing_area_apply_stroke (DrawingArea *area,
{
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
{
cairo_set_line_width (area->cr, 10 * pressure);
cairo_set_line_width (area->cr, 10 * pressure * area->brush_size);
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
}
else
{
cairo_set_line_width (area->cr, 4 * pressure);
cairo_set_line_width (area->cr, 4 * pressure * area->brush_size);
cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE);
}
@@ -148,8 +265,6 @@ drawing_area_apply_stroke (DrawingArea *area,
area->draw_color.green, area->draw_color.blue,
area->draw_color.alpha * pressure);
//cairo_set_source_rgba (area->cr, 0, 0, 0, pressure);
cairo_line_to (area->cr, x, y);
cairo_stroke (area->cr);
cairo_move_to (area->cr, x, y);
@@ -225,11 +340,15 @@ drawing_area_new (void)
return g_object_new (drawing_area_get_type (), NULL);
}
void
static void
drawing_area_set_color (DrawingArea *area,
GdkRGBA *color)
{
if (gdk_rgba_equal (&area->draw_color, color))
return;
area->draw_color = *color;
g_signal_emit (area, area_signals[COLOR_SET], 0, &area->draw_color);
}
static void
@@ -242,6 +361,14 @@ color_button_color_set (GtkColorButton *button,
drawing_area_set_color (draw_area, &color);
}
static void
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorButton *button)
{
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), color);
}
GtkWidget *
do_paint (GtkWidget *toplevel)
{
@@ -263,6 +390,8 @@ do_paint (GtkWidget *toplevel)
colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set",
G_CALLBACK (color_button_color_set), draw_area);
g_signal_connect (draw_area, "color-set",
G_CALLBACK (drawing_area_color_set), colorbutton);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });

View File

@@ -55,10 +55,11 @@ create_complex_popover (GtkWidget *parent,
}
static void
entry_size_allocate_cb (GtkEntry *entry,
const GtkAllocation *allocation,
int baseline,
gpointer user_data)
entry_size_allocate_cb (GtkEntry *entry,
int width,
int height,
int baseline,
gpointer user_data)
{
GtkEntryIconPosition popover_pos;
GtkPopover *popover = user_data;
@@ -77,7 +78,6 @@ entry_size_allocate_cb (GtkEntry *entry,
static void
entry_icon_press_cb (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkEvent *event,
gpointer user_data)
{
GtkWidget *popover = user_data;

View File

@@ -151,11 +151,10 @@ create_search_menu (GtkWidget *entry)
static void
icon_press_cb (GtkEntry *entry,
gint position,
GdkEventButton *event,
gpointer data)
{
if (position == GTK_ENTRY_ICON_PRIMARY)
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
}
static void

View File

@@ -26,17 +26,6 @@ changed_cb (GtkEditable *editable)
g_message ("changed: %s", text);
}
static gboolean
window_event_cb (GtkWidget *widget,
GdkEvent *event,
GtkSearchBar *bar)
{
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS)
return gtk_search_bar_handle_event (bar, event);
return GDK_EVENT_PROPAGATE;
}
static void
search_changed (GtkSearchEntry *entry,
GtkLabel *label)
@@ -102,7 +91,7 @@ do_search_entry2 (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), searchbar);
/* Hook the search bar to key presses */
g_signal_connect (window, "event", G_CALLBACK (window_event_cb), searchbar);
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), window);
/* Help */
label = gtk_label_new ("Start Typing to search");

View File

@@ -295,6 +295,7 @@ start_puzzle (GdkPaintable *puzzle)
grid = gtk_grid_new ();
gtk_widget_set_can_focus (grid, TRUE);
gtk_container_add (GTK_CONTAINER (frame), grid);
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
/* Add a key event controller so people can use the arrow
* keys to move the puzzle */

View File

@@ -12,12 +12,10 @@ do_transparent (GtkWidget *do_widget)
if (!window)
{
GtkWidget *sw;
GtkWidget *overlay;
GtkWidget *button;
GtkWidget *label;
GtkWidget *box;
GtkWidget *image;
GtkWidget *picture;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
@@ -54,17 +52,8 @@ do_transparent (GtkWidget *do_widget)
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), button);
gtk_container_child_set (GTK_CONTAINER (overlay), button, "blur", 5.0, NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (sw), box);
image = gtk_image_new_from_resource ("/transparent/portland-rose.jpg");
gtk_container_add (GTK_CONTAINER (box), image);
picture = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
gtk_container_add (GTK_CONTAINER (overlay), picture);
}
if (!gtk_widget_get_visible (window))

View File

@@ -376,10 +376,9 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
static void
get_image_data (GtkWidget *widget,
GdkDragContext *context,
GdkDrag *drag,
GtkSelectionData *selection,
guint target_info,
guint time,
gpointer data)
{
GtkWidget *image;
@@ -399,10 +398,9 @@ get_image_data (GtkWidget *widget,
static void
get_scalable_image_data (GtkWidget *widget,
GdkDragContext *context,
GdkDrag *drag,
GtkSelectionData *selection,
guint target_info,
guint time,
gpointer data)
{
gchar *uris[2];

View File

@@ -17,4 +17,4 @@ executable('gtk4-icon-browser',
link_args: extra_demo_ldflags,
install: true)
install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)
install_data('org.gtk.IconBrowser.desktop', install_dir: gtk_applicationsdir)

View File

@@ -6,6 +6,7 @@
<property name="child-model">store</property>
</object>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<style><class name="devel"/></style>
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<menu id="app-menu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
</interface>

View File

@@ -13,7 +13,7 @@ executable('gtk4-widget-factory',
install: true)
# desktop file
install_data('gtk4-widget-factory.desktop', install_dir: gtk_applicationsdir)
install_data('org.gtk.WidgetFactory.desktop', install_dir: gtk_applicationsdir)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')

View File

@@ -353,7 +353,6 @@ update_pulse_time (GtkAdjustment *adjustment, GtkWidget *widget)
static void
on_entry_icon_release (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkEvent *event,
gpointer user_data)
{
if (icon_pos != GTK_ENTRY_ICON_SECONDARY)
@@ -967,8 +966,8 @@ background_loaded_cb (GObject *source,
return;
}
child = gtk_image_new_from_pixbuf (pixbuf);
gtk_widget_show (child);
child = gtk_picture_new_for_pixbuf (pixbuf);
gtk_widget_set_size_request (child, 110, 70);
gtk_flow_box_insert (GTK_FLOW_BOX (bd->flowbox), child, -1);
child = gtk_widget_get_parent (child);
g_object_set_data_full (G_OBJECT (child), "filename", bd->filename, g_free);
@@ -996,8 +995,7 @@ populate_flowbox (GtkWidget *flowbox)
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
gdk_pixbuf_fill (pixbuf, 0xffffffff);
child = gtk_image_new_from_pixbuf (pixbuf);
gtk_widget_show (child);
child = gtk_picture_new_for_pixbuf (pixbuf);
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
location = "/usr/share/backgrounds/gnome";
@@ -1082,7 +1080,7 @@ set_accel (GtkApplication *app, GtkWidget *widget)
typedef struct
{
GtkTextView tv;
GdkPixbuf *pixbuf;
GdkTexture *texture;
} MyTextView;
typedef GtkTextViewClass MyTextViewClass;
@@ -1095,18 +1093,23 @@ my_text_view_init (MyTextView *tv)
}
static void
my_tv_draw_layer (GtkTextView *widget,
GtkTextViewLayer layer,
cairo_t *cr)
my_tv_snapshot_layer (GtkTextView *widget,
GtkTextViewLayer layer,
GtkSnapshot *snapshot)
{
MyTextView *tv = (MyTextView *)widget;
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->pixbuf)
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->texture)
{
cairo_save (cr);
gdk_cairo_set_source_pixbuf (cr, tv->pixbuf, 0.0, 0.0);
cairo_paint_with_alpha (cr, 0.333);
cairo_restore (cr);
gtk_snapshot_push_opacity (snapshot, 0.333);
gtk_snapshot_append_texture (snapshot,
tv->texture,
&GRAPHENE_RECT_INIT(
0, 0,
gdk_texture_get_width (tv->texture),
gdk_texture_get_height (tv->texture)
));
gtk_snapshot_pop (snapshot);
}
}
@@ -1115,7 +1118,7 @@ my_tv_finalize (GObject *object)
{
MyTextView *tv = (MyTextView *)object;
g_clear_object (&tv->pixbuf);
g_clear_object (&tv->texture);
G_OBJECT_CLASS (my_text_view_parent_class)->finalize (object);
}
@@ -1127,20 +1130,24 @@ my_text_view_class_init (MyTextViewClass *class)
GObjectClass *o_class = G_OBJECT_CLASS (class);
o_class->finalize = my_tv_finalize;
tv_class->draw_layer = my_tv_draw_layer;
tv_class->snapshot_layer = my_tv_snapshot_layer;
}
static void
my_text_view_set_background (MyTextView *tv, const gchar *filename)
{
GError *error = NULL;
GFile *file;
g_clear_object (&tv->pixbuf);
g_clear_object (&tv->texture);
if (filename == NULL)
return;
tv->pixbuf = gdk_pixbuf_new_from_file (filename, &error);
file = g_file_new_for_path (filename);
tv->texture = gdk_texture_new_from_file (file, &error);
g_object_unref (file);
if (error)
{
g_warning ("%s", error->message);

View File

@@ -6,9 +6,6 @@
<gresource prefix="/org/gtk/WidgetFactory">
<file>widget-factory.css</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory/gtk">
<file preprocess="xml-stripblanks">menus.ui</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>

View File

@@ -16,6 +16,16 @@
<attribute name="action">win.transition</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Widget Factory</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
<menu id="dinner_menu">
<section>
@@ -396,6 +406,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</columns>
</object>
<object class="GtkApplicationWindow" id="window">
<style><class name="devel"/></style>
<property name="title">GTK+ Widget Factory</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar1">
@@ -2226,6 +2237,9 @@ microphone-sensitivity-medium-symbolic</property>
<property name="tooltip-text" translatable="yes">Save the current document</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem"/>
</child>
<child>
<object class="GtkToolButton">
<property name="label" translatable="yes">Search</property>

View File

@@ -71,7 +71,7 @@ straightforward manner.
void gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time);
void gdk_drop_finish (GdkDragContext *context,
void gdk_drag_finish (GdkDragContext *context,
gboolean success,
guint32 time);
GdkAtom gdk_drag_get_selection (GdkDragContext *context);

View File

@@ -171,7 +171,6 @@ gdk_rgba_get_type
<FILE>gdksurface</FILE>
GdkSurface
GdkSurfaceType
GdkSurfaceClass
GdkSurfaceHints
GdkGeometry
GdkGravity
@@ -194,7 +193,6 @@ gdk_surface_is_visible
gdk_surface_is_viewable
gdk_surface_is_input_only
gdk_surface_get_state
gdk_surface_withdraw
gdk_surface_iconify
gdk_surface_deiconify
gdk_surface_stick
@@ -282,8 +280,6 @@ gdk_surface_get_toplevel
gdk_surface_get_children
gdk_surface_get_children_with_user_data
gdk_surface_peek_children
gdk_surface_get_events
gdk_surface_set_events
gdk_surface_set_icon_name
gdk_surface_set_transient_for
gdk_surface_set_role
@@ -301,8 +297,6 @@ gdk_surface_get_support_multidevice
gdk_surface_set_support_multidevice
gdk_surface_get_device_cursor
gdk_surface_set_device_cursor
gdk_surface_get_device_events
gdk_surface_set_device_events
<SUBSECTION>
gdk_surface_coords_from_parent
@@ -652,7 +646,7 @@ gdk_event_get_scancode
gdk_event_get_pointer_emulated
gdk_event_get_crossing_detail
gdk_event_get_crossing_mode
gdk_event_get_drag_context
gdk_event_get_drop
gdk_event_get_focus_in
gdk_event_get_grab_surface
gdk_event_get_motion_history
@@ -661,7 +655,6 @@ gdk_event_get_key_is_modifier
gdk_event_get_pad_axis_value
gdk_event_get_pad_button
gdk_event_get_pad_group_mode
gdk_event_get_string
gdk_event_get_touch_emulating_pointer
gdk_event_get_touchpad_angle_delta
gdk_event_get_touchpad_deltas
@@ -698,7 +691,7 @@ gdk_event_get_type
<SECTION>
<FILE>gdkpaintable</FILE>
<TITLE>GdkPaintable/TITLE>
<TITLE>GdkPaintable</TITLE>
GdkPaintable
GdkPaintableFlags
gdk_paintable_get_current_image
@@ -779,38 +772,60 @@ gdk_cursor_get_type
<SECTION>
<TITLE>Drag and Drop</TITLE>
<FILE>dnd</FILE>
GdkDragContext
GdkDrag
GdkDrop
GdkDragCancelReason
gdk_drag_drop_done
gdk_drag_begin
gdk_drop_finish
GdkDragAction
gdk_drag_status
GDK_ACTION_ALL
gdk_drag_context_get_display
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
gdk_drag_context_get_selected_action
gdk_drag_context_get_formats
gdk_drag_context_get_device
gdk_drag_context_get_source_surface
gdk_drag_context_get_dest_surface
gdk_drag_context_get_drag_surface
gdk_drag_context_set_hotspot
gdk_drag_get_display
gdk_drag_get_actions
gdk_drag_get_suggested_action
gdk_drag_get_selected_action
gdk_drag_get_formats
gdk_drag_get_device
gdk_drag_get_drag_surface
gdk_drag_set_hotspot
<SUBSECTION>
gdk_drag_action_is_unique
<SUBSECTION>
gdk_drop_get_display
gdk_drop_get_device
gdk_drop_get_surface
gdk_drop_get_formats
gdk_drop_get_actions
gdk_drop_get_drag
gdk_drop_status
gdk_drop_finish
gdk_drop_read_async
gdk_drop_read_finish
gdk_drop_read_value_async
gdk_drop_read_value_finish
gdk_drop_read_text_async
gdk_drop_read_text_finish
<SUBSECTION Standard>
GDK_DRAG_CONTEXT
GDK_TYPE_DRAG_CONTEXT
GDK_IS_DRAG_CONTEXT
GDK_DRAG_CONTEXT_CLASS
GDK_DRAG_CONTEXT_GET_CLASS
GDK_IS_DRAG_CONTEXT_CLASS
GDK_DRAG
GDK_TYPE_DRAG
GDK_IS_DRAG
GDK_DRAG_CLASS
GDK_DRAG_GET_CLASS
GDK_IS_DRAG_CLASS
GDK_TYPE_DRAG_ACTION
GDK_TYPE_DRAG_PROTOCOL
GDK_TYPE_DROP
GDK_DROP
GDK_IS_DROP
<SUBSECTION Private>
GdkDragContextClass
gdk_drag_context_get_type
GdkDragClass
gdk_drag_get_type
GdkDropClass
gdk_drop_get_type
</SECTION>
<SECTION>
@@ -853,7 +868,6 @@ gdk_x11_screen_lookup_visual
gdk_x11_screen_supports_net_wm_hint
gdk_x11_screen_get_number_of_desktops
gdk_x11_screen_get_current_desktop
gdk_x11_surface_foreign_new_for_display
gdk_x11_surface_lookup_for_display
gdk_x11_surface_get_xid
gdk_x11_surface_set_theme_variant
@@ -1250,6 +1264,7 @@ gdk_clipboard_get_type
<SECTION>
<FILE>gdkcontentprovider</FILE>
GdkContentProvider
GdkContentProviderClass
gdk_content_provider_new_for_value
gdk_content_provider_new_for_bytes
gdk_content_provider_ref_formats
@@ -1265,7 +1280,6 @@ GDK_CONTENT_PROVIDER_CLASS
GDK_CONTENT_PROVIDER_GET_CLASS
GDK_IS_CONTENT_PROVIDER
GDK_IS_CONTENT_PROVIDER_CLASS
GdkContentProviderClass
gdk_content_provider_get_type
</SECTION>

View File

@@ -2,6 +2,7 @@ gdk_app_launch_context_get_type
gdk_clipboard_get_type
gdk_content_deserializer_get_type
gdk_content_formats_get_type
gdk_content_provider_get_type
gdk_content_serializer_get_type
gdk_cursor_get_type
gdk_device_get_type
@@ -9,7 +10,8 @@ gdk_device_pad_get_type
gdk_device_tool_get_type
gdk_display_get_type
gdk_display_manager_get_type
gdk_drag_context_get_type
gdk_drag_get_type
gdk_drop_get_type
gdk_event_get_type
gdk_frame_clock_get_type
gdk_gl_context_get_type

View File

@@ -87,16 +87,22 @@ images = [
'images/zoom_out_cursor.png',
]
src_dir = [ gdkinc ]
if x11_enabled
src_dir += [ gdkx11_inc ]
endif
if wayland_enabled
src_dir += [ gdkwayland_inc ]
endif
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gdk4',
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: [
gdkinc,
gdkx11_inc,
gdkwayland_inc,
],
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [

View File

@@ -44,7 +44,7 @@
<informalexample>
<para>Create a new file with the following content named <filename>example-0.c.</filename></para>
<programlisting><xi:include href="../../../../examples/window-default.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/window-default.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>
@@ -120,7 +120,7 @@
here</ulink>.</para>
<para>Finally the window size is set using gtk_window_set_default_size and
the window is then shown by GTK via gtk_widget_show_all().</para>
the window is then shown by GTK via gtk_widget_show().</para>
<para>When you exit the window, by for example pressing the X,
the g_application_run() in the main loop returns with a number
@@ -153,7 +153,7 @@
<example id="gtk-getting-started-hello-world">
<title>Hello World in GTK+</title>
<para>Create a new file with the following content named example-1.c.</para>
<programlisting><xi:include href="../../../../examples/hello-world.c" parse="text">
<programlisting><xi:include href="@SRC_DIR@/examples/hello-world.c" parse="text">
<xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
@@ -233,7 +233,7 @@
<example id="gtk-getting-started-grid-packing">
<title>Packing buttons</title>
<para>Create a new file with the following content named example-2.c.</para>
<programlisting><xi:include href="../../../../examples/grid-packing.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/grid-packing.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
@@ -257,9 +257,9 @@
<example>
<title>Packing buttons with GtkBuilder</title>
<para>Create a new file with the following content named example-3.c.</para>
<programlisting><xi:include href="../../../../examples/builder.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/builder.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<para>Create a new file with the following content named builder.ui.</para>
<programlisting><xi:include href="../../../../examples/builder.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/builder.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
@@ -346,7 +346,7 @@
of our application class.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/main.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application1/main.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>All the application logic is in the application class, which
@@ -364,7 +364,7 @@
GIO <ulink url="https://developer.gnome.org/gio/2.36/GApplication.html#GApplication.description">documentation</ulink>.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application1/exampleapp.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Another important class that is part of the application support
@@ -373,7 +373,7 @@
window.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/exampleappwin.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application1/exampleappwin.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>As part of the initial setup of our application, we also
@@ -388,7 +388,7 @@
</informalfigure>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.desktop" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application1/org.gtk.exampleapp.desktop" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Note that <replaceable>@<!-- -->bindir@</replaceable> needs to be replaced
@@ -420,7 +420,7 @@
</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application2/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application2/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To make use of this file in our application, we revisit
@@ -460,7 +460,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application2/exampleapp.gresource.xml" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application2/exampleapp.gresource.xml" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>This file has to be converted into a C source file that will be
@@ -488,23 +488,28 @@ example_app_window_class_init (ExampleAppWindowClass *class)
<para>In this step, we make our application show the content of
all the files that it is given on the commandline.</para>
<para>To this end, we add a private struct to our application
<para>To this end, we add a member to the struct in application
window subclass and keep a reference to the #GtkStack there.
The gtk_widget_class_bind_template_child_private() function
The first member of the struct should be the parent type from
which the class is derived. Here, ExampleAppWindow is derived
from GtkApplicationWindow.
The gtk_widget_class_bind_template_child() function
arranges things so that after instantiating the template, the
@stack member of the private struct will point to the widget of
@stack member of the struct will point to the widget of
the same name from the template.</para>
<informalexample>
<programlisting><![CDATA[
...
struct _ExampleAppWindowPrivate
struct _ExampleAppWindow
{
GtkApplicationWindow parent;
GtkWidget *stack;
};
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
...
@@ -513,7 +518,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
{
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
"/org/gtk/exampleapp/window.ui");
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
}
...
@@ -533,25 +538,21 @@ void
example_app_window_open (ExampleAppWindow *win,
GFile *file)
{
ExampleAppWindowPrivate *priv;
gchar *basename;
GtkWidget *scrolled, *view;
gchar *contents;
gsize length;
priv = example_app_window_get_instance_private (win);
basename = g_file_get_basename (file);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_show (scrolled);
gtk_widget_set_hexpand (scrolled, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
gtk_widget_show (view);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
{
@@ -598,7 +599,7 @@ example_app_window_open (ExampleAppWindow *win,
in a ui file, and add it as a resource to our binary.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application4/app-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application4/app-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To associate the app menu with the application, we have to call
@@ -697,7 +698,7 @@ example_app_class_init (ExampleAppClass *class)
GSettings requires a schema that describes our settings:</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application5/org.gtk.exampleapp.gschema.xml" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application5/org.gtk.exampleapp.gschema.xml" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Before we can make use of this schema in our application,
@@ -718,14 +719,11 @@ example_app_class_init (ExampleAppClass *class)
static void
example_app_window_init (ExampleAppWindow *win)
{
ExampleAppWindowPrivate *priv;
priv = example_app_window_get_instance_private (win);
gtk_widget_init_template (GTK_WIDGET (win));
priv->settings = g_settings_new ("org.gtk.exampleapp");
win->settings = g_settings_new ("org.gtk.exampleapp");
g_settings_bind (priv->settings, "transition",
priv->stack, "transition-type",
g_settings_bind (win->settings, "transition",
win->stack, "transition-type",
G_SETTINGS_BIND_DEFAULT);
}
@@ -749,13 +747,13 @@ example_app_window_init (ExampleAppWindow *win)
<para>Lets start with the template.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application6/prefs.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application6/prefs.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Next comes the dialog subclass.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application6/exampleappprefs.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application6/exampleappprefs.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Now we revisit the <literal>preferences_activated(<!-- -->)</literal> function in our
@@ -807,7 +805,7 @@ preferences_activated (GSimpleAction *action,
to slide out the search bar below the header bar.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application7/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application7/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Implementing the search needs quite a few code changes that
@@ -823,7 +821,6 @@ static void
search_text_changed (GtkEntry *entry,
ExampleAppWindow *win)
{
ExampleAppWindowPrivate *priv;
const gchar *text;
GtkWidget *tab;
GtkWidget *view;
@@ -835,9 +832,7 @@ search_text_changed (GtkEntry *entry,
if (text[0] == '\0')
return;
priv = example_app_window_get_instance_private (win);
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
@@ -887,7 +882,7 @@ example_app_window_init (ExampleAppWindow *win)
which demonstrates #GtkMenuButton, #GtkRevealer and #GtkListBox.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application8/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application8/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>The code to populate the sidebar with buttons for the words
@@ -898,7 +893,7 @@ example_app_window_init (ExampleAppWindow *win)
ui file.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application8/gears-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application8/gears-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To connect the menuitem to the show-words setting, we use
@@ -957,7 +952,7 @@ example_app_window_init (ExampleAppWindow *win)
triggers the show-lines action:</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application9/gears-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application9/gears-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To make this menu item do something, we create a property
@@ -978,12 +973,12 @@ example_app_window_init (ExampleAppWindow *win)
{
...
action = (GAction*) g_property_action_new ("show-lines", priv->lines, "visible");
action = (GAction*) g_property_action_new ("show-lines", win->lines, "visible");
g_action_map_add_action (G_ACTION_MAP (win), action);
g_object_unref (action);
g_object_bind_property (priv->lines, "visible",
priv->lines_label, "visible",
g_object_bind_property (win->lines, "visible",
win->lines_label, "visible",
G_BINDING_DEFAULT);
}
@@ -1017,7 +1012,7 @@ example_app_window_init (ExampleAppWindow *win)
be a direct child of the window, and set its type to be titlebar.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application10/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/application10/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>A small extra bonus of using a header bar is that we get
@@ -1073,7 +1068,7 @@ example_app_window_init (ExampleAppWindow *win)
<example id="gtk-getting-started-drawing">
<title>Drawing in response to input</title>
<para>Create a new file with the following content named example-4.c.</para>
<programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="@SRC_DIR@/examples/drawing.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:

View File

@@ -41,6 +41,16 @@
<xi:include href="visual_index.xml" />
</chapter>
<chapter id="Lists">
<title>GListModel support</title>
<xi:include href="xml/gtkfilterlistmodel.xml" />
<xi:include href="xml/gtkflattenlistmodel.xml" />
<xi:include href="xml/gtkmaplistmodel.xml" />
<xi:include href="xml/gtkslicelistmodel.xml" />
<xi:include href="xml/gtksortlistmodel.xml" />
<xi:include href="xml/gtktreelistmodel.xml" />
</chapter>
<chapter id="Application">
<title>Application support</title>
<xi:include href="xml/gtkapplication.xml" />
@@ -152,6 +162,7 @@
<chapter id="TreeWidgetObjects">
<title>Tree, List and Icon Grid Widgets</title>
<xi:include href="xml/tree_widget.sgml" />
<xi:include href="xml/treeview_tutorial.xml" />
<xi:include href="xml/gtktreemodel.xml" />
<xi:include href="xml/gtktreeselection.xml" />
<xi:include href="xml/gtktreeviewcolumn.xml" />
@@ -301,6 +312,7 @@
<title>Gestures and event handling</title>
<xi:include href="xml/gtkeventcontroller.xml" />
<xi:include href="xml/gtkeventcontrollerkey.xml" />
<xi:include href="xml/gtkeventcontrollerlegacy.xml" />
<xi:include href="xml/gtkeventcontrollerscroll.xml" />
<xi:include href="xml/gtkeventcontrollermotion.xml" />
<xi:include href="xml/gtkgesture.xml" />
@@ -385,7 +397,6 @@
<xi:include href="osx.sgml" />
<xi:include href="broadway.xml" />
<xi:include href="wayland.xml" />
<xi:include href="mir.xml" />
</part>
<xi:include href="glossary.xml" />

View File

@@ -679,8 +679,6 @@ gtk_combo_box_get_active_id
gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popup_for_device
gtk_combo_box_popup
gtk_combo_box_popdown
gtk_combo_box_get_popup_accessible
gtk_combo_box_get_row_separator_func
@@ -760,9 +758,6 @@ gtk_container_child_set_valist
gtk_container_child_notify
gtk_container_child_notify_by_pspec
gtk_container_forall
gtk_container_get_focus_chain
gtk_container_set_focus_chain
gtk_container_unset_focus_chain
gtk_container_class_find_child_property
gtk_container_class_install_child_property
gtk_container_class_install_child_properties
@@ -1244,6 +1239,26 @@ GTK_TYPE_FILE_FILTER
gtk_file_filter_get_type
</SECTION>
<SECTION>
<FILE>gtkfilterlistmodel</FILE>
<TITLE>GtkFilterListModel</TITLE>
GtkFilterListModel
gtk_filter_list_model_new
gtk_filter_list_model_get_model
gtk_filter_list_model_set_filter_func
gtk_filter_list_model_has_filter
gtk_filter_list_model_refilter
<SUBSECTION Standard>
GTK_FILTER_LIST_MODEL
GTK_IS_FILTER_LIST_MODEL
GTK_TYPE_FILTER_LIST_MODEL
GTK_FILTER_LIST_MODEL_CLASS
GTK_IS_FILTER_LIST_MODEL_CLASS
GTK_FILTER_LIST_MODEL_GET_CLASS
<SUBSECTION Private>
gtk_filter_list_model_get_type
</SECTION>
<SECTION>
<FILE>gtkfixed</FILE>
<TITLE>GtkFixed</TITLE>
@@ -1264,6 +1279,24 @@ GtkFixedChild
gtk_fixed_get_type
</SECTION>
<SECTION>
<FILE>gtkflattenlistmodel</FILE>
<TITLE>GtkFlattenListModel</TITLE>
GtkFlattenListModel
gtk_flatten_list_model_new
gtk_flatten_list_model_set_model
gtk_flatten_list_model_get_model
<SUBSECTION Standard>
GTK_FLATTEN_LIST_MODEL
GTK_IS_FLATTEN_LIST_MODEL
GTK_TYPE_FLATTEN_LIST_MODEL
GTK_FLATTEN_LIST_MODEL_CLASS
GTK_IS_FLATTEN_LIST_MODEL_CLASS
GTK_FLATTEN_LIST_MODEL_GET_CLASS
<SUBSECTION Private>
gtk_flatten_list_model_get_type
</SECTION>
<SECTION>
<FILE>gtkfontbutton</FILE>
<TITLE>GtkFontButton</TITLE>
@@ -1711,6 +1744,27 @@ GtkLinkButtonPrivate
gtk_link_button_get_type
</SECTION>
<SECTION>
<FILE>gtkmaplistmodel</FILE>
<TITLE>GtkMapListModel</TITLE>
GtkMapListModel
GtkMapListModelMapFunc
gtk_map_list_model_new
gtk_map_list_model_set_map_func
gtk_map_list_model_set_model
gtk_map_list_model_get_model
gtk_map_list_model_has_map
<SUBSECTION Standard>
GTK_MAP_LIST_MODEL
GTK_IS_MAP_LIST_MODEL
GTK_TYPE_MAP_LIST_MODEL
GTK_MAP_LIST_MODEL_CLASS
GTK_IS_MAP_LIST_MODEL_CLASS
GTK_MAP_LIST_MODEL_GET_CLASS
<SUBSECTION Private>
gtk_map_list_model_get_type
</SECTION>
<SECTION>
<FILE>gtkmenu</FILE>
<TITLE>GtkMenu</TITLE>
@@ -1724,8 +1778,6 @@ gtk_menu_attach
gtk_menu_popup_at_rect
gtk_menu_popup_at_widget
gtk_menu_popup_at_pointer
gtk_menu_popup_for_device
gtk_menu_popup
gtk_menu_set_accel_group
gtk_menu_get_accel_group
gtk_menu_set_accel_path
@@ -2541,6 +2593,51 @@ GtkSizeGroupPrivate
gtk_size_group_get_type
</SECTION>
<SECTION>
<FILE>gtkslicelistmodel</FILE>
<TITLE>GtkSliceListModel</TITLE>
GtkSliceListModel
gtk_slice_list_model_new
gtk_slice_list_model_new_for_type
gtk_slice_list_model_set_model
gtk_slice_list_model_get_model
gtk_slice_list_model_set_offset
gtk_slice_list_model_get_offset
gtk_slice_list_model_set_size
gtk_slice_list_model_get_size
<SUBSECTION Standard>
GTK_SLICE_LIST_MODEL
GTK_IS_SLICE_LIST_MODEL
GTK_TYPE_SLICE_LIST_MODEL
GTK_SLICE_LIST_MODEL_CLASS
GTK_IS_SLICE_LIST_MODEL_CLASS
GTK_SLICE_LIST_MODEL_GET_CLASS
<SUBSECTION Private>
gtk_slice_list_model_get_type
</SECTION>
<SECTION>
<FILE>gtksortlistmodel</FILE>
<TITLE>GtkSortListModel</TITLE>
GtkSortListModel
gtk_sort_list_model_new
gtk_sort_list_model_new_for_type
gtk_sort_list_model_set_sort_func
gtk_sort_list_model_has_sort
gtk_sort_list_model_set_model
gtk_sort_list_model_get_model
gtk_sort_list_model_resort
<SUBSECTION Standard>
GTK_SORT_LIST_MODEL
GTK_IS_SORT_LIST_MODEL
GTK_TYPE_SORT_LIST_MODEL
GTK_SORT_LIST_MODEL_CLASS
GTK_IS_SORT_LIST_MODEL_CLASS
GTK_SORT_LIST_MODEL_GET_CLASS
<SUBSECTION Private>
gtk_sort_list_model_get_type
</SECTION>
<SECTION>
<FILE>gtkspinbutton</FILE>
<TITLE>GtkSpinButton</TITLE>
@@ -3275,6 +3372,49 @@ GTK_TOOLTIP
gtk_tooltip_get_type
</SECTION>
<SECTION>
<FILE>gtktreelistmodel</FILE>
<TITLE>GtkTreeListModel</TITLE>
GtkTreeListModel
GtkTreeListRow
GtkTreeListModelCreateModelFunc
gtk_tree_list_model_new
gtk_tree_list_model_get_model
gtk_tree_list_model_get_passthrough
gtk_tree_list_model_set_autoexpand
gtk_tree_list_model_get_autoexpand
gtk_tree_list_model_get_child_row
gtk_tree_list_model_get_row
<SUBSECTION>
gtk_tree_list_row_get_item
gtk_tree_list_row_set_expanded
gtk_tree_list_row_get_expanded
gtk_tree_list_row_is_expandable
gtk_tree_list_row_get_position
gtk_tree_list_row_get_depth
gtk_tree_list_row_get_children
gtk_tree_list_row_get_parent
gtk_tree_list_row_get_child_row
<SUBSECTION Standard>
GTK_TREE_LIST_MODEL
GTK_IS_TREE_LIST_MODEL
GTK_TYPE_TREE_LIST_MODEL
GTK_TREE_LIST_MODEL_CLASS
GTK_IS_TREE_LIST_MODEL_CLASS
GTK_TREE_LIST_MODEL_GET_CLASS
GTK_TREE_LIST_ROW
GTK_IS_TREE_LIST_ROW
GTK_TYPE_TREE_LIST_ROW
GTK_TREE_LIST_ROW_CLASS
GTK_IS_TREE_LIST_ROW_CLASS
GTK_TREE_LIST_ROW_GET_CLASS
<SUBSECTION Private>
gtk_tree_list_model_get_type
gtk_tree_list_row_get_type
</SECTION>
<SECTION>
<FILE>gtktreemodel</FILE>
<TITLE>GtkTreeModel</TITLE>
@@ -4281,7 +4421,6 @@ gtk_widget_list_accel_closures
gtk_widget_can_activate_accel
gtk_widget_event
gtk_widget_activate
gtk_widget_intersect
gtk_widget_is_focus
gtk_widget_grab_focus
gtk_widget_grab_default
@@ -4464,6 +4603,10 @@ gtk_widget_class_bind_template_callback
gtk_widget_class_bind_template_callback_full
gtk_widget_class_set_connect_func
<SUBSECTION>
gtk_widget_observe_children
gtk_widget_observe_controllers
<SUBSECTION Standard>
GTK_WIDGET
GTK_IS_WIDGET
@@ -4507,6 +4650,7 @@ gtk_window_set_destroy_with_parent
gtk_window_set_display
gtk_window_is_active
gtk_window_is_maximized
gtk_window_get_toplevels
gtk_window_list_toplevels
gtk_window_add_mnemonic
gtk_window_remove_mnemonic
@@ -4865,7 +5009,6 @@ gtk_style_context_get_parent
gtk_style_context_get_path
gtk_style_context_get_property
gtk_style_context_get_display
gtk_style_context_get_frame_clock
gtk_style_context_get_state
gtk_style_context_get_valist
gtk_style_context_get_section
@@ -4888,7 +5031,6 @@ gtk_style_context_remove_class
gtk_style_context_has_class
gtk_style_context_list_classes
gtk_style_context_set_display
gtk_style_context_set_frame_clock
gtk_style_context_set_state
gtk_style_context_set_scale
gtk_style_context_get_scale
@@ -4909,12 +5051,10 @@ gtk_render_check
gtk_render_expander
gtk_render_focus
gtk_render_frame
gtk_render_frame_gap
gtk_render_handle
gtk_render_layout
gtk_render_line
gtk_render_option
gtk_render_slider
gtk_render_activity
gtk_render_icon
gtk_render_insertion_cursor
@@ -4938,7 +5078,6 @@ gtk_border_get_type
<FILE>gtkcssprovider</FILE>
<TITLE>GtkCssProvider</TITLE>
GtkCssProvider
gtk_css_provider_get_default
gtk_css_provider_get_named
gtk_css_provider_load_from_data
gtk_css_provider_load_from_file
@@ -5015,6 +5154,7 @@ gtk_selection_data_get_type
<TITLE>Drag and Drop</TITLE>
GtkDestDefaults
GtkDragResult
<SUBSECTION Destination Side>
gtk_drag_dest_set
gtk_drag_dest_unset
@@ -5026,13 +5166,13 @@ gtk_drag_dest_add_image_targets
gtk_drag_dest_add_uri_targets
gtk_drag_dest_set_track_motion
gtk_drag_dest_get_track_motion
gtk_drag_finish
gtk_drag_get_data
gtk_drag_get_source_widget
gtk_drag_highlight
gtk_drag_unhighlight
<SUBSECTION Source Side>
gtk_drag_begin_with_coordinates
gtk_drag_begin
gtk_drag_cancel
gtk_drag_set_icon_widget
gtk_drag_set_icon_paintable
@@ -6017,6 +6157,8 @@ gtk_overlay_get_overlay_pass_through
gtk_overlay_set_overlay_pass_through
gtk_overlay_get_measure_overlay
gtk_overlay_set_measure_overlay
gtk_overlay_get_clip_overlay
gtk_overlay_set_clip_overlay
<SUBSECTION Standard>
GTK_TYPE_OVERLAY
@@ -6462,9 +6604,27 @@ GTK_GESTURE_SINGLE_GET_CLASS
gtk_gesture_single_get_type
</SECTION>
<SECTION>
<FILE>gtkeventcontrollerlegacy</FILE>
<TITLE>GtkEventControllerlegacy</TITLE>
GtkEventControllerlegacy
gtk_event_controller_legacy_new
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_LEGACY
GTK_EVENT_CONTROLLER_LEGACY
GTK_EVENT_CONTROLLER_LEGACY_CLASS
GTK_IS_EVENT_CONTROLLER_LEGACY
GTK_IS_EVENT_CONTROLLER_LEGACY_CLASS
GTK_EVENT_CONTROLLER_LEGACY_GET_CLASS
<SUBSECTION Private>
gtk_event_controller_legacy_get_type
</SECTION>
<SECTION>
<FILE>gtkeventcontrollerscroll</FILE>
<TITLE>GtkEventControlerScroll</TITLE>
<TITLE>GtkEventControllerScroll</TITLE>
GtkEventControllerScroll
GtkEventControllerScrollFlags
gtk_event_controller_scroll_new
@@ -6485,7 +6645,7 @@ gtk_event_controller_scroll_get_type
<SECTION>
<FILE>gtkeventcontrollermotion</FILE>
<TITLE>GtkEventControlerMotion</TITLE>
<TITLE>GtkEventControllerMotion</TITLE>
GtkEventControllerMotion
gtk_event_controller_motion_new
@@ -6503,7 +6663,7 @@ gtk_event_controller_motion_get_type
<SECTION>
<FILE>gtkeventcontrollerkey</FILE>
<TITLE>GtkEventControlerKey</TITLE>
<TITLE>GtkEventControllerKey</TITLE>
GtkEventControllerKey
gtk_event_controller_key_new

View File

@@ -54,6 +54,7 @@ gtk_entry_completion_get_type
gtk_entry_get_type
gtk_event_controller_get_type
gtk_event_controller_key_get_type
gtk_event_controller_legacy_get_type
gtk_event_controller_motion_get_type
gtk_event_controller_scroll_get_type
gtk_expander_get_type
@@ -118,6 +119,7 @@ gtk_page_setup_get_type
@DISABLE_ON_W32@gtk_page_setup_unix_dialog_get_type
gtk_paned_get_type
gtk_paper_size_get_type
gtk_picture_get_type
gtk_popover_get_type
gtk_popover_menu_get_type
@DISABLE_ON_W32@gtk_printer_get_type

View File

@@ -179,41 +179,6 @@
</para>
</refsect2>
<refsect2 id="event-masks">
<title>Event masks</title>
<para>
Each widget instance has a basic event mask and another per input device,
which determine the types of input event it receives. Each event mask set
on a widget is added to the corresponding (basic or per-device) event mask
for the widgets #GdkSurface, and all child #GdkSurfaces.
</para>
<para>
Filtering events against event masks happens inside #GdkSurface, which
exposes event masks to the windowing system to reduce the number of events
GDK receives from it. On receiving an event, it is filtered against the
#GdkSurfaces mask for the input device, if set. Otherwise, it is filtered
against the #GdkSurfaces basic event mask.
</para>
<para>
This means that widgets must add to the event mask for each event type
they expect to receive, using gtk_widget_set_events() or
gtk_widget_add_events() to preserve the existing mask. Widgets which are
aware of floating devices should use gtk_widget_set_device_events() or
gtk_widget_add_device_events(), and must explicitly enable the device
using gtk_widget_set_device_enabled(). See the #GdkDeviceManager
documentation for more information.
</para>
<para>
All standard widgets set the event mask for all events they expect to
receive, and it is not necessary to modify this. Masks should be set when
implementing a new widget.
</para>
</refsect2>
<refsect2>
<title>Touch events</title>

View File

@@ -340,7 +340,6 @@ content_files = [
'css-overview.xml',
'css-properties.xml',
'drawing-model.xml',
'getting_started.xml',
'glossary.xml',
'gtk4-broadwayd.xml',
'gtk4-builder-tool.xml',
@@ -355,7 +354,6 @@ content_files = [
'input-handling.xml',
'migrating-2to4.xml',
'migrating-3to4.xml',
'mir.xml',
'osx.sgml',
'other_software.sgml',
'overview.xml',
@@ -364,6 +362,7 @@ content_files = [
'running.sgml',
'text_widget.sgml',
'tree_widget.sgml',
'treeview_tutorial.xml',
'visual_index.xml',
'wayland.xml',
'windows.sgml',
@@ -373,7 +372,6 @@ content_files = [
expand_content_files = [
'compiling.sgml',
'drawing-model.xml',
'getting_started.xml',
'glossary.xml',
'input-handling.xml',
'migrating-2to4.xml',
@@ -381,9 +379,11 @@ expand_content_files = [
'question_index.sgml',
'text_widget.sgml',
'tree_widget.sgml',
'treeview_tutorial.xml',
]
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
configure_file(input: 'getting_started.xml.in', output: 'getting_started.xml', configuration: src_dir_conf)
types_conf = configuration_data()
if os_win32

View File

@@ -20,11 +20,11 @@
<para>
The steps outlined in the following sections assume that your
application is working with GTK+ 3.22, which is the final stable
application is working with GTK+ 3.24, which is the final stable
release of GTK+ 3.x. It includes all the necessary APIs and tools
to help you port your application to GTK+ 4. If you are still using
an older version of GTK+ 3.x, you should first get your application
to build and work with the latest minor release in the 3.22 series.
to build and work with the latest minor release in the 3.24 series.
</para>
<section>
@@ -34,7 +34,7 @@
widgets have been deprecated. These deprecations are clearly spelled
out in the API reference, with hints about the recommended replacements.
The API reference for GTK+ 3 also includes an
<ulink url="https://developer.gnome.org/gtk3/3.22/api-index-deprecated.html">index</ulink> of all deprecated symbols.
<ulink url="https://developer.gnome.org/gtk3/3.24/api-index-deprecated.html">index</ulink> of all deprecated symbols.
</para>
<para>
To verify that your program does not use any deprecated symbols,
@@ -79,13 +79,13 @@
<title>Review your window creation flags</title>
<para>
GTK+ 4 removes the GDK_WA_CURSOR flag. Instead, just use
gdk_surface_set_cursor() to set a cursor on the window after
gdk_window_set_cursor() to set a cursor on the window after
creating it.
</para>
<para>
GTK+ 4 also removes the GDK_WA_VISUAL flag, and always uses
an RGBA visual for windows. To prepare your code for this,
use gdk_surface_set_visual (gdk_screen_get_rgba_visual ()) after
use gdk_window_set_visual (gdk_screen_get_rgba_visual ()) after
creating your window.
</para>
<para>
@@ -169,6 +169,30 @@
</para>
</section>
<section>
<title>Stop using GtkWidget event signals</title>
<para>
Event controllers and #GtkGestures replace event signals in GTK+ 4. They
have been backported to GTK+ 3.x so you can prepare for this change.
</para>
</section>
<section>
<title>Set a proper app_id</title>
<para>
In GTK+4 we want the application's #GApplication
'application-id' (and therefore the D-Bus name), the desktop
file basename and Wayland's xdg-shell app_id to match. In
order to achieve this with GTK+3 call g_set_prgname() with the same
application id you passed to #GtkApplication. Rename your
desktop files to match the application id if needed.
</para>
<para>
The call to g_set_prgname() can be removed once you fully migrated
to GTK+4.
</para>
</section>
</section>
<section>
@@ -262,6 +286,14 @@
</para>
</section>
<section>
<title>Stop using GtkEventBox</title>
<para>
GtkEventBox is no longer needed and has been removed.
All widgets receive all events.
</para>
</section>
<section>
<title>Adapt to GtkHeaderBar API changes</title>
<para>
@@ -311,6 +343,15 @@
</para>
</section>
<section>
<title>Adapt to GtkWidget's size allocation changes</title>
<para>
The #GtkWidget::size-allocate signal now takes the baseline as an
argument, so you no longer need to call gtk_widget_get_allocated_baseline()
to get it.
</para>
</section>
<section>
<title>Switch to GtkWidget's children APIs</title>
<para>
@@ -391,6 +432,10 @@
from ui files it run the command <command>gtk4-builder-tool simplify --replace</command>
on them.
</para>
<para>
The function gtk_widget_show_all(), the #GtkWidget::no-show-all property
and its getter and setter have been removed in GTK+ 4, so you should stop using them.
</para>
</section>
<section>
@@ -432,8 +477,7 @@
<title>GtkWidget event signals are removed</title>
<para>
Event controllers and #GtkGestures have already been introduced in GTK+ 3 to handle
input for many cases. In GTK+ 4, even more are available, such as #GtkEventControllerScroll
and GtkEventControllerMotion, and the traditional widget signals for handling input,
input for many cases. In GTK+ 4, the traditional widget signals for handling input,
such as #GtkWidget::motion-event or #GtkWidget::event have been removed.
</para>
</section>

View File

@@ -1,35 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk-mir">
<refmeta>
<refentrytitle>Using GTK+ with Mir</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Using GTK+ with Mir</refname>
<refpurpose>
Mir-specific aspects of using GTK+
</refpurpose>
</refnamediv>
<refsect1>
<title>Using GTK+ with Mir</title>
<para>
The GDK Mir backend provides support for running GTK+ applications
under Mir based display servers. To run your application in this way,
select the Mir backend by setting <literal>GDK_BACKEND=mir</literal>.
</para>
<para>
Currently, the Mir backend does not use any additional commandline
options or environment variables.
</para>
</refsect1>
</refentry>

View File

@@ -435,11 +435,6 @@ nevertheless.
<listitem><para>Selects the Wayland backend for connecting to Wayland display servers</para></listitem>
</varlistentry>
<varlistentry>
<term>mir</term>
<listitem><para>Selects the Mir backend for connecting to Mir display servers</para></listitem>
</varlistentry>
</variablelist>
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain

View File

@@ -0,0 +1,143 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="TreeView-tutorial">
<refmeta>
<refentrytitle>TreeView Tutorial</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>TreeView Tutorial</refname>
<refpurpose>A tutorial on the use of GtkTreeModel, GtkTreeView, and friends</refpurpose>
</refnamediv>
<refsect1>
<title>Overview</title>
<para>GtkTreeView is a widget that displays single- or multi-columned
lists and trees.</para>
<para>The purpose of this tutorial is not to provide an exhaustive
documentation of #GtkTreeView - that is what the API documentation is
for, which should be read alongside with this tutorial. The goal is
rather to present an introduction to the most commonly-used aspects
of #GtkTreeView, and to demonstrate how the various #GtkTreeView
components and concepts work together. Furthermore, an attempt has
been made to shed some light on custom tree models and custom cell
renderers, which seem to be often-mentioned, but rarely
explained.</para>
<para>Developers looking for a quick and dirty introduction that
teaches them everything they need to know in less than five paragraphs
will not find it here. In the author's experience, developers who do
not understand how the tree view and the models work together will run
into problems once they try to modify the given examples, whereas
developers who have worked with other toolkits that employ the
Model/View/Controller-design will find that the API reference provides
all the information they need to know in more condensed form anyway.
Those who disagree may jump straight to the working example code of
course.</para>
<para>Please note that the code examples in the following sections do
not necessarily demonstrate how GtkTreeView is used best in a particular
situation. There are different ways to achieve the same result, and the
examples merely show those different ways, so that developers are able
to decide which one is most suitable for the task at hand.</para>
<refsect2>
<title>Components</title>
<para>The most important concept underlying #GtkTreeView is that of
complete separation between data and how that data is displayed on
the screen. This is commonly known as Model/View/Controller-design,
or MVC. Data of various type (strings, numbers, images, etc.) is
stored in a "model". The "view" is then told which data to display,
where to display it, and how to display it. One of the advantages
of this approach is that you can have multiple views that display
the same data (a directory tree for example) in different ways, or
in the same way multiple times, with only one copy of the underlying
data. This avoids duplication of data and programming effort if the
same data is re-used in different contexts. Also, when the data in
the model is updated, all views automatically get updated as
well.</para>
<para>So, while #GtkTreeModel is used to store data, there are other
components that determine which data is displayed in the #GtkTreeView
and how it is displayed. These components are #GtkTreeViewColumn and
#GtkCellRenderer. A #GtkTreeView is made up of tree view columns.
These are the columns that users perceive as columns. They have a
clickable column header with a column title that can be hidden, and
can be resized and sorted. Tree view columns do not display any data,
they are only used as a device to represent the user-side of the tree
view (sorting etc.) and serve as packing widgets for the components
that do the actual rendering of data onto the screen, namely the
#GtkCellRenderer family of objects. There are a number of different
cell renderers that specialise in rendering certain data like
strings, pixbufs, or toggle buttons. More on this later.</para>
<para>Cell renderers are packed into tree view columns to display data.
A tree view column needs to contain at least one cell renderer, but can
contain multiple cell renderers. For example, if one wanted to display
a 'Filename' column where each filename has a little icon on the left
indicating the file type, one would pack a GtkCellRendererPixbuf and a
GtkCellRendererText into one tree view column. Packing renderers into a
tree view column is similar to packing widgets into a #GtkBox.</para>
</refsect2>
<refsect2>
<title>GtkTreeModels for Data Storage: GtkListStore and GtkTreeStore</title>
<para>It is important to realise what #GtkTreeModel is and what it is
not. #GtkTreeModel is basically just an 'interface' to the data store,
meaning that it is a standardised set of functions that allows a
#GtkTreeView widget (and the application programmer) to query certain
characteristics of a data store, for example how many rows there are,
which rows have children, and how many children a particular row has.
It also provides functions to retrieve data from the data store, and
tell the tree view what type of data is stored in the model. Every
data store must implement the #GtkTreeModel interface and provide these
functions. #GtkTreeModel itself only provides a way to query a data
store's characteristics and to retrieve existing data, it does not
provide a way to remove or add rows to the store or put data into the
store. This is done using the specific store's functions.</para>
<para>GTK comes with two built-in data stores (models): #GtkListStore
and #GtkTreeStore. As the names imply, #GtkListStore is used for simple
lists of data items where items have no hierarchical parent-child
relationships, and #GtkTreeStore is used for tree-like data structures,
where items can have parent-child relationships. A list of files in a
directory would be an example of a simple list structure, whereas a
directory tree is an example for a tree structure. A list is basically
just a special case of a tree with none of the items having any
children, so one could use a tree store to maintain a simple list of
items as well. The only reason #GtkListStore exists is in order to
provide an easier interface that does not need to cater for
child-parent relationships, and because a simple list model can be
optimised for the special case where no children exist, which makes it
faster and more efficient.</para>
<para>#GtkListStore and #GtkTreeStore should cater for most types of
data an application developer might want to display in a #GtkTreeView.
However, it should be noted that #GtkListStore and #GtkTreeStore have
been designed to cater to a large number of potential use cases, and
so are not overly optimized. If you already have your specialized data
store; if you plan to store a lot of data; or if have a large number
of rows, you should consider implementing your own custom model that
stores and manipulates data your own way and implements the
#GtkTreeModel interface. This will not only be more efficient, but
probably also lead to saner code in the long run, and give you more
control over your data. See below for more details on how to implement
custom models.</para>
<para>Tree model implementations like #GtkListStore and #GtkTreeStore
will take care of the view side for you once you have configured the
#GtkTreeView to display what you want. If you change data in the store,
the model will notify the tree view and your data display will be
updated. If you add or remove rows, the model will also notify the
store, and your row will appear in or disappear from the view as
well.</para>
</refsect2>
</refsect1>

View File

@@ -12,6 +12,9 @@ docpath = join_paths(gtk_datadir, 'gtk-doc', 'html')
version_conf = configuration_data()
version_conf.set('GTK_VERSION', meson.project_version())
src_dir_conf = configuration_data()
src_dir_conf.set('SRC_DIR', meson.source_root())
subdir('gdk')
subdir('gsk')
subdir('gtk')

View File

@@ -2,8 +2,8 @@ To make gnome-shell use the desktop file and icon for this example
while running it uninstalled, do the following:
mkdir -p ~/.local/share/applications
sed -e "s#@bindir@#$PWD#" exampleapp.desktop \
> ~/.local/share/applications/lt-exampleapp.desktop
sed -e "s#@bindir@#$PWD#" org.gtk.exampleapp.desktop \
> ~/.local/share/applications/org.gtk.exampleapp.desktop
mkdir -p ~/.local/share/icons/hicolor/48x48/apps
cp exampleapp.png ~/.local/share/icons/hicolor/48x48/apps

View File

@@ -1,16 +1,5 @@
#include <gtk/gtk.h>
static gboolean
window_key_pressed (GtkEventController *controller,
guint keyval,
guint keycode,
GdkModifierType state,
GtkSearchBar *search_bar)
{
return gtk_search_bar_handle_event (search_bar,
gtk_get_current_event ());
}
static void
activate_cb (GtkApplication *app,
gpointer user_data)
@@ -20,12 +9,12 @@ activate_cb (GtkApplication *app,
GtkWidget *box;
GtkWidget *entry;
GtkWidget *menu_button;
GtkEventController *controller;
window = gtk_application_window_new (app);
gtk_widget_show (window);
search_bar = gtk_search_bar_new ();
gtk_widget_set_valign (search_bar, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (window), search_bar);
gtk_widget_show (search_bar);
@@ -40,12 +29,7 @@ activate_cb (GtkApplication *app,
gtk_box_pack_start (GTK_BOX (box), menu_button);
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry));
controller = gtk_event_controller_key_new ();
g_object_set_data_full (G_OBJECT (window), "controller", controller, g_object_unref);
g_signal_connect (controller, "key-pressed",
G_CALLBACK (window_key_pressed), search_bar);
gtk_widget_add_controller (window, controller);
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (search_bar), window);
}
gint

View File

@@ -61,9 +61,6 @@ static GdkSurface * gdk_broadway_device_surface_at_position (GdkDevice *de
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
static void gdk_broadway_device_select_surface_events (GdkDevice *device,
GdkSurface *surface,
GdkEventMask event_mask);
G_DEFINE_TYPE (GdkBroadwayDevice, gdk_broadway_device, GDK_TYPE_DEVICE)
@@ -81,7 +78,6 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
device_class->grab = gdk_broadway_device_grab;
device_class->ungrab = gdk_broadway_device_ungrab;
device_class->surface_at_position = gdk_broadway_device_surface_at_position;
device_class->select_surface_events = gdk_broadway_device_select_surface_events;
}
static void
@@ -325,9 +321,3 @@ gdk_broadway_device_surface_at_position (GdkDevice *device,
return surface;
}
static void
gdk_broadway_device_select_surface_events (GdkDevice *device,
GdkSurface *surface,
GdkEventMask event_mask)
{
}

View File

@@ -49,9 +49,6 @@ struct _GdkBroadwayDisplay
/* Keyboard related information */
GdkKeymap *keymap;
/* drag and drop information */
GdkDragContext *current_dest_drag;
GdkBroadwayServer *server;
gpointer move_resize_data;

View File

@@ -24,7 +24,7 @@
#include "config.h"
#include "gdkdndprivate.h"
#include "gdkdragprivate.h"
#include "gdkinternals.h"
#include "gdkproperty.h"
@@ -34,56 +34,56 @@
#include <string.h>
#define GDK_TYPE_BROADWAY_DRAG_CONTEXT (gdk_broadway_drag_context_get_type ())
#define GDK_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContext))
#define GDK_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
#define GDK_IS_BROADWAY_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
#define GDK_IS_BROADWAY_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG_CONTEXT))
#define GDK_BROADWAY_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG_CONTEXT, GdkBroadwayDragContextClass))
#define GDK_TYPE_BROADWAY_DRAG (gdk_broadway_drag_get_type ())
#define GDK_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDrag))
#define GDK_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
#define GDK_IS_BROADWAY_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_DRAG))
#define GDK_IS_BROADWAY_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAG))
#define GDK_BROADWAY_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAG, GdkBroadwayDragClass))
#ifdef GDK_COMPILATION
typedef struct _GdkBroadwayDragContext GdkBroadwayDragContext;
typedef struct _GdkBroadwayDrag GdkBroadwayDrag;
#else
typedef GdkDragContext GdkBroadwayDragContext;
typedef GdkDrag GdkBroadwayDrag;
#endif
typedef struct _GdkBroadwayDragContextClass GdkBroadwayDragContextClass;
typedef struct _GdkBroadwayDragClass GdkBroadwayDragClass;
GType gdk_broadway_drag_context_get_type (void);
GType gdk_broadway_drag_get_type (void);
struct _GdkBroadwayDragContext {
GdkDragContext context;
struct _GdkBroadwayDrag {
GdkDrag context;
};
struct _GdkBroadwayDragContextClass
struct _GdkBroadwayDragClass
{
GdkDragContextClass parent_class;
GdkDragClass parent_class;
};
static void gdk_broadway_drag_context_finalize (GObject *object);
static void gdk_broadway_drag_finalize (GObject *object);
static GList *contexts;
G_DEFINE_TYPE (GdkBroadwayDragContext, gdk_broadway_drag_context, GDK_TYPE_DRAG_CONTEXT)
G_DEFINE_TYPE (GdkBroadwayDrag, gdk_broadway_drag, GDK_TYPE_DRAG)
static void
gdk_broadway_drag_context_init (GdkBroadwayDragContext *dragcontext)
gdk_broadway_drag_init (GdkBroadwayDrag *dragcontext)
{
contexts = g_list_prepend (contexts, dragcontext);
}
static void
gdk_broadway_drag_context_finalize (GObject *object)
gdk_broadway_drag_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
GdkDrag *context = GDK_DRAG (object);
contexts = g_list_remove (contexts, context);
G_OBJECT_CLASS (gdk_broadway_drag_context_parent_class)->finalize (object);
G_OBJECT_CLASS (gdk_broadway_drag_parent_class)->finalize (object);
}
/* Drag Contexts */
GdkDragContext *
GdkDrag *
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
@@ -91,12 +91,12 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
gint dx,
gint dy)
{
GdkDragContext *new_context;
GdkDrag *new_context;
g_return_val_if_fail (surface != NULL, NULL);
g_return_val_if_fail (GDK_SURFACE_IS_BROADWAY (surface), NULL);
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG,
"device", device,
"content", content,
NULL);
@@ -104,38 +104,6 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
return new_context;
}
static void
gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
guint32 time)
{
g_return_if_fail (context != NULL);
}
static void
gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
guint32 time)
{
g_return_if_fail (context != NULL);
}
/* Destination side */
static void
gdk_broadway_drag_context_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time)
{
g_return_if_fail (context != NULL);
}
static void
gdk_broadway_drag_context_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time)
{
g_return_if_fail (context != NULL);
}
void
_gdk_broadway_surface_register_dnd (GdkSurface *surface)
{
@@ -147,15 +115,9 @@ _gdk_broadway_display_init_dnd (GdkDisplay *display)
}
static void
gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
gdk_broadway_drag_class_init (GdkBroadwayDragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
object_class->finalize = gdk_broadway_drag_context_finalize;
context_class->drag_status = gdk_broadway_drag_context_drag_status;
context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
object_class->finalize = gdk_broadway_drag_finalize;
}

View File

@@ -285,7 +285,6 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
event->key.state = message->key.state;
event->key.hardware_keycode = message->key.key;
gdk_event_set_scancode (event, message->key.key);
event->key.length = 0;
gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
node = _gdk_event_queue_append (display, event);

View File

@@ -46,7 +46,7 @@ void gdk_broadway_surface_set_nodes (GdkSurface *surface,
GPtrArray *node_textures);
void _gdk_broadway_surface_register_dnd (GdkSurface *surface);
GdkDragContext * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
@@ -101,7 +101,6 @@ void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
void _gdk_broadway_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
gint _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,

View File

@@ -207,7 +207,6 @@ void
_gdk_broadway_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkSurfaceAttr *attributes)
{
GdkSurfaceImplBroadway *impl;
@@ -323,11 +322,7 @@ gdk_surface_broadway_show (GdkSurface *surface,
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
impl->visible = TRUE;
if (surface->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_SURFACE (surface), GDK_MAP, NULL, FALSE);
/* FIXME: update state ? */
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
if (_gdk_broadway_server_surface_show (broadway_display->server, impl->id))
@@ -344,11 +339,7 @@ gdk_surface_broadway_hide (GdkSurface *surface)
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
impl->visible = FALSE;
if (surface->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (GDK_SURFACE (surface), GDK_UNMAP, NULL, FALSE);
/* FIXME: update state ? */
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
@@ -620,24 +611,6 @@ gdk_surface_broadway_get_device_state (GdkSurface *surface,
return child != NULL;
}
static GdkEventMask
gdk_surface_broadway_get_events (GdkSurface *surface)
{
if (GDK_SURFACE_DESTROYED (surface))
return 0;
return 0;
}
static void
gdk_surface_broadway_set_events (GdkSurface *surface,
GdkEventMask event_mask)
{
if (!GDK_SURFACE_DESTROYED (surface))
{
}
}
static void
gdk_surface_broadway_input_shape_combine_region (GdkSurface *surface,
const cairo_region_t *shape_region,
@@ -1359,8 +1332,6 @@ gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass)
impl_class->show = gdk_surface_broadway_show;
impl_class->hide = gdk_surface_broadway_hide;
impl_class->withdraw = gdk_surface_broadway_withdraw;
impl_class->set_events = gdk_surface_broadway_set_events;
impl_class->get_events = gdk_surface_broadway_get_events;
impl_class->raise = gdk_surface_broadway_raise;
impl_class->lower = gdk_surface_broadway_lower;
impl_class->restack_toplevel = gdk_surface_broadway_restack_toplevel;

View File

@@ -43,8 +43,19 @@ clienthtml_h = custom_target('clienthtml.h',
],
)
broadwayjs_h = custom_target('broadwayjs.h',
input : ['broadway.js'],
output : 'broadwayjs.h',
command : [
gen_c_array,
'--array-name=broadway_js',
'--output=@OUTPUT@',
'@INPUT0@',
],
)
libgdk_broadway = static_library('gdk-broadway',
clienthtml_h,
clienthtml_h, broadwayjs_h,
gdk_broadway_sources, gdkconfig, gdkenum_h,
include_directories: [confinc, gdkinc],
c_args: [
@@ -58,17 +69,6 @@ libgdk_broadway = static_library('gdk-broadway',
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
broadwayjs_h = custom_target('broadwayjs.h',
input : ['broadway.js'],
output : 'broadwayjs.h',
command : [
gen_c_array,
'--array-name=broadway_js',
'--output=@OUTPUT@',
'@INPUT0@',
],
)
executable('gtk4-broadwayd',
clienthtml_h, broadwayjs_h,
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',

View File

@@ -23,12 +23,12 @@
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkAppLaunchContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkClipboard, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentProvider, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkCursor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplay, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDisplayManager, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDragContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawingContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrag, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrawContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkFrameClock, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkGLContext, g_object_unref)

View File

@@ -32,5 +32,8 @@ void gdk_display_set_cursor_theme (GdkDisplay *display,
const char *theme,
int size);
gboolean gdk_running_in_sandbox (void);
gboolean gdk_should_use_portal (void);
const gchar * gdk_get_startup_notification_id (void);
#endif /* __GDK__PRIVATE_H__ */

View File

@@ -154,6 +154,36 @@ static const GDebugKey gdk_debug_keys[] = {
};
#endif
#ifdef G_HAS_CONSTRUCTORS
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_desktop_startup_notification_id)
#endif
G_DEFINE_CONSTRUCTOR(stash_desktop_startup_notification_id)
#endif
static gchar *startup_notification_id = NULL;
static void
stash_desktop_startup_notification_id (void)
{
const char *desktop_startup_id;
desktop_startup_id = g_getenv ("DESKTOP_STARTUP_ID");
if (desktop_startup_id && *desktop_startup_id != '\0')
{
if (!g_utf8_validate (desktop_startup_id, -1, NULL))
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
else
startup_notification_id = g_strdup (desktop_startup_id ? desktop_startup_id : "");
}
/* Clear the environment variable so it won't be inherited by
* child processes and confuse things.
*/
g_unsetenv ("DESKTOP_STARTUP_ID");
}
static gpointer
register_resources (gpointer dummy G_GNUC_UNUSED)
{
@@ -186,6 +216,10 @@ gdk_pre_parse (void)
G_N_ELEMENTS (gdk_debug_keys));
}
#endif /* G_ENABLE_DEBUG */
#ifndef G_HAS_CONSTRUCTORS
stash_desktop_startup_notification_id ();
#endif
}
/*< private >
@@ -216,17 +250,46 @@ gdk_display_open_default (void)
return display;
}
/*< private >
*
* gdk_get_startup_notification_id
*
* Returns the original value of the DESKTOP_STARTUP_ID environment
* variable if it was defined and valid, or %NULL otherwise.
*
* Returns: (nullable) (transfer none): the original value of the
* DESKTOP_STARTUP_ID environment variable, or %NULL.
*/
const gchar *
gdk_get_startup_notification_id (void)
{
return startup_notification_id;
}
gboolean
gdk_running_in_sandbox (void)
{
char *path;
gboolean ret;
return g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS);
}
path = g_build_filename (g_get_user_runtime_dir (), "flatpak-info", NULL);
ret = g_file_test (path, G_FILE_TEST_EXISTS);
g_free (path);
gboolean
gdk_should_use_portal (void)
{
static const char *use_portal = NULL;
return ret;
if (G_UNLIKELY (use_portal == NULL))
{
if (gdk_running_in_sandbox ())
use_portal = "1";
else
{
use_portal = g_getenv ("GTK_USE_PORTAL");
if (!use_portal)
use_portal = "";
}
}
return use_portal[0] == '1';
}
/**

View File

@@ -44,8 +44,9 @@
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkdisplay.h>
#include <gdk/gdkdisplaymanager.h>
#include <gdk/gdkdnd.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkdrawcontext.h>
#include <gdk/gdkdrop.h>
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h>

View File

@@ -716,8 +716,7 @@ file_uri_deserializer_finish (GObject *source,
return;
}
str = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (
g_filter_output_stream_get_base_stream (G_FILTER_OUTPUT_STREAM (stream))));
str = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (stream));
uris = g_uri_list_extract_uris (str);
g_free (str);
@@ -738,6 +737,8 @@ file_uri_deserializer_finish (GObject *source,
g_value_take_boxed (value, g_slist_reverse (l));
}
g_strfreev (uris);
gdk_content_deserializer_return_success (deserializer);
}
static void

View File

@@ -895,8 +895,8 @@ init (void)
gdk_content_register_serializer (G_TYPE_STRING,
mime,
string_serializer,
mime,
g_free);
(gpointer) charset,
NULL);
}
gdk_content_register_serializer (G_TYPE_STRING,
"text/plain",

View File

@@ -61,12 +61,7 @@
* the commonly available names that are shared with the CSS specification.
* Other names may be available, depending on the platform in use.
* Another option to create a cursor is to use gdk_cursor_new_from_texture()
* and provide an image to use for the cursor. Depending on the #GdkDisplay
* in use, the type of supported images may be limited. See
* gdk_display_supports_cursor_alpha(),
* gdk_display_supports_cursor_color(),
* gdk_display_get_default_cursor_size() and
* gdk_display_get_maximal_cursor_size() for the limitations that might apply.
* and provide an image to use for the cursor.
*
* To ease work with unsupported cursors, a fallback cursor can be provided.
* If a #GdkSurface cannot use a cursor because of the reasons mentioned above,
@@ -346,18 +341,6 @@ gdk_cursor_new_from_name (const gchar *name,
*
* Creates a new cursor from a #GdkTexture.
*
* Not all GDK backends support RGBA cursors. If they are not
* supported, a monochrome approximation will be displayed.
* The functions gdk_display_supports_cursor_alpha() and
* gdk_display_supports_cursor_color() can be used to determine
* whether RGBA cursors are supported;
* gdk_display_get_default_cursor_size() and
* gdk_display_get_maximal_cursor_size() give information about
* cursor sizes.
*
* On the X backend, support for RGBA cursors requires a
* sufficently new version of the X Render extension.
*
* Returns: a new #GdkCursor.
*/
GdkCursor *

View File

@@ -112,9 +112,6 @@ struct _GdkDeviceClass
double *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
void (* select_surface_events) (GdkDevice *device,
GdkSurface *surface,
GdkEventMask event_mask);
};
void _gdk_device_set_associated_device (GdkDevice *device,

View File

@@ -47,8 +47,6 @@ typedef struct _GdkDeviceTool GdkDeviceTool;
*
* Indicates the specific type of tool being used being a tablet. Such as an
* airbrush, pencil, etc.
*
* Since: 3.22
*/
typedef enum {
GDK_DEVICE_TOOL_TYPE_UNKNOWN,

View File

@@ -492,8 +492,6 @@ gdk_display_put_event_nocopy (GdkDisplay *display,
GdkEvent *event)
{
_gdk_event_queue_append (display, event);
/* If the main loop is blocking in a different thread, wake it up */
g_main_context_wakeup (NULL);
}
/**
@@ -633,8 +631,7 @@ get_current_toplevel (GdkDisplay *display,
pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
if (pointer_surface != NULL &&
(GDK_SURFACE_DESTROYED (pointer_surface) ||
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
GDK_SURFACE_DESTROYED (pointer_surface))
pointer_surface = NULL;
*x_out = round (x);
@@ -1283,6 +1280,26 @@ gdk_display_notify_startup_complete (GdkDisplay *display,
GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id);
}
/**
* gdk_display_get_startup_notification_id:
* @display: a #GdkDisplay
*
* Gets the startup notification ID for a Wayland display, or %NULL
* if no ID has been defined.
*
* Returns: the startup notification ID for @display, or %NULL
*/
const gchar *
gdk_display_get_startup_notification_id (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
if (GDK_DISPLAY_GET_CLASS (display)->get_startup_notification_id == NULL)
return NULL;
return GDK_DISPLAY_GET_CLASS (display)->get_startup_notification_id (display);
}
void
_gdk_display_pause_events (GdkDisplay *display)
{
@@ -1313,17 +1330,15 @@ _gdk_display_event_data_free (GdkDisplay *display,
}
void
_gdk_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkSurfaceAttr *attributes)
gdk_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkSurfaceAttr *attributes)
{
GDK_DISPLAY_GET_CLASS (display)->create_surface_impl (display,
surface,
real_parent,
event_mask,
attributes);
surface,
real_parent,
attributes);
}
GdkSurface *

View File

@@ -94,6 +94,8 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
void gdk_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id);
GDK_AVAILABLE_IN_ALL
const gchar * gdk_display_get_startup_notification_id (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display);

View File

@@ -136,6 +136,8 @@ struct _GdkDisplayClass
void (*notify_startup_complete) (GdkDisplay *display,
const gchar *startup_id);
const gchar * (*get_startup_notification_id) (GdkDisplay *display);
void (*event_data_copy) (GdkDisplay *display,
const GdkEvent *event,
GdkEvent *new_event);
@@ -144,7 +146,6 @@ struct _GdkDisplayClass
void (*create_surface_impl) (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
GdkKeymap * (*get_keymap) (GdkDisplay *display);
@@ -231,10 +232,9 @@ void _gdk_display_event_data_copy (GdkDisplay *display
GdkEvent *new_event);
void _gdk_display_event_data_free (GdkDisplay *display,
GdkEvent *event);
void _gdk_display_create_surface_impl (GdkDisplay *display,
void gdk_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
GdkSurface * _gdk_display_create_surface (GdkDisplay *display);

View File

@@ -1,954 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkdndprivate.h"
#include "gdkdisplay.h"
#include "gdksurface.h"
#include "gdkintl.h"
#include "gdkcontentformats.h"
#include "gdkcontentprovider.h"
#include "gdkcontentserializer.h"
#include "gdkcursor.h"
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
struct _GdkDragContextPrivate
{
GdkDisplay *display;
GdkDevice *device;
GdkContentFormats *formats;
};
static struct {
GdkDragAction action;
const gchar *name;
GdkCursor *cursor;
} drag_cursors[] = {
{ GDK_ACTION_DEFAULT, NULL, NULL },
{ GDK_ACTION_ASK, "dnd-ask", NULL },
{ GDK_ACTION_COPY, "dnd-copy", NULL },
{ GDK_ACTION_MOVE, "dnd-move", NULL },
{ GDK_ACTION_LINK, "dnd-link", NULL },
{ 0, "dnd-none", NULL },
};
enum {
PROP_0,
PROP_CONTENT,
PROP_DEVICE,
PROP_DISPLAY,
PROP_FORMATS,
N_PROPERTIES
};
enum {
CANCEL,
DROP_PERFORMED,
DND_FINISHED,
ACTION_CHANGED,
N_SIGNALS
};
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
static guint signals[N_SIGNALS] = { 0 };
static GList *contexts = NULL;
G_DEFINE_TYPE_WITH_PRIVATE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
/**
* SECTION:dnd
* @title: Drag And Drop
* @short_description: Functions for controlling drag and drop handling
*
* These functions provide a low level interface for drag and drop.
* The X backend of GDK supports both the Xdnd and Motif drag and drop
* protocols transparently, the Win32 backend supports the WM_DROPFILES
* protocol.
*
* GTK+ provides a higher level abstraction based on top of these functions,
* and so they are not normally needed in GTK+ applications.
* See the [Drag and Drop][gtk3-Drag-and-Drop] section of
* the GTK+ documentation for more information.
*/
/**
* GdkDragContext:
*
* The GdkDragContext struct contains only private fields and
* should not be accessed directly.
*/
/**
* gdk_drag_context_get_display:
* @context: a #GdkDragContext
*
* Gets the #GdkDisplay that the drag context was created for.
*
* Returns: (transfer none): a #GdkDisplay
**/
GdkDisplay *
gdk_drag_context_get_display (GdkDragContext *context)
{
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return priv->display;
}
/**
* gdk_drag_context_get_formats:
* @context: a #GdkDragContext
*
* Retrieves the formats supported by this context.
*
* Returns: (transfer none): a #GdkContentFormats
**/
GdkContentFormats *
gdk_drag_context_get_formats (GdkDragContext *context)
{
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return priv->formats;
}
/**
* gdk_drag_context_get_actions:
* @context: a #GdkDragContext
*
* Determines the bitmask of actions proposed by the source if
* gdk_drag_context_get_suggested_action() returns %GDK_ACTION_ASK.
*
* Returns: the #GdkDragAction flags
**/
GdkDragAction
gdk_drag_context_get_actions (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_ACTION_DEFAULT);
return context->actions;
}
/**
* gdk_drag_context_get_suggested_action:
* @context: a #GdkDragContext
*
* Determines the suggested drag action of the context.
*
* Returns: a #GdkDragAction value
**/
GdkDragAction
gdk_drag_context_get_suggested_action (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
return context->suggested_action;
}
/**
* gdk_drag_context_get_selected_action:
* @context: a #GdkDragContext
*
* Determines the action chosen by the drag destination.
*
* Returns: a #GdkDragAction value
**/
GdkDragAction
gdk_drag_context_get_selected_action (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), 0);
return context->action;
}
/**
* gdk_drag_context_get_source_surface:
* @context: a #GdkDragContext
*
* Returns the #GdkSurface where the DND operation started.
*
* Returns: (transfer none): a #GdkSurface
**/
GdkSurface *
gdk_drag_context_get_source_surface (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return context->source_surface;
}
/**
* gdk_drag_context_get_dest_surface:
* @context: a #GdkDragContext
*
* Returns the destination surface for the DND operation.
*
* Returns: (transfer none): a #GdkSurface
**/
GdkSurface *
gdk_drag_context_get_dest_surface (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return context->dest_surface;
}
/**
* gdk_drag_context_get_device:
* @context: a #GdkDragContext
*
* Returns the #GdkDevice associated to the drag context.
*
* Returns: (transfer none): The #GdkDevice associated to @context.
**/
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context)
{
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return priv->device;
}
static void
gdk_drag_context_init (GdkDragContext *context)
{
contexts = g_list_prepend (contexts, context);
}
static void
gdk_drag_context_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
switch (prop_id)
{
case PROP_CONTENT:
context->content = g_value_dup_object (value);
if (context->content)
{
g_assert (priv->formats == NULL);
priv->formats = gdk_content_provider_ref_formats (context->content);
}
break;
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
priv->display = gdk_device_get_display (priv->device);
break;
case PROP_FORMATS:
if (priv->formats)
{
GdkContentFormats *override = g_value_dup_boxed (value);
if (override)
{
gdk_content_formats_unref (priv->formats);
priv->formats = override;
}
}
else
{
priv->formats = g_value_dup_boxed (value);
g_assert (priv->formats != NULL);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gdk_drag_context_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (gobject);
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
switch (prop_id)
{
case PROP_CONTENT:
g_value_set_object (value, context->content);
break;
case PROP_DEVICE:
g_value_set_object (value, priv->device);
break;
case PROP_DISPLAY:
g_value_set_object (value, priv->display);
break;
case PROP_FORMATS:
g_value_set_boxed (value, priv->formats);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gdk_drag_context_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
GdkDragContextPrivate *priv = gdk_drag_context_get_instance_private (context);
contexts = g_list_remove (contexts, context);
g_clear_object (&context->content);
g_clear_pointer (&priv->formats, gdk_content_formats_unref);
if (context->source_surface)
g_object_unref (context->source_surface);
if (context->dest_surface)
g_object_unref (context->dest_surface);
G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
}
static void
gdk_drag_context_read_local_async (GdkDragContext *context,
GdkContentFormats *formats,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
task = g_task_new (context, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, gdk_drag_context_read_local_async);
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Reading not implemented."));
g_object_unref (task);
}
static GInputStream *
gdk_drag_context_read_local_finish (GdkDragContext *context,
const char **out_mime_type,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, context), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_context_read_local_async, NULL);
if (out_mime_type)
*out_mime_type = g_task_get_task_data (G_TASK (result));
return g_task_propagate_pointer (G_TASK (result), error);
}
static void
gdk_drag_context_class_init (GdkDragContextClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gdk_drag_context_get_property;
object_class->set_property = gdk_drag_context_set_property;
object_class->finalize = gdk_drag_context_finalize;
/**
* GdkDragContext:content:
*
* The #GdkContentProvider or %NULL if the context is not a source-side
* context.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content",
"Content",
"The content being dragged",
GDK_TYPE_CONTENT_PROVIDER,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDragContext:device:
*
* The #GdkDevice that is performing the drag.
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device",
"Device",
"The device performing the drag",
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDragContext:display:
*
* The #GdkDisplay that the drag context belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDragContext:formats:
*
* The possible formats that the context can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDragContext::cancel:
* @context: The object on which the signal is emitted
* @reason: The reason the context was cancelled
*
* The drag and drop operation was cancelled.
*/
signals[CANCEL] =
g_signal_new (g_intern_static_string ("cancel"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragContextClass, cancel),
NULL, NULL,
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1, GDK_TYPE_DRAG_CANCEL_REASON);
/**
* GdkDragContext::drop-performed:
* @context: The object on which the signal is emitted
* @time: the time at which the drop happened.
*
* The drag and drop operation was performed on an accepting client.
*/
signals[DROP_PERFORMED] =
g_signal_new (g_intern_static_string ("drop-performed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragContextClass, drop_performed),
NULL, NULL,
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT);
/**
* GdkDragContext::dnd-finished:
* @context: The object on which the signal is emitted
*
* The drag and drop operation was finished, the drag destination
* finished reading all data. The drag source can now free all
* miscellaneous data.
*/
signals[DND_FINISHED] =
g_signal_new (g_intern_static_string ("dnd-finished"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragContextClass, dnd_finished),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* GdkDragContext::action-changed:
* @context: The object on which the signal is emitted
* @action: The action currently chosen
*
* A new action is being chosen for the drag and drop operation.
*/
signals[ACTION_CHANGED] =
g_signal_new (g_intern_static_string ("action-changed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragContextClass, action_changed),
NULL, NULL,
g_cclosure_marshal_VOID__FLAGS,
G_TYPE_NONE, 1, GDK_TYPE_DRAG_ACTION);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
/**
* gdk_drag_status:
* @context: a #GdkDragContext
* @action: the selected action which will be taken when a drop happens,
* or 0 to indicate that a drop will not be accepted
* @time_: the timestamp for this operation
*
* Selects one of the actions offered by the drag source.
*
* This function is called by the drag destination in response to
* gdk_drag_motion() called by the drag source.
*/
void
gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time_)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_status (context, action, time_);
}
/*
* gdk_drag_abort:
* @context: a #GdkDragContext
* @time_: the timestamp for this operation
*
* Aborts a drag without dropping.
*
* This function is called by the drag source.
*/
void
gdk_drag_abort (GdkDragContext *context,
guint32 time_)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_abort (context, time_);
}
/*
* gdk_drag_drop:
* @context: a #GdkDragContext
* @time_: the timestamp for this operation
*
* Drops on the current destination.
*
* This function is called by the drag source.
*/
void
gdk_drag_drop (GdkDragContext *context,
guint32 time_)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_drop (context, time_);
}
/**
* gdk_drop_finish:
* @context: a #GdkDragContext
* @success: %TRUE if the data was successfully received
* @time_: the timestamp for this operation
*
* Ends the drag operation after a drop.
*
* This function is called by the drag destination.
*/
void
gdk_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time_)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_finish (context, success, time_);
}
static void
gdk_drag_context_write_done (GObject *content,
GAsyncResult *result,
gpointer task)
{
GError *error = NULL;
if (gdk_content_provider_write_mime_type_finish (GDK_CONTENT_PROVIDER (content), result, &error))
g_task_return_boolean (task, TRUE);
else
g_task_return_error (task, error);
g_object_unref (task);
}
static void
gdk_drag_context_write_serialize_done (GObject *content,
GAsyncResult *result,
gpointer task)
{
GError *error = NULL;
if (gdk_content_serialize_finish (result, &error))
g_task_return_boolean (task, TRUE);
else
g_task_return_error (task, error);
g_object_unref (task);
}
void
gdk_drag_context_write_async (GdkDragContext *context,
const char *mime_type,
GOutputStream *stream,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkContentFormats *formats, *mime_formats;
GTask *task;
GType gtype;
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (context->content);
g_return_if_fail (mime_type != NULL);
g_return_if_fail (mime_type == g_intern_string (mime_type));
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
task = g_task_new (context, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, gdk_drag_context_write_async);
formats = gdk_content_provider_ref_formats (context->content);
if (gdk_content_formats_contain_mime_type (formats, mime_type))
{
gdk_content_provider_write_mime_type_async (context->content,
mime_type,
stream,
io_priority,
cancellable,
gdk_drag_context_write_done,
task);
gdk_content_formats_unref (formats);
return;
}
mime_formats = gdk_content_formats_new ((const gchar *[2]) { mime_type, NULL }, 1);
mime_formats = gdk_content_formats_union_serialize_gtypes (mime_formats);
gtype = gdk_content_formats_match_gtype (formats, mime_formats);
if (gtype != G_TYPE_INVALID)
{
GValue value = G_VALUE_INIT;
GError *error = NULL;
g_assert (gtype != G_TYPE_INVALID);
g_value_init (&value, gtype);
if (gdk_content_provider_get_value (context->content, &value, &error))
{
gdk_content_serialize_async (stream,
mime_type,
&value,
io_priority,
cancellable,
gdk_drag_context_write_serialize_done,
g_object_ref (task));
}
else
{
g_task_return_error (task, error);
}
g_value_unset (&value);
}
else
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible formats to transfer clipboard contents."));
}
gdk_content_formats_unref (mime_formats);
gdk_content_formats_unref (formats);
g_object_unref (task);
}
gboolean
gdk_drag_context_write_finish (GdkDragContext *context,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, context), FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_context_write_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
/**
* gdk_drop_read_async:
* @context: a #GdkDragContext
* @mime_types: (array zero-terminated=1) (element-type utf8): pointer to an array of mime types
* @io_priority: the io priority for the read operation
* @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore
* @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied
* @user_data: (closure): the data to pass to @callback
*
* Asynchronously read the dropped data from a DND context
* in a format that complies with one of the mime types.
*/
void
gdk_drop_read_async (GdkDragContext *context,
const char **mime_types,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkContentFormats *formats;
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (mime_types != NULL && mime_types[0] != NULL);
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
formats = gdk_content_formats_new (mime_types, g_strv_length ((char **) mime_types));
GDK_DRAG_CONTEXT_GET_CLASS (context)->read_async (context,
formats,
io_priority,
cancellable,
callback,
user_data);
gdk_content_formats_unref (formats);
}
/**
* gdk_drop_read_finish:
* @context: a #GdkDragContext
* @out_mime_type: (out) (type utf8): return location for the used mime type
* @result: a #GAsyncResult
* @error: (allow-none): location to store error information on failure, or %NULL
*
* Finishes an async drop read operation, see gdk_drop_read_async().
*
* Returns: (nullable) (transfer full): the #GInputStream, or %NULL
*/
GInputStream *
gdk_drop_read_finish (GdkDragContext *context,
const char **out_mime_type,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (g_async_result_is_tagged (result, gdk_drag_context_read_local_async))
{
return gdk_drag_context_read_local_finish (context, out_mime_type, result, error);
}
else
{
return GDK_DRAG_CONTEXT_GET_CLASS (context)->read_finish (context, out_mime_type, result, error);
}
}
/**
* gdk_drag_context_get_drag_surface:
* @context: a #GdkDragContext
*
* Returns the surface on which the drag icon should be rendered
* during the drag operation. Note that the surface may not be
* available until the drag operation has begun. GDK will move
* the surface in accordance with the ongoing drag operation.
* The surface is owned by @context and will be destroyed when
* the drag operation is over.
*
* Returns: (nullable) (transfer none): the drag surface, or %NULL
*/
GdkSurface *
gdk_drag_context_get_drag_surface (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface)
return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface (context);
return NULL;
}
/**
* gdk_drag_context_set_hotspot:
* @context: a #GdkDragContext
* @hot_x: x coordinate of the drag surface hotspot
* @hot_y: y coordinate of the drag surface hotspot
*
* Sets the position of the drag surface that will be kept
* under the cursor hotspot. Initially, the hotspot is at the
* top left corner of the drag surface.
*/
void
gdk_drag_context_set_hotspot (GdkDragContext *context,
gint hot_x,
gint hot_y)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot)
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot (context, hot_x, hot_y);
}
/**
* gdk_drag_drop_done:
* @context: a #GdkDragContext
* @success: whether the drag was ultimatively successful
*
* Inform GDK if the drop ended successfully. Passing %FALSE
* for @success may trigger a drag cancellation animation.
*
* This function is called by the drag source, and should
* be the last call before dropping the reference to the
* @context.
*
* The #GdkDragContext will only take the first gdk_drag_drop_done()
* call as effective, if this function is called multiple times,
* all subsequent calls will be ignored.
*/
void
gdk_drag_drop_done (GdkDragContext *context,
gboolean success)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
if (context->drop_done)
return;
context->drop_done = TRUE;
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done)
GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done (context, success);
}
void
gdk_drag_context_set_cursor (GdkDragContext *context,
GdkCursor *cursor)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor)
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_cursor (context, cursor);
}
void
gdk_drag_context_cancel (GdkDragContext *context,
GdkDragCancelReason reason)
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_signal_emit (context, signals[CANCEL], 0, reason);
}
gboolean
gdk_drag_context_handle_source_event (GdkEvent *event)
{
GdkDragContext *context;
GList *l;
for (l = contexts; l; l = l->next)
{
context = l->data;
if (!context->is_source)
continue;
if (!GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event)
continue;
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->handle_event (context, event))
return TRUE;
}
return FALSE;
}
GdkCursor *
gdk_drag_get_cursor (GdkDragContext *context,
GdkDragAction action)
{
gint i;
for (i = 0 ; i < G_N_ELEMENTS (drag_cursors) - 1; i++)
if (drag_cursors[i].action == action)
break;
if (drag_cursors[i].cursor == NULL)
drag_cursors[i].cursor = gdk_cursor_new_from_name (drag_cursors[i].name, NULL);
return drag_cursors[i].cursor;
}
static void
gdk_drag_context_commit_drag_status (GdkDragContext *context)
{
GdkDragContextClass *context_class;
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
g_return_if_fail (!context->is_source);
context_class = GDK_DRAG_CONTEXT_GET_CLASS (context);
if (context_class->commit_drag_status)
context_class->commit_drag_status (context);
}
gboolean
gdk_drag_context_handle_dest_event (GdkEvent *event)
{
GdkDragContext *context = NULL;
switch ((guint) event->any.type)
{
case GDK_DRAG_MOTION:
case GDK_DROP_START:
context = event->dnd.context;
break;
default:
return FALSE;
}
if (!context)
return FALSE;
gdk_drag_context_commit_drag_status (context);
return TRUE;;
}

View File

@@ -1,152 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_DND_H__
#define __GDK_DND_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkevents.h>
G_BEGIN_DECLS
#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
/**
* GdkDragAction:
* @GDK_ACTION_DEFAULT: Means nothing, and should not be used.
* @GDK_ACTION_COPY: Copy the data.
* @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
* it from the source using the DELETE target of the X selection protocol.
* @GDK_ACTION_LINK: Add a link to the data. Note that this is only
* useful if source and destination agree on what it means.
* @GDK_ACTION_PRIVATE: Special action which tells the source that the
* destination will do something that the source doesnt understand.
* @GDK_ACTION_ASK: Ask the user what to do with the data.
*
* Used in #GdkDragContext to indicate what the destination
* should do with the dropped data.
*/
typedef enum
{
GDK_ACTION_DEFAULT = 1 << 0,
GDK_ACTION_COPY = 1 << 1,
GDK_ACTION_MOVE = 1 << 2,
GDK_ACTION_LINK = 1 << 3,
GDK_ACTION_PRIVATE = 1 << 4,
GDK_ACTION_ASK = 1 << 5
} GdkDragAction;
/**
* GdkDragCancelReason:
* @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
* @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
* @GDK_DRAG_CANCEL_ERROR: Unspecified error.
*
* Used in #GdkDragContext to the reason of a cancelled DND operation.
*
* Since: 3.20
*/
typedef enum {
GDK_DRAG_CANCEL_NO_TARGET,
GDK_DRAG_CANCEL_USER_CANCELLED,
GDK_DRAG_CANCEL_ERROR
} GdkDragCancelReason;
GDK_AVAILABLE_IN_ALL
GType gdk_drag_context_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_drag_context_get_display (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_drag_context_get_device (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkContentFormats *gdk_drag_context_get_formats (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_context_get_actions (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_drag_context_get_source_surface (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_drag_context_get_dest_surface (GdkDragContext *context);
/* Destination side */
GDK_AVAILABLE_IN_ALL
void gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_drop_read_async (GdkDragContext *context,
const char **mime_types,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
GInputStream * gdk_drop_read_finish (GdkDragContext *context,
const char **out_mime_type,
GAsyncResult *result,
GError **error);
/* Source side */
GDK_AVAILABLE_IN_ALL
GdkDragContext * gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
GDK_AVAILABLE_IN_ALL
void gdk_drag_drop_done (GdkDragContext *context,
gboolean success);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_drag_context_get_drag_surface (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
void gdk_drag_context_set_hotspot (GdkDragContext *context,
gint hot_x,
gint hot_y);
G_END_DECLS
#endif /* __GDK_DND_H__ */

View File

@@ -1,124 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010, Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 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_DND_PRIVATE_H__
#define __GDK_DND_PRIVATE_H__
#include "gdkdnd.h"
G_BEGIN_DECLS
#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
typedef struct _GdkDragContextClass GdkDragContextClass;
struct _GdkDragContextClass {
GObjectClass parent_class;
void (*drag_status) (GdkDragContext *context,
GdkDragAction action,
guint32 time_);
void (*drag_abort) (GdkDragContext *context,
guint32 time_);
void (*drag_drop) (GdkDragContext *context,
guint32 time_);
void (*drop_finish) (GdkDragContext *context,
gboolean success,
guint32 time_);
void (* read_async) (GdkDragContext *context,
GdkContentFormats *formats,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GInputStream * (* read_finish) (GdkDragContext *context,
const char **out_mime_type,
GAsyncResult *result,
GError **error);
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
void (*set_hotspot) (GdkDragContext *context,
gint hot_x,
gint hot_y);
void (*drop_done) (GdkDragContext *context,
gboolean success);
void (*set_cursor) (GdkDragContext *context,
GdkCursor *cursor);
void (*cancel) (GdkDragContext *context,
GdkDragCancelReason reason);
void (*drop_performed) (GdkDragContext *context,
guint32 time);
void (*dnd_finished) (GdkDragContext *context);
gboolean (*handle_event) (GdkDragContext *context,
const GdkEvent *event);
void (*action_changed) (GdkDragContext *context,
GdkDragAction action);
void (*commit_drag_status) (GdkDragContext *context);
};
struct _GdkDragContext {
GObject parent_instance;
/*< private >*/
gboolean is_source;
GdkSurface *source_surface;
GdkSurface *dest_surface;
GdkSurface *drag_surface;
GdkContentProvider *content;
GdkDragAction actions;
GdkDragAction suggested_action;
GdkDragAction action;
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
};
void gdk_drag_context_set_cursor (GdkDragContext *context,
GdkCursor *cursor);
void gdk_drag_context_cancel (GdkDragContext *context,
GdkDragCancelReason reason);
gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
gboolean gdk_drag_context_handle_dest_event (GdkEvent *event);
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
GdkDragAction action);
void gdk_drag_abort (GdkDragContext *context,
guint32 time_);
void gdk_drag_drop (GdkDragContext *context,
guint32 time_);
void gdk_drag_context_write_async (GdkDragContext *context,
const char *mime_type,
GOutputStream *stream,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean gdk_drag_context_write_finish (GdkDragContext *context,
GAsyncResult *result,
GError **error);
G_END_DECLS
#endif

792
gdk/gdkdrag.c Normal file
View File

@@ -0,0 +1,792 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkdragprivate.h"
#include "gdkdisplay.h"
#include "gdksurface.h"
#include "gdkintl.h"
#include "gdkcontentformats.h"
#include "gdkcontentprovider.h"
#include "gdkcontentserializer.h"
#include "gdkcursor.h"
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
static struct {
GdkDragAction action;
const gchar *name;
GdkCursor *cursor;
} drag_cursors[] = {
{ GDK_ACTION_ASK, "dnd-ask", NULL },
{ GDK_ACTION_COPY, "dnd-copy", NULL },
{ GDK_ACTION_MOVE, "dnd-move", NULL },
{ GDK_ACTION_LINK, "dnd-link", NULL },
{ 0, "dnd-none", NULL },
};
enum {
PROP_0,
PROP_CONTENT,
PROP_DEVICE,
PROP_DISPLAY,
PROP_FORMATS,
PROP_SELECTED_ACTION,
PROP_ACTIONS,
PROP_SURFACE,
N_PROPERTIES
};
enum {
CANCEL,
DROP_PERFORMED,
DND_FINISHED,
N_SIGNALS
};
typedef struct _GdkDragPrivate GdkDragPrivate;
struct _GdkDragPrivate {
GdkSurface *surface;
GdkDisplay *display;
GdkDevice *device;
GdkContentFormats *formats;
GdkContentProvider *content;
GdkDragAction actions;
GdkDragAction selected_action;
guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
};
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
static guint signals[N_SIGNALS] = { 0 };
static GList *drags = NULL;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrag, gdk_drag, G_TYPE_OBJECT)
/**
* SECTION:dnd
* @title: Drag And Drop
* @short_description: Functions for controlling drag and drop handling
*
* These functions provide a low level interface for drag and drop.
*
* The GdkDrag object represents the source side of an ongoing DND operation.
* It is created when a drag is started, and stays alive for duration of
* the DND operation.
*
* The GdkDrop object represents the target side of an ongoing DND operation.
*
* GTK+ provides a higher level abstraction based on top of these functions,
* and so they are not normally needed in GTK+ applications. See the
* [Drag and Drop][gtk4-Drag-and-Drop] section of the GTK+ documentation
* for more information.
*/
/**
* GdkDrag:
*
* The GdkDrag struct contains only private fields and
* should not be accessed directly.
*/
/**
* gdk_drag_get_display:
* @drag: a #GdkDrag
*
* Gets the #GdkDisplay that the drag object was created for.
*
* Returns: (transfer none): a #GdkDisplay
**/
GdkDisplay *
gdk_drag_get_display (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->display;
}
/**
* gdk_drag_get_formats:
* @drag: a #GdkDrag
*
* Retrieves the formats supported by this GdkDrag object.
*
* Returns: (transfer none): a #GdkContentFormats
**/
GdkContentFormats *
gdk_drag_get_formats (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->formats;
}
/**
* gdk_drag_get_actions:
* @drag: a #GdkDrag
*
* Determines the bitmask of possible actions proposed by the source.
*
* Returns: the #GdkDragAction flags
**/
GdkDragAction
gdk_drag_get_actions (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return priv->actions;
}
/**
* gdk_drag_get_selected_action:
* @drag: a #GdkDrag
*
* Determines the action chosen by the drag destination.
*
* Returns: a #GdkDragAction value
**/
GdkDragAction
gdk_drag_get_selected_action (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), 0);
return priv->selected_action;
}
/**
* gdk_drag_get_device:
* @drag: a #GdkDrag
*
* Returns the #GdkDevice associated to the GdkDrag object.
*
* Returns: (transfer none): The #GdkDevice associated to @drag.
**/
GdkDevice *
gdk_drag_get_device (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->device;
}
static void
gdk_drag_init (GdkDrag *drag)
{
drags = g_list_prepend (drags, drag);
}
static void
gdk_drag_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdkDrag *drag = GDK_DRAG (gobject);
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
switch (prop_id)
{
case PROP_CONTENT:
priv->content = g_value_dup_object (value);
if (priv->content)
{
g_assert (priv->formats == NULL);
priv->formats = gdk_content_provider_ref_formats (priv->content);
}
break;
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
priv->display = gdk_device_get_display (priv->device);
break;
case PROP_FORMATS:
if (priv->formats)
{
GdkContentFormats *override = g_value_dup_boxed (value);
if (override)
{
gdk_content_formats_unref (priv->formats);
priv->formats = override;
}
}
else
{
priv->formats = g_value_dup_boxed (value);
g_assert (priv->formats != NULL);
}
break;
case PROP_SELECTED_ACTION:
{
GdkDragAction action = g_value_get_flags (value);
gdk_drag_set_selected_action (drag, action);
}
break;
case PROP_ACTIONS:
{
GdkDragAction actions = g_value_get_flags (value);
gdk_drag_set_actions (drag, actions);
}
break;
case PROP_SURFACE:
priv->surface = g_value_dup_object (value);
g_assert (priv->surface != NULL);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gdk_drag_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdkDrag *drag = GDK_DRAG (gobject);
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
switch (prop_id)
{
case PROP_CONTENT:
g_value_set_object (value, priv->content);
break;
case PROP_DEVICE:
g_value_set_object (value, priv->device);
break;
case PROP_DISPLAY:
g_value_set_object (value, priv->display);
break;
case PROP_FORMATS:
g_value_set_boxed (value, priv->formats);
break;
case PROP_SELECTED_ACTION:
g_value_set_flags (value, priv->selected_action);
break;
case PROP_ACTIONS:
g_value_set_flags (value, priv->actions);
break;
case PROP_SURFACE:
g_value_set_object (value, priv->surface);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gdk_drag_finalize (GObject *object)
{
GdkDrag *drag = GDK_DRAG (object);
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
drags = g_list_remove (drags, drag);
g_clear_object (&priv->content);
g_clear_pointer (&priv->formats, gdk_content_formats_unref);
g_clear_object (&priv->surface);
G_OBJECT_CLASS (gdk_drag_parent_class)->finalize (object);
}
static void
gdk_drag_class_init (GdkDragClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = gdk_drag_get_property;
object_class->set_property = gdk_drag_set_property;
object_class->finalize = gdk_drag_finalize;
/**
* GdkDrag:content:
*
* The #GdkContentProvider.
*/
properties[PROP_CONTENT] =
g_param_spec_object ("content",
"Content",
"The content being dragged",
GDK_TYPE_CONTENT_PROVIDER,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrag:device:
*
* The #GdkDevice that is performing the drag.
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device",
"Device",
"The device performing the drag",
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrag:display:
*
* The #GdkDisplay that the drag belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrag:formats:
*
* The possible formats that the drag can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_SELECTED_ACTION] =
g_param_spec_flags ("selected-action",
"Selected action",
"The currently selected action",
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions",
"Actions",
"The possible actions",
GDK_TYPE_DRAG_ACTION,
0,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
properties[PROP_SURFACE] =
g_param_spec_object ("surface",
"Surface",
"The surface where the drag originates",
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrag::cancel:
* @drag: The object on which the signal is emitted
* @reason: The reason the drag was cancelled
*
* The drag operation was cancelled.
*/
signals[CANCEL] =
g_signal_new (g_intern_static_string ("cancel"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragClass, cancel),
NULL, NULL,
g_cclosure_marshal_VOID__ENUM,
G_TYPE_NONE, 1, GDK_TYPE_DRAG_CANCEL_REASON);
/**
* GdkDrag::drop-performed:
* @drag: The object on which the signal is emitted
*
* The drag operation was performed on an accepting client.
*/
signals[DROP_PERFORMED] =
g_signal_new (g_intern_static_string ("drop-performed"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragClass, drop_performed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* GdkDrag::dnd-finished:
* @drag: The object on which the signal is emitted
*
* The drag operation was finished, the destination
* finished reading all data. The drag object can now
* free all miscellaneous data.
*/
signals[DND_FINISHED] =
g_signal_new (g_intern_static_string ("dnd-finished"),
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkDragClass, dnd_finished),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
static void
gdk_drag_write_done (GObject *content,
GAsyncResult *result,
gpointer task)
{
GError *error = NULL;
if (gdk_content_provider_write_mime_type_finish (GDK_CONTENT_PROVIDER (content), result, &error))
g_task_return_boolean (task, TRUE);
else
g_task_return_error (task, error);
g_object_unref (task);
}
static void
gdk_drag_write_serialize_done (GObject *content,
GAsyncResult *result,
gpointer task)
{
GError *error = NULL;
if (gdk_content_serialize_finish (result, &error))
g_task_return_boolean (task, TRUE);
else
g_task_return_error (task, error);
g_object_unref (task);
}
void
gdk_drag_write_async (GdkDrag *drag,
const char *mime_type,
GOutputStream *stream,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
GdkContentFormats *formats, *mime_formats;
GTask *task;
GType gtype;
g_return_if_fail (GDK_IS_DRAG (drag));
g_return_if_fail (priv->content);
g_return_if_fail (mime_type != NULL);
g_return_if_fail (mime_type == g_intern_string (mime_type));
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
task = g_task_new (drag, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, gdk_drag_write_async);
formats = gdk_content_provider_ref_formats (priv->content);
if (gdk_content_formats_contain_mime_type (formats, mime_type))
{
gdk_content_provider_write_mime_type_async (priv->content,
mime_type,
stream,
io_priority,
cancellable,
gdk_drag_write_done,
task);
gdk_content_formats_unref (formats);
return;
}
mime_formats = gdk_content_formats_new ((const gchar *[2]) { mime_type, NULL }, 1);
mime_formats = gdk_content_formats_union_serialize_gtypes (mime_formats);
gtype = gdk_content_formats_match_gtype (formats, mime_formats);
if (gtype != G_TYPE_INVALID)
{
GValue value = G_VALUE_INIT;
GError *error = NULL;
g_assert (gtype != G_TYPE_INVALID);
g_value_init (&value, gtype);
if (gdk_content_provider_get_value (priv->content, &value, &error))
{
gdk_content_serialize_async (stream,
mime_type,
&value,
io_priority,
cancellable,
gdk_drag_write_serialize_done,
g_object_ref (task));
}
else
{
g_task_return_error (task, error);
}
g_value_unset (&value);
}
else
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible formats to transfer clipboard contents."));
}
gdk_content_formats_unref (mime_formats);
gdk_content_formats_unref (formats);
g_object_unref (task);
}
gboolean
gdk_drag_write_finish (GdkDrag *drag,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, drag), FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drag_write_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
void
gdk_drag_set_actions (GdkDrag *drag,
GdkDragAction actions)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
if (priv->actions == actions)
return;
priv->actions = actions;
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_ACTIONS]);
}
void
gdk_drag_set_selected_action (GdkDrag *drag,
GdkDragAction action)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
GdkCursor *cursor;
if (priv->selected_action == action)
return;
priv->selected_action = action;
cursor = gdk_drag_get_cursor (drag, action);
gdk_drag_set_cursor (drag, cursor);
g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_SELECTED_ACTION]);
}
/**
* gdk_drag_get_drag_surface:
* @drag: a #GdkDrag
*
* Returns the surface on which the drag icon should be rendered
* during the drag operation. Note that the surface may not be
* available until the drag operation has begun. GDK will move
* the surface in accordance with the ongoing drag operation.
* The surface is owned by @drag and will be destroyed when
* the drag operation is over.
*
* Returns: (nullable) (transfer none): the drag surface, or %NULL
*/
GdkSurface *
gdk_drag_get_drag_surface (GdkDrag *drag)
{
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
if (GDK_DRAG_GET_CLASS (drag)->get_drag_surface)
return GDK_DRAG_GET_CLASS (drag)->get_drag_surface (drag);
return NULL;
}
/**
* gdk_drag_set_hotspot:
* @drag: a #GdkDrag
* @hot_x: x coordinate of the drag surface hotspot
* @hot_y: y coordinate of the drag surface hotspot
*
* Sets the position of the drag surface that will be kept
* under the cursor hotspot. Initially, the hotspot is at the
* top left corner of the drag surface.
*/
void
gdk_drag_set_hotspot (GdkDrag *drag,
gint hot_x,
gint hot_y)
{
g_return_if_fail (GDK_IS_DRAG (drag));
if (GDK_DRAG_GET_CLASS (drag)->set_hotspot)
GDK_DRAG_GET_CLASS (drag)->set_hotspot (drag, hot_x, hot_y);
}
/**
* gdk_drag_drop_done:
* @drag: a #GdkDrag
* @success: whether the drag was ultimatively successful
*
* Inform GDK if the drop ended successfully. Passing %FALSE
* for @success may trigger a drag cancellation animation.
*
* This function is called by the drag source, and should
* be the last call before dropping the reference to the
* @drag.
*
* The #GdkDrag will only take the first gdk_drag_drop_done()
* call as effective, if this function is called multiple times,
* all subsequent calls will be ignored.
*/
void
gdk_drag_drop_done (GdkDrag *drag,
gboolean success)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_if_fail (GDK_IS_DRAG (drag));
if (priv->drop_done)
return;
priv->drop_done = TRUE;
if (GDK_DRAG_GET_CLASS (drag)->drop_done)
GDK_DRAG_GET_CLASS (drag)->drop_done (drag, success);
}
void
gdk_drag_set_cursor (GdkDrag *drag,
GdkCursor *cursor)
{
g_return_if_fail (GDK_IS_DRAG (drag));
if (GDK_DRAG_GET_CLASS (drag)->set_cursor)
GDK_DRAG_GET_CLASS (drag)->set_cursor (drag, cursor);
}
void
gdk_drag_cancel (GdkDrag *drag,
GdkDragCancelReason reason)
{
g_return_if_fail (GDK_IS_DRAG (drag));
g_signal_emit (drag, signals[CANCEL], 0, reason);
}
gboolean
gdk_drag_handle_source_event (GdkEvent *event)
{
GdkDrag *drag;
GList *l;
for (l = drags; l; l = l->next)
{
drag = l->data;
if (!GDK_DRAG_GET_CLASS (drag)->handle_event)
continue;
if (GDK_DRAG_GET_CLASS (drag)->handle_event (drag, event))
return TRUE;
}
return FALSE;
}
GdkCursor *
gdk_drag_get_cursor (GdkDrag *drag,
GdkDragAction action)
{
gint i;
for (i = 0 ; i < G_N_ELEMENTS (drag_cursors) - 1; i++)
if (drag_cursors[i].action == action)
break;
if (drag_cursors[i].cursor == NULL)
drag_cursors[i].cursor = gdk_cursor_new_from_name (drag_cursors[i].name, NULL);
return drag_cursors[i].cursor;
}
/**
* gdk_drag_action_is_unique:
* @action: a #GdkDragAction
*
* Checks if @action represents a single action or if it
* includes multiple flags that can be selected from.
*
* When @action is 0 - ie no action was given, %TRUE
* is returned.
*
* Returns: %TRUE if exactly one action was given
**/
gboolean
gdk_drag_action_is_unique (GdkDragAction action)
{
return (action & (action - 1)) == 0;
}

96
gdk/gdkdrag.h Normal file
View File

@@ -0,0 +1,96 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_DND_H__
#define __GDK_DND_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkevents.h>
G_BEGIN_DECLS
#define GDK_TYPE_DRAG (gdk_drag_get_type ())
#define GDK_DRAG(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG, GdkDrag))
#define GDK_IS_DRAG(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG))
/**
* GdkDragCancelReason:
* @GDK_DRAG_CANCEL_NO_TARGET: There is no suitable drop target.
* @GDK_DRAG_CANCEL_USER_CANCELLED: Drag cancelled by the user
* @GDK_DRAG_CANCEL_ERROR: Unspecified error.
*
* Used in #GdkDrag to the reason of a cancelled DND operation.
*/
typedef enum {
GDK_DRAG_CANCEL_NO_TARGET,
GDK_DRAG_CANCEL_USER_CANCELLED,
GDK_DRAG_CANCEL_ERROR
} GdkDragCancelReason;
GDK_AVAILABLE_IN_ALL
GType gdk_drag_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_drag_get_display (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_drag_get_device (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkContentFormats *gdk_drag_get_formats (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_actions (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
gboolean gdk_drag_action_is_unique (GdkDragAction action);
GDK_AVAILABLE_IN_ALL
GdkDrag * gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
GDK_AVAILABLE_IN_ALL
void gdk_drag_drop_done (GdkDrag *drag,
gboolean success);
GDK_AVAILABLE_IN_ALL
GdkSurface *gdk_drag_get_drag_surface (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
void gdk_drag_set_hotspot (GdkDrag *drag,
gint hot_x,
gint hot_y);
G_END_DECLS
#endif /* __GDK_DND_H__ */

86
gdk/gdkdragprivate.h Normal file
View File

@@ -0,0 +1,86 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2010, Red Hat, Inc
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 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_DND_PRIVATE_H__
#define __GDK_DND_PRIVATE_H__
#include "gdkdrag.h"
G_BEGIN_DECLS
#define GDK_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG, GdkDragClass))
#define GDK_IS_DRAG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG))
#define GDK_DRAG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG, GdkDragClass))
typedef struct _GdkDragClass GdkDragClass;
struct _GdkDragClass {
GObjectClass parent_class;
GdkSurface* (*get_drag_surface) (GdkDrag *drag);
void (*set_hotspot) (GdkDrag *drag,
gint hot_x,
gint hot_y);
void (*drop_done) (GdkDrag *drag,
gboolean success);
void (*set_cursor) (GdkDrag *drag,
GdkCursor *cursor);
void (*cancel) (GdkDrag *drag,
GdkDragCancelReason reason);
void (*drop_performed) (GdkDrag *drag,
guint32 time);
void (*dnd_finished) (GdkDrag *drag);
gboolean (*handle_event) (GdkDrag *drag,
const GdkEvent *event);
};
struct _GdkDrag {
GObject parent_instance;
};
void gdk_drag_set_cursor (GdkDrag *drag,
GdkCursor *cursor);
void gdk_drag_set_actions (GdkDrag *drag,
GdkDragAction actions);
void gdk_drag_set_selected_action (GdkDrag *drag,
GdkDragAction action);
void gdk_drag_cancel (GdkDrag *drag,
GdkDragCancelReason reason);
gboolean gdk_drag_handle_source_event (GdkEvent *event);
GdkCursor * gdk_drag_get_cursor (GdkDrag *drag,
GdkDragAction action);
void gdk_drag_write_async (GdkDrag *drag,
const char *mime_type,
GOutputStream *stream,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean gdk_drag_write_finish (GdkDrag *drag,
GAsyncResult *result,
GError **error);
G_END_DECLS
#endif

990
gdk/gdkdrop.c Normal file
View File

@@ -0,0 +1,990 @@
/*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#include "config.h"
#include "gdkdropprivate.h"
#include "gdkcontentdeserializer.h"
#include "gdkcontentformats.h"
#include "gdkcontentprovider.h"
#include "gdkcontentserializer.h"
#include "gdkcursor.h"
#include "gdkdisplay.h"
#include "gdkenumtypes.h"
#include "gdkeventsprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkpipeiostreamprivate.h"
#include "gdksurface.h"
typedef struct _GdkDropPrivate GdkDropPrivate;
struct _GdkDropPrivate {
GdkDevice *device;
GdkDrag *drag;
GdkContentFormats *formats;
GdkSurface *surface;
GdkDragAction actions;
};
enum {
PROP_0,
PROP_ACTIONS,
PROP_DEVICE,
PROP_DISPLAY,
PROP_DRAG,
PROP_FORMATS,
PROP_SURFACE,
N_PROPERTIES
};
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrop, gdk_drop, G_TYPE_OBJECT)
/**
* GdkDrop:
*
* The GdkDrop struct contains only private fields and
* should not be accessed directly.
*/
static void
gdk_drop_default_status (GdkDrop *self,
GdkDragAction actions)
{
}
static void
gdk_drop_read_local_write_done (GObject *drag,
GAsyncResult *result,
gpointer stream)
{
/* we don't care about the error, we just want to clean up */
gdk_drag_write_finish (GDK_DRAG (drag), result, NULL);
/* XXX: Do we need to close_async() here? */
g_output_stream_close (stream, NULL, NULL);
g_object_unref (stream);
}
static void
gdk_drop_read_local_async (GdkDrop *self,
GdkContentFormats *formats,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkContentFormats *content_formats;
const char *mime_type;
GTask *task;
GdkContentProvider *content;
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, gdk_drop_read_local_async);
if (priv->drag == NULL)
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Dragndrop from other applications is not supported."));
g_object_unref (task);
return;
}
g_object_get (priv->drag, "content", &content, NULL);
content_formats = gdk_content_provider_ref_formats (content);
g_object_unref (content);
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
if (mime_type != NULL)
{
GOutputStream *output_stream;
GIOStream *stream;
stream = gdk_pipe_io_stream_new ();
output_stream = g_io_stream_get_output_stream (stream);
gdk_drag_write_async (priv->drag,
mime_type,
output_stream,
io_priority,
cancellable,
gdk_drop_read_local_write_done,
g_object_ref (output_stream));
g_task_set_task_data (task, (gpointer) mime_type, NULL);
g_task_return_pointer (task, g_object_ref (g_io_stream_get_input_stream (stream)), g_object_unref);
g_object_unref (stream);
}
else
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible formats to transfer contents."));
}
gdk_content_formats_unref (content_formats);
g_object_unref (task);
}
static GInputStream *
gdk_drop_read_local_finish (GdkDrop *self,
const char **out_mime_type,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drop_read_local_async, NULL);
if (out_mime_type)
*out_mime_type = g_task_get_task_data (G_TASK (result));
return g_task_propagate_pointer (G_TASK (result), error);
}
static void
gdk_drop_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GdkDrop *self = GDK_DROP (gobject);
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
switch (prop_id)
{
case PROP_ACTIONS:
gdk_drop_set_actions (self, g_value_get_flags (value));
break;
case PROP_DEVICE:
priv->device = g_value_dup_object (value);
g_assert (priv->device != NULL);
if (priv->surface)
g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
break;
case PROP_DRAG:
priv->drag = g_value_dup_object (value);
break;
case PROP_FORMATS:
priv->formats = g_value_dup_boxed (value);
g_assert (priv->formats != NULL);
break;
case PROP_SURFACE:
priv->surface = g_value_dup_object (value);
g_assert (priv->surface != NULL);
if (priv->device)
g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gdk_drop_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GdkDrop *self = GDK_DROP (gobject);
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
switch (prop_id)
{
case PROP_ACTIONS:
g_value_set_flags (value, priv->actions);
break;
case PROP_DEVICE:
g_value_set_object (value, priv->device);
break;
case PROP_DISPLAY:
g_value_set_object (value, gdk_device_get_display (priv->device));
break;
case PROP_DRAG:
g_value_set_object (value, priv->drag);
break;
case PROP_FORMATS:
g_value_set_boxed (value, priv->formats);
break;
case PROP_SURFACE:
g_value_set_object (value, priv->surface);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
gdk_drop_finalize (GObject *object)
{
GdkDrop *self = GDK_DROP (object);
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_clear_object (&priv->device);
g_clear_object (&priv->drag);
G_OBJECT_CLASS (gdk_drop_parent_class)->finalize (object);
}
static void
gdk_drop_class_init (GdkDropClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->status = gdk_drop_default_status;
object_class->get_property = gdk_drop_get_property;
object_class->set_property = gdk_drop_set_property;
object_class->finalize = gdk_drop_finalize;
/**
* GdkDrop:actions:
*
* The possible actions for this drop
*/
properties[PROP_ACTIONS] =
g_param_spec_flags ("actions",
"Actions",
"The possible actions for this drop",
GDK_TYPE_DRAG_ACTION,
GDK_ACTION_ALL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrop:device:
*
* The #GdkDevice performing the drop
*/
properties[PROP_DEVICE] =
g_param_spec_object ("device",
"Device",
"The device performing the drop",
GDK_TYPE_DEVICE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrop:display:
*
* The #GdkDisplay that the drop belongs to.
*/
properties[PROP_DISPLAY] =
g_param_spec_object ("display",
"Display",
"Display this drag belongs to",
GDK_TYPE_DISPLAY,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrop:drag:
*
* The #GdkDrag that initiated this drop
*/
properties[PROP_DRAG] =
g_param_spec_object ("drag",
"Drag",
"The drag that initiated this drop",
GDK_TYPE_DRAG,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrop:formats:
*
* The possible formats that the drop can provide its data in.
*/
properties[PROP_FORMATS] =
g_param_spec_boxed ("formats",
"Formats",
"The possible formats for data",
GDK_TYPE_CONTENT_FORMATS,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrop:surface:
*
* The #GdkSurface the drop happens on
*/
properties[PROP_SURFACE] =
g_param_spec_object ("surface",
"Surface",
"The surface the drop is happening on",
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
}
static void
gdk_drop_init (GdkDrop *self)
{
}
/**
* gdk_drop_get_display:
* @self: a #GdkDrop
*
* Gets the #GdkDisplay that @self was created for.
*
* Returns: (transfer none): a #GdkDisplay
**/
GdkDisplay *
gdk_drop_get_display (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return gdk_device_get_display (priv->device);
}
/**
* gdk_drop_get_device:
* @self: a #GdkDrop
*
* Returns the #GdkDevice performing the drop.
*
* Returns: (transfer none): The #GdkDevice performing the drop.
**/
GdkDevice *
gdk_drop_get_device (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return priv->device;
}
/**
* gdk_drop_get_formats:
* @self: a #GdkDrop
*
* Returns the #GdkContentFormats that the drop offers the data
* to be read in.
*
* Returns: (transfer none): The possible #GdkContentFormats
**/
GdkContentFormats *
gdk_drop_get_formats (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return priv->formats;
}
/**
* gdk_drop_get_surface:
* @self: a #GdkDrop
*
* Returns the #GdkSurface performing the drop.
*
* Returns: (transfer none): The #GdkSurface performing the drop.
**/
GdkSurface *
gdk_drop_get_surface (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
return priv->surface;
}
/**
* gdk_drop_get_actions:
* @self: a #GdkDrop
*
* Returns the possible actions for this #GdkDrop. If this value
* contains multiple actions - ie gdk_drag_action_is_unique()
* returns %FALSE for the result - gdk_drag_finish() must choose
* the action to use when accepting the drop.
*
* This value may change over the lifetime of the #GdkDrop both
* as a response to source side actions as well as to calls to
* gdk_drop_status() or gdk_drag_finish(). The source side will
* not change this value anymore once a drop has started.
*
* Returns: The possible #GdkDragActions
**/
GdkDragAction
gdk_drop_get_actions (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), 0);
return priv->actions;
}
void
gdk_drop_set_actions (GdkDrop *self,
GdkDragAction actions)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_if_fail (GDK_IS_DROP (self));
g_return_if_fail ((actions & GDK_ACTION_ASK) == 0);
if (priv->actions == actions)
return;
priv->actions = actions;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ACTIONS]);
}
/**
* gdk_drop_get_drag:
* @self: a #GdkDrop
*
* If this is an in-app drag-and-drop operation, returns the #GdkDrag
* that corresponds to this drop.
*
* If it is not, %NULL is returned.
*
* Returns: (transfer none) (nullable): the corresponding #GdkDrag
**/
GdkDrag *
gdk_drop_get_drag (GdkDrop *self)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DROP (self), 0);
return priv->drag;
}
/**
* gdk_drop_status:
* @self: a #GdkDrop
* @actions: Supported actions of the destination, or 0 to indicate
* that a drop will not be accepted
*
* Selects all actions that are potentially supported by the destination.
*
* When calling this function, do not restrict the passed in actions to
* the ones provided by gdk_drop_get_actions(). Those actions may
* change in the future, even depending on the actions you provide here.
*
* This function should be called by drag destinations in response to
* %GDK_DRAG_ENTER or %GDK_DRAG_MOTION events. If the destination does
* not yet know the exact actions it supports, it should set any possible
* actions first and then later call this function again.
*/
void
gdk_drop_status (GdkDrop *self,
GdkDragAction actions)
{
g_return_if_fail (GDK_IS_DROP (self));
GDK_DROP_GET_CLASS (self)->status (self, actions);
}
/**
* gdk_drop_finish:
* @self: a #GdkDrop
* @action: the action performed by the destination or 0 if the drop
* failed
*
* Ends the drag operation after a drop.
*
* The @action must be a single action selected from the actions
* available via gdk_drop_get_actions().
**/
void
gdk_drop_finish (GdkDrop *self,
GdkDragAction action)
{
g_return_if_fail (GDK_IS_DROP (self));
g_return_if_fail (gdk_drag_action_is_unique (action));
GDK_DROP_GET_CLASS (self)->finish (self, action);
}
static void
gdk_drop_read_internal (GdkDrop *self,
GdkContentFormats *formats,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
if (priv->drag)
{
gdk_drop_read_local_async (self,
formats,
io_priority,
cancellable,
callback,
user_data);
}
else
{
GDK_DROP_GET_CLASS (self)->read_async (self,
formats,
io_priority,
cancellable,
callback,
user_data);
}
}
/**
* gdk_drop_read_async:
* @self: a #GdkDrop
* @mime_types: (array zero-terminated=1) (element-type utf8):
* pointer to an array of mime types
* @io_priority: the io priority for the read operation
* @cancellable: (allow-none): optional #GCancellable object,
* %NULL to ignore
* @callback: (scope async): a #GAsyncReadyCallback to call when
* the request is satisfied
* @user_data: (closure): the data to pass to @callback
*
* Asynchronously read the dropped data from a #GdkDrop
* in a format that complies with one of the mime types.
*/
void
gdk_drop_read_async (GdkDrop *self,
const char **mime_types,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkContentFormats *formats;
g_return_if_fail (GDK_IS_DROP (self));
g_return_if_fail (mime_types != NULL && mime_types[0] != NULL);
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
formats = gdk_content_formats_new (mime_types, g_strv_length ((char **) mime_types));
gdk_drop_read_internal (self, formats, io_priority, cancellable, callback, user_data);
gdk_content_formats_unref (formats);
}
/**
* gdk_drop_read_finish:
* @self: a #GdkDrop
* @out_mime_type: (out) (type utf8): return location for the used mime type
* @result: a #GAsyncResult
* @error: (allow-none): location to store error information on failure, or %NULL
*
* Finishes an async drop read operation, see gdk_drop_read_async().
*
* Returns: (nullable) (transfer full): the #GInputStream, or %NULL
*/
GInputStream *
gdk_drop_read_finish (GdkDrop *self,
const char **out_mime_type,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (GDK_IS_DROP (self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (g_async_result_is_tagged (result, gdk_drop_read_local_async))
{
return gdk_drop_read_local_finish (self, out_mime_type, result, error);
}
else
{
return GDK_DROP_GET_CLASS (self)->read_finish (self, out_mime_type, result, error);
}
}
static void
gdk_drop_read_value_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GTask *task = data;
GError *error = NULL;
GValue *value;
value = g_task_get_task_data (task);
if (!gdk_content_deserialize_finish (result, value, &error))
g_task_return_error (task, error);
else
g_task_return_pointer (task, value, NULL);
g_object_unref (task);
}
static void
gdk_drop_read_value_got_stream (GObject *source,
GAsyncResult *result,
gpointer data)
{
GInputStream *stream;
GError *error = NULL;
GTask *task = data;
const char *mime_type;
stream = gdk_drop_read_finish (GDK_DROP (source), &mime_type, result, &error);
if (stream == NULL)
{
g_task_return_error (task, error);
return;
}
gdk_content_deserialize_async (stream,
mime_type,
G_VALUE_TYPE (g_task_get_task_data (task)),
g_task_get_priority (task),
g_task_get_cancellable (task),
gdk_drop_read_value_done,
task);
g_object_unref (stream);
}
static void
free_value (gpointer value)
{
g_value_unset (value);
g_slice_free (GValue, value);
}
static void
gdk_drop_read_value_internal (GdkDrop *self,
GType type,
gpointer source_tag,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkContentFormatsBuilder *builder;
GdkContentFormats *formats;
GValue *value;
GTask *task;
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_priority (task, io_priority);
g_task_set_source_tag (task, source_tag);
value = g_slice_new0 (GValue);
g_value_init (value, type);
g_task_set_task_data (task, value, free_value);
if (priv->drag)
{
GError *error = NULL;
GdkContentProvider *content;
gboolean res;
g_object_get (priv->drag, "content", &content, NULL);
res = gdk_content_provider_get_value (content, value, &error);
g_object_unref (content);
if (res)
{
g_task_return_pointer (task, value, NULL);
g_object_unref (task);
return;
}
else if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
{
g_task_return_error (task, error);
g_object_unref (task);
return;
}
else
{
/* fall through to regular stream transfer */
g_clear_error (&error);
}
}
builder = gdk_content_formats_builder_new ();
gdk_content_formats_builder_add_gtype (builder, type);
formats = gdk_content_formats_builder_free_to_formats (builder);
formats = gdk_content_formats_union_deserialize_mime_types (formats);
gdk_drop_read_internal (self,
formats,
io_priority,
cancellable,
gdk_drop_read_value_got_stream,
task);
gdk_content_formats_unref (formats);
}
/**
* gdk_drop_read_value_async:
* @self: a #GdkDrop
* @type: a #GType to read
* @io_priority: the [I/O priority][io-priority]
* of the request.
* @cancellable: (nullable): optional #GCancellable object, %NULL to ignore.
* @callback: (scope async): callback to call when the request is satisfied
* @user_data: (closure): the data to pass to callback function
*
* Asynchronously request the drag operation's contents converted to the given
* @type. When the operation is finished @callback will be called.
* You can then call gdk_drop_read_value_finish() to get the resulting
* #GValue.
*
* For local drag'n'drop operations that are available in the given #GType, the
* value will be copied directly. Otherwise, GDK will try to use
* gdk_content_deserialize_async() to convert the data.
**/
void
gdk_drop_read_value_async (GdkDrop *self,
GType type,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_return_if_fail (GDK_IS_DROP (self));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
gdk_drop_read_value_internal (self,
type,
gdk_drop_read_value_async,
io_priority,
cancellable,
callback,
user_data);
}
/**
* gdk_drop_read_value_finish:
* @self: a #GdkDrop
* @result: a #GAsyncResult
* @error: a #GError location to store the error occurring, or %NULL to
* ignore.
*
* Finishes an async drop read started with
* gdk_drop_read_value_async().
*
* Returns: (transfer none): a #GValue containing the result.
**/
const GValue *
gdk_drop_read_value_finish (GdkDrop *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drop_read_value_async, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return g_task_propagate_pointer (G_TASK (result), error);
}
/**
* gdk_drop_read_text_async:
* @self: a #GdkDrop
* @cancellable: (nullable): optional #GCancellable object, %NULL to ignore.
* @callback: (scope async): callback to call when the request is satisfied
* @user_data: (closure): the data to pass to callback function
*
* Asynchronously request the drag operation's contents converted to a string.
* When the operation is finished @callback will be called. You can then
* call gdk_drop_read_text_finish() to get the result.
*
* This is a simple wrapper around gdk_drop_read_value_async(). Use
* that function or gdk_drop_read_async() directly if you need more
* control over the operation.
**/
void
gdk_drop_read_text_async (GdkDrop *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_return_if_fail (GDK_IS_DROP (self));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
g_return_if_fail (callback != NULL);
gdk_drop_read_value_internal (self,
G_TYPE_STRING,
gdk_drop_read_text_async,
G_PRIORITY_DEFAULT,
cancellable,
callback,
user_data);
}
/**
* gdk_drop_read_text_finish:
* @self: a #GdkDrop
* @result: a #GAsyncResult
* @error: a #GError location to store the error occurring, or %NULL to
* ignore.
*
* Finishes an asynchronous read started with
* gdk_drop_read_text_async().
*
* Returns: (transfer full) (nullable): a new string or %NULL on error.
**/
char *
gdk_drop_read_text_finish (GdkDrop *self,
GAsyncResult *result,
GError **error)
{
const GValue *value;
g_return_val_if_fail (g_task_is_valid (result, self), NULL);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gdk_drop_read_text_async, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
value = g_task_propagate_pointer (G_TASK (result), error);
if (!value)
return NULL;
return g_value_dup_string (value);
}
static void
gdk_drop_do_emit_event (GdkEvent *event,
gboolean dont_queue)
{
if (dont_queue)
{
_gdk_event_emit (event);
g_object_unref (event);
}
else
{
_gdk_event_queue_append (gdk_event_get_display (event), event);
}
}
void
gdk_drop_emit_enter_event (GdkDrop *self,
gboolean dont_queue,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DRAG_ENTER);
event->any.surface = g_object_ref (priv->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
gdk_event_set_device (event, priv->device);
gdk_drop_do_emit_event (event, dont_queue);
}
void
gdk_drop_emit_motion_event (GdkDrop *self,
gboolean dont_queue,
double x_root,
double y_root,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DRAG_MOTION);
event->any.surface = g_object_ref (priv->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
event->dnd.x_root = x_root;
event->dnd.y_root = y_root;
gdk_event_set_device (event, priv->device);
gdk_drop_do_emit_event (event, dont_queue);
}
void
gdk_drop_emit_leave_event (GdkDrop *self,
gboolean dont_queue,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DRAG_LEAVE);
event->any.surface = g_object_ref (priv->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
gdk_event_set_device (event, priv->device);
gdk_drop_do_emit_event (event, dont_queue);
}
void
gdk_drop_emit_drop_event (GdkDrop *self,
gboolean dont_queue,
double x_root,
double y_root,
guint32 time)
{
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
GdkEvent *event;
event = gdk_event_new (GDK_DROP_START);
event->any.surface = g_object_ref (priv->surface);
event->dnd.drop = g_object_ref (self);
event->dnd.time = time;
event->dnd.x_root = x_root;
event->dnd.y_root = y_root;
gdk_event_set_device (event, priv->device);
gdk_drop_do_emit_event (event, dont_queue);
}

98
gdk/gdkdrop.h Normal file
View File

@@ -0,0 +1,98 @@
/*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#ifndef __GDK_DROP_H__
#define __GDK_DROP_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkDrop, g_object_unref)
#define GDK_TYPE_DROP (gdk_drop_get_type ())
#define GDK_DROP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DROP, GdkDrop))
#define GDK_IS_DROP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DROP))
GDK_AVAILABLE_IN_ALL
GType gdk_drop_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_drop_get_display (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
GdkDevice * gdk_drop_get_device (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_drop_get_surface (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
GdkContentFormats * gdk_drop_get_formats (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drop_get_actions (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
GdkDrag * gdk_drop_get_drag (GdkDrop *self);
GDK_AVAILABLE_IN_ALL
void gdk_drop_status (GdkDrop *self,
GdkDragAction actions);
GDK_AVAILABLE_IN_ALL
void gdk_drop_finish (GdkDrop *self,
GdkDragAction action);
GDK_AVAILABLE_IN_ALL
void gdk_drop_read_async (GdkDrop *self,
const char **mime_types,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
GInputStream * gdk_drop_read_finish (GdkDrop *self,
const char **out_mime_type,
GAsyncResult *result,
GError **error);
GDK_AVAILABLE_IN_ALL
void gdk_drop_read_value_async (GdkDrop *self,
GType type,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
const GValue * gdk_drop_read_value_finish (GdkDrop *self,
GAsyncResult *result,
GError **error);
GDK_AVAILABLE_IN_ALL
void gdk_drop_read_text_async (GdkDrop *self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
char * gdk_drop_read_text_finish (GdkDrop *self,
GAsyncResult *result,
GError **error);
G_END_DECLS
#endif /* __GDK_DROP_H__ */

81
gdk/gdkdropprivate.h Normal file
View File

@@ -0,0 +1,81 @@
/*
* Copyright © 2018 Benjamin Otte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#ifndef __GDK_DROP_PRIVATE_H__
#define __GDK_DROP_PRIVATE_H__
#include "gdkdrop.h"
G_BEGIN_DECLS
#define GDK_DROP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DROP, GdkDropClass))
#define GDK_IS_DROP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DROP))
#define GDK_DROP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DROP, GdkDropClass))
typedef struct _GdkDropClass GdkDropClass;
struct _GdkDrop {
GObject parent_instance;
};
struct _GdkDropClass {
GObjectClass parent_class;
void (* status) (GdkDrop *self,
GdkDragAction actions);
void (* finish) (GdkDrop *self,
GdkDragAction action);
void (* read_async) (GdkDrop *self,
GdkContentFormats *formats,
int io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GInputStream * (* read_finish) (GdkDrop *self,
const char **out_mime_type,
GAsyncResult *result,
GError **error);
};
void gdk_drop_set_actions (GdkDrop *self,
GdkDragAction actions);
void gdk_drop_emit_enter_event (GdkDrop *self,
gboolean dont_queue,
guint32 time);
void gdk_drop_emit_motion_event (GdkDrop *self,
gboolean dont_queue,
double x_root,
double y_root,
guint32 time);
void gdk_drop_emit_leave_event (GdkDrop *self,
gboolean dont_queue,
guint32 time);
void gdk_drop_emit_drop_event (GdkDrop *self,
gboolean dont_queue,
double x_root,
double y_root,
guint32 time);
G_END_DECLS
#endif

View File

@@ -28,7 +28,8 @@
#include "gdkeventsprivate.h"
#include "gdkinternals.h"
#include "gdkdisplayprivate.h"
#include "gdkdndprivate.h"
#include "gdkdragprivate.h"
#include "gdkdropprivate.h"
#include "gdk-private.h"
#include <string.h>
@@ -164,14 +165,14 @@ gdk_event_class_init (GdkEventClass *klass)
void
_gdk_event_emit (GdkEvent *event)
{
if (gdk_drag_context_handle_source_event (event))
if (gdk_drag_handle_source_event (event))
return;
if (gdk_surface_handle_event (event))
return;
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
if (gdk_drag_context_handle_dest_event (event))
return;
}
/*********************************************
@@ -630,11 +631,6 @@ gdk_event_copy (const GdkEvent *event)
switch ((guint) event->any.type)
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
new_event->key.string = g_strdup (event->key.string);
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
if (event->crossing.child_surface != NULL)
@@ -645,12 +641,7 @@ gdk_event_copy (const GdkEvent *event)
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
case GDK_DROP_START:
g_object_ref (event->dnd.context);
break;
case GDK_EXPOSE:
if (event->expose.region)
new_event->expose.region = cairo_region_copy (event->expose.region);
g_object_ref (event->dnd.drop);
break;
case GDK_BUTTON_PRESS:
@@ -702,11 +693,6 @@ gdk_event_finalize (GObject *object)
switch ((guint) event->any.type)
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
g_free (event->key.string);
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
g_clear_object (&event->crossing.child_surface);
@@ -716,8 +702,7 @@ gdk_event_finalize (GObject *object)
case GDK_DRAG_LEAVE:
case GDK_DRAG_MOTION:
case GDK_DROP_START:
if (event->dnd.context != NULL)
g_object_unref (event->dnd.context);
g_clear_object (&event->dnd.drop);
break;
case GDK_BUTTON_PRESS:
@@ -733,11 +718,6 @@ gdk_event_finalize (GObject *object)
g_free (event->touch.axes);
break;
case GDK_EXPOSE:
if (event->expose.region)
cairo_region_destroy (event->expose.region);
break;
case GDK_MOTION_NOTIFY:
g_clear_object (&event->motion.tool);
g_free (event->motion.axes);
@@ -835,9 +815,6 @@ gdk_event_get_time (const GdkEvent *event)
case GDK_NOTHING:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_EXPOSE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_GRAB_BROKEN:
case GDK_EVENT_LAST:
default:
@@ -911,9 +888,6 @@ gdk_event_get_state (const GdkEvent *event,
case GDK_NOTHING:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_EXPOSE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_GRAB_BROKEN:
case GDK_PAD_BUTTON_PRESS:
case GDK_PAD_BUTTON_RELEASE:
@@ -1309,37 +1283,6 @@ gdk_event_get_key_group (const GdkEvent *event,
return fetched;
}
/**
* gdk_event_get_string:
* @event: a #GdkEvent
* @string: (out) (transfer none): return location for the string
*
* Extracts a string from an event. The string is an
* approximation of the keyval in a key event.
*
* Returns: %TRUE on success, otherwise %FALSE
**/
gboolean
gdk_event_get_string (const GdkEvent *event,
const char **string)
{
gboolean fetched = TRUE;
switch ((guint) event->any.type)
{
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
*string = event->key.string;
break;
default:
*string = NULL;
fetched = FALSE;
break;
}
return fetched;
}
/**
* gdk_event_get_key_is_modifier:
* @event: a #GdkEvent
@@ -2061,17 +2004,15 @@ gdk_event_is_sent (const GdkEvent *event)
}
/**
* gdk_event_get_drag_context:
* gdk_event_get_drop:
* @event: a #GdkEvent
* @context: (out) (transfer none): return location for the drag context
*
* Gets the drag context from a DND event.
* Gets the #GdkDrop from a DND event.
*
* Returns: %TRUE on success, otherwise %FALSE
* Returns: (transfer none) (nullable): the drop
**/
gboolean
gdk_event_get_drag_context (const GdkEvent *event,
GdkDragContext **context)
GdkDrop *
gdk_event_get_drop (const GdkEvent *event)
{
if (!event)
return FALSE;
@@ -2081,11 +2022,10 @@ gdk_event_get_drag_context (const GdkEvent *event,
event->any.type == GDK_DRAG_MOTION ||
event->any.type == GDK_DROP_START)
{
*context = event->dnd.context;
return TRUE;
return event->dnd.drop;
}
return FALSE;
return NULL;
}
/**
@@ -2510,8 +2450,6 @@ gdk_event_get_axes (GdkEvent *event,
*
* Returns: (transfer container) (element-type GdkTimeCoord) (nullable): a list
* of time and coordinates
*
* Since: 3.94
*/
GList *
gdk_event_get_motion_history (const GdkEvent *event)

View File

@@ -31,7 +31,7 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdnd.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
@@ -54,7 +54,7 @@ G_BEGIN_DECLS
#define GDK_PRIORITY_EVENTS (G_PRIORITY_DEFAULT)
/**
* GDK_PRIORITY_REDRAW:
* GDK_PRIORITY_REDRAW: (value 120)
*
* This is the priority that the idle handler processing surface updates
* is given in the
@@ -67,8 +67,6 @@ G_BEGIN_DECLS
*
* Use this macro as the return value for continuing the propagation of
* an event handler.
*
* Since: 3.4
*/
#define GDK_EVENT_PROPAGATE (FALSE)
@@ -77,8 +75,6 @@ G_BEGIN_DECLS
*
* Use this macro as the return value for stopping the propagation of
* an event handler.
*
* Since: 3.4
*/
#define GDK_EVENT_STOP (TRUE)
@@ -87,8 +83,6 @@ G_BEGIN_DECLS
*
* The primary button. This is typically the left mouse button, or the
* right button in a left-handed setup.
*
* Since: 3.4
*/
#define GDK_BUTTON_PRIMARY (1)
@@ -96,8 +90,6 @@ G_BEGIN_DECLS
* GDK_BUTTON_MIDDLE:
*
* The middle button.
*
* Since: 3.4
*/
#define GDK_BUTTON_MIDDLE (2)
@@ -106,15 +98,12 @@ G_BEGIN_DECLS
*
* The secondary button. This is typically the right mouse button, or the
* left button in a left-handed setup.
*
* Since: 3.4
*/
#define GDK_BUTTON_SECONDARY (3)
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose;
typedef struct _GdkEventMotion GdkEventMotion;
typedef struct _GdkEventButton GdkEventButton;
typedef struct _GdkEventTouch GdkEventTouch;
@@ -155,8 +144,6 @@ typedef void (*GdkEventFunc) (GdkEvent *event,
* hidden or destroyed, usually when the user clicks on a special icon in the
* title bar.
* @GDK_DESTROY: the surface has been destroyed.
* @GDK_EXPOSE: all or part of the surface has become visible and needs to be
* redrawn.
* @GDK_MOTION_NOTIFY: the pointer (usually a mouse) has moved.
* @GDK_BUTTON_PRESS: a mouse button has been pressed.
* @GDK_BUTTON_RELEASE: a mouse button has been released.
@@ -167,8 +154,6 @@ typedef void (*GdkEventFunc) (GdkEvent *event,
* @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface.
* @GDK_CONFIGURE: the size, position or stacking order of the surface has changed.
* Note that GTK+ discards these events for %GDK_SURFACE_CHILD surfaces.
* @GDK_MAP: the surface has been mapped.
* @GDK_UNMAP: the surface has been unmapped.
* @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
* surface (e.g. a touchscreen or graphics tablet).
* @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
@@ -216,7 +201,6 @@ typedef enum
GDK_NOTHING,
GDK_DELETE,
GDK_DESTROY,
GDK_EXPOSE,
GDK_MOTION_NOTIFY,
GDK_BUTTON_PRESS,
GDK_BUTTON_RELEASE,
@@ -226,8 +210,6 @@ typedef enum
GDK_LEAVE_NOTIFY,
GDK_FOCUS_CHANGE,
GDK_CONFIGURE,
GDK_MAP,
GDK_UNMAP,
GDK_PROXIMITY_IN,
GDK_PROXIMITY_OUT,
GDK_DRAG_ENTER,
@@ -291,7 +273,7 @@ typedef enum
* @GDK_SCROLL_LEFT: the surface is scrolled to the left.
* @GDK_SCROLL_RIGHT: the surface is scrolled to the right.
* @GDK_SCROLL_SMOOTH: the scrolling is determined by the delta values
* in scroll events. See gdk_event_get_scroll_deltas(). Since: 3.4
* in scroll events. See gdk_event_get_scroll_deltas()
*
* Specifies the direction for scroll events.
*/
@@ -421,9 +403,6 @@ gboolean gdk_event_get_key_is_modifier (const GdkEvent *event,
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_key_group (const GdkEvent *event,
guint *group);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_string (const GdkEvent *event,
const char **string);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_scroll_direction (const GdkEvent *event,
@@ -513,8 +492,7 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_event_is_sent (const GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_drag_context (const GdkEvent *event,
GdkDragContext **context);
GdkDrop * gdk_event_get_drop (const GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_event_get_crossing_mode (const GdkEvent *event,

View File

@@ -26,7 +26,7 @@
#define __GDK_EVENTS_PRIVATE_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkdnd.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
@@ -63,23 +63,6 @@ struct _GdkEventAny
GdkDisplay *display;
};
/*
* GdkEventExpose:
* @type: the type of the event (%GDK_EXPOSE)
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @area: bounding box of @region.
* @region: the region that needs to be redrawn.
*
* Generated when all or part of a surface becomes visible and needs to be
* redrawn.
*/
struct _GdkEventExpose
{
GdkEventAny any;
cairo_region_t *region;
};
/*
* GdkEventMotion:
* @type: the type of the event.
@@ -261,22 +244,10 @@ struct _GdkEventScroll
* @keyval: the key that was pressed or released. See the
* `gdk/gdkkeysyms.h` header file for a
* complete list of GDK key codes.
* @length: the length of @string.
* @string: a string containing an approximation of the text that
* would result from this keypress. The only correct way to handle text
* input of text is using input methods (see #GtkIMContext), so this
* field is deprecated and should never be used.
* (gdk_unicode_to_keyval() provides a non-deprecated way of getting
* an approximate translation for a key.) The string is encoded in the
* encoding of the current locale (Note: this for backwards compatibility:
* strings in GTK+ and GDK are typically in UTF-8.) and NUL-terminated.
* In some cases, the translation of the key code will be a single
* NUL byte, in which case looking at @length is necessary to distinguish
* it from the an empty translation.
* @hardware_keycode: the raw code of the key that was pressed or released.
* @group: the keyboard group.
* @is_modifier: a flag that indicates if @hardware_keycode is mapped to a
* modifier. Since 2.10
* modifier
*
* Describes a key press or key release event.
*/
@@ -286,8 +257,6 @@ struct _GdkEventKey
guint32 time;
guint state;
guint keyval;
gint length;
gchar *string;
guint16 hardware_keycode;
guint16 key_scancode;
guint8 group;
@@ -414,8 +383,6 @@ struct _GdkEventProximity
* is unmapped), or if the same application grabs the pointer or keyboard
* again. Note that implicit grabs (which are initiated by button presses)
* can also cause #GdkEventGrabBroken events.
*
* Since: 2.8
*/
struct _GdkEventGrabBroken {
GdkEventAny any;
@@ -430,7 +397,7 @@ struct _GdkEventGrabBroken {
* %GDK_DRAG_MOTION or %GDK_DROP_START)
* @surface: the surface which received the event.
* @send_event: %TRUE if the event was sent explicitly.
* @context: the #GdkDragContext for the current DND operation.
* @drop: the #GdkDrop for the current DND operation.
* @time: the time of the event in milliseconds.
* @x_root: the x coordinate of the pointer relative to the root of the
* screen, only set for %GDK_DRAG_MOTION and %GDK_DROP_START.
@@ -441,7 +408,7 @@ struct _GdkEventGrabBroken {
*/
struct _GdkEventDND {
GdkEventAny any;
GdkDragContext *context;
GdkDrop *drop;
guint32 time;
gshort x_root, y_root;
@@ -536,8 +503,6 @@ struct _GdkEventTouchpadPinch {
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD button presses and releases.
*
* Since: 3.22
*/
struct _GdkEventPadButton {
GdkEventAny any;
@@ -562,8 +527,6 @@ struct _GdkEventPadButton {
* @value: The current value for the given axis.
*
* Generated during %GDK_SOURCE_TABLET_PAD interaction with tactile sensors.
*
* Since: 3.22
*/
struct _GdkEventPadAxis {
GdkEventAny any;
@@ -587,8 +550,6 @@ struct _GdkEventPadAxis {
* device may have different current modes.
*
* Generated during %GDK_SOURCE_TABLET_PAD mode switches in a group.
*
* Since: 3.22
*/
struct _GdkEventPadGroupMode {
GdkEventAny any;
@@ -601,7 +562,6 @@ struct _GdkEventPadGroupMode {
* GdkEvent:
* @type: the #GdkEventType
* @any: a #GdkEventAny
* @expose: a #GdkEventExpose
* @motion: a #GdkEventMotion
* @button: a #GdkEventButton
* @touch: a #GdkEventTouch
@@ -653,7 +613,6 @@ struct _GdkEventPadGroupMode {
union _GdkEvent
{
GdkEventAny any;
GdkEventExpose expose;
GdkEventMotion motion;
GdkEventButton button;
GdkEventTouch touch;

View File

@@ -58,8 +58,6 @@ typedef struct _GdkFrameClockClass GdkFrameClockClass;
* #GdkFrameClockPhase is used to represent the different paint clock
* phases that can be requested. The elements of the enumeration
* correspond to the signals of #GdkFrameClock.
*
* Since: 3.8
**/
typedef enum {
GDK_FRAME_CLOCK_PHASE_NONE = 0,

View File

@@ -32,7 +32,7 @@
#include "gdkdisplay.h"
#include "gdkeventsprivate.h"
#include "gdkenumtypes.h"
#include "gdkdndprivate.h"
#include "gdkdragprivate.h"
G_BEGIN_DECLS
@@ -150,7 +150,6 @@ struct _GdkSurface
gint x;
gint y;
GdkEventMask event_mask;
guint8 surface_type;
guint8 resize_count;
@@ -206,7 +205,6 @@ struct _GdkSurface
cairo_region_t *input_shape;
GList *devices_inside;
GHashTable *device_events;
GdkFrameClock *frame_clock; /* NULL to use from parent or default */
@@ -293,6 +291,8 @@ GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
void gdk_surface_get_unscaled_size (GdkSurface *surface,
int *unscaled_width,
int *unscaled_height);
gboolean gdk_surface_handle_event (GdkEvent *event);
/*****************************************
* Interfaces provided by windowing code *

View File

@@ -50,8 +50,6 @@ typedef struct _GdkMonitorClass GdkMonitorClass;
*
* This enumeration describes how the red, green and blue components
* of physical pixels on an output device are laid out.
*
* Since: 3.22
*/
typedef enum {
GDK_SUBPIXEL_LAYOUT_UNKNOWN,

View File

@@ -643,8 +643,8 @@ gdk_paintable_new_empty (int intrinsic_width,
{
GdkEmptyPaintable *result;
g_return_val_if_fail (intrinsic_width < 0, NULL);
g_return_val_if_fail (intrinsic_height < 0, NULL);
g_return_val_if_fail (intrinsic_width >= 0, NULL);
g_return_val_if_fail (intrinsic_height >= 0, NULL);
result = g_object_new (GDK_TYPE_EMPTY_PAINTABLE, NULL);

View File

@@ -175,7 +175,7 @@ parse_rgb_value (const gchar *str,
* - A RGBA color in the form “rgba(r,g,b,a)”
*
* Where “r”, “g”, “b” and “a” are respectively the red, green, blue and
* alpha color values. In the last two cases, r g and b are either integers
* alpha color values. In the last two cases, “r”, “g”, and “b” are either integers
* in the range 0 to 255 or percentage values in the range 0% to 100%, and
* a is a floating point value in the range 0 to 1.
*
@@ -353,18 +353,18 @@ gdk_rgba_equal (gconstpointer p1,
* @rgba: a #GdkRGBA
*
* Returns a textual specification of @rgba in the form
* `rgb (r, g, b)` or
* `rgba (r, g, b, a)`,
* `rgb(r,g,b)` or
* `rgba(r g,b,a)`,
* where “r”, “g”, “b” and “a” represent the red, green,
* blue and alpha values respectively. r, g, and b are
* represented as integers in the range 0 to 255, and a
* is represented as floating point value in the range 0 to 1.
* blue and alpha values respectively. “r”, “g”, and “b” are
* represented as integers in the range 0 to 255, and “a”
* is represented as a floating point value in the range 0 to 1.
*
* These string forms are string forms those supported by
* These string forms are string forms that are supported by
* the CSS3 colors module, and can be parsed by gdk_rgba_parse().
*
* Note that this string representation may lose some
* precision, since r, g and b are represented as 8-bit
* precision, since “r”, “g” and “b” are represented as 8-bit
* integers. If this is a concern, you should use a
* different representation.
*

View File

@@ -434,14 +434,15 @@ gdk_seat_tool_removed (GdkSeat *seat,
GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial)
guint64 serial,
guint64 hw_id)
{
GdkSeatClass *seat_class;
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
seat_class = GDK_SEAT_GET_CLASS (seat);
return seat_class->get_tool (seat, serial);
return seat_class->get_tool (seat, serial, hw_id);
}
/**

View File

@@ -47,8 +47,6 @@ G_BEGIN_DECLS
* @GDK_SEAT_CAPABILITY_ALL: The union of all capabilities
*
* Flags describing the seat capabilities.
*
* Since: 3.20
*/
typedef enum {
GDK_SEAT_CAPABILITY_NONE = 0,
@@ -71,8 +69,6 @@ typedef enum {
* grabbed. A typical action would be ensuring the surface is
* visible, although there's room for other initialization
* actions.
*
* Since: 3.20
*/
typedef void (* GdkSeatGrabPrepareFunc) (GdkSeat *seat,
GdkSurface *surface,

View File

@@ -282,7 +282,8 @@ gdk_seat_default_get_slaves (GdkSeat *seat,
static GdkDeviceTool *
gdk_seat_default_get_tool (GdkSeat *seat,
guint64 serial)
guint64 serial,
guint64 hw_id)
{
GdkSeatDefaultPrivate *priv;
GdkDeviceTool *tool;
@@ -297,7 +298,7 @@ gdk_seat_default_get_tool (GdkSeat *seat,
{
tool = g_ptr_array_index (priv->tools, i);
if (tool->serial == serial)
if (tool->serial == serial && tool->hw_id == hw_id)
return tool;
}
@@ -457,8 +458,7 @@ gdk_seat_default_remove_tool (GdkSeatDefault *seat,
priv = gdk_seat_default_get_instance_private (seat);
if (tool != gdk_seat_get_tool (GDK_SEAT (seat),
gdk_device_tool_get_serial (tool)))
if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id))
return;
g_signal_emit_by_name (seat, "tool-removed", tool);

View File

@@ -57,7 +57,8 @@ struct _GdkSeatClass
GdkSeatCapabilities capabilities);
GdkDeviceTool * (* get_tool) (GdkSeat *seat,
guint64 serial);
guint64 serial,
guint64 tool_id);
GList * (* get_master_pointers) (GdkSeat *seat,
GdkSeatCapabilities capabilities);
};
@@ -74,6 +75,7 @@ void gdk_seat_tool_removed (GdkSeat *seat,
GdkDeviceTool *
gdk_seat_get_tool (GdkSeat *seat,
guint64 serial);
guint64 serial,
guint64 hw_id);
#endif /* __GDK_SEAT_PRIVATE_H__ */

View File

@@ -97,6 +97,8 @@
enum {
MOVED_TO_RECT,
SIZE_CHANGED,
RENDER,
LAST_SIGNAL
};
@@ -105,6 +107,7 @@ enum {
PROP_CURSOR,
PROP_DISPLAY,
PROP_STATE,
PROP_MAPPED,
LAST_PROP
};
@@ -271,6 +274,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
GDK_TYPE_SURFACE_STATE, GDK_SURFACE_STATE_WITHDRAWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
properties[PROP_MAPPED] =
g_param_spec_boolean ("mapped",
P_("Mapped"),
P_("Mapped"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
@@ -310,6 +320,31 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
G_TYPE_POINTER,
G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN);
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_INT,
G_TYPE_INT);
signals[RENDER] =
g_signal_new (g_intern_static_string ("render"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0,
g_signal_accumulator_true_handled,
NULL,
NULL,
G_TYPE_BOOLEAN,
1,
CAIRO_GOBJECT_TYPE_REGION);
}
static void
@@ -321,9 +356,6 @@ seat_removed_cb (GdkDisplay *display,
surface->devices_inside = g_list_remove (surface->devices_inside, device);
g_hash_table_remove (surface->device_cursor, device);
if (surface->device_events)
g_hash_table_remove (surface->device_events, device);
}
static void
@@ -336,16 +368,8 @@ gdk_surface_finalize (GObject *object)
if (!GDK_SURFACE_DESTROYED (surface))
{
if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_FOREIGN)
{
g_warning ("losing last reference to undestroyed surface");
_gdk_surface_destroy (surface, FALSE);
}
else
/* We use TRUE here, to keep us from actually calling
* XDestroyWindow() on the window
*/
_gdk_surface_destroy (surface, TRUE);
g_warning ("losing last reference to undestroyed surface");
_gdk_surface_destroy (surface, FALSE);
}
if (surface->impl)
@@ -369,9 +393,6 @@ gdk_surface_finalize (GObject *object)
if (surface->device_cursor)
g_hash_table_destroy (surface->device_cursor);
if (surface->device_events)
g_hash_table_destroy (surface->device_events);
if (surface->devices_inside)
g_list_free (surface->devices_inside);
@@ -430,18 +451,16 @@ gdk_surface_get_property (GObject *object,
g_value_set_flags (value, surface->state);
break;
case PROP_MAPPED:
g_value_set_boolean (value, GDK_SURFACE_IS_MAPPED (surface));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static gboolean
gdk_surface_is_subsurface (GdkSurface *surface)
{
return surface->surface_type == GDK_SURFACE_SUBSURFACE;
}
static GdkSurface *
gdk_surface_get_impl_surface (GdkSurface *surface)
{
@@ -530,10 +549,7 @@ recompute_visible_regions_internal (GdkSurface *private,
old_abs_y = private->abs_y;
/* Update absolute position */
if ((gdk_surface_has_impl (private) &&
private->surface_type != GDK_SURFACE_SUBSURFACE) ||
(gdk_surface_is_toplevel (private) &&
private->surface_type == GDK_SURFACE_SUBSURFACE))
if (gdk_surface_has_impl (private))
{
/* Native surfaces and toplevel subsurfaces start here */
private->abs_x = 0;
@@ -601,45 +617,6 @@ _gdk_surface_update_size (GdkSurface *surface)
recompute_visible_regions (surface, FALSE);
}
static GdkEventMask
get_native_device_event_mask (GdkSurface *private,
GdkDevice *device)
{
GdkEventMask event_mask;
if (device)
event_mask = GPOINTER_TO_INT (g_hash_table_lookup (private->device_events, device));
else
event_mask = private->event_mask;
if (private->surface_type == GDK_SURFACE_FOREIGN)
return event_mask;
else
{
GdkEventMask mask;
mask = private->event_mask;
/* We need thse for all native surfaces so we can
emulate events on children: */
mask |=
GDK_EXPOSURE_MASK |
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
GDK_TOUCH_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_SCROLL_MASK;
return mask;
}
}
static GdkEventMask
get_native_event_mask (GdkSurface *private)
{
return get_native_device_event_mask (private, NULL);
}
GdkSurface*
gdk_surface_new (GdkDisplay *display,
GdkSurface *parent,
@@ -647,7 +624,6 @@ gdk_surface_new (GdkDisplay *display,
{
GdkSurface *surface;
gboolean native;
GdkEventMask event_mask;
g_return_val_if_fail (attributes != NULL, NULL);
@@ -692,30 +668,13 @@ gdk_surface_new (GdkDisplay *display,
if (parent != NULL)
g_warning (G_STRLOC "Toplevel surfaces must be created without a parent");
break;
case GDK_SURFACE_SUBSURFACE:
#ifdef GDK_WINDOWING_WAYLAND
if (!GDK_IS_WAYLAND_DISPLAY (display))
{
g_warning (G_STRLOC "Subsurface surfaces can only be used on Wayland");
return NULL;
}
#endif
break;
case GDK_SURFACE_CHILD:
if (GDK_SURFACE_TYPE (parent) == GDK_SURFACE_FOREIGN)
{
g_warning (G_STRLOC "Child surfaces must not be created as children of\n"
"a surface of type GDK_SURFACE_FOREIGN");
return NULL;
}
break;
default:
g_warning (G_STRLOC "cannot make surfaces of type %d", surface->surface_type);
return NULL;
}
surface->event_mask = GDK_ALL_EVENTS_MASK;
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
surface->input_only = FALSE;
@@ -738,17 +697,10 @@ gdk_surface_new (GdkDisplay *display,
native = TRUE; /* Always use native surfaces for toplevels */
}
#ifdef GDK_WINDOWING_WAYLAND
if (surface->surface_type == GDK_SURFACE_SUBSURFACE)
native = TRUE; /* Always use native windows for subsurfaces as well */
#endif
if (native)
{
event_mask = get_native_event_mask (surface);
/* Create the impl */
_gdk_display_create_surface_impl (display, surface, parent, event_mask, attributes);
gdk_display_create_surface_impl (display, surface, parent, attributes);
surface->impl_surface = surface;
}
else
@@ -947,81 +899,69 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_CHILD:
case GDK_SURFACE_TEMP:
case GDK_SURFACE_FOREIGN:
case GDK_SURFACE_SUBSURFACE:
if (surface->surface_type == GDK_SURFACE_FOREIGN && !foreign_destroy)
if (surface->parent)
{
if (surface->parent->children)
surface->parent->children = g_list_remove_link (surface->parent->children, &surface->children_list_node);
if (!recursing &&
GDK_SURFACE_IS_MAPPED (surface))
{
recompute_visible_regions (surface, FALSE);
gdk_surface_invalidate_in_parent (surface);
}
}
if (surface->gl_paint_context)
{
/* Make sure to destroy if current */
g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
g_object_unref (surface->gl_paint_context);
surface->gl_paint_context = NULL;
}
if (surface->frame_clock)
{
g_object_run_dispose (G_OBJECT (surface->frame_clock));
gdk_surface_set_frame_clock (surface, NULL);
}
tmp = surface->children;
surface->children = NULL;
/* No need to free children list, its all made up of in-struct nodes */
while (tmp)
{
temp_surface = tmp->data;
tmp = tmp->next;
if (temp_surface)
_gdk_surface_destroy_hierarchy (temp_surface,
TRUE,
recursing_native || gdk_surface_has_impl (surface),
foreign_destroy);
}
_gdk_surface_clear_update_area (surface);
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
if (gdk_surface_has_impl (surface))
impl_class->destroy (surface, recursing_native, foreign_destroy);
else
{
if (surface->parent)
{
if (surface->parent->children)
surface->parent->children = g_list_remove_link (surface->parent->children, &surface->children_list_node);
if (!recursing &&
GDK_SURFACE_IS_MAPPED (surface))
{
recompute_visible_regions (surface, FALSE);
gdk_surface_invalidate_in_parent (surface);
}
}
if (surface->gl_paint_context)
{
/* Make sure to destroy if current */
g_object_run_dispose (G_OBJECT (surface->gl_paint_context));
g_object_unref (surface->gl_paint_context);
surface->gl_paint_context = NULL;
}
if (surface->frame_clock)
{
g_object_run_dispose (G_OBJECT (surface->frame_clock));
gdk_surface_set_frame_clock (surface, NULL);
}
if (surface->surface_type == GDK_SURFACE_FOREIGN)
g_assert (surface->children == NULL);
else
{
tmp = surface->children;
surface->children = NULL;
/* No need to free children list, its all made up of in-struct nodes */
while (tmp)
{
temp_surface = tmp->data;
tmp = tmp->next;
if (temp_surface)
_gdk_surface_destroy_hierarchy (temp_surface,
TRUE,
recursing_native || gdk_surface_has_impl (surface),
foreign_destroy);
}
}
_gdk_surface_clear_update_area (surface);
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
if (gdk_surface_has_impl (surface))
impl_class->destroy (surface, recursing_native, foreign_destroy);
else
{
/* hide to make sure we repaint and break grabs */
gdk_surface_hide (surface);
}
surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
surface->parent = NULL;
surface->destroyed = TRUE;
surface_remove_from_pointer_info (surface, display);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
/* hide to make sure we repaint and break grabs */
gdk_surface_hide (surface);
}
surface->state |= GDK_SURFACE_STATE_WITHDRAWN;
surface->parent = NULL;
surface->destroyed = TRUE;
surface_remove_from_pointer_info (surface, display);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
break;
}
}
@@ -1209,10 +1149,7 @@ gdk_surface_get_parent (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
if (gdk_surface_is_subsurface (surface))
return surface->transient_for;
else
return surface->parent;
return surface->parent;
}
/**
@@ -1232,8 +1169,7 @@ gdk_surface_get_toplevel (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
while (surface->surface_type == GDK_SURFACE_CHILD ||
surface->surface_type == GDK_SURFACE_SUBSURFACE)
while (surface->surface_type == GDK_SURFACE_CHILD)
{
if (gdk_surface_is_toplevel (surface))
break;
@@ -1693,20 +1629,13 @@ static void
gdk_surface_process_updates_recurse (GdkSurface *surface,
cairo_region_t *expose_region)
{
GdkEvent *event;
gboolean handled;
if (surface->destroyed)
return;
/* Paint the surface before the children, clipped to the surface region */
event = gdk_event_new (GDK_EXPOSE);
event->any.surface = g_object_ref (surface);
event->any.send_event = FALSE;
event->expose.region = cairo_region_reference (expose_region);
_gdk_event_emit (event);
g_object_unref (event);
g_signal_emit (surface, signals[RENDER], 0, expose_region, &handled);
}
/* Process and remove any invalid area on the native surface by creating
@@ -2285,10 +2214,8 @@ _gdk_surface_update_viewable (GdkSurface *surface)
{
gboolean viewable;
if (surface->surface_type == GDK_SURFACE_FOREIGN)
viewable = TRUE;
else if (gdk_surface_is_toplevel (surface) ||
surface->parent->viewable)
if (gdk_surface_is_toplevel (surface) ||
surface->parent->viewable)
viewable = GDK_SURFACE_IS_MAPPED (surface);
else
viewable = FALSE;
@@ -2328,6 +2255,7 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
{
surface->state = 0;
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
}
did_show = _gdk_surface_update_viewable (surface);
@@ -2343,15 +2271,6 @@ gdk_surface_show_internal (GdkSurface *surface, gboolean raise)
impl_class->show (surface, !did_show ? was_mapped : TRUE);
}
if (!was_mapped && !gdk_surface_has_impl (surface))
{
if (surface->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (surface, GDK_MAP, NULL, FALSE);
}
if (!was_mapped || did_raise)
{
recompute_visible_regions (surface, FALSE);
@@ -2387,7 +2306,7 @@ gdk_surface_show_unraised (GdkSurface *surface)
* other surfaces with the same parent surface appear below @surface.
* This is true whether or not the surfaces are visible.
*
* If @surface is a toplevel, the surface manager may choose to deny the
* If @surface is a toplevel, the window manager may choose to deny the
* request to move the surface in the Z-order, gdk_surface_raise() only
* requests the restack, does not guarantee it.
*/
@@ -2608,6 +2527,7 @@ gdk_surface_hide (GdkSurface *surface)
{
surface->state = GDK_SURFACE_STATE_WITHDRAWN;
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
}
if (was_mapped)
@@ -2654,198 +2574,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS
recompute_visible_regions (surface, FALSE);
if (was_mapped && !gdk_surface_has_impl (surface))
{
if (surface->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
}
/* Invalidate the rect */
if (was_mapped)
gdk_surface_invalidate_in_parent (surface);
}
/**
* gdk_surface_withdraw:
* @surface: a toplevel #GdkSurface
*
* Withdraws a surface (unmaps it and asks the surface manager to forget about it).
* This function is not really useful as gdk_surface_hide() automatically
* withdraws toplevel surfaces before hiding them.
**/
void
gdk_surface_withdraw (GdkSurface *surface)
{
GdkSurfaceImplClass *impl_class;
gboolean was_mapped;
GdkGLContext *current_context;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (surface->destroyed)
return;
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (gdk_surface_has_impl (surface))
{
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->withdraw (surface);
if (was_mapped)
{
if (surface->event_mask & GDK_STRUCTURE_MASK)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
if (surface->parent && surface->parent->event_mask & GDK_SUBSTRUCTURE_MASK)
_gdk_make_event (surface, GDK_UNMAP, NULL, FALSE);
}
current_context = gdk_gl_context_get_current ();
if (current_context != NULL && gdk_gl_context_get_surface (current_context) == surface)
gdk_gl_context_clear_current ();
recompute_visible_regions (surface, FALSE);
}
}
/**
* gdk_surface_set_events:
* @surface: a #GdkSurface
* @event_mask: event mask for @surface
*
* The event mask for a surface determines which events will be reported
* for that surface from all master input devices. For example, an event mask
* including #GDK_BUTTON_PRESS_MASK means the surface should report button
* press events. The event mask is the bitwise OR of values from the
* #GdkEventMask enumeration.
*
* See the [input handling overview][event-masks] for details.
**/
void
gdk_surface_set_events (GdkSurface *surface,
GdkEventMask event_mask)
{
GdkSurfaceImplClass *impl_class;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (surface->destroyed)
return;
surface->event_mask = event_mask;
if (gdk_surface_has_impl (surface))
{
impl_class = GDK_SURFACE_IMPL_GET_CLASS (surface->impl);
impl_class->set_events (surface,
get_native_event_mask (surface));
}
}
/**
* gdk_surface_get_events:
* @surface: a #GdkSurface
*
* Gets the event mask for @surface for all master input devices. See
* gdk_surface_set_events().
*
* Returns: event mask for @surface
**/
GdkEventMask
gdk_surface_get_events (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
if (surface->destroyed)
return 0;
return surface->event_mask;
}
/**
* gdk_surface_set_device_events:
* @surface: a #GdkSurface
* @device: #GdkDevice to enable events for.
* @event_mask: event mask for @surface
*
* Sets the event mask for a given device (Normally a floating device, not
* attached to any visible pointer) to @surface. For example, an event mask
* including #GDK_BUTTON_PRESS_MASK means the surface should report button
* press events. The event mask is the bitwise OR of values from the
* #GdkEventMask enumeration.
*
* See the [input handling overview][event-masks] for details.
**/
void
gdk_surface_set_device_events (GdkSurface *surface,
GdkDevice *device,
GdkEventMask event_mask)
{
GdkEventMask device_mask;
GdkSurface *native;
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (GDK_IS_DEVICE (device));
if (GDK_SURFACE_DESTROYED (surface))
return;
if (G_UNLIKELY (!surface->device_events))
surface->device_events = g_hash_table_new (NULL, NULL);
if (event_mask == 0)
{
/* FIXME: unsetting events on a master device
* would restore surface->event_mask
*/
g_hash_table_remove (surface->device_events, device);
}
else
g_hash_table_insert (surface->device_events, device,
GINT_TO_POINTER (event_mask));
native = gdk_surface_get_toplevel (surface);
device_mask = get_native_device_event_mask (surface, device);
GDK_DEVICE_GET_CLASS (device)->select_surface_events (device, native, device_mask);
}
/**
* gdk_surface_get_device_events:
* @surface: a #GdkSurface.
* @device: a #GdkDevice.
*
* Returns the event mask for @surface corresponding to an specific device.
*
* Returns: device event mask for @surface
**/
GdkEventMask
gdk_surface_get_device_events (GdkSurface *surface,
GdkDevice *device)
{
GdkEventMask mask;
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
if (GDK_SURFACE_DESTROYED (surface))
return 0;
if (!surface->device_events)
return 0;
mask = GPOINTER_TO_INT (g_hash_table_lookup (surface->device_events, device));
/* FIXME: device could be controlled by surface->event_mask */
return mask;
}
static void
gdk_surface_move_resize_toplevel (GdkSurface *surface,
gboolean with_move,
@@ -3086,24 +2819,19 @@ gdk_surface_set_cursor_internal (GdkSurface *surface,
GdkDevice *device,
GdkCursor *cursor)
{
GdkPointerSurfaceInfo *pointer_info;
GdkDisplay *display;
if (GDK_SURFACE_DESTROYED (surface))
return;
g_assert (gdk_surface_get_display (surface) == gdk_device_get_display (device));
if (surface->surface_type == GDK_SURFACE_FOREIGN)
GDK_DEVICE_GET_CLASS (device)->set_surface_cursor (device, surface, cursor);
else
{
GdkPointerSurfaceInfo *pointer_info;
GdkDisplay *display;
display = gdk_surface_get_display (surface);
pointer_info = _gdk_display_get_pointer_info (display, device);
display = gdk_surface_get_display (surface);
pointer_info = _gdk_display_get_pointer_info (display, device);
if (_gdk_surface_event_parent_of (surface, pointer_info->surface_under_pointer))
update_cursor (display, device);
}
if (_gdk_surface_event_parent_of (surface, pointer_info->surface_under_pointer))
update_cursor (display, device);
}
/**
@@ -3137,7 +2865,7 @@ gdk_surface_get_cursor (GdkSurface *surface)
*
* Note that @cursor must be for the same display as @surface.
*
* Use gdk_cursor_new_for_display() or gdk_cursor_new_from_texture() to
* Use gdk_cursor_new_from_name() or gdk_cursor_new_from_texture() to
* create the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR.
* Passing %NULL for the @cursor argument to gdk_surface_set_cursor() means
* that @surface will use the cursor of its parent surface. Most surfaces
@@ -3224,7 +2952,7 @@ gdk_surface_get_device_cursor (GdkSurface *surface,
* @cursor: a #GdkCursor
*
* Sets a specific #GdkCursor for a given device when it gets inside @surface.
* Use gdk_cursor_new_for_display() or gdk_cursor_new_from_texture() to create
* Use gdk_cursor_new_fromm_name() or gdk_cursor_new_from_texture() to create
* the cursor. To make the cursor invisible, use %GDK_BLANK_CURSOR. Passing
* %NULL for the @cursor argument to gdk_surface_set_cursor() means that
* @surface will use the cursor of its parent surface. Most surfaces should
@@ -3665,7 +3393,7 @@ gdk_surface_merge_child_input_shapes (GdkSurface *surface)
* gdk_surface_get_modal_hint:
* @surface: A toplevel #GdkSurface.
*
* Determines whether or not the surface manager is hinted that @surface
* Determines whether or not the window manager is hinted that @surface
* has modal behaviour.
*
* Returns: whether or not the surface has the modal hint set.
@@ -4129,11 +3857,8 @@ _gdk_make_event (GdkSurface *surface,
case GDK_FOCUS_CHANGE:
case GDK_CONFIGURE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_DELETE:
case GDK_DESTROY:
case GDK_EXPOSE:
default:
break;
}
@@ -4647,7 +4372,7 @@ gdk_surface_set_transient_for (GdkSurface *surface,
* @x: (out): return location for X position of surface frame
* @y: (out): return location for Y position of surface frame
*
* Obtains the top-left corner of the surface manager frame in root
* Obtains the top-left corner of the window manager frame in root
* surface coordinates.
*
**/
@@ -5360,10 +5085,10 @@ gdk_surface_register_dnd (GdkSurface *surface)
*
* This function is called by the drag source.
*
* Returns: (transfer full) (nullable): a newly created #GdkDragContext or
* Returns: (transfer full) (nullable): a newly created #GdkDrag or
* %NULL on error.
*/
GdkDragContext *
GdkDrag *
gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
@@ -5687,6 +5412,7 @@ void
gdk_surface_set_state (GdkSurface *surface,
GdkSurfaceState new_state)
{
gboolean was_mapped, mapped;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (new_state == surface->state)
@@ -5697,8 +5423,12 @@ gdk_surface_set_state (GdkSurface *surface,
* inconsistent state to the user.
*/
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
surface->state = new_state;
mapped = GDK_SURFACE_IS_MAPPED (surface);
_gdk_surface_update_viewable (surface);
/* We only really send the event to toplevels, since
@@ -5710,13 +5440,15 @@ gdk_surface_set_state (GdkSurface *surface,
{
case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_TEMP: /* ? */
g_object_notify (G_OBJECT (surface), "state");
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_STATE]);
break;
case GDK_SURFACE_FOREIGN:
case GDK_SURFACE_CHILD:
default:
break;
}
if (was_mapped != mapped)
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
}
void
@@ -5726,3 +5458,16 @@ gdk_synthesize_surface_state (GdkSurface *surface,
{
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
}
gboolean
gdk_surface_handle_event (GdkEvent *event)
{
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
event->configure.width, event->configure.height);
return TRUE;
}
return FALSE;
}

View File

@@ -43,12 +43,7 @@ typedef struct _GdkGeometry GdkGeometry;
* GdkSurfaceType:
* @GDK_SURFACE_TOPLEVEL: toplevel window (used to implement #GtkWindow)
* @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry)
* @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement
* #GtkMenu)
* @GDK_SURFACE_FOREIGN: foreign surface (see gdk_surface_foreign_new())
* @GDK_SURFACE_SUBSURFACE: subsurface; This surface is visually
* tied to a toplevel, and is moved/stacked with it. Currently this window
* type is only implemented in Wayland. Since 3.14
* @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement #GtkMenu)
*
* Describes the kind of surface.
*/
@@ -56,9 +51,7 @@ typedef enum
{
GDK_SURFACE_TOPLEVEL,
GDK_SURFACE_CHILD,
GDK_SURFACE_TEMP,
GDK_SURFACE_FOREIGN,
GDK_SURFACE_SUBSURFACE
GDK_SURFACE_TEMP
} GdkSurfaceType;
/* Size restriction enumeration.
@@ -217,9 +210,6 @@ typedef enum
*
* In general, when multiple flags are set, flipping should take precedence over
* sliding, which should take precedence over resizing.
*
* Since: 3.22
* Stability: Unstable
*/
typedef enum
{
@@ -266,8 +256,6 @@ typedef enum
*
* Indicates which monitor (in a multi-head setup) a surface should span over
* when in fullscreen mode.
*
* Since: 3.8
**/
typedef enum
{
@@ -377,16 +365,15 @@ struct _GdkGeometry
* @GDK_SURFACE_STATE_ABOVE: the surface is kept above other surfaces.
* @GDK_SURFACE_STATE_BELOW: the surface is kept below other surfaces.
* @GDK_SURFACE_STATE_FOCUSED: the surface is presented as focused (with active decorations).
* @GDK_SURFACE_STATE_TILED: the surface is in a tiled state, Since 3.10. Since 3.91.2, this
* is deprecated in favor of per-edge information.
* @GDK_SURFACE_STATE_TOP_TILED: whether the top edge is tiled, Since 3.91.2
* @GDK_SURFACE_STATE_TOP_RESIZABLE: whether the top edge is resizable, Since 3.91.2
* @GDK_SURFACE_STATE_RIGHT_TILED: whether the right edge is tiled, Since 3.91.2
* @GDK_SURFACE_STATE_RIGHT_RESIZABLE: whether the right edge is resizable, Since 3.91.2
* @GDK_SURFACE_STATE_BOTTOM_TILED: whether the bottom edge is tiled, Since 3.91.2
* @GDK_SURFACE_STATE_BOTTOM_RESIZABLE: whether the bottom edge is resizable, Since 3.91.2
* @GDK_SURFACE_STATE_LEFT_TILED: whether the left edge is tiled, Since 3.91.2
* @GDK_SURFACE_STATE_LEFT_RESIZABLE: whether the left edge is resizable, Since 3.91.2
* @GDK_SURFACE_STATE_TILED: the surface is in a tiled state. Deprecated
* @GDK_SURFACE_STATE_TOP_TILED: whether the top edge is tiled
* @GDK_SURFACE_STATE_TOP_RESIZABLE: whether the top edge is resizable
* @GDK_SURFACE_STATE_RIGHT_TILED: whether the right edge is tiled
* @GDK_SURFACE_STATE_RIGHT_RESIZABLE: whether the right edge is resizable
* @GDK_SURFACE_STATE_BOTTOM_TILED: whether the bottom edge is tiled
* @GDK_SURFACE_STATE_BOTTOM_RESIZABLE: whether the bottom edge is resizable
* @GDK_SURFACE_STATE_LEFT_TILED: whether the left edge is tiled
* @GDK_SURFACE_STATE_LEFT_RESIZABLE: whether the left edge is resizable
*
* Specifies the state of a toplevel surface.
*/
@@ -468,8 +455,6 @@ void gdk_surface_show (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_hide (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_withdraw (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_show_unraised (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_move (GdkSurface *surface,
@@ -685,19 +670,6 @@ GDK_AVAILABLE_IN_ALL
GList * gdk_surface_get_children_with_user_data (GdkSurface *surface,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
GdkEventMask gdk_surface_get_events (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_events (GdkSurface *surface,
GdkEventMask event_mask);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_device_events (GdkSurface *surface,
GdkDevice *device,
GdkEventMask event_mask);
GDK_AVAILABLE_IN_ALL
GdkEventMask gdk_surface_get_device_events (GdkSurface *surface,
GdkDevice *device);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_icon_list (GdkSurface *surface,
GList *surfaces);

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