Compare commits

...

602 Commits

Author SHA1 Message Date
Benjamin Otte
01e88743ef eventcontroller: Make widget no longer a construct-only property
The new API model is now complete. To set a widget on a controller, it
is now necessary to call gtk_widget_add_controller().
2018-04-05 20:23:33 +02:00
Benjamin Otte
dfa7f99336 padcontroller: Port to new API model 2018-04-05 20:23:33 +02:00
Benjamin Otte
89e7a799d9 eventcontrollermotion: Port to new API model 2018-04-05 20:23:33 +02:00
Benjamin Otte
ca77d3931e eventcontrollerscroll: Port to new API model 2018-04-05 20:15:55 +02:00
Benjamin Otte
72d5bebf9a draggesture: Port to new API model 2018-04-05 20:12:35 +02:00
Benjamin Otte
88a99abaf3 longpressgesture: Port to new API model 2018-04-05 20:11:45 +02:00
Benjamin Otte
59f2a790a7 multipressgesture: Port to new API model 2018-04-05 20:11:20 +02:00
Benjamin Otte
f4a6414443 pangesture: Port to new API model 2018-04-05 20:09:03 +02:00
Benjamin Otte
e801fc32b0 swipegesture: Port to new API model 2018-04-05 20:08:13 +02:00
Benjamin Otte
83bcb4aa22 zoomgesture: Port to new API model 2018-04-05 20:08:13 +02:00
Benjamin Otte
83736d4142 rotategesture: Port to new API model 2018-04-05 20:08:13 +02:00
Benjamin Otte
dbeaad6a35 legacycontroller: Port to new API model
We no longer set the widget on construction, but instead require an
explicit call to gtk_widget_add_controller().

This way, the reference handling becomes explicit and bindable.

Because gtk_widget_add_controller() is (transfer: full), we don't
even need to unref the controller after adding it.
And we don't need to keep track of it, because controllers get cleaned
up by GtkWidget.
2018-04-05 20:08:13 +02:00
Benjamin Otte
792c9d6512 filechooser: Put event controllers into ui file 2018-04-05 20:08:13 +02:00
Benjamin Otte
51b8d6dfcd placesviewrow: Put event controllers into ui file 2018-04-05 20:08:13 +02:00
Benjamin Otte
0b3ba3ecd5 widget-factory: Put gesture into ui file 2018-04-05 20:08:13 +02:00
Benjamin Otte
f356f09476 emojichooser: Put event controllers into ui file 2018-04-05 20:08:13 +02:00
Benjamin Otte
c03a35a697 aboutdialog: Put event controllers into ui file 2018-04-05 20:08:13 +02:00
Benjamin Otte
fb08023ff3 widget: Allow adding event controllers in ui files 2018-04-05 20:08:12 +02:00
Benjamin Otte
21ff4df74d widget: Expose gtk_widget_add_controller()
.. and gtk_widget_remove_controller().
2018-04-05 20:08:12 +02:00
Benjamin Otte
50f8268c3e eventcontroller: Move declaration
This is in preparation for exposing APIs in gtkwidget.c
2018-04-05 20:08:12 +02:00
Benjamin Otte
957ff4761e eventcontroller: Add vfuncs to (un)set widget
This is the first step towards refactoring how widgets deal with event
controllers.

In the future, the widget will treat controllers the same way it treats
child widgets:
1. The controllers will be created without a widget.
2. There will be gtk_widget_add/remove_controller() functions to add
   or remove controllers.
3. The widget will hold a reference to all its controllers.

This way we will ultimately be able to automate controllers with ui
files.
2018-04-05 20:08:12 +02:00
Benjamin Otte
47ea3a9452 snapshot: Don't cause invalid reads
1. Pass clip rectangles to gtk_snapshot_push_state() that point into
   the state array.
2. g_array_set_size(len+1) the state array
3. Make that function realloc() the state array.
4. The clip rectangle now points into invalid memory
5. Use the clip array

This patch fixes things by moving step 5 to before step 2.
2018-04-05 18:41:34 +02:00
Benjamin Otte
1792f3b21e rendernode: Add missing return
Don't to extra work when not needed.
2018-04-05 18:40:54 +02:00
Piotr Drąg
df74f36328 Update POTFILES.in 2018-04-05 17:37:22 +02:00
Benjamin Otte
ebea84474d widget: Fix variable names
Stop docs build from complaining
2018-04-05 17:09:52 +02:00
Benjamin Otte
374467c11c a11y: Fix headers
We were getting a gcc warning before.
2018-04-05 17:05:21 +02:00
Benjamin Otte
8cb0df7554 Merge branch 'window-activate' into 'master'
a11y: restore window:activate/deactivate emission

Closes #127

See merge request GNOME/gtk!77
2018-04-05 14:36:13 +00:00
Samuel Thibault
62f31015fc a11y: restore window:activate/deactivate emission
1b9aa1b708 ('a11y: drop the focus tracker') removed a bit too much.  We
still have to emit window:activate/deactivate events.  They are easy to
emit anyway.

Fixes #127
2018-04-05 15:19:04 +02:00
Benjamin Otte
a5cb6aa365 inspector: Add an fps overlay 2018-04-05 14:58:43 +02:00
Benjamin Otte
6de4c63a67 inspector: Bring back debug updates
This time, they are implemented as an overlay, so they require a running
inspector and can't be enabled via env variable anymore.
2018-04-05 14:58:42 +02:00
Benjamin Otte
2699c15a99 widget: Remove draw signal
The only remaining user is the text handle, but the text handle doesn't
draw anything anyway currently, so whoever fixes it can make it use
snapshots.
2018-04-05 14:57:10 +02:00
Benjamin Otte
de990614d7 inspector: Introduce so-called "overlays"
Overlays are drawings that get rendered on top of the inspected window.

The only overlay in existence so far is the highlight overlay, which is
used to highlight widgets and replaces the "draw" signal handler used
previously.
2018-04-05 14:57:10 +02:00
Benjamin Otte
cbf26fbd02 widget: Add gtk_widget_compute_bounds()
The first in a set of functions intended to query widget coordinates
from another widget's coordinate system.
2018-04-05 14:57:10 +02:00
Benjamin Otte
6c55096933 inspector: Change semantics of inspector render node notify
Instead of just notifying the inspector of what is going to be rendered,
allow the inspector to modify it.

This way, the inspector can overlay information it deems relevant over
the render node while still having access to what the actual widget
(without the inspector) would paint.
2018-04-05 14:57:10 +02:00
Benjamin Otte
0ea8395c03 image: Actually report a request mode
This makes height-for-width actually work for GtkImage.

I'm kinda ashamed I didn't notice it not working before.
2018-04-05 14:57:10 +02:00
Benjamin Otte
7a4e76ae15 treeview: Remove invalidation tracking code 2018-04-05 14:57:10 +02:00
Benjamin Otte
1aacb14236 testgtk: Remove draw signal usage 2018-04-05 14:57:10 +02:00
Benjamin Otte
56e018b91c widget: Remove GtkWidget.draw vfunc
Widgets are exclusively snapshot now.

The draw signal still exists.
2018-04-05 14:57:10 +02:00
Benjamin Otte
c06a790694 widget: Remove gtk_widget_draw()
If you want to draw a widget to cairo today, you create a widget
paintable, snapshot it to a render node and then draw the render node to
cairo.

And yes, this is that complicated on purpose. Don't draw widgets to
Cairo.
2018-04-05 14:56:39 +02:00
Benjamin Otte
4a513b7800 reftests: Port from gtk_widget_draw() to snapshots 2018-04-05 14:56:39 +02:00
Benjamin Otte
c85547667f testgtk: Take an actual snapshot of a widget
Don't just draw the widget, take the paintable of it instead!
2018-04-05 14:56:39 +02:00
Benjamin Otte
a595a4c2ce testlist3: Set the actual row as drag icon
(Well, don't do anything actually, because dnd is broken, but
in theory...)
2018-04-05 14:56:39 +02:00
Benjamin Otte
f974b48503 widgetpaintable: Implement get_current_image()
Now that snapshot and empty paintables exist, this is rather trivial.
2018-04-05 14:56:39 +02:00
Benjamin Otte
c74854fe49 paintable: Introduce gdk_paintable_new_empty()
Also, use it where appropriate.
2018-04-05 14:56:39 +02:00
Benjamin Otte
ffc7b2bb0a snapshot: Allow passing the bounds of the created paintable
This allows being more specific about the size.
It's useful in particular when the resulting render nodes might be
too small for the size, not only when they are too large. For the
latter case, using a clip node would be enough.

It also requires adding a clip node when rendering the resulting
paintable, but that should be optimized out by GtkSnapshot when not
necessary.
2018-04-05 14:56:39 +02:00
Benjamin Otte
12fedca726 widgetpaintable: Protect against too many signals
This is actually not just a mechnaism to protect against too many
signals, but it's also a method to getting those signals at the wrong
time.

For every size/content change, a widget needs to invalidate twice:
Once when it queues a resize/redraw (going valid => invalid) and once
when the new size/content is actually assigned (going invalid => valid).

However, one of those invalidations might be inconvenient for the
listener. GtkImage for example does not like receiving
invalidate-contents signals when new contents are assigned, but is fine
with them when the old ones go invalid. And it will not try to draw the
paintable in between anyway.

So by bypassing the 2nd emission if nothing was changed, we can make
GtkImage happy.
2018-04-05 14:56:39 +02:00
Benjamin Otte
139882bc76 demos: Add an image demo for widget paintables 2018-04-05 14:56:39 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Benjamin Otte
fc6de135fe widget: Don't keep track of clip anymore.
It's not used anywhere, so why would we need it?
2018-04-05 14:56:38 +02:00
Benjamin Otte
f1f27ce0c2 broadway: Improve error message
This error message is printed into the journal if a GTK app can't
connect to eithre Wayland or X11. Make it at least mention who is not
capable of connecting to a server.

Unrelated, we might want to improve our error reporting when a GTK app
can't start, so that debugging issues with system startup / login get
easier to resolve.
2018-04-05 14:56:38 +02:00
Benjamin Otte
a36b0f8bae widget: Don't clip widgets anymore when snapshotting
This is the first step in removing clips.

It's seperate to allow bisecting to this commit when analyzing
performance problems.
2018-04-05 14:56:38 +02:00
Benjamin Otte
4bf90633ea widget: Cache clip from creating render node
When the clip changes that is passed to a snapshot function, we need to
create eventual cached render nodes because they might not have drawn
their whole area before.

Fixes issues with redrawing when scrolling.
2018-04-05 14:56:38 +02:00
Benjamin Otte
278ab3c4de snapshot: Track clip as a rect only 2018-04-05 14:56:38 +02:00
Benjamin Otte
200bbe8fda diff: Allow aborting a diff
When the max cost for finding a path gets to high, the diff can now be
aborted.

Because render nodes have a fallback method (by just marking the whole
bounds of the nodes as different), we use this to improve performance
of diffs.

This brings fishbowl (which is basically a container node with N images
that change every frame) back to close to previous performance.
2018-04-05 14:56:38 +02:00
Benjamin Otte
144637bff1 build: Switch order of subdirectories
After fixing this once already in 5970dac167 the order was messed up
again in d50708b024.
2018-04-05 14:56:38 +02:00
Benjamin Otte
4b72ea33ac diff: Introduce GskDiffSettings
We can put lots of settings there to allow tuning the diff algorithm
used.
2018-04-05 14:56:38 +02:00
Benjamin Otte
0f184d3270 vulkan: Always render clip extents
Now that we have the full render nodes available, there is not much
benefit in fine-grained control over multiple rectangles.
In particular, it's causing pain with complex regions.

There might be a benefit in clipping to the region's rectangles in cases
like widget-factory where the whole diff is made up of the 2 rectangles
of spinner and the pulsing progress bar, but it needs a good heuristic
for where this is useful.
2018-04-05 14:56:38 +02:00
Benjamin Otte
e3a717363b snapshot: Remove clip argument from gtk_snapshot_new()
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().
2018-04-05 14:56:38 +02:00
Benjamin Otte
73650c6da2 gtk: Remove gtk_widget_queue_draw_region()
... and gtk_widget_queue_draw_area().

They don't doi anything anymore.
2018-04-05 14:56:38 +02:00
Benjamin Otte
a468714849 widget: Stop tracking invalidations
Instead of calling gdk_surface_invalidate_region(), just
gdk_surface_queue_expose() and rely on the renderer computing the diff
from the previous rendering.
2018-04-05 14:56:38 +02:00
Benjamin Otte
7e078cd940 gtk: Remove debug updates
With the soon-to-arrive automatic updates (aka computing invalid region
from render nodes), this will no longer be necessary.
2018-04-05 14:56:38 +02:00
Benjamin Otte
925cbeaadf renderer: Track the previous node
... and diff the previous node with the current one to determine the
clip region.

This doubles the work necessary to track clip regions, but the following
commits will clean that up.
2018-04-05 14:56:38 +02:00
Benjamin Otte
7c313c7b25 gsk: move begin/end_frame vfuncs into the renderers 2018-04-05 14:56:38 +02:00
Benjamin Otte
d0873c7dec gsk: Fold gsk_renderer_begin_draw_frame() into renderer
It doesn't need to be exported anymore.

As a side effect, the inspector no longer has any information about the
render region, so remove the code that was taking care of that.
2018-04-05 14:56:38 +02:00
Benjamin Otte
b19d7630ae widget: Reorder gtk_widget_render()
Now that we don't clip the created render nodes anymore, we don't have
to compute the clip region beforehand.

So snapshot the render nodes before initializing the renderer.
2018-04-05 14:56:38 +02:00
Benjamin Otte
a6079b9b7b gsk: Implement gsk_render_node_diff()
This includes a copy of the diff(1) algorithm used by git diff by Davide
Libenzi.

It's used for the common case ofcontainer nodes having only very few
changes for the few nodes of child widgets that changed (like a button
lighting up when hilighted or a spinning spinner).
2018-04-05 14:56:38 +02:00
Benjamin Otte
c0db4091cf magnifier: Redo with GtkWidgetPaintable 2018-04-05 14:56:38 +02:00
Benjamin Otte
2d10c2568c gtk: Add GtkWidgetPaintable
A GtkWidgetPaintable is a paintable that observes a given GtkWidget and
renders that widget into a paintable.
2018-04-05 14:56:38 +02:00
Benjamin Otte
29111a16d4 widget: Cache the render node
This requires a bunch of refactorings:

1. Don't pass the current clip region to gtk_widget_snapshot()
   so we don't create full widget contents
3. Have a widget->priv->draw_needed that we invalidate on every
   queue_draw() call and set on every snapshot()
2. In queue_draw(), walk the widget chain to invalidate the
   render nodes of all parents
2018-04-05 14:56:38 +02:00
Benjamin Otte
271820b677 rendernode: Add gsk_render_node_diff()
... and gsk_render_node_can_diff(). Those are vfuncs to compute a region
containing all the pixels that differ between the two nodes.

This is just the plumbing that chains into node classes. No node
implements it yet.
2018-04-05 14:56:38 +02:00
Matthias Clasen
dcdd95bbc8 font button: fix compiler warnings
A PangoLanguage is not a string.
2018-04-05 06:23:14 -04:00
Benjamin Otte
7c60f939ee Merge branch 'text-changed-delete-4' into 'master'
gtkentryaccessible: Fix text-changed::delete length

See merge request GNOME/gtk!100
2018-04-04 18:19:08 +00:00
Benjamin Otte
572a23b136 Merge branch 'textview-delete-4' into 'master'
gtktextviewaccessible: update cursor position after text suppression

See merge request GNOME/gtk!102
2018-04-04 18:18:49 +00:00
Samuel Thibault
a1f206b802 gtktextviewaccessible: update cursor position after text suppression
delete_range_cb is set to be called before the text suppression done by
the gtktextlayout (otherwise it does not work properly). But at that
point the cursor position is not yet up to date.  We thus need to move
the accessibility cursor notification to after the actual text
suppression, by using another callback.

This fixes cursor position in brltty screen reading.

(cherry picked from commit fa6994d033)
2018-04-04 18:26:55 +02:00
Samuel Thibault
8c8cb2bb12 gtkentryaccessible: Fix text-changed::delete length
The second parameter of the text-changed::delete event is to be the length,
not the end position.  This fixes spurious text removals in brltty
screen reading.

(cherry picked from commit 209f908a03)
2018-04-04 17:59:31 +02:00
Daniel Boles
67360c9d00 GLArea: Remove wrong transfer annotation on new()
Like other widgets, this returns a floating reference, so
(transfer full) is wrong. Just omit the annotation as others do,
thus implying (transfer none).

Close https://gitlab.gnome.org/GNOME/gtk/issues/156
2018-04-04 12:02:21 +01:00
Lionel Landwerlin
faceaec20a imwayland: destroy objects only if it matches our manager object
Should fix one of the crash from #129.
2018-04-03 19:11:09 +02:00
Matthias Clasen
bd9debe048 font chooser: Remove some dead code
This is leftover code from already removed debug spew.
2018-04-02 17:46:41 -04:00
Matthias Clasen
ec66c32def font button: Fix a crash
Since we are now storing the language as a PangoLanguage,
we must not free it anymore.
2018-04-02 17:45:48 -04:00
Matthias Clasen
5a68ac27cf font chooser: Make the language property writable
This is meant as an input to the font chooser.
We don't want the user to select a language, but
rather have fonts presented as they would work for
the current language. Therefore, do away with the
lang/script combo on the tweak page.
2018-04-02 13:37:53 -04:00
Chun-wei Fan
464943e5a6 gtk, demos: Fix builds without HarfBuzz and PangoFT
Really exclude the portions in the gtkfontchooserwidget.c that are built
when HarfBuzz and PangoFT2 are built, and update the Meson files to
exclude such sources as well from the main GTK SO/DLL and from the
gtk4-demo program.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:15:18 +08:00
Chun-wei Fan
bca4a78f07 testsuite/gsk/test-render-nodes.c: Avoid VLA usage
Just #define N as 5, instead of using a const int, which is not enough
to justify that as non-VLA usage.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:14:55 +08:00
Chun-wei Fan
a4c0395343 [gtk|demos/gtk-demo]/language-names.c: Fix build on non-GCC/CLang
Remove g_auto*() usage from these sources and use the traditional
g_free(), as g_auto*() are GCCisms (or CLangisms).

Also, don't include unistd.h unconditionally and stop including
langinfo.h and dirent.h, since they seem to be unused.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:13:27 +08:00
Chun-wei Fan
19ce520c2d build: Fix linking demos on Visual Studio
The demos are now built as GUI programs, which will require the presence
of WinMain() on Visual Studio builds, unless we specify the entry point.

Pass the /entry:mainCRTStartup linker flag on Visual Studio builds for
the demo programs so that they can link properly.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:11:50 +08:00
Matthias Clasen
d0e46d257c font chooser: Add examples for font features
For some font features, we can figure out affected
glyphs, and show before/after. For some others, we
hardcode typical sequences.

Still to do: figure out how to find ligatures and
show them.
2018-04-01 19:36:54 -04:00
Matthias Clasen
63a7d99d25 widget-factory: Enable all details in the font chooser
We want to see this here.
2018-04-01 19:36:54 -04:00
Piotr Drąg
1764673cff Update POTFILES.in 2018-04-01 15:00:07 +02:00
Руслан Ижбулатов
9e76a6055a W32: Link GTK to pangowin32
Needed for pango_win32_font_logfont() from gtkimcontextime.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-01 10:35:02 +00:00
LRN
eec0bd2fa9 Merge branch 'lrn/issue-147' into 'master'
Fix cursor handling in GTK4 on W32

Closes #147

See merge request GNOME/gtk!92
2018-04-01 10:33:43 +00:00
Rico Tzschichholz
f2937f8c45 Fix some g-i annotation warnings 2018-04-01 09:15:08 +02:00
Matthias Clasen
6b3091856b Enable variations and features for font explorer 2018-03-31 21:31:11 -04:00
Matthias Clasen
ad814509a4 font chooser: Align level value names
In the backport, I used the plural for variations, and that
is a better name, so use it here too.
2018-03-31 21:02:51 -04:00
Matthias Clasen
17693a2820 font chooser: Align property defaults
Set the default font chooser level to the same value we use
in the backports, to preserve font chooser behavior.
2018-03-31 21:02:51 -04:00
Matthias Clasen
8fb30a6a7b Font chooser: Hide tweak button sometimes
When there is no chance of tweaking anything, don't
show a tweak button.
2018-03-31 21:02:51 -04:00
Matthias Clasen
d15a29c876 Defeat compiler optimization
We always want to call both update functions here, and
the compiler unhelpfully optimizes out the second call
if the first one returns TRUE.
2018-03-31 21:02:51 -04:00
Timm Bäder
0f28f0ee39 GskRenderer: Remove outdated documentation comment
All render node trees are immutable
2018-03-31 14:45:03 +02:00
Timm Bäder
d9136fb944 snapshot: Plug memory leak when collecting rounded clip nodes 2018-03-31 14:45:03 +02:00
Timm Bäder
08296b8aee gl renderer: Don't highlight cairo nodes as fallback 2018-03-31 14:45:01 +02:00
Daniel Boles
db22398361 ProgressBar: Drop leftover "superimposed" mention
This was missed from the commit that dropped other mentions to the
previous ability to superimpose text.

https://bugzilla.gnome.org/show_bug.cgi?id=748784
2018-03-31 12:28:12 +01:00
Nelson Benítez León
d9b8acfced appchooserwidget: search text using g_str_match_string()
so we match on diacritics (eg. accented letters) and also
search on text tokens. As a plus we also reduce code size.

https://bugzilla.gnome.org/show_bug.cgi?id=745128
2018-03-31 13:48:30 +05:00
Timm Bäder
0fdd061bf5 togglebutton: Remove priv pointer 2018-03-30 23:15:04 +02:00
Timm Bäder
b2f04be04c popover: Remove priv pointer 2018-03-30 23:15:04 +02:00
Timm Bäder
809fdaa3e4 shaderbuilder: Insert newlines directly after defines
Instead of doing that in the loop in the last interation, we can just do
it after the loop.
2018-03-30 23:15:04 +02:00
Timm Bäder
f6330846c9 gl renderer: Remover unused mask uniform 2018-03-30 23:15:04 +02:00
Timm Bäder
badada9cf8 shader builder: Remove unused members 2018-03-30 23:15:04 +02:00
Timm Bäder
be3a42b7b1 shader builder: Reuse GString for shader code 2018-03-30 23:15:04 +02:00
Timm Bäder
66d5a4f752 widget: Fix snapshot condition
Of course, we only need to snapshot if both width and height > 0,
otherwise the result is invisible.
2018-03-30 23:15:04 +02:00
Timm Bäder
60acbd1090 entrybuffer: Remove priv pointer 2018-03-30 23:15:04 +02:00
Timm Bäder
7d61aad12c menubar: Don't crash when cycling through menubars 2018-03-30 23:15:04 +02:00
Matthias Clasen
f78598dd9b Merge branch 'im-wayland-reset' into 'master'
wayland: Don't emit signals if nothing changed

See merge request GNOME/gtk!83
2018-03-30 20:14:40 +00:00
Benjamin Otte
2f3cf6227a fishbowl: Make stats tracking work somewhat with broken X servers
Broken X servers being the ones that don't support NET_WM_TIMINGS (ie
every WM but mutter and XWayland).
2018-03-30 18:58:33 +02:00
Benjamin Otte
89f6a4ede4 demos: Improve frame rate tracking for fishbowl demo
We now properly use GdkFrameTimings and can therefor check for dropping
even a single frame in the history (of 16 frames or 1/4 of a second).
Once that happens, we immediately stop adding new items to the bowl.

A side effect is that the number of icons is now a *lot* smaller.
2018-03-30 16:51:09 +02:00
Benjamin Otte
c13fff8adb x11: Always request frame updates
This ensures that the frame clock gets updated with correct presentation
times even if nothing was drawn.

This is necessary for benchmarking but would also be relevant for videos
that want to sync to the frame clock but draw frames a lot less.
2018-03-30 16:50:54 +02:00
Benjamin Otte
7201e63120 x11: Make the frame clock work in GL and Vulkan 2018-03-30 16:50:28 +02:00
Руслан Ижбулатов
795572710c GDK W32: Remember surface cursor, implicit surface grab
This commit ensures that each GdkSurface impl remembers the
cursor that GDK sets for it, and that this cursor is set
each time WM_SETCURSOR is called for that sufrace's HWND.
This is needed because W32, unlike X, has no per-window cursors -
the cursor on W32 is a global resource, and we need to keep track
of which cursor should be set when pointer is over which surface
ourselves (WM_SETCURSOR exists exactly for this reason).

This commit also makes GDK remember the surface that has an implicit
grab (since implicit grabs are gone from the upper levels of the toolkit),
and ensures that crossing events are correctly synthesized and the grab
is broken when surface focus changes. This fixes a bug where opening
a new window (by clicking something in some other, pre-existing window)
will make that new window not get any mouse input due to the fact
that the mouse-button-down event from that click caused an implicit
grab on the pre-existing window, and that grab was not released afterward.
2018-03-29 23:59:31 +00:00
Руслан Ижбулатов
a82d67bb7d GDK W32: Use the new cursor class
This makes all the code use the new cursor class instead of
raw HCURSOR handles.
2018-03-29 23:59:23 +00:00
Руслан Ижбулатов
d8da6d38db GDK W32: New cursor class
Instead of now-unused GdkWin32Cursor class (a subclass of GdkCursor),
add a stand-alone GdkWin32HCursor class that is a wrapper around
HCURSOR handle.

On creation it's given a display instance, a HCURSOR handle and a boolean
that indicates whether the HCURSOR handle can or cannot be destroyed
(this depends on how the handle was obtained).
That information is stored in a hash table inside the GdkWin32Display
singleton, each entry of that table has reference count.
When the GdkWin32HCursor object is finalized, it reduces the reference
count on the table entry in the GdkWin32Display. When it's created,
it either adds such an entry or refs an existing one.
This way two pieces of code (or the same piece of code called
multiple times) that independently obtain the same HCURSOR from the OS
will get to different GdkWin32HCursor instances, but GdkWin32Display
will know that both use the same handle.

Once the reference count reaches 0 on the table entry, it is freed
and the handle (if destroyable) is put on the destruction list,
and an idle destruction function is queued.

If the same handle is once again registered for use before the
idle destructior is invoked (this happens, for example, when
an old cursor is destroyed and then replaced with a new one),
the handle gets removed from the destruction list.

The destructor just calls DestroyCursor() on each handle, calling
SetCursor(NULL) before doing that when the handle is in use.
This ensures that SetCursor(NULL) (which will cause cursor to disappear,
which is bad by itself, and which will also cause flickering if the
cursor is set to a non-NULL again shortly afterward)
is almost never called, unless GTK messes up and keeps using a cursor
beyond its lifetime.

This scheme also ensures that non-destructable cursors are not destroyed.

It's also possible to call _gdk_win32_display_hcursor_ref()
and _gdk_win32_display_hcursor_unref() manually instead of creating
GdkWin32HCursor objects, but that is not recommended.
2018-03-29 23:59:14 +00:00
Daniel Boles
70198e21ee themes: Make disabled Expander arrow look disabled
If GtkExpander:sensitive was FALSE, the arrow still got the normal fg
colour, which made it look clickable, in contrast to the adjacent label.
Fix this by adding selectors to catch the applicable :disabled states.

Note: Needing these may indicate an oops in generic styles elsewhere,
but I couldn’t see any, so let’s just get it looking right for now.

Close https://gitlab.gnome.org/GNOME/gtk/issues/146
2018-03-29 21:23:50 +01:00
Daniel Boles
7b0387efbf emojichooser.ui: Add i18n context to all tooltips…
…since, unlike in gtk-3-22, it's not just Objects that already had that
here in the title labels. Thanks to Piotr for spotting this!
2018-03-29 19:38:04 +01:00
Piotr Drąg
8fff606c56 Update POTFILES.in 2018-03-29 20:28:53 +02:00
Daniel Boles
072ce56617 emojichooser.ui: Reuse headings as button tooltips
https://bugzilla.gnome.org/show_bug.cgi?id=792632
2018-03-29 19:18:28 +01:00
Tomasz Miąsko
494f75b4cf Widget: Fix doc of default ::keynav-failed handler
https://bugzilla.gnome.org/show_bug.cgi?id=793089
2018-03-29 19:18:28 +01:00
Руслан Ижбулатов
dbda7d770a GDK W32: the .area member of the expose event is gone
The .area and .count members were removed in commit 5c7ee3a483

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 18:02:50 +00:00
Руслан Ижбулатов
8519dbf1b6 GDK W32: Adapt to the window->surface change
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:44:00 +00:00
Руслан Ижбулатов
d1d94b8630 GDK W32: gdk_content_formats_builder_free{,_to_formats}
The function was renamed in commit 2cbe094b91

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:43:59 +00:00
Руслан Ижбулатов
a7e8b5ac78 GDK W32: Don't use gdk_threads_add_timeout_full()
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:43:58 +00:00
Руслан Ижбулатов
b6d3602a35 GDK W32: don't use gdk_drag_find_surface() and gdk_drag_motion()
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:43:57 +00:00
Руслан Ижбулатов
ef01e6ee52 GDK W32: Adapt to event filter removal
Add a new W32 backend-specific message filtering mechanism.
Works roughly the same way old event filtering did, but without
events (events are GDK/X11 concept that never really made sense
on W32), so there's no functionality for 'altering' events being
emitted. If an event needs to be emitted in response to a message
do it yourself.

Implemented like this, it should give better performance than
if we were to use GLib signals for this, since W32 sends a LOT
of messages (unlike X11, which doesn't send events as often)
all the time, and invoking the signal machinery on *each* message
would probably be bad.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:43:55 +00:00
Руслан Ижбулатов
38b4c8d1fa GDK W32: adapt to GdkDragProtocol removal
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:43:54 +00:00
Руслан Ижбулатов
54a4307128 GDK W32: Another massive clipboard and DnD update
Rename GdkWin32Selection to GdkWin32Clipdrop, since GdkSelection
is mostly gone, and the word "selection" does not reflect the
functionality of this object too well.

Clipboard is now handled by a separate thread, most of the code for
it now lives in gdkclipdrop-win32.c, gdkclipboard-win32.c just uses
clipdrop as a backend.

The DnD source part is also put into a thread.
The DnD target part does not spin the main loop, it just
emits a GDK event and returns a default value if it doesn't get a reply
by the time the event is processed.

Both clipboard and DnD use a new GOutputStream subclass to get data
from GTK and put it into a HGLOBAL.

GdkWin32DragContext is split into GdkWin32DragContext and GdkWin32DropContext,
anticipating a similar change that slated to happen to GdkDragContext.

OLE2 DnD protocol is now used by default, set GDK_WIN32_OLE2_DND envvar to 0
to make GDK use the old LOCAL and DROPFILES protocols.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 17:43:53 +00:00
Daniel Boles
6ad33a274b HighContrast: Honour .monospace set by GtkTextView
Copy the line that sets a monospace family from Adwaita (same place too)

noticed at https://gitlab.gnome.org/GNOME/gtk/issues/141#note_91610
2018-03-29 18:19:58 +01:00
Emmanuele Bassi
f8e1924355 ci: Manually install Meson from PyPI
The Fedora base image we use for our CI doesn't always keep Meson up to
date with our requirements, so it's better if we just install Meson via
Python's pip.
2018-03-29 11:37:30 +01:00
Emmanuele Bassi
d50708b024 Add an option for building examples
Examples are not like demos; the latter are installed, and provide a
Flatpak manifest for CI pipelines and GNOME Builder. We should not be
using a single configure time option to gate building both.
2018-03-29 11:37:30 +01:00
Chun-wei Fan
934354fb8c gdkglcontext-win32.c: Fix window->surface changes
Rename the GdkSurface variables to surface, and make sure that we are
creating the context GObject correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-29 13:25:12 +08:00
Benjamin Otte
ea0290c50e builder: Allow named objects to be used in paintable/pixbuf properties
Instead of erroring if an object by a name already exists, use that
object.
2018-03-29 05:02:15 +02:00
Benjamin Otte
4fc072925c gsk: Remove gsk_renderer_create_cairo_surface()
It's not used anymore.
2018-03-29 05:02:15 +02:00
Benjamin Otte
69101a11b5 renderer: Get rid of unused member variable 2018-03-29 05:02:15 +02:00
Benjamin Otte
50b8ee3a5f frameclockidle: Rename header so it's private now 2018-03-29 05:02:15 +02:00
Benjamin Otte
ccde20ea08 frameclockidle: Remove nonexisting functions from header 2018-03-29 05:02:15 +02:00
Benjamin Otte
7ee4bfd9d6 vulkan: Reserve 4 images in the swapchain by default
With the previous approach we would spend most of the time waiting for
the swapchain to be filled again because it seems the compositor takes
care of 2 images at once from time to time.

This is not visible in profiles because waiting for a frame is a
read/poll/whatever operation that does not take CPU. It's only
noticeable because the app becomes less responsive.
2018-03-29 05:02:15 +02:00
Timm Bäder
e6d104bfa0 Rename gtkkineticscrolling.h to gtkkineticscrollingprivate.h
To match the naming scheme we use for all private header files.
2018-03-28 16:47:54 +02:00
Timm Bäder
2f9790b02e expander: Update css docs 2018-03-28 16:42:53 +02:00
Timm Bäder
c2c1262766 testgtk: don't set a focus adjustment on a box
That will make the focus adjustment code in gtkcontainer.c scroll to the
wrong coordinates.
2018-03-28 16:32:47 +02:00
Timm Bäder
0c9c6498c3 Revert "container: Fix scroll adjustment coordinates"
This reverts commit 7351848c75.
2018-03-28 16:32:46 +02:00
Timm Bäder
d0adffe6eb expander: Remove priv pointer 2018-03-28 16:32:46 +02:00
Chun-wei Fan
d64635a760 build: Defer defining HAVE_PANGOFT and HAVE_HARFBUZZ
We forgot to account for the case where we lookup for HarfBuzz manually
under Visual Studio builds, so only set HAVE_HARFBUZZ (and thus
HAVE_PANGOFT, since PangoFT2 depends on HarfBuzz) after we did the
fallback check for HarfBuzz.

Also, check for hb.h instead of harfbuzz/hb.h to be inline with the
pkg-config case, as the sources also include the HarfBuzz header by
using #include <hb.h>, not #include <harfbuzz/hb.h>

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 22:14:32 +08:00
Chun-wei Fan
dfb06e1c7a gsk/gl: Include cairo.h consistently
Follow the other sources that include cairo.h, by just doing #include
<cairo.h>, not <cairo/cairo.h>.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 22:05:17 +08:00
Руслан Ижбулатов
139a627a85 gtkimcontextime: fix to compile again
This makes the code compile again, though obviously there have been
some substantial changes in how IM contexts work, so it's possible
that IME IM context doesn't work now.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 09:28:32 +00:00
Руслан Ижбулатов
7ccf6a7df7 GDK W32: remove unused client_message
This seems to be a leftover from API that was removed in
commit c332ac207a back in 2011.
The code, as it is now, does not even make sense.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:10 +00:00
Руслан Ижбулатов
5c9ae36c50 GDK W32: drop cursor-related GdkWin32Display functions
These functions went away in commit 77bab4e027

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:09 +00:00
Руслан Ижбулатов
102f802b04 GDK W32: remove the use of GDK_SURFACE_STATE
GDK_WINDOW_STATE (or, after rename, GDK_SURFACE_STATE) got
removed from GDK in commit 11a946df39

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:08 +00:00
Руслан Ижбулатов
35305bfc85 GDK W32: move GdkWin32MonitorDpiType to a different header
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 08:33:07 +00:00
Руслан Ижбулатов
48613eca27 Check for freetype2 version when PangoFT is used
Check for freetype2 version, because pangoft works with any version
(pangoft availability does not indicate that ft2 is new enough), unlike
GTK.

On Windows, since pangoft is optional, we check for the presence of
freetype2 .pc file first after finding that we have pangoft, and then
check for FT_Get_Var_Design_Coordinates() manually by looking for the
freetype headers and .lib first, and then looking for the presence of
that symbol, since freetype2's Visual Studio build system does not
generate a .pc file for us.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 16:14:37 +08:00
Руслан Ижбулатов
69e1128cd3 GDK W32: _gdk_surface_invalidate_{for_expose,region}
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 16:13:42 +08:00
Руслан Ижбулатов
6100a9d692 GDK W32: drop the use of gdk_keymap_get_default()
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 16:10:38 +08:00
Руслан Ижбулатов
56782123d2 Only use gtk_print_backends_init() on UNIX
It's from gtkprintbackend.c, which is in gtk_unix_print_sources
source list and thus only available on os_unix only.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 15:43:25 +08:00
Руслан Ижбулатов
5cdb33d1c4 Alternative printbackends subdir for non-UNIX OSes
The main buildscript expects 'print_backends' list to be defined.
Since printbackends is os_unix-only, we need to define this list
ourselves for other OSes.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 15:39:36 +08:00
Руслан Ижбулатов
b7d7602750 Make wayland bits in meson.build conditional on wayland use
Otherwise the build won't configure due to its inability to find
wayland-scanner program on systems where no such program is availble.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-28 15:39:20 +08:00
Matthias Clasen
b1b05bee53 font chooser: Make levels flags
Turn the GtkFontChooserLevel field into flags, and
add flags for OpenType variations and features. The
motivation for this is to make font-features in the UI
opt-in, since applications need to support them by
applying the pango attribute.
2018-03-27 16:14:21 -04:00
Matthias Clasen
85a7d0a201 font chooser widget: Expose tweak-action as property
This is necessary for applications that want to embed
the font chooser widget outside of GtkFontChooserDialog,
in order to access the tweak page.
2018-03-27 16:14:21 -04:00
Matthias Clasen
6ff76a483c font button: notify when ::font-features changes
Lack of notification was causing the font-features to not
show up in the inspector.
2018-03-27 16:14:21 -04:00
Timm Bäder
9665c4d651 spinbutton: spinbuttons aren't entries anymore
Fix a code sample to reflect that.
2018-03-27 19:09:15 +02:00
Timm Bäder
8646f9da19 spinbutton: Remove queue_resize call from realize
No reason for this to be here.
2018-03-27 19:08:50 +02:00
Timm Bäder
490abbb292 spinbutton: Fix a copy/paste bug in the docs 2018-03-27 18:25:03 +02:00
Timm Bäder
cc0a69e101 gl renderer: Fix some crashes
When the first op is a modelview or projection change.
2018-03-27 18:20:52 +02:00
Timm Bäder
5c66f2ec19 accellabel: Stop saying it's a GtkLabel
And clean up the includes accordingly.
2018-03-27 18:20:52 +02:00
Timm Bäder
331af6815b accellabel: Remove some unnused class fields 2018-03-27 18:20:52 +02:00
Timm Bäder
33b2bfa81f accellabel: Remove priv pointer 2018-03-27 18:20:52 +02:00
Emmanuele Bassi
1b62d28cbb ci: Move flatpak building to a script
The YAML is getting hard to modify, so let's use a simple script like we
do for the other CI jobs.
2018-03-27 12:47:05 +01:00
Emmanuele Bassi
69441cbace Do not test for linker flags
Meson warns when doing that, as it's not really portable.

Since we're using platform-specific linker flags on Darwin, we can also
do the same on Linux; the syntax is GCC-specific, so we're going to need
Clang users to test it.
2018-03-27 12:47:05 +01:00
Benjamin Otte
b9445f4d7e Merge branch 'krnowak/leak-fixes' into 'master'
Fix some leaks

See merge request GNOME/gtk!87
2018-03-27 11:37:24 +00:00
Krzesimir Nowak
06661da8b0 Fix some leaks 2018-03-27 13:14:41 +02:00
Matthias Clasen
4b2c4ab109 wayland: Don't emit signals if nothing changed
We were emitting a preedit-changed even if the preedit text did
not actually change, causing text views to scroll.
2018-03-26 21:38:28 -04:00
Timm Bäder
b26e584e29 gl renderer: Rename everything called window to surface 2018-03-26 21:13:52 +02:00
Timm Bäder
81d19154a3 entry: Remove useless queue_draw call
This is already taken care of by the add_class/remove_class.
2018-03-26 20:03:00 +02:00
Benjamin Otte
f494d6ae1f snapshot: Generate better names for offset nodes 2018-03-26 19:43:06 +02:00
Benjamin Otte
353ad30b12 rendernode: Fix serializing
Adding the offset node broke serialization in 2 ways:

1. We store the enum value in the node, so make sure to not change it
   for existing values
2. The offset node was missing in the deserialization lookup table
2018-03-26 19:43:06 +02:00
Benjamin Otte
e2ee2a6dab iconhelper: Apply scale to paintable
Instead of fiddling around with scale in the iconhelper (and getting it
wrong), create a GtkScaler around the paintable that takes care of the
scaling.
2018-03-26 18:46:22 +02:00
Benjamin Otte
5e99646e1c dnd: Remove gtk_drag_set_icon_surface()
All users are gone. Use gtk_drag_set_icon_paintable() instead.
2018-03-26 18:32:38 +02:00
Benjamin Otte
cc9908353c tests: Don't use gtk_drag_set_icon_surface() 2018-03-26 18:30:34 +02:00
Benjamin Otte
9afbf02bc2 textview: Port dnd icon to be a GdkPaintable 2018-03-26 18:16:37 +02:00
Benjamin Otte
3f28a6851b colorswatch: Port drag icon to paintables 2018-03-26 18:16:36 +02:00
Benjamin Otte
8e3e321da4 colorbutton: Port dnd icon to paintable
Patch is untested, because colorbuttons can't do DND at the moment.
2018-03-26 18:16:36 +02:00
Benjamin Otte
aa1d1e4189 treeview: Turn drag icon into paintable 2018-03-26 18:16:36 +02:00
Benjamin Otte
a269e9a266 iconview: Port DND icons to snapshot paintables 2018-03-26 18:16:36 +02:00
Benjamin Otte
5415d05359 tests: Remove references to long-deleted property 2018-03-26 18:16:36 +02:00
Benjamin Otte
60719bb67c textutil: Make gtk_text_util_create_drag_icon() return a paintable 2018-03-26 18:16:36 +02:00
Benjamin Otte
7fdcc58532 snapshot: Add gtk_snapshot_to_paintable()
This is intended for DND icons
2018-03-26 18:16:36 +02:00
Benjamin Otte
9b83116fcb snapshot: Export gtk_snapshot_append_layout()
This is the equivalent snapshot function to pango_cairo_show_layout().

Not to be confused with gtk_snapshot_render_layout(), which is the
equivalent to gtk_render_layout().
2018-03-26 18:16:36 +02:00
Benjamin Otte
e6d24f4c15 snapshot: Make gtk_snapshot_append_node() take care of offset
Push an offset node when append_node is called. That resets the offset.
2018-03-26 18:16:36 +02:00
Benjamin Otte
ce743f28a1 rendernode: Add an offset node
This is a special case of the transform node that does a 2D translation.

The implementation in the Vulkan and GL renderers is crude and just does
the same as the transform node.

Nothing uses that node yet.
2018-03-26 18:16:36 +02:00
Piotr Drąg
b8b6324c4c Update Polish translation 2018-03-26 01:42:57 +02:00
Benjamin Otte
8c43f22e3e colorscale: Draw gradient using render nodes
Don't use Cairo when it's not needed.
2018-03-26 00:31:12 +02:00
Benjamin Otte
438b4b6b5c colorscale: Draw hue background as a texture
No need to use Cairo here.
2018-03-26 00:31:12 +02:00
Benjamin Otte
b16ac01a03 colorplane: Create background image as a texture
Don't create it using Cairo.
2018-03-26 00:31:12 +02:00
Matthias Clasen
448d2502d9 Merge branch 'bz773274' into 'master'
wayland: Don't paint if the window is unmapped

See merge request GNOME/gtk!32
2018-03-25 20:44:44 +00:00
Benjamin Otte
6bad307180 colorscale: Don't free surface data before surface
When drawing onto a recording surface, source surfaces get cached.

But if we g_free() the surface data after we're done, that cache is
gonna point at invalid data...
2018-03-25 22:38:42 +02:00
Timm Bäder
98a9f2b3c1 GdkGLContext: Add a GL debug message callback
If G_ENABLE_CONSISTENCY_CHECKS is defined (i.e. if our buildtype is
'debug'), add a opengl debug callback that prints all debug messages
with a severity higher than SEVERITY_NOTIFICATION as a warning to the
console.
2018-03-25 21:04:36 +02:00
Timm Bäder
433517fdc9 gl renderer: Skip all 0-sized nodes
These will cause problems later on.
2018-03-25 11:47:57 +02:00
Timm Bäder
7240178988 gl renderer: Remove cairo node special case 2018-03-25 11:47:57 +02:00
Emmanuele Bassi
eb382c1321 ci: Remove --werror
Turns out that GCC errors out when building the GLib test suite, as it
now checks for overflows in allocator functions, and we're testing for
those.

This would not be an issue for GTK, but since we're building GLib as a
subproject, we get failures for those as well.

Until we can find out how to disable errors for subprojects, or fix the
GLib test suite not to trip up warnings in GCC, we're going to live
without compiler warnings treated as errors for a while.
2018-03-25 00:31:36 +00:00
Emmanuele Bassi
cfeab26de0 ci: Use the appropriate argument for errors
The option to enable fatal warnings in Meson is `--werror`.
2018-03-25 00:00:02 +00:00
Daniel Boles
f8ecd488cd Menu: Don't leak priv->motion_controller 2018-03-24 22:01:02 +00:00
Benjamin Otte
b83cd9e818 ci: build with -Werror 2018-03-24 22:27:28 +01:00
Emmanuele Bassi
ba65c1ae58 ci: Disable ccache
Forcibly remove any ccache use, even if it's installed.
2018-03-24 21:17:34 +00:00
Emmanuele Bassi
fe45cf9c09 docs: Style fixes for the contribution guidelines 2018-03-24 21:16:16 +00:00
Benjamin Otte
1cfa88ed91 snapshot: Remove renderer
Now that there's no longer a need to keep the renderer around for Cairo
rendering, don't do that then.
2018-03-24 21:57:20 +01:00
Benjamin Otte
e84c6acc4f rendernode: Remove renderer argument
It's not needed to create Cairo nodes anymore.
2018-03-24 21:57:20 +01:00
Benjamin Otte
df600669a2 rendernode: Create Cairo surfaces as recording surfaces
This way, we can postpone the actual rendeing of the node until the
renderer. This allows the renderer to choose the right scale to
render at, so it can decide to use 2x scale for hidpi on its own.

Last but not least, it makes all nodes independent of the context they
are created in, because they do not need to know at snapshot time what
they will ultimately be rendered into.
2018-03-24 21:57:20 +01:00
Benjamin Otte
f680d5d130 vulkan: Remove special case for Cairo surfaces
This is in preparation for the next commits which switch Cairo nodes to
recording surfaces.
2018-03-24 21:57:20 +01:00
LRN
9c0c1702d5 Merge branch 'lrn/bug-773299' into 'master'
bug 773299 2nd

See merge request GNOME/gtk!79
2018-03-24 11:08:36 +00:00
Руслан Ижбулатов
5ff9e34fbb GDK W32: Adapt DnD event putting to recent changes
Set the display for each event that we put.
Also reorganize the dnd_event_put() function a bit, giving it a surface
directly instead of setting it by implication.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:59:02 +00:00
LRN
0c3d757ba2 Merge branch 'lrn/bug-773299' into 'master'
bug 773299

See merge request GNOME/gtk!78
2018-03-24 10:46:59 +00:00
Руслан Ижбулатов
b8e6d06372 GDK W32: Don't check dest_surface for != NULL on button events
dest_surface is going to always be NULL for source contexts.
Previously we used to put the root window there to pass this check,
but root windows are gone (and root surfaces never existed to begin
with), so we have to adapt.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:28:11 +00:00
Руслан Ижбулатов
6b50788901 GDK W32: Init display scale to the global Windows scale, not 1
This affects gdk_device_query_state() for the virtual device. It has
no window, and is forced to query the display itself, and display
defaults its scale to 1 even for HiDPI desktops. Use the same
"query scale of a NULL monitor" trick that we use in other places
to get the global desktop scale.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:09:54 +00:00
Руслан Ижбулатов
6bdb004dfd GDK W32: adapt to the recent changes in GdkEvent
https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-03-24 10:09:52 +00:00
Dz Chen
e239de064b Update zh_CN po and po-properties translations 2018-03-23 23:57:51 +08:00
Daniel Boles
0b8215e0b1 Adwaita: Regenerate CSS from SASS
https://gitlab.gnome.org/GNOME/gtk/merge_requests/66 introduced spurious
red/green fore/background.

Also, the GtkVideo stuff didn't get regenerated in.
2018-03-22 20:58:31 +00:00
Daniel Boles
563cb69c6d Merge branch 'toolbar-spacing-fix' into 'master'
theme: Be more selective when adding margins to toolbar items

See merge request GNOME/gtk!66
2018-03-22 20:54:01 +00:00
Benjamin Otte
b01ee88f11 surface: Make process_updates no longer be a vfunc 2018-03-21 23:28:26 +01:00
Benjamin Otte
ade14779b1 surface: Remove some unused vfuncs 2018-03-21 23:28:26 +01:00
Benjamin Otte
cb4ec6f384 gdk: Remove GdkSurfaceImpl::shape_combine_region vfunc
... and all the implementations.

Input shapes still exist.
2018-03-21 23:28:26 +01:00
Benjamin Otte
4fff16860f gdk: Remove a bunch of unused variables 2018-03-21 23:28:26 +01:00
Emmanuele Bassi
1e3d9e1293 Reduce the header level in the bug template
Make version and additional information headers use h2, like everything else.
2018-03-21 11:49:24 +00:00
Matthias Clasen
877b48579e Merge branch 'wip/sync-pre-swap-buffers' into 'master'
Synchronize wl_surface state before wl_surface_commit

See merge request GNOME/gtk!75
2018-03-21 11:40:55 +00:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Alexander Larsson
945379d623 GdkSurface: Fix doc comments for remoteve invalidate_children argument 2018-03-21 09:18:30 +01:00
Alexander Larsson
3f2894fec1 broadway: Fix up window -> surface renames 2018-03-21 09:17:50 +01:00
Alexander Larsson
8d05fcd35c Fix up indentation after GdkSurface rename
This fixes up a lot of the indentation issues from the
rename of windows to surfaces, at least the ones in the headers
and many others.
2018-03-21 09:06:31 +01:00
Jonas Ådahl
7e102f8879 wayland/vulkancontext: Sync surface state before vkQueuePresentKHR
A side effect of vkQueuePresentKHR is the Vulkan implementation calling
wl_surface_commit() on the corresponding Wayland surface. Thus, before
this, we must synchronize the surface state (e.g. opaque region, window
geometry, etc) that changed since last time. Prior to this commit this
was done after calling vkQueuePresentKHR(), causing the surface state to
always correspond to the previous buffer state. As of this commit this
is now done before calling vkQueuePresentKHR(), thus before
wl_surface_commit().
2018-03-21 14:14:32 +08:00
Jonas Ådahl
1d5d46ff29 wayland/glcontext: Sync surface state before swapping buffers
A side effect of eglSwapBuffers* is the EGL implementation calling
wl_surface_commit() on the corresponding Wayland surface. Thus, before
swapping buffers, we must synchronize the surface state (e.g. opaque
region, window geometry, etc) that changed since the last buffer swap.
Prior to this commit, this was done after eglSwapBuffers*, causing the
surface state to always correspond to the previous buffer state. As of
this commit this is now done before swapping the buffers, thus before
wl_surface_commit().
2018-03-21 14:14:20 +08:00
Benjamin Otte
2a4ffd4a59 surface: Simplify gdk_surface_invalidate_region()
Remove duplicate functions and unused arguments.

Functionality is identical otherwise.
2018-03-21 04:10:07 +01:00
Benjamin Otte
8202f333ea surface: Stop tracking clip region
It's not needed because we're not using it for anything anymore now that
client-side surfaces aren't drawn anymore.
2018-03-21 04:10:07 +01:00
Benjamin Otte
0ce19eed08 gdk: Remove gdk_surface_shape_combine_region()
If you want transparent region, you can just render them transparent.
If you want input shaping, use gdk_surface_input_shape_combine_region().

Also remove gtk_widget_shape_combine_region().
2018-03-21 04:10:07 +01:00
Benjamin Otte
ef693f317c surface: Remove gdk_surface_get_clip_region()
... and gdk_surface_get_visible_region() APIs. They are unused.
2018-03-21 04:10:07 +01:00
Benjamin Otte
f5ff44595a gdk: Remove unused members from surface struct 2018-03-21 04:10:06 +01:00
Benjamin Otte
101cf7dcbd surface: Stop shaping native children of csw surfaces
We don't have them anymore and they are goig away anyway.
2018-03-21 04:10:06 +01:00
Emmanuele Bassi
f260e76ede docs: Drop the 'Contributing' section from the README
We have a whole document for that, and it's up to date with regards to
the GitLab workflow.
2018-03-21 01:02:23 +00:00
Emmanuele Bassi
68379cab9b Add a template for bug reports
GitLab issues can use templates to guide users when filing new bug
reports; we should take advantage of this feature.
2018-03-21 00:59:06 +00:00
Emmanuele Bassi
09e6b4dc01 docs: Point at the right place for new bugs
We use GitLab issues, now.
2018-03-21 00:58:46 +00:00
Emmanuele Bassi
9165dd33ed Add a build status badge
Like all cool kids are doing, these days.
2018-03-21 00:45:09 +00:00
Matthias Clasen
47d79a4257 Add appdata for gtk4-widget-factory
This will let us build a better flatpak for gtk4-widget-factory.
2018-03-20 20:05:15 -04:00
Benjamin Otte
5a32469303 surface: Remove GSK_SURFACE_ROOT
Root surface have been dead for a while now, no need to keep the enum
value around.
2018-03-21 00:58:01 +01:00
Emmanuele Bassi
5290d9d8c7 Merge branch 'ci-flatpak'
Generate Flatpak bundles for gtk-demo and gtk-widget-factory when
running the CI pipeline, and store them as artifacts on the CI server.
2018-03-20 23:52:31 +00:00
Benjamin Otte
7862894f11 surface: Remove gdk_surface_invalidate_maybe_recurse()
This also means we can now get rid of child funcs because they're not
used anymore.
2018-03-21 00:43:28 +01:00
Benjamin Otte
a1898d678b surface: Remove gdk_surface_scroll()
It's yet another fancy way to call gdk_surface_invalidate_region().

Also remove the one testgtk test that was still using it.
2018-03-21 00:43:28 +01:00
Benjamin Otte
d6ba10bacf surface: Remove gdk_surface_move_region()
It's just a cute version of gdk_surface_invalidate_region()
these days and people can call that function instead.
2018-03-21 00:43:28 +01:00
Benjamin Otte
c4ecc3f4f7 surface: Remove queue_antiexpose()
... and its implementation in the X11 backend.

GDK does lots of work trying to reduce the region in expose events
so that when the server sends multiple expose events, touching the
same area we can make sure to only redraw stuff once. However:
(1) this is only relevant of there's tons of delay and multiple
    expose events get sent
(2) we coalesce multiple events into a single expose event anyway
(3) we do this on the frame clock

But most importantly:
(4) Since the invention of compositing, servers caches all contents
    anyway
2018-03-21 00:43:28 +01:00
Benjamin Otte
63edf43e86 gdk: Remove unused area member from GdkEventExpose 2018-03-21 00:43:28 +01:00
Benjamin Otte
5c7ee3a483 gdk: Remove unused count member from GdkEventExpose 2018-03-21 00:43:28 +01:00
Benjamin Otte
4f87861c9a widget: Remove useless macro 2018-03-21 00:43:28 +01:00
Matthias Clasen
cb41d1586f Add appdata for gtk4-demo
This will let us build a better flatpak for gtk4-demo.
2018-03-20 19:40:30 -04:00
Emmanuele Bassi
f353bbd0bc ci: Add two flatpak jobs
When building GTK through the CI infrastructure, it would help to have
some ways of testing it; for instance, if we want to verify that theme
changes are useful, or if we want to run the result without necessarily
build it locally.

This is where flatpak comes in handy. By having the CI build a flatpak
buundle, and storing it as an artifact, of the GTK demos, we can easily
point developers and designers to an installable binary that won't break
their system, nor will require development tools and environments to
run.
2018-03-20 23:14:32 +00:00
Emmanuele Bassi
1873304e7b Add flatpak builder manifests for our demos
We can use manifests as targets when building GTK inside a flatpak
environment; or we can use them for CI purposes.
2018-03-20 23:14:32 +00:00
Olivier Fourdan
77a5d00047 wayland: Drop cairo surfaces when withdrawing
If a surface is unmapped by the client while gdk is processing updates,
(for example Firefox un-mapping its window on Expose events), the
windowing backend resources might be lost (for example with Wayland)
which can cause a crash in end_paint().

Make sure we drop the cairo surfaces as well when hiding the surface,
that will avoid the crash in gdk_surface_impl_wayland_end_paint() when
trying to attach the staging cairo surface to a released wl_surface,
these will be recreated when needed when the surface becomes visible
again and there is no need to keep such buffers around for a surface
which is not visible anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=793062
2018-03-20 18:49:56 +01:00
Emmanuele Bassi
706a6cf0a3 Merge branch 'tests-gdk' into 'master'
gitlab-ci: enable gtk+:gdk tests

See merge request GNOME/gtk!74
2018-03-20 17:20:28 +00:00
Emmanuele Bassi
b304655e2d tests: Update renamed symbol 2018-03-20 17:05:33 +00:00
Carlos Garnacho
28c27f37ee Merge branch 'detect-synaptics-touchpads-v2' into 'master'
x11/xi2: Report touchpads as TOUCHPAD, not MOUSE

See merge request GNOME/gtk!65
2018-03-20 17:03:15 +00:00
Piotr Drąg
dcc6124209 Update POTFILES.in 2018-03-20 17:32:35 +01:00
Christoph Reiter
feb7bf2fbe gitlab-ci: enable gtk+:gdk tests
xvfb doesn't like C.utf8 and returns XLocaleNotSupported.

While (afaik) C.utf8 and C.UTF.8 should be the same thing, and the former
is returned by locale -a on Fedora, switch to C.UTF-8 to make xvfb happy.

This makes gtk+:gdk tests pass.
2018-03-20 17:31:38 +01:00
Alexander Larsson
695d141f32 Merge branch 'rename-window-to-surface' into 'master'
Rename window to surface

See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00:00
Matthias Clasen
b83ba41f2d Merge branch 'accessible-role' into 'master'
gtkbuilder: add accessibility role declaration

Closes #109

See merge request GNOME/gtk!69
2018-03-20 15:46:20 +00:00
Benjamin Otte
e798eedfb6 Merge branch 'style-context-null-widget-guard-master' into 'master'
gtkstylecontext: guard against gtk_css_widget_node_get_widget() returning NULL in more places

See merge request GNOME/gtk!71
2018-03-20 15:36:19 +00:00
Matthias Clasen
e6cd6f8db6 Merge branch 'a11y-fixes' into 'master'
Fix some accessibility issues in demos

Closes #110

See merge request GNOME/gtk!68
2018-03-20 15:33:35 +00:00
Alexander Larsson
4ac450b324 Convert all references to GdkEvent->surface 2018-03-20 16:25:50 +01:00
Christoph Reiter
f440c48dea gtkstylecontext: guard against gtk_css_widget_node_get_widget() returning NULL in more places
When the widget gets finalized it clears the widgetnode and gtk_css_widget_node_get_widget
returns NULL. Guard against gtk_css_widget_node_get_widget() returning NULL like in other
places.

See https://gitlab.gnome.org/GNOME/pygobject/issues/28#note_82862
2018-03-20 16:02:51 +01:00
Alexander Larsson
19ca2789c0 GtkWidget: Continuer rename of widget->surface
This completes the rename manually.
2018-03-20 15:40:31 +01:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Alexander Larsson
3dce0dcca7 GdkSurface: Rename lots of stuff from window->surface
Mostly these are internal things, but the major public change is
that event.window is now event.surface.
2018-03-20 15:14:10 +01:00
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
890080ebf7 GdkWindow -> GdkSurface: File renames
Rename all *window.[ch] source files.

This is an automatic operation, done by the following commands:

for i in $(git ls-files gdk | grep window); do
    git mv $i $(echo $i | sed s/window/surface/);
    git sed -f g $(basename $i) $(basename $i | sed s/window/surface/) ;
done

git checkout NEWS* po-properties po
2018-03-20 11:46:11 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
1d26879fa5 tests: Add testtexture
a test that simply loads a given file as a texture and renders it.
2018-03-20 09:40:10 +01:00
Timm Bäder
0124740fa0 gl renderer: Support large textures
By tiling them.
2018-03-20 09:40:10 +01:00
Timm Bäder
3f367277fe snapshot: Limit cairo nodes to clip region
In certain cases, we might create large cairo nodes, resulting in
surfaces so large, cairo can't handle them. Fix this by limiting the
cairo node to the current clip region.
2018-03-20 09:40:10 +01:00
Timm Bäder
4240119d64 gl renderer: add basic code to support texture tiling 2018-03-20 09:40:10 +01:00
Timm Bäder
a9fec38680 rendernode: Don't use gdk_texture_download_surface
It can't handle the texture sizes we'd like to support
2018-03-20 09:40:10 +01:00
Timm Bäder
22780044ec rendernode: Don't use gdk_texture_download_surface
It can't handle the texture sizes we'd like to support
2018-03-20 09:37:59 +01:00
Timm Bäder
4353ad224f rendernode: Check cairo surface status after creation 2018-03-20 09:37:59 +01:00
Timm Bäder
85eef63b32 inspector: Use the attach widget as menu parent object
Fixes #101
2018-03-20 09:37:59 +01:00
Timm Bäder
9e9db8607b Revert "gl renderer: Limit texture node size to clip"
This reverts commit 0234e8e2c9.

This broke partially clipped-away nodes when they are being transformed,
e.g. by a rotation
2018-03-20 09:37:59 +01:00
Timm Bäder
8ef2b10f70 gldriver: Name driver instances 'self' 2018-03-20 09:37:59 +01:00
Timm Bäder
50ffa86d18 progressbar: Remove priv pointer 2018-03-20 09:37:59 +01:00
Timm Bäder
2210078a64 progressbar: Remove snapshot implementation 2018-03-20 09:37:59 +01:00
Timm Bäder
25ab5b9f0b levelbar: Remove priv pointer 2018-03-20 09:37:59 +01:00
Timm Bäder
f261bf2fc6 switch: Avoid a gtk_widget_get_clip call
Since we get the correct clip anyway from the gtk_widget_size_allocate
call above.
2018-03-20 09:37:59 +01:00
Timm Bäder
922b2cf99a grid: Remove child list
Save the child info using g_object_set_qdata and just use the widget's
built-in child list for everthing else. This is especially simple for
GtkGrid since it has never supported reordering its child widgets.
2018-03-20 09:37:59 +01:00
Timm Bäder
c8b0c55284 paned: Remove priv pointer 2018-03-20 09:37:59 +01:00
Timm Bäder
93aa5ce167 container: Don't use forall() in compute_expand
Use the widget list instead, which saves some code.
2018-03-20 09:37:58 +01:00
Timm Bäder
781400f6d3 container: Don't use forall() in get_request_mode
We can just use the widget child list, which save some code.
2018-03-20 09:37:58 +01:00
Rico Tzschichholz
f7326ff828 texture: Fix documentation block of gdk_texture_download 2018-03-19 20:31:15 +01:00
Samuel Thibault
9561b97dc4 Fix some accessibility issues in demos
Fixes #110
2018-03-19 18:07:25 +01:00
Samuel Thibault
bd986f9534 gtkbuilder: add accessibility role declaration
This allows to override the role declared to the atk stack.  For
instance,

<accessibility>
  <role type="static"/>
</accessibility>

allows to tell the accessibility stack that a label is just a message in
a message box.

Fixes #109
2018-03-19 18:07:06 +01:00
Daniel Boles
a15080c640 gdkrgba: Add a missing apostrophe in a doc comment 2018-03-19 15:14:20 +00:00
Quentin Glidic
f431e28ce3 gtkimcontextsimple.c: Use X11_DATA_PREFIX only on X11
Unlike what commit d01ea18dc3 says, X11 is
not a requirement for Wayland, so a Wayland-only build is possible. We
just use the same logic as other non-X11 platforms.

https://bugzilla.gnome.org/show_bug.cgi?id=784615

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2018-03-19 11:39:47 +01:00
Daniel van Vugt
0ad27cc598 x11/xi2: Report touchpads as TOUCHPAD, not MOUSE
is_touchpad_device() for XI2 was hardcoded to look for libinput only.
Extend it slightly to correctly identify other Xorg touchpad drivers.

https://gitlab.gnome.org/GNOME/gtk/issues/97
2018-03-19 12:08:29 +08:00
Benjamin Otte
1a1373779f mediafile: Improve error message
We are using media plugins these days, so this is not a compile-time
issue.
2018-03-19 00:28:20 +01:00
Benjamin Otte
2aee39d12c video: Add gtk_video_get_file()
That function was missing.
2018-03-19 00:28:20 +01:00
Rico Tzschichholz
158df3c1bb gtk: Fix some g-i annotations warnings 2018-03-18 21:47:10 +01:00
Piotr Drąg
f1e1e9a71e Update POTFILES.in 2018-03-18 21:12:29 +01:00
Benjamin Otte
04a3b8b6df mediastream: Add gtk_media_stream_realize/unrealize()
This allows widget to attach their streams to GdkWindow(s)

The idea is to allow attaching a stream to windowing system(s) so the
stream can make use of its resources, in particular GL contexts.

I am however unsure what to attach to:
- GtkWindow
- GdkWindow
- GtkWidget
- GskRenderer
Each of these provide advantages and disadvantages.

So I'm very much open to better suggestions.
2018-03-18 21:01:23 +01:00
Benjamin Otte
09a21f1cd2 build: Make GStreamer backend the default
Instead of compiling without media backend by default, we now use the
GStreamer backend.

This means that CI now requires gstreamer support.
2018-03-18 21:01:23 +01:00
Benjamin Otte
0f4ab5862a gtk-demo: Add a simple video player example
For now, it's impossible to unfullscreen. Somebody should figure out a
way to do this.
2018-03-18 21:01:23 +01:00
Benjamin Otte
2362e4d41e gtk: Add a GStreamer implementation of GtkMediaFile 2018-03-18 21:01:23 +01:00
Benjamin Otte
182f39aba7 demos: Round up the paintable demos with a media stream 2018-03-18 21:01:23 +01:00
Benjamin Otte
3d9cb477aa demos: Add an animated paintable demo
This builds on the paintable demo.
2018-03-18 21:01:23 +01:00
Benjamin Otte
357175f0b1 gtk-demo: Add paintable demo 2018-03-18 21:01:23 +01:00
Benjamin Otte
b410b48eed demos: Add a video benchmark to widgetbowl demo 2018-03-18 21:01:23 +01:00
Benjamin Otte
5bd85058d9 gtk-demo: Add a video example (with controls) to the images demo 2018-03-18 21:01:23 +01:00
Benjamin Otte
7cf6da60da gtk: Add GtkVideo
GtkVideo is a simple video player widget. It probably needs some more
configurability, but it does its job.
2018-03-18 21:01:23 +01:00
Benjamin Otte
9700a98f48 gtk: Add GtkMediaControls
This is a basic first implementation of controls for a GtkMediaStream,
modeled after Totem's UI.
2018-03-18 21:01:23 +01:00
Benjamin Otte
800bcb5cb4 gtk: Add ffmpeg implementation of GtkMediaFile
This adds a module using ffmpeg to implement the GtkMediaFile interface.
2018-03-18 21:01:23 +01:00
Matthias Clasen
e4338c4d42 mediafile: Turn into an extension point
This way, we can support external libraries providing implementations of
GtkMediaFile.

We also add a media backend called 'nomedia' that can be enabled to not
compile any support for GtkMediaFile. This is useful when people want to
statically compile GTK into an application that does not use media.
For now, this option is the default.

We also support a new environment variable GTK_MEDIA that allows
selecting the implementation to use.
GTK_MEDIA=help can be used to get info about the available
implementations.
2018-03-18 21:01:23 +01:00
Benjamin Otte
29cccf5e84 gtk: Add GtkMediaFile
GtkMediaFile is an implementation of GtkMediaStream to play back files.

Except it isn't an implementation yet, but only an interface.
2018-03-18 21:01:23 +01:00
Benjamin Otte
4db1a5f5c4 gtk: Add GtkMediaStream
GtkMediaStream is the new base class for playback of audio and video
streams.

It implements GdkPaintable for rendering.
2018-03-18 21:01:23 +01:00
Rico Tzschichholz
4642e86284 texture: Fix compilation by avoiding to include not-yet available headers 2018-03-18 20:52:46 +01:00
Benjamin Otte
ea84e974e6 snapshot: Turn into GObject
This makes GdkSnapshot the base class for GtkSnapshot and hopefully
stops confusing bindings.

C code should see no difference to before.
2018-03-18 19:21:33 +01:00
Benjamin Otte
abc9b944f9 testsuite: Update C++ keywords test to GTK 3.0.0 2018-03-18 19:20:46 +01:00
Benjamin Otte
87fa7ff314 build: Fix printbackends
There's no "auto" option anymore, so remove checks for that option.
2018-03-18 19:08:28 +01:00
Benjamin Otte
6dc29f2852 gltexture: Rename variable
Makes docs build happy.
2018-03-18 18:42:20 +01:00
Nikita Churaev
0f13a232c6 theme: Be more selective when adding margins to toolbar items
Only add margins to direct children of toolbar items, this fixes the
gaps between linked buttons inside custom toolbar items.
2018-03-18 13:33:52 +03:00
Benjamin Otte
82a99a3643 texture: Expose subclasses as subclasses
This is necessary so that bidnings work properly and don't make
gdk_gl_texture_release() a function on GdkTexture.
It also allows code to identify what type of texture they are dealing
with.

Finally, we can now decide to add getters later without screwing
anything up, if we want to allow people to access GL textures directly.
2018-03-18 05:57:07 +01:00
Benjamin Otte
d54ca3c74f gdk: Add GDK_MEMORY_DEFAULT
This is the default memory format.

I added it because it is way better than including a private header and
using GDK_MEMORY_CAIRO_FORMAT_ARGB32.
2018-03-18 05:57:07 +01:00
Benjamin Otte
ee8e42f19b gdk: Remove gdk_texture_new_from_data()
Use gdk_memory_texture_new() instead.
2018-03-18 05:57:07 +01:00
Daniel Boles
41a5e744d8 SpinButton: Desensitise +/- buttons as appropriate
The logic for this in 3 got lost in the move from gadgets to widgets. We
must update the sensitivities when :wrap, :value, or the bounds change.

Close: https://gitlab.gnome.org/GNOME/gtk/issues/88
2018-03-17 15:53:50 +00:00
Timm Bäder
a25dcd0f74 snapshot: Fix some indentation 2018-03-17 14:13:42 +01:00
Timm Bäder
7351848c75 container: Fix scroll adjustment coordinates 2018-03-17 14:05:55 +01:00
Timm Bäder
bb04808eea testgtk: Remove alpha widgets demo
This used to test that "windowed widgets" and "non-windowed widgets"
handle alpha correctly, but none of the mentioned widgets are windowed
at all anymore. For the rest, this is more easily and dynamically
testable by simply using the inspector.
2018-03-17 14:05:40 +01:00
Timm Bäder
004d0f2fc1 testgtk: GtkSpinButton is not a GtkEntry anymore 2018-03-17 12:09:30 +01:00
Timm Bäder
fb763cd4ca layout: Fix scrolling
We accidentally dropped the code that takes the adjustments into account
at some point.
2018-03-17 12:09:30 +01:00
Timm Bäder
a5e20c5ffc layout: remove map implementation
gtk_widget_real_map already maps all the child widgets.
2018-03-17 12:09:30 +01:00
Timm Bäder
3ca298ec94 container: Remove focus widget sorting code
The more general version of this code lives in gtkwidgetfocus.s now.
2018-03-17 12:09:30 +01:00
Timm Bäder
ad85a75c2e window: Use widget facilities to sort focus menubars 2018-03-17 12:09:30 +01:00
Timm Bäder
1a8e7d97ae menubar: Use GtkWidget focusing facilities 2018-03-17 12:09:30 +01:00
Timm Bäder
1eb22e7927 radibutton: Use focusing facilities from GtkWidget
Instead of the ones from GtkContainer which will hopefully soon go away.
2018-03-17 12:09:30 +01:00
Timm Bäder
fd28bddde1 container: Only do custom focus management if a focus chain is set
Otherwise, the process should be the same one we use in GtkWidget.
2018-03-17 12:09:30 +01:00
Timm Bäder
ca4f08136a container: Rename parent_class to gtk_container_parent_class
To match the name we have everywhere else.
2018-03-17 12:09:30 +01:00
Timm Bäder
16689a1e81 widget: Fix a few typos in cursor documentation 2018-03-17 12:09:30 +01:00
Timm Bäder
24e708a770 popover: Remove an unneeded local variable 2018-03-17 12:09:30 +01:00
Timm Bäder
64e128629f magnifier: Clip child node to magnifier size
It's still broken in several other ways, but now one less.
2018-03-17 12:09:30 +01:00
Timm Bäder
6cfb720ab7 Fix a few get_allocated_width/height usages 2018-03-17 12:09:30 +01:00
Timm Bäder
3e6fea0550 widgetbowl: Add a proper description
Instead of the copy/pasted one from the fishbowl demo.
2018-03-17 12:09:30 +01:00
Daniel Boles
146082d464 Notebook: Don’t show raw underline/markup in popup
If @menu_label == NULL, we create a default page->menu_label. This took
@tab_label.get_label() and passed that to page->menu_label.set_text().
This is wrong because we set the plain text of the menu_label from the
rich text of @tab_label. So, if @tab_label used mnemonics or markup, our
menu_label got the raw underline or markup tags shown in it as raw text.

As we call set_text() on the menu Label, the fix is to be symmetric: use
@tab_label’s get_text() as source, as that strips underlines and markup.

It’s not worth making the default Label ‘inherit’ :use-underline/markup;
that’s a slippery slope, and users wanting such things can just create a
fully fledged GtkLabel to pass as @menu_label to suppress the default.

https://bugzilla.gnome.org/show_bug.cgi?id=705509
2018-03-16 22:34:05 +00:00
Benjamin Otte
b64a403100 selection: Remove surface APIs 2018-03-16 06:04:45 +01:00
Benjamin Otte
12409ee075 cellrendererpixbuf: Store the texture in the iconhelper paintable
That's kinda weird but allows us to delete the texture case from
GtkIconHelper and GTK_IMAGE_TEXTURE from the GtkImageType enum.

And it doesn't cause any other problems because the cell renderer
can't deal with paintables - otherwise it would mirror GtkImage and have
a "paintable" property instead.
2018-03-16 06:04:45 +01:00
Benjamin Otte
cbe40f5f46 image: Remove gtk_image_set_texture()
gtk_image_get_paintable() is a perfect replacement, so use that one.
2018-03-16 06:04:45 +01:00
Benjamin Otte
2935ef8128 image: Add gtk_image_set_can_shrink()
Images with that value set will request a 0x0 minimum size and scale
down their contents.
2018-03-16 06:04:45 +01:00
Benjamin Otte
c6541853ab image: Add gtk_image_set_keep_aspect_ratio()
If set, the image will draw its contents while keeping their aspect
ratio. That means empty areas show up on the top/bottom or left/right.

Also move the special-case snapshotting code for icons to
GtkIconHelper. That's where it belongs.
2018-03-16 06:04:45 +01:00
Benjamin Otte
0a08c03885 iconhelper: Implement GdkPaintable
This only implements the vfuncs, but does not actually emit signals
yet.

It's also not useed for anything other than snapshot() so far, this
will come in later commits.
2018-03-16 06:04:45 +01:00
Benjamin Otte
af18796312 icontheme: Remove surface support
It's not used anymore.
2018-03-16 06:04:45 +01:00
Benjamin Otte
9e54c22c49 image: Don't handle surfaces anymore
Lots of special cases that are no longer needed because no code uses
surfaces.

Also remove the GdkCellRendererPixbuf:surface property.
2018-03-16 06:04:45 +01:00
Benjamin Otte
01f996447e tests: Port from surface to texture 2018-03-16 06:04:45 +01:00
Benjamin Otte
a8608618a9 dragsource: Replace gtk_drag_source_set_icon_surface()
... with gtk_drag_source_set_icon_paintable().
2018-03-16 06:04:45 +01:00
Benjamin Otte
1f4839d4c8 inspector: Use Textures for images in the property view 2018-03-16 06:04:44 +01:00
Benjamin Otte
3c7ee010f5 cellrendererpixbuf: Put pixbufs into textures
... instead of going via surfaces.

A side effect is that the pixbuf property is no longer readable because
we have no good way to get the pixbuf back out of the texture, but I
don't think this matters a lot.

If people want to read the pixbuf property, we need to add some code to
make that work.
2018-03-16 06:04:44 +01:00
Benjamin Otte
7844320f10 image: Load resources and files into textures
Instead of loading them into surfaces (which we want to get rid of), we
load into textures.
In fact, we introduce a new paintable subclass called a GtkScaler that
takes care of tracking scaling.

This also ideally gets rid of an extra conversion once renderers learn
to render textures directly.
2018-03-16 06:04:44 +01:00
Benjamin Otte
c9557c207f iconhelper: Handle texture scale again
We will need that in the next commits.
2018-03-16 06:04:44 +01:00
Benjamin Otte
2016f56176 iconhelper: Turn into a GObject 2018-03-16 06:04:44 +01:00
Benjamin Otte
3427639b08 iconhelper: Rework to allow resizing of paintables
GtkImage will now allow paintables to be rendered to the full image and
the image will be sized according to CSS rules for image sizing.
2018-03-16 06:04:44 +01:00
Benjamin Otte
3e50092869 iconhelper: Rename function
There are no more icon sizes, this is now the default size we render at.

This naming change is kinda relevant because of CSS terminology.
2018-03-16 06:04:44 +01:00
Benjamin Otte
536714a147 paintable: Add gdk_paintable_compute_concrete_size()
Do the CSS size computation routine. This will be used elsewhere soon.
2018-03-16 06:04:44 +01:00
Benjamin Otte
bcf1aa7cb2 tooltips: Make icon a paintable 2018-03-16 06:04:44 +01:00
Benjamin Otte
d1be2b29cf entry: Make icons a paintable 2018-03-16 06:04:44 +01:00
Benjamin Otte
89ee42db54 dnd: Make dnd icon API take a paintable
... instead of a texture.
2018-03-16 06:04:44 +01:00
Benjamin Otte
ccb6b8585c aboutdialog: Make logo a paintable
No reason to limit this to textures anymore.
2018-03-16 06:04:44 +01:00
Benjamin Otte
2b35332fd6 cssimage: Implement dynamicity for cross-fades 2018-03-16 06:04:44 +01:00
Benjamin Otte
7e39b12858 css: Implement dynamic values for array values
This makes animated background-images work.
2018-03-16 06:04:44 +01:00
Benjamin Otte
3faa7e04db cssimage: Add GtkCssImagePaintable
This type can hold any GdkPaintable.

Use it to replace GtkCssImageSurface, which used to hold a GdkTexture.
2018-03-16 06:04:44 +01:00
Benjamin Otte
4beeb6173b cssimage: Add gtk_css_image_is_invalid()
Use that instead of hacks to guess when an image is considered invalid
according to https://drafts.csswg.org/css-images-4/#invalid-image

Also add a GtkCssImageInvalid that implements the behavior of invalid
images according to the CSS spec so thjat image implementations can
refer to that image.
2018-03-16 06:04:44 +01:00
Benjamin Otte
5970dac167 build: Switch order of subdirectories
This makes demos be compiled/linked before tests. And that means that
while hacking, I can already run widget-factory when the tests are
still linking.
2018-03-16 06:04:44 +01:00
Benjamin Otte
9fa1e68151 image: Implement support for paintables
This includes adding support to GtkImageDefintion and GtkIconHelper.

Only GtkImage handles support for signals from the paintable.
2018-03-16 06:04:44 +01:00
Benjamin Otte
c59948169d iconhelper: transition to GdkPaintable
This is in preparation for accepting the image type paintable.

It's a bit incovenient because we need more code to track width/height
ourselves (as the paintable no longer does it for us), but it's not too
hard.

GtkIconHelper does not track invalidations on the paintable.
2018-03-16 06:04:44 +01:00
Benjamin Otte
a4e16ce3cc texture: Implement GdkPaintable
This is kind of evil because we need to link to GTK to be able to
snapshot, but I hope nobody notices.
2018-03-16 06:04:44 +01:00
Benjamin Otte
d4764cc89b snapshot: "Inherit" from GdkSnapshot
This is a neat trick to get around the circularity between GDK, GSK and
GTK that we inherit with the GdkPaintable interface.

GdkPaintable uses GtkSnapshot
GtkSnapshot creates GskRenderNodes
GskRenderNodes use GdkTextures
GdkTexture will soon implement GdkPaintable

This causes a loop that spans GDK, GSK and GTK and this is the easiest
way to resolve it without breaking bindings (at least that's the idea).
2018-03-16 06:04:44 +01:00
Benjamin Otte
8f43d7e188 gdk: Add GdkPaintable 2018-03-16 06:04:44 +01:00
Benjamin Otte
a721d8b78f css: Implement support for dynamic values
This adds a new GtkStyleAnimation called GtkCssDynamic (for lack of a
better name) that is spawned whenever at least one dynamic value is part
of the GtkCssStyle.
2018-03-16 06:04:43 +01:00
Benjamin Otte
d774406573 cssimage: Implement dynamic values
No image actually implements it yet, but this is the plumbing.
2018-03-16 06:04:43 +01:00
Benjamin Otte
3322599e99 css: Introduce the idea of dynamic values
Dynamic values are values that change their contents with the current
(monotonic) time.

This just introduces the GtkCssValue API for it.
2018-03-16 06:04:43 +01:00
Benjamin Otte
7f0ef81e11 vulkan: Our data is premultiplied, don't pretend it isn't
If the backend can't do premultiplied alpha, better make the backend treat
2018-03-16 06:04:43 +01:00
Benjamin Otte
927f48d289 css: Remove ability to query css images as cairo patterns
Nobody's doing that. And CSS Images are no longer using Cairo anyway.

If we wanted to support querying them (hint: we don't) we should be
using GdkPaintable.
2018-03-16 06:04:43 +01:00
Benjamin Otte
45072c3a64 aboutdialog: The default icons are textures these days 2018-03-16 06:04:43 +01:00
Benjamin Otte
a891a3ae26 demos: Unbreak icon for fishbowl demo
351559fcfa was to eager in simplifying
things.
2018-03-16 06:04:43 +01:00
Benjamin Otte
4bb8352ab5 css: Fix compiler warning
...
2018-03-16 06:04:43 +01:00
Matthias Clasen
62aa487500 Improve the scale handling
Always use the smallest scale that is larger than requested,
or, failing that, the largest available scale.
2018-03-15 20:28:12 -04:00
Matthias Clasen
454814c6b4 Merge branch 'css-image-scaled' into 'master'
Css image scaled

See merge request GNOME/gtk!62
2018-03-15 23:58:40 +00:00
Emmanuele Bassi
0b4e0ce509 ci: Restore ccache, but do not cache it across jobs
The GitLab cache is kept across jobs, whether they succeeded or not:
this means that if a compiler check fails during the Meson
configuration, the small compiler program gets cached and restored the
next time the job is run, thus failing again.
2018-03-15 18:28:44 +00:00
Matthias Clasen
35f92b5695 Merge branch 'wip/filechooser-non-default-display-gtk4' into 'master'
Fix filechooser dialog using non default display (gtk4)

Closes #83

See merge request GNOME/gtk!60
2018-03-15 17:44:49 +00:00
Matthias Clasen
55d35dd13e Update the expected results in the testsuite
the -gtk-scaled() change in the previous commit makes it so
that we now print out the scale factors. Update the expected
output of affected tests to take that into account.
2018-03-15 13:38:41 -04:00
Timm Bäder
ba52be36c2 gl renderer: Set border program outline state 2018-03-15 18:17:57 +01:00
Timm Bäder
eaf899061a gl renderer: Remove shadow program
Drawing shadows is the same task as drawing text in our case and these
two shaders have been the same thing for quite a while.
2018-03-15 18:12:00 +01:00
Timm Bäder
0a7880110e gl renderer: Fix clipped borders
Stop abusing the clip rect for borders.
2018-03-15 18:11:57 +01:00
Timm Bäder
a475e6671c shaderbuilder: Remove unused API 2018-03-15 16:30:48 +01:00
Timm Bäder
e35132054e gl: Move shaderbuilder into gl/ subdirectory
It only handles OpenGL shaders.
2018-03-15 15:06:46 +01:00
Timm Bäder
ebfadae568 gl renderer: Draw offscreen nodes in device pixels
We need to draw them upscaled, of course. This fixes button hover (or,
more generally, crossfade nodes) in hidpi setups.
2018-03-15 13:52:07 +01:00
Timm Bäder
65e3dda065 testsuite: Add more gl renderer tests 2018-03-15 12:58:51 +01:00
Timm Bäder
f82b3fdb90 gl tests: Update clipped cross fade output 2018-03-15 12:41:11 +01:00
Timm Bäder
d66bfb1a9a testsuite: Add a GL gradient test 2018-03-15 11:15:35 +01:00
Matthias Clasen
a4c2819f91 Make GtkCssImageScaled handle scales properly
We slightly expand the syntax of -gtk-scaled to allow
specifying an explicit scale after each image, and then
we create a single-image GtkCssImageScaled with the
preferred scale in compute().
2018-03-15 06:04:08 -04:00
Timm Bäder
3a5630358f gl renderer: Fix rounded clips in hidpi 2018-03-15 11:01:53 +01:00
Timm Bäder
afffc696f4 spinbutton: Remove an unnecessary queue_draw call
This is done automatically in case the spinbutton value actually
changes.
2018-03-15 09:44:49 +01:00
Timm Bäder
a0729f9683 gdk: Remove unused variable 2018-03-15 09:25:42 +01:00
Timm Bäder
04fadc508b GskGLDriver: Use g_assert_cmphex for GL constants 2018-03-15 09:25:42 +01:00
Matthias Clasen
16bf07fe33 Trivial formatting fixes
Fix some whitespace problems.
2018-03-14 23:23:03 -04:00
Daniel Boles
2f16c092a5 testspinbutton: Add button to toggle wrap on Spins
I found myself wanting to test this for something else, so let's test
it. It revealed a bug immediately!

https://gitlab.gnome.org/GNOME/gtk/issues/88
2018-03-14 23:09:51 +00:00
Daniel Boles
55664f95ab testspinbutton: Orient box orthogonally to Spins
This makes better use of space.
2018-03-14 23:01:06 +00:00
Timm Bäder
8b800fa775 testsuite: Simplify GL test definition 2018-03-14 17:28:41 +01:00
Timm Bäder
d978d4af59 testsuite: Add a GL tests for clipped rounded clipped nodes 2018-03-14 17:28:41 +01:00
Timm Bäder
d417595a05 gl renderer: Draw rounded clip child to a texture
And then clip the texture using the current (maybe also rounded) clip.
This way, the result is correct. We don't necessarily have to do the
offscreen drawing in any case, but got the safe route for now.
2018-03-14 17:28:41 +01:00
Timm Bäder
90c8619f42 gl renderer: Properly draw gl textures from a different context
Temporarily switch to the texture's gl context, download the texture and
create a new one in our context for it.
2018-03-14 17:28:41 +01:00
Timm Bäder
955dca950c fixed: Remove snapshot implementation
It does the same thing as the default implementation.
2018-03-14 17:28:41 +01:00
Timm Bäder
5f2283c0ab snapshot: Ignore 0 sized clip nodes
This may happen due to the intersection before.
2018-03-14 17:28:41 +01:00
Carlos Soriano
f06f0a0dee gtkmenu: Remove unused constant
It was used in gtk3 but not in master anymore.
2018-03-14 16:05:08 +01:00
Jonas Ådahl
a48eaa1954 entrycompletion: Realize popup after setting screen
Realization is done as a side effect of calling
_gtk_entry_completion_resize_popup(), but if this is done before the
GdkScreen of the GtkWindow is set up correctly, it may result in the
widget being unrealized when the screen is updated. This may happen
when the file dialog parent window is not using the default GdkDisplay.

To avoid this issue, realize the popup after the screen has been
properly set up.

Fixes #83 in gtk4
2018-03-14 15:37:26 +08:00
Timm Bäder
417e8d6ca4 snapshot: Add missing (nullable) annotation 2018-03-13 23:43:29 +01:00
Timm Bäder
d4c9a35193 widget: Simplify setting a default direction
No reason for the second paramter to be a pointer.
2018-03-13 23:43:29 +01:00
Timm Bäder
81a7f8e00c label: Remove dead NULL check
We only create the gesture when priv->select_info is !NULL.
2018-03-13 23:43:29 +01:00
Christoph Reiter
f91ea2ce37 Merge branch 'master' into 'master'
Add proper annotation for gdk_frame_clock_get_refresh_info

See merge request GNOME/gtk!55
2018-03-13 20:30:53 +00:00
Christoph Reiter
5838ac3d1d run-docker.sh: Disable SELinux for the container and update the image tag
On Fedora and similar SELinux by default prevents containers accessing
mounted host directories. This script is just used for testing,
so disable it.
2018-03-13 21:13:31 +01:00
Emmanuele Bassi
27abc9fefe Update CONTRIBUTING.md
Update the instructions to match the GitLab workflow.
2018-03-13 18:13:46 +00:00
Emmanuele Bassi
b939af0090 ci: Add explicit dependency on "which"
The xvfb-run script depends on it, but it seems Fedora packages ended up
forgetting about it.
2018-03-13 17:56:44 +00:00
Emmanuele Bassi
4e2790ea74 ci: Remove ccache
There are issues with the caching; CI will randomly fail to create new
files used when testing features.
2018-03-13 17:03:27 +00:00
Emmanuele Bassi
9a5947758c ci: Add GLib build dependencies
Since we may end up building GLib as a subproject, we're going to need
all the appropriate GLib build dependencies as well as the GTK ones.
2018-03-13 16:28:42 +00:00
Emmanuele Bassi
44469197d5 ci: Use a different Docker image
I've rebuilt the new Docker image we use for CI to include GStreamer in
the dependencies.

We really need to have the Docker registry hosted on gnome.org, to avoid
pointing people at Dockerhub.
2018-03-13 16:05:03 +00:00
Emmanuele Bassi
9d045db142 Annotate gdk_gl_texture_new() appropriately
This is a constructor, and it needs a transfer annotation.

Sadly, the resulting introspection representation is going to be a less
than satisfactory `Gdk.gl_texture_new()`, because there is no such thing
as a GdkGLTexture in the public API.
2018-03-13 16:00:55 +00:00
Emmanuele Bassi
73ffb7f5e9 Initialise variables
The dx and dy variables may be left uninitialized by the coordinate
translation — or so the C compiler thinks. Let's avoid a warning when
building.
2018-03-13 16:00:55 +00:00
Emmanuele Bassi
a0d2d1f44b Use the same arguments for print backends
All the print backend shared modules should use the same C preprocessor
symbols.
2018-03-13 16:00:55 +00:00
Emmanuele Bassi
fe1586ca3d ci: Add gstreamer to the Docker image
We're going to need it for the media interface.
2018-03-13 16:00:55 +00:00
Emmanuele Bassi
b52da5682e ci: Use the right path for the logs
The meson-logs directory is under the `_build` directory.
2018-03-13 16:00:55 +00:00
Matthias Clasen
3b45019ba2 Merge branch 'query-wayland-registry' into 'master'
gtkimmodule: make match_backend() query

See merge request GNOME/gtk!56
2018-03-13 02:09:26 +00:00
Daniel Boles
9aedafa39e FileChooserWidget: Fix leaks in .get_subtitle()
Now that subtitle's default value "Searching" for OPERATION_MODE_SEARCH
is duplicated as it should be, we cannot reassign other strings to it
anymore, as that resulted in the original dupe of "Searching" leaking.

Fix this by only assigning the dup'd "Searching" after trying to get
more specific values, not before. We therefore need to set it to NULL
during its declaration, and that means we needn't in the final else.
2018-03-13 00:20:17 +00:00
Daniel Boles
fc9dc97430 FileChooserWidget: Avoid crash freeing static str
Having a FileChooserDialog in location-entry mode then pressing
<primary>f to move to search mode would crash with an invalid free().

In that case, FileChooserWidget.get_subtitle() returned a static string
straight from gettext. This crashed when the GBinding from :subtitle to
FileChooserDialog’s HeaderBar:subtitle shortly tried to free the string.

Fix by duplicating the string before returning it, like all other paths.

https://bugzilla.gnome.org/show_bug.cgi?id=791004
2018-03-12 23:07:50 +00:00
Peter Bloomfield
86cd5c04bd gtkimmodule: make match_backend() query
…the wayland registry.

Wnen _gtk_im_module_get_default_context_id calls
match_backend (context_id) and the default GdkDisplay
is wayland, match_backend() should return TRUE only if
gdk_wayland_display_query_registry (display, "gtk_text_input_manager")
returns TRUE.
2018-03-12 17:46:57 -04:00
Stas Solovey
d11c78c46f Update Russian translation
(cherry picked from commit 0e01668683)
2018-03-12 21:08:41 +00:00
Aurimas Černius
3a377bb0a3 Updated Lithuanian translation 2018-03-12 23:00:48 +02:00
Daniel Boles
bde1328a07 testinfobar: Test more properties, response signal
Also test :message-type, :show-close-button, and ::response.
2018-03-12 19:16:07 +00:00
Marek Černocký
7ec3b52d97 Updated Czech translation 2018-03-12 20:08:48 +01:00
Mart Raudsepp
86f3e67775 Update Estonian translation
(cherry picked from commit e4e2b7687d)
2018-03-12 16:28:27 +00:00
Benjamin Otte
13d943f763 texture: Change download vfunc
A problem with textures is that they can become too big for GPU memory,
which would require tiling. But for tiling we only need to download
the pixels needed by the tile.

Similarly, there might be interest to not upload full textures if a
renderer knows it only needs a small part.

Both of these methods require the ability to specify an area of the
texture to be downloaded. So change the download vfunc to include
this parameter now before we add even more textures later.

A private gdk_texture_download_area() function has also been added, but
nobody is using it yet.
2018-03-12 17:21:45 +01:00
Benjamin Otte
e5813b3ae7 texture: Export gdk_memory_texture_new() and GdkMemoryFormat
Also add tests for all these newfangled formats.
2018-03-12 17:21:45 +01:00
Daniel Boles
5fe14e06da Merge branch 'wip/dboles/frame-yalign-byealign' into 'master'
Frame: Erase the now-useless property label-yalign

See merge request GNOME/gtk!40
2018-03-12 16:17:11 +00:00
Daniel Boles
2072953375 ListBox: Avoid ::row-activated/Row::activate ambig
…uity, by adding a doc comment to Row::activate explaining what it does
and why it is probably not what the user reading that is looking for.

https://bugzilla.gnome.org/show_bug.cgi?id=794008
2018-03-12 16:12:09 +00:00
Piotr Drąg
d0757f6436 Update Polish translation 2018-03-12 16:48:31 +01:00
Daniel Boles
6bb1f0dbf3 testinfobar: Add simple test of :visible/:revealed
This exists merely to prove that, having added :revealed, show() and
hide() now work reliably, as does set_revealed() for the animated case.

https://bugzilla.gnome.org/show_bug.cgi?id=710888
2018-03-12 15:30:55 +00:00
Sander Sweers
fe8225e573 Add proper annotation for gdk_frame_clock_get_refresh_info
See https://gitlab.gnome.org/GNOME/gtk/issues/77
2018-03-12 16:07:39 +01:00
Daniel Boles
e4578ca7bf Frame: Erase the now-useless property label-yalign
The border is now drawn on the frame node, not using an internal border
node, so we are no longer able to align the label to vertically overlap
the border. The property no longer performs its original purpose, & nor
is it a useful candidate for giving a new role, so no point keeping it.

https://bugzilla.gnome.org/show_bug.cgi?id=778886
2018-03-12 14:17:32 +00:00
Balázs Meskó
362ef4449c Update Hungarian translation 2018-03-12 06:21:39 +00:00
Piotr Drąg
be9001f0da Update POTFILES.in 2018-03-11 19:28:03 +01:00
Matthias Clasen
3ee4d6fc0f Merge branch 'module-reorg' into 'master'
Consolidate print backends into one directory

See merge request GNOME/gtk!53
2018-03-11 16:47:43 +00:00
Matthias Clasen
a78e9f2261 Consolidate print backends into one directory
This will let us use GTK_PATH to load them uninstalled, which
is useful for in-tree tests.
2018-03-11 12:38:35 -04:00
Matthias Clasen
da8e83f9cb Exit cleanly if no display is found
We should not try to create an inspector window and generate
tons of ugly warnings in this case.
2018-03-11 08:14:14 -04:00
Marek Černocký
9ded44b3de Updated Czech translation 2018-03-11 09:43:01 +01:00
Marek Černocký
f5c3b2c691 Updated Czech translation 2018-03-11 08:14:09 +01:00
Marek Černocký
0f533ed61d Fixed typo in script name Kjohki -> Khojki 2018-03-11 08:12:31 +01:00
Matthias Clasen
527d265bea Merge branch 'wip/matthiasc/snapshot' into 'master'
Implement builder pattern for GtkSnapshot

See merge request GNOME/gtk!52
2018-03-11 05:39:00 +00:00
Matthias Clasen
d55da3fd44 Use GtkSnapshot getters
We can avoid direct struct access and gtksnapshotprivate.h
everywhere.
2018-03-11 00:31:44 -05:00
Matthias Clasen
7c18911c00 GtkSnapshot: Add getters
These getters can be useful when creating new snapshots
in a snapshot() vfunc.
2018-03-11 00:31:44 -05:00
Matthias Clasen
890cd45ce4 Document new snapshot api 2018-03-11 00:31:44 -05:00
Matthias Clasen
eed279ad91 GtkSnapshot: Drop init/finish
We are ont using stack-allocated snapshots anymore.
2018-03-11 00:31:44 -05:00
Matthias Clasen
694f1d8ecd Stop using stack-allocated snapshots
Use the new/free api instead of init/finish
for GtkSnapshot.
2018-03-11 00:31:44 -05:00
Matthias Clasen
e23f641e49 GtkSnapshot: Implement the builder pattern
Make GtkSnapshot a refcounted boxed type, and add
public API that follows the builder pattern described
here: https://blogs.gnome.org/otte/2018/02/03/builders/
2018-03-11 00:31:44 -05:00
Timm Bäder
7eb3736760 GdkCursor: Add some missing (nullable) annotations 2018-03-09 11:57:23 +01:00
Timm Bäder
00d37c80f8 spinbutton: Remove priv pointer 2018-03-09 09:24:20 +01:00
Matthias Clasen
e0771a54a2 Avoid warnings
When generating introspection data, we instantiate types without
calling gtk_init, so make sure that extension points are registered
before the type is trying to implement them.
2018-03-09 02:13:13 -05:00
Pavel Roskin
01fda3b85e x11: Avoid a division by zero
This is similar to f44baf51d9 but for RandR 1.3 servers like
x11rdp and Windows Exceed which don't return a refresh rate. Avoid a
crash when that happens.

https://bugzilla.gnome.org/show_bug.cgi?id=775546
2018-03-08 16:20:01 +01:00
Timm Bäder
28cda7f516 separator: Remove priv pointer 2018-03-07 20:42:32 +01:00
Timm Bäder
faabb808be menubutton: Remove priv pointer 2018-03-07 20:26:51 +01:00
Timm Bäder
38fa5ab57b widget: Add a translate_coordinates version for doubles
So we can use that one when translating event coordinates. Also adapt
the widgetfocus demo to ensure this works.

We should probably at some point delete either the int or the double
version.
2018-03-07 20:17:39 +01:00
Timm Bäder
034017425c linkbutton: Remove priv pointer 2018-03-07 20:17:39 +01:00
Timm Bäder
4dfe4a6476 expander: Remove label-fill property
It's just setting some internal boolean and nothing else. It's like this
in gtk3 as well so it can't be too important either.
2018-03-07 20:17:39 +01:00
Timm Bäder
6cc824af43 Merge branch 'expander-add-like-bin' into 'master'
expander: Check for an existing child when adding

See merge request GNOME/gtk!48
2018-03-07 19:09:30 +00:00
Benjamin Otte
db6fed1496 overlay: Add GtkOverlay::measure child property
It determines whether a child is included in the overlay's size
measurement.

The first user is (gonna be) GtkVideo.
2018-03-07 16:17:15 +01:00
Benjamin Otte
325f6121ba eventcontroller: Remove unused evmask member variable 2018-03-07 16:17:15 +01:00
Benjamin Otte
074e7001dc eventcontroller: Get rid of constructed vfunc
Instead, add the controller to the widget in set_property.
2018-03-07 16:17:15 +01:00
Benjamin Otte
8920639a2b texture: Add GdkMemoryTexture
GdkMemoryTexture is a texture implementation for holding data in memory
(read: GBytes). You specify the GdkMemoryFormat that data is in and off
you go.

Renderers can use this to add uploads in various different formats and
don't need to fallback to GDK doing the conersion on the CPU.

Supported formats can be extended if we need new ones, for now I just
added the relevant ones for Cairo and GdkPixbuf.

The constructor is also private still, because I'm not sure we want to
export GdkMemoryFormat.
Wrappers that do from_cairo_surface() and for_pixbuf() do exist though.
2018-03-07 16:17:15 +01:00
Benjamin Otte
160e6ad6f6 gdk: Split out GL texture
Put GdkGLTexture into its own file and rename the API to
gdk_gl_texture_foo() instead of gdk_texture_foo_for_gl().

Apart from naming, no actual code changes.
2018-03-07 16:17:15 +01:00
Carlos Garnacho
b49c6cdcb1 imwayland: Fix parent type
It was inadvertently changed in commit 15cc20e7b.

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

Closes: #58
2018-03-07 10:58:22 +01:00
Matthias Clasen
cc6d60afa4 Use gio-querymodules
GIO has this facility, so we should use it.
At the same time, make sure the immodules directory
exists, even if we don't install any modules there
outselves.
2018-03-06 20:54:26 -05:00
Matthias Clasen
5ec41fb47b Make debug messages work earlier
We need to be able to produce debug output during module
loading. This change ensures that we can.
2018-03-06 20:54:26 -05:00
Alexandre Franke
122e7b16e6 Update French translation 2018-03-06 21:01:36 +00:00
Peter Bloomfield
a207ab6105 expander: Check for an existing child when adding
Now that GtkExpander subclasses GtkContainer instead of GtkBin, it needs
its own guard against adding more than one child.

Also, the documentation should no longer describe adding a child as if
it is descended from GtkBin.
2018-03-06 14:26:08 -05:00
Timm Bäder
de537a0755 entry: Fix invisible cursors 2018-03-06 20:04:30 +01:00
Timm Bäder
2f5d5ca9f8 GdkSelectionInputStreamX11: Plug a memory leak 2018-03-06 19:59:29 +01:00
Timm Bäder
49a7bf267b GdkSelectionOutputStreamX11: Plug a memory leak 2018-03-06 19:47:18 +01:00
Timm Bäder
f5e290517a expander: fix sizes in resize_toplevel
We can't use gtk_widget_get_allocation for either non-anchored widgets
(which happens with the child widget when the expander is unexpanded)
nor toplevel windows since that will include the window decorations.

Fixes #70 in gtk4
2018-03-06 18:12:49 +01:00
Timm Bäder
7dc4669d01 viewport: Remove priv pointer 2018-03-06 14:37:28 +01:00
Timm Bäder
22457822eb expander: Attach the gesture to the title widget
Instead of tracking whether the click happened inside the title widget
ourselves, just attach the gesture to the title widget.
2018-03-05 17:24:22 +01:00
Rūdolfs Mazurs
564397f391 Update Latvian translation 2018-03-04 19:24:16 +00:00
Rūdolfs Mazurs
4519c6696c Update Latvian translation 2018-03-04 19:18:11 +00:00
Timm Bäder
84b4f85f1a overlay: Make forall() remove-safe
Since this is a GtkContainer, forall will be used to destroy all the
widgets.
2018-03-04 20:04:43 +01:00
Timm Bäder
0bb1e1b1fd overlay: Fix GSlide/g_free mixup
We free the allocated data later using g_free, so don't use GSlice when
allocating it.
2018-03-04 20:04:17 +01:00
Timm Bäder
53410bab0f overlay: Fix remove implementation
Use the child widget list of the overlay, not the passed child.
2018-03-04 20:03:54 +01:00
Timm Bäder
31a0739bf3 imcontextxim: Move initialisation into _init function
We are creating these using g_object_new, so the _new function is never
called, resulting in a NULL mb_charset. Fix this by moving the
initialisation into the _init function.
2018-03-04 19:55:54 +01:00
Benjamin Otte
aa175ec2f5 Merge branch 'set-client-widget-nullable' into 'master'
gtkimcontextxim: fix gtk_im_context_xim_set_client_widget not handling widget=NULL

See merge request GNOME/gtk!46
2018-03-04 18:29:45 +00:00
Timm Bäder
8a062f4f9a gskpango: Don't create text nodes for clipped text
Measure the text here directly and check if the created node bounds will
be clipped away before even creating the text node.
2018-03-04 19:15:03 +01:00
Timm Bäder
2d50d9ebe6 rendernodes: Add gsk_text_node_new_with_bounds
An alternative GskTextNode constructor that does no text measuring. That
way, we can measure the text before and check if the node will be
outside of the current clip anyway.
2018-03-04 19:12:04 +01:00
Timm Bäder
ee8132a439 rendernodes: Add missing nullable annotation 2018-03-04 19:12:04 +01:00
Timm Bäder
0234e8e2c9 gl renderer: Limit texture node size to clip 2018-03-04 19:12:04 +01:00
Timm Bäder
f44642c7cb overlay: Remove child list 2018-03-04 19:12:04 +01:00
Timm Bäder
9beb5490f5 overlay: Remove priv pointer 2018-03-04 19:12:04 +01:00
Timm Bäder
da431b2a43 glglyphcache: Pass lookup key to g_hash_table_lookup directly 2018-03-04 19:12:04 +01:00
Timm Bäder
cfbac153a3 overlay: Fix coordinates in child_update_style_classes
Both main child and all others are in the same coordinate space, so no
need to add the parent position here.
2018-03-04 19:12:04 +01:00
Timm Bäder
ddcc9b9f2f overlay: Don't chain up in size_allocate
The GtkBin size_allocate implementation will allocate a size to the main
child, which GtkOverlay already does.
2018-03-04 19:12:04 +01:00
Timm Bäder
8ebec46db5 entry: Remove priv pointer 2018-03-04 19:12:04 +01:00
Timm Bäder
71ae2fae2e container: Remove unused struct member 2018-03-04 19:12:04 +01:00
Timm Bäder
1596c61003 testsuite: Remove GL text test case
This was just testing that text nodes do alpha correctly, but the test
even breaks if the default font is different from the one that was used
to create the reference image, so drop it for now.
2018-03-04 19:12:04 +01:00
Timm Bäder
891c37a4cb label: Simplify ensure_layout()
use an early return for an already existing layout.
2018-03-04 19:12:04 +01:00
Christoph Reiter
8c2c748c11 gtkimcontextxim: fix gtk_im_context_xim_set_client_widget not handling widget=NULL
gtk_im_context_set_client_widget() allows passing NULL as widget to signal that
the widget no longer exists. The xim implementation didn't handle that
case which led to the test suite on gitlab-ci failing.
2018-03-04 18:40:12 +01:00
Christoph Reiter
235ff253ff Merge branch 'gi-a11y' into 'master'
Include gtk/gtk-a11y.h in introspection file.

See merge request GNOME/gtk!43
2018-03-04 10:10:20 +00:00
Christoph Reiter
331c4b5954 Merge branch 'include-gtkstackaccessible' into 'master'
a11y: Include gtkstackaccessible.h in gtk-a11y.h

See merge request GNOME/gtk!41
2018-03-04 09:43:34 +00:00
Tomasz Miąsko
7ba53de1e8 Include gtk/gtk-a11y.h in introspection file.
The gir XML file contains description of types and functions from
gtk/gtk-a11y.h. Indicate that this header should be included in addition
to gtk/gtk.h in applications written in C. #56
2018-03-03 20:51:30 +01:00
Tomasz Miąsko
c2b4da128a a11y: Include gtkstackaccessible.h in gtk-a11y.h 2018-03-03 20:01:54 +01:00
Bruce Cowan
ec2cdac298 Update British English translation
(cherry picked from commit 3059df0d4d)
2018-03-02 22:09:58 +00:00
Piotr Drąg
ce2b6d9eb7 Update POTFILES.skip 2018-03-02 21:27:43 +01:00
Piotr Drąg
d8956aeff2 Update POTFILES.skip 2018-03-02 21:26:21 +01:00
Benjamin Otte
634717d0b9 gtk: Remove unused header files in gtk/ui/ 2018-03-02 02:00:25 +01:00
Benjamin Otte
88de098711 entry: Remove cursor adjustment APIs 2018-03-02 02:00:25 +01:00
Benjamin Otte
4ac3f916d0 css: Parse hex colors with alpha value
The CSS color spec version 4 introduces this, support has hit Safari,
Chrome and Firefox, so this looks like a feature that's here to stay.

https://drafts.csswg.org/css-color/#hex-notation
2018-03-02 02:00:24 +01:00
Piotr Drąg
67b959f1a7 Update POTFILES.in 2018-03-01 18:38:05 +01:00
Christoph Reiter
48f68bb881 Merge branch 'quartz-missing-config-include-gtk4' into 'master'
macos: Fix missing gdk symbol exports for gtk dnd

See merge request GNOME/gtk!39
2018-03-01 13:46:26 +00:00
Christoph Reiter
26e2af26ed macos: export gdk_quartz_drag_source_context()
It's used in the gtk dnd code but not exported in gdk.
Append a "_libgtk_only" suffix as with other internal exports and
export the symbol.

See #32
2018-03-01 14:36:44 +01:00
Emmanuele Bassi
78c130543c ci: Store the logs on build failure
We should save the logs directory when the CI pipeline fails, so that we
have a chance at debugging the failure.
2018-03-01 17:09:22 +07:00
Emmanuele Bassi
4b33cc5f89 ci: Update the configuration options
The options were renamed in commit 7b32900c55.
2018-03-01 17:08:27 +07:00
Emmanuele Bassi
6fa2c7e3b7 xim: Use NULL-safe string comparison
The locale string may be NULL.
2018-03-01 16:44:02 +07:00
Matthias Clasen
32873cc94b Merge branch 'wip/matthiasc/immodule-cleanup' into 'master'
Convert immodules to use an extension point

See merge request GNOME/gtk!34
2018-03-01 06:38:39 +00:00
Timm Bäder
881046b46e entry: Simplify cursor management
Since cursors are per-widget now and the icons are widgets, we can just
set the cursors once.
2018-02-28 10:35:31 +01:00
Christoph Reiter
94d6d56913 macos: Fix gdk_quartz_drag_context_get_dragging_info_libgtk_only symbol export
The header got included without config.h being included first which resulted in the
wrong _GDK_EXTERN macro being used. As a result some symbols weren't exported
and starting a DnD action would crash in the linker.

This patch adds config.h includes in all places where clang complained about
_GDK_EXTERN redefinitions.

See #32 for more info.
2018-02-27 20:04:34 +01:00
Patrick Griffis
971f46e1f2 build: Error if no backends enabled 2018-02-27 13:42:28 -05:00
Timm Bäder
d2b5436462 gl: Make blur nodes with radius ∈ ]0; 1[
Otherwise, the radius here ends up being 0 and we don't draw anything at
all.
2018-02-27 14:22:08 +01:00
Timm Bäder
cac3e7705d gsk: Increase blur node bounds by blur radius
Otherwise, the resulting node will be too small and the result looks
clipped.
2018-02-27 14:12:25 +01:00
Timm Bäder
c02090b1f6 tests: Add testblur 2018-02-27 12:51:07 +01:00
Timm Bäder
1355c9ae88 scale: Remove priv pointer 2018-02-27 12:39:04 +01:00
Timm Bäder
813ccb6378 emojichooser: Only measure reference emoji once
Doing that once for every emoji is pretty slow and unnecessary as the
width does not change.
2018-02-27 11:45:34 +01:00
Timm Bäder
3c33e541cd entry: Add motion controller
Do the mouse cursor un-obscuring in the ::motion handler instead of in
the ->event handler. We don't get rid of the GtkWidgetClass::event
handler altogether that way, but it's a step in the right direction.
2018-02-27 11:05:04 +01:00
Timm Bäder
83c74ff7d0 spinbutton: Fold function into only caller 2018-02-27 10:30:14 +01:00
Timm Bäder
7c59ac2e4a spinbutton: Remove unused macro 2018-02-27 10:30:14 +01:00
Timm Bäder
67258c69f0 checkbutton: Don't reorder non-existent indicator widget 2018-02-26 18:23:20 +01:00
Timm Bäder
9db76cebb4 entry: Check gdk_event_get_coords return value
We use the x/y values later on to decide what to do with the event.
2018-02-26 12:57:17 +01:00
Timm Bäder
354eab70da entry: Allocate icons at full height
Makes for a larger hit area for pointing devices. If vertical centering
is still desired, GtkWidget:halign can be set on the icon widgets.
2018-02-26 12:53:49 +01:00
Timm Bäder
a9cd2d8181 widget: Simplify set_style_context
No need to use widget->priv later if we already define a priv pointer
before.
2018-02-26 08:42:38 +01:00
Timm Bäder
c7294ab90e button: Remove priv pointer
This way we can also move the GtkButtonPrivate definition into
gtkbutton.c
2018-02-25 16:47:20 +01:00
Timm Bäder
94493414b5 filechooserwidget: Make the location entry hexpand 2018-02-25 16:47:20 +01:00
Timm Bäder
fef4f0704a textview: Use content size when validating contents 2018-02-25 16:47:20 +01:00
Timm Bäder
dc1612b865 contentsformat: Avoid a GPtrArray
We know how many items this array will have in advance, so just malloc
enough.
2018-02-25 16:47:20 +01:00
Timm Bäder
7d7045bc35 widget: Remove some unneeded prototypes 2018-02-25 16:47:20 +01:00
Matthias Clasen
04cc589a61 fix the build 2018-02-24 21:44:03 -05:00
Matthias Clasen
ef556689f8 Update docs for changed options 2018-02-24 21:34:40 -05:00
Matthias Clasen
ca794f909a Update docs for immodules 2018-02-24 21:34:40 -05:00
Matthias Clasen
15cc20e7b5 Always include platform immodules
No need to load these as gio modules, we just include
them in libgtk.
2018-02-24 21:34:40 -05:00
Matthias Clasen
29bcc38ae6 Convert immodules to use an extension point
Add an extension point called gtk-im-module, which requires
the type GtkIMContext. Simplify the loading by using GIO
infrastructure. Drop the locale filtering for now, I don't
think it is really necessary nowadays.

Convert existing platform modules to gio modules.
Sill to do: Drop the conditional build machinery.
Either always include them, or never.
2018-02-24 21:34:40 -05:00
Matthias Clasen
e6bf832514 Don't mention papi in options docs
The papi print backend has been removed.
2018-02-24 21:31:52 -05:00
Matthias Clasen
79bd123911 Add some debug output to print backend loading 2018-02-24 21:31:52 -05:00
Matthias Clasen
ab322e33aa README.md: Minor updates 2018-02-24 21:31:52 -05:00
Timm Bäder
4e23daa998 widget: Don't export propagate_hierarchy_changed 2018-02-23 22:14:38 +01:00
Timm Bäder
eb66d6bcc6 widget: Simplify _set_name
No need for a new_name local variable here.
2018-02-23 22:08:45 +01:00
Timm Bäder
f5afc17d26 button: Remove ::event handler
GRAB_BROKEN events cause the ::cancel handler of the gesture to be
emitted, which is where we also call gtk_button_do_release, so this
GtkWidget::event handler is unnecessary.
2018-02-23 21:57:49 +01:00
Timm Bäder
8720b2d8c5 widget: Correct translate_coordinate documentation
We write 0 to dest_x and dest_y nowadays if the two widgets do not have
a common ancestor.
2018-02-23 21:57:49 +01:00
GNOME Translation Robot
7835385264 Update Scottish Gaelic translation
(cherry picked from commit f3f75f62e8)
2018-02-23 17:35:38 +00:00
GNOME Translation Robot
21e3a8daeb Update Scottish Gaelic translation
(cherry picked from commit 68eb897900)
2018-02-23 17:25:51 +00:00
Timm Bäder
a302fd34e8 Merge branch 'text-view-measure' into 'master'
text-view: make measure() use the layout height

See merge request GNOME/gtk!37
2018-02-23 16:03:53 +00:00
Benjamin Otte
45603f70a8 vulkan: Don't quiet the compiler
This reverts 76461a8004.

We don't want to quiet the compiler here because new warnings should be
added to the enum the moment they become available.
2018-02-23 14:12:47 +01:00
Benjamin Otte
4cfaee99e7 vulkan: Add error strings for missing VkResults
Also, guard newer error returns with proper #if, so they don't trip up
older Vulkan versions.
2018-02-23 14:12:47 +01:00
Timm Bäder
0b9dca3d55 placessidebar: Don't create a GtkWindow for drag icons
Just use the drag_widget we create before, since GtkWindow drag icons
are not allowed anymore.
2018-02-23 11:08:53 +01:00
Timm Bäder
fd20e42932 range: Fix typo in allocate_trough
lower - upper results in something negative of course.
2018-02-23 10:59:21 +01:00
Timm Bäder
94093fd18e widget: Improve warning for negative size_allocate dimensions
Print widget class, css node name and address.
2018-02-23 10:47:19 +01:00
Timm Bäder
01d7ec2c83 range: Fix coord/value translation
Save the x/y we allocated the slider at, which is different than
the coordinates we get from any of the widget allocation accessors.
2018-02-23 10:47:18 +01:00
Timm Bäder
79426a0a50 range: Compute slider allocation in update_initial_slider_position
Instead of outside at every call-site.
2018-02-23 10:47:05 +01:00
Timm Bäder
4095cac75c range: Remove GtkScale special casing
This is unnecessary these days due to the negative margins of the
slider.
2018-02-23 10:47:05 +01:00
Timm Bäder
af4474f752 range: Simplify allocate_trough 2018-02-23 10:47:05 +01:00
Timm Bäder
1fea980930 range: Simplify compute_slider_position 2018-02-23 10:47:05 +01:00
Timm Bäder
4c952da6cb range: Fix coordinates in coord_to_value
The given coordinate needs to be trough-relative, since that's what the
slider is relative to. Also use the trough's content size and not the
outer size.
2018-02-23 10:47:05 +01:00
Timm Bäder
52f877d606 range: Remove some unneeded includes 2018-02-23 10:47:05 +01:00
Timm Bäder
82d459f015 range: Remove priv pointer 2018-02-23 10:47:05 +01:00
Timm Bäder
ece26b847b range: Stop tracking mouse position
We have the mouse position available everywhere we want to use it
anyway, so use that instead.
2018-02-23 10:47:05 +01:00
Timm Bäder
e9ecfeaca6 range: Stop tracking mouse location
Instead, just use gtk_widget_pick() to get the widget at the pointer
position whenever we need it.
2018-02-23 10:47:05 +01:00
Timm Bäder
69fa3c4876 range: Don't call calc_slider() on value changes
calc_slider() updates the slider visibility, but that can only change if
the upper or lower change.
2018-02-23 10:47:05 +01:00
Timm Bäder
8a38f62915 range: Remove unnecessary queue_draw calls 2018-02-23 10:47:05 +01:00
Timm Bäder
c200758c26 range: Remove scale special case
This is done automatically nowadays since the value is shown in a
widget.
2018-02-23 10:47:05 +01:00
Peter Bloomfield
1828c6b1cd text-view: make measure() use the layout height
GtkTextView::measure should include the height of the text-layout in its
minimum and natural heights. This fixes scrolling when a text-view has a
scrolled-window ancestor that is not its immediate parent.
2018-02-21 08:22:42 -05:00
Emmanuele Bassi
96f8eec50b Merge branch 'gitlab-ci-run-gtk-tests' into 'master'
gitlab-ci: run parts of the test suite

See merge request GNOME/gtk!22
2018-02-21 12:07:37 +00:00
Emmanuele Bassi
88d419456d build: Do not eagerly disable checks on release builds
Release builds should only disable cast checks, to match what we used
to do back with the Autotools builds.

The Autotools build had an "--enable-debug=no" option, but that was
rarely used; Meson has debug, debugoptimized, release, and plain build
types, but we considered the "release" build types as the old "disable
all debugging code", which is not really accurate.

Disabling assertions and preconditon checks should be left to people
with constrained environments and/or packagers; they are supposed to
use the "plain" build type, and override the CFLAGS themselves.
2018-02-20 13:22:01 +00:00
Emmanuele Bassi
a7e96675bd build: Use get_supported_arguments()
Instead of checking each flag one by one, use the appropriate method of
the Meson compiler object.
2018-02-20 13:18:28 +00:00
Matthias Clasen
bfc81767ba Drop no-longer existing im modules
This was just dead code. The actual modules have already
been removed.
2018-02-19 18:38:20 -05:00
Christoph Reiter
65c3f532cf gitlab-ci: run parts of the test suite
This runs the tests in testsuite/{css,gtk,tools}
All others suites have failing tests and need more work.
2018-02-19 19:43:42 +01:00
Matthias Clasen
a7df2fe7f3 Merge branch 'gtk-debug-flags-with-open-display-master' into 'master'
gtk_init: Fix debug flags handling when a display is already open

See merge request GNOME/gtk!27
2018-02-19 18:35:21 +00:00
Matthias Clasen
4a0854484f Merge branch 'tests-set-schema-dir' into 'master'
tests: Make GSETTINGS_SCHEMA_DIR point to the compiled schemas in the build dir

See merge request GNOME/gtk!21
2018-02-19 18:28:00 +00:00
Christoph Reiter
8ad81a35e1 gtk_init: Fix debug flags handling when a display is already open
The code assigning the display to the debug_flags struct gets only
called when the default display changes, which never happens
when there already is one.

This makes it call the change callback in case a display is already
there.

The same fix was applied to gtk3 in !26 where calling gdk_init()
before gtk_init() would trigger this case. With gdk_init() gone
in master this is less likely to happen, but still possible
if gdk_display_open() is called before gtk_init().

See https://gitlab.gnome.org/GNOME/pygobject/issues/166
2018-02-19 19:24:00 +01:00
Matthias Clasen
9ea80a7506 Remove some unused code
No more callers of _gtk_find_module.
2018-02-18 22:13:38 -05:00
Emmanuele Bassi
b3be9868d8 Remove unused variable in the CUPS print backend
The variable is a leftover from when we were not using the
G_DEFINE_DYNAMIC_TYPE macro.
2018-02-19 02:10:52 +00:00
Emmanuele Bassi
8f273d5e02 Fix the build in the Cloudprint print backend
Typos and re-declared functions.
2018-02-19 02:08:02 +00:00
Emmanuele Bassi
96f6f218ef Fix build of the lpr print backend
Some copy-and-paste from the CUPS print backend broke the build on
Continuous, where CUPS does not exist.
2018-02-19 02:07:09 +00:00
Emmanuele Bassi
809603c16c build: Fix checks on enabled print backends
The enabled print backends are a boolean, not a 'yes/no' string.
2018-02-19 02:06:11 +00:00
Matthias Clasen
19a13b316e Fix the build 2018-02-18 18:14:18 -05:00
Matthias Clasen
de0039546b Convert print backends to use a GIOExtensionPoint
Use GIOModule and GIOExtensionPoint. This is the preferred
way to define extensions these days, instead of manually
implementing type modules.
2018-02-18 18:00:42 -05:00
Matthias Clasen
7272610a02 Move the mixed module check function
This is only called in one place, move the function there.
2018-02-18 09:41:29 -05:00
Matthias Clasen
5b4082ac87 Remove gtkmodules.h
We don't use these definitions anymore.

Also clean up the docs wrt to modules.
2018-02-18 09:41:29 -05:00
Matthias Clasen
39d1537211 Stop loading modules
We no longer look at the GTK_MODULES environment variables.
With this commit, we stop loading general-purpose modules
altogether.
2018-02-18 09:41:29 -05:00
Matthias Clasen
a732ebf521 Stop using settings for modules
The Wayland backend was already not supporting this setting
since it is an XSetting that is not backed by a GSetting.

Drop this setting altogether, since we will stop supporting
general-purpose modules.
2018-02-18 09:41:29 -05:00
Christoph Reiter
fef3dfc43e Merge branch 'master' into 'master'
Fix annotation for gtk_tree_view_is_blank_at_pos()

See merge request GNOME/gtk!13
2018-02-18 10:48:23 +00:00
Timm Bäder
909fdc99ad Merge branch 'master' into 'master'
gtkprintbackendcups.c: fix \n at end of a debugging note

See merge request GNOME/gtk!25
2018-02-18 08:08:47 +00:00
Ivan Zakharyaschev
4c2f904ac4 gtkprintbackendcups.c: fix \n at end of a debugging note
(cherry picked from commit 7461ceebe3)
(cherry picked from commit d2a4febfa7)
2018-02-17 21:29:34 +03:00
Christoph Reiter
1253e7bfcb tests: Make GSETTINGS_SCHEMA_DIR point to the compiled schemas in the build dir
With autotools the schemas were compiled into each test suite directory
and the tests set GSETTINGS_SCHEMA_DIR to the test build directory.

With meson's gnome.compile_schemas() we can not define a target directory
so just make sure it is built in the gtk directory and set GSETTINGS_SCHEMA_DIR
to the gtk build directory when running the tests.

This makes the gtk+:gtk suite pass when no gtk is installed on the system.
2018-02-17 09:48:12 +01:00
Gniourf
c5bece5cef Fix annotation for gtk_tree_view_is_blank_at_pos()
The annotation (allow-none) is wrong. Since
gtk_tree_view_is_blank_at_pos() also calls
gtk_tree_view_get_path_at_pos(), the same fields should have the same
annotations.
2018-02-14 13:51:00 +01:00
797 changed files with 81913 additions and 56254 deletions

View File

@@ -1,23 +1,43 @@
image: lazka/gitlab-gtk:v1
stages:
- build
- flatpak
before_script:
- mkdir -p _ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/_ccache
cache:
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
build:
gtk:
image: ebassi/gitlab-gtk:latest
stage: build
before_script:
- export CCACHE_DISABLE=true_
script:
- bash -x ./.gitlab-ci/test-docker.sh
- bash -x ./.gitlab-ci/test-docker.sh
cache:
paths:
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
artifacts:
when: on_failure
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
flatpak:demo:
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
stage: flatpak
script:
- bash -x ./.gitlab-ci/flatpak-build.sh org.gtk.Demo
artifacts:
paths:
- org.gtk.Demo-dev.flatpak
expire_in: 1 day
flatpak:widget-factory:
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
stage: flatpak
script:
- bash -x ./.gitlab-ci/flatpak-build.sh org.gtk.WidgetFactory
artifacts:
paths:
- org.gtk.WidgetFactory-dev.flatpak
expire_in: 1 day

View File

@@ -1,6 +1,7 @@
FROM fedora:27
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
@@ -9,19 +10,33 @@ RUN dnf -y install \
ccache \
colord-devel \
cups-devel \
desktop-file-utils \
elfutils-libelf-devel \
fribidi-devel \
gcc \
gcc-c++ \
gdk-pixbuf2-devel \
gdk-pixbuf2-modules \
gettext \
git \
glib2-devel \
glibc-devel \
glibc-headers \
gobject-introspection-devel \
graphene-devel \
gstreamer1-devel \
gstreamer1-plugins-good \
gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-base-devel \
iso-codes \
itstool \
json-glib-devel \
libattr-devel \
libepoxy-devel \
libffi-devel \
libmount-devel \
librsvg2 \
libselinux-devel \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
@@ -32,15 +47,27 @@ RUN dnf -y install \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libwayland-egl-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
python3 \
python3-pip \
python3-wheel \
redhat-rpm-config \
sassc \
systemtap-sdt-devel \
vulkan-devel \
wayland-devel \
wayland-protocols-devel \
xorg-x11-server-Xvfb
which \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
@@ -49,4 +76,4 @@ RUN useradd -u $HOST_USER_ID -ms /bin/bash user
USER user
WORKDIR /home/user
ENV LANG C.utf8
ENV LANG C.UTF-8

View File

@@ -0,0 +1,44 @@
#!/bin/bash
set -e
appid=$1
builddir=app
repodir=repo
flatpak-builder \
--stop-at=gtk \
${builddir} \
build-aux/flatpak/${appid}.json
flatpak-builder \
--run ${builddir} build-aux/flatpak/${appid}.json \
meson \
--prefix /app \
--libdir /app/lib \
--buildtype debug \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dprint-backends=file \
-Dbuild-tests=false \
-Dbuild-examples=false \
-Dintrospection=false \
-Ddemos=true \
_build .
flatpak-builder \
--run ${builddir} build-aux/flatpak/${appid}.json \
ninja -C _build install
flatpak-builder \
--finish-only \
--repo=${repodir} \
${builddir} \
build-aux/flatpak/${appid}.json
flatpak build-bundle \
${repodir} \
${appid}-dev.flatpak \
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \
${appid}

View File

@@ -2,8 +2,10 @@
set -e
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "gitlab-gtk" \
TAG="ebassi/gitlab-gtk:latest"
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .
sudo docker run --rm \
sudo docker run --rm --security-opt label=disable \
--volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
--tty --interactive "gitlab-gtk" bash
--tty --interactive "${TAG}" bash

View File

@@ -2,8 +2,22 @@
set -e
pwd
meson -Denable-x11-backend=true -Denable-wayland-backend=true \
-Denable-broadway-backend=true -Denable-vulkan=yes _build_full
cd _build_full
srcdir=$(pwd)
meson \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dbroadway-backend=true \
-Dvulkan=yes \
_build $srcdir
cd _build
ninja
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test \
--print-errorlogs \
--suite=gtk+ \
--no-suite=gtk+:gsk \
--no-suite=gtk+:a11y

View File

@@ -0,0 +1,39 @@
## Steps to reproduce
1. ...
2. ...
3. ...
<!--
You should try and reproduce with the demos applications available
under the `demos` directory, or the test programs in the `tests` directory.
Alternatively, please attach a *small and self-contained* example that
exhibits the issue.
-->
## Current behavior
<!--
Please describe the current behaviour
-->
## Expected outcome
<!--
Please describe the expected outcome
-->
## Version information
<!--
- which version of GTK+ you are using
- what operating system and version
- for Linux, which distribution
- if you built GTK+ yourself, the list of options used to configure the build
-->
## Additional information
<!--
- If the bug was a crash, the exact text that was printed out
when the crash occurred.
- If the bug was a crash, attaching a stack trace obtained using
GDB is appreciated; follow the instructions on the wiki:
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces
-->

View File

@@ -1,30 +1,41 @@
If you want to hack on the GTK+ project, you'll need to have the development
tools appropriate for your operating system, including:
- Python (2.7 or 3.x)
- Meson
- Ninja
- Gettext (19.7 or newer)
- a C99 compatible compiler
- Python 3.x
- Meson
- Ninja
- Gettext (19.7 or newer)
- a C99 compatible compiler
Up-to-date instructions about developing GNOME applications and libraries
can be found here:
https://developer.gnome.org
* https://developer.gnome.org
Information about using git with GNOME can be found here:
Information about using GitLab with GNOME can be found here:
https://wiki.gnome.org/Git
* https://wiki.gnome.org/GitLab
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.
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).
**Note**: if you plan to push changes to back to the master repository and
have a GNOME account, you want to use the following instead:
You should start by forking the GTK repository from the GitLab web UI, and
cloning from your fork:
```ssh
$ git clone https://gitlab.gnome.org/yourusername/gtk.git
$ cd gtk
```
**Note**: if you plan to push changes to back to the main repository and
have a GNOME account, you can skip the fork, and use the following instead:
```sh
$ git clone ssh://<username>@git.gnome.org/git/gtk+
$ 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
@@ -32,9 +43,21 @@ configure your build using Meson:
```sh
$ meson _builddir .
$ cd _builddir
$ ninja
```
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`.
**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
$ 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.

View File

@@ -1,6 +1,8 @@
GTK+ — The GTK toolkit
======================
[![Build Status](https://gitlab.gnome.org/GNOME/gtk/badges/master/build.svg)](https://gitlab.gnome.org/GNOME/gtk/pipelines)
General information
-------------------
@@ -59,10 +61,10 @@ If you are building the X11 backend, you will also need:
- xrender
- xi
- xext
- xfixes (optional)
- xcursor (optional)
- xdamage (optional)
- xcomposite (optional)
- xfixes
- xcursor
- xdamage
- xcomposite
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
If you are building the Wayland backend, you will also need:
@@ -105,8 +107,7 @@ Or [online](https://developer.gnome.org/gtk4/stable/gtk-building.html)
How to report bugs
------------------
Bugs should be reported to the GNOME [bug tracking system](https://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2b).
You will need an account for yourself.
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
In the bug report please include:
@@ -121,11 +122,12 @@ In the bug report please include:
* How to reproduce the bug.
If you can reproduce it with one of the test programs that are built
in the tests/ subdirectory, that will be most convenient. Otherwise,
please include a short test program that exhibits the behavior.
As a last resort, you can also provide a pointer to a larger piece
of software that can be downloaded.
If you can reproduce it with one of the demo applications that are
built in the demos/ subdirectory, on one of the test programs that
are built in the tests/ subdirectory, that will be most convenient.
Otherwise, please include a short test program that exhibits the
behavior. As a last resort, you can also provide a pointer to a
larger piece of software that can be downloaded.
* If the bug was a crash, the exact text that was printed out
when the crash occurred.
@@ -133,24 +135,6 @@ In the bug report please include:
* Further information such as stack traces may be useful, but
is not necessary.
Contributing
------------
Patches should also be submitted to the bug tracking system. If the patch
fixes an existing bug, add the patch as an attachment to that bug report;
otherwise, enter a new bug report that describes the patch, and attach the
patch to that bug report.
Patches should be in Git-formatted form. You should use `git format-patch`
to generate them. We recommend using [git-bz](http://git.fishsoup.net/man/git-bz.html).
For more information on the recommended workflow, please read
[this wiki page](https://wiki.gnome.org/Git/WorkingWithPatches).
Please, follow the `CODING_STYLE` document in order to conform to GTK+'s
coding style when submitting a code contribution.
Release notes
-------------

View File

@@ -0,0 +1,59 @@
{
"app-id": "org.gtk.Demo",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"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": [
"--device=dri",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*",
"--talk-name=ca.desrt.conf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"cleanup": [
"/include",
"/lib/pkgconfig", "/share/pkgconfig",
"/share/aclocal",
"/man", "/share/man", "/share/gtk-doc",
"*.la", ".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules": [
{
"name": "graphene",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ebassi/graphene.git"
}
]
},
{
"name": "gtk",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
}
]
}
]
}

View File

@@ -0,0 +1,59 @@
{
"app-id": "org.gtk.WidgetFactory",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"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": [
"--device=dri",
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*",
"--talk-name=ca.desrt.conf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"cleanup": [
"/include",
"/lib/pkgconfig", "/share/pkgconfig",
"/share/aclocal",
"/man", "/share/man", "/share/gtk-doc",
"*.la", ".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules": [
{
"name": "graphene",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ebassi/graphene.git"
}
]
},
{
"name": "gtk",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
}
]
}
]
}

View File

@@ -16,8 +16,11 @@ if [ -z "$DESTDIR" ]; then
echo Updating icon cache...
gtk-update-icon-cache -q -t -f ${gtk_datadir}/icons/hicolor
echo Updating input method modules cache...
gtk_imdir=${gtk_libdir}/gtk-${gtk_api_version}/${gtk_abi_version}
mkdir -p ${gtk_imdir}
gtk4-query-immodules > ${gtk_imdir}/immodules.cache
echo Updating module cache for print backends...
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/printbackends
echo Updating module cache for input methods...
mkdir -p ${gtk_libdir}/gtk-4.0/4.0.0/immodules
gio-querymodules ${gtk_libdir}/gtk-4.0/4.0.0/immodules
fi

View File

@@ -41,6 +41,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#mesondefine HAVE_DLFCN_H
/* Have the ffmpeg library */
#mesondefine HAVE_FFMPEG
/* Define to 1 if you have the <ftw.h> header file. */
#mesondefine HAVE_FTW_H
@@ -53,6 +56,9 @@
/* Define if gio-unix is available */
#mesondefine HAVE_GIO_UNIX
/* Define if GStreamer support is available */
#mesondefine HAVE_GSTREAMER
/* Define to 1 if you have the `httpGetAuthString' function. */
#mesondefine HAVE_HTTPGETAUTHSTRING

View File

@@ -457,27 +457,26 @@ demo_application_window_constructed (GObject *object)
static void
demo_application_window_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip)
int baseline)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
baseline, out_clip);
baseline);
if (!window->maximized && !window->fullscreen)
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
}
static void
window_state_changed (GtkWidget *widget)
surface_state_changed (GtkWidget *widget)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
GdkWindowState new_state;
GdkSurfaceState new_state;
new_state = gdk_window_get_state (gtk_widget_get_window (widget));
window->maximized = (new_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
new_state = gdk_surface_get_state (gtk_widget_get_surface (widget));
window->maximized = (new_state & GDK_SURFACE_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_SURFACE_STATE_FULLSCREEN) != 0;
}
static void
@@ -485,15 +484,15 @@ demo_application_window_realize (GtkWidget *widget)
{
GTK_WIDGET_CLASS (demo_application_window_parent_class)->realize (widget);
g_signal_connect_swapped (gtk_widget_get_window (widget), "notify::state",
G_CALLBACK (window_state_changed), widget);
g_signal_connect_swapped (gtk_widget_get_surface (widget), "notify::state",
G_CALLBACK (surface_state_changed), widget);
}
static void
demo_application_window_unrealize (GtkWidget *widget)
{
g_signal_handlers_disconnect_by_func (gtk_widget_get_window (widget),
window_state_changed, widget);
g_signal_handlers_disconnect_by_func (gtk_widget_get_surface (widget),
surface_state_changed, widget);
GTK_WIDGET_CLASS (demo_application_window_parent_class)->unrealize (widget);
}

View File

@@ -68,19 +68,19 @@ enum
static GtkWidget *
find_toplevel_at_pointer (GdkDisplay *display)
{
GdkWindow *pointer_window;
GdkSurface *pointer_window;
GtkWidget *widget = NULL;
pointer_window = gdk_device_get_window_at_position (gtk_get_current_event_device (),
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (),
NULL, NULL);
/* The user data field of a GdkWindow is used to store a pointer
/* The user data field of a GdkSurface is used to store a pointer
* to the widget that created it.
*/
if (pointer_window)
{
gpointer widget_ptr;
gdk_window_get_user_data (pointer_window, &widget_ptr);
gdk_surface_get_user_data (pointer_window, &widget_ptr);
widget = widget_ptr;
}
@@ -128,7 +128,7 @@ query_for_toplevel (GdkDisplay *display,
device = gtk_get_current_event_device ();
if (gdk_seat_grab (gdk_device_get_seat (device),
gtk_widget_get_window (popup),
gtk_widget_get_surface (popup),
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
{

View File

@@ -93,8 +93,8 @@ paste_button_clicked (GtkWidget *button,
gdk_clipboard_read_text_async (clipboard, NULL, paste_received, entry);
}
static GdkTexture *
get_image_texture (GtkImage *image)
static GdkPaintable *
get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
GtkIconTheme *icon_theme;
@@ -102,15 +102,15 @@ get_image_texture (GtkImage *image)
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_TEXTURE:
return g_object_ref (gtk_image_get_texture (image));
case GTK_IMAGE_PAINTABLE:
return g_object_ref (gtk_image_get_paintable (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
return gtk_icon_info_load_texture (icon_info);
return GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info));
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
@@ -123,11 +123,14 @@ drag_begin (GtkWidget *widget,
GdkDragContext *context,
gpointer data)
{
GdkTexture *texture;
GdkPaintable *paintable;
texture = get_image_texture (GTK_IMAGE (widget));
if (texture)
gtk_drag_set_icon_texture (context, texture, -2, -2);
paintable = get_image_paintable (GTK_IMAGE (widget));
if (paintable)
{
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
g_object_unref (paintable);
}
}
void
@@ -138,11 +141,11 @@ drag_data_get (GtkWidget *widget,
guint time,
gpointer data)
{
GdkTexture *texture;
GdkPaintable *paintable;
texture = get_image_texture (GTK_IMAGE (widget));
if (texture)
gtk_selection_data_set_texture (selection_data, texture);
paintable = get_image_paintable (GTK_IMAGE (widget));
if (GDK_IS_TEXTURE (paintable))
gtk_selection_data_set_texture (selection_data, GDK_TEXTURE (paintable));
}
static void
@@ -157,7 +160,7 @@ drag_data_received (GtkWidget *widget,
GdkTexture *texture;
texture = gtk_selection_data_get_texture (selection_data);
gtk_image_set_from_texture (GTK_IMAGE (data), texture);
gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
}
@@ -167,16 +170,16 @@ copy_image (GtkMenuItem *item,
gpointer data)
{
GdkClipboard *clipboard;
GdkTexture *texture;
GdkPaintable *paintable;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
texture = get_image_texture (GTK_IMAGE (data));
paintable = get_image_paintable (GTK_IMAGE (data));
if (texture)
{
gdk_clipboard_set_texture (clipboard, texture);
g_object_unref (texture);
}
if (GDK_IS_TEXTURE (paintable))
gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
if (paintable)
g_object_unref (paintable);
}
static void
@@ -190,7 +193,7 @@ paste_image_received (GObject *source,
if (texture == NULL)
return;
gtk_image_set_from_texture (GTK_IMAGE (data), texture);
gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
@@ -318,10 +321,10 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (drag_data_received), image);
/* context menu on image */
gesture = gtk_gesture_multi_press_new (image);
gesture = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
/* Create the second image */
image = gtk_image_new_from_icon_name ("process-stop");
@@ -343,10 +346,10 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (drag_data_received), image);
/* context menu on image */
gesture = gtk_gesture_multi_press_new (image);
gesture = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
}
if (!gtk_widget_get_visible (window))

View File

@@ -677,7 +677,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/default_cursor.png</property>
<property name="paintable">resource:///cursors/default_cursor.png</property>
</object>
</child>
<child>
@@ -734,7 +734,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/none_cursor.png</property>
<property name="paintable">resource:///cursors/none_cursor.png</property>
</object>
</child>
<child>
@@ -791,7 +791,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/gtk_logo_cursor.png</property>
<property name="paintable">resource:///cursors/gtk_logo_cursor.png</property>
</object>
</child>
<child>
@@ -861,7 +861,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/context_menu_cursor.png</property>
<property name="paintable">resource:///cursors/context_menu_cursor.png</property>
</object>
</child>
<child>
@@ -918,7 +918,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/help_cursor.png</property>
<property name="paintable">resource:///cursors/help_cursor.png</property>
</object>
</child>
<child>
@@ -975,7 +975,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/pointer_cursor.png</property>
<property name="paintable">resource:///cursors/pointer_cursor.png</property>
</object>
</child>
<child>
@@ -1032,7 +1032,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/progress_cursor.png</property>
<property name="paintable">resource:///cursors/progress_cursor.png</property>
</object>
</child>
<child>
@@ -1089,7 +1089,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/wait_cursor.png</property>
<property name="paintable">resource:///cursors/wait_cursor.png</property>
</object>
</child>
<child>
@@ -1159,7 +1159,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/cell_cursor.png</property>
<property name="paintable">resource:///cursors/cell_cursor.png</property>
</object>
</child>
<child>
@@ -1216,7 +1216,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/crosshair_cursor.png</property>
<property name="paintable">resource:///cursors/crosshair_cursor.png</property>
</object>
</child>
<child>
@@ -1273,7 +1273,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/text_cursor.png</property>
<property name="paintable">resource:///cursors/text_cursor.png</property>
</object>
</child>
<child>
@@ -1330,7 +1330,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/vertical_text_cursor.png</property>
<property name="paintable">resource:///cursors/vertical_text_cursor.png</property>
</object>
</child>
<child>
@@ -1400,7 +1400,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/alias_cursor.png</property>
<property name="paintable">resource:///cursors/alias_cursor.png</property>
</object>
</child>
<child>
@@ -1457,7 +1457,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/copy_cursor.png</property>
<property name="paintable">resource:///cursors/copy_cursor.png</property>
</object>
</child>
<child>
@@ -1514,7 +1514,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/move_cursor.png</property>
<property name="paintable">resource:///cursors/move_cursor.png</property>
</object>
</child>
<child>
@@ -1571,7 +1571,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/no_drop_cursor.png</property>
<property name="paintable">resource:///cursors/no_drop_cursor.png</property>
</object>
</child>
<child>
@@ -1628,7 +1628,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/not_allowed_cursor.png</property>
<property name="paintable">resource:///cursors/not_allowed_cursor.png</property>
</object>
</child>
<child>
@@ -1685,7 +1685,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/grab_cursor.png</property>
<property name="paintable">resource:///cursors/grab_cursor.png</property>
</object>
</child>
<child>
@@ -1742,7 +1742,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/grabbing_cursor.png</property>
<property name="paintable">resource:///cursors/grabbing_cursor.png</property>
</object>
</child>
<child>
@@ -1812,7 +1812,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/all_scroll_cursor.png</property>
<property name="paintable">resource:///cursors/all_scroll_cursor.png</property>
</object>
</child>
<child>
@@ -1869,7 +1869,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/col_resize_cursor.png</property>
<property name="paintable">resource:///cursors/col_resize_cursor.png</property>
</object>
</child>
<child>
@@ -1926,7 +1926,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/row_resize_cursor.png</property>
<property name="paintable">resource:///cursors/row_resize_cursor.png</property>
</object>
</child>
<child>
@@ -1983,7 +1983,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/n_resize_cursor.png</property>
<property name="paintable">resource:///cursors/n_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2040,7 +2040,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/e_resize_cursor.png</property>
<property name="paintable">resource:///cursors/e_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2097,7 +2097,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/s_resize_cursor.png</property>
<property name="paintable">resource:///cursors/s_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2154,7 +2154,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/w_resize_cursor.png</property>
<property name="paintable">resource:///cursors/w_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2211,7 +2211,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/ne_resize_cursor.png</property>
<property name="paintable">resource:///cursors/ne_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2268,7 +2268,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/nw_resize_cursor.png</property>
<property name="paintable">resource:///cursors/nw_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2325,7 +2325,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/sw_resize_cursor.png</property>
<property name="paintable">resource:///cursors/sw_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2382,7 +2382,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/se_resize_cursor.png</property>
<property name="paintable">resource:///cursors/se_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2439,7 +2439,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/ew_resize_cursor.png</property>
<property name="paintable">resource:///cursors/ew_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2496,7 +2496,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/ns_resize_cursor.png</property>
<property name="paintable">resource:///cursors/ns_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2553,7 +2553,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/nesw_resize_cursor.png</property>
<property name="paintable">resource:///cursors/nesw_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2610,7 +2610,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/nwse_resize_cursor.png</property>
<property name="paintable">resource:///cursors/nwse_resize_cursor.png</property>
</object>
</child>
<child>
@@ -2680,7 +2680,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/zoom_in_cursor.png</property>
<property name="paintable">resource:///cursors/zoom_in_cursor.png</property>
</object>
</child>
<child>
@@ -2737,7 +2737,7 @@
<property name="spacing">10</property>
<child>
<object class="GtkImage">
<property name="texture">resource:///cursors/zoom_out_cursor.png</property>
<property name="paintable">resource:///cursors/zoom_out_cursor.png</property>
</object>
</child>
<child>

View File

@@ -121,6 +121,7 @@
<gresource prefix="/images">
<file>alphatest.png</file>
<file>floppybuddy.gif</file>
<file>gtk-logo.webm</file>
</gresource>
<gresource prefix="/pixbufs">
<file>apple-red.png</file>
@@ -181,6 +182,9 @@
<file>overlay.c</file>
<file>overlay2.c</file>
<file>pagesetup.c</file>
<file>paintable.c</file>
<file>paintable_animated.c</file>
<file>paintable_mediastream.c</file>
<file>panes.c</file>
<file>pickers.c</file>
<file>pixbufs.c</file>
@@ -204,6 +208,7 @@
<file>transparent.c</file>
<file>tree_store.c</file>
<file>textmask.c</file>
<file>video_player.c</file>
</gresource>
<gresource prefix="/textview">
<file>floppybuddy.gif</file>

View File

@@ -299,7 +299,7 @@ pressed_cb (GtkGesture *gesture,
rect.height = 0;
gtk_menu_popup_at_rect (GTK_MENU (menu),
gtk_widget_get_window (widget),
gtk_widget_get_surface (widget),
&rect,
GDK_GRAVITY_NORTH_WEST,
GDK_GRAVITY_NORTH_WEST,
@@ -356,10 +356,11 @@ do_dnd (GtkWidget *do_widget)
gtk_widget_set_hexpand (fixed, TRUE);
gtk_widget_set_vexpand (fixed, TRUE);
multipress = gtk_gesture_multi_press_new (fixed);
multipress = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (multipress), 0);
g_signal_connect (multipress, "pressed", G_CALLBACK (pressed_cb), NULL);
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);
gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");

View File

@@ -86,7 +86,7 @@ draw_brush (GtkWidget *widget,
cairo_destroy (cr);
gtk_widget_queue_draw_area (widget, update_rect.x, update_rect.y, update_rect.width, update_rect.height);
gtk_widget_queue_draw (widget);
}
static double start_x;
@@ -137,7 +137,7 @@ checkerboard_draw (GtkDrawingArea *da,
/* At the start of a draw handler, a clip region has been set on
* the Cairo context, and the contents have been cleared to the
* widget's background color. The docs for
* gdk_window_begin_paint_region() give more details on how this
* gdk_surface_begin_paint_region() give more details on how this
* works.
*/
@@ -244,13 +244,14 @@ do_drawingarea (GtkWidget *do_widget)
g_signal_connect (da, "size-allocate",
G_CALLBACK (scribble_size_allocate), NULL);
drag = gtk_gesture_drag_new (da);
drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
g_object_set_data_full (G_OBJECT (da), "drag", drag, g_object_unref);
gtk_widget_add_controller (da, GTK_EVENT_CONTROLLER (drag));
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), da);
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), da);
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), da);
}
if (!gtk_widget_get_visible (window))

View File

@@ -581,8 +581,7 @@ init_pad_controller (GtkWidget *window,
gint i;
action_group = g_simple_action_group_new ();
pad_controller = gtk_pad_controller_new (GTK_WINDOW (window),
G_ACTION_GROUP (action_group),
pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
NULL);
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
@@ -607,8 +606,7 @@ init_pad_controller (GtkWidget *window,
gtk_pad_controller_set_action_entries (pad_controller, pad_actions,
G_N_ELEMENTS (pad_actions));
g_object_set_data_full (G_OBJECT (window), "pad-controller",
pad_controller, g_object_unref);
gtk_widget_add_controller (window, GTK_EVENT_CONTROLLER (pad_controller));
g_object_unref (action_group);
}

View File

@@ -45,6 +45,9 @@
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<accessibility>
<relation type="label-for" target="treeview1"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -81,6 +84,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -129,6 +135,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -142,6 +151,9 @@
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<accessibility>
<relation type="label-for" target="treeview2"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -155,6 +167,9 @@
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<accessibility>
<relation type="label-for" target="treeview3"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -185,6 +200,9 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>

View File

@@ -9,6 +9,7 @@
#include "gtkfishbowl.h"
GtkWidget *info_label;
GtkWidget *allow_changes;
#define N_STATS 5
@@ -17,14 +18,7 @@ GtkWidget *allow_changes;
typedef struct _Stats Stats;
struct _Stats {
gint64 last_stats;
gint64 last_frame;
gint last_suggestion;
guint frame_counter_max;
guint stats_index;
guint frame_counter[N_STATS];
guint item_counter[N_STATS];
};
static Stats *
@@ -41,102 +35,132 @@ get_stats (GtkWidget *widget)
{
stats = g_new0 (Stats, 1);
g_object_set_qdata_full (G_OBJECT (widget), stats_quark, stats, g_free);
stats->last_frame = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
stats->last_stats = stats->last_frame;
}
return stats;
}
static gint64
guess_refresh_interval (GdkFrameClock *frame_clock)
{
gint64 interval;
gint64 i;
interval = G_MAXINT64;
for (i = gdk_frame_clock_get_history_start (frame_clock);
i < gdk_frame_clock_get_frame_counter (frame_clock);
i++)
{
GdkFrameTimings *t, *before;
gint64 ts, before_ts;
t = gdk_frame_clock_get_timings (frame_clock, i);
before = gdk_frame_clock_get_timings (frame_clock, i - 1);
if (t == NULL || before == NULL)
continue;
ts = gdk_frame_timings_get_frame_time (t);
before_ts = gdk_frame_timings_get_frame_time (before);
if (ts == 0 || before_ts == 0)
continue;
interval = MIN (interval, ts - before_ts);
}
if (interval == G_MAXINT64)
return 0;
return interval;
}
static void
do_stats (GtkWidget *widget,
GtkWidget *info_label,
gint *suggested_change)
{
GdkFrameClock *frame_clock;
Stats *stats;
gint64 frame_time;
GdkFrameTimings *start, *end;
gint64 start_counter, end_counter;
gint64 n_frames, expected_frames;
gint64 start_timestamp, end_timestamp;
gint64 interval;
char *new_label;
stats = get_stats (widget);
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
frame_clock = gtk_widget_get_frame_clock (widget);
if (frame_clock == NULL)
return;
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
start_counter = gdk_frame_clock_get_history_start (frame_clock);
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
end_counter--;
if (end_counter - start_counter < 4)
return;
start_timestamp = gdk_frame_timings_get_presentation_time (start);
end_timestamp = gdk_frame_timings_get_presentation_time (end);
if (start_timestamp == 0 || end_timestamp == 0)
{
char *new_label;
guint i, n_frames;
start_timestamp = gdk_frame_timings_get_frame_time (start);
end_timestamp = gdk_frame_timings_get_frame_time (end);
}
n_frames = 0;
for (i = 0; i < N_STATS; i++)
{
n_frames += stats->frame_counter[i];
}
new_label = g_strdup_printf ("icons - %.1f fps",
(double) G_USEC_PER_SEC * n_frames
/ (N_STATS * STATS_UPDATE_TIME));
gtk_label_set_label (GTK_LABEL (info_label), new_label);
g_free (new_label);
interval = gdk_frame_timings_get_refresh_interval (end);
if (interval == 0)
{
interval = guess_refresh_interval (frame_clock);
if (interval == 0)
return;
}
n_frames = end_counter - start_counter;
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
if (stats->frame_counter[stats->stats_index] >= 19 * stats->frame_counter_max / 20)
{
if (stats->last_suggestion > 0)
stats->last_suggestion *= 2;
else
stats->last_suggestion = 1;
}
new_label = g_strdup_printf ("icons - %.1f fps",
((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp));
gtk_label_set_label (GTK_LABEL (info_label), new_label);
g_free (new_label);
if (n_frames >= expected_frames)
{
if (stats->last_suggestion > 0)
stats->last_suggestion *= 2;
else
{
if (stats->last_suggestion < 0)
stats->last_suggestion--;
else
stats->last_suggestion = -1;
stats->last_suggestion = MAX (stats->last_suggestion, 1 - (int) stats->item_counter[stats->stats_index]);
}
stats->stats_index = (stats->stats_index + 1) % N_STATS;
stats->frame_counter[stats->stats_index] = 0;
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
stats->last_stats = frame_time;
if (suggested_change)
*suggested_change = stats->last_suggestion;
stats->last_suggestion = 1;
}
else if (n_frames + 1 < expected_frames)
{
if (stats->last_suggestion < 0)
stats->last_suggestion--;
else
stats->last_suggestion = 0;
stats->last_suggestion = -1;
}
else
{
if (suggested_change)
*suggested_change = 0;
stats->last_suggestion = 0;
}
stats->last_frame = frame_time;
stats->frame_counter[stats->stats_index]++;
stats->frame_counter_max = MAX (stats->frame_counter_max, stats->frame_counter[stats->stats_index]);
}
static void
stats_update (GtkWidget *widget)
{
Stats *stats;
stats = get_stats (widget);
stats->item_counter[stats->stats_index] = gtk_fishbowl_get_count (GTK_FISHBOWL (widget));
if (suggested_change)
*suggested_change = stats->last_suggestion;
else
stats->last_suggestion = 0;
}
static gboolean
move_fish (GtkWidget *bowl,
GdkFrameClock *frame_clock,
gpointer info_label)
move_fish (gpointer bowl)
{
gint suggested_change = 0;
gint suggested_change = 0, new_count;
do_stats (bowl,
info_label,
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allow_changes)) ? &suggested_change : NULL);
gtk_fishbowl_set_count (GTK_FISHBOWL (bowl),
gtk_fishbowl_get_count (GTK_FISHBOWL (bowl)) + suggested_change);
stats_update (bowl);
new_count = gtk_fishbowl_get_count (GTK_FISHBOWL (bowl)) + suggested_change;
new_count = MAX (1, new_count);
gtk_fishbowl_set_count (GTK_FISHBOWL (bowl), new_count);
return G_SOURCE_CONTINUE;
}
@@ -149,7 +173,7 @@ do_fishbowl (GtkWidget *do_widget)
if (!window)
{
GtkBuilder *builder;
GtkWidget *bowl, *info_label;
GtkWidget *bowl;
g_type_ensure (GTK_TYPE_FISHBOWL);
@@ -166,7 +190,9 @@ do_fishbowl (GtkWidget *do_widget)
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_realize (window);
gtk_widget_add_tick_callback (bowl, move_fish, info_label, NULL);
g_timeout_add_seconds (1,
move_fish,
bowl);
}
if (!gtk_widget_get_visible (window))

View File

@@ -33,8 +33,8 @@
</child>
<child>
<object class="GtkToggleButton" id="changes_prevent">
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean"/>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean"/>
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">True</property>
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">False</property>
<property name="icon-name">changes-prevent</property>
<property name="relief">none</property>
</object>

View File

@@ -42,6 +42,7 @@
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="font">Sans 12</property>
<property name="level">family|style|size|variations|features</property>
<signal name="font-set" handler="font_changed" swapped="no"/>
</object>
</child>

View File

@@ -208,23 +208,27 @@ plane_drag_gesture_end (GtkGestureDrag *gesture,
static void
gtk_font_plane_init (GtkFontPlane *plane)
{
gtk_widget_set_has_window (GTK_WIDGET (plane), FALSE);
GtkGesture *gesture;
gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
plane->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (plane));
g_signal_connect (plane->drag_gesture, "drag-begin",
gesture = gtk_gesture_drag_new ();
g_signal_connect (gesture, "drag-begin",
G_CALLBACK (plane_drag_gesture_begin), plane);
g_signal_connect (plane->drag_gesture, "drag-update",
g_signal_connect (gesture, "drag-update",
G_CALLBACK (plane_drag_gesture_update), plane);
g_signal_connect (plane->drag_gesture, "drag-end",
g_signal_connect (gesture, "drag-end",
G_CALLBACK (plane_drag_gesture_end), plane);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (plane->drag_gesture), 0);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
plane->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (plane));
g_signal_connect (plane->long_press_gesture, "pressed",
gesture = gtk_gesture_long_press_new ();
g_signal_connect (gesture, "pressed",
G_CALLBACK (hold_action), plane);
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (plane->long_press_gesture),
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
TRUE);
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
}
static void
@@ -235,9 +239,6 @@ plane_finalize (GObject *object)
g_clear_object (&plane->weight_adj);
g_clear_object (&plane->width_adj);
g_clear_object (&plane->drag_gesture);
g_clear_object (&plane->long_press_gesture);
G_OBJECT_CLASS (gtk_font_plane_parent_class)->finalize (object);
}

View File

@@ -41,7 +41,6 @@ struct _GtkFontPlane
GtkAdjustment *width_adj;
GtkGesture *drag_gesture;
GtkGesture *long_press_gesture;
};
struct _GtkFontPlaneClass

View File

@@ -157,12 +157,12 @@ do_gestures (GtkWidget *do_widget)
NULL, NULL);
/* Swipe */
gesture = gtk_gesture_swipe_new (drawing_area);
gesture = gtk_gesture_swipe_new ();
g_signal_connect (gesture, "swipe",
G_CALLBACK (swipe_gesture_swept), drawing_area);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
/* 3fg swipe for touchpads */
gesture = g_object_new (GTK_TYPE_GESTURE_SWIPE,
@@ -178,30 +178,30 @@ do_gestures (GtkWidget *do_widget)
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
/* Long press */
gesture = gtk_gesture_long_press_new (drawing_area);
gesture = gtk_gesture_long_press_new ();
g_signal_connect (gesture, "pressed",
G_CALLBACK (long_press_gesture_pressed), drawing_area);
g_signal_connect (gesture, "end",
G_CALLBACK (long_press_gesture_end), drawing_area);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
/* Rotate */
rotate = gesture = gtk_gesture_rotate_new (drawing_area);
rotate = gesture = gtk_gesture_rotate_new ();
g_signal_connect (gesture, "angle-changed",
G_CALLBACK (rotation_angle_changed), drawing_area);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
/* Zoom */
zoom = gesture = gtk_gesture_zoom_new (drawing_area);
zoom = gesture = gtk_gesture_zoom_new ();
g_signal_connect (gesture, "scale-changed",
G_CALLBACK (zoom_scale_changed), drawing_area);
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
GTK_PHASE_BUBBLE);
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
}
if (!gtk_widget_get_visible (window))

Binary file not shown.

View File

@@ -56,7 +56,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_CONTAINER)
static void
gtk_fishbowl_init (GtkFishbowl *fishbowl)
{
gtk_widget_set_has_window (GTK_WIDGET (fishbowl), FALSE);
gtk_widget_set_has_surface (GTK_WIDGET (fishbowl), FALSE);
}
/**
@@ -127,8 +127,7 @@ gtk_fishbowl_measure (GtkWidget *widget,
static void
gtk_fishbowl_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip)
int baseline)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
@@ -139,8 +138,6 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
for (children = priv->children; children; children = children->next)
{
GtkAllocation child_clip;
child = children->data;
if (!gtk_widget_get_visible (child->widget))
@@ -152,7 +149,7 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
child_allocation.width = child_requisition.width;
child_allocation.height = child_requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation, -1, &child_clip);
gtk_widget_size_allocate (child->widget, &child_allocation, -1);
}
}

View File

@@ -317,12 +317,16 @@ toggle_sensitivity_callback (GtkWidget *togglebutton,
GtkWidget *
do_images (GtkWidget *do_widget)
{
GtkWidget *video;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *base_vbox;
GtkWidget *image;
GtkWidget *label;
GtkWidget *button;
GIcon *gicon;
GdkPaintable *paintable;
GIcon *gicon;
if (!window)
{
@@ -336,9 +340,15 @@ do_images (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (cleanup_callback), NULL);
base_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
g_object_set (base_vbox, "margin", 16, NULL);
gtk_container_add (GTK_CONTAINER (window), base_vbox);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
gtk_container_add (GTK_CONTAINER (base_vbox), hbox);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
g_object_set (vbox, "margin", 16, NULL);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
@@ -395,6 +405,8 @@ do_images (GtkWidget *do_widget)
/* Progressive */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
@@ -415,13 +427,48 @@ do_images (GtkWidget *do_widget)
start_progressive_loading (image);
/* Video */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Displaying video</u>");
gtk_box_pack_start (GTK_BOX (vbox), label);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_widget_set_halign (frame, GTK_ALIGN_CENTER);
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), frame);
video = gtk_video_new_for_resource ("/images/gtk-logo.webm");
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
gtk_container_add (GTK_CONTAINER (frame), video);
/* Widget paintables */
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
gtk_container_add (GTK_CONTAINER (hbox), vbox);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>GtkWidgetPaintable</u>");
gtk_box_pack_start (GTK_BOX (vbox), label);
paintable = gtk_widget_paintable_new (do_widget);
image = gtk_image_new_from_paintable (paintable);
gtk_image_set_can_shrink (GTK_IMAGE (image), TRUE);
gtk_widget_set_size_request (image, 100, 100);
gtk_widget_set_valign (image, GTK_ALIGN_START);
gtk_container_add (GTK_CONTAINER (vbox), image);
/* Sensitivity control */
button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
gtk_box_pack_start (GTK_BOX (vbox), button);
gtk_box_pack_start (GTK_BOX (base_vbox), button);
g_signal_connect (button, "toggled",
G_CALLBACK (toggle_sensitivity_callback),
vbox);
base_vbox);
}
if (!gtk_widget_get_visible (window))

View File

@@ -2,12 +2,13 @@
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <dirent.h>
#include <locale.h>
#include <langinfo.h>
#include <sys/stat.h>
#include <glib.h>
@@ -173,9 +174,9 @@ languages_variant_init (const char *variant)
{
gboolean res;
gsize buf_len;
g_autofree char *buf = NULL;
g_autofree char *filename = NULL;
g_autoptr (GError) error = NULL;
char *buf = NULL;
char *filename = NULL;
GError *error = NULL;
bindtextdomain (variant, ISO_CODES_LOCALESDIR);
bind_textdomain_codeset (variant, "UTF-8");
@@ -185,19 +186,25 @@ languages_variant_init (const char *variant)
res = g_file_get_contents (filename, &buf, &buf_len, &error);
if (res)
{
g_autoptr (GMarkupParseContext) ctx = NULL;
GMarkupParseContext *ctx = NULL;
GMarkupParser parser = { languages_parse_start_tag, NULL, NULL, NULL, NULL };
ctx = g_markup_parse_context_new (&parser, 0, NULL, NULL);
g_free (error);
error = NULL;
res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
g_free (ctx);
if (!res)
g_warning ("Failed to parse '%s': %s\n", filename, error->message);
}
else
g_warning ("Failed to load '%s': %s\n", filename, error->message);
g_free (error);
g_free (filename);
g_free (buf);
}
static void

View File

@@ -37,7 +37,7 @@ enum
static Bug data[] =
{
{ FALSE, 60482, "Normal", "scrollable notebooks and hidden tabs" },
{ FALSE, 60620, "Critical", "gdk_window_clear_area (gdkwindow-win32.c) is not thread-safe" },
{ FALSE, 60620, "Critical", "gdk_surface_clear_area (gdksurface-win32.c) is not thread-safe" },
{ FALSE, 50214, "Major", "Xft support does not clean up correctly" },
{ TRUE, 52877, "Major", "GtkFileSelection needs a refresh method. " },
{ FALSE, 56070, "Normal", "Can't click button after setting in sensitive" },

View File

@@ -98,6 +98,9 @@
<property name="yalign">0</property>
<property name="label" translatable="0">Message</property>
<property name="wrap">1</property>
<accessibility>
<role type="static"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>

View File

@@ -250,7 +250,7 @@ static gchar *types[] =
"GtkTreeSelection ",
"GdkDisplay ",
"GdkScreen ",
"GdkWindow ",
"GdkSurface ",
"GdkEventButton ",
"GdkCursor ",
"GtkTreeIter ",
@@ -555,7 +555,7 @@ add_data_tab (const gchar *demoname)
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
widget = gtk_image_new_from_resource (resource_name);
if (gtk_image_get_surface (GTK_IMAGE (widget)) == NULL)
if (gtk_image_get_paintable (GTK_IMAGE (widget)) == NULL)
{
GBytes *bytes;

View File

@@ -45,6 +45,9 @@ demos = files([
'modelbutton.c',
'overlay.c',
'overlay2.c',
'paintable.c',
'paintable_animated.c',
'paintable_mediastream.c',
'panes.c',
'pickers.c',
'pixbufs.c',
@@ -68,12 +71,16 @@ demos = files([
'theming_style_classes.c',
'transparent.c',
'tree_store.c',
'video_player.c',
])
gtkdemo_deps = [ libgtk_dep, ]
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c'])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files('font_features.c')
extra_demo_sources += files(['script-names.c', 'language-names.c'])
gtkdemo_deps += [ harfbuzz_dep, ]
endif
@@ -93,13 +100,12 @@ gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
source_dir: '.')
executable('gtk4-demo',
'main.c', 'gtkfishbowl.c', 'fontplane.c', 'script-names.c', 'language-names.c',
'gtkgears.c',
demos, demos_h, gtkdemo_resources,
demos, demos_h, extra_demo_sources, gtkdemo_resources,
c_args: gtkdemo_args,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
executable('gtk4-demo-application',
@@ -108,6 +114,7 @@ executable('gtk4-demo-application',
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
@@ -127,3 +134,6 @@ install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir)
# GSettings
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
gnome.compile_schemas()
# appdata
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.Demo.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK+ Demo</name>
<summary>Program to demonstrate GTK+ functions</summary>
<description>
<p>
GTK+ Demo is a collection of examples that demonstrate the major
features of the GTK+ toolkit.
</p>
</description>
<screenshots>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-demo/gtk-demo1.png</image>
<caption>The main window</caption>
</screenshot>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-demo/gtk-demo2.png</image>
<caption>An example</caption>
</screenshot>
</screenshots>
<kudos>
<kudo>AppMenu</kudo>
<kudo>HiDpiIcon</kudo>
<kudo>ModernToolkit</kudo>
</kudos>
<url type="homepage">https://www.gtk.org</url>
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
</component>

179
demos/gtk-demo/paintable.c Normal file
View File

@@ -0,0 +1,179 @@
/* Paintable/A simple paintable
*
* GdkPaintable is an interface used by GTK for drawings of any sort
* that do not require layouting or positioning.
*
* This demo code gives a simple example on how a paintable can
* be created.
*
* Paintables can be used in many places inside GTK widgets, but the
* most common usage is inside GtkImage and that's what we're going
* to do here.
*/
#include <gtk/gtk.h>
#include "paintable.h"
static GtkWidget *window = NULL;
/* First, add the boilerplate for the object itself.
* This part would normally go in the header.
*/
#define GTK_TYPE_NUCLEAR_ICON (gtk_nuclear_icon_get_type ())
G_DECLARE_FINAL_TYPE (GtkNuclearIcon, gtk_nuclear_icon, GTK, NUCLEAR_ICON, GObject)
/* Declare the struct. */
struct _GtkNuclearIcon
{
GObject parent_instance;
/* We store this rotation value here.
* We are not doing with it here, but it will come in
* very useful in the followup demos.
*/
double rotation;
};
struct _GtkNuclearIconClass
{
GObjectClass parent_class;
};
/* This is the function that draws the actual icon.
* We make it a custom function and define it in the paintable.h header
* so that it can be called from all the other demos, too.
*/
void
gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double width,
double height,
double rotation)
{
#define RADIUS 0.3
cairo_t *cr;
double size;
gtk_snapshot_append_color (snapshot,
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
&GRAPHENE_RECT_INIT (0, 0, width, height),
"Yellow background");
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
(height - size) / 2.0,
size, size),
"Radioactive Icon");
cairo_translate (cr, width / 2.0, height / 2.0);
cairo_scale (cr, size, size);
cairo_rotate (cr, rotation);
cairo_arc (cr, 0, 0, 0.1, - G_PI, G_PI);
cairo_fill (cr);
cairo_set_line_width (cr, RADIUS);
cairo_set_dash (cr, (double[1]) { RADIUS * G_PI / 3 }, 1, 0.0);
cairo_arc (cr, 0, 0, RADIUS, - G_PI, G_PI);
cairo_stroke (cr);
cairo_destroy (cr);
}
/* Here, we implement the functionality required by the GdkPaintable interface */
static void
gtk_nuclear_icon_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkNuclearIcon *nuclear = GTK_NUCLEAR_ICON (paintable);
/* The snapshot function is the only function we need to implement.
* It does the actual drawing of the paintable.
*/
gtk_nuclear_snapshot (snapshot,
width, height,
nuclear->rotation);
}
static GdkPaintableFlags
gtk_nuclear_icon_get_flags (GdkPaintable *paintable)
{
/* The flags are very useful to let GTK know that this image
* is never going to change.
* This allows many optimizations and should therefore always
* be set.
*/
return GDK_PAINTABLE_STATIC_CONTENTS | GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_nuclear_icon_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gtk_nuclear_icon_snapshot;
iface->get_flags = gtk_nuclear_icon_get_flags;
}
/* When defining the GType, we need to implement the GdkPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkNuclearIcon, gtk_nuclear_icon, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_nuclear_icon_paintable_init))
/* Here's the boilerplate for the GObject declaration.
* We don't need to do anything special here, because we keep no
* data of our own.
*/
static void
gtk_nuclear_icon_class_init (GtkNuclearIconClass *klass)
{
}
static void
gtk_nuclear_icon_init (GtkNuclearIcon *nuclear)
{
}
/* And finally, we add a simple constructor.
* It is declared in the header so that the other examples
* can use it.
*/
GdkPaintable *
gtk_nuclear_icon_new (double rotation)
{
GtkNuclearIcon *nuclear;
nuclear = g_object_new (GTK_TYPE_NUCLEAR_ICON, NULL);
nuclear->rotation = rotation;
return GDK_PAINTABLE (nuclear);
}
GtkWidget *
do_paintable (GtkWidget *do_widget)
{
GdkPaintable *nuclear;
GtkWidget *image;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Nuclear Icon");
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
nuclear = gtk_nuclear_icon_new (0.0);
image = gtk_image_new_from_paintable (nuclear);
gtk_container_add (GTK_CONTAINER (window), image);
g_object_unref (nuclear);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,15 @@
#ifndef __PAINTABLE_H__
#define __PAINTABLE_H__
#include <gtk/gtk.h>
void gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double width,
double height,
double rotation);
GdkPaintable * gtk_nuclear_icon_new (double rotation);
GdkPaintable * gtk_nuclear_animation_new (void);
GtkMediaStream *gtk_nuclear_media_stream_new (void);
#endif /* __PAINTABLE_H__ */

View File

@@ -0,0 +1,209 @@
/* Paintable/An animated paintable
*
* GdkPaintable also allows paintables to change.
*
* This demo code gives an example of how this could work. It builds
* on the previous simple example.
*
* Paintables can also change their size, this works similarly, but
* we will not demonstrate this here as our icon does not have any size.
*/
#include <gtk/gtk.h>
#include "paintable.h"
static GtkWidget *window = NULL;
/* First, add the boilerplate for the object itself.
* This part would normally go in the header.
*/
#define GTK_TYPE_NUCLEAR_ANIMATION (gtk_nuclear_animation_get_type ())
G_DECLARE_FINAL_TYPE (GtkNuclearAnimation, gtk_nuclear_animation, GTK, NUCLEAR_ANIMATION, GObject)
/* Do a full rotation in 5 seconds.
* We will register the timeout for doing a single step to
* be executed every 10ms, which means after 1000 steps
* 10s will have elapsed.
*/
#define MAX_PROGRESS 500
/* Declare the struct. */
struct _GtkNuclearAnimation
{
GObject parent_instance;
/* This variable stores the progress of our animation.
* We just count upwards until we hit MAX_PROGRESS and
* then start from scratch.
*/
int progress;
/* This variable holds the ID of the timer that updates
* our progress variable.
* We need to keep track of it so that we can remove it
* again.
*/
guint source_id;
};
struct _GtkNuclearAnimationClass
{
GObjectClass parent_class;
};
/* Again, we implement the functionality required by the GdkPaintable interface */
static void
gtk_nuclear_animation_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkNuclearAnimation *nuclear = GTK_NUCLEAR_ANIMATION (paintable);
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
width, height,
2 * G_PI * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintable *
gtk_nuclear_animation_get_current_image (GdkPaintable *paintable)
{
GtkNuclearAnimation *nuclear = GTK_NUCLEAR_ANIMATION (paintable);
/* For non-static paintables, this function needs to be implemented.
* It must return a static paintable with the same contents
* as this one currently has.
*
* Luckily we added the rotation property to the nuclear icon
* object previously, so we can just return an instance of that one.
*/
return gtk_nuclear_icon_new (2 * G_PI * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintableFlags
gtk_nuclear_animation_get_flags (GdkPaintable *paintable)
{
/* This time, we cannot set the static contents flag because our animation
* changes the contents.
* However, our size still doesn't change, so report that flag.
*/
return GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_nuclear_animation_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gtk_nuclear_animation_snapshot;
iface->get_current_image = gtk_nuclear_animation_get_current_image;
iface->get_flags = gtk_nuclear_animation_get_flags;
}
/* When defining the GType, we need to implement the GdkPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkNuclearAnimation, gtk_nuclear_animation, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_nuclear_animation_paintable_init))
/* This time, we need to implement the finalize function,
*/
static void
gtk_nuclear_animation_finalize (GObject *object)
{
GtkNuclearAnimation *nuclear = GTK_NUCLEAR_ANIMATION (object);
/* Remove the timeout we registered when constructing
* the object.
*/
g_source_remove (nuclear->source_id);
/* Don't forget to chain up to the parent class' implementation
* of the finalize function.
*/
G_OBJECT_CLASS (gtk_nuclear_animation_parent_class)->finalize (object);
}
/* In the class declaration, we need to add our finalize function.
*/
static void
gtk_nuclear_animation_class_init (GtkNuclearAnimationClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = gtk_nuclear_animation_finalize;
}
static gboolean
gtk_nuclear_animation_step (gpointer data)
{
GtkNuclearAnimation *nuclear = data;
/* Add 1 to the progress and reset it when we've reached
* the maximum value.
* The animation will rotate by 360 degrees at MAX_PROGRESS
* so it will be identical to the original unrotated one.
*/
nuclear->progress = (nuclear->progress + 1) % MAX_PROGRESS;
/* Now we need to tell all listeners that we've changed out contents
* so that they can redraw this paintable.
*/
gdk_paintable_invalidate_contents (GDK_PAINTABLE (nuclear));
/* We want this timeout function to be called repeatedly,
* so we return this value here.
* If this was a single-shot timeout, we could also
* return G_SOURCE_REMOVE here to get rid of it.
*/
return G_SOURCE_CONTINUE;
}
static void
gtk_nuclear_animation_init (GtkNuclearAnimation *nuclear)
{
/* Add a timer here that constantly updates our animations.
* We want to update it often enough to guarantee a smooth animation.
*
* Ideally, we'd attach to the frame clock, but because we do
* not have it available here, we just use a regular timeout
* that hopefully triggers often enough to be smooth.
*/
nuclear->source_id = g_timeout_add (10,
gtk_nuclear_animation_step,
nuclear);
}
/* And finally, we add the simple constructor we declared in the header. */
GdkPaintable *
gtk_nuclear_animation_new (void)
{
return g_object_new (GTK_TYPE_NUCLEAR_ANIMATION, NULL);
}
GtkWidget *
do_paintable_animated (GtkWidget *do_widget)
{
GdkPaintable *nuclear;
GtkWidget *image;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Nuclear Animation");
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
nuclear = gtk_nuclear_animation_new ();
image = gtk_image_new_from_paintable (nuclear);
gtk_container_add (GTK_CONTAINER (window), image);
g_object_unref (nuclear);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,312 @@
/* Paintable/A media stream
*
* GdkPaintable is also used by the GtkMediaStream class.
*
* This demo code turns the nuclear media_stream into the object
* GTK uses for videos. This allows treating the icon like a
* regular video, so we can for example attach controls to it.
*
* After all, what good is an media_stream if one cannot pause
* it.
*/
#include <gtk/gtk.h>
#include "paintable.h"
static GtkWidget *window = NULL;
/* First, add the boilerplate for the object itself.
* This part would normally go in the header.
*/
#define GTK_TYPE_NUCLEAR_MEDIA_STREAM (gtk_nuclear_media_stream_get_type ())
G_DECLARE_FINAL_TYPE (GtkNuclearMediaStream, gtk_nuclear_media_stream, GTK, NUCLEAR_MEDIA_STREAM, GtkMediaStream)
/* Do a full rotation in 5 seconds.
*
* We do not save steps here but real timestamps.
* GtkMediaStream uses microseconds, so we will do so, too.
*/
#define DURATION (5 * G_USEC_PER_SEC)
/* Declare the struct. */
struct _GtkNuclearMediaStream
{
/* We now inherit from the media stream object. */
GtkMediaStream parent_instance;
/* This variable stores the progress of our video.
*/
gint64 progress;
/* This variable stores the timestamp of the last
* time we updated the progress variable when the
* video is currently playing.
* This is so that we can always accurately compute the
* progress we've had, even if the timeout does not
* exactly work.
*/
gint64 last_time;
/* This variable again holds the ID of the timer that
* updates our progress variable. Nothing changes about
* how this works compared to the previous example.
*/
guint source_id;
};
struct _GtkNuclearMediaStreamClass
{
GObjectClass parent_class;
};
/* GtkMediaStream is a GdkPaintable. So when we want to display video,
* we have to implement the interface, just like in the animation example.
*/
static void
gtk_nuclear_media_stream_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (paintable);
/* We call the function from the previous example here. */
gtk_nuclear_snapshot (snapshot,
width, height,
2 * G_PI * nuclear->progress / DURATION);
}
static GdkPaintable *
gtk_nuclear_media_stream_get_current_image (GdkPaintable *paintable)
{
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (paintable);
/* Same thing as with the animation */
return gtk_nuclear_icon_new (2 * G_PI * nuclear->progress / DURATION);
}
static GdkPaintableFlags
gtk_nuclear_media_stream_get_flags (GdkPaintable *paintable)
{
/* And same thing as with the animation over here, too. */
return GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_nuclear_media_stream_paintable_init (GdkPaintableInterface *iface)
{
iface->snapshot = gtk_nuclear_media_stream_snapshot;
iface->get_current_image = gtk_nuclear_media_stream_get_current_image;
iface->get_flags = gtk_nuclear_media_stream_get_flags;
}
/* This time, we inherit from GTK_TYPE_MEDIA_STREAM */
G_DEFINE_TYPE_WITH_CODE (GtkNuclearMediaStream, gtk_nuclear_media_stream, GTK_TYPE_MEDIA_STREAM,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_nuclear_media_stream_paintable_init))
static gboolean
gtk_nuclear_media_stream_step (gpointer data)
{
GtkNuclearMediaStream *nuclear = data;
gint64 current_time;
/* Compute the time that has elapsed since the last time we were called
* and add it to our current progress.
*/
current_time = g_source_get_time (g_main_current_source ());
nuclear->progress += current_time - nuclear->last_time;
/* Check if we've ended */
if (nuclear->progress > DURATION)
{
if (gtk_media_stream_get_loop (GTK_MEDIA_STREAM (nuclear)))
{
/* We're looping. So make the progress loop using modulo */
nuclear->progress %= DURATION;
}
else
{
/* Just make sure we don't overflow */
nuclear->progress = DURATION;
}
}
/* Update the last time to the current timestamp. */
nuclear->last_time = current_time;
/* Update the timestamp of the media stream */
gtk_media_stream_update (GTK_MEDIA_STREAM (nuclear), nuclear->progress);
/* We also need to invalidate our contents again.
* After all, we are a video and not just an audio stream.
*/
gdk_paintable_invalidate_contents (GDK_PAINTABLE (nuclear));
/* Now check if we have finished playing and if so,
* tell the media stream. The media stream will then
* call our pause function to pause the stream.
*/
if (nuclear->progress >= DURATION)
gtk_media_stream_ended (GTK_MEDIA_STREAM (nuclear));
/* The timeout function is removed by the pause function,
* so we can just always return this value.
*/
return G_SOURCE_CONTINUE;
}
static gboolean
gtk_nuclear_media_stream_play (GtkMediaStream *stream)
{
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (stream);
/* If we're already at the end of the stream, we don't want
* to start playing and exit early.
*/
if (nuclear->progress >= DURATION)
return FALSE;
/* This time, we add the source only when we start playing.
*/
nuclear->source_id = g_timeout_add (10,
gtk_nuclear_media_stream_step,
nuclear);
/* We also want to initialize our time, so that we can
* do accurate updates.
*/
nuclear->last_time = g_get_monotonic_time ();
/* We successfully started playing, so we return TRUE here. */
return TRUE;
}
static void
gtk_nuclear_media_stream_pause (GtkMediaStream *stream)
{
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (stream);
/* This function will be called when a playing stream
* gets paused.
* So we remove the updating source here and set it
* back to 0 so that the finalize function doesn't try
* to remove it again.
*/
g_source_remove (nuclear->source_id);
nuclear->source_id = 0;
nuclear->last_time = 0;
}
static void
gtk_nuclear_media_stream_seek (GtkMediaStream *stream,
gint64 timestamp)
{
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (stream);
/* This is optional functionality for media streams,
* but not being able to seek is kinda boring.
* And it's trivial to implement, so let's go for it.
*/
nuclear->progress = timestamp;
/* Media streams are asynchronous, so seeking can take a while.
* We however don't need that functionality, so we can just
* report success.
*/
gtk_media_stream_seek_success (stream);
/* We also have to update our timestamp and tell the
* paintable interface abbout the seek
*/
gtk_media_stream_update (stream, nuclear->progress);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (nuclear));
}
/* Again, we need to implement the finalize function.
*/
static void
gtk_nuclear_media_stream_finalize (GObject *object)
{
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (object);
/* This time, we need to check if the source exists before
* removing it as it only exists while we are playing.
*/
if (nuclear->source_id > 0)
g_source_remove (nuclear->source_id);
/* Don't forget to chain up to the parent class' implementation
* of the finalize function.
*/
G_OBJECT_CLASS (gtk_nuclear_media_stream_parent_class)->finalize (object);
}
/* In the class declaration, we need to implement the media stream */
static void
gtk_nuclear_media_stream_class_init (GtkNuclearMediaStreamClass *klass)
{
GtkMediaStreamClass *stream_class = GTK_MEDIA_STREAM_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
stream_class->play = gtk_nuclear_media_stream_play;
stream_class->pause = gtk_nuclear_media_stream_pause;
stream_class->seek = gtk_nuclear_media_stream_seek;
gobject_class->finalize = gtk_nuclear_media_stream_finalize;
}
static void
gtk_nuclear_media_stream_init (GtkNuclearMediaStream *nuclear)
{
/* This time, we don't have to add a timer here, because media
* streams start paused.
*
* However, media streams need to tell GTK once they are intialized,
* so we do that here.
*/
gtk_media_stream_prepared (GTK_MEDIA_STREAM (nuclear),
FALSE,
TRUE,
TRUE,
DURATION);
}
/* And finally, we add the simple constructor we declared in the header. */
GtkMediaStream *
gtk_nuclear_media_stream_new (void)
{
return g_object_new (GTK_TYPE_NUCLEAR_MEDIA_STREAM, NULL);
}
GtkWidget *
do_paintable_mediastream (GtkWidget *do_widget)
{
GtkMediaStream *nuclear;
GtkWidget *video;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Nuclear MediaStream");
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
nuclear = gtk_nuclear_media_stream_new ();
gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
video = gtk_video_new_for_media_stream (nuclear);
gtk_container_add (GTK_CONTAINER (window), video);
g_object_unref (nuclear);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -58,8 +58,7 @@ static void
entry_size_allocate_cb (GtkEntry *entry,
const GtkAllocation *allocation,
int baseline,
GtkAllocation *out_clip,
gpointer user_data)
gpointer user_data)
{
GtkEntryIconPosition popover_pos;
GtkPopover *popover = user_data;

View File

@@ -27,9 +27,12 @@
<property name="column-spacing">10</property>
<property name="margin">20</property>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="label_plain">
<property name="label">Plain</property>
<property name="xalign">0</property>
<accessibility>
<relation type="label-for" target="scale_plain"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -37,12 +40,15 @@
</packing>
</child>
<child>
<object class="GtkScale">
<object class="GtkScale" id="scale_plain">
<property name="can-focus">1</property>
<property name="width-request">200</property>
<property name="draw-value">0</property>
<property name="adjustment">adjustment1</property>
<property name="hexpand">1</property>
<accessibility>
<relation type="labelled-by" target="label_plain"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -50,9 +56,12 @@
</packing>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="label_marks">
<property name="label">Marks</property>
<property name="xalign">0</property>
<accessibility>
<relation type="label-for" target="scale_marks"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -60,7 +69,7 @@
</packing>
</child>
<child>
<object class="GtkScale">
<object class="GtkScale" id="scale_marks">
<property name="can-focus">1</property>
<property name="width-request">200</property>
<property name="draw-value">0</property>
@@ -73,6 +82,9 @@
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
</marks>
<accessibility>
<relation type="labelled-by" target="label_marks"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -80,9 +92,12 @@
</packing>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="label_discrete">
<property name="label">Discrete</property>
<property name="xalign">0</property>
<accessibility>
<relation type="label-for" target="scale_discrete"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -90,13 +105,16 @@
</packing>
</child>
<child>
<object class="GtkScale">
<object class="GtkScale" id="scale_discrete">
<property name="can-focus">1</property>
<property name="width-request">200</property>
<property name="round-digits">0</property>
<property name="draw-value">0</property>
<property name="adjustment">adjustment3</property>
<property name="hexpand">1</property>
<accessibility>
<relation type="labelled-by" target="label_discrete"/>
</accessibility>
<marks>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>

View File

@@ -104,6 +104,7 @@
<child>
<object class="GtkSwitch" id="switch1">
<property name="can-focus">1</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>
</object>

View File

@@ -0,0 +1,96 @@
/* Video Player
*
* This is a simple video player using just GTK widgets.
*/
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static void
open_dialog_response_cb (GtkWidget *dialog,
int response,
GtkWidget *video)
{
gtk_widget_hide (dialog);
if (response == GTK_RESPONSE_ACCEPT)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
gtk_video_set_file (GTK_VIDEO (video), file);
g_object_unref (file);
}
gtk_widget_destroy (dialog);
}
static void
open_clicked_cb (GtkWidget *button,
GtkWidget *video)
{
GtkWidget *dialog;
dialog = gtk_file_chooser_dialog_new ("Select a video",
GTK_WINDOW (gtk_widget_get_toplevel (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Open", GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
gtk_widget_show (dialog);
}
static void
fullscreen_clicked_cb (GtkWidget *button,
gpointer unused)
{
GtkWidget *window = gtk_widget_get_toplevel (button);
gtk_window_fullscreen (GTK_WINDOW (window));
}
GtkWidget *
do_video_player (GtkWidget *do_widget)
{
GtkWidget *title;
GtkWidget *video;
GtkWidget *open_button;
GtkWidget *fullscreen_button;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Video Player");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
video = gtk_video_new ();
gtk_container_add (GTK_CONTAINER (window), video);
title = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (title), TRUE);
gtk_header_bar_set_title (GTK_HEADER_BAR (title), "Video Player");
gtk_window_set_titlebar (GTK_WINDOW (window), title);
open_button = gtk_button_new_with_mnemonic ("_Open");
g_signal_connect (open_button, "clicked", G_CALLBACK (open_clicked_cb), video);
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), open_button);
fullscreen_button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic");
g_signal_connect (fullscreen_button, "clicked", G_CALLBACK (fullscreen_clicked_cb), NULL);
gtk_header_bar_pack_end (GTK_HEADER_BAR (title), fullscreen_button);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -1,8 +1,8 @@
/* Benchmark/Widgetbowl
*
* This demo models the fishbowl demos seen on the web in a GTK way.
* It's also a neat little tool to see how fast your computer (or
* your GTK version) is.
* This is a version of the Fishbowl demo that instead shows different
* kinds of widgets, which is useful for comparing the rendering performance
* of theme specifics.
*/
#include <gtk/gtk.h>
@@ -81,6 +81,18 @@ create_label (void)
return w;
}
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));
gtk_media_stream_set_loop (stream, TRUE);
gtk_media_stream_play (stream);
g_object_unref (stream);
return w;
}
static GtkWidget *
create_gears (void)
{
@@ -102,6 +114,7 @@ static const struct {
{ "Label" , create_label },
{ "Spinner" , create_spinner },
{ "Spinbutton", create_spinbutton },
{ "Video", create_video },
{ "Gears", create_gears },
};

View File

@@ -14,6 +14,7 @@ executable('gtk4-icon-browser',
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)

View File

@@ -133,6 +133,9 @@
<object class="GtkImage" id="image1">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -143,6 +146,9 @@
<object class="GtkImage" id="image2">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -153,6 +159,9 @@
<object class="GtkImage" id="image3">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
</object>
<packing>
<property name="left-attach">2</property>
@@ -163,6 +172,9 @@
<object class="GtkImage" id="image4">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label4"/>
</accessibility>
</object>
<packing>
<property name="left-attach">3</property>
@@ -173,6 +185,9 @@
<object class="GtkImage" id="image5">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label5"/>
</accessibility>
</object>
<packing>
<property name="left-attach">4</property>
@@ -183,6 +198,9 @@
<object class="GtkImage" id="image6">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label6"/>
</accessibility>
</object>
<packing>
<property name="left-attach">5</property>
@@ -197,6 +215,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image1"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -211,6 +232,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image2"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -225,6 +249,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image3"/>
</accessibility>
</object>
<packing>
<property name="left-attach">2</property>
@@ -239,6 +266,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image4"/>
</accessibility>
</object>
<packing>
<property name="left-attach">3</property>
@@ -253,6 +283,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image5"/>
</accessibility>
</object>
<packing>
<property name="left-attach">4</property>
@@ -267,6 +300,9 @@
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image6"/>
</accessibility>
</object>
<packing>
<property name="left-attach">5</property>

View File

@@ -9,6 +9,7 @@ executable('gtk4-widget-factory',
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# desktop file
@@ -24,3 +25,6 @@ foreach icon_size : ['16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ]
install_data('data/@0@/gtk4-widget-factory-symbolic.symbolic.png'.format(icon_size),
install_dir: icons_dir)
endforeach
# appdata
install_data('org.gtk.WidgetFactory.appdata.xml', install_dir: gtk_appdatadir)

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.WidgetFactory.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK+ Widget Factory</name>
<summary>Program to demonstrate GTK+ functions</summary>
<description>
<p>
GTK+ Widget Factory is a showcase of GTK+ widgets. It was
originally created to help theme authors test their creations
for completeness.
</p>
</description>
<screenshots>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-widget-factory/gtk-widget-factory1.png</image>
<caption>Page 1</caption>
</screenshot>
<screenshot>
<image>https://static.gnome.org/appdata/gtk4-widget-factory/gtk-widget-factory2.png</image>
<caption>Page 3</caption>
</screenshot>
</screenshots>
<kudos>
<kudo>AppMenu</kudo>
<kudo>HiDpiIcon</kudo>
<kudo>ModernToolkit</kudo>
</kudos>
<url type="homepage">https://www.gtk.org</url>
<translation type="gettext">gtk-4.0</translation>
<update_contact>matthias.clasen_at_gmail.com</update_contact>
<developer_name>Matthias Clasen and others</developer_name>
</component>

View File

@@ -64,7 +64,7 @@ get_idle (gpointer data)
GtkApplication *app = gtk_window_get_application (GTK_WINDOW (window));
gtk_widget_set_sensitive (window, TRUE);
gdk_window_set_cursor (gtk_widget_get_window (window), NULL);
gdk_surface_set_cursor (gtk_widget_get_surface (window), NULL);
g_application_unmark_busy (G_APPLICATION (app));
return G_SOURCE_REMOVE;
@@ -81,7 +81,7 @@ get_busy (GSimpleAction *action,
g_application_mark_busy (G_APPLICATION (app));
cursor = gdk_cursor_new_from_name ("wait", NULL);
gdk_window_set_cursor (gtk_widget_get_window (window), cursor);
gdk_surface_set_cursor (gtk_widget_get_surface (window), cursor);
g_object_unref (cursor);
g_timeout_add (5000, get_idle, window);
@@ -1655,7 +1655,6 @@ activate (GApplication *app)
gint i;
GPermission *permission;
GAction *action;
GtkGesture *gesture;
g_type_ensure (my_text_view_get_type ());
@@ -1680,6 +1679,7 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
gtk_builder_add_callback_symbol (builder, "scale_format_value", (GCallback)scale_format_value);
gtk_builder_add_callback_symbol (builder, "scale_format_value_blank", (GCallback)scale_format_value_blank);
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
gtk_builder_connect_signals (builder, NULL);
@@ -1897,10 +1897,6 @@ activate (GApplication *app)
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
gesture = gtk_gesture_multi_press_new (widget);
g_signal_connect (gesture, "pressed", G_CALLBACK (osd_frame_pressed), widget);
gtk_widget_show (GTK_WIDGET (window));
g_object_unref (builder);

View File

@@ -878,6 +878,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkFontButton" id="fontbutton1">
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="level">family|style|size|features|variations</property>
</object>
<packing>
<property name="position">6</property>
@@ -3099,6 +3100,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkGestureMultiPress">
<signal name="pressed" handler="osd_frame_pressed" object="osd_frame" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
@@ -3274,6 +3280,9 @@ bad things might happen.</property>
<object class="GtkLabel">
<property name="margin">20</property>
<property name="label" translatable="yes">To free the princess, you have to slay the dragon.</property>
<accessibility>
<role type="static"/>
</accessibility>
</object>
</child>
</object>
@@ -3464,9 +3473,12 @@ bad things might happen.</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="title_label">
<property name="label">Title:</property>
<property name="xalign">1</property>
<accessibility>
<relation type="label-for" target="open_popover_entry"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -3474,10 +3486,13 @@ bad things might happen.</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="description_label">
<property name="valign">start</property>
<property name="label">Description:</property>
<property name="xalign">1</property>
<accessibility>
<relation type="label-for" target="open_popover_textview"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -3493,7 +3508,11 @@ bad things might happen.</property>
<property name="min-content-width">100</property>
<property name="max-content-width">100</property>
<child>
<object class="GtkTextView" id="open_popover_textview"/>
<object class="GtkTextView" id="open_popover_textview">
<accessibility>
<relation type="labelled-by" target="description_label"/>
</accessibility>
</object>
</child>
</object>
<packing>
@@ -3504,6 +3523,9 @@ bad things might happen.</property>
<child>
<object class="GtkEntry" id="open_popover_entry">
<property name="activates-default">1</property>
<accessibility>
<relation type="labelled-by" target="title_label"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -3551,6 +3573,9 @@ bad things might happen.</property>
<child>
<object class="GtkLabel" id="notebook_info_label">
<property name="label">No updates at this time</property>
<accessibility>
<role type="static"/>
</accessibility>
</object>
</child>
</object>

View File

@@ -26,13 +26,13 @@ Refer to the file widget_system.txt which covers widget flags and the
resulting invariants in a detailed way.
GdkWindow pointers may be NULL in GdkEvents
GdkSurface pointers may be NULL in GdkEvents
-------------------------------------------
The notification nature of the signal mechanism might cause events to
be emitted that have their GdkWindow pointer set to NULL.
be emitted that have their GdkSurface pointer set to NULL.
This is due to the fact that certain events need to be emitted after the
real GdkWindow of a widget is not any longer pertinent.
real GdkSurface of a widget is not any longer pertinent.
It's up to the signal handling function (application) to check for the
window field of the event structure to be != NULL, if it is going to
perform any operations through Gdk calls on it.
@@ -43,7 +43,7 @@ GDK_SELECTION_CLEAR GtkWidget::selection_clear_event
GDK_FOCUS_CHANGE GtkWidget::focus_in_event
GtkWidget::focus_out_event
Events that are assured to have a valid GdkEvent.any.window field are
Events that are assured to have a valid GdkEvent.any.surface field are
GDK_EXPOSE GtkWidget::expose_event
@@ -51,10 +51,10 @@ GDK_EXPOSE GtkWidget::expose_event
Writing Gdk functions
---------------------
When writing Gdk functions that operate on GdkWindow structures in any
meaningful sense, that is casting to a GdkWindowPrivate structure for
access to fields other then GdkWindow.user_data, the programmer is
recommended to check for the GdkWindowPrivate.destroyed field to be ==
FALSE, especially if the GdkWindowPrivate.xwindow field is used.
When writing Gdk functions that operate on GdkSurface structures in any
meaningful sense, that is casting to a GdkSurfacePrivate structure for
access to fields other then GdkSurface.user_data, the programmer is
recommended to check for the GdkSurfacePrivate.destroyed field to be ==
FALSE, especially if the GdkSurfacePrivate.xwindow field is used.
Silent abortion of the Gdk function is the correct behaviour if this
condition isn't met.

View File

@@ -81,19 +81,19 @@ GdkAtom gdk_drag_get_selection (GdkDragContext *context);
/* Source side */
GdkDragContext * gdk_drag_begin (GdkWindow *window,
GdkDragContext * gdk_drag_begin (GdkSurface *window,
GList *targets,
GdkDragAction actions);
gboolean gdk_drag_get_protocol (guint32 xid,
GdkDragProtocol *protocol);
void gdk_drag_find_window (GdkDragContext *context,
GdkWindow *drag_window,
GdkSurface *drag_surface,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkSurface **dest_surface,
GdkDragProtocol *protocol);
gboolean gdk_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
GdkSurface *dest_surface,
GdkDragProtocol protocol,
gint x_root,
gint y_root,

View File

@@ -47,12 +47,12 @@ gdk_scroll_direction_get_type
gdk_setting_action_get_type
gdk_status_get_type
gdk_visibility_state_get_type
gdk_window_attributes_type_get_type
gdk_window_edge_get_type
gdk_window_hints_get_type
gdk_window_state_get_type
gdk_window_type_get_type
gdk_window_type_hint_get_type
gdk_surface_attributes_type_get_type
gdk_surface_edge_get_type
gdk_surface_hints_get_type
gdk_surface_state_get_type
gdk_surface_type_get_type
gdk_surface_type_hint_get_type
gdk_wm_decoration_get_type
gdk_wm_function_get_type
GDK_AVAILABLE_IN_4_0
@@ -96,7 +96,7 @@ gdk_display_get_n_monitors
gdk_display_get_monitor
gdk_display_get_primary_monitor
gdk_display_get_monitor_at_point
gdk_display_get_monitor_at_window
gdk_display_get_monitor_at_surface
gdk_display_get_clipboard
gdk_display_get_primary_clipboard
gdk_display_get_setting
@@ -169,186 +169,176 @@ gdk_rgba_get_type
<SECTION>
<TITLE>Windows</TITLE>
<FILE>windows</FILE>
GdkWindow
GdkWindowType
GdkWindowClass
GdkWindowHints
GdkSurface
GdkSurfaceType
GdkSurfaceClass
GdkSurfaceHints
GdkGeometry
GdkGravity
GdkAnchorHints
GdkWindowEdge
GdkWindowTypeHint
GdkWindowState
gdk_window_new_toplevel
gdk_window_new_popup
gdk_window_new_temp
gdk_window_new_child
gdk_window_destroy
gdk_window_get_window_type
gdk_window_get_display
gdk_window_show
gdk_window_show_unraised
gdk_window_hide
gdk_window_is_destroyed
gdk_window_is_visible
gdk_window_is_viewable
gdk_window_is_input_only
gdk_window_is_shaped
gdk_window_get_state
gdk_window_withdraw
gdk_window_iconify
gdk_window_deiconify
gdk_window_stick
gdk_window_unstick
gdk_window_maximize
gdk_window_unmaximize
gdk_window_fullscreen
gdk_window_fullscreen_on_monitor
gdk_window_unfullscreen
GdkSurfaceEdge
GdkSurfaceTypeHint
GdkSurfaceState
gdk_surface_new_toplevel
gdk_surface_new_popup
gdk_surface_new_temp
gdk_surface_new_child
gdk_surface_destroy
gdk_surface_get_surface_type
gdk_surface_get_display
gdk_surface_show
gdk_surface_show_unraised
gdk_surface_hide
gdk_surface_is_destroyed
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
gdk_surface_unstick
gdk_surface_maximize
gdk_surface_unmaximize
gdk_surface_fullscreen
gdk_surface_fullscreen_on_monitor
gdk_surface_unfullscreen
GdkFullscreenMode
gdk_window_get_fullscreen_mode
gdk_window_set_fullscreen_mode
gdk_window_set_keep_above
gdk_window_set_keep_below
gdk_window_set_opacity
gdk_window_set_pass_through
gdk_window_get_pass_through
gdk_window_move
gdk_window_resize
gdk_window_move_resize
gdk_window_scroll
gdk_window_move_region
gdk_window_has_native
gdk_window_raise
gdk_window_lower
gdk_window_restack
gdk_window_focus
gdk_window_register_dnd
gdk_window_begin_resize_drag
gdk_window_begin_resize_drag_for_device
gdk_window_begin_move_drag
gdk_window_begin_move_drag_for_device
gdk_window_show_window_menu
gdk_window_constrain_size
gdk_window_beep
gdk_window_get_scale_factor
gdk_window_set_opaque_region
gdk_window_create_gl_context
gdk_window_create_vulkan_context
gdk_surface_get_fullscreen_mode
gdk_surface_set_fullscreen_mode
gdk_surface_set_keep_above
gdk_surface_set_keep_below
gdk_surface_set_opacity
gdk_surface_set_pass_through
gdk_surface_get_pass_through
gdk_surface_move
gdk_surface_resize
gdk_surface_move_resize
gdk_surface_has_native
gdk_surface_raise
gdk_surface_lower
gdk_surface_restack
gdk_surface_focus
gdk_surface_register_dnd
gdk_surface_begin_resize_drag
gdk_surface_begin_resize_drag_for_device
gdk_surface_begin_move_drag
gdk_surface_begin_move_drag_for_device
gdk_surface_show_window_menu
gdk_surface_constrain_size
gdk_surface_beep
gdk_surface_get_scale_factor
gdk_surface_set_opaque_region
gdk_surface_create_gl_context
gdk_surface_create_vulkan_context
<SUBSECTION>
gdk_window_get_clip_region
gdk_window_begin_draw_frame
gdk_window_end_draw_frame
gdk_window_get_visible_region
gdk_surface_begin_draw_frame
gdk_surface_end_draw_frame
<SUBSECTION>
gdk_window_invalidate_rect
gdk_window_invalidate_region
GdkWindowChildFunc
gdk_window_invalidate_maybe_recurse
gdk_window_get_update_area
gdk_window_freeze_updates
gdk_window_thaw_updates
gdk_window_get_frame_clock
gdk_surface_invalidate_rect
gdk_surface_invalidate_region
gdk_surface_queue_expose
gdk_surface_freeze_updates
gdk_surface_thaw_updates
gdk_surface_get_frame_clock
<SUBSECTION>
gdk_window_set_user_data
gdk_window_set_accept_focus
gdk_window_get_accept_focus
gdk_window_set_focus_on_map
gdk_window_get_focus_on_map
gdk_window_shape_combine_region
gdk_window_set_child_shapes
gdk_window_merge_child_shapes
gdk_window_input_shape_combine_region
gdk_window_set_child_input_shapes
gdk_window_merge_child_input_shapes
gdk_window_set_title
gdk_surface_set_user_data
gdk_surface_set_accept_focus
gdk_surface_get_accept_focus
gdk_surface_set_focus_on_map
gdk_surface_get_focus_on_map
gdk_surface_input_shape_combine_region
gdk_surface_set_child_input_shapes
gdk_surface_merge_child_input_shapes
gdk_surface_set_title
GDK_PARENT_RELATIVE
gdk_window_set_cursor
gdk_window_get_cursor
gdk_window_get_user_data
gdk_window_get_geometry
gdk_window_set_geometry_hints
gdk_window_get_width
gdk_window_get_height
gdk_window_set_icon_list
gdk_window_set_modal_hint
gdk_window_get_modal_hint
gdk_window_set_type_hint
gdk_window_get_type_hint
gdk_window_set_shadow_width
gdk_window_set_skip_taskbar_hint
gdk_window_set_skip_pager_hint
gdk_window_set_urgency_hint
gdk_window_get_position
gdk_window_get_root_origin
gdk_window_get_frame_extents
gdk_window_get_origin
gdk_window_get_root_coords
gdk_window_get_device_position
gdk_window_get_device_position_double
gdk_surface_set_cursor
gdk_surface_get_cursor
gdk_surface_get_user_data
gdk_surface_get_geometry
gdk_surface_set_geometry_hints
gdk_surface_get_width
gdk_surface_get_height
gdk_surface_set_icon_list
gdk_surface_set_modal_hint
gdk_surface_get_modal_hint
gdk_surface_set_type_hint
gdk_surface_get_type_hint
gdk_surface_set_shadow_width
gdk_surface_set_skip_taskbar_hint
gdk_surface_set_skip_pager_hint
gdk_surface_set_urgency_hint
gdk_surface_get_position
gdk_surface_get_root_origin
gdk_surface_get_frame_extents
gdk_surface_get_origin
gdk_surface_get_root_coords
gdk_surface_get_device_position
gdk_surface_get_device_position_double
GdkModifierType
GdkModifierIntent
gdk_window_get_parent
gdk_window_get_toplevel
gdk_window_get_children
gdk_window_get_children_with_user_data
gdk_window_peek_children
gdk_window_get_events
gdk_window_set_events
gdk_window_set_icon_name
gdk_window_set_transient_for
gdk_window_set_role
gdk_window_set_startup_id
gdk_window_set_group
gdk_window_get_group
gdk_window_set_decorations
gdk_window_get_decorations
gdk_surface_get_parent
gdk_surface_get_toplevel
gdk_surface_get_children
gdk_surface_get_children_with_user_data
gdk_surface_peek_children
gdk_surface_get_events
gdk_surface_set_events
gdk_surface_set_icon_name
gdk_surface_set_transient_for
gdk_surface_set_role
gdk_surface_set_startup_id
gdk_surface_set_group
gdk_surface_get_group
gdk_surface_set_decorations
gdk_surface_get_decorations
GdkWMDecoration
gdk_window_set_functions
gdk_surface_set_functions
GdkWMFunction
<SUBSECTION>
gdk_window_get_support_multidevice
gdk_window_set_support_multidevice
gdk_window_get_device_cursor
gdk_window_set_device_cursor
gdk_window_get_device_events
gdk_window_set_device_events
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_window_coords_from_parent
gdk_window_coords_to_parent
gdk_surface_coords_from_parent
gdk_surface_coords_to_parent
<SUBSECTION Standard>
GDK_WINDOW
GDK_WINDOW_GET_CLASS
GDK_TYPE_WINDOW
GDK_IS_WINDOW
GDK_WINDOW_CLASS
GDK_IS_WINDOW_CLASS
GDK_SURFACE
GDK_SURFACE_GET_CLASS
GDK_TYPE_SURFACE
GDK_IS_SURFACE
GDK_SURFACE_CLASS
GDK_IS_SURFACE_CLASS
GDK_TYPE_FILTER_RETURN
GDK_TYPE_GRAVITY
GDK_TYPE_MODIFIER_TYPE
GDK_TYPE_WINDOW_ATTRIBUTES_TYPE
GDK_TYPE_WINDOW_EDGE
GDK_TYPE_WINDOW_HINTS
GDK_TYPE_WINDOW_TYPE
GDK_TYPE_WINDOW_TYPE_HINT
GDK_TYPE_SURFACE_ATTRIBUTES_TYPE
GDK_TYPE_SURFACE_EDGE
GDK_TYPE_SURFACE_HINTS
GDK_TYPE_SURFACE_TYPE
GDK_TYPE_SURFACE_TYPE_HINT
GDK_TYPE_WM_DECORATION
GDK_TYPE_WM_FUNCTION
GDK_TYPE_WINDOW_STATE
GDK_TYPE_SURFACE_STATE
<SUBSECTION Private>
gdk_window_get_type
gdk_window_window_class_get_type
GdkWindowClass
GdkWindowImpl
GdkWindowImplClass
GdkWindowRedirect
gdk_window_impl_get_type
gdk_surface_get_type
gdk_surface_window_class_get_type
GdkSurfaceClass
GdkSurfaceImpl
GdkSurfaceImplClass
GdkSurfaceRedirect
gdk_surface_impl_get_type
gdk_fullscreen_mode_get_type
</SECTION>
@@ -417,8 +407,8 @@ gdk_pango_layout_line_get_clip_region
<SECTION>
<TITLE>Cairo Interaction</TITLE>
<FILE>cairo_interaction</FILE>
gdk_window_create_similar_surface
gdk_window_create_similar_image_surface
gdk_surface_create_similar_surface
gdk_surface_create_similar_image_surface
gdk_cairo_get_clip_rectangle
gdk_cairo_get_drawing_context
gdk_cairo_set_source_rgba
@@ -536,15 +526,15 @@ gdk_device_ungrab
gdk_device_get_state
gdk_device_get_position
gdk_device_get_position_double
gdk_device_get_window_at_position
gdk_device_get_window_at_position_double
gdk_device_get_surface_at_position
gdk_device_get_surface_at_position_double
gdk_device_get_history
gdk_device_free_history
GdkTimeCoord
gdk_device_get_axis
gdk_device_list_axes
gdk_device_get_axis_value
gdk_device_get_last_event_window
gdk_device_get_last_event_surface
<SUBSECTION>
gdk_device_tool_get_serial
@@ -657,7 +647,7 @@ gdk_event_get_scroll_deltas
gdk_event_is_scroll_stop_event
gdk_event_get_state
gdk_event_get_time
gdk_event_get_window
gdk_event_get_surface
gdk_event_get_event_type
GdkEventSequence
gdk_event_get_event_sequence
@@ -714,19 +704,37 @@ GDK_IS_EVENT
gdk_event_get_type
</SECTION>
<SECTION>
<TITLE>Paintable</TITLE>
<FILE>paintable</FILE>
GdkPaintable
gdk_paintable_snapshot
gdk_paintable_get_current_image
gdk_paintable_get_flags
gdk_paintable_get_intrinsic_width
gdk_paintable_get_intrinsic_height
gdk_paintable_get_intrinsic_aspect_ratio
gdk_paintable_compute_concrete_size
gdk_paintable_invalidate_contents
gdk_paintable_invalidate_size
gdk_paintable_new_empty
<SECTION>
<SECTION>
<TITLE>Textures</TITLE>
<FILE>textures</FILE>
GdkTexture
gdk_texture_new_for_data
gdk_texture_new_for_pixbuf
gdk_texture_new_for_gl
gdk_texture_new_from_resource
gdk_texture_new_from_file
gdk_texture_get_width
gdk_texture_get_height
gdk_texture_download
gdk_texture_release_gl
GdkMemoryFormat
GDK_MEMORY_FORMAT_DEFAULT
gdk_memory_texture_new
gdk_gl_texture_new
gdk_gl_texture_release
<SUBSECTION Standard>
GdkTextureClass
@@ -734,6 +742,16 @@ gdk_texture_get_type
GDK_TYPE_TEXTURE
GDK_IS_TEXTURE
GDK_TEXTURE
GdkGLTextureClass
gdk_gl_texture_get_type
GDK_TYPE_GL_TEXTURE
GDK_IS_GL_TEXTURE
GDK_GL_TEXTURE
GdkMemoryTextureClass
gdk_memory_texture_get_type
GDK_TYPE_MEMORY_TEXTURE
GDK_IS_MEMORY_TEXTURE
GDK_MEMORY_TEXTURE
</SECTION>
<SECTION>
@@ -777,9 +795,9 @@ 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_window
gdk_drag_context_get_dest_window
gdk_drag_context_get_drag_window
gdk_drag_context_get_source_surface
gdk_drag_context_get_dest_surface
gdk_drag_context_get_drag_surface
gdk_drag_context_set_hotspot
<SUBSECTION Standard>
@@ -801,7 +819,7 @@ gdk_drag_context_get_type
<INCLUDE>gdk/gdkx.h</INCLUDE>
<TITLE>X Window System Interaction</TITLE>
<FILE>x_interaction</FILE>
GDK_WINDOW_XID
GDK_SURFACE_XID
GDK_DISPLAY_XDISPLAY
GDK_POINTER_TO_XID
GDK_XID_TO_POINTER
@@ -826,7 +844,7 @@ gdk_x11_display_error_trap_push
gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_display_set_window_scale
gdk_x11_display_set_surface_scale
gdk_x11_display_get_glx_version
gdk_x11_register_standard_event_type
gdk_x11_screen_get_screen_number
@@ -837,16 +855,16 @@ 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_window_foreign_new_for_display
gdk_x11_window_lookup_for_display
gdk_x11_window_get_xid
gdk_x11_window_set_theme_variant
gdk_x11_window_set_user_time
gdk_x11_window_move_to_current_desktop
gdk_x11_window_move_to_desktop
gdk_x11_window_get_desktop
gdk_x11_window_set_utf8_property
gdk_x11_window_set_frame_sync_enabled
gdk_x11_surface_foreign_new_for_display
gdk_x11_surface_lookup_for_display
gdk_x11_surface_get_xid
gdk_x11_surface_set_theme_variant
gdk_x11_surface_set_user_time
gdk_x11_surface_move_to_current_desktop
gdk_x11_surface_move_to_desktop
gdk_x11_surface_get_desktop
gdk_x11_surface_set_utf8_property
gdk_x11_surface_set_frame_sync_enabled
gdk_x11_keymap_get_group_for_state
gdk_x11_keymap_key_is_modifier
gdk_x11_visual_get_xvisual
@@ -939,12 +957,12 @@ GDK_X11_VISUAL_CLASS
GDK_IS_X11_VISUAL
GDK_IS_X11_VISUAL_CLASS
GDK_X11_VISUAL_GET_CLASS
GDK_TYPE_X11_WINDOW
GDK_X11_WINDOW
GDK_X11_WINDOW_CLASS
GDK_IS_X11_WINDOW
GDK_IS_X11_WINDOW_CLASS
GDK_X11_WINDOW_GET_CLASS
GDK_TYPE_X11_SURFACE
GDK_X11_SURFACE
GDK_X11_SURFACE_CLASS
GDK_IS_X11_SURFACE
GDK_IS_X11_SURFACE_CLASS
GDK_X11_SURFACE_GET_CLASS
<SUBSECTION Private>
gdk_x11_app_launch_context_get_type
@@ -961,8 +979,8 @@ gdk_x11_drag_context_get_type
gdk_x11_keymap_get_type
gdk_x11_screen_get_type
gdk_x11_visual_get_type
gdk_x11_window_get_type
gdk_window_impl_x11_get_type
gdk_x11_surface_get_type
gdk_surface_impl_x11_get_type
</SECTION>
<SECTION>
@@ -976,13 +994,13 @@ gdk_wayland_device_get_wl_seat
gdk_wayland_display_get_wl_compositor
gdk_wayland_display_get_wl_display
gdk_wayland_display_query_registry
gdk_wayland_window_new_subsurface
gdk_wayland_window_get_wl_surface
gdk_wayland_window_set_use_custom_surface
GdkWaylandWindowExported
gdk_wayland_window_export_handle
gdk_wayland_window_unexport_handle
gdk_wayland_window_set_transient_for_exported
gdk_wayland_surface_new_subsurface
gdk_wayland_surface_get_wl_surface
gdk_wayland_surface_set_use_custom_surface
GdkWaylandSurfaceExported
gdk_wayland_surface_export_handle
gdk_wayland_surface_unexport_handle
gdk_wayland_surface_set_transient_for_exported
<SUBSECTION Standard>
GDK_TYPE_WAYLAND_DEVICE
@@ -1003,18 +1021,18 @@ GDK_WAYLAND_DISPLAY_MANAGER_CLASS
GDK_WAYLAND_DISPLAY_MANAGER_GET_CLASS
GDK_IS_WAYLAND_DISPLAY_MANAGER
GDK_IS_WAYLAND_DISPLAY_MANAGER_CLASS
GDK_TYPE_WAYLAND_WINDOW
GDK_WAYLAND_WINDOW
GDK_WAYLAND_WINDOW_CLASS
GDK_WAYLAND_WINDOW_GET_CLASS
GDK_IS_WAYLAND_WINDOW
GDK_IS_WAYLAND_WINDOW_CLASS
GDK_TYPE_WAYLAND_SURFACE
GDK_WAYLAND_SURFACE
GDK_WAYLAND_SURFACE_CLASS
GDK_WAYLAND_SURFACE_GET_CLASS
GDK_IS_WAYLAND_SURFACE
GDK_IS_WAYLAND_SURFACE_CLASS
<SUBSECTION Private>
gdk_wayland_device_get_type
gdk_wayland_display_get_type
gdk_wayland_display_manager_get_type
gdk_wayland_window_get_type
gdk_wayland_surface_get_type
</SECTION>
@@ -1089,7 +1107,7 @@ gdk_frame_timings_get_type
<FILE>gdkdrawcontext</FILE>
GdkDrawContext
gdk_draw_context_get_display
gdk_draw_context_get_window
gdk_draw_context_get_surface
<SUBSECTION Standard>
GDK_DRAW_CONTEXT
@@ -1105,7 +1123,7 @@ gdk_draw_context_get_type
<FILE>gdkglcontext</FILE>
GdkGLContext
gdk_gl_context_get_display
gdk_gl_context_get_window
gdk_gl_context_get_surface
gdk_gl_context_get_shared_context
gdk_gl_context_get_version
@@ -1170,7 +1188,7 @@ GDK_IS_MONITOR
<SECTION>
<FILE>gdkdrawingcontext</FILE>
GdkDrawingContext
gdk_drawing_context_get_window
gdk_drawing_context_get_surface
gdk_drawing_context_get_clip
gdk_drawing_context_get_cairo_context
gdk_drawing_context_is_valid

View File

@@ -11,7 +11,7 @@ gdk_gl_context_get_type
gdk_keymap_get_type
gdk_monitor_get_type
gdk_seat_get_type
gdk_window_get_type
gdk_surface_get_type
gdk_content_serializer_get_type
gdk_content_deserializer_get_type
gdk_clipboard_get_type

View File

@@ -1,12 +1,10 @@
<SECTION>
<FILE>GskRenderer</FILE>
gsk_renderer_new_for_window
gsk_renderer_get_window
gsk_renderer_new_for_surface
gsk_renderer_get_surface
gsk_renderer_get_display
gsk_renderer_realize
gsk_renderer_unrealize
gsk_renderer_begin_draw_frame
gsk_renderer_end_draw_frame
gsk_renderer_render
gsk_renderer_render_texture
<SUBSECTION Standard>

View File

@@ -293,17 +293,6 @@ How to compile GTK+ itself
<cmdsynopsis>
<command>meson</command>
<sbr/>
<group>
<arg choice="plain">-Ddisable-modules=true</arg>
<arg choice="plain">-Ddisable-modules=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dwith-included-immodules=MODULE1,MODULE2,...</arg>
<arg choice="plain">-Dwith-included-immodules=all</arg>
<arg choice="plain">-Dwith-included-immodules=none</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Ddocumentation=true</arg>
<arg choice="plain">-Ddocumentation=false</arg>
@@ -315,75 +304,59 @@ How to compile GTK+ itself
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-cups-print-backend=yes</arg>
<arg choice="plain">-Denable-cups-print-backend=no</arg>
<arg choice="plain">-Denable-cups-print-backend=auto</arg>
<arg choice="plain">-Dprint-backends=all</arg>
<arg choice="plain">-Dprint-backends=none</arg>
<arg choice="plain">-Dprint-backends=cups,lpr,...</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-papi-print-backend=yes</arg>
<arg choice="plain">-Denable-papi-print-backend=no</arg>
<arg choice="plain">-Denable-papi-print-backend=auto</arg>
<arg choice="plain">-Dcolord=yes</arg>
<arg choice="plain">-Dcolord=no</arg>
<arg choice="plain">-Dcolord=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-cloudprint-print-backend=yes</arg>
<arg choice="plain">-Denable-cloudprint-print-backend=no</arg>
<arg choice="plain">-Denable-cloudprint-print-backend=auto</arg>
<arg choice="plain">-Dvulkan=yes</arg>
<arg choice="plain">-Dvulkan=no</arg>
<arg choice="plain">-Dvulkan=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-test-print-backend=yes</arg>
<arg choice="plain">-Denable-test-print-backend=no</arg>
<arg choice="plain">-Denable-test-print-backend=auto</arg>
<arg choice="plain">-Dx11-backend=true</arg>
<arg choice="plain">-Dx11-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-colord=yes</arg>
<arg choice="plain">-Denable-colord=no</arg>
<arg choice="plain">-Denable-colord=auto</arg>
<arg choice="plain">-Dcloudproviders=true</arg>
<arg choice="plain">-Dcloudproviders=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-vulkan=yes</arg>
<arg choice="plain">-Denable-vulkan=no</arg>
<arg choice="plain">-Denable-vulkan=auto</arg>
<arg choice="plain">-Dxinerama=yes</arg>
<arg choice="plain">-Dxinerama=no</arg>
<arg choice="plain">-Dxinerama=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-x11-backend=true</arg>
<arg choice="plain">-Denable-x11-backend=false</arg>
<arg choice="plain">-Dwin32-backend=true</arg>
<arg choice="plain">-Dwin32-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-xinerama=true</arg>
<arg choice="plain">-Denable-xinerama=false</arg>
<arg choice="plain">-Dquartz-backend=true</arg>
<arg choice="plain">-Dquartz-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-win32-backend=true</arg>
<arg choice="plain">-Denable-win32-backend=false</arg>
<arg choice="plain">-Dbroadway-backend=true</arg>
<arg choice="plain">-Dbroadway-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-quartz-backend=true</arg>
<arg choice="plain">-Denable-quartz-backend=false</arg>
<arg choice="plain">-Dwayland-backend=true</arg>
<arg choice="plain">-Dwayland-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-broadway-backend=true</arg>
<arg choice="plain">-Denable-broadway-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-wayland-backend=true</arg>
<arg choice="plain">-Denable-wayland-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Denable-mir-backend=true</arg>
<arg choice="plain">-Denable-mir-backend=false</arg>
</group>
<group>
<arg choice="plain">-Dintrospection=true</arg>
<arg choice="plain">-Dintrospection=false</arg>
@@ -392,33 +365,7 @@ How to compile GTK+ itself
</para>
<formalpara>
<title><systemitem>disable-modules</systemitem></title>
<para>
Normally GTK+ will try to build the input method modules
as little shared libraries that are loaded on demand.
The <systemitem>disable-modules</systemitem> option
indicates that they should all be built statically
into the GTK+ library instead. This is useful for
people who need to produce statically-linked binaries.
If <systemitem>disable-modules</systemitem> is not specified,
then the <command>configure</command> script will try to
auto-detect whether shared modules work on your system.
</para>
</formalpara>
<formalpara>
<title><systemitem>with-included-immodules</systemitem></title>
<para>
This option allows you to specify which input method modules you
want to include directly into the GTK+ shared library, as opposed
to building them as loadable modules.
</para>
</formalpara>
<formalpara>
<title><systemitem>enable-xinerama</systemitem></title>
<title><systemitem>xinerama</systemitem></title>
<para>
By default GTK+ will try to link against the Xinerama libraries
@@ -428,8 +375,8 @@ How to compile GTK+ itself
</formalpara>
<formalpara>
<title><systemitem>enable-documentation</systemitem> and
<systemitem>enable-man-pages</systemitem></title>
<title><systemitem>documentation</systemitem> and
<systemitem>man-pages</systemitem></title>
<para>
The <application>gtk-doc</application> package is
@@ -440,38 +387,33 @@ How to compile GTK+ itself
<application>gtk-doc</application> installed and
are modifying GTK+, you may want to enable
<application>gtk-doc</application> support by passing
in <systemitem>enable-documentation</systemitem>.
in <systemitem>documentation</systemitem>.
</para>
<para>
Additionally, some tools provided by GTK+ have their own
manual pages generated using a similar set of dependencies;
if you have <application>xsltproc</application> then you
can generate manual pages by passing <systemitem>enable-man-pages</systemitem>
can generate manual pages by passing <systemitem>man-pages</systemitem>
when configuring the build.
</para>
</formalpara>
<formalpara>
<title><systemitem>enable-cups-print-backend</systemitem>,
<systemitem>enable-papi-print-backend</systemitem>,
<systemitem>enable-cloudprint-print-backend</systemitem>, and
<systemitem>enable-test-print-backend</systemitem></title>
<title><systemitem>print-backends</systemitem></title>
<para>
By default, GTK+ will try to build various print backends if
their dependencies are found. These options can be used to
explicitly control whether each print backend should be built
or not.
their dependencies are found. This option can be used to
explicitly control which print backends should be built.
</para>
</formalpara>
<formalpara>
<title><systemitem>enable-x11-backend</systemitem>,
<systemitem>enable-win32-backend</systemitem>,
<systemitem>enable-quartz-backend</systemitem>,
<systemitem>enable-broadway-backend</systemitem>,
<systemitem>enable-wayland-backend</systemitem>, and
<systemitem>enable-mir-backend</systemitem></title>
<title><systemitem>x11-backend</systemitem>,
<systemitem>win32-backend</systemitem>,
<systemitem>quartz-backend</systemitem>,
<systemitem>broadway-backend</systemitem> and
<systemitem>wayland-backend</systemitem></title>
<para>
Enable specific backends for GDK. If none of these options
@@ -496,8 +438,9 @@ How to compile GTK+ itself
</formalpara>
<formalpara>
<title><systemitem>build-tests</systemitem>
<systemitem>demos</systemitem></title>
<title><systemitem>build-tests</systemitem>,
<systemitem>install-tests</systemitem>,
<systemitem>demos</systemitem></title>
<para>
By default, GTK+ will build quite a few tests and demos.

View File

@@ -90,7 +90,7 @@
<link linkend="GdkEvent"><structname>GdkEvent</structname></link>
structures and sends them on to the GTK layer. In turn, the GTK layer
finds the widget that corresponds to a particular
<classname>GdkWindow</classname> and emits the corresponding event
<classname>GdkSurface</classname> and emits the corresponding event
signals on that widget.
</para>
@@ -207,17 +207,17 @@
<para>
Normally, there is only a single cairo context which is used in
the entire repaint, rather than one per GdkWindow. This means you
the entire repaint, rather than one per GdkSurface. This means you
have to respect (and not reset) existing clip and transformations
set on it.
</para>
<para>
Most widgets, including those that create their own GdkWindows have
Most widgets, including those that create their own GdkSurfaces have
a transparent background, so they draw on top of whatever widgets
are below them. This was not the case in GTK+ 2 where the theme set
the background of most widgets to the default background color. (In
fact, transparent GdkWindows used to be impossible.)
fact, transparent GdkSurfaces used to be impossible.)
</para>
<para>
@@ -263,10 +263,10 @@
<para>
Two basic functions in GDK form the core of the double-buffering
mechanism: <link
linkend="gdk_window_begin_paint_region"><function>gdk_window_begin_paint_region()</function></link>
linkend="gdk_surface_begin_paint_region"><function>gdk_surface_begin_paint_region()</function></link>
and <link
linkend="gdk_window_end_paint"><function>gdk_window_end_paint()</function></link>.
The first function tells a <classname>GdkWindow</classname> to
linkend="gdk_surface_end_paint"><function>gdk_surface_end_paint()</function></link>.
The first function tells a <classname>GdkSurface</classname> to
create a temporary off-screen buffer for drawing. All
subsequent drawing operations to this window get automatically
redirected to that buffer. The second function actually paints
@@ -278,16 +278,16 @@
<para>
It would be inconvenient for all widgets to call
<function>gdk_window_begin_paint_region()</function> and
<function>gdk_window_end_paint()</function> at the beginning
<function>gdk_surface_begin_paint_region()</function> and
<function>gdk_surface_end_paint()</function> at the beginning
and end of their draw handlers.
</para>
<para>
To make this easier, GTK+ normally calls
<function>gdk_window_begin_paint_region()</function>
<function>gdk_surface_begin_paint_region()</function>
before emitting the #GtkWidget::draw signal, and
then it calls <function>gdk_window_end_paint()</function>
then it calls <function>gdk_surface_end_paint()</function>
after the signal has been emitted. This is convenient for
most widgets, as they do not need to worry about creating
their own temporary drawing buffers or about calling those
@@ -335,8 +335,8 @@ my_widget_init (MyWidget *widget)
<para>
Even if you turn off double buffering on a widget, you
can still call
<function>gdk_window_begin_paint_region()</function> and
<function>gdk_window_end_paint()</function> by hand to use
<function>gdk_surface_begin_paint_region()</function> and
<function>gdk_surface_end_paint()</function> by hand to use
temporary drawing buffers.
</para>
</refsect2>

View File

@@ -137,7 +137,7 @@
<para>
This is the step in a <glossterm
linkend="widget">widget's</glossterm> life cycle where it
actually shows the GdkWindows it created when it was
actually shows the GdkSurfaces it created when it was
<glossterm linkend="realization">realized</glossterm>. When a
widget is mapped, it must turn on its
%GTK_MAPPED <link linkend="GtkWidgetFlags">flag</link>.
@@ -146,7 +146,7 @@
<para>
Note that due to the asynchronous nature of the X window
system, a widget's window may not appear on the screen
immediatly after one calls gdk_window_show():
immediatly after one calls gdk_surface_show():
you must wait for the corresponding map <glossterm
linkend="event">event</glossterm> to be received. You can do
this with the <link
@@ -193,10 +193,10 @@
<glossterm>no-window widget</glossterm>
<glossdef>
<para>
A widget that does not have a GdkWindow of its own on which to
A widget that does not have a GdkSurface of its own on which to
draw its contents, but rather shares its <glossterm
linkend="parent">parent's</glossterm>. This can be tested with
the gtk_widget_get_has_window() function.
the gtk_widget_get_has_surface() function.
</para>
</glossdef>
</glossentry>
@@ -218,20 +218,20 @@
<para>
This is the step in a <glossterm
linkend="widget">widget's</glossterm> life cycle where it
creates its own GdkWindow, or otherwise associates itself with
creates its own GdkSurface, or otherwise associates itself with
its <glossterm linkend="parent">parent's</glossterm>
GdkWindow. If the widget has its own window, then it must
GdkSurface. If the widget has its own window, then it must
also attach a <glossterm linkend="style">style</glossterm> to
it. A widget becomes unrealized by destroying its associated
GdkWindow. When a widget is realized, it must turn on its
GdkSurface. When a widget is realized, it must turn on its
%GTK_REALIZED <link linkend="GtkWidgetFlags">flag</link>.
</para>
<para>
Widgets that don't own the GdkWindow on which they draw are
Widgets that don't own the GdkSurface on which they draw are
called <glossterm linkend="no-window">no-window widgets</glossterm>.
This can be tested with the gtk_widget_get_has_window() function. Normally,
these widgets draw on their parent's GdkWindow.
This can be tested with the gtk_widget_get_has_surface() function. Normally,
these widgets draw on their parent's GdkSurface.
</para>
<para>

View File

@@ -351,7 +351,6 @@
<xi:include href="gtk4-demo-application.xml" />
<xi:include href="gtk4-widget-factory.xml" />
<xi:include href="gtk4-icon-browser.xml" />
<xi:include href="gtk4-query-immodules.xml" />
<xi:include href="gtk4-update-icon-cache.xml" />
<xi:include href="gtk4-encode-symbolic-svg.xml" />
<xi:include href="gtk4-builder-tool.xml" />

View File

@@ -1,96 +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="gtk4-query-immodules">
<refentryinfo>
<title>gtk4-query-immodules</title>
<productname>GTK+</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-query-immodules</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-query-immodules</refname>
<refpurpose>Input method module registration utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-query-immodules</command>
<arg choice="opt">--update-cache</arg>
<arg choice="opt" rep="repeat">MODULE</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-query-immodules</command> collects information about loadable
input method modules for GTK+ and writes it to the default cache file
location, or to <filename>stdout</filename>.
</para>
<para>
If called without arguments, it looks for modules in the GTK+ input method
module path.
</para>
<para>
If called with arguments, it looks for the specified modules. The arguments
may be absolute or relative paths.
</para>
<para>
Normally, the output of <command>gtk4-query-immodules</command> is written
to <filename><replaceable>libdir</replaceable>/gtk-4.0/4.0.0/immodules.cache</filename>,
where GTK+ looks for it by default. If it is written to some other location,
the <envar>GTK_IM_MODULE_FILE</envar> environment variable can be set to point
GTK+ at the file.
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>--update-cache</term>
<listitem><para>Write the output to the default cache location instead of
<filename>stdout</filename></para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Files</title>
<variablelist>
<varlistentry>
<term><filename><replaceable>libdir</replaceable>/gtk-4.0/4.0.0/immodules.cache</filename></term>
<listitem><para>The default im cache file used by GTK+ applications</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Environment</title>
<variablelist>
<varlistentry>
<term><link linkend="gtk-path"><envar>GTK_PATH</envar></link></term>
<listitem><para>Prepends directories to the input method module path</para></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gtk-im-module-file"><envar>GTK_IM_MODULE_FILE</envar></link></term>
<listitem><para>Specifies an alternative im module cache for GTK+
applications</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -902,8 +902,6 @@ gtk_entry_set_attributes
gtk_entry_get_attributes
gtk_entry_set_completion
gtk_entry_get_completion
gtk_entry_set_cursor_hadjustment
gtk_entry_get_cursor_hadjustment
gtk_entry_set_progress_fraction
gtk_entry_get_progress_fraction
gtk_entry_set_progress_pulse_step
@@ -914,11 +912,11 @@ gtk_entry_reset_im_context
gtk_entry_set_tabs
gtk_entry_get_tabs
GtkEntryIconPosition
gtk_entry_set_icon_from_texture
gtk_entry_set_icon_from_paintable
gtk_entry_set_icon_from_icon_name
gtk_entry_set_icon_from_gicon
gtk_entry_get_icon_storage_type
gtk_entry_get_icon_texture
gtk_entry_get_icon_paintable
gtk_entry_get_icon_name
gtk_entry_get_icon_gicon
gtk_entry_set_icon_activatable
@@ -1046,8 +1044,6 @@ gtk_expander_set_use_markup
gtk_expander_get_use_markup
gtk_expander_set_label_widget
gtk_expander_get_label_widget
gtk_expander_set_label_fill
gtk_expander_get_label_fill
gtk_expander_set_resize_toplevel
gtk_expander_get_resize_toplevel
<SUBSECTION Standard>
@@ -1487,7 +1483,6 @@ GtkIconViewPrivate
<TITLE>GtkImage</TITLE>
GtkImage
GtkImageType
gtk_image_get_surface
gtk_image_get_texture
gtk_image_get_icon_name
gtk_image_get_gicon
@@ -1497,14 +1492,12 @@ gtk_image_new_from_pixbuf
gtk_image_new_from_icon_name
gtk_image_new_from_gicon
gtk_image_new_from_resource
gtk_image_new_from_surface
gtk_image_new_from_texture
gtk_image_set_from_file
gtk_image_set_from_pixbuf
gtk_image_set_from_icon_name
gtk_image_set_from_gicon
gtk_image_set_from_resource
gtk_image_set_from_surface
gtk_image_set_from_texture
gtk_image_clear
gtk_image_new
@@ -1512,6 +1505,10 @@ gtk_image_set_pixel_size
gtk_image_get_pixel_size
gtk_image_set_icon_size
gtk_image_get_icon_size
gtk_image_set_keep_aspect_ratio
gtk_image_get_keep_aspect_ratio
gtk_image_set_can_shrink
gtk_image_get_can_shrink
<SUBSECTION Standard>
GTK_IMAGE
GTK_IS_IMAGE
@@ -1533,7 +1530,6 @@ GtkImageGIconData
<TITLE>GtkIMContext</TITLE>
GtkIMContext
GtkIMContextClass
GtkIMContextInfo
gtk_im_context_get_preedit_string
gtk_im_context_filter_keypress
gtk_im_context_focus_in
@@ -2911,7 +2907,7 @@ gtk_text_view_get_line_at_y
gtk_text_view_get_line_yrange
gtk_text_view_get_iter_at_location
gtk_text_view_get_iter_at_position
gtk_text_view_buffer_to_window_coords
gtk_text_view_buffer_to_surface_coords
gtk_text_view_window_to_buffer_coords
gtk_text_view_set_border_window_size
gtk_text_view_get_border_window_size
@@ -4171,6 +4167,15 @@ gtk_volume_button_get_type
<FILE>gtksnapshot</FILE>
<TITLE>GtkSnapshot</TITLE>
GtkSnapshot
gtk_snapshot_new
gtk_snapshot_ref
gtk_snapshot_unref
gtk_snapshot_to_node
gtk_snapshot_to_paintable
gtk_snapshot_free_to_node
gtk_snapshot_free_to_paintable
gtk_snapshot_get_renderer
gtk_snapshot_get_record_names
gtk_snapshot_push
gtk_snapshot_push_transform
gtk_snapshot_push_opacity
@@ -4187,6 +4192,7 @@ gtk_snapshot_append_node
gtk_snapshot_append_cairo
gtk_snapshot_append_texture
gtk_snapshot_append_color
gtk_snapshot_append_layout
gtk_snapshot_clips_rect
gtk_snapshot_render_background
gtk_snapshot_render_frame
@@ -4195,6 +4201,24 @@ gtk_snapshot_render_layout
gtk_snapshot_render_insertion_cursor
</SECTION>
<SECTION>
<FILE>gtkwidgetpaintable</FILE>
<TITLE>GtkWidgetPaintable</TITLE>
gtk_widget_paintable_new
gtk_widget_paintable_get_widget
gtk_widget_paintable_set_widget
<SUBSECTION Standard>
GTK_WIDGET_PAINTABLE
GTK_IS_WIDGET_PAINTABLE
GTK_TYPE_WIDGET_PAINTABLE
GTK_WIDGET_PAINTABLE_CLASS
GTK_IS_WIDGET_PAINTABLE_CLASS
GTK_WIDGET_PAINTABLE_GET_CLASS
<SUBSECTION Private>
gtk_widget_paintable_get_type
</SECTION>
<SECTION>
<FILE>gtkwidget</FILE>
<TITLE>GtkWidget</TITLE>
@@ -4214,7 +4238,6 @@ gtk_widget_map
gtk_widget_unmap
gtk_widget_realize
gtk_widget_unrealize
gtk_widget_draw
gtk_widget_queue_draw
gtk_widget_queue_resize
gtk_widget_queue_resize_no_redraw
@@ -4240,18 +4263,19 @@ gtk_widget_set_name
gtk_widget_get_name
gtk_widget_set_sensitive
gtk_widget_set_parent
gtk_widget_set_parent_window
gtk_widget_get_parent_window
gtk_widget_set_parent_surface
gtk_widget_get_parent_surface
gtk_widget_get_toplevel
gtk_widget_get_ancestor
gtk_widget_is_ancestor
gtk_widget_translate_coordinates
gtk_widget_add_controller
gtk_widget_remove_controller
gtk_widget_set_direction
GtkTextDirection
gtk_widget_get_direction
gtk_widget_set_default_direction
gtk_widget_get_default_direction
gtk_widget_shape_combine_region
gtk_widget_input_shape_combine_region
gtk_widget_create_pango_context
gtk_widget_get_pango_context
@@ -4260,8 +4284,6 @@ gtk_widget_get_font_options
gtk_widget_set_font_map
gtk_widget_get_font_map
gtk_widget_create_pango_layout
gtk_widget_queue_draw_area
gtk_widget_queue_draw_region
gtk_widget_get_cursor
gtk_widget_set_cursor
gtk_widget_set_cursor_from_name
@@ -4297,9 +4319,9 @@ gtk_widget_set_tooltip_window
gtk_widget_get_has_tooltip
gtk_widget_set_has_tooltip
gtk_widget_trigger_tooltip_query
gtk_widget_get_window
gtk_widget_register_window
gtk_widget_unregister_window
gtk_widget_get_surface
gtk_widget_register_surface
gtk_widget_unregister_surface
gtk_widget_get_allocated_width
gtk_widget_get_allocated_height
gtk_widget_get_allocation
@@ -4307,7 +4329,7 @@ gtk_widget_get_allocated_baseline
gtk_widget_get_allocated_size
gtk_widget_get_width
gtk_widget_get_height
gtk_widget_get_clip
gtk_widget_compute_bounds
gtk_widget_contains
gtk_widget_pick
gtk_widget_get_can_default
@@ -4316,8 +4338,8 @@ gtk_widget_get_can_focus
gtk_widget_set_can_focus
gtk_widget_get_focus_on_click
gtk_widget_set_focus_on_click
gtk_widget_get_has_window
gtk_widget_set_has_window
gtk_widget_get_has_surface
gtk_widget_set_has_surface
gtk_widget_get_sensitive
gtk_widget_is_sensitive
gtk_widget_get_visible
@@ -4332,7 +4354,7 @@ gtk_widget_has_visible_focus
gtk_widget_has_grab
gtk_widget_is_drawable
gtk_widget_is_toplevel
gtk_widget_set_window
gtk_widget_set_surface
gtk_widget_set_receives_default
gtk_widget_get_receives_default
gtk_widget_set_support_multidevice
@@ -4600,9 +4622,6 @@ gtk_main_iteration
gtk_main_iteration_do
gtk_main_do_event
GtkModuleInitFunc
GtkModuleDisplayInitFunc
<SUBSECTION>
gtk_grab_add
gtk_grab_get_current
@@ -4940,8 +4959,6 @@ gtk_selection_data_set_text
gtk_selection_data_get_text
gtk_selection_data_set_pixbuf
gtk_selection_data_get_pixbuf
gtk_selection_data_set_surface
gtk_selection_data_get_surface
gtk_selection_data_set_texture
gtk_selection_data_get_texture
gtk_selection_data_set_uris
@@ -4993,16 +5010,15 @@ gtk_drag_unhighlight
gtk_drag_begin_with_coordinates
gtk_drag_cancel
gtk_drag_set_icon_widget
gtk_drag_set_icon_surface
gtk_drag_set_icon_texture
gtk_drag_set_icon_paintable
gtk_drag_set_icon_name
gtk_drag_set_icon_gicon
gtk_drag_set_icon_default
gtk_drag_check_threshold
gtk_drag_source_set
gtk_drag_source_set_icon_surface
gtk_drag_source_set_icon_name
gtk_drag_source_set_icon_gicon
gtk_drag_source_set_icon_paintable
gtk_drag_source_unset
gtk_drag_source_set_target_list
gtk_drag_source_get_target_list
@@ -5082,7 +5098,6 @@ gtk_icon_theme_lookup_by_gicon
gtk_icon_theme_lookup_by_gicon_for_scale
gtk_icon_theme_load_icon
gtk_icon_theme_load_icon_for_scale
gtk_icon_theme_load_surface
gtk_icon_theme_list_contexts
gtk_icon_theme_list_icons
gtk_icon_theme_get_icon_sizes
@@ -5093,7 +5108,6 @@ gtk_icon_info_get_base_size
gtk_icon_info_get_base_scale
gtk_icon_info_get_filename
gtk_icon_info_load_icon
gtk_icon_info_load_surface
gtk_icon_info_load_texture
gtk_icon_info_load_icon_async
gtk_icon_info_load_icon_finish
@@ -5975,6 +5989,8 @@ gtk_overlay_add_overlay
gtk_overlay_reorder_overlay
gtk_overlay_get_overlay_pass_through
gtk_overlay_set_overlay_pass_through
gtk_overlay_get_measure_overlay
gtk_overlay_set_measure_overlay
<SUBSECTION Standard>
GTK_TYPE_OVERLAY

View File

@@ -146,6 +146,7 @@ gtk_shortcuts_section_get_type
gtk_shortcuts_group_get_type
gtk_shortcuts_shortcut_get_type
gtk_size_group_get_type
gtk_snapshot_get_type
gtk_spin_button_get_type
gtk_spinner_get_type
gtk_stack_get_type

View File

@@ -91,7 +91,7 @@
<title>Event propagation</title>
<para>
For widgets which have a #GdkWindow set, events are received from the
For widgets which have a #GdkSurface set, events are received from the
windowing system and passed to gtk_main_do_event(). See its documentation
for details of what it does: compression of enter/leave events,
identification of the widget receiving the event, pushing the event onto a
@@ -101,11 +101,11 @@
<para>
When a GDK backend produces an input event, it is tied to a #GdkDevice and
a #GdkWindow, which in turn represents a windowing system surface in the
a #GdkSurface, which in turn represents a windowing system surface in the
backend. If a widget has grabbed the current input device, or all input
devices, the event is propagated to that #GtkWidget. Otherwise, it is
propagated to the the #GtkWidget which called gtk_widget_register_window()
on the #GdkWindow receiving the event.
propagated to the the #GtkWidget which called gtk_widget_register_surface()
on the #GdkSurface receiving the event.
</para>
<para>
@@ -113,7 +113,7 @@
specific input device (gtk_device_grab_add()), is sent events in
preference to a global grab (gtk_grab_add()). Input grabs only have effect
within the #GtkWindowGroup containing the #GtkWidget which registered the
events #GdkWindow. If this #GtkWidget is a child of the grab widget, the
events #GdkSurface. If this #GtkWidget is a child of the grab widget, the
event is propagated to the child — this is the basis for propagating
events within modal dialogs.
</para>
@@ -186,15 +186,15 @@
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 #GdkWindow, and all child #GdkWindows.
for the widgets #GdkSurface, and all child #GdkSurfaces.
</para>
<para>
Filtering events against event masks happens inside #GdkWindow, which
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
#GdkWindows mask for the input device, if set. Otherwise, it is filtered
against the #GdkWindows basic event mask.
#GdkSurfaces mask for the input device, if set. Otherwise, it is filtered
against the #GdkSurfaces basic event mask.
</para>
<para>

View File

@@ -158,7 +158,6 @@ content_files = [
'gtk4-encode-symbolic-svg.xml',
'gtk4-icon-browser.xml',
'gtk4-launch.xml',
'gtk4-query-immodules.xml',
'gtk4-query-settings.xml',
'gtk4-update-icon-cache.xml',
'gtk4-widget-factory.xml',
@@ -261,7 +260,6 @@ if get_option('man-pages') and xsltproc.found()
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-icon-browser', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-immodules', '1', ],
[ 'gtk4-query-settings', '1', ],
[ 'gtk4-update-icon-cache', '1', ],
[ 'gtk4-widget-factory', '1', ],

View File

@@ -79,13 +79,13 @@
<title>Review your window creation flags</title>
<para>
GTK+ 4 removes the GDK_WA_CURSOR flag. Instead, just use
gdk_window_set_cursor() to set a cursor on the window after
gdk_surface_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_window_set_visual (gdk_screen_get_rgba_visual ()) after
use gdk_surface_set_visual (gdk_screen_get_rgba_visual ()) after
creating your window.
</para>
<para>
@@ -150,7 +150,7 @@
</section>
<section>
<title>Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_window()</title>
<title>Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_surface()</title>
<para>
These functions are not supported in GTK+ 4. Instead, either use backend-specific
APIs, or render your widgets using gtk_widget_render().
@@ -194,7 +194,7 @@
<title>Stop using the root window</title>
<para>
The root window is an X11-centric concept that is no longer exposed in the
backend-neutral GDK API. gdk_window_get_parent() will return %NULL for toplevel
backend-neutral GDK API. gdk_surface_get_parent() will return %NULL for toplevel
windows. If you need to interact with the X11 root window, you can use
gdk_x11_display_get_xrootwindow() to get its XID.
</para>
@@ -217,12 +217,12 @@
</section>
<section>
<title>Adapt to GdkWindow API changes</title>
<title>Adapt to GdkSurface API changes</title>
<para>
The gdk_window_new() function has been replaced by a number of more
specialized constructors: gdk_window_new_toplevel(), gdk_window_new_popup(),
gdk_window_new_temp(), gdk_window_new_child(), gdk_window_new_input(),
gdk_wayland_window_new_subsurface(). Use the appropriate ones to create
The gdk_surface_new() function has been replaced by a number of more
specialized constructors: gdk_surface_new_toplevel(), gdk_surface_new_popup(),
gdk_surface_new_temp(), gdk_surface_new_child(), gdk_surface_new_input(),
gdk_wayland_surface_new_subsurface(). Use the appropriate ones to create
your windows.
</para>
<para>
@@ -230,7 +230,7 @@
complicating the code and could not be supported across backends.
</para>
<para>
gdk_window_reparent() is no longer available.
gdk_surface_reparent() is no longer available.
</para>
</section>
@@ -244,7 +244,7 @@
</section>
<section>
<title>Stop using gdk_window_set_event_compression</title>
<title>Stop using gdk_surface_set_event_compression</title>
<para>
Event compression is now always enabled. If you need to see the uncoalesced
motion history, use gdk_event_get_motion_history().
@@ -367,7 +367,7 @@
</section>
<section>
<title>Stop using APIs to query GdkWindows</title>
<title>Stop using APIs to query GdkSurfaces</title>
<para>
A number of APIs for querying special-purpose windows have been removed,
since these windows are no longer publically available:

View File

@@ -391,14 +391,14 @@ This comes up when using bitfields; in C you can write the following
code:
<informalexample>
<programlisting>
gdk_window_set_events (gdk_window,
gdk_surface_set_events (gdk_surface,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
</programlisting>
</informalexample>
while in C++ you must write:
<informalexample>
<programlisting>
gdk_window_set_events (gdk_window,
gdk_surface_set_events (gdk_surface,
(GdkEventMask) GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
</programlisting>
</informalexample>

View File

@@ -122,36 +122,13 @@ additional environment variables.
</para>
</formalpara>
<formalpara>
<title><envar>GTK3_MODULES</envar></title>
<para>
A list of modules to load. Note that GTK+ also allows to specify modules to load via a commandline option (<option>--gtk-module</option>) and with the <literal>gtk-modules</literal> setting.
</para>
</formalpara>
<formalpara>
<title><envar>GTK_MODULES</envar></title>
<para>
A list of modules to load in addition to the ones in the <envar>GTK3_MODULES</envar> variable.
</para>
<warning>
Note that this environment variable is read by GTK+ 2.x too,
which may not have the same set of modules available for loading.
Use <envar>GTK3_MODULES</envar> for modules that are only compatible
with GTK+ 3.
</warning>
</formalpara>
<formalpara id="gtk-path">
<title><envar>GTK_PATH</envar></title>
<para>
Specifies a list of directories to search when GTK+ is looking for
dynamically loaded objects such as the modules specified by
<envar>GTK_MODULES</envar>, theme engines, input method
modules, file system backends and print backends. If the path to
dynamically loaded objects such as input method
modules and print backends. If the path to
the dynamically loaded object is given as an absolute path name,
then GTK+ loads it directly.
Otherwise, GTK+ goes in turn through the directories in <envar>GTK_PATH</envar>,
@@ -206,27 +183,6 @@ additional environment variables.
</para>
</formalpara>
<formalpara id="gtk-im-module-file">
<title><envar>GTK_IM_MODULE_FILE</envar></title>
<para>
Specifies the file listing the IM modules to load. This environment
variable the default value
<filename><replaceable>libdir</replaceable>/gtk-4.0/4.0.0/immodules.cache</filename>
(<replaceable>libdir</replaceable> has the same meaning here as explained for <envar>GTK_PATH</envar>).
</para>
<para>
The <filename>immodules.cache</filename> file is generated by the
<command>gtk-query-immodules-3.0</command> utility.
</para>
<warning>
Note that this environment variable is read by GTK+ 2.x too, which
makes it unsuitable for setting it system-wide (or session-wide),
since doing so will cause either GTK+ 2.x applications or GTK+ 3
applications to see the wrong list of IM modules.
</warning>
</formalpara>
<formalpara>
<title><envar>GTK_EXE_PREFIX</envar></title>

View File

@@ -211,20 +211,20 @@ static GList *toplevels;
static guint shot_id;
static gboolean
window_is_csd (GdkWindow *window)
window_is_csd (GdkSurface *window)
{
gboolean set;
GdkWMDecoration decorations = 0;
/* FIXME: is this accurate? */
set = gdk_window_get_decorations (window, &decorations);
set = gdk_surface_get_decorations (window, &decorations);
return (set && (decorations == 0));
}
static gboolean
shoot_one (WidgetInfo *info)
{
GdkWindow *window;
GdkSurface *window;
XID id;
GdkPixbuf *screenshot = NULL;
DecorationType decor = DECOR_FRAME;
@@ -235,8 +235,8 @@ shoot_one (WidgetInfo *info)
gtk_main_quit ();
}
window = gtk_widget_get_window (info->window);
id = gdk_x11_window_get_xid (window);
window = gtk_widget_get_surface (info->window);
id = gdk_x11_surface_get_xid (window);
if (window_is_csd (window))
decor = (info->include_decorations) ? DECOR_NONE : DECOR_WINDOW_FRAME;
screenshot = take_window_shot (id, decor);

View File

@@ -62,23 +62,23 @@ GtkWidget, public flags:
GTK_TOPLEVEL:
Widgets without a real parent, as there are GtkWindows and
GtkMenus have this flag set throughout their lifetime.
Toplevel widgets always contain their own GdkWindow.
Toplevel widgets always contain their own GdkSurface.
GTK_NO_WINDOW:
This flag is indicative for a widget that does not provide
its own GdkWindow. Visible action (e.g. drawing) is performed
on the parent's GdkWindow.
its own GdkSurface. Visible action (e.g. drawing) is performed
on the parent's GdkSurface.
GTK_REALIZED:
Set by gtk_widget_realize, unset by gtk_widget_unrealize.
Relies on ((widget->parent && widget->parent->window)
|| GTK_WIDGET_TOPLEVEL (widget));
Means: widget has an associated GdkWindow (XWindow).
Means: widget has an associated GdkSurface (XWindow).
GTK_MAPPED:
Set by gtk_widget_map, unset by gtk_widget_unmap.
May only be set if GTK_WIDGET_REALIZED (widget).
Means: gdk_window_show() has been called on the widgets window(s).
Means: gdk_surface_show() has been called on the widgets window(s).
GTK_VISIBLE:
Set by gtk_widget_show.
@@ -329,7 +329,7 @@ Adding to a container
When a widget is added to a container, the container:
1) calls gtk_widget_set_parent_window (widget, window) if
1) calls gtk_widget_set_parent_surface (widget, window) if
the widget is being added to something other than container->window
2) calls gtk_widget_set_parent (widget, container)
@@ -364,7 +364,7 @@ When a widget receives the "realize" signal it should:
1) set the realized flag
2) set widget->window
widget->window = gtk_widget_get_parent_window (widget);
widget->window = gtk_widget_get_parent_surface (widget);
g_object_ref (widget->window);
3) attach the widget's style
@@ -374,7 +374,7 @@ When a widget receives the "realize" signal it should:
1) set the REALIZED flag
2) create windows with the parent obtained from
gtk_widget_get_parent_window (widget);
gtk_widget_get_parent_surface (widget);
3) attach the widget's style
4) set the background color for the new window based on the style
@@ -382,7 +382,7 @@ The Map signal
--------------
1) Set the MAPPED flag
2) If the widget has any windows, gdk_window_show those windows
2) If the widget has any windows, gdk_surface_show those windows
3) call gtk_widget_map for all child widgets that are
VISIBLE, CHILD_VISIBLE and !MAPPED. (A widget will only
be !CHILD_VISIBLE if the container set it that way, so
@@ -395,7 +395,7 @@ The Unmap signal
When a widget receives the unmap signal, it must:
1) If the widget has a window, gdk_window_hide that window,
1) If the widget has a window, gdk_surface_hide that window,
2) If the widget does not have a window, unmap all child widgets
3) Do any other functions related to taking the widget offscreen
(for instance, removing popup windows...)
@@ -409,8 +409,8 @@ When a widget receives the unrealize signal, it must
1) For any windows other than widget->window do:
gdk_window_set_user_data (window, NULL);
gdk_window_destroy (window);
gdk_surface_set_user_data (window, NULL);
gdk_surface_destroy (window);
2) Call the parent's unrealize handler

View File

@@ -21,7 +21,6 @@ static void
size_allocate_cb (GtkWidget *widget,
GtkAllocation *alloc,
int baseline,
GdkRectangle *clip,
gpointer data)
{
if (surface)
@@ -30,9 +29,9 @@ size_allocate_cb (GtkWidget *widget,
surface = NULL;
}
if (gtk_widget_get_window (widget))
if (gtk_widget_get_surface (widget))
{
surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
surface = gdk_surface_create_similar_surface (gtk_widget_get_surface (widget),
CAIRO_CONTENT_COLOR,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
@@ -73,8 +72,8 @@ draw_brush (GtkWidget *widget,
cairo_destroy (cr);
/* Now invalidate the affected region of the drawing area. */
gtk_widget_queue_draw_area (widget, x - 3, y - 3, 6, 6);
/* Now invalidate the drawing area. */
gtk_widget_queue_draw (widget);
}
static double start_x;
@@ -158,17 +157,16 @@ activate (GtkApplication *app,
g_signal_connect_after (drawing_area, "size-allocate",
G_CALLBACK (size_allocate_cb), NULL);
drag = gtk_gesture_drag_new (drawing_area);
drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
g_object_set_data_full (G_OBJECT (drawing_area), "drag", drag, g_object_unref);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (drag));
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), drawing_area);
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), drawing_area);
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), drawing_area);
press = gtk_gesture_multi_press_new (drawing_area);
press = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (press), GDK_BUTTON_SECONDARY);
g_object_set_data_full (G_OBJECT (drawing_area), "press", press, g_object_unref);
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (press));
g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area);

View File

@@ -30,7 +30,7 @@
#define __GDKBROADWAY_H_INSIDE__
#include <gdk/broadway/gdkbroadwaydisplay.h>
#include <gdk/broadway/gdkbroadwaywindow.h>
#include <gdk/broadway/gdkbroadwaysurface.h>
#include <gdk/broadway/gdkbroadwaycursor.h>
#include <gdk/broadway/gdkbroadwaymonitor.h>

View File

@@ -22,33 +22,33 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_BROADWAY_WINDOW_H__
#define __GDK_BROADWAY_WINDOW_H__
#ifndef __GDK_BROADWAY_SURFACE_H__
#define __GDK_BROADWAY_SURFACE_H__
#include <gdk/gdk.h>
G_BEGIN_DECLS
#define GDK_TYPE_BROADWAY_WINDOW (gdk_broadway_window_get_type ())
#define GDK_BROADWAY_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_WINDOW, GdkBroadwayWindow))
#define GDK_BROADWAY_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_WINDOW, GdkBroadwayWindowClass))
#define GDK_IS_BROADWAY_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_WINDOW))
#define GDK_IS_BROADWAY_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_WINDOW))
#define GDK_BROADWAY_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_WINDOW, GdkBroadwayWindowClass))
#define GDK_TYPE_BROADWAY_SURFACE (gdk_broadway_surface_get_type ())
#define GDK_BROADWAY_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_SURFACE, GdkBroadwaySurface))
#define GDK_BROADWAY_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_SURFACE, GdkBroadwaySurfaceClass))
#define GDK_IS_BROADWAY_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_SURFACE))
#define GDK_IS_BROADWAY_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_SURFACE))
#define GDK_BROADWAY_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_SURFACE, GdkBroadwaySurfaceClass))
#ifdef GDK_COMPILATION
typedef struct _GdkBroadwayWindow GdkBroadwayWindow;
typedef struct _GdkBroadwaySurface GdkBroadwaySurface;
#else
typedef GdkWindow GdkBroadwayWindow;
typedef GdkSurface GdkBroadwaySurface;
#endif
typedef struct _GdkBroadwayWindowClass GdkBroadwayWindowClass;
typedef struct _GdkBroadwaySurfaceClass GdkBroadwaySurfaceClass;
GDK_AVAILABLE_IN_ALL
GType gdk_broadway_window_get_type (void);
GType gdk_broadway_surface_get_type (void);
GDK_AVAILABLE_IN_ALL
guint32 gdk_broadway_get_last_seen_time (GdkWindow *window);
guint32 gdk_broadway_get_last_seen_time (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_BROADWAY_WINDOW_H__ */
#endif /* __GDK_BROADWAY_SURFACE_H__ */

View File

@@ -20,50 +20,50 @@
#include "gdkdevice-broadway.h"
#include "gdkwindow.h"
#include "gdksurface.h"
#include "gdkprivate-broadway.h"
static gboolean gdk_broadway_device_get_history (GdkDevice *device,
GdkWindow *window,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events);
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events);
static void gdk_broadway_device_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask);
static void gdk_broadway_device_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor);
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask);
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
static void gdk_broadway_device_warp (GdkDevice *device,
gdouble x,
gdouble y);
gdouble x,
gdouble y);
static void gdk_broadway_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
static GdkGrabStatus gdk_broadway_device_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time_);
GdkSurface *surface,
gboolean owner_events,
GdkEventMask event_mask,
GdkSurface *confine_to,
GdkCursor *cursor,
guint32 time_);
static void gdk_broadway_device_ungrab (GdkDevice *device,
guint32 time_);
static GdkWindow * gdk_broadway_device_window_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
static void gdk_broadway_device_select_window_events (GdkDevice *device,
GdkWindow *window,
GdkEventMask event_mask);
guint32 time_);
static GdkSurface * gdk_broadway_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
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)
@@ -75,13 +75,13 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
device_class->get_history = gdk_broadway_device_get_history;
device_class->get_state = gdk_broadway_device_get_state;
device_class->set_window_cursor = gdk_broadway_device_set_window_cursor;
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
device_class->warp = gdk_broadway_device_warp;
device_class->query_state = gdk_broadway_device_query_state;
device_class->grab = gdk_broadway_device_grab;
device_class->ungrab = gdk_broadway_device_ungrab;
device_class->window_at_position = gdk_broadway_device_window_at_position;
device_class->select_window_events = gdk_broadway_device_select_window_events;
device_class->surface_at_position = gdk_broadway_device_surface_at_position;
device_class->select_surface_events = gdk_broadway_device_select_surface_events;
}
static void
@@ -97,24 +97,24 @@ gdk_broadway_device_init (GdkBroadwayDevice *device_core)
static gboolean
gdk_broadway_device_get_history (GdkDevice *device,
GdkWindow *window,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events)
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events)
{
return FALSE;
}
static void
gdk_broadway_device_get_state (GdkDevice *device,
GdkWindow *window,
gdouble *axes,
GdkModifierType *mask)
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask)
{
gdouble x, y;
gdk_window_get_device_position_double (window, device, &x, &y, mask);
gdk_surface_get_device_position_double (surface, device, &x, &y, mask);
if (axes)
{
@@ -124,28 +124,28 @@ gdk_broadway_device_get_state (GdkDevice *device,
}
static void
gdk_broadway_device_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
gdk_broadway_device_set_surface_cursor (GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor)
{
}
static void
gdk_broadway_device_warp (GdkDevice *device,
gdouble x,
gdouble y)
gdouble x,
gdouble y)
{
}
static void
gdk_broadway_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **child_window,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask)
{
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
@@ -160,10 +160,10 @@ gdk_broadway_device_query_state (GdkDevice *device,
broadway_display = GDK_BROADWAY_DISPLAY (display);
_gdk_broadway_server_query_mouse (broadway_display->server,
&mouse_toplevel_id,
&device_root_x,
&device_root_y,
&mask32);
&mouse_toplevel_id,
&device_root_x,
&device_root_y,
&mask32);
if (root_x)
*root_x = device_root_x;
@@ -175,25 +175,25 @@ gdk_broadway_device_query_state (GdkDevice *device,
*win_y = device_root_y;
if (mask)
*mask = mask32;
if (child_window)
if (child_surface)
{
GdkWindow *mouse_toplevel;
GdkSurface *mouse_toplevel;
mouse_toplevel = g_hash_table_lookup (broadway_display->id_ht, GUINT_TO_POINTER (mouse_toplevel_id));
if (window == NULL)
*child_window = mouse_toplevel;
if (surface == NULL)
*child_surface = mouse_toplevel;
else
*child_window = NULL;
*child_surface = NULL;
}
return;
}
void
_gdk_broadway_window_grab_check_unmap (GdkWindow *window,
gulong serial)
_gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
gulong serial)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkSeat *seat;
GList *devices, *d;
@@ -203,18 +203,18 @@ _gdk_broadway_window_grab_check_unmap (GdkWindow *window,
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
/* End all grabs on the newly hidden window */
/* End all grabs on the newly hidden surface */
for (d = devices; d; d = d->next)
_gdk_display_end_device_grab (display, d->data, serial, window, TRUE);
_gdk_display_end_device_grab (display, d->data, serial, surface, TRUE);
g_list_free (devices);
}
void
_gdk_broadway_window_grab_check_destroy (GdkWindow *window)
_gdk_broadway_surface_grab_check_destroy (GdkSurface *surface)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkSeat *seat;
GdkDeviceGrabInfo *grab;
GList *devices, *d;
@@ -227,14 +227,14 @@ _gdk_broadway_window_grab_check_destroy (GdkWindow *window)
for (d = devices; d; d = d->next)
{
/* Make sure there is no lasting grab in this native window */
/* Make sure there is no lasting grab in this native surface */
grab = _gdk_display_get_last_device_grab (display, d->data);
if (grab && grab->native_window == window)
{
grab->serial_end = grab->serial_start;
grab->implicit_ungrab = TRUE;
}
if (grab && grab->native_surface == surface)
{
grab->serial_end = grab->serial_start;
grab->implicit_ungrab = TRUE;
}
}
@@ -244,12 +244,12 @@ _gdk_broadway_window_grab_check_destroy (GdkWindow *window)
static GdkGrabStatus
gdk_broadway_device_grab (GdkDevice *device,
GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time_)
GdkSurface *surface,
gboolean owner_events,
GdkEventMask event_mask,
GdkSurface *confine_to,
GdkCursor *cursor,
guint32 time_)
{
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
@@ -266,10 +266,10 @@ gdk_broadway_device_grab (GdkDevice *device,
{
/* Device is a pointer */
return _gdk_broadway_server_grab_pointer (broadway_display->server,
GDK_WINDOW_IMPL_BROADWAY (window->impl)->id,
owner_events,
event_mask,
time_);
GDK_SURFACE_IMPL_BROADWAY (surface->impl)->id,
owner_events,
event_mask,
time_);
}
}
@@ -280,7 +280,7 @@ gdk_broadway_device_grab (GdkDevice *device,
static void
gdk_broadway_device_ungrab (GdkDevice *device,
guint32 time_)
guint32 time_)
{
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
@@ -300,34 +300,34 @@ gdk_broadway_device_ungrab (GdkDevice *device,
serial = _gdk_broadway_server_ungrab_pointer (broadway_display->server, time_);
if (serial != 0)
{
grab = _gdk_display_get_last_device_grab (display, device);
if (grab &&
(time_ == GDK_CURRENT_TIME ||
grab->time == GDK_CURRENT_TIME ||
!TIME_IS_LATER (grab->time, time_)))
grab->serial_end = serial;
}
{
grab = _gdk_display_get_last_device_grab (display, device);
if (grab &&
(time_ == GDK_CURRENT_TIME ||
grab->time == GDK_CURRENT_TIME ||
!TIME_IS_LATER (grab->time, time_)))
grab->serial_end = serial;
}
}
}
static GdkWindow *
gdk_broadway_device_window_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
static GdkSurface *
gdk_broadway_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkWindow *window;
GdkSurface *surface;
gdk_broadway_device_query_state (device, NULL, &window, NULL, NULL, win_x, win_y, mask);
gdk_broadway_device_query_state (device, NULL, &surface, NULL, NULL, win_x, win_y, mask);
return window;
return surface;
}
static void
gdk_broadway_device_select_window_events (GdkDevice *device,
GdkWindow *window,
GdkEventMask event_mask)
gdk_broadway_device_select_surface_events (GdkDevice *device,
GdkSurface *surface,
GdkEventMask event_mask)
{
}

View File

@@ -181,10 +181,10 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
toplevels = broadway_display->toplevels;
for (l = toplevels; l != NULL; l = l->next)
{
GdkWindowImplBroadway *toplevel_impl = l->data;
GdkSurfaceImplBroadway *toplevel_impl = l->data;
if (toplevel_impl->maximized)
gdk_window_move_resize (toplevel_impl->wrapper, 0, 0, msg->width, msg->height);
gdk_surface_move_resize (toplevel_impl->wrapper, 0, 0, msg->width, msg->height);
}
}
@@ -263,7 +263,7 @@ _gdk_broadway_display_open (const gchar *display_name)
broadway_display->server = _gdk_broadway_server_new (display_name, &error);
if (broadway_display->server == NULL)
{
g_printerr ("Unable to init server: %s\n", error->message);
g_printerr ("Unable to init Broadway server: %s\n", error->message);
g_error_free (error);
return NULL;
}
@@ -313,7 +313,7 @@ gdk_broadway_display_has_pending (GdkDisplay *display)
return FALSE;
}
static GdkWindow *
static GdkSurface *
gdk_broadway_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
@@ -520,7 +520,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
object_class->dispose = gdk_broadway_display_dispose;
object_class->finalize = gdk_broadway_display_finalize;
display_class->window_type = GDK_TYPE_BROADWAY_WINDOW;
display_class->surface_type = GDK_TYPE_BROADWAY_SURFACE;
display_class->get_name = gdk_broadway_display_get_name;
display_class->beep = gdk_broadway_display_beep;
@@ -534,7 +534,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
display_class->create_window_impl = _gdk_broadway_display_create_window_impl;
display_class->create_surface_impl = _gdk_broadway_display_create_surface_impl;
display_class->get_keymap = _gdk_broadway_display_get_keymap;
display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list;
display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target;

View File

@@ -26,7 +26,7 @@
#include "gdkdisplayprivate.h"
#include "gdkkeys.h"
#include "gdkwindow.h"
#include "gdksurface.h"
#include "gdkinternals.h"
#include "gdkbroadway-server.h"
#include "gdkmonitorprivate.h"

View File

@@ -84,36 +84,36 @@ gdk_broadway_drag_context_finalize (GObject *object)
/* Drag Contexts */
GdkDragContext *
_gdk_broadway_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy)
{
GdkDragContext *new_context;
g_return_val_if_fail (window != NULL, NULL);
g_return_val_if_fail (GDK_WINDOW_IS_BROADWAY (window), NULL);
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,
"display", gdk_window_get_display (window),
"display", gdk_surface_get_display (surface),
"content", content,
NULL);
NULL);
return new_context;
}
static void
gdk_broadway_drag_context_drag_drop (GdkDragContext *context,
guint32 time)
guint32 time)
{
g_return_if_fail (context != NULL);
}
static void
gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
guint32 time)
guint32 time)
{
g_return_if_fail (context != NULL);
}
@@ -122,30 +122,30 @@ gdk_broadway_drag_context_drag_abort (GdkDragContext *context,
static void
gdk_broadway_drag_context_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time)
GdkDragAction action,
guint32 time)
{
g_return_if_fail (context != NULL);
}
static void
gdk_broadway_drag_context_drop_reply (GdkDragContext *context,
gboolean ok,
guint32 time)
gboolean ok,
guint32 time)
{
g_return_if_fail (context != NULL);
}
static void
gdk_broadway_drag_context_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time)
gboolean success,
guint32 time)
{
g_return_if_fail (context != NULL);
}
void
_gdk_broadway_window_register_dnd (GdkWindow *window)
_gdk_broadway_surface_register_dnd (GdkSurface *surface)
{
}

View File

@@ -88,7 +88,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
GdkDisplay *display;
GdkBroadwayDisplay *display_broadway;
GdkSeat *seat;
GdkWindow *window;
GdkSurface *surface;
GdkEvent *event = NULL;
GList *node;
GSList *list, *d;
@@ -113,11 +113,11 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_new (GDK_ENTER_NOTIFY);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->crossing.time = message->base.time;
event->crossing.x = message->pointer.win_x;
event->crossing.y = message->pointer.win_y;
@@ -133,11 +133,11 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
}
break;
case BROADWAY_EVENT_LEAVE:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_new (GDK_LEAVE_NOTIFY);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->crossing.time = message->base.time;
event->crossing.x = message->pointer.win_x;
event->crossing.y = message->pointer.win_y;
@@ -156,11 +156,11 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
if (_gdk_broadway_moveresize_handle_event (display, message))
break;
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_new (GDK_MOTION_NOTIFY);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->motion.time = message->base.time;
event->motion.x = message->pointer.win_x;
event->motion.y = message->pointer.win_y;
@@ -180,11 +180,11 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
_gdk_broadway_moveresize_handle_event (display, message))
break;
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_new (message->base.type == 'b' ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->button.time = message->base.time;
event->button.x = message->pointer.win_x;
event->button.y = message->pointer.win_y;
@@ -200,11 +200,11 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_SCROLL:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_new (GDK_SCROLL);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->scroll.time = message->base.time;
event->scroll.x = message->pointer.win_x;
event->scroll.y = message->pointer.win_y;
@@ -219,8 +219,8 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_TOUCH:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->touch.event_surface_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->touch.event_surface_id));
if (surface)
{
GdkEventType event_type = 0;
@@ -243,7 +243,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
event = gdk_event_new (event_type);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->touch.sequence = GUINT_TO_POINTER(message->touch.sequence_id);
event->touch.emulating_pointer = message->touch.is_emulated;
event->touch.time = message->base.time;
@@ -274,12 +274,12 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
window = g_hash_table_lookup (display_broadway->id_ht,
surface = g_hash_table_lookup (display_broadway->id_ht,
GINT_TO_POINTER (message->key.surface_id));
if (window)
if (surface)
{
event = gdk_event_new (message->base.type == 'k' ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->key.time = message->base.time;
event->key.keyval = message->key.key;
event->key.state = message->key.state;
@@ -299,14 +299,14 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface)
{
window->x = message->configure_notify.x;
window->y = message->configure_notify.y;
surface->x = message->configure_notify.x;
surface->y = message->configure_notify.y;
event = gdk_event_new (GDK_CONFIGURE);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->configure.x = message->configure_notify.x;
event->configure.y = message->configure_notify.y;
event->configure.width = message->configure_notify.width;
@@ -315,20 +315,20 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
if (window->resize_count >= 1)
if (surface->resize_count >= 1)
{
window->resize_count -= 1;
surface->resize_count -= 1;
if (window->resize_count == 0)
_gdk_broadway_moveresize_configure_done (display, window);
if (surface->resize_count == 0)
_gdk_broadway_moveresize_configure_done (display, surface);
}
}
break;
case BROADWAY_EVENT_ROUNDTRIP_NOTIFY:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->roundtrip_notify.id));
if (window)
_gdk_broadway_roundtrip_notify (window, message->roundtrip_notify.tag, message->roundtrip_notify.local);
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->roundtrip_notify.id));
if (surface)
_gdk_broadway_roundtrip_notify (surface, message->roundtrip_notify.tag, message->roundtrip_notify.local);
break;
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
@@ -336,21 +336,21 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_FOCUS:
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (surface)
{
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->focus_change.in = FALSE;
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (window)
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (surface)
{
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->focus_change.in = TRUE;
gdk_event_set_device (event, gdk_seat_get_pointer (seat));
node = _gdk_event_queue_append (display, event);

View File

@@ -31,53 +31,51 @@
#include <gdk/gdkcursor.h>
#include <gdk/gdkinternals.h>
#include "gdkwindow-broadway.h"
#include "gdksurface-broadway.h"
#include "gdkdisplay-broadway.h"
#include "gdkbroadwaycursor.h"
#include "gdkbroadwaywindow.h"
void _gdk_broadway_resync_windows (void);
#include "gdkbroadwaysurface.h"
guint32 gdk_broadway_display_ensure_texture (GdkDisplay *display,
GdkTexture *texture);
GdkTexture *texture);
void gdk_broadway_window_set_nodes (GdkWindow *window,
GArray *nodes,
GPtrArray *node_textures);
void gdk_broadway_surface_set_nodes (GdkSurface *surface,
GArray *nodes,
GPtrArray *node_textures);
void _gdk_broadway_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_broadway_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
void _gdk_broadway_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy);
gboolean _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
BroadwayInputMsg *msg);
gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
GdkWindow *window);
void _gdk_broadway_roundtrip_notify (GdkWindow *window,
guint32 tag,
gboolean local_reply);
void _gdk_broadway_window_grab_check_destroy (GdkWindow *window);
void _gdk_broadway_window_grab_check_unmap (GdkWindow *window,
gulong serial);
void _gdk_broadway_surface_register_dnd (GdkSurface *surface);
GdkDragContext * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
gint dx,
gint dy);
void _gdk_broadway_surface_translate (GdkSurface *surface,
cairo_region_t *area,
gint dx,
gint dy);
gboolean _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
BroadwayInputMsg *msg);
gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
GdkSurface *surface);
void _gdk_broadway_roundtrip_notify (GdkSurface *surface,
guint32 tag,
gboolean local_reply);
void _gdk_broadway_surface_grab_check_destroy (GdkSurface *surface);
void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
gulong serial);
void _gdk_keymap_keys_changed (GdkDisplay *display);
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
GdkModifierType state);
GdkModifierType state);
void _gdk_keymap_add_virtual_modifiers_compat (GdkKeymap *keymap,
GdkModifierType *modifiers);
gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap,
guint keycode);
guint keycode);
void _gdk_broadway_display_size_changed (GdkDisplay *display,
BroadwayInputScreenResizeNotify *msg);
BroadwayInputScreenResizeNotify *msg);
void _gdk_broadway_events_got_input (BroadwayInputMsg *message);
@@ -86,7 +84,7 @@ void _gdk_broadway_display_init_dnd (GdkDisplay *display);
GdkDisplay * _gdk_broadway_display_open (const gchar *display_name);
void _gdk_broadway_display_queue_events (GdkDisplay *display);
GdkCursor*_gdk_broadway_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
const gchar *name);
GdkCursor *_gdk_broadway_display_get_cursor_for_texture (GdkDisplay *display,
GdkTexture *texture,
int x,
@@ -94,37 +92,37 @@ GdkCursor *_gdk_broadway_display_get_cursor_for_texture (GdkDisplay *display,
gboolean _gdk_broadway_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_broadway_display_supports_cursor_color (GdkDisplay *display);
void _gdk_broadway_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
guint *width,
guint *height);
void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
void _gdk_broadway_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
guint *width,
guint *height);
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,
gint format,
const guchar *text,
gint length,
gchar ***list);
GdkAtom encoding,
gint format,
const guchar *text,
gint length,
gchar ***list);
gchar *_gdk_broadway_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str);
const gchar *str);
GdkKeymap* _gdk_broadway_display_get_keymap (GdkDisplay *display);
void _gdk_broadway_display_consume_all_input (GdkDisplay *display);
BroadwayInputMsg * _gdk_broadway_display_block_for_input (GdkDisplay *display,
char op,
guint32 serial,
gboolean remove);
char op,
guint32 serial,
gboolean remove);
/* Window methods - testing */
void _gdk_broadway_window_resize_surface (GdkWindow *window);
/* Surface methods - testing */
void _gdk_broadway_surface_resize_surface (GdkSurface *surface);
void _gdk_broadway_cursor_update_theme (GdkCursor *cursor);
void _gdk_broadway_cursor_display_finalize (GdkDisplay *display);
#define GDK_WINDOW_IS_BROADWAY(win) (GDK_IS_WINDOW_IMPL_BROADWAY (((GdkWindow *)win)->impl))
#define GDK_SURFACE_IS_BROADWAY(win) (GDK_IS_SURFACE_IMPL_BROADWAY (((GdkSurface *)win)->impl))
#endif /* __GDK_PRIVATE_BROADWAY_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -22,31 +22,31 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WINDOW_BROADWAY_H__
#define __GDK_WINDOW_BROADWAY_H__
#ifndef __GDK_SURFACE_BROADWAY_H__
#define __GDK_SURFACE_BROADWAY_H__
#include <gdk/gdkwindowimpl.h>
#include <gdk/gdksurfaceimpl.h>
G_BEGIN_DECLS
typedef struct _GdkWindowImplBroadway GdkWindowImplBroadway;
typedef struct _GdkWindowImplBroadwayClass GdkWindowImplBroadwayClass;
typedef struct _GdkSurfaceImplBroadway GdkSurfaceImplBroadway;
typedef struct _GdkSurfaceImplBroadwayClass GdkSurfaceImplBroadwayClass;
/* Window implementation for Broadway
/* Surface implementation for Broadway
*/
#define GDK_TYPE_WINDOW_IMPL_BROADWAY (gdk_window_impl_broadway_get_type ())
#define GDK_WINDOW_IMPL_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_BROADWAY, GdkWindowImplBroadway))
#define GDK_WINDOW_IMPL_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL_BROADWAY, GdkWindowImplBroadwayClass))
#define GDK_IS_WINDOW_IMPL_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_BROADWAY))
#define GDK_IS_WINDOW_IMPL_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_BROADWAY))
#define GDK_WINDOW_IMPL_BROADWAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_BROADWAY, GdkWindowImplBroadwayClass))
#define GDK_TYPE_SURFACE_IMPL_BROADWAY (gdk_surface_impl_broadway_get_type ())
#define GDK_SURFACE_IMPL_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SURFACE_IMPL_BROADWAY, GdkSurfaceImplBroadway))
#define GDK_SURFACE_IMPL_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SURFACE_IMPL_BROADWAY, GdkSurfaceImplBroadwayClass))
#define GDK_IS_SURFACE_IMPL_BROADWAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SURFACE_IMPL_BROADWAY))
#define GDK_IS_SURFACE_IMPL_BROADWAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SURFACE_IMPL_BROADWAY))
#define GDK_SURFACE_IMPL_BROADWAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SURFACE_IMPL_BROADWAY, GdkSurfaceImplBroadwayClass))
struct _GdkWindowImplBroadway
struct _GdkSurfaceImplBroadway
{
GdkWindowImpl parent_instance;
GdkSurfaceImpl parent_instance;
GdkWindow *wrapper;
GdkSurface *wrapper;
GdkCursor *cursor;
@@ -61,24 +61,23 @@ struct _GdkWindowImplBroadway
int pre_maximize_width;
int pre_maximize_height;
gint8 toplevel_window_type;
gboolean dirty;
gboolean last_synced;
GdkGeometry geometry_hints;
GdkWindowHints geometry_hints_mask;
GdkSurfaceHints geometry_hints_mask;
GArray *node_data;
GPtrArray *node_data_textures;
};
struct _GdkWindowImplBroadwayClass
struct _GdkSurfaceImplBroadwayClass
{
GdkWindowImplClass parent_class;
GdkSurfaceImplClass parent_class;
};
GType gdk_window_impl_broadway_get_type (void);
GType gdk_surface_impl_broadway_get_type (void);
G_END_DECLS
#endif /* __GDK_WINDOW_BROADWAY_H__ */
#endif /* __GDK_SURFACE_BROADWAY_H__ */

File diff suppressed because it is too large Load Diff

View File

@@ -12,12 +12,12 @@ gdk_broadway_sources = files([
'gdkkeys-broadway.c',
'gdkmonitor-broadway.c',
'gdkselection-broadway.c',
'gdkwindow-broadway.c',
'gdksurface-broadway.c',
])
gdk_broadway_public_headers = [
'gdkbroadwaydisplay.h',
'gdkbroadwaywindow.h',
'gdkbroadwaysurface.h',
'gdkbroadwaycursor.h',
'gdkbroadwaymonitor.h',
]

View File

@@ -36,7 +36,7 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkKeymap, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkMonitor, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSeat, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkVulkanContext, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkWindow, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkSurface, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkContentFormats, gdk_content_formats_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkEvent, gdk_event_free)

View File

@@ -10,20 +10,20 @@ GdkDisplay * gdk_display_open_default (void);
gboolean gdk_device_grab_info (GdkDisplay *display,
GdkDevice *device,
GdkWindow **grab_window,
GdkSurface **grab_surface,
gboolean *owner_events);
void gdk_pre_parse (void);
void gdk_window_freeze_toplevel_updates (GdkWindow *window);
void gdk_window_thaw_toplevel_updates (GdkWindow *window);
void gdk_surface_freeze_toplevel_updates (GdkSurface *surface);
void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
gboolean gdk_window_supports_edge_constraints (GdkWindow *window);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
void gdk_window_move_to_rect (GdkWindow *window,
void gdk_surface_move_to_rect (GdkSurface *surface,
const GdkRectangle *rect,
GdkGravity rect_anchor,
GdkGravity window_anchor,
GdkGravity surface_anchor,
GdkAnchorHints anchor_hints,
gint rect_anchor_dx,
gint rect_anchor_dy);

View File

@@ -51,19 +51,23 @@
#include <gdk/gdkframeclock.h>
#include <gdk/gdkframetimings.h>
#include <gdk/gdkglcontext.h>
#include <gdk/gdkgltexture.h>
#include <gdk/gdkkeys.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkmemorytexture.h>
#include <gdk/gdkmonitor.h>
#include <gdk/gdkpaintable.h>
#include <gdk/gdkpango.h>
#include <gdk/gdkpixbuf.h>
#include <gdk/gdkproperty.h>
#include <gdk/gdkrectangle.h>
#include <gdk/gdkrgba.h>
#include <gdk/gdkseat.h>
#include <gdk/gdksnapshot.h>
#include <gdk/gdktexture.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkvulkancontext.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdksurface.h>
#include <gdk/gdk-autocleanup.h>

View File

@@ -33,9 +33,9 @@
* can be used with GDK. GTK+ does all of its drawing using cairo.
*
* GDK does not wrap the cairo API, instead it allows to create cairo
* contexts which can be used to draw on #GdkWindows. Additional
* contexts which can be used to draw on #GdkSurfaces. Additional
* functions allow use #GdkRectangles with cairo and to use #GdkRGBAs,
* #GdkPixbufs and #GdkWindows as sources for drawing operations.
* #GdkPixbufs and #GdkSurfaces as sources for drawing operations.
*/
@@ -240,8 +240,8 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
/**
* gdk_cairo_surface_create_from_pixbuf:
* @pixbuf: a #GdkPixbuf
* @scale: the scale of the new surface, or 0 to use same as @window
* @for_window: (allow-none): The window this will be drawn to, or %NULL
* @scale: the scale of the new surface, or 0 to use same as @surface
* @for_surface: (allow-none): The surface this will be drawn to, or %NULL
*
* Creates an image surface with the same contents as
* the pixbuf.
@@ -251,14 +251,14 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
cairo_surface_t *
gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pixbuf,
int scale,
GdkWindow *for_window)
GdkSurface *for_surface)
{
cairo_format_t format;
cairo_surface_t *surface;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
g_return_val_if_fail (scale >= 0, NULL);
g_return_val_if_fail (for_window == NULL || GDK_IS_WINDOW (for_window), NULL);
g_return_val_if_fail (for_surface == NULL || GDK_IS_SURFACE (for_surface), NULL);
if (gdk_pixbuf_get_n_channels (pixbuf) == 3)
format = CAIRO_FORMAT_RGB24;
@@ -266,7 +266,7 @@ gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pixbuf,
format = CAIRO_FORMAT_ARGB32;
surface =
gdk_window_create_similar_image_surface (for_window,
gdk_surface_create_similar_image_surface (for_surface,
format,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),

View File

@@ -58,10 +58,10 @@ cairo_region_t *
GDK_AVAILABLE_IN_ALL
cairo_surface_t * gdk_cairo_surface_create_from_pixbuf (const GdkPixbuf *pixbuf,
int scale,
GdkWindow *for_window);
GdkSurface *for_surface);
GDK_AVAILABLE_IN_ALL
void gdk_cairo_draw_from_gl (cairo_t *cr,
GdkWindow *window,
GdkSurface *surface,
int source,
int source_type,
int buffer_scale,

View File

@@ -147,18 +147,20 @@ GdkContentFormats *
gdk_content_formats_new (const char **mime_types,
guint n_mime_types)
{
GPtrArray *array;
guint i;
const char **mime_types_copy;
if (n_mime_types == 0)
return gdk_content_formats_new_take (NULL, 0, NULL, 0);
array = g_ptr_array_new ();
for (i = 0; i < n_mime_types; i++)
g_ptr_array_add (array, (gpointer) g_intern_string (mime_types[i]));
g_ptr_array_add (array, NULL);
mime_types_copy = g_new (const char *, n_mime_types + 1);
return gdk_content_formats_new_take (NULL, 0, (const char **) g_ptr_array_free (array, FALSE), n_mime_types);
for (i = 0; i < n_mime_types; i++)
mime_types_copy[i] = g_intern_string (mime_types[i]);
mime_types_copy[n_mime_types] = NULL;
return gdk_content_formats_new_take (NULL, 0, mime_types_copy, n_mime_types);
}
/**

View File

@@ -48,7 +48,7 @@
*
* Cursors by themselves are not very interesting, they must be
* bound to a window for users to see them. This is done with
* gdk_window_set_cursor() or gdk_window_set_device_cursor().
* gdk_surface_set_cursor() or gdk_surface_set_device_cursor().
* Applications will typically use higher-level GTK+ functions such
* as gtk_widget_set_cursor() instead.
*
@@ -69,7 +69,7 @@
* gdk_display_get_maximal_cursor_size() for the limitations that might apply.
*
* To ease work with unsupported cursors, a fallback cursor can be provided.
* If a #GdkWindow cannot use a cursor because of the reasons mentioned above,
* If a #GdkSurface cannot use a cursor because of the reasons mentioned above,
* it will try the fallback cursor. Of course, fallback cursors can themselves
* have fallback cursors again, so it is possible to provide a chain of
* progressively easier to support cursors. If none of the provided cursors
@@ -391,7 +391,7 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
* For textured cursors, this can happen when the texture is too large or
* when the #GdkDisplay it is used on does not support textured cursors.
*
* Returns: (transfer none): the fallback of the cursor or %NULL to use
* Returns: (transfer none) (nullable): the fallback of the cursor or %NULL to use
* the default cursor as fallback.
*/
GdkCursor *
@@ -409,7 +409,7 @@ gdk_cursor_get_fallback (GdkCursor *cursor)
* Returns the name of the cursor. If the cursor is not a named cursor, %NULL
* will be returned and the GdkCursor::texture property will be set.
*
* Returns: (transfer none): the name of the cursor or %NULL if it is not
* Returns: (transfer none) (nullable): the name of the cursor or %NULL if it is not
* a named cursor
*/
const char *
@@ -427,7 +427,7 @@ gdk_cursor_get_name (GdkCursor *cursor)
* Returns the texture for the cursor. If the cursor is a named cursor, %NULL
* will be returned and the GdkCursor::name property will be set.
*
* Returns: (transfer none): the texture for cursor or %NULL if it is a
* Returns: (transfer none) (nullable): the texture for cursor or %NULL if it is a
* named cursor
*/
GdkTexture *

View File

@@ -502,30 +502,30 @@ gdk_device_get_property (GObject *object,
/**
* gdk_device_get_state: (skip)
* @device: a #GdkDevice.
* @window: a #GdkWindow.
* @surface: a #GdkSurface.
* @axes: (nullable) (array): an array of doubles to store the values of
* the axes of @device in, or %NULL.
* @mask: (optional) (out): location to store the modifiers, or %NULL.
*
* Gets the current state of a pointer device relative to @window. As a slave
* Gets the current state of a pointer device relative to @surface. As a slave
* devices coordinates are those of its master pointer, this
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
* unless there is an ongoing grab on them. See gdk_device_grab().
*/
void
gdk_device_get_state (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
if (GDK_DEVICE_GET_CLASS (device)->get_state)
GDK_DEVICE_GET_CLASS (device)->get_state (device, window, axes, mask);
GDK_DEVICE_GET_CLASS (device)->get_state (device, surface, axes, mask);
}
/**
@@ -594,43 +594,43 @@ gdk_device_get_position (GdkDevice *device,
/**
* gdk_device_get_window_at_position_double:
* gdk_device_get_surface_at_position_double:
* @device: pointer #GdkDevice to query info to.
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
*
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y in
* double precision. Returns %NULL if the window tree under @device is not known to GDK (for example,
* Obtains the surface underneath @device, returning the location of the device in @win_x and @win_y in
* double precision. Returns %NULL if the surface tree under @device is not known to GDK (for example,
* belongs to another application).
*
* As a slave device coordinates are those of its master pointer, This
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
* unless there is an ongoing grab on them, see gdk_device_grab().
*
* Returns: (nullable) (transfer none): the #GdkWindow under the
* Returns: (nullable) (transfer none): the #GdkSurface under the
* device position, or %NULL.
**/
GdkWindow *
gdk_device_get_window_at_position_double (GdkDevice *device,
GdkSurface *
gdk_device_get_surface_at_position_double (GdkDevice *device,
gdouble *win_x,
gdouble *win_y)
{
gdouble tmp_x, tmp_y;
GdkWindow *window;
GdkSurface *surface;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
window = _gdk_device_window_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
surface = _gdk_device_surface_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
/* This might need corrections, as the native window returned
/* This might need corrections, as the native surface returned
may contain client side children */
if (window)
window = _gdk_window_find_descendant_at (window,
if (surface)
surface = _gdk_surface_find_descendant_at (surface,
tmp_x, tmp_y,
&tmp_x, &tmp_y);
@@ -639,50 +639,50 @@ gdk_device_get_window_at_position_double (GdkDevice *device,
if (win_y)
*win_y = tmp_y;
return window;
return surface;
}
/**
* gdk_device_get_window_at_position:
* gdk_device_get_surface_at_position:
* @device: pointer #GdkDevice to query info to.
* @win_x: (out) (allow-none): return location for the X coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
* @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
* relative to the window origin, or %NULL.
* relative to the surface origin, or %NULL.
*
* Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
* Obtains the surface underneath @device, returning the location of the device in @win_x and @win_y. Returns
* %NULL if the surface tree under @device is not known to GDK (for example, belongs to another application).
*
* As a slave device coordinates are those of its master pointer, This
* function may not be called on devices of type %GDK_DEVICE_TYPE_SLAVE,
* unless there is an ongoing grab on them, see gdk_device_grab().
*
* Returns: (nullable) (transfer none): the #GdkWindow under the
* Returns: (nullable) (transfer none): the #GdkSurface under the
* device position, or %NULL.
**/
GdkWindow *
gdk_device_get_window_at_position (GdkDevice *device,
GdkSurface *
gdk_device_get_surface_at_position (GdkDevice *device,
gint *win_x,
gint *win_y)
{
gdouble tmp_x, tmp_y;
GdkWindow *window;
GdkSurface *surface;
window =
gdk_device_get_window_at_position_double (device, &tmp_x, &tmp_y);
surface =
gdk_device_get_surface_at_position_double (device, &tmp_x, &tmp_y);
if (win_x)
*win_x = round (tmp_x);
if (win_y)
*win_y = round (tmp_y);
return window;
return surface;
}
/**
* gdk_device_get_history: (skip)
* @device: a #GdkDevice
* @window: the window with respect to which which the event coordinates will be reported
* @surface: the surface with respect to which which the event coordinates will be reported
* @start: starting timestamp for range of events to return
* @stop: ending timestamp for the range of events to return
* @events: (array length=n_events) (out) (transfer full) (optional):
@@ -698,7 +698,7 @@ gdk_device_get_window_at_position (GdkDevice *device,
* be returned. (This is not distinguishable from the case where
* motion history is supported and no events were found.)
*
* Note that there is also gdk_window_set_event_compression() to get
* Note that there is also gdk_surface_set_event_compression() to get
* more motion events delivered directly, independent of the windowing
* system.
*
@@ -707,7 +707,7 @@ gdk_device_get_window_at_position (GdkDevice *device,
**/
gboolean
gdk_device_get_history (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
@@ -715,7 +715,7 @@ gdk_device_get_history (GdkDevice *device,
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
if (n_events)
*n_events = 0;
@@ -723,13 +723,13 @@ gdk_device_get_history (GdkDevice *device,
if (events)
*events = NULL;
if (GDK_WINDOW_DESTROYED (window))
if (GDK_SURFACE_DESTROYED (surface))
return FALSE;
if (!GDK_DEVICE_GET_CLASS (device)->get_history)
return FALSE;
return GDK_DEVICE_GET_CLASS (device)->get_history (device, window,
return GDK_DEVICE_GET_CLASS (device)->get_history (device, surface,
start, stop,
events, n_events);
}
@@ -838,7 +838,7 @@ gdk_device_get_mode (GdkDevice *device)
*
* Sets a the mode of an input device. The mode controls if the
* device is active and whether the devices range is mapped to the
* entire screen or to a single window.
* entire screen or to a single surface.
*
* Note: This is only meaningful for floating devices, master devices (and
* slaves connected to these) drive the pointer cursor, which is not limited
@@ -1311,19 +1311,19 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
* or gdk_event_get_device() if the grab is in reaction to an event. Also, you can use
* gdk_seat_get_pointer() but only in code that isnt triggered by a
* #GdkEvent and there arent other means to get a meaningful #GdkDevice to operate on.
* @window: the #GdkWindow which will own the grab (the grab window)
* @surface: the #GdkSurface which will own the grab (the grab surface)
* @grab_ownership: specifies the grab ownership.
* @owner_events: if %FALSE then all device events are reported with respect to
* @window and are only reported if selected by @event_mask. If
* @surface and are only reported if selected by @event_mask. If
* %TRUE then pointer events for this application are reported
* as normal, but pointer events outside this application are
* reported with respect to @window and only if selected by
* reported with respect to @surface and only if selected by
* @event_mask. In either mode, unreported events are discarded.
* @event_mask: specifies the event mask, which is used in accordance with
* @owner_events.
* @cursor: (allow-none): the cursor to display while the grab is active if the device is
* a pointer. If this is %NULL then the normal cursors are used for
* @window and its descendants, and the cursor for @window is used
* @surface and its descendants, and the cursor for @surface is used
* elsewhere.
* @time_: the timestamp of the event which led to this pointer grab. This
* usually comes from the #GdkEvent struct, though %GDK_CURRENT_TIME
@@ -1331,10 +1331,10 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
*
* Grabs the device so that all events coming from this device are passed to
* this application until the device is ungrabbed with gdk_device_ungrab(),
* or the window becomes unviewable. This overrides any previous grab on the device
* or the surface becomes unviewable. This overrides any previous grab on the device
* by this client.
*
* Note that @device and @window need to be on the same display.
* Note that @device and @surface need to be on the same display.
*
* Device grabs are used for operations which need complete control over the
* given device events (either pointer or keyboard). For example in GTK+ this
@@ -1344,7 +1344,7 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
* and button release events, then a button press event will cause an automatic
* pointer grab until the button is released. X does this automatically since
* most applications expect to receive button press and release events in pairs.
* It is equivalent to a pointer grab on the window with @owner_events set to
* It is equivalent to a pointer grab on the surface with @owner_events set to
* %TRUE.
*
* If you set up anything at the time you take the grab that needs to be
@@ -1357,7 +1357,7 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
**/
GdkGrabStatus
gdk_device_grab (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
@@ -1365,15 +1365,15 @@ gdk_device_grab (GdkDevice *device,
guint32 time_)
{
GdkGrabStatus res;
GdkWindow *native;
GdkSurface *native;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_FAILED);
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_FAILED);
g_return_val_if_fail (gdk_window_get_display (window) == gdk_device_get_display (device), GDK_GRAB_FAILED);
g_return_val_if_fail (GDK_IS_SURFACE (surface), GDK_GRAB_FAILED);
g_return_val_if_fail (gdk_surface_get_display (surface) == gdk_device_get_display (device), GDK_GRAB_FAILED);
native = gdk_window_get_toplevel (window);
native = gdk_surface_get_toplevel (surface);
if (native == NULL || GDK_WINDOW_DESTROYED (native))
if (native == NULL || GDK_SURFACE_DESTROYED (native))
return GDK_GRAB_NOT_VIEWABLE;
res = GDK_DEVICE_GET_CLASS (device)->grab (device,
@@ -1389,12 +1389,12 @@ gdk_device_grab (GdkDevice *device,
GdkDisplay *display;
gulong serial;
display = gdk_window_get_display (window);
display = gdk_surface_get_display (surface);
serial = _gdk_display_get_next_serial (display);
_gdk_display_add_device_grab (display,
device,
window,
surface,
native,
grab_ownership,
owner_events,
@@ -1432,7 +1432,7 @@ gdk_device_ungrab (GdkDevice *device,
* @y: the Y coordinate of the destination.
*
* Warps @device in @display to the point @x,@y,
* unless the device is confined to a window by a grab,
* unless the device is confined to a surface by a grab,
* in which case it will be moved
* as far as allowed by the grab. Warping the pointer
* creates events as if the user had moved the mouse
@@ -1566,8 +1566,8 @@ find_axis_info (GArray *array,
}
gboolean
_gdk_device_translate_window_coord (GdkDevice *device,
GdkWindow *window,
_gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *surface,
guint index_,
gdouble value,
gdouble *axis_value)
@@ -1580,7 +1580,7 @@ _gdk_device_translate_window_coord (GdkDevice *device,
gdouble x_min, y_min;
gdouble x_resolution, y_resolution;
gdouble device_aspect;
gint window_width, window_height;
gint surface_width, surface_height;
if (index_ >= device->axes->len)
return FALSE;
@@ -1608,8 +1608,8 @@ _gdk_device_translate_window_coord (GdkDevice *device,
x_min = axis_info_x->min_value;
y_min = axis_info_y->min_value;
window_width = gdk_window_get_width (window);
window_height = gdk_window_get_height (window);
surface_width = gdk_surface_get_width (surface);
surface_height = gdk_surface_get_height (surface);
x_resolution = axis_info_x->resolution;
y_resolution = axis_info_y->resolution;
@@ -1633,23 +1633,23 @@ _gdk_device_translate_window_coord (GdkDevice *device,
device_aspect = (device_height * y_resolution) /
(device_width * x_resolution);
if (device_aspect * window_width >= window_height)
if (device_aspect * surface_width >= surface_height)
{
/* device taller than window */
x_scale = window_width / device_width;
/* device taller than surface */
x_scale = surface_width / device_width;
y_scale = (x_scale * x_resolution) / y_resolution;
x_offset = 0;
y_offset = - (device_height * y_scale - window_height) / 2;
y_offset = - (device_height * y_scale - surface_height) / 2;
}
else
{
/* window taller than device */
y_scale = window_height / device_height;
/* surface taller than device */
y_scale = surface_height / device_height;
x_scale = (y_scale * y_resolution) / x_resolution;
y_offset = 0;
x_offset = - (device_width * x_scale - window_width) / 2;
x_offset = - (device_width * x_scale - surface_width) / 2;
}
if (axis_value)
@@ -1665,9 +1665,9 @@ _gdk_device_translate_window_coord (GdkDevice *device,
gboolean
_gdk_device_translate_screen_coord (GdkDevice *device,
GdkWindow *window,
gdouble window_root_x,
gdouble window_root_y,
GdkSurface *surface,
gdouble surface_root_x,
gdouble surface_root_y,
gdouble screen_width,
gdouble screen_height,
guint index_,
@@ -1698,7 +1698,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
offset = - window_root_x - window->abs_x;
offset = - surface_root_x - surface->abs_x;
}
else
{
@@ -1707,7 +1707,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
else
scale = 1;
offset = - window_root_y - window->abs_y;
offset = - surface_root_y - surface->abs_y;
}
if (axis_value)
@@ -1746,8 +1746,8 @@ _gdk_device_translate_axis (GdkDevice *device,
void
_gdk_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
@@ -1755,8 +1755,8 @@ _gdk_device_query_state (GdkDevice *device,
GdkModifierType *mask)
{
GDK_DEVICE_GET_CLASS (device)->query_state (device,
window,
child_window,
surface,
child_surface,
root_x,
root_y,
win_x,
@@ -1764,14 +1764,14 @@ _gdk_device_query_state (GdkDevice *device,
mask);
}
GdkWindow *
_gdk_device_window_at_position (GdkDevice *device,
GdkSurface *
_gdk_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,
gboolean get_toplevel)
{
return GDK_DEVICE_GET_CLASS (device)->window_at_position (device,
return GDK_DEVICE_GET_CLASS (device)->surface_at_position (device,
win_x,
win_y,
mask,
@@ -1779,22 +1779,22 @@ _gdk_device_window_at_position (GdkDevice *device,
}
/**
* gdk_device_get_last_event_window:
* gdk_device_get_last_event_surface:
* @device: a #GdkDevice, with a source other than %GDK_SOURCE_KEYBOARD
*
* Gets information about which window the given pointer device is in, based on events
* Gets information about which surface the given pointer device is in, based on events
* that have been received so far from the display server. If another application
* has a pointer grab, or this application has a grab with owner_events = %FALSE,
* %NULL may be returned even if the pointer is physically over one of this
* application's windows.
* application's surfaces.
*
* Returns: (transfer none) (allow-none): the last window the device
* Returns: (transfer none) (allow-none): the last surface the device
*/
GdkWindow *
gdk_device_get_last_event_window (GdkDevice *device)
GdkSurface *
gdk_device_get_last_event_surface (GdkDevice *device)
{
GdkDisplay *display;
GdkPointerWindowInfo *info;
GdkPointerSurfaceInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
@@ -1802,7 +1802,7 @@ gdk_device_get_last_event_window (GdkDevice *device)
display = gdk_device_get_display (device);
info = _gdk_display_get_pointer_info (display, device);
return info->window_under_pointer;
return info->surface_under_pointer;
}
/**

View File

@@ -73,10 +73,10 @@ typedef enum
* @GDK_MODE_DISABLED: the device is disabled and will not report any events.
* @GDK_MODE_SCREEN: the device is enabled. The devices coordinate space
* maps to the entire screen.
* @GDK_MODE_WINDOW: the device is enabled. The devices coordinate space
* is mapped to a single window. The manner in which this window
* @GDK_MODE_SURFACE: the device is enabled. The devices coordinate space
* is mapped to a single surface. The manner in which this surface
* is chosen is undefined, but it will typically be the same
* way in which the focus window for key events is determined.
* way in which the focus surface for key events is determined.
*
* An enumeration that describes the mode of an input device.
*/
@@ -84,7 +84,7 @@ typedef enum
{
GDK_MODE_DISABLED,
GDK_MODE_SCREEN,
GDK_MODE_WINDOW
GDK_MODE_SURFACE
} GdkInputMode;
/**
@@ -163,7 +163,7 @@ void gdk_device_set_axis_use (GdkDevice *device,
GDK_AVAILABLE_IN_ALL
void gdk_device_get_state (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask);
GDK_AVAILABLE_IN_ALL
@@ -171,8 +171,8 @@ void gdk_device_get_position (GdkDevice *device,
gint *x,
gint *y);
GDK_AVAILABLE_IN_ALL
GdkWindow *
gdk_device_get_window_at_position
GdkSurface *
gdk_device_get_surface_at_position
(GdkDevice *device,
gint *win_x,
gint *win_y);
@@ -181,14 +181,14 @@ void gdk_device_get_position_double (GdkDevice *device,
gdouble *x,
gdouble *y);
GDK_AVAILABLE_IN_ALL
GdkWindow *
gdk_device_get_window_at_position_double
GdkSurface *
gdk_device_get_surface_at_position_double
(GdkDevice *device,
gdouble *win_x,
gdouble *win_y);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_history (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
@@ -225,7 +225,7 @@ GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
GDK_DEPRECATED_FOR(gdk_seat_grab)
GdkGrabStatus gdk_device_grab (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
@@ -242,7 +242,7 @@ void gdk_device_warp (GdkDevice *device,
gint y);
GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_device_get_last_event_window (GdkDevice *device);
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const gchar *gdk_device_get_vendor_id (GdkDevice *device);

View File

@@ -71,50 +71,50 @@ struct _GdkDeviceClass
GObjectClass parent_class;
gboolean (* get_history) (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events);
void (* get_state) (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
gdouble *axes,
GdkModifierType *mask);
void (* set_window_cursor) (GdkDevice *device,
GdkWindow *window,
void (* set_surface_cursor)(GdkDevice *device,
GdkSurface *surface,
GdkCursor *cursor);
void (* warp) (GdkDevice *device,
gdouble x,
gdouble y);
void (* query_state) (GdkDevice *device,
GdkWindow *window,
GdkWindow **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
GdkGrabStatus (* grab) (GdkDevice *device,
GdkWindow *window,
GdkSurface *surface,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkSurface *confine_to,
GdkCursor *cursor,
guint32 time_);
void (*ungrab) (GdkDevice *device,
guint32 time_);
GdkWindow * (* window_at_position) (GdkDevice *device,
double *win_x,
double *win_y,
GdkModifierType *mask,
gboolean get_toplevel);
void (* select_window_events) (GdkDevice *device,
GdkWindow *window,
GdkEventMask event_mask);
GdkSurface * (* surface_at_position) (GdkDevice *device,
double *win_x,
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,
@@ -138,16 +138,16 @@ void _gdk_device_get_axis_info (GdkDevice *device,
void _gdk_device_set_keys (GdkDevice *device,
guint num_keys);
gboolean _gdk_device_translate_window_coord (GdkDevice *device,
GdkWindow *window,
guint index,
gdouble value,
gdouble *axis_value);
gboolean _gdk_device_translate_surface_coord (GdkDevice *device,
GdkSurface *surface,
guint index,
gdouble value,
gdouble *axis_value);
gboolean _gdk_device_translate_screen_coord (GdkDevice *device,
GdkWindow *window,
gdouble window_root_x,
gdouble window_root_y,
GdkSurface *surface,
gdouble surface_root_x,
gdouble surface_root_y,
gdouble screen_width,
gdouble screen_height,
guint index,
@@ -167,14 +167,14 @@ void _gdk_device_add_slave (GdkDevice *device,
void _gdk_device_remove_slave (GdkDevice *device,
GdkDevice *slave);
void _gdk_device_query_state (GdkDevice *device,
GdkWindow *window,
GdkWindow **child_window,
GdkSurface *surface,
GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask);
GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
GdkSurface * _gdk_device_surface_at_position (GdkDevice *device,
gdouble *win_x,
gdouble *win_y,
GdkModifierType *mask,

View File

@@ -31,7 +31,7 @@
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkevents.h"
#include "gdkwindowimpl.h"
#include "gdksurfaceimpl.h"
#include "gdkinternals.h"
#include "gdkmonitorprivate.h"
@@ -171,7 +171,7 @@ gdk_display_class_init (GdkDisplayClass *class)
object_class->get_property = gdk_display_get_property;
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
class->window_type = GDK_TYPE_WINDOW;
class->surface_type = GDK_TYPE_SURFACE;
class->opened = gdk_display_real_opened;
class->make_default = gdk_display_real_make_default;
@@ -326,17 +326,17 @@ gdk_display_class_init (GdkDisplayClass *class)
}
static void
free_pointer_info (GdkPointerWindowInfo *info)
free_pointer_info (GdkPointerSurfaceInfo *info)
{
g_clear_object (&info->window_under_pointer);
g_slice_free (GdkPointerWindowInfo, info);
g_clear_object (&info->surface_under_pointer);
g_slice_free (GdkPointerSurfaceInfo, info);
}
static void
free_device_grab (GdkDeviceGrabInfo *info)
{
g_object_unref (info->window);
g_object_unref (info->native_window);
g_object_unref (info->surface);
g_object_unref (info->native_surface);
g_free (info);
}
@@ -516,22 +516,22 @@ gdk_display_put_event (GdkDisplay *display,
static void
generate_grab_broken_event (GdkDisplay *display,
GdkWindow *window,
GdkSurface *surface,
GdkDevice *device,
gboolean implicit,
GdkWindow *grab_window)
GdkSurface *grab_surface)
{
g_return_if_fail (window != NULL);
g_return_if_fail (surface != NULL);
if (!GDK_WINDOW_DESTROYED (window))
if (!GDK_SURFACE_DESTROYED (surface))
{
GdkEvent *event;
event = gdk_event_new (GDK_GRAB_BROKEN);
event->any.window = g_object_ref (window);
event->any.surface = g_object_ref (surface);
event->any.send_event = FALSE;
event->grab_broken.implicit = implicit;
event->grab_broken.grab_window = grab_window;
event->grab_broken.grab_surface = grab_surface;
gdk_event_set_device (event, device);
event->grab_broken.keyboard = (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) ? TRUE : FALSE;
@@ -559,8 +559,8 @@ _gdk_display_get_last_device_grab (GdkDisplay *display,
GdkDeviceGrabInfo *
_gdk_display_add_device_grab (GdkDisplay *display,
GdkDevice *device,
GdkWindow *window,
GdkWindow *native_window,
GdkSurface *surface,
GdkSurface *native_surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
@@ -573,8 +573,8 @@ _gdk_display_add_device_grab (GdkDisplay *display,
info = g_new0 (GdkDeviceGrabInfo, 1);
info->window = g_object_ref (window);
info->native_window = g_object_ref (native_window);
info->surface = g_object_ref (surface);
info->native_surface = g_object_ref (native_surface);
info->serial_start = serial_start;
info->serial_end = G_MAXULONG;
info->owner_events = owner_events;
@@ -619,30 +619,29 @@ _gdk_display_add_device_grab (GdkDisplay *display,
return info;
}
static GdkWindow *
static GdkSurface *
get_current_toplevel (GdkDisplay *display,
GdkDevice *device,
int *x_out,
int *y_out,
GdkModifierType *state_out)
{
GdkWindow *pointer_window;
GdkSurface *pointer_surface;
gdouble x, y;
GdkModifierType state;
pointer_window = _gdk_device_window_at_position (device, &x, &y, &state, TRUE);
pointer_surface = _gdk_device_surface_at_position (device, &x, &y, &state, TRUE);
if (pointer_window != NULL &&
(GDK_WINDOW_DESTROYED (pointer_window) ||
GDK_WINDOW_TYPE (pointer_window) == GDK_WINDOW_ROOT ||
GDK_WINDOW_TYPE (pointer_window) == GDK_WINDOW_FOREIGN))
pointer_window = NULL;
if (pointer_surface != NULL &&
(GDK_SURFACE_DESTROYED (pointer_surface) ||
GDK_SURFACE_TYPE (pointer_surface) == GDK_SURFACE_FOREIGN))
pointer_surface = NULL;
*x_out = round (x);
*y_out = round (y);
*state_out = state;
return pointer_window;
return pointer_surface;
}
static void
@@ -654,8 +653,8 @@ switch_to_pointer_grab (GdkDisplay *display,
guint32 time,
gulong serial)
{
GdkWindow *new_toplevel;
GdkPointerWindowInfo *info;
GdkSurface *new_toplevel;
GdkPointerSurfaceInfo *info;
GList *old_grabs;
GdkModifierType state;
int x = 0, y = 0;
@@ -670,10 +669,10 @@ switch_to_pointer_grab (GdkDisplay *display,
/* New grab is in effect */
if (!grab->implicit)
{
/* !owner_event Grabbing a window that we're not inside, current status is
now NULL (i.e. outside grabbed window) */
if (!grab->owner_events && info->window_under_pointer != grab->window)
_gdk_display_set_window_under_pointer (display, device, NULL);
/* !owner_event Grabbing a surface that we're not inside, current status is
now NULL (i.e. outside grabbed surface) */
if (!grab->owner_events && info->surface_under_pointer != grab->surface)
_gdk_display_set_surface_under_pointer (display, device, NULL);
}
grab->activated = TRUE;
@@ -697,7 +696,7 @@ switch_to_pointer_grab (GdkDisplay *display,
if (new_toplevel)
{
/* w is now toplevel and x,y in toplevel coords */
_gdk_display_set_window_under_pointer (display, device, new_toplevel);
_gdk_display_set_surface_under_pointer (display, device, new_toplevel);
info->toplevel_x = x;
info->toplevel_y = y;
info->state = state;
@@ -706,8 +705,8 @@ switch_to_pointer_grab (GdkDisplay *display,
if (grab == NULL) /* Ungrabbed, send events */
{
/* We're now ungrabbed, update the window_under_pointer */
_gdk_display_set_window_under_pointer (display, device, new_toplevel);
/* We're now ungrabbed, update the surface_under_pointer */
_gdk_display_set_surface_under_pointer (display, device, new_toplevel);
}
}
@@ -767,11 +766,11 @@ _gdk_display_device_grab_update (GdkDisplay *display,
}
if ((next_grab == NULL && current_grab->implicit_ungrab) ||
(next_grab != NULL && current_grab->window != next_grab->window))
generate_grab_broken_event (display, GDK_WINDOW (current_grab->window),
(next_grab != NULL && current_grab->surface != next_grab->surface))
generate_grab_broken_event (display, GDK_SURFACE (current_grab->surface),
device,
current_grab->implicit,
next_grab? next_grab->window : NULL);
next_grab? next_grab->surface : NULL);
/* Remove old grab */
grabs = g_list_delete_link (grabs, grabs);
@@ -832,12 +831,12 @@ _gdk_display_has_device_grab (GdkDisplay *display,
/* Returns true if last grab was ended
* If if_child is non-NULL, end the grab only if the grabbed
* window is the same as if_child or a descendant of it */
* surface is the same as if_child or a descendant of it */
gboolean
_gdk_display_end_device_grab (GdkDisplay *display,
GdkDevice *device,
gulong serial,
GdkWindow *if_child,
GdkSurface *if_child,
gboolean implicit)
{
GdkDeviceGrabInfo *grab;
@@ -851,7 +850,7 @@ _gdk_display_end_device_grab (GdkDisplay *display,
grab = l->data;
if (grab &&
(if_child == NULL ||
_gdk_window_event_parent_of (if_child, grab->window)))
_gdk_surface_event_parent_of (if_child, grab->surface)))
{
grab->serial_end = serial;
grab->implicit_ungrab = implicit;
@@ -916,11 +915,11 @@ _gdk_display_check_grab_ownership (GdkDisplay *display,
return TRUE;
}
GdkPointerWindowInfo *
GdkPointerSurfaceInfo *
_gdk_display_get_pointer_info (GdkDisplay *display,
GdkDevice *device)
{
GdkPointerWindowInfo *info;
GdkPointerSurfaceInfo *info;
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
@@ -932,7 +931,7 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
if (G_UNLIKELY (!info))
{
info = g_slice_new0 (GdkPointerWindowInfo);
info = g_slice_new0 (GdkPointerSurfaceInfo);
g_hash_table_insert (display->pointers_info, device, info);
}
@@ -951,7 +950,7 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
while (g_hash_table_iter_next (&iter, &key, &value))
{
GdkPointerWindowInfo *info = value;
GdkPointerSurfaceInfo *info = value;
GdkDevice *device = key;
(func) (display, device, info, user_data);
@@ -962,7 +961,7 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
* gdk_device_grab_info:
* @display: the display for which to get the grab information
* @device: device to get the grab information from
* @grab_window: (out) (transfer none): location to store current grab window
* @grab_surface: (out) (transfer none): location to store current grab surface
* @owner_events: (out): location to store boolean indicating whether
* the @owner_events flag to gdk_device_grab() was %TRUE.
*
@@ -975,7 +974,7 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
gboolean
gdk_device_grab_info (GdkDisplay *display,
GdkDevice *device,
GdkWindow **grab_window,
GdkSurface **grab_surface,
gboolean *owner_events)
{
GdkDeviceGrabInfo *info;
@@ -987,8 +986,8 @@ gdk_device_grab_info (GdkDisplay *display,
if (info)
{
if (grab_window)
*grab_window = info->window;
if (grab_surface)
*grab_surface = info->surface;
if (owner_events)
*owner_events = info->owner_events;
@@ -1103,14 +1102,14 @@ gdk_display_flush (GdkDisplay *display)
* gdk_display_get_default_group:
* @display: a #GdkDisplay
*
* Returns the default group leader window for all toplevel windows
* on @display. This window is implicitly created by GDK.
* See gdk_window_set_group().
* Returns the default group leader surface for all toplevel surfaces
* on @display. This surface is implicitly created by GDK.
* See gdk_surface_set_group().
*
* Returns: (transfer none): The default group leader window
* Returns: (transfer none): The default group leader surface
* for @display
**/
GdkWindow *
GdkSurface *
gdk_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
@@ -1162,7 +1161,7 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
* gdk_display_supports_shapes:
* @display: a #GdkDisplay
*
* Returns %TRUE if gdk_window_shape_combine_mask() can
* Returns %TRUE if gdk_surface_shape_combine_mask() can
* be used to create shaped windows on @display.
*
* Returns: %TRUE if shaped windows are supported
@@ -1179,10 +1178,10 @@ gdk_display_supports_shapes (GdkDisplay *display)
* gdk_display_supports_input_shapes:
* @display: a #GdkDisplay
*
* Returns %TRUE if gdk_window_input_shape_combine_mask() can
* be used to modify the input shape of windows on @display.
* Returns %TRUE if gdk_surface_input_shape_combine_mask() can
* be used to modify the input shape of surfaces on @display.
*
* Returns: %TRUE if windows with modified input shape are supported
* Returns: %TRUE if surfaces with modified input shape are supported
*/
gboolean
gdk_display_supports_input_shapes (GdkDisplay *display)
@@ -1314,23 +1313,23 @@ _gdk_display_event_data_free (GdkDisplay *display,
}
void
_gdk_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
_gdk_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkWindowAttr *attributes)
GdkSurfaceAttr *attributes)
{
GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display,
window,
GDK_DISPLAY_GET_CLASS (display)->create_surface_impl (display,
surface,
real_parent,
event_mask,
attributes);
}
GdkWindow *
_gdk_display_create_window (GdkDisplay *display)
GdkSurface *
_gdk_display_create_surface (GdkDisplay *display)
{
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->window_type,
return g_object_new (GDK_DISPLAY_GET_CLASS (display)->surface_type,
"display", display,
NULL);
}
@@ -1383,7 +1382,7 @@ gdk_display_set_debug_flags (GdkDisplay *display,
* gdk_display_is_composited:
* @display: a #GdkDisplay
*
* Returns whether windows can reasonably be expected to have
* Returns whether surfaces can reasonably be expected to have
* their alpha channel drawn correctly on the screen. Check
* gdk_display_is_rgba() for wether the display supports an
* alpha channel.
@@ -1393,7 +1392,7 @@ gdk_display_set_debug_flags (GdkDisplay *display,
*
* On modern displays, this value is always %TRUE.
*
* Returns: Whether windows with RGBA visuals can reasonably be
* Returns: Whether surfaces with RGBA visuals can reasonably be
* expected to have their alpha channels drawn correctly on the screen.
**/
gboolean
@@ -1422,22 +1421,22 @@ gdk_display_set_composited (GdkDisplay *display,
* gdk_display_is_rgba:
* @display: a #GdkDisplay
*
* Returns wether windows on this @display are created with an
* Returns wether surfaces on this @display are created with an
* alpha channel.
*
* Even if a %TRUE is returned, it is possible that the
* windows alpha channel wont be honored when displaying the
* window on the screen: in particular, for X an appropriate
* surfaces alpha channel wont be honored when displaying the
* surface on the screen: in particular, for X an appropriate
* windowing manager and compositing manager must be running to
* provide appropriate display. Use gdk_display_is_composited()
* to check if that is the case.
*
* For setting an overall opacity for a top-level window, see
* gdk_window_set_opacity().
* For setting an overall opacity for a top-level surface, see
* gdk_surface_set_opacity().
*
* On modern displays, this value is always %TRUE.
*
* Returns: %TRUE if windows are created with an alpha channel or
* Returns: %TRUE if surfaces are created with an alpha channel or
* %FALSE if the display does not support this functionality.
**/
gboolean
@@ -1593,8 +1592,8 @@ gdk_display_get_monitor (GdkDisplay *display,
* Gets the primary monitor for the display.
*
* The primary monitor is considered the monitor where the “main desktop”
* lives. While normal application windows typically allow the window
* manager to place the windows, specialized desktop applications
* lives. While normal application surfaces typically allow the window
* manager to place the surfaces, specialized desktop applications
* such as panels should place themselves on the primary monitor.
*
* If no monitor is the designated primary monitor, any monitor
@@ -1673,19 +1672,19 @@ gdk_display_get_monitor_at_point (GdkDisplay *display,
}
/**
* gdk_display_get_monitor_at_window:
* gdk_display_get_monitor_at_surface:
* @display: a #GdkDisplay
* @window: a #GdkWindow
* @surface: a #GdkSurface
*
* Gets the monitor in which the largest area of @window
* resides, or a monitor close to @window if it is outside
* Gets the monitor in which the largest area of @surface
* resides, or a monitor close to @surface if it is outside
* of all monitors.
*
* Returns: (transfer none): the monitor with the largest overlap with @window
* Returns: (transfer none): the monitor with the largest overlap with @surface
*/
GdkMonitor *
gdk_display_get_monitor_at_window (GdkDisplay *display,
GdkWindow *window)
gdk_display_get_monitor_at_surface (GdkDisplay *display,
GdkSurface *surface)
{
GdkRectangle win;
int n_monitors, i;
@@ -1696,16 +1695,16 @@ gdk_display_get_monitor_at_window (GdkDisplay *display,
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
class = GDK_DISPLAY_GET_CLASS (display);
if (class->get_monitor_at_window)
if (class->get_monitor_at_surface)
{
best = class->get_monitor_at_window (display, window);
best = class->get_monitor_at_surface (display, surface);
if (best)
return best;
}
gdk_window_get_geometry (window, &win.x, &win.y, &win.width, &win.height);
gdk_window_get_origin (window, &win.x, &win.y);
gdk_surface_get_geometry (surface, &win.x, &win.y, &win.width, &win.height);
gdk_surface_get_origin (surface, &win.x, &win.y);
n_monitors = gdk_display_get_n_monitors (display);
for (i = 0; i < n_monitors; i++)

View File

@@ -80,7 +80,7 @@ GDK_AVAILABLE_IN_ALL
GdkDisplay *gdk_display_get_default (void);
GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_display_get_default_group (GdkDisplay *display);
GdkSurface *gdk_display_get_default_group (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
GdkClipboard * gdk_display_get_clipboard (GdkDisplay *display);
@@ -116,8 +116,8 @@ GdkMonitor * gdk_display_get_monitor_at_point (GdkDisplay *display,
int x,
int y);
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_display_get_monitor_at_window (GdkDisplay *display,
GdkWindow *window);
GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);

View File

@@ -19,7 +19,7 @@
#define __GDK_DISPLAY_PRIVATE_H__
#include "gdkdisplay.h"
#include "gdkwindow.h"
#include "gdksurface.h"
#include "gdkcursor.h"
#include "gdkmonitor.h"
#include "gdkinternals.h"
@@ -40,8 +40,8 @@ typedef struct _GdkDisplayClass GdkDisplayClass;
/* Tracks information about the device grab on this display */
typedef struct
{
GdkWindow *window;
GdkWindow *native_window;
GdkSurface *surface;
GdkSurface *native_surface;
gulong serial_start;
gulong serial_end; /* exclusive, i.e. not active on serial_end */
guint event_mask;
@@ -54,21 +54,21 @@ typedef struct
guint implicit : 1;
} GdkDeviceGrabInfo;
/* Tracks information about which window and position the pointer last was in.
/* Tracks information about which surface and position the pointer last was in.
* This is useful when we need to synthesize events later.
* Note that we track toplevel_under_pointer using enter/leave events,
* so in the case of a grab, either with owner_events==FALSE or with the
* pointer in no clients window the x/y coordinates may actually be outside
* the window.
* pointer in no clients surface the x/y coordinates may actually be outside
* the surface.
*/
typedef struct
{
GdkWindow *window_under_pointer; /* window that last got a normal enter event */
GdkSurface *surface_under_pointer; /* surface that last got a normal enter event */
gdouble toplevel_x, toplevel_y;
guint32 state;
guint32 button;
GdkDevice *last_slave;
} GdkPointerWindowInfo;
} GdkPointerSurfaceInfo;
struct _GdkDisplay
{
@@ -86,7 +86,7 @@ struct _GdkDisplay
GdkClipboard *clipboard;
GdkClipboard *primary_clipboard;
GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
GHashTable *pointers_info; /* GdkPointerSurfaceInfo for each device */
guint32 last_event_time; /* Last reported event time from server */
guint double_click_time; /* Maximum time between clicks in msecs */
@@ -114,7 +114,7 @@ struct _GdkDisplayClass
{
GObjectClass parent_class;
GType window_type; /* type for native windows for this display, set in class_init */
GType surface_type; /* type for native surfaces for this display, set in class_init */
GType vk_context_type; /* type for GdkVulkanContext, must be set if vk_extension_name != NULL */
const char *vk_extension_name; /* Name of required windowing vulkan extension or %NULL (default) if Vulkan isn't supported */
@@ -125,7 +125,7 @@ struct _GdkDisplayClass
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkWindow * (*get_default_group) (GdkDisplay *display);
GdkSurface * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_shapes) (GdkDisplay *display);
gboolean (*supports_input_shapes) (GdkDisplay *display);
@@ -140,11 +140,11 @@ struct _GdkDisplayClass
GdkEvent *new_event);
void (*event_data_free) (GdkDisplay *display,
GdkEvent *event);
void (*create_window_impl) (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
void (*create_surface_impl) (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkSurfaceAttr *attributes);
GdkKeymap * (*get_keymap) (GdkDisplay *display);
@@ -166,8 +166,8 @@ struct _GdkDisplayClass
GdkMonitor * (*get_monitor) (GdkDisplay *display,
int index);
GdkMonitor * (*get_primary_monitor) (GdkDisplay *display);
GdkMonitor * (*get_monitor_at_window) (GdkDisplay *display,
GdkWindow *window);
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
GdkSurface *surface);
gboolean (*get_setting) (GdkDisplay *display,
const char *name,
GValue *value);
@@ -185,7 +185,7 @@ struct _GdkDisplayClass
typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
GdkDevice *device,
GdkPointerWindowInfo *device_info,
GdkPointerSurfaceInfo *device_info,
gpointer user_data);
void _gdk_display_update_last_event (GdkDisplay *display,
@@ -198,8 +198,8 @@ GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
GdkDevice *device);
GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
GdkDevice *device,
GdkWindow *window,
GdkWindow *native_window,
GdkSurface *surface,
GdkSurface *native_surface,
GdkGrabOwnership grab_ownership,
gboolean owner_events,
GdkEventMask event_mask,
@@ -212,12 +212,12 @@ GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display
gboolean _gdk_display_end_device_grab (GdkDisplay *display,
GdkDevice *device,
gulong serial,
GdkWindow *if_child,
GdkSurface *if_child,
gboolean implicit);
gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
GdkDevice *device,
gulong serial);
GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
GdkPointerSurfaceInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
GdkDevice *device);
void _gdk_display_pointer_info_foreach (GdkDisplay *display,
GdkDisplayPointerInfoForeach func,
@@ -230,12 +230,12 @@ 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_window_impl (GdkDisplay *display,
GdkWindow *window,
GdkWindow *real_parent,
void _gdk_display_create_surface_impl (GdkDisplay *display,
GdkSurface *surface,
GdkSurface *real_parent,
GdkEventMask event_mask,
GdkWindowAttr *attributes);
GdkWindow * _gdk_display_create_window (GdkDisplay *display);
GdkSurfaceAttr *attributes);
GdkSurface * _gdk_display_create_surface (GdkDisplay *display);
gboolean gdk_display_make_gl_context_current (GdkDisplay *display,
GdkGLContext *context);

View File

@@ -26,7 +26,7 @@
#include "gdkdndprivate.h"
#include "gdkdisplay.h"
#include "gdkwindow.h"
#include "gdksurface.h"
#include "gdkintl.h"
#include "gdkcontentformats.h"
#include "gdkcontentprovider.h"
@@ -171,35 +171,35 @@ gdk_drag_context_get_selected_action (GdkDragContext *context)
}
/**
* gdk_drag_context_get_source_window:
* gdk_drag_context_get_source_surface:
* @context: a #GdkDragContext
*
* Returns the #GdkWindow where the DND operation started.
* Returns the #GdkSurface where the DND operation started.
*
* Returns: (transfer none): a #GdkWindow
* Returns: (transfer none): a #GdkSurface
**/
GdkWindow *
gdk_drag_context_get_source_window (GdkDragContext *context)
GdkSurface *
gdk_drag_context_get_source_surface (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return context->source_window;
return context->source_surface;
}
/**
* gdk_drag_context_get_dest_window:
* gdk_drag_context_get_dest_surface:
* @context: a #GdkDragContext
*
* Returns the destination window for the DND operation.
* Returns the destination surface for the DND operation.
*
* Returns: (transfer none): a #GdkWindow
* Returns: (transfer none): a #GdkSurface
**/
GdkWindow *
gdk_drag_context_get_dest_window (GdkDragContext *context)
GdkSurface *
gdk_drag_context_get_dest_surface (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
return context->dest_window;
return context->dest_surface;
}
/**
@@ -315,11 +315,11 @@ gdk_drag_context_finalize (GObject *object)
g_clear_object (&context->content);
g_clear_pointer (&context->formats, gdk_content_formats_unref);
if (context->source_window)
g_object_unref (context->source_window);
if (context->source_surface)
g_object_unref (context->source_surface);
if (context->dest_window)
g_object_unref (context->dest_window);
if (context->dest_surface)
g_object_unref (context->dest_surface);
G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
}
@@ -782,25 +782,25 @@ gdk_drop_read_finish (GdkDragContext *context,
}
/**
* gdk_drag_context_get_drag_window:
* gdk_drag_context_get_drag_surface:
* @context: a #GdkDragContext
*
* Returns the window on which the drag icon should be rendered
* during the drag operation. Note that the window may not be
* 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 window in accordance with the ongoing drag operation.
* The window is owned by @context and will be destroyed when
* 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 window, or %NULL
* Returns: (nullable) (transfer none): the drag surface, or %NULL
*/
GdkWindow *
gdk_drag_context_get_drag_window (GdkDragContext *context)
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_window)
return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_window (context);
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface)
return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_drag_surface (context);
return NULL;
}
@@ -808,12 +808,12 @@ gdk_drag_context_get_drag_window (GdkDragContext *context)
/**
* gdk_drag_context_set_hotspot:
* @context: a #GdkDragContext
* @hot_x: x coordinate of the drag window hotspot
* @hot_y: y coordinate of the drag window hotspot
* @hot_x: x coordinate of the drag surface hotspot
* @hot_y: y coordinate of the drag surface hotspot
*
* Sets the position of the drag window that will be kept
* 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 window.
* top left corner of the drag surface.
*/
void
gdk_drag_context_set_hotspot (GdkDragContext *context,

View File

@@ -98,9 +98,9 @@ GDK_AVAILABLE_IN_ALL
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_drag_context_get_source_window (GdkDragContext *context);
GdkSurface *gdk_drag_context_get_source_surface (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_drag_context_get_dest_window (GdkDragContext *context);
GdkSurface *gdk_drag_context_get_dest_surface (GdkDragContext *context);
/* Destination side */
GDK_AVAILABLE_IN_ALL
@@ -132,7 +132,7 @@ GInputStream * gdk_drop_read_finish (GdkDragContext *
/* Source side */
GDK_AVAILABLE_IN_ALL
GdkDragContext * gdk_drag_begin (GdkWindow *window,
GdkDragContext * gdk_drag_begin (GdkSurface *surface,
GdkDevice *device,
GdkContentProvider *content,
GdkDragAction actions,
@@ -147,7 +147,7 @@ void gdk_drag_drop_done (GdkDragContext *context,
gboolean success);
GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_drag_context_get_drag_window (GdkDragContext *context);
GdkSurface *gdk_drag_context_get_drag_surface (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
void gdk_drag_context_set_hotspot (GdkDragContext *context,

View File

@@ -57,7 +57,7 @@ struct _GdkDragContextClass {
GAsyncResult *result,
GError **error);
gboolean (*drop_status) (GdkDragContext *context);
GdkWindow* (*get_drag_window) (GdkDragContext *context);
GdkSurface* (*get_drag_surface) (GdkDragContext *context);
void (*set_hotspot) (GdkDragContext *context,
gint hot_x,
gint hot_y);
@@ -87,9 +87,9 @@ struct _GdkDragContext {
GdkDisplay *display;
gboolean is_source;
GdkWindow *source_window;
GdkWindow *dest_window;
GdkWindow *drag_window;
GdkSurface *source_surface;
GdkSurface *dest_surface;
GdkSurface *drag_surface;
GdkContentProvider *content;
GdkContentFormats *formats;

View File

@@ -36,7 +36,7 @@
*
* You will always interact with one of those s.ubclasses.
*
* A GdkDrawContext is always associated with a single toplevel window.
* A GdkDrawContext is always associated with a single toplevel surface.
*/
/**
@@ -49,7 +49,7 @@
typedef struct _GdkDrawContextPrivate GdkDrawContextPrivate;
struct _GdkDrawContextPrivate {
GdkWindow *window;
GdkSurface *surface;
guint is_drawing : 1;
};
@@ -58,7 +58,7 @@ enum {
PROP_0,
PROP_DISPLAY,
PROP_WINDOW,
PROP_SURFACE,
LAST_PROP
};
@@ -73,7 +73,7 @@ gdk_draw_context_dispose (GObject *gobject)
GdkDrawContext *context = GDK_DRAW_CONTEXT (gobject);
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
g_clear_object (&priv->window);
g_clear_object (&priv->surface);
G_OBJECT_CLASS (gdk_draw_context_parent_class)->dispose (gobject);
}
@@ -89,9 +89,9 @@ gdk_draw_context_set_property (GObject *gobject,
switch (prop_id)
{
case PROP_WINDOW:
priv->window = g_value_dup_object (value);
g_assert (priv->window != NULL);
case PROP_SURFACE:
priv->surface = g_value_dup_object (value);
g_assert (priv->surface != NULL);
break;
default:
@@ -114,8 +114,8 @@ gdk_draw_context_get_property (GObject *gobject,
g_value_set_object (value, gdk_draw_context_get_display (context));
break;
case PROP_WINDOW:
g_value_set_object (value, priv->window);
case PROP_SURFACE:
g_value_set_object (value, priv->surface);
break;
default:
@@ -146,15 +146,15 @@ gdk_draw_context_class_init (GdkDrawContextClass *klass)
G_PARAM_STATIC_STRINGS);
/**
* GdkDrawContext:window:
* GdkDrawContext:surface:
*
* The #GdkWindow the gl context is bound to.
* The #GdkSurface the gl context is bound to.
*/
pspecs[PROP_WINDOW] =
g_param_spec_object ("window",
P_("Window"),
P_("The GDK window bound to the context"),
GDK_TYPE_WINDOW,
pspecs[PROP_SURFACE] =
g_param_spec_object ("surface",
P_("Surface"),
P_("The GDK surface bound to the context"),
GDK_TYPE_SURFACE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -171,8 +171,8 @@ gdk_draw_context_init (GdkDrawContext *self)
* gdk_draw_context_is_drawing:
* @context: a #GdkDrawContext
*
* Returns %TRUE if @context is in the process of drawing to its window. In such
* cases, it will have access to the window's backbuffer to render the new frame
* Returns %TRUE if @context is in the process of drawing to its surface. In such
* cases, it will have access to the surface's backbuffer to render the new frame
* onto it.
*
* Returns: %TRUE if the context is between begin_frame() and end_frame() calls.
@@ -194,7 +194,7 @@ gdk_draw_context_is_drawing (GdkDrawContext *context)
*
* The @context is free to update @region to the size that actually needs to
* be repainted. Contexts that do not support partial blits for example may
* want to invalidate the whole window instead.
* want to invalidate the whole surface instead.
*
* The function does not clear the background. Clearing the backgroud is the
* job of the renderer. The contents of the backbuffer are undefined after this
@@ -257,24 +257,24 @@ gdk_draw_context_get_display (GdkDrawContext *context)
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
return priv->window ? gdk_window_get_display (priv->window) : NULL;
return priv->surface ? gdk_surface_get_display (priv->surface) : NULL;
}
/**
* gdk_draw_context_get_window:
* gdk_draw_context_get_surface:
* @context: a #GdkDrawContext
*
* Retrieves the #GdkWindow used by the @context.
* Retrieves the #GdkSurface used by the @context.
*
* Returns: (nullable) (transfer none): a #GdkWindow or %NULL
* Returns: (nullable) (transfer none): a #GdkSurface or %NULL
*/
GdkWindow *
gdk_draw_context_get_window (GdkDrawContext *context)
GdkSurface *
gdk_draw_context_get_surface (GdkDrawContext *context)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
return priv->window;
return priv->surface;
}

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