Compare commits

...

1822 Commits

Author SHA1 Message Date
Emmanuele Bassi
bb54bc7d14 Add a "devel" CSS theme for our demos
It's useful to know if you're running the demos from an unstable version
of GTK+, so we should use a CSS fragment that updates the visual
identity of gtk-demo and gtk-widget-factory depending on the version of
GTK+ they are running against.
2018-05-08 09:16:53 +01:00
Mohammed Sadiq
772c994fd0 examples: Simplify .ui files
Run gtk4-builder-tool recursively
2018-05-07 22:30:40 +05:30
Mohammed Sadiq
c5976fed9a examples: Fix Makefiles to use gtk4 for build 2018-05-07 22:29:32 +05:30
Benjamin Otte
34d1ebc562 dnd: Make "formats" a construct-only property
... and hide the member variable inside the DragContextPrivate.
2018-05-07 18:55:09 +02:00
Benjamin Otte
80f5fd8435 wayland: Remove stray if
Leftover from d056be4ea2.

I need more sleep when I need to fixup the fixups of my fixups now.
2018-05-07 18:55:09 +02:00
Benjamin Otte
2ce2a80d40 win32: Remove unused file 2018-05-07 18:55:09 +02:00
Benjamin Otte
fa0a44e811 Merge branch 'wip/sadiq/fixes' into 'master'
icon-browser: Fix typo in description

See merge request GNOME/gtk!138
2018-05-07 15:54:26 +00:00
Mohammed Sadiq
67becb4510 icon-browser: Fix typo in description
This is shown as tooltip-text
2018-05-07 20:50:27 +05:30
Benjamin Otte
69644993f6 gsk: Improve GSK_RENDERER behavior
1. Include the broadway renderer (so we can test it properly fails on
   Wayland or X11)
2. List all potential renderers, print useful information when Vulkan
   is not compiled in instea dof omitting it
3. Improve docs
2018-05-07 16:45:32 +02:00
Benjamin Otte
d056be4ea2 wayland: Fix memleak
7f8a8f221d forgot to free the data offer
passed to it.
2018-05-07 16:28:50 +02:00
Matthias Clasen
3c05a6662b Update docs for debug environment variables
Just the usual pre-release doc fixups.
2018-05-07 07:47:18 -04:00
Matthias Clasen
5469bf0773 Document the GSK_RENDERER environment variable
Just the usual pre-release doc fixups.
2018-05-07 07:47:18 -04:00
Matthias Clasen
335a8aa843 Update build docs
Just the usual pre-release doc fixups.
2018-05-07 07:47:18 -04:00
Matthias Clasen
f5a2ab38f3 Miscellaneous docs improvements
Just the usual pre-release doc fixups.
2018-05-07 07:47:18 -04:00
Matthias Clasen
766185bce5 Add GtkWidgetPaintable to the docs
Just the usual pre-release doc fixups.
2018-05-07 07:47:18 -04:00
Matthias Clasen
c7fd3ebbaf Add GdkPaintable to the docs
Just the usual pre-release doc fixups.
2018-05-07 07:47:18 -04:00
Daniel Boles
e1f1fe9ba6 MediaStream: Fix capitalisation of two new %TRUEs 2018-05-06 21:46:30 +01:00
Matthias Clasen
79e54929a2 Add more media docs 2018-05-06 15:57:10 -04:00
Benjamin Otte
7f8a8f221d wayland: Redo DND offer handling
Instead of tracking offers in GdkWaylandSelection objects, track the
pending offer in the GdkWaylandSeat and pass it to the GdkDragContext
once we get an enter event.
2018-05-06 02:10:20 +02:00
Benjamin Otte
03a85ff2a0 gdk: Remove unnecessary assignments
The variable is never read again.
2018-05-06 02:10:20 +02:00
Matthias Clasen
f569717a03 Add media support to docs 2018-05-05 18:28:19 -04:00
Matthias Clasen
7fdf3d1769 Fixes to the gtk docs 2018-05-05 18:03:31 -04:00
Matthias Clasen
702deee799 Add some more content to the migration guide 2018-05-05 13:33:36 -04:00
Matthias Clasen
a34f35d587 More NEWS 2018-05-05 13:33:36 -04:00
Daniel Boles
901aa59b5b GesturePan: Remove widget parameter from docs, too
71991270b0 (note_112519)
2018-05-05 10:51:24 +01:00
Timm Bäder
f6a79559e9 inspector: Don't add controllers to non-window toplevels
That doesn't make sense in this context and breaks grabs.
2018-05-05 09:06:22 +02:00
Timm Bäder
64849426ae inspector: Use unique names for g_object_set_data calls
Otherwise the calls of the different inspector pages might end up
clashing.
2018-05-05 09:05:02 +02:00
Timm Bäder
d1cdb9b5cf widget: Clarify add_tick_callback docs
You don't pass the callback to remove_tick_callback, but the id returned
from add_tick_callback.
2018-05-05 07:39:55 +02:00
Timm Bäder
e379ea617a stylecontext: Draw arrow-less insertion cursors as color nodes
This lets us avoid an often used cairo node.
2018-05-05 07:25:10 +02:00
Timm Bäder
f44959fa59 stylecontext: Remove outdated comment
gtktextview:invalidate_cursor_windwo is no more.
2018-05-05 07:25:10 +02:00
Timm Bäder
af27199102 widget: Directly access priv pointer in even controller API
Spares us a few lines.
2018-05-05 07:25:10 +02:00
Christian Hergert
613f7609c2 build: fix meson.build when quartz is used
We need access to the variable earlier in the file when the quartz
backend is being setup.
2018-05-04 17:46:08 -07:00
Piotr Drąg
0f0be1ee8e Update Polish translation 2018-05-04 21:48:33 +02:00
Matthias Clasen
db095f8cdb Update NEWS 2018-05-04 15:37:48 -04:00
Matthias Clasen
4a72cab818 Document gdk_drop_read_async 2018-05-03 22:04:28 -04:00
Matthias Clasen
e191015aa0 The legacy event controller is still private 2018-05-03 20:45:36 -04:00
Matthias Clasen
45db4a5550 Merge branch 'wip/xdg-shell' into 'master'
xdg shell (stable)

See merge request GNOME/gtk!35
2018-05-04 00:43:01 +00:00
Matthias Clasen
0069de7e75 Merge branch 'altBackspaceEmacs' into 'master'
Add binding for <alt>BackSpace to emacs keys

See merge request GNOME/gtk!96
2018-05-04 00:39:39 +00:00
Matthias Clasen
be2853e5de emoji chooser: Match search terms better
Use g_str_match_string for better results.
2018-05-03 20:36:19 -04:00
Emin Tufan Çetin
0ab4bc80ad Update Turkish translation 2018-05-03 07:04:43 +00:00
Benjamin Otte
35e74a1501 win32: Fix build 2018-05-03 01:56:44 +02:00
Benjamin Otte
eb9105acea dnd: Add a private struct
And put member veriables into it.

Also fix backends to use accessors instead of direct access.
2018-05-03 01:31:40 +02:00
Benjamin Otte
8366ef71c0 dnd: Remove gdk_drop_reply()
It was only necessary for Motif DND, and we don't support that anymore.
2018-05-03 01:31:40 +02:00
Benjamin Otte
fb53568c04 gdk: Remove gdk_drag_grop_succeeded()
It's unused and most backends don't implement it.
2018-05-03 01:31:39 +02:00
Timm Bäder
622a150bb4 snapshot: merge container nodes
A container node inside another container node doesn't make a lot of
sense, we can instead just use the parent container node and add the
child container node's children to it directly.
2018-05-02 19:48:34 +02:00
Timm Bäder
2815054820 recorder: Fix cairo node display
We can only upload image surfaces as a texture but cairo nodes use
recording surfaces now.
2018-05-02 19:48:34 +02:00
Timm Bäder
31e0aaf6b0 gl renderer: Remove ops debug message
Without a node name, this doesn't make much sense anymore.
2018-05-02 19:48:34 +02:00
Matthias Clasen
ee82d73d7a Merge branch 'wip/lantw/gtk4-use-dev-evdev-input-h-on-freebsd' into 'master'
wayland: Use dev/evdev/input.h on FreeBSD (GTK4)

See merge request GNOME/gtk!133
2018-05-02 10:55:38 +00:00
Matthias Clasen
0f4084946a Add missing types to gtk docs 2018-05-01 23:26:28 -04:00
Matthias Clasen
1185b0b447 Add missing types to gdk docs 2018-05-01 23:22:13 -04:00
Ting-Wei Lan
7fed0b74ed wayland: Use dev/evdev/input.h on FreeBSD
The header linux/input.h used by GDK is specific to Linux. It is
possible to get a few Linux headers on FreeBSD by installing v4l_compat,
but it is usually better to use the one shipped with FreeBSD.

We prefer dev/evdev/input.h to linux/input.h here, so it will always use
dev/evdev/input.h on FreeBSD regardless of v4l_compat.

https://svnweb.freebsd.org/changeset/ports/465644
2018-05-01 22:28:57 +08:00
Timm Bäder
d506799e72 gl renderer: Ignore nodes outside of the clip
Pretty sure this will bite me later but for now we avoid rendering nodes
that we are not going to see anyway.
2018-05-01 15:13:11 +02:00
Timm Bäder
3a5a9d9233 gl renderer: Use simple offset for selected offset node children 2018-05-01 15:13:11 +02:00
Timm Bäder
e0205eb27c widget: add shortcut to gtk_widget_set_child_visible
So we don't do unnecessary work when just setting priv->child_visible to
the same value again.
2018-05-01 15:13:11 +02:00
Timm Bäder
a54e5844b6 widget: Don't mention gtk_widget_snapshot() in the docs
It's not public so people can't know about it.
2018-05-01 15:13:11 +02:00
Matthias Clasen
1dcb76bc26 Merge branch 'wip/carlosg/controller' into 'master'
carlosg/controller

See merge request GNOME/gtk!131
2018-05-01 12:35:53 +00:00
Jonas Ådahl
5f19421bc9 wayland: Various whitespace cleanups
Broke up a long line, added an empty one, indented another one, and re-aligned
a large amount of function parameter names that got misaligned in some past
refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=791939
2018-05-01 13:39:42 +02:00
Jonas Ådahl
a40923b03a wayland: Add support for xdg-shell stable
This commit adds support the stable version of the xdg-shell protocol.
Support for the last version of the unstable series is left intact, but
will not receive new features.

The stable version is prioritized above the older version.

https://bugzilla.gnome.org/show_bug.cgi?id=791939
2018-05-01 13:36:38 +02:00
Rico Tzschichholz
2cf55c1686 Fix some g-i annotation warnings 2018-05-01 12:35:32 +02:00
Matthias Clasen
422262436b Fix the modelbutton demo _again_
It lost the action-target properties again.
2018-04-30 20:49:34 -04:00
Emmanuele Bassi
97e43715fb Merge branch 'docs' into 'master'
gitlabci: Add gtk-doc to the container image.

See merge request GNOME/gtk!130
2018-04-30 16:21:21 +00:00
Jordan Petridis
50985d922a gitlabci: Add gtk-doc to the container image. 2018-04-30 19:04:38 +03:00
Benjamin Otte
995b29d8db Merge branch 'lrn/meson-intl' into 'master'
Link libgtk to libintl

See merge request GNOME/gtk!113
2018-04-30 12:25:43 +00:00
Benjamin Otte
5166767e8b Merge branch '169-gtktextview-accesses-already-disposed-object' into 'master'
Resolve "GtkTextView accesses already disposed object"

Closes #169

See merge request GNOME/gtk!109
2018-04-30 11:56:36 +00:00
Mario Blättermann
bf6aafe460 Update German translation 2018-04-30 10:42:41 +00:00
Benjamin Otte
bcb3a32686 Merge branch 'window-activate-grab-4-2.4' into 'master'
gdk: do not deactivate surface on keyboard grab

Closes #85

See merge request GNOME/gtk!120
2018-04-30 09:48:25 +00:00
Samuel Thibault
01455399e8 gdk: do not deactivate surface on keyboard grabs
When pressing e.g. a window manager shortcut, which acquires keyboard grab,
Xorg would send FocusOut NotifyGrab then FocusIn NotifyUngrab.  Currently
gdk would then deactivate the current surface, which makes accessibility
screen readers think that we have switched to a non-accessible application
and came back again, and thus reannounce the application frame etc. which we
don't want when e.g. just raising volume.

And actually, receiving FocusOut NotifyGrab does not mean losing the
X focus, it only means an application aqcuired a grab, i.e. it is
temporarily stealing keyboard events. On Wayland, this isn't even
notified actually.

This commit makes gdk only deactivate surfaces when there was an actual
focus switch to another window, as determined by has_focus_window (instead
of just has_focus), which happens either normally through FocusOut with
NotifyNormal, or during grabs through FocusOut with NotifyWhileGrabbed.

Fixes #85
2018-04-30 10:57:53 +02:00
Matthias Clasen
3684b72121 Misc documentation fixes
Close some gaps in gdk docs.
2018-04-28 22:34:14 -04:00
Matthias Clasen
059a181f7d Document GdkMemoryTexture 2018-04-28 16:22:29 -04:00
Matthias Clasen
a0f591297a More doc build fixes
If only the errors would make it back to stderr.
2018-04-28 16:02:34 -04:00
Matthias Clasen
b20e68cc91 More doc build fixes 2018-04-28 15:07:35 -04:00
Matthias Clasen
6b7be6643a Add offset nodes to the docs 2018-04-28 15:07:35 -04:00
Matthias Clasen
5e2103f7f0 Fix the gdk doc build
GdkDrawingContext no longer exists.
2018-04-28 15:07:35 -04:00
Fabio Tomat
8fecee4e41 Update Friulian translation 2018-04-28 09:19:30 +00:00
Benjamin Otte
4aaeb7de19 dnd: Make GdkDragContext::device a (construct-only) property
Also remove gdk_drag_context_set_device() and insist on backends using
the property.
2018-04-27 14:32:28 +02:00
Benjamin Otte
a86359af2b wayland: Create drop contexts on demand
Instead of creating and reusing the same one from start to finish.
2018-04-27 14:32:28 +02:00
Benjamin Otte
56cc470663 dragsource: Use capture phase for gesture
Otherwise buttons don't work as drag sources, and we like to do that.
2018-04-27 14:32:28 +02:00
Benjamin Otte
aca20dbb78 gtk-demo: Always have at least 1 icon in the fishbowl
When changing the widget type, don't start out with 0 icons.
2018-04-27 14:32:28 +02:00
Kristjan SCHMIDT
3a4238e199 Update Esperanto translation 2018-04-26 23:24:32 +00:00
Руслан Ижбулатов
76855e8999 imcontextsimple: ensure W32 code only runs on W32 displays
gdk_win32_keymap_check_compose() shouldn't be called for
non-W32 displays (i.e. when using broadway or other backends
that could be made to run on Windows).
2018-04-26 17:50:55 +00:00
Carlos Garnacho
3675f9ccb2 gesturestylus: Port to new API model 2018-04-26 17:59:42 +02:00
Carlos Garnacho
15e00759c7 eventcontrollerkey: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
ba7849960e 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-26 17:59:42 +02:00
Benjamin Otte
c5f12a7326 padcontroller: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4f3058f195 eventcontrollermotion: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
74dbb057ed eventcontrollerscroll: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
1e6eb1f8b9 draggesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
bf82149271 longpressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
71991270b0 pangesture: Port to new API model 2018-04-26 17:59:41 +02:00
Benjamin Otte
66223aaa08 swipegesture: Port to new API model 2018-04-26 17:59:41 +02:00
Benjamin Otte
91efa37fcb zoomgesture: Port to new API model 2018-04-26 17:59:41 +02:00
Benjamin Otte
703d5340f1 rotategesture: Port to new API model 2018-04-26 17:59:41 +02:00
Benjamin Otte
6fb92a0ab9 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-26 17:59:41 +02:00
Benjamin Otte
31de97749a filechooser: Put event controllers into ui file 2018-04-26 17:59:41 +02:00
Benjamin Otte
fa97236b62 placesviewrow: Put event controllers into ui file 2018-04-26 17:59:41 +02:00
Benjamin Otte
c2ec738a2e widget-factory: Put gesture into ui file 2018-04-26 17:59:41 +02:00
Benjamin Otte
0d7cf79b00 emojichooser: Put event controllers into ui file 2018-04-26 17:59:41 +02:00
Benjamin Otte
40a082de10 aboutdialog: Put event controllers into ui file 2018-04-26 17:59:41 +02:00
Benjamin Otte
9c0acf62b4 widget: Allow adding event controllers in ui files 2018-04-26 17:59:41 +02:00
Benjamin Otte
9af03fa602 widget: Expose gtk_widget_add_controller()
.. and gtk_widget_remove_controller().
2018-04-26 17:59:41 +02:00
Benjamin Otte
8ddba5ffcd eventcontroller: Move declaration
This is in preparation for exposing APIs in gtkwidget.c
2018-04-26 17:59:41 +02:00
Benjamin Otte
e01e9ce092 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-26 17:59:41 +02:00
Adrian Johnson
b0bb7f3da4 Add gtk_printer_get_hard_margins_for_paper_size
to retreive paper size specific hard margins and use this
to set the hard margins in the print context.
(modified by Marek Kasik <mkasik@redhat.com>)

https://bugzilla.gnome.org/show_bug.cgi?id=686109
2018-04-26 14:19:55 +02:00
Fabio Tomat
9774b9fabd Update Friulian translation 2018-04-26 07:52:37 +00:00
Carlos Garnacho
77f4204bf4 menu: Set up callback with a return function
The function hooked up to the ::key-pressed signal should have
a return value. Pointed out by Peter Bloomfield.
2018-04-25 19:11:21 +02:00
Benjamin Otte
b442277fd4 comboboxtext: GTK_DISABLE_SINGLE_INCLUDES is not a thing
What you don't find when laughing at vcpkg having a CMake build file for
GTK.
2018-04-25 17:18:16 +02:00
Daniel Mustieles
f00361b246 Updated Spanish translation 2018-04-25 13:18:01 +02:00
Carlos Garnacho
aeda2ad049 notebook: Fetch directly current event state/device
gtk_get_current_event() returns a new reference to the event, it should
be freed across various return branches to avoid the event leak, or we
just fetch the little stuff we're interested in.
2018-04-25 02:17:39 +02:00
Carlos Garnacho
23f4724a23 range: Do not unconditionally stop events in event handler
Prevents keybindings from working on scales.
2018-04-25 02:16:35 +02:00
Carlos Garnacho
0547c0999f combobox: Do not unconditionally stop events in event handler
Prevents combobox menus from being closed.
2018-04-25 02:16:05 +02:00
Benjamin Otte
ae7a677346 cairocontext: Remove fallback implementations
Now that all Cairo contexts are ported to managing cairo surfaces
themselves, the old fallback code that didi the managing is no longer
needed.

Also clarify the behavior of gdk_cairo_context_cairo_create() wrt the
vfunc by doing the early exit and the clipping outside of it.
2018-04-24 23:24:55 +02:00
Руслан Ижбулатов
7002f08cc1 GDK W32: Switch to GdkCairoContext
* Remove DC refcounting (we trust GDK to always do
  begin_frame/end_frame calls in pairs)
* Now that there's no GDK-provided double-buffer up the stack,
  double-buffering is implemented here
  (though it's disabled by default - in my tests it didn't provide
   any visual improvements, but did decrease performance).
* For some reason delaying window resizes until the point where
  we need to blit the double-buffer into the window leads
  to visual glitches, so doulbe-buffered windows are resized
  in begin_frame, same as non-double-buffered ones.
* New code to clear the paint region, for all drawing modes.
  Hopefully, it isn't duplicated anywhere up the stack.
* GL has its own context now, so remove any GL-related comments.
* Layered windows are still used (because cairo actually works
  better with them)
* A bit more code re-use for layered windows
* Some functions that were local to gdksurface-win32.c are made
  usable for the whole backend
* Drag-indicator drawing is temporarily commented out to match
  a similar change in X11 backend
2018-04-24 23:24:55 +02:00
Alexander Larsson
8c5d31d11d broadway: Handle offset nodes 2018-04-24 23:24:55 +02:00
Alexander Larsson
b554f4be20 broadway: Handle cairo nodes of type recording surface 2018-04-24 23:24:55 +02:00
Alexander Larsson
a329de63ea broadway: Add and use GdkBroadwayDrawContext 2018-04-24 23:24:55 +02:00
Alexander Larsson
99c46f263e broadway: Add basic GdkCairoContext implementation 2018-04-24 23:17:14 +02:00
Alexander Larsson
9421cb8b3a broadway: Call _gdk_surface_update_size when resizing surface 2018-04-24 23:17:14 +02:00
Benjamin Otte
83ea0b3714 drawcontext: Only pass the region that matters
We used to pass 2 regions to GdkDrawCotnext.end_frame() but code was
confusing what they meant. So we now don't do that anymore and only pass
the region that matters: The frame region.
2018-04-24 23:16:58 +02:00
Benjamin Otte
fd686afeb2 drawcontext: Add gdk_draw_context_in_frame() API
This makes the previous gdk_draw_context_is_drawing() function public
under a new name.

I decided against the old name because we use the term "frame" for a
drawing operation, so I wanted to have this boolean flag reuse the term.
2018-04-24 23:16:58 +02:00
Benjamin Otte
6aa89f2163 drawcontext: Move variable into private struct
... and get rid of duplicate variable in the process.
2018-04-24 23:16:58 +02:00
Benjamin Otte
a865621519 gdk: Move begin/end_frame() functions
As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.

As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.
2018-04-24 23:16:58 +02:00
Benjamin Otte
48fc18c37b gdk: Get rid of GdkDrawingContext
All information is kept in GdkDrawContext these days, so use that one.
2018-04-24 23:16:58 +02:00
Benjamin Otte
c6ae0ff2d1 gdk: Get rid of gdk_drawing_context_get_clip()
Use the identical gdk_draw_context_get_frame_region() instead.
2018-04-24 23:16:58 +02:00
Benjamin Otte
dbe4f1d766 gdk: Add gdk_draw_context_get_frame_region()
This does the same as gdk_drawing_context_get_clip().
2018-04-24 23:16:58 +02:00
Benjamin Otte
e7d6648f46 gdk: Remove gdk_gl_context_get_damage()
Remove it only form public API, because we still use the vfunc to figure
out the damage area in begin_frame().
2018-04-24 23:16:58 +02:00
Benjamin Otte
4d481ecb95 gsk: Refactor damage computation for GL renderer
Previously, we got the damage, then computed the changed area, then
started a frame with that changed area.

But starting a frame computes the damage for us.

So now we start a frame, then get the damage area from that, then
compute the change area.
2018-04-24 23:16:58 +02:00
Benjamin Otte
4aac0760b3 wayland: Rewrite Cairo rendering
Also, split it into its own file - which was the original reason for
looking at this code, the rewrite was an unintentional side effect.

This changes the context to create surfaces on demand.
So whenever the compositor holds onto a surface while GDK wants to
render, it just creates a new surface. If the compositor releases
surfaces, we will retain one for the next frame to be rendered, but free
all extra ones.
This way, we should get to a stage where we have exactly as many
surfaces as needed and never allocate/free any.
2018-04-24 23:16:58 +02:00
Benjamin Otte
03e6cefe73 x11: Move implementation of Cairo context backends
Also, don't implement SurfaceClass.ref_cairo_surface() anymore. This
means calls to it will crash now. But as they only happen in the generic
GdkCairoContext implementation, we shouldn't be affected by that.

Plus, once all backends have been ported, that call is going away
anyway.
2018-04-24 23:16:13 +02:00
Benjamin Otte
c48d78525e surface: Merge function into only caller 2018-04-24 23:16:13 +02:00
Benjamin Otte
899674d445 gdk: Remove GDK_DEBUG=cairo-image
This is the default now - at least until cairo rendering gets split
into backends.
2018-04-24 23:16:13 +02:00
Benjamin Otte
54a83d0288 surface: Fold function into only user 2018-04-24 23:16:12 +02:00
Benjamin Otte
7a6871ea5f cairocontext: Turn cairo_create() function into a vfunc 2018-04-24 23:16:12 +02:00
Benjamin Otte
a6553b0e20 gdk: Remove unused GL setting 2018-04-24 23:16:12 +02:00
Benjamin Otte
813e9c95fb gdk: Add Cairo context implementations for all backends
And make the GdkCairoContext as abstract.

The idea of this and thje following commits is to get rid of all
Cairo code in gdksurface.c (and $backend/gdksurface-$backend.c)
by moving that code into the Cairo context files.
In particular, the GdkSurfaceClass.begin_frame/end_frame()
functions (which are currently exclusively used by the Cairo code
should end up being moved to GdkDrawContextClass.begin/end_frame().

This has multiple benefits:

1. It unifies code between the different drawing contexts.
   GL lives in GLContext, Vulkan in VulkanContext and Cairo in
   CairoContext. In turn, this makes it way easier to reason about
   what's going on in surface-specific code. Currently pretty much
   all backends do things wrong when they want to sync to drawing
   or to the frame clock.

2. It makes the API of GdkSurface smaller. No drawing code (apart
   from creating the contexts) needs to remain.

3. It confines Cairo to the Drawcontext, thereby making it way
   more obvious when backends are still using it in situations
   where it may now conflict with OpenGL (like when doing the dnd
   failed animation or in the APIs that I'm removing in this
   branch).

4. We have 2 very different types of Cairo contexts: The X/win32
   model, where we have a natively supported Cairo backend but do
   double buffering ourselves and use similar surfaces and the
   Wayland/Broadway model where we use image surfaces without any
   Cairo backend support and have to submit the buffers manually.
   By not sharing code between those 2 versions, we can make the
   actual code way smaller. We also get around the need to create
   1x1 image surfaces in the Wayland backend where we pretend
   there's a native Cairo surface.
2018-04-24 23:16:12 +02:00
Benjamin Otte
a83487a0c4 cairocontext: Move a function
A function of GdkDrawingContext is only used when drawing with Cairo, so
move it to GdkCairoContext.
2018-04-24 23:16:12 +02:00
Benjamin Otte
52de880c1c gdk: Move Cairo code from surface to CairoContext
This just moves code, no actual changes to functionality are happening.
2018-04-24 23:16:12 +02:00
Benjamin Otte
f396786051 gdk: Add GdkCairoContext
This does nothing but disallow passing NULL to gdk_surface_begin_paint()
and instead require this context.

The ultimate goal is to split out Cairo drawing into its own source file
so it doesn't clutter up the generic rendering path.
2018-04-24 23:16:12 +02:00
Benjamin Otte
2210b9a302 gtk-demo: Merge widgetbowl into fishbowl 2018-04-24 21:55:37 +02:00
Benjamin Otte
aa2f415283 demo: Clean up GtkFishbowl widget
1. Remove set_icons property
2. Make it a GtkWidget subclass
3. Add gtk_fishbowl_set_creation_func()
4. Make the widgetbowl use the new benchmarking infrastructure of the
   fishbowl
2018-04-24 21:55:37 +02:00
Benjamin Otte
db5b8ca997 demo: Move benchmarking implementation to fishbowl widget 2018-04-24 21:55:37 +02:00
Kristjan SCHMIDT
8756748525 Update Esperanto translation 2018-04-24 19:17:30 +00:00
Daniel Boles
1e5c79ed47 testentrycompletion: Use the model we already got
cherry-pick of gtk-3-22 commit af350b20b1
2018-04-24 13:45:49 +01:00
Stas Solovey
dbdd3bf179 Update Russian translation 2018-04-24 10:32:36 +00:00
Benjamin Otte
1e0eed79b5 snapshot: Get rid of record_nodes flag
Instead, use GTK_DEBUG=snapshot for it.
2018-04-24 04:06:58 +02:00
Benjamin Otte
b49dccb86d rendernode: Remove gsk_render_node_set_name()
And of course, gsk_render_node_get_name() is gone, too.
The replacement is of course debug nodes.

As a side effect, GskRenderNode is now *really* immutable.
2018-04-24 04:06:58 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Benjamin Otte
49f9d2108d gsk: Add GskDebugNode 2018-04-24 04:06:58 +02:00
Matthias Clasen
29d77be03f Merge branch 'wip/matthiasc/emoji-picker' into 'master'
Wip/matthiasc/emoji picker

See merge request GNOME/gtk!115
2018-04-24 00:38:20 +00:00
Matthias Clasen
8be12a2427 Drop Ctrl-Shift-e support
Now that we have Emoji completion, drop the rather limited
Ctrl-Shift-e support in GtkIMContextSimple, and leave this
sequence to input methods.
2018-04-23 18:54:43 -04:00
Matthias Clasen
f0f2dd743f widget-factory: add emoji completion to an entry 2018-04-23 18:54:43 -04:00
Matthias Clasen
5d80086470 entry: Add emoji completion
Pop up completions when the text in the entry matches :word:
This functionality has to be enabled using the enable-emoji-completion
property.
2018-04-23 18:54:43 -04:00
Matthias Clasen
1104a8fdb7 Add an emoji completion popup
This widget provides entry completion-like functionality
for Emoji codes like 😁 or 💋.
2018-04-23 18:54:43 -04:00
Matthias Clasen
e283ed5523 Export some entry functions privately
This will be used in the following commits.
2018-04-23 18:54:43 -04:00
Emmanuele Bassi
3f307c59bd wayland: Allow a NULL inhibitors hash table
The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
2a87caf529 gtk-demo, testgtk: Don't pass an integer to fabs
It looks like a mistake which compilers are likely to warn.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
f57c1a2901 imcontextxim: Don't assign a variable to itself
This causes clang to show warnings.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
1517114d9f Fix header guards
They were found by clang.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
48af688940 build: Use cc.links to check linker arguments
Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.
2018-04-23 18:54:43 -04:00
Ting-Wei Lan
e882db2763 build: Make the default setting work on non-Linux Unix-like systems
All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.
2018-04-23 18:54:43 -04:00
Daniel Mustieles
7bb98674d0 Update Spanish translation 2018-04-23 14:18:20 +00:00
Emmanuele Bassi
fc57d3b5a3 wayland: Allow a NULL inhibitors hash table
The shortcuts inhibitors hash table is created when we create a
GdkWaylandWindow implementation for a GdkWindow, and it's destroyed once
we finalize the instance. The fake "root" window we create for the
Wayland display does not have a backing native window, so the shortcuts
inhibitors hash table is set to NULL; this causes a critical error
message when calling g_hash_table_destroy() on it. The finalization of
the root window happens when we close a display connection.

We should use g_clear_pointer(), instead, as it's NULL safe.

Without this change, the displayclose test fails, as all warnings are
considered fatal.
2018-04-23 10:57:07 +01:00
Matthias Clasen
9178f74067 Merge branch 'wip/lantw/improve-freebsd-build-and-fix-warnings' into 'master'
Improve meson.build for FreeBSD and reduce the number of warnings during compilation

See merge request GNOME/gtk!123
2018-04-23 02:40:00 +00:00
Daniel Boles
e6deaa3a85 Widget: Add missing space in new warning 2018-04-22 23:12:18 +01:00
Daniel Boles
5c152192d7 themes: Fix a new comment
bah.
2018-04-22 22:21:35 +01:00
Daniel Boles
b92e688141 themes: Fix swapped borders on RTL PathBar buttons
.linked assumes the container is a GtkBox, which is documented as never
flipping children in RTL, so :first-child is always the left child, etc.
GtkBox does that by reordering its CSS nodes when the direction changes.

But most widgets don’t do that, so :first|last-child are 1st/last ADDED
and swap sides in RTL. GtkPathBar is so, and ignoring that in our themes
meant that in RTL, its left/right buttons got each other’s borders. Yuk!

This patch adds the groundwork for supporting widgets like that, via the
%linked_flippable placeholder, and applies that to override buttons in
  filechooser .path-bar.linked > button
so that the correct borders get applied to those buttons when using RTL.

Note that I select only PathBars within a FileChooser because we also
have NautilusPathBar, which also uses widget.path-bar – but *does* flip
its nodes for RTL already, so letting that get affected broke it again!

https://bugzilla.gnome.org/show_bug.cgi?id=772817
2018-04-22 22:06:50 +01:00
Daniel Boles
0401e031ad CheckMenuItem: Fix insert_after|before() here too
See the previous commit.

There may be other cases of these being swapped by Gadget conversions,
but hopefully someone else will find and fix those before I have to…

Close https://gitlab.gnome.org/GNOME/gtk/issues/200
2018-04-22 21:51:10 +01:00
Daniel Boles
95f65da038 MenuItem: Fix broken args to insert_before|after()
The widget & its parent were swapped to each other’s place in the calls.

https://gitlab.gnome.org/GNOME/gtk/issues/200
2018-04-22 21:49:41 +01:00
Daniel Boles
f36c8c219c Widget: Show widget name/addrs if fail to reparent
so we can more easily get an idea of where the problematic code is

https://gitlab.gnome.org/GNOME/gtk/issues/200
2018-04-22 21:49:41 +01:00
Daniel Boles
ae14fa4efd Widget: Trivially fix arg name in non-doc comment 2018-04-22 21:40:20 +01:00
Daniel Boles
5f7191b31a MenuButton: popover connects to menu_deactivate_cb
This was missed (even before my recent patches).

https://gitlab.gnome.org/GNOME/gtk/issues/199
2018-04-22 16:33:26 +01:00
Daniel Boles
279344a2e6 MenuButton: Disconnect newly added signal handler
Otherwise, we do stuff we shouldn't, as the failing pipeline showed:
https://gitlab.gnome.org/GNOME/gtk/pipelines/9431

https://gitlab.gnome.org/GNOME/gtk/issues/199
2018-04-22 16:33:26 +01:00
Daniel Boles
f403a311c9 MenuButton: Clarify NULL popup/over/menu/model doc 2018-04-22 16:11:18 +01:00
Daniel Boles
caa9255dd3 MenuButton: Drop ref to Popover on its ::destroy
Otherwise, if the Popover is destroyed before the MenuButton, the latter
still had a non-NULL but invalid instance and tried to use it in dispose

Close https://gitlab.gnome.org/GNOME/gtk/issues/199
2018-04-22 16:11:18 +01:00
Daniel Boles
1d636dc8d4 Entry: Show optional style classes in node diagram 2018-04-22 16:11:09 +01:00
Juan Pablo Ugarte
bc2fad6842 a11y/ScrolledWin|IconView: Connect signals safely
Use g_signal_connect_data() instead of g_signal_connect_object()
to make sure the callback gets disconnected when the data object
is destroyed. This avoids problems in garbage-collected bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=789215
2018-04-22 16:11:08 +01:00
Piotr Drąg
bef44a0c9d Update Polish translation 2018-04-22 16:13:56 +02:00
Ting-Wei Lan
43a7f36993 gtk-demo, testgtk: Don't pass an integer to fabs
It looks like a mistake which compilers are likely to warn.
2018-04-22 21:59:13 +08:00
Ting-Wei Lan
d3f40dc771 imcontextxim: Don't assign a variable to itself
This causes clang to show warnings.
2018-04-22 21:57:10 +08:00
Ting-Wei Lan
77637dc73b Fix header guards
They were found by clang.
2018-04-22 21:57:10 +08:00
Ting-Wei Lan
ff1dd5009c build: Use cc.links to check linker arguments
Instead of hard-coding linker flags for a specific operating system and
a specific compiler, we can should cc.links to test them, so they can be
used on more operating systems and compilers.
2018-04-22 21:57:10 +08:00
Ting-Wei Lan
f922109a9c build: Make the default setting work on non-Linux Unix-like systems
All of the four platform-dependent backends are enabled by default. It
is usually a good default because it requires users to explicitly choose
backends they want to use. Rules in meson.build also automatically
disable unavailable backends for macOS, Windows, Linux, so users on
these 3 major platforms don't have to manually disable things when
running meson commands.

However, meson.build doesn't do the same thing for other Unix-like
systems, which is acceptable but not ideal. To make it easier to build
GTK+ on these systems, the Linux case, which enables X11 and Wayland and
disables Win32 and Quartz, is made the default for all operating systems
that are not Windows or macOS.

This commit also changes most 'host_machine.system()' calls to os_*
variables, which are easier to read and less likely to be used wrongly.
2018-04-22 21:57:10 +08:00
Benjamin Otte
7a09cd4cda widget: Position changes don't require a redraw
Well, they don't require a redraw of the widget, because the widget
itself didn't change.
They require a redraw of the parent, because that now displays the
widget in a different position.

And this means we can keep the cache of the widget's render node.

My fishbowl numbers are through the roof^W water surface. Vulkan gets
4000 now.
2018-04-22 02:57:47 +02:00
Benjamin Otte
c5bcc47ce7 demo: Don't add more icons all the time
If adding new icons takes longer than a second, the frame clock should
run before we add even more icons...
2018-04-22 02:57:47 +02:00
Timm Bäder
8d11e7685a build: Remove 'name' kwarg from has_function calls
They cause warnings with later meson versions.
2018-04-21 19:30:12 +02:00
Timm Bäder
f483fd539e build: Fix copy/paste error 2018-04-21 19:24:25 +02:00
Timm Bäder
5b453ecd19 Always use #ifdef for G_ENABLE_DEBUG
Release builds don't define it to 0, they just don't define it. Avoid
the compilation warning we get otherwise.
2018-04-21 19:18:20 +02:00
Timm Bäder
9b8ff8d6c3 sizerequestcache: Directly initialize some locals
Declaring them and initializing them in the same block of code without
an empty line in between is really just confusing.
2018-04-21 19:06:54 +02:00
Timm Bäder
1313234ae0 Use inlined gtk_widget_get_display version in a few places
We can safely do this whenever we already made sure that the given
pointer is a valid GtkWidget.
2018-04-21 19:06:21 +02:00
Timm Bäder
c3e02b2b22 widget: Add static inline version of gtk_widget_display()
Due to the few type checks in gtk_widget_get_display(), it was the
slowest part of a call to gtk_widget_query_size_for_orientation if the
in case of a cache hit.
2018-04-21 18:48:15 +02:00
Timm Bäder
1a24a360bd textview: Remove handling_key_event flag
It's not used anymore.
2018-04-21 15:45:47 +02:00
Timm Bäder
4f3c7cd48a gsk: Make gsk_text_node_new_with_bounds private
We pulled out the bounds calculation for performance reasons, but the
caller can't know how to properly compute them. Inside gtk+, we can do
that but it's not good enough for public API.
2018-04-21 11:20:15 +02:00
Timm Bäder
d74be1fcf0 gl renderer: Rename texture_id parameter to fbo_id
So this makes sense again.
2018-04-21 10:13:16 +02:00
Timm Bäder
ac268b1c5d widget: Use get_instance_private more often
To be more consistent with newer code. We can also save a few lines here
and there by pulling the priv initialization before the precondition
checks.
2018-04-21 10:06:57 +02:00
Timm Bäder
fae1bbb3fe sizerequestcache: Constify some locals
Make it clear that we only use them for lookups here.
2018-04-21 10:06:57 +02:00
Timm Bäder
bd855c11ab sizerequestcache: Use int instead of gint 2018-04-21 10:06:57 +02:00
Timm Bäder
bb412cdda1 sizerequest: Pull locals in closest scope 2018-04-21 10:06:57 +02:00
Timm Bäder
840504b60a snapshot: Fix some documentation problems 2018-04-21 10:06:57 +02:00
Timm Bäder
c948c9e51d viewport: Remove useless import
Just a debugging remnant
2018-04-21 10:06:57 +02:00
Timm Bäder
746c9dc278 viewport: Remove outdated comment 2018-04-21 10:06:57 +02:00
Timm Bäder
29f38056a9 gl renderer: Fix fallback node scaling 2018-04-21 10:06:57 +02:00
Matthias Clasen
cfa04805a3 Merge branch 'print-deserialize' into 'master'
printing: Be more careful when deserializing

See merge request GNOME/gtk!121
2018-04-20 21:37:13 +00:00
Matthias Clasen
6f4a77bb3c printing: Be more careful when deserializing
The GVariant we are getting here might not be coming
from GTK+, but rather from some other source. Best to
be forgiving and deal with missing data without crashing.

This was causing the GTK+ portal backends to crash on
print requests from Qt.
2018-04-20 16:58:36 -04:00
Daniel Mustieles
09037b261e Updated Spanish translation 2018-04-20 11:42:22 +02:00
Daniel Mustieles
9d746d4ec4 Revert "Update Spanish translation"
This reverts commit 8570d33e08.
2018-04-19 16:13:15 +02:00
Marco Trevisan (Treviño)
c15b64b720 stack: protect set_visible_child_name from NULL stack
Return with error if gtk_stack_set_visible_child_name is called
with NULL parameter


(cherry picked from commit 2ee5aee4a9)
2018-04-19 08:40:17 +00:00
Emmanuele Bassi
e30176a522 Merge branch 'gtkplacesview-finalization-fixes-master' into 'master'
Gtkplacesview finalization fixes

See merge request GNOME/gtk!119
2018-04-19 08:24:49 +00:00
Marco Trevisan (Treviño)
4900c3eb3b gtkplacesview: disconnect from server list monitor changes on destroy
It might happen otherwise that a change is recorded in between the
widget dispose and finalization, causing a crash when setting
the visible name for the GtkStack (as that will be NULL at that point)
2018-04-19 02:59:52 -05:00
Marco Trevisan (Treviño)
f9452957cd gtkplacesview: unset entry_pulse_timeout_id before removing it
Fixes a warning on widget finalize, when trying to remove an invalid
source.
2018-04-19 02:59:43 -05:00
Daniel Boles
06a1477f80 Scale: Document new optional classes on value node 2018-04-18 22:59:19 +01:00
Daniel Boles
45c8c8f934 Range: Make down/up keys act like down/up scrolls
Before now, down/up keys on H Ranges would increase/decrease value resp,
which is unintuitive & worse, contradicts what we already do for scrolls

Fix simply by moving to the new should_invert_move() as scrolls just did
– which also gets us the other benefits explained in the last 2 commits.

https://bugzilla.gnome.org/show_bug.cgi?id=407242
https://bugzilla.gnome.org/show_bug.cgi?id=791802
2018-04-18 18:36:55 +01:00
Daniel Boles
6985dde320 Range: Use should_invert_move() to scroll value
This fixes RTL and/or :inverted Ranges responding to a horizontal scroll
by moving the value/slider button in the opposite direction... See prev.

https://bugzilla.gnome.org/show_bug.cgi?id=791802
2018-04-18 18:36:55 +01:00
Daniel Boles
bc2a38a59e Range: Add should_invert_move() for scrolls & keys
This will be used in subsequent commits to fix the sign by which the
value is changed in response to directional scroll or keypress events.

The idea is: you have a movement to make – in the form of a delta that
follows widget directions, i.e. −1 means left or up, +1 means right or
down – and you want to know whether that delta needs to be inverted in
order to produce the intuitively expected directional change of :value.

The existing should_invert() is not sufficient: it just determines
whether to invert visually, but we need more nuance than that for input.

To answer that – while not doubling up the work for scrolls and keys – I
add a helper should_invert_move(), which considers other relevant state:

 • A parallel movement on priv->orientation should just use the existing
   should_invert(), which already worked OK for this case (not others).

 • Movements on the other orientation now depend on priv->orientation:

    ◦ For a horizontal Range, always invert, so up (i.e. −ve in terms of
      widget coords) always means increase value & vice-versa. This was
      done in get_wheel_delta(), but move it here for use with keys too.

    ◦ For a vertical Range, ignore :invert as it’s only relevant to the
      parallel orientation. Do not care about text direction here either
      as RTL locales do not invert number lines, Cartesian plots, etc.

This returns TRUE if the delta should be inverted before applying to the
value, and we can now use this function in both scroll and key handlers.

https://bugzilla.gnome.org/show_bug.cgi?id=407242
https://bugzilla.gnome.org/show_bug.cgi?id=791802
2018-04-18 18:36:09 +01:00
Benjamin Otte
2db43edbd6 snapshot: Don't handle clip anymore
If widgets want to clip things, they now need to do it themselves.

By not taking care of clip, we avoid the need to track clip. And by not
tracking clip, we can avoid all unnecessary cache invalidations that we
were doing for render nodes whenever the clip changed.

And when you are scrolling, the clip changes *a lot*.
2018-04-17 23:21:37 +02:00
Daniel Boles
3b2a03367c MenuShell: Avoid compiler warning re un/signed cmp
priv->button is a guint, but we assigned it to a local gint.

gtk/gtkmenushell.c:734:37: warning: comparison between signed and
  unsigned integer expressions [-Wsign-compare]
           if (button && (new_button != button) && priv->parent_menu_shell)
                                     ^
2018-04-17 20:53:48 +01:00
Daniel Boles
d13e78831b Menu|Item: Fix FIXME re non-const interned strings
These are members of the private struct, so it hurts no one to fix this.
2018-04-17 20:53:48 +01:00
Daniel Boles
4fae962a03 Menu: Remove redundant typecheck in private func
Everything that calls this already ensured we are a valid GtkMenu.
2018-04-17 20:40:21 +01:00
Daniel Boles
8fd0ee96a6 Menu: Update @accel_path annotation/description 2018-04-17 20:40:21 +01:00
Daniel Boles
48472a4b04 Menu: Typecheck AccelGroup passed via public API 2018-04-17 20:40:21 +01:00
Daniel Boles
24953ab1be Menu: Typecheck before dereferencing to get ->priv 2018-04-17 20:40:21 +01:00
Daniel Boles
2a7e5d5137 MenuShell: Sanitise take_focus bool via public API
We store in priv then compare it later, so better make sure it’s 0 or 1.
2018-04-17 20:40:21 +01:00
Daniel Boles
f6ba206d07 MenuShell: Typecheck the instance @ select_first()
since this is public API and therefore might get junk passed to it.
2018-04-17 20:21:05 +01:00
Daniel Boles
331f9762cc CellRenderer: Link to CellEditable.start_editing()
...from CellRenderer::start-editing, to point people in the direction of
info about the lifecycle of the Editable and how to do generic setup.

https://gitlab.gnome.org/GNOME/gtk/issues/154
2018-04-17 19:07:39 +01:00
Daniel Boles
aaf2e30a48 CellRenderer: Clarify doc of .start_editing()
Drop the line copied from .activate(), replace it with a description of
what this method actually does, and explain what a NULL result means.

https://gitlab.gnome.org/GNOME/gtk/issues/154
2018-04-17 19:07:39 +01:00
Daniel Boles
50feed4c28 CellRenderer: Entry is not the only CellEditable
so link to GtkCellEditable and note that GtkEntry is just one example.
2018-04-17 19:07:39 +01:00
Daniel Boles
0fd9362e91 CellRenderer|Editable: Don't @See_also subclasses
The documentation knows that from the inheritance hierarchy, without us
having to manually duplicate that info here. Link to each other instead.
2018-04-17 19:07:39 +01:00
Daniel Boles
bdb7815b0c CellEditable: Clarify doc on lifecycle of editable
* Note in the intro that we're really thinking about temporary widgets
* Mention a gotcha regarding GtkEntry and how ::focus-out stops editing
* Give some examples of what you'd want to do in ::editing-done
* Be a bit more precise about what ::remove-widget represents
* Summarise the lifecycle between Renderer/Editable in .start_editing()
* Emphasise again there that this should be viewed as a temporary widget

https://gitlab.gnome.org/GNOME/gtk/issues/154
2018-04-17 19:07:39 +01:00
Daniel Boles
59a8ffd35e CellEditable: Move arg description to right place
Move it from the body to the argument line, and while there, update
the deprecated (allow-none) to (nullable).
2018-04-17 19:07:39 +01:00
Daniel Boles
44682256a9 CellEditable: Fix grammar error in doc synopsis 2018-04-17 19:07:39 +01:00
Christoph Reiter
5b2153ad38 ci: move the docker image to gitlab.gnome.org 2018-04-17 19:09:34 +02:00
Daniel Mustieles
8570d33e08 Update Spanish translation 2018-04-17 16:25:45 +00:00
Marek Kasik
0abf8efd2f TextView: Don't access already disposed text mark
Instead of asking of TextMark for its buffer,
let's reference also the buffer in the SelectionData.

Closes #169
2018-04-17 16:01:54 +02:00
Emmanuele Bassi
e23b65e434 Add an issue template for crashers
Better to have separate templates than a large, "choose your own
adventure" one.
2018-04-17 09:39:31 +01:00
gogo
4bb48212a6 Update Croatian translation 2018-04-16 19:09:18 +00:00
Matthias Clasen
8b188c9b41 Merge branch 'code-owners' into 'master'
docs: Start defining the owners of code sections

See merge request GNOME/gtk!116
2018-04-16 16:38:50 +00:00
Emmanuele Bassi
0b4bfd5c93 docs: Start defining the owners of code sections
When filing a new merge request it's often hard to know who to ask for a
review; using the Git log doesn't always help — the person that touched
a file last may just be fixing the build or a compiler warning.

The `CODE-OWNERS` file format is something that GitHub uses in order to
pre-fill the list of reviewers:

  https://help.github.com/articles/about-codeowners/

Ideally, in the future, we'll be able to use this file with a bot like
homu to automatically go through newly filed merge requests and
automatically ask the relevant people for reviews, instead of doing this
manually.
2018-04-16 16:06:33 +01:00
gogo
d79f1fdbce Update Croatian translation 2018-04-16 13:45:29 +00:00
Christoph Reiter
f4857da08f ci: remove allow_failure from flatpak jobs again
It was added in 814b7d7bb7 due to too old wayland in the runtime.
5b160efc76 fixed it by bundling a newer wayland.
2018-04-16 11:54:47 +02:00
Matthias Clasen
3e9a68be83 No need to clear GTK_MODULES anymore
Not a variable we care about nowadays.
2018-04-15 22:03:50 -04:00
Matthias Clasen
651e7aa6a1 Spruce up config summary
Show all the options. Nothing to hide.
2018-04-15 22:03:38 -04:00
Matthias Clasen
5b160efc76 flatpak: Bundle wayland for now
We need a newer wayland than is available in the runtime
currently, so use the power of flatpak and bundle it.
2018-04-15 17:45:45 -04:00
Timm Bäder
b0e9dc4723 tooltip: Ignore events with pressed buttons
We dont' want to show tooltips in those cases.
2018-04-15 17:12:01 +02:00
Timm Bäder
4336c6412a gl renderer: Remove unused viewport member 2018-04-15 17:12:01 +02:00
Timm Bäder
172b0e7ea0 frame: Use underscores in widgets ids in the docs
They will work in composite widget templates this way.
2018-04-15 17:12:01 +02:00
Timm Bäder
bf08537885 frame: Remove priv pointer 2018-04-15 17:12:01 +02:00
Timm Bäder
be77e0d500 frame: Stop saving label and child allocation
We don't use them for anything anymore.
2018-04-15 17:12:01 +02:00
Timm Bäder
2f95b4dd70 Remove gtk_render_icon_surface
As part of removing all the cairo_surace_t usage. There's still
gtk_render_icon for the same purpose that takes a GdkTexture*
2018-04-15 17:12:01 +02:00
Timm Bäder
4b02982e1c widget: Use _set_has_tooltip everywhere
real_set_has_tooltip sounds like it's a vfunc implementation, but it
wasn't. The force parameter was also useless so just remove that.
2018-04-15 17:12:01 +02:00
Timm Bäder
914656b8b6 widget: Use priv pointer directly 2018-04-15 17:12:01 +02:00
Timm Bäder
5f02caf09b widget: Update docs to mention ::draw less 2018-04-15 17:12:01 +02:00
Christoph Reiter
3da9543b63 Revert "ci: Enable the a11y test suite"
This reverts commit 968a8e1cf0.

things still fail in the gitlab runner
2018-04-15 05:48:59 +02:00
Matthias Clasen
d48084dad9 font chooser: Allow tweaking fractions
This makes some sense, and frac is meant to be set globally.
2018-04-14 20:28:27 -04:00
Emmanuele Bassi
968a8e1cf0 ci: Enable the a11y test suite
The accessibility test suite only performs internal validation.
2018-04-14 16:15:52 +01:00
Emmanuele Bassi
e36adbac04 tests: Update the expected a11y dump results
Keep in sync with the current tree.

The changes are mostly caused by updates in the internal hierarchy of
composite widgets, and the fact that the order in which the widget tree
is traversed is not exactly stable.
2018-04-14 16:14:36 +01:00
Emmanuele Bassi
7bd5f8f69c tests: Split out the accessibility dump tests
Instead of having a single massive test running through the a11y
directory, we can split off each individual file into its own unit.

Having individual units has several advantages:

 - units are executed in parallel
 - it's easier to identify the failing units
 - logs for failed units are easier to read
2018-04-14 16:14:10 +01:00
Emmanuele Bassi
84a30e9524 ci: Use a common section for Flatpak jobs
Avoid repeating blobs of YAML manually, and use the proper YAML
mechanism to copy-paste blobs instead.
2018-04-14 16:13:50 +01:00
Timm Bäder
0a0c909e14 GskRenderer: Plug a memory leak 2018-04-14 12:50:17 +02:00
Timm Bäder
1db1a30339 flowbox: Remove unnecessary queue_draw call 2018-04-14 12:50:17 +02:00
Timm Bäder
1195bb3872 paned: Remove outdated comment
The cursor is not updated in state_flags_changed these days.
2018-04-14 12:50:17 +02:00
Timm Bäder
b48422d423 build: Print summary last 2018-04-14 11:47:02 +02:00
Timm Bäder
add82735bb gl renderer: Don't use texture ids in glBindFramebuffer calls 2018-04-14 11:47:02 +02:00
Timm Bäder
c18219c5a8 snapshot: don't create offset nodes inside offset nodes
It's pretty easy to make that one offset node.
2018-04-14 11:47:02 +02:00
Timm Bäder
fdfdada362 gl renderer: Increase GArray size by 2 up front
Since we know we will add two elements anyway.
2018-04-14 11:47:02 +02:00
Timm Bäder
3a995b41d7 widget: Avoid a dead assignment 2018-04-14 11:47:02 +02:00
Timm Bäder
497d2f8c50 tooltip: Avoid some possibly uninitialized values 2018-04-14 11:47:02 +02:00
Aron Xu
26f962eead po: fix zh_CN translation 2018-04-14 13:10:55 +08:00
Benjamin Otte
fc6018f192 wayland: Don't freeze the frame clock too early
We can't freeze the frame clock on commit, but only after-paint,
otherwise the frameclock will resume in the paint stage.

So freeze the frame clock at the end of the frame if we are waiting for
a frame callback.

Note; The diff is only lage because of indentation changes due to
avoiding early returns in favor of a branch.
2018-04-13 02:16:10 +02:00
Benjamin Otte
4aab8e970b gdk: Remove gdk_surface_create_similar_image_surface()
It's unused.
2018-04-12 14:04:33 +02:00
Benjamin Otte
7ef8696a7d gdk: Remove gdk_cairo_surface_create_from_pixbuf()
It's unused and people should use textures and snapshots anyway.
2018-04-12 14:04:20 +02:00
Benjamin Otte
9cecf123f3 widget-factory: Use a pixbuf instead of a surface
This gets rid of the last user of
gdk_cairo_surface_create_from_pixbuf().
2018-04-12 14:03:58 +02:00
Benjamin Otte
af6b2cdb37 testgtk: Don't set cairo surfaces as icons
The code expects textures these days, so use those.
2018-04-12 14:03:48 +02:00
Benjamin Otte
3a1c69dce6 gdk: Remove gdk_cairo_get_drawing_context()
It's unused.
2018-04-12 14:03:40 +02:00
Benjamin Otte
b9c8c146d2 tests: Use gdk_texture_save_to_png() where appropriate 2018-04-12 14:02:59 +02:00
Benjamin Otte
770866f265 texture: Add gdk_texture_save_to_png()
It's needed for debugging Timm's code, so better have it here than
hidden in my random-patch vault.
2018-04-12 14:02:59 +02:00
Benjamin Otte
39d930c065 drawingcontext: Remove unused APIs 2018-04-12 14:02:59 +02:00
Christoph Reiter
814b7d7bb7 ci: allow flatpak jobs to fail for now
We can easily revert this when things are fixed again.
2018-04-11 19:52:21 +02:00
Timm Bäder
0965812e37 scrolledwindow: Fix indicator revealing
We need to increase the scrollbar bounds size.
2018-04-11 19:14:55 +02:00
Timm Bäder
5e81761ad0 gl renderer: Slightly change ops_offset behavior
Add the given delta to the current one instead of replacing it.
2018-04-11 19:14:54 +02:00
Timm Bäder
0336825537 gl renderer: Don't draw all rounded clip nodes to a texture
We only need to do that if the rounde clip node intersects with the
outer one.
2018-04-11 19:14:54 +02:00
Руслан Ижбулатов
8c3ee6a38d Link libgtk to libintl
GTK does use libintl directly (in gtkmain.c, for example) and thus
needs to be linked to it (if found and/or needed).

Previously we most likely were getting libintl from glib, but
that stopped for some reason. Either way, explicit linking is
the right thing to do here.
2018-04-11 16:49:18 +00:00
Руслан Ижбулатов
20f12f9ed7 GDK W32: Fix a missing weak referencing
The changes in a82d67bb7d didn't
preserve a g_object_weak_ref() call that we need to ensure the
objects in hash map don't become stale. Fix this.
2018-04-11 16:39:34 +00:00
Emmanuele Bassi
8fa2db35f8 Merge branch 'gitlab-ci-ccache-again' into 'master'
gitlab-ci: Reenable ccache but disable it during the initial meson call

See merge request GNOME/gtk!111
2018-04-11 14:32:37 +00:00
Emmanuele Bassi
a2a99d27c9 Simplify the Wayland code generation
Instead of going through an ancillary script to strip away the
`WL_EXPORT` annotation from the generated code, we should bump up the
required version of Wayland, and use the `private-code` argument for
wayland-scanner, which does the right thing for us.
2018-04-11 15:06:43 +01:00
Christoph Reiter
c542115906 gitlab-ci: Reenable ccache but disable it during the initial meson call
There where some problems (??) with ccache not detecting changes during meson
checks. Setting CCACHE_DISABLE during the meson execution makes ccache not use
the cache and pass things directly to the compiler.
2018-04-11 15:33:00 +02:00
Timm Bäder
d7af16c8e4 gl renderer: Render everyhing according to MV scale
And not the surface's scale factor. This way the magnifier works.
2018-04-11 15:31:22 +02:00
Timm Bäder
cc66b50dcd gl renderer: Remove unused field 2018-04-11 15:31:22 +02:00
Emmanuele Bassi
d448be007e ci: Update container to Fedora 28
We're going to need updated dependencies that we cannot build as
subprojects, like wayland-protocols.
2018-04-11 13:58:47 +01:00
Benjamin Otte
2dd37e9624 widget: Not all toplevels are containers
Guard against GtkInvisible.
2018-04-11 04:04:37 +02:00
Benjamin Otte
b79c138100 widget: Only start/stop idle sizers for toplevels
They are the only widgets that have idle sizers.
2018-04-11 03:16:34 +02:00
Benjamin Otte
2abf082231 widget: Move frame clock handling to vfunc
Instead of connecting to / disconnecting from the frame clock, do it
inside the vfuncs next to changing the priv->realized boolean.

This removes a race between those 2 cases that could cause child
widgets' unrealize handlers to reconnect this widget to the frame clock
because it was still marked as realize when the widget had already
disconnected from the frame clock.

Fixes #168
2018-04-11 03:16:34 +02:00
Benjamin Otte
7ef8cb652b widget: Remove gtk_widget_set_realized()
Everybody chains up now.
2018-04-11 03:16:34 +02:00
Benjamin Otte
5abc4749de gtk: Chain up in toplevels' realize
Don't call set_realized() manually.
2018-04-11 03:16:34 +02:00
Benjamin Otte
5c51a302a4 widget: Make gtk_widget_real_realize() stricter
But in turn, also allow it to work on widgets with their own surface.

This way, we can chain up from everywhere and won't have to export
gtk_widget_set_realized().
2018-04-11 03:16:34 +02:00
Benjamin Otte
0af5316f00 widget: Assert unrealizing
Instead of just setting the flag, assert that it was set.
2018-04-11 03:16:34 +02:00
Benjamin Otte
2862ee7682 widget: Remove unused member 2018-04-11 03:16:34 +02:00
Benjamin Otte
3ee2aa1b22 container: Remove gtk_container_maybe_start_idle_sizer()
Fold it into gtk_container_start_idle_sizer()
2018-04-11 03:16:34 +02:00
Benjamin Otte
21f15094fb container: Remove gtk_container_queue_resize_handler()
It's the same as gtk_container_maybe_start_idle_sizer()
2018-04-11 03:16:34 +02:00
Benjamin Otte
3df94fe099 container: Use maybe_start_idle_sizer()
That way, we don't accidentally start an idle sizer for unrealized
widgets.
2018-04-11 03:16:34 +02:00
Benjamin Otte
e0415fccd7 window: Don't queue resize handler
It's not needed, because the queue_allocate() call right above it does
this work.
2018-04-11 03:16:34 +02:00
Benjamin Otte
b591d7bc20 widget: Don't queue resize handler twice
We already queue it when we set_alloc_needed(), so there's no need to do
it again.
2018-04-11 03:16:34 +02:00
Benjamin Otte
d6477d0894 container: Don't store the resize clock
Use gtk_widget_get_frame_clock() instead
2018-04-11 03:16:34 +02:00
Benjamin Otte
1738b80efd Merge branch 'gitlab-ci-mingw' into 'master'
gitlab-ci: mingw build

See merge request GNOME/gtk!105
2018-04-10 18:59:49 +00:00
Christoph Reiter
f26b2469af gitlab-ci: Add a 32bit mingw build 2018-04-10 19:24:15 +02:00
Emmanuele Bassi
14c8a603e3 Terminate strncpy() buffers correctly
When using strncpy() with a buffer we need to account for the
terminating NUL character. GCC 8 started warning when using PPD_MAX_NAME
as the buffer length for strncpy() because the buffer we're copying into
has the same length — which means that the terminating NUL may be
skipped if the source string has a length of PPD_MAX_NAME.

The appropriate way to handle the case where we're copying a source with
a length bigger than of PPD_MAX_NAME is, as reported in the strncpy()
documentation, to copy `PPD_MAX_NAME - 1` bytes, and explicitly NUL
terminate the destination buffer. This has the additional benefit of
avoiding the compiler warning.
2018-04-10 14:54:45 +01:00
Benjamin Otte
adc0159bdb wayland: Factor out frame timings request code
Also call the code everywhere we draw and not just with Cairo.
2018-04-10 15:13:38 +02:00
Benjamin Otte
e44bbeb558 filechooserbutton: Fix reserved pointers
So gcc stops complaining about unnecessary parenthesis.
2018-04-10 15:13:38 +02:00
Benjamin Otte
12063fe53e ffmpeg: Fix compile warnings for newest version 2018-04-10 15:13:38 +02:00
Timm Bäder
f24d0725ca vulkancontext: Add new error enum 2018-04-10 09:53:48 +02:00
Timm Bäder
3db4f805ee widgetfocus: Use gtk_widget_compute_bounds
Instead of gtk_widget_get_allocation.
2018-04-10 09:44:14 +02:00
Timm Bäder
3ce6355bf4 widget: Remove _get_own_allocation
Replace all usages of it with _compute_bounds
2018-04-10 09:43:47 +02:00
Timm Bäder
3a5b2f54ea widget: Remove gtk_widget_get_own_allocation
Use compute_bounds everywhere.
2018-04-10 09:43:47 +02:00
Timm Bäder
5d1f93796e widget: Remove get_own_allocation usages 2018-04-10 09:43:47 +02:00
Timm Bäder
b29ee2dc46 notebook: Use compute_bounds 2018-04-10 09:43:47 +02:00
Timm Bäder
d49d391fcd popover: Use gtk_widget_compute_bounds
Instead of the private get_own_allocation
2018-04-10 09:43:47 +02:00
Timm Bäder
3593fd2a29 toolbar: Avoid a get_own_allocation call
We want the content allocation here since we are allocation child
widgets.
2018-04-10 09:43:47 +02:00
Timm Bäder
44390c16b2 widget: Fix typo in compute_bounds docs 2018-04-10 09:43:47 +02:00
Timm Bäder
09f04633ca gdk: Protect against negative GDK_SCALE values
Using those should not happen.
2018-04-10 09:43:47 +02:00
Руслан Ижбулатов
27d9f233d4 GDK W32: use clock after_paint signal for timing updates
* Previous commit had misleading info. The code was
added to begin_paint() instead of end_paint(). Though
that did not affect its performance in any visible way.
* Company advised to move the code to an "after_paint" signal
handler, so that it works on all renderers, not just Cairo.
This change caused high fluctuation in FPS values in fishbowl
when it is put in a situation where it cannot achieve 60fps
(such as using Cairo renderer at ultra-high resolution).
This seems to be deliberate and not a bug.
2018-04-09 20:21:16 +00:00
Emmanuele Bassi
410b20f904 docs: Link to GResource
Since we're referring to GLib's functionality, might as well save some
time to the reader, and link to the GResource API reference page.
2018-04-09 20:55:51 +01:00
Daniel Boles
fae064d5f9 docs/reference/gtk/getting_started: cgit => GitLab
master version of b685eb1779
2018-04-09 20:55:14 +01:00
Руслан Ижбулатов
c7ef697029 GDK W32: set update frequency and timestamp
There is no easily apparent way of being notified when frame updates
happene exactly, so we just query frame info at the end of each paint.
If we query too often (faster than DWM refresh rate), we just get
the same values twice in a row, but that is, hopefully, highly unlikely.
2018-04-09 19:07:10 +00:00
Daniel Boles
b7291ce533 AccelGroup: Remove @See_also of deleted function
gtk_item_factory_new() is not a thing that exists.

Also, maybe the lack of space after the colon was what stopped the link
from rendering.
2018-04-09 19:45:10 +01:00
Benjamin Otte
0afdd84a2a css: Clipping changes don't need a queue_allocate() anymore
Now that queue_draw() isn't restricted to clip anymore, we don't need to
care about clip in the CSS engine either.

We do keep GTK_CSS_AFFECTS_CLIP around though because GtkWindow does
care for the window's size.
2018-04-09 20:20:55 +02:00
Benjamin Otte
78a9b5d1ed entry: Stop being activatable
Activating entries does not do anything.

Activate the default widget instead.
2018-04-09 20:20:55 +02:00
Daniel Boles
d77ede508c Merge branch 'master' into 'master'
gdk_x11_display_get_monitor: fix monitor number test logic

See merge request GNOME/gtk!107
2018-04-09 17:25:08 +00:00
Sébastien Villemot
bb8debe925 gdk_x11_display_get_monitor: fix monitor number test logic
When asked for a nonexistent (positive) monitor number,
gdk_x11_display_get_monitor would (at best) return an uninitialized pointer,
instead of returning NULL.
2018-04-09 18:07:14 +02:00
Benjamin Otte
bb8f6f87ae glcontext: Store the buffer age regions in the GL context
That way, we can store the right region there: The actual painted area
instead of the exposed area (which is way too small).

Also, the GL context is the only user of this data, so storing it there
seems way smarter.
2018-04-09 01:00:31 +02:00
Benjamin Otte
c8e38c6065 vulkan: Use new resize vfunc to recreate swapchain
... instead of checking sizes for every frame.
2018-04-09 01:00:31 +02:00
Benjamin Otte
a115f59950 drawcontext: Add a surface_resized() vfunc
Call this vfunc whenever the surface's size has changed.
2018-04-09 01:00:31 +02:00
Benjamin Otte
7ed0c85c61 surface: Track all draw contexts created for the surface 2018-04-09 01:00:31 +02:00
Benjamin Otte
e8fef1147f widget: Don't do a 0-size check before snapshotting
Even widgets with an empty allocation may still want to draw stuff.
Examples include shadows or child widgets with negative margins.

Fixes GtkEntry's progressbar not showing up anymore.
2018-04-09 01:00:31 +02:00
Daniel Boles
8d8db89669 testmodelbutton: Test :centered, :icon, :inverted
Test more stuff.
2018-04-08 18:48:16 +01:00
Daniel Boles
15b569e64d testmodelbutton: Fix wrongly overridding MB child
I was setting a GtkButton:label, which resulted in the ModelButton's own
custom children getting lost. That doesn't make for a useful test...
2018-04-08 18:48:16 +01:00
Daniel Boles
53a66c0f41 ModelButton: Use WARN_INVALID_PROPERTY, not assert
Do the same thing we do everywhere else for invalid properties.
2018-04-08 18:48:16 +01:00
Daniel Boles
7fd0d3ec51 ModelButton: Fix type Wether => Whether 2018-04-08 18:48:16 +01:00
Daniel Boles
08126ffdf2 testmodelbutton: Add explanatory comments to CSS
and load at an earlier, more sensible place, before creating any widgets
2018-04-08 18:48:16 +01:00
Daniel Boles
57c58f880b ModelButton: Protect against nonsensical gbooleans
the same way we do normally.
2018-04-08 13:17:18 +01:00
Daniel Boles
5bbb185e14 tests/testmodelbutton: Add this
and test whether :action-name, :role, and CSS nodes work as expected

https://gitlab.gnome.org/GNOME/gtk/issues/163
2018-04-08 13:17:18 +01:00
Timm Bäder
6cd53fc491 Merge branch 'wip/sadiq/fixes' into 'master'
listbox: Fix signal name is documentation

See merge request GNOME/gtk!106
2018-04-08 07:30:24 +00:00
Mohammed Sadiq
5ad31616e8 listbox: Fix signal name in documentation 2018-04-08 11:02:23 +05:30
Rico Tzschichholz
ff738269b6 Fix some g-i annotation warnings 2018-04-06 16:26:17 +02:00
Timm Bäder
58aa93be41 menu: Avoid an invalid read 2018-04-06 08:24:19 +02:00
Timm Bäder
d4e4904604 lockbutton: Remove priv pointer 2018-04-06 08:24:19 +02:00
Timm Bäder
b7f98314a5 widgetbowl: Add switch demo 2018-04-06 08:24:19 +02:00
Benjamin Otte
fb33110fd1 gtk-demo: Redo viewing of resources
1. Don't rely on GtkImage as a detector of file type anymore.
   Instead, hardcode all extensions that are in use.
2. Add a display method for videos.
2018-04-06 00:44:18 +02:00
Benjamin Otte
3eddbdc191 video: Add autoplay and loop boolean properties 2018-04-06 00:44:18 +02:00
Piotr Drąg
faaf828c74 Update POTFILES.in 2018-04-05 22:54:03 +02:00
Carlos Garnacho
acb950ffb5 gtkmenushell: Port to using GtkEventControllerKey 2018-04-05 19:26:55 +02:00
Carlos Garnacho
9a80b9e382 gtkcellrendereraccel: Port to using GtkEventControllerKey 2018-04-05 19:26:55 +02:00
Carlos Garnacho
362a6ca469 gtkentry: Use key controller to track focus changes 2018-04-05 19:26:55 +02:00
Carlos Garnacho
73fe140b10 gtkcalendar: Use key controller to track focus changes 2018-04-05 19:26:55 +02:00
Carlos Garnacho
b0cd5cd7c8 gtktextview: Use key controller for focus changes 2018-04-05 19:26:55 +02:00
Carlos Garnacho
3361fe1e62 gtkeventcontrollerkey: Add ::focus-in/out signals
And handle GDK_FOCUS_CHANGE events in order to emit those.
2018-04-05 19:26:55 +02:00
Carlos Garnacho
5a34d0f816 gtkeventcontrollerkey: Add get_group() call
Callers can use this function on a key-pressed/released signal
to find out the key event group, useful in a few places.
2018-04-05 19:26:55 +02:00
Carlos Garnacho
d724506abe gtkmenu: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:55 +02:00
Carlos Garnacho
d5e826a660 gtkiconview: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:55 +02:00
Carlos Garnacho
f291541769 gtkcellrendererspin: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:55 +02:00
Carlos Garnacho
1fa6239509 appchoooserdialog: use search bar key capture API 2018-04-05 19:26:54 +02:00
Carlos Garnacho
0b3b81a8bf inspector: Use search bar API to capture key events from the toplevel 2018-04-05 19:26:54 +02:00
Carlos Garnacho
20c1e24b60 gtksearchbar/entry: Add [gs]et_key_capture_widget() API calls
This lets these widgets actively pull events from a widget, instead
of passively being fed events.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
ad5f0a63a3 gtkwindow: Perform key activation in gtk_main_do_event()
In a similar spirit to the previous commit, make window shortcut
activation happen by default on toplevels, without relying on
legacy controllers.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
6892b5c5ba gtkwidget: Activate key bindings through run_controllers()
Deferring a bit further making those a standalone controller, make
binding activation happen on run_controllers(), so it happens by
default on widgets (unless the key event was consumed earlier)
without the need of a legacy event controller.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
d74ecfb02e gtkwidget: Break early if non-gesture controllers handle the event
Non gesture controllers have no means to collaborate with other
controllers, thus should be considered standalone entities. It makes
no sense to propagate any further if scroll/key controllers handled
the event.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
695549d5a7 eventcontrollerkey: Add function to forward stuff elsewhere 2018-04-05 19:26:54 +02:00
Carlos Garnacho
b55696e551 gtkmain: Don't use special paths for key event propagation
Set the event_widget to the window focus, and let event capture/bubble
handling do the rest.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
385fa18c27 gtkrange: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
cfdf4f650f gtkcellrendereraccel: simplify grabbing code 2018-04-05 19:26:54 +02:00
Matthias Clasen
df386f29ab combo box: Stop using ::key-press-event
Switch to using ::event.
2018-04-05 19:26:54 +02:00
Matthias Clasen
ec84fb90bf app chooser: Stop using ::key-press-event
For now, just switch to using ::event.
2018-04-05 19:26:54 +02:00
Carlos Garnacho
80c3ebe3a0 gtkentrycompletion: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
585aafc2df gtkplacessidebar: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
87b4dc4c67 gtktextview: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
5118f9817a gtkflowbox: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:54 +02:00
Carlos Garnacho
568054a034 gtkentry: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Carlos Garnacho
0d884d22fb gtkcolorswatch: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Carlos Garnacho
6f4107c8de gtkcolorplane: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Carlos Garnacho
5081472d97 gtkcalendar: Stop using ::key-press-event
Use GtkEventControllerKey for the task
2018-04-05 19:26:53 +02:00
Matthias Clasen
b033e30318 search bar: Stop using ::key-press-event
Use a key event controller instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
f231ac6541 Shortcuts window: stop using ::key-press-event
Use a key event controller instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
c971ca7c34 color editor: Stop using ::key-press-event
Use key event controllers instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
4990842981 about dialog: Stop using ::key-press-event
Use a key event controller instead.
2018-04-05 19:26:53 +02:00
Matthias Clasen
21d1ab42d1 icon-browser: Stop using ::key-press-event 2018-04-05 19:26:53 +02:00
Matthias Clasen
6d1b21a028 places view: Stop using ::key-press-event 2018-04-05 19:26:53 +02:00
Matthias Clasen
c2bd7fcf35 inspector: Stop using ::key-press-event 2018-04-05 19:26:53 +02:00
Matthias Clasen
75024fea60 testgtk: Drop snapshot
This needs to be redone with modern snapshotting infrastructure.
Lets drop it for now, it is somewhat duplicative with inspector
features.
2018-04-05 19:26:53 +02:00
Matthias Clasen
98f31e61d7 testgtk: Drop the event watcher
This is not a very useful test, and it is hard to keep working
in an event controller world.
2018-04-05 19:26:53 +02:00
Matthias Clasen
2cc85df62b docs: Modernize an example
The signals that are showcased here are going away.
2018-04-05 19:26:53 +02:00
Matthias Clasen
918d552472 gtk-demo: Stop using ::key-press-event in font explorer
Use a key controller instead. Note that this currently
breaks the handling of Enter, since we activate key bindings
twice, causing us to switch to the label and back.
2018-04-05 19:26:53 +02:00
Matthias Clasen
8d396991db testsuite: Don't use ::key-press-event
We don't need it here.
2018-04-05 19:26:53 +02:00
Matthias Clasen
19bd57ed1f file chooser: Use a key event controller
We want to get rid of ::key-press-event.
2018-04-05 19:26:53 +02:00
Carlos Garnacho
b1eaeebe7d demos: Add "Paint" demo 2018-04-05 19:26:53 +02:00
Carlos Garnacho
f0c8e9de4f gtk: Add GtkGestureStylus
This is a GtkGesture done to deal with stylus events from drawing tablets.
Those have a special number of characteristics that extend a regular
pointer, so it makes sense to wrap that.
2018-04-05 19:26:53 +02:00
Carlos Garnacho
58eaf5ca16 gtkwindow: Unset focus grab_widget if it ends up unmapped
This may result on the later emission of crossing events, with one of the
sides being already unmapped/unrealized. The widget being unmapped will
result on repick and emission of a set of crossing events anyway.
2018-04-05 19:26:04 +02:00
Carlos Garnacho
1ce79b29e3 gtk: Add GtkEventControllerKey
This event controller is meant to replace usage from key-press/release-event
handlers all through. Optionally it can be set a GtkIMContext, so interaction
is carried by the controller.
2018-04-05 19:26:04 +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
Ivan Malison
f876532514 Add binding for <alt>BackSpace to emacs keys 2018-04-01 20:16:05 -07: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
Daniel Boles
db4895fbe5 TextLayout: Clarify implementation of special case
This exists to exit early for invisible lines. It attempts to use the
LineDisplay’s direction to create a corresponding PangoLayout. However,
the dir is not yet set by this point, & the display was new0()d, so its
dir is always 0 == TEXT_DIR_NONE. Thus, we always create an LTR layout.

Whatever the original intent, this outcome seems to be OK, so let’s make
the code say what it means, rather than using a misleading conditional.

https://bugzilla.gnome.org/show_bug.cgi?id=779099
2018-02-17 22:18:13 -05:00
Matthias Clasen
f42ebef9d1 calendar: Avoid warnings for new "%OB" format
Use the same code we have in gtk-3-22 to deal with strftime()
not supporting %OB, and avoid compiler warnings for non-literal
format strings.
2018-02-17 17:12:45 -05: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
Piotr Drąg
cfcd0f888d Update Polish translation 2018-02-17 17:22:50 +01: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
Benjamin Otte
710c39027b vulkan: Keep track of command buffers
Fixes a rather large memleak.
2018-02-17 08:04:43 +01:00
Benjamin Otte
95ddb57562 cssimage: Get rid of draw vfunc
All remaining users of that vfunc now implement snapshot using cairo
render nodes (win32 and radial).

Also, GtkCssImageClass.snapshot is now NULL, so if a subclass doesn't
implement it, it will now crash.
Previously it would try to call the draw vfunc.
2018-02-17 08:04:43 +01:00
Timm Bäder
1b8a768279 adwaita: Move searchbar style to box child
This way, we avoid a 1px border at the bottom of the actual searchbar
widget and move it instead to the child of a GtkRevealer. Since we can
now use widgets with 0px height, we finally get rid of the 1px border
that was drawn even if the searchbar child was hidden.
2018-02-16 21:23:14 +01:00
Carlos Garnacho
f22403a317 gdk/wayland: Use GDK_AVAILABLE_IN_ALL
GDK_AVAILABLE_IN_4_0 makes it unavailable till 4.0, but we want
it now.
2018-02-16 19:36:41 +01:00
Carlos Garnacho
f64c32113a gtksettings: Remove leftover code
The immodule variable is unused
2018-02-16 19:36:40 +01:00
Timm Bäder
ad776cc57b gl renderer: Increase offscreen texture size
This fixes blurry checkbutton marks in hidpi setups, but breaks button
hover effects. That's another problem.
2018-02-16 18:00:06 +01:00
Timm Bäder
78c6f713dd textview: Implement measure()
Don't use the current layout size as minimum size anymore, that doesn't
make sense. Also move the code from size_request() from gtk2 into the
now current measure() function.
2018-02-16 17:41:41 +01:00
Piotr Drąg
689537d75b Update POTFILES.in 2018-02-16 17:14:08 +01:00
Emmanuele Bassi
6757f42c66 Merge branch 'quartz-symbol-not-found' into 'master'
gdkquartz.h: export pasteboard functions

Closes #32

See merge request GNOME/gtk!19
2018-02-16 12:41:33 +00:00
Tom Schoonjans
ffa85a41d0 gdkquartz.h: export pasteboard functions 2018-02-16 12:16:02 +00:00
Matthias Clasen
e61e6a864b Drop unmaintained print backends
The papi and test printbackends have not seen any
maintenance in a long time.
2018-02-15 22:49:31 -05:00
Piotr Drąg
c65819e289 Update POTFILES.in 2018-02-16 00:25:16 +01:00
Matthias Clasen
dd4bb00a24 Fix the build
This was a mis-merge.
2018-02-15 18:22:53 -05:00
Matthias Clasen
c481a773af Drop non-backend immodules
These are not well integrated, and have not seen any
maintenance in many years.
2018-02-15 16:05:20 -05:00
Bastien Nocera
cc951ac6c8 gtkbookmarksmanager: Use GTK+ 3.0's bookmarks file
There's no reason to use a separate file until the format of the file
changes though, as this just means that GTK+ 3.x and GTK+ 4.x
applications would end up showing different bookmarks in the file
chooser.

https://bugzilla.gnome.org/show_bug.cgi?id=793425
2018-02-15 20:42:21 +01:00
Emmanuele Bassi
d8e476f4db Merge branch 'ci-cache-subprojects' into 'master'
gitlab-ci: cache meson subprojects

See merge request GNOME/gtk!17
2018-02-15 12:58:56 +00:00
Christoph Reiter
1395f78679 gitlab-ci: cache meson subprojects
This saves another 30sec here and reducing clone operations on the
gnome gitlab instance is probably a good idea as well.
2018-02-15 13:43:55 +01:00
Emmanuele Bassi
46436158eb Update the wrap file for GLib
Point to the right repo, now that GLib is on GitLab, instead of relying
on the redirection.
2018-02-15 11:30:03 +00:00
Carlos Soriano
6cef9514ae gtkplacessidebar: Rename favorites to starred
To have more consistency in the name. The same was done in Nautilus in
commit 27b039b37c.
2018-02-15 10:51:04 +01:00
Piotr Drąg
21f599eea4 Update POTFILES.in 2018-02-15 04:29:36 +01:00
Matthias Clasen
d564e397e2 Merge branch 'master' into 'master'
calendar: Use the new "%OB" format in strftime()

Closes #9

See merge request GNOME/gtk!10
2018-02-15 03:07:54 +00:00
Matthias Clasen
656f67eeb7 Merge branch 'wip/issue-21' into 'master'
Mention gtk_button_set_image() and friends in the migration docs

Closes #21

See merge request GNOME/gtk!6
2018-02-15 03:06:28 +00:00
Matthias Clasen
c2531b7ff2 Merge branch 'wip/carlosg/imwayland' into 'master'
modules: Add wayland IM implementation

See merge request GNOME/gtk!4
2018-02-15 03:01:43 +00:00
Matthias Clasen
753138a7cc Merge branch 'issue-2' into 'master'
Update the configuration options

Closes #2

See merge request GNOME/gtk!11
2018-02-15 02:58:16 +00:00
Emmanuele Bassi
716f7cd3f7 Merge branch 'gitlab-ci-docker' into 'master'
Add gitlab-ci support using a prebuilt docker image

See merge request GNOME/gtk!7
2018-02-14 23:38:58 +00:00
Christoph Reiter
dfc1f76be7 Add gitlab-ci support using a prebuilt docker image 2018-02-14 22:47:44 +01:00
Emmanuele Bassi
7f25cc9d4e Rewrite toarray Perl script to Python
We don't need to shell out to Perl to generate a C array out of a text
file.
2018-02-14 15:51:45 +00:00
Emmanuele Bassi
327e7a4ccc build: Rename last 'enable' options
Drop the 'enable-' prefix to conform to the best practices for naming
configuration options in Meson.
2018-02-14 14:14:22 +00:00
Emmanuele Bassi
7b32900c55 build: Rename GDK backend options
Drop the 'enable-' prefix, and always enable all platform-specific
backends. We can disable them depending on the platform. This way,
the documentation printed by `meson configure` remains accurate.
2018-02-14 14:14:22 +00:00
Emmanuele Bassi
1440db1570 build: Coalesce print backends options into one
Instead of having separate options for each print backend, we can use
the same approach as the input method modules: a single option, with a
comma-separated list of print backends.
2018-02-14 14:14:22 +00:00
Emmanuele Bassi
2e7fef7d18 build: Rename the 'enable-colord' option
Drop the 'enable-' prefix, to follow the naming best practices for Meson
configuration options.
2018-02-14 14:14:22 +00:00
Emmanuele Bassi
d1a8ed0214 build: Rename 'with-included-immodules' option
We can call it 'included-immodules', and simplify its logic by always
attempting to split the value, to avoid turning an array into a string
and then back into an array again.
2018-02-14 14:14:22 +00:00
Emmanuele Bassi
4b7017ef35 build: Rename 'disable-modules' option
We should not have 'disable' in the name, to conform with the Meson best
practices for boolean options.
2018-02-14 14:14:22 +00: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
Emmanuele Bassi
490899e271 x11: Do not include fallback-c89.c
We're definitely using a C99-compliant toolchain, if we're building the
X11 backend.
2018-02-14 11:15:31 +00:00
Rafal Luzynski
b9ea25c25c calendar: Use the new "%OB" format in strftime()
Due to the recent changes introduced in glibc 2.27 "%OB" is the
correct format to obtain a month name as used in the calendar
header.  The same rule has been working in BSD family (including
OS X) since 1990s.  This change is simple but makes GTK+ 4.x require
glibc >= 2.27.  If this requirement cannot be fulfilled then we must
cherry-pick the full commit cbf118c from gtk-3-22 branch.

Closes: #9
2018-02-13 23:29:20 +01:00
Mart Raudsepp
970d2e3f45 Update Estonian translation
(cherry picked from commit 97f3a4397a)
2018-02-13 22:21:15 +00:00
Mart Raudsepp
dd9249a87f Update Estonian translation
(cherry picked from commit af2d039717)
2018-02-13 20:14:56 +00:00
Timm Bäder
aa32fc1708 cssprovider: Remove priv pointer 2018-02-13 18:48:44 +01:00
Timm Bäder
160a4208ed menu: Remove an incorrect comment
They are not missing, they are snapshot when chaining up.
2018-02-13 18:48:44 +01:00
Emmanuele Bassi
395550c671 Merge branch 'bump-glib-dep' into 'master'
meson: Require glib 2.55.0

See merge request GNOME/gtk!8
2018-02-13 17:03:08 +00:00
Christoph Reiter
7d44735893 meson: Require glib 2.55.0
gtk+ has started using g_file_load_bytes() which is available
since glib 2.55.0
2018-02-13 18:00:27 +01:00
Carlos Garnacho
21e9fe4f55 modules: Add wayland IM implementation
This IM context implementation goes through the gtk-text-input protocol,
leaving up to the compositor the actual interaction with IM engines.
2018-02-13 15:47:57 +01:00
Carlos Garnacho
3b568fbe77 gdk/wayland: Add GdkDisplay call to query available globals
The internal known_globals hashtable is used to carry accounting for
interfaces that depend on others (as ordering is not guaranteed), extend
its usage so it also keeps track of unimplemented interfaces (here at
least).

The API call will then use this to allow querying the globals offered by
the compositor, it will be useful to determine whether we can use
text-input protocols or should fallback to other IMs.
2018-02-13 15:47:57 +01:00
Emmanuele Bassi
7ee69fc7b2 Mention gtk_button_set_image() and friends in the migration docs
The image-related API for GtkButton has been dropped, but still needs
to be mentioned in the migration guide.

Closes: #21
2018-02-13 12:57:18 +00:00
Benjamin Otte
365707e4eb x11: Run event filters on all windows
The event filters that were split out in commit
65beb0fc22 need to be run for every event
window and not just for the root window.
2018-02-13 10:34:06 +01:00
Benjamin Otte
91c6b56c99 treemenu: Remove unused defines 2018-02-13 10:34:06 +01:00
Emmanuele Bassi
da6b68d2b7 Disable CI
The CI runner is pretty slow to set up (takes about 6 minutes to get
through the system dependencies needed to build GTK), and does not work
with dependencies as subprojects.

Until we figure out how to make it work, and make it work a bit faster,
we should drop CI and rely on Continuous for a while longer.

We can revert this commit as soon as we find out how to make things
work.
2018-02-12 17:16:51 +00:00
Emmanuele Bassi
6aa66f59ce ci: Update the vulkan build option 2018-02-12 17:04:57 +00:00
Emmanuele Bassi
4040986545 Add GitLab CI (build only) 2018-02-12 16:57:17 +00:00
Emmanuele Bassi
bb7beb5ade Drop method annotation for gtk_drag_cancel()
The other method annotations were removed in commit c306e448b3.

There is no introspected ABI change, as g-ir-scanner would just ignore
the annotation.

This eliminates the last warning when building GTK on Linux.
2018-02-12 16:46:42 +00:00
Emmanuele Bassi
032dabe137 build: Allow using introspection from subprojects
When building dependencies as subprojects we need to tell the
introspection scanner where to find the introspection data; this
means using GIR targets from the subproject.
2018-02-12 14:25:43 +00:00
Alban Browaeys
c306e448b3 Fix overzalous method annotations for drag and drop
Functional revert of commit 9c4892f291.

Fixes introspection scanner warnings like:

  Warning: Gtk: gtk_drag_finish: Methods must belong to the same
  namespace as the class they belong to

That is, the gtk_drag_* functions cannot be methods as they have a
"GdkDragContext" as the instance parameter, and that is not a valid
type for the Gtk namespace.

This is not an introspected ABI change, as the generated introspection
data ignores the annotation.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=692152
2018-02-12 11:42:44 +00:00
Emmanuele Bassi
55c9576d83 build: Use GIR targets for built introspection data
Instead of using `--include-uninstalled` in the scanner arguments, we
can tell Meson to use an introspection target, and it'll do the
appropriate thing for us.
2018-02-12 11:42:44 +00:00
Emmanuele Bassi
99bcccd884 Bump up the dependency on Meson
We're going to use a new argument in the generate_gir() function.
2018-02-12 11:42:44 +00:00
Mart Raudsepp
c300c530ea Update Estonian translation
(cherry picked from commit 8dc234717e)
2018-02-12 00:39:33 +00:00
Matthias Clasen
f771046a00 gdk: Add some more docs
Add another reference to the docs.
2018-02-11 00:41:31 +00:00
Matthias Clasen
c289d7c176 gdk: Expand the docs a bit
Add a reference to the getter to the GdkKeymap::direction-changed
signal docs.
sh: indent: command not found
2018-02-10 23:46:14 +00:00
Emmanuele Bassi
5c3c95a96c docs: Mention G_ENABLE_DIAGNOSTIC in the porting notes
Since part of our type system is resolved at run time, we need to use
run time facilities to get diagnostic messages, like deprecation
warnings for properties and signals.

We should mention the G_ENABLE_DIAGNOSTIC environment variable in the
migration guide, to let developers know how to catch deprecations and
changes while porting their code.
2018-02-09 19:38:17 +00:00
Timm Bäder
d54321c1ca menu: Guard against NULL toplevel
This can happen, as indicated by GtkMenu explicitly connecting to
::destroy of its toplevel window. Do the same thing in GtkComboBox.
2018-02-09 20:17:48 +01:00
Timm Bäder
1362609120 box: Remove an unnecessary include 2018-02-09 11:36:53 +01:00
Timm Bäder
89ac1d6197 box: Rename private pointers to "priv"
Which is the style we use everywhere else.
2018-02-09 11:36:53 +01:00
Timm Bäder
1cfbe9c3d0 box: Simplify size_allocate
Stop looking at the box allocation position since both x and y are 0.
2018-02-09 11:36:53 +01:00
Timm Bäder
3a4c6c18b3 box: Use widget child list when computing size request
Contrary to what the comments in this function might suggest, it does
not actually do anything about child positions, child child sizes. So,
packing doesn't matter and we don't need to iterate over all child
widgets twice.
2018-02-09 11:36:53 +01:00
Timm Bäder
5e9f5c17b5 box: Use widget child list in compute_size_for_orientation
And remove the non-NULL checks for minimum_size and natural_size since
these are non-NULL by definition since this function is only called from
measure().
2018-02-09 11:36:53 +01:00
Benjamin Otte
ff5928754f inspector: Remove gtk.h include 2018-02-09 01:06:59 +01:00
Benjamin Otte
396056e011 a11y: Remove gtk.h include from iconview header 2018-02-09 01:02:06 +01:00
Benjamin Otte
619a19f6fd a11y: Remove gtk.h include from lockbutton 2018-02-09 00:58:59 +01:00
Benjamin Otte
808921dd3e a11y: Remove gtk/h include from menu header 2018-02-09 00:56:26 +01:00
Benjamin Otte
6a47dc26e4 a11y: Remove gtk.h include from listbox headers 2018-02-09 00:52:44 +01:00
Benjamin Otte
df68ef8553 a11y: Remove gtk.h from flowbox includes 2018-02-09 00:47:58 +01:00
Benjamin Otte
3bb95a09bb a11y: Remove gtk.h include from container accessible 2018-02-09 00:42:38 +01:00
Benjamin Otte
9c7874214e a11y: Remove gtk.h include 2018-02-08 23:39:17 +01:00
Benjamin Otte
f08bc40fbb a11y: Don't include gtk.h
Also add missing includes and sort them for all the widgets that relied
on that before.
2018-02-08 15:25:53 +01:00
Emmanuele Bassi
453a50dc95 docs: Link to the compiler requirements wiki page
From the README file.
2018-02-08 14:11:42 +00:00
Emmanuele Bassi
ff41829b3f Rename the project's DOAP file
We need its name to match the repository's name.
2018-02-08 14:11:42 +00:00
Benjamin Otte
7437d34eb9 shortcuts: Don't include gtk.h
Clean up all shortcuts includes to only include the necessary files
while we're at it.
2018-02-08 06:16:01 +01:00
Benjamin Otte
eb3049d6b5 pointerfocus: Don't include gtk.h
Also fix up gtktypes.h to include the required glib.h for G_BEGIN_DECLS
and gtkdnd.c to include missing includes.
2018-02-08 06:16:01 +01:00
Matthias Clasen
601c5fd734 Drop event filters from the docs
No longer public API.
2018-02-07 15:13:31 -05:00
Matthias Clasen
89f6b8751e Remove gdk_window_add_filter
Drop the public filtering API. The x11 backend already has
the ::xevent signal as replacement. The win32 backend needs
a similar signal to replace filtering.

Reshuffle header inclusions in the x11 backend a little bit
to avoid a cyclic inclusion between gdkprivate-x11.h and
gdkdisplay-x11.h that is otherwise causing problems.
2018-02-07 15:12:03 -05:00
Matthias Clasen
65beb0fc22 x11: Don't use gdk_window_add_filter
This function is going away.
2018-02-07 12:24:40 -05:00
Emmanuele Bassi
d07b14f4d2 docs: Update header rules in the coding style
- Make the rules for including headers explicit
 - Make the symbol visibility rules explicit, and drop the
   old "leading underscore" hack
 - Drop Private data structure declarations and priv pointers
   from public headers
 - Mention G_DECLARE_* macros
 - Mention `#pragma once`
2018-02-07 15:01:25 +00:00
Timm Bäder
4f50c68296 cellrendereraccel: unref sizing_label 2018-02-06 13:40:57 +01:00
Timm Bäder
fab9449414 build: install gsk-autocleanup.h 2018-02-06 11:26:47 +01:00
Timm Bäder
0a51f38963 gl renderer: Check the scale factor for every render
This way we pick up changes in the GdkWindow's scale_factor.
2018-02-06 09:19:40 +01:00
Timm Bäder
614c3e6721 demo: Remove an expose_event mention 2018-02-06 09:19:40 +01:00
Timm Bäder
c73e22dadb notebook: Remove another event type check
Just like 3d65019e98, but for release
events.
2018-02-06 09:19:40 +01:00
Timm Bäder
de6c0037b7 separatormenuitem: Don't create label widget in get_label
Calling gtk_menu_item_get_label on a GtkSeparatorMenuItem would
otherwise create a GtkLabel child, increasing the vertical size request
to that of the child label.
2018-02-06 09:19:40 +01:00
Matthias Clasen
1a9a0c2577 Drop a leftover declaration
The function gdk_add_option_entries does not exist anymore.
2018-02-06 01:17:18 -05:00
Matthias Clasen
5b63583c0b Make gdk_event_get_history public
This function is meant to be public, but was missing
an annotation in the header.
2018-02-06 01:17:17 -05:00
Matthias Clasen
0fe3fafac1 gdk: Drop gdk_x11_window_set_frame_extents
This function is unused and has been deprecated
for a long time.
2018-02-06 01:16:32 -05:00
Matthias Clasen
d400c50ca3 fix the docs build
The GtkPlacesSidebar does not exist anymore in public API.
2018-02-06 01:16:32 -05:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
2616e6857c gdk: Add some missing autocleanup definitions
Best to be consistent.
2018-02-06 01:16:32 -05:00
Matthias Clasen
1772cfd4d8 gsk: Add autocleanup definitions
This may be useful for applications using render nodes.
2018-02-06 01:16:32 -05:00
Piotr Drąg
d0ea070c23 Update POTFILES.in 2018-02-05 17:54:21 +01:00
Benjamin Otte
db267433c0 tests: Make text test have more glyphs
Load random strings from /usr/share/dict/words instead of reusing the
same 10 words all the time. That way, we get closer to the real world
use case of having a full alphabet.
2018-02-05 17:22:56 +01:00
Benjamin Otte
452f2f0394 cssprovider: Use g_file_load_bytes()
This way, we get a special no-copy case for resources.

https://bugzilla.gnome.org/show_bug.cgi?id=790270
2018-02-05 17:22:56 +01:00
Carlos Garnacho
faeb572dd5 docs: Rename right get_history() call on GDK docs
Obviously gdk_device_get_history() is not the right function to change. To
delete if anything...
2018-02-05 16:10:58 +01:00
Carlos Garnacho
f964fe3ee5 gdk: Rename gdk_event_get_history() to get_motion_history()
It only applies to GDK_MOTION_NOTIFY events, so this is a more descriptive
name. Also add Since tag in docs, and GDK_AVAILABLE_IN_3_94.
2018-02-05 16:05:34 +01:00
Emmanuele Bassi
00990ec307 build: Fix the non-pkg-config Vulkan detection
Not all the variables were renamed.
2018-02-05 14:35:34 +00:00
Daniel Stone
a5363b9e5d build: Create input method module cache directory
Before running gtk-query-immodules, the cache output directory may not
actually exist. Make sure it does before we try to write into it.

https://bugzilla.gnome.org/show_bug.cgi?id=793182
Signed-off-by: Daniel Stone <daniels@collabora.com>
2018-02-05 14:03:10 +00:00
Emmanuele Bassi
3b0e6720af build: Use pkg-config to find Vulkan
The standard Vulkan SDK ships with a pkg-config file, like a modern
library should.

We should fall back to finding the library and header only for platforms
where pkg-config is not really a thing.

Based on a patch by: Daniel Stone <daniels@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=793181
2018-02-05 14:01:59 +00:00
Emmanuele Bassi
bfcb978079 Drop the last mentions of motion hint events
The GDK_POINTER_MOTION_HINT_MASK enumeration value is gone, but we're
still keeping around the "is_hint" field in GdkEventMotion, even though
every backend sets it to `false` — except for the core X11 device
manager.
2018-02-05 14:00:51 +00:00
Matthias Clasen
66a3b07183 Don't put gdk types into a gsk header
This is a leftover from when GskTexture was moved
to gdk.
2018-02-05 07:50:17 +01:00
Matthias Clasen
fd25a8cdf2 Drop the mir backend
Mir is in the process of switching over to the Wayland protocol,
so we don't need to maintain a separate backend, going forward.
2018-02-05 07:50:17 +01:00
Piotr Drąg
4abdc43688 Update Polish translation 2018-02-05 00:37:11 +01:00
Matthias Clasen
4d16c5abc0 docs: Remove some leftovers
There were still references to recent chooser and tool palette
types in the docs.
2018-02-04 23:38:15 +01:00
Matthias Clasen
697b05c90c Drop threads from the docs 2018-02-04 23:27:59 +01:00
Matthias Clasen
3c45a56934 Drop gtk_widget_show_now
This function does bad things, and is not an
API that we want to take into GTK+ 4.
2018-02-04 23:23:15 +01:00
Matthias Clasen
ee6fc6492f treeview: Stop using gtk_widget_show_now
If this is a problem, it needs to be handled explicitly.
2018-02-04 23:23:15 +01:00
Matthias Clasen
8891967f2b gtk testsuite: Stop using gtk_widget_show_now
If this is a problem, it needs to be handled explicitly.
2018-02-04 23:23:15 +01:00
Matthias Clasen
4ad658f91e a11y testsuite: Stop using gtk_widget_show_now
On non-windows, this doesn't do anything anyway.
2018-02-04 23:23:15 +01:00
Timm Bäder
b726f60f90 searchbar: reorganize
Avoid the ugly priv->tool_box==NULL check in ::add (and ::remove) by
just not using template xml for this small class. Also, make sure the
GtkBin child is properly set and implement remove to also properly
remove it. Remove the manual widget margins and add some CSS for it.
Also switch to simply using a GtkCenterBox.
2018-02-04 22:51:16 +01:00
Timm Bäder
fd148d1ef5 searchbar: Properly remove child widgets
Since the GtkSearchBar is not the direct parent, we need to remove them
properly from priv->box_center.
2018-02-04 17:51:18 +01:00
Timm Bäder
baa3df51ad searchbar: Remove unused widgets
both box_left and box_right are unused.
2018-02-04 17:28:03 +01:00
Timm Bäder
cd6408b47a gdk: fix a format string warning 2018-02-04 15:48:47 +01:00
Timm Bäder
d70bfea8e9 glarea: Fix precondition check
and the build.
2018-02-04 15:10:23 +01:00
Timm Bäder
5aaf752013 roundedrect: Fix coordinate mixup in contains_point
This together with the optimizations in GtkSnapshot was causing circular
buttons to become squared when partially scrolled out of view.
2018-02-04 14:56:41 +01:00
Timm Bäder
76258c8e3a glarea: Simplify make_current
We only use the widget pointer here once.
2018-02-04 14:56:41 +01:00
Timm Bäder
c739db0e29 gl renderer: Use a gl texture in render_texture
Get rid of the manual y flipping and cairo business. This keeps the gl
unit tests working at least.
2018-02-04 13:10:51 +01:00
Piotr Drąg
676e2e088e Update POTFILES.in 2018-02-03 20:23:28 +01:00
Benjamin Otte
83a687f891 rendernode: Don't alloca() 8MB
This happens when deserializing testcases and it really confuses
valgrind into thinking we're longjmp()ing.

And deserializing rendernodes is slow anyway, so who cares about a few
more malloc()s.
2018-02-03 16:24:13 +01:00
Benjamin Otte
cf030e9ffc rbtree: Privatize header
According to meson it's the only private header that doesn't conform to
the *private.h naming.

Fix that.
2018-02-03 16:24:13 +01:00
Emmanuele Bassi
2cbe094b91 Allow binding GdkContentFormatsBuilder
GdkContentFormatsBuilder is currently not introspectable, as it does not
have a GType. We can turn it into a boxed type, but we need to implement
memory management for it.

The current gdk_content_formats_builder_free() function returns a newly
constructed value, so we cannot use it as a GBoxedFreeFunc; additionally
copying a GdkContentFormatsBuilder contents would make it a bit odd, as
you could get multiple identical GdkContentFormats out of the copies.

A simple approach is to model the GdkContentFormatsBuilder API to follow
the GBytes one: use reference counting for memory management, and have
a function to release a reference, return a GdkContentFormats, and reset
the GdkContentFormatsBuilder state.

For language bindings, we can provide a get_formats() function that
returns the GdkContentFormats instance and resets the builder instance,
leaving the reference count untouched.

For C convenience we can keep gdk_content_formats_builder_free(), and
make it a wrapper around gdk_content_formats_builder_get_formats(), with
the guarantee that it'll free the builder instance regardless of its
current reference count.

https://bugzilla.gnome.org/show_bug.cgi?id=793097
https://blogs.gnome.org/otte/2018/02/03/builders/
2018-02-03 16:24:13 +01:00
Timm Bäder
4fa4b8525e gl renderer: Clear resources after render_texture
This makes multiple consecutive render_texture calls on the same
renderer work.
2018-02-03 13:24:55 +01:00
Timm Bäder
3d65019e98 notebook: Handle touch events for tabs
No need to check for the event type here.
2018-02-03 12:23:00 +01:00
Timm Bäder
98e30f82b9 widget: Remove realized checks from _translate_coordinates
As discussed.
2018-02-03 12:22:56 +01:00
Timm Bäder
8f7a8ada18 widget: Don't call snapshot vfunc if width or height are 0
The result won't be visible anyway. This also prevents problems with
widgets that create some resource the size of the widget, like
GtkGLArea. It also keeps us from snapshotting revealers with
size 0.
2018-02-03 12:22:52 +01:00
Timm Bäder
f52100c46e iconbrowser: setup image dnd for image6
Otherwise the we fail to set the drag source icon name later on.
2018-02-03 12:22:46 +01:00
Emmanuele Bassi
2432e53652 Remove all gdk_threads_* entry points
Now that we don't use them anywhere, it's time for them to go.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
888dfe499d Drop the Big GDK Lock
GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:07:10 +01:00
Emmanuele Bassi
c655759cef Replace gdk_threads_add_timeout* with g_timeout_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Emmanuele Bassi
334acbfc39 Replace gdk_threads_add_idle* with g_idle_add()
The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.

https://bugzilla.gnome.org/show_bug.cgi?id=793124
2018-02-03 12:06:58 +01:00
Benjamin Otte
dfc131c7ec toolpalette: Remove
The widget was basically unmaintained since GTK 3.0 and the only known
user was Glade.
2018-02-03 11:52:37 +01:00
Benjamin Otte
55874470ff gtk: Remove GtkRecentChooser
It's not used any more, recent files are only used by the filtchooser
and that one uses GtkRecentManager directly.
2018-02-02 23:01:31 +01:00
Benjamin Otte
bb8baa2b76 tests: Unrealize renderer
Renderers must be unrealized these days.
2018-02-02 15:34:34 +01:00
Benjamin Otte
38b25599d8 texture: Add sanity checks to constructors
width, height and GL texture ID may not be 0, so return_if_fail() if
they are.
2018-02-02 14:59:23 +01:00
Benjamin Otte
df0b4d6684 texture: Make the texture id a guint
Texture IDs are unsigned, so treat them like that.
2018-02-02 14:59:23 +01:00
Emmanuele Bassi
fcaa9aa22d Rename GtkActionMuxer's private header
Follow the naming policy for private headers.
2018-02-02 10:28:17 +01:00
Emmanuele Bassi
1ed17df7a0 Rename GtkActionHelper private header
Follow the naming scheme for private headers.
2018-02-02 10:28:17 +01:00
Emmanuele Bassi
0ec744a3a5 Split list of sources
We need to have two lists: one, with the list of sources that need to be
introspected; and one with the list of sources that contain only private
symbols.

This reduces the amount of source files that the introspection scanner
needs to traverse, and thus the build time.
2018-02-02 10:28:17 +01:00
Emmanuele Bassi
b8828023e6 docs: Annotate gdk_keymap_get_display()
Avoid a warning from the introspection scanner.
2018-02-01 16:13:53 +01:00
Emmanuele Bassi
3a2aa2bd80 Remove unnecessary gtk-doc stanza
The places sidebar is not a publicly documented API, so there's no need
to use a gtk-doc stanza — especially if the syntax of the stanza is
wrong.
2018-02-01 16:08:51 +01:00
Emmanuele Bassi
a379ddefc3 Remove leading underscore from private symbols
There's no need to do that any more, as only explicitly annotated
symbols are exported.
2018-02-01 16:05:58 +01:00
Emmanuele Bassi
fe142b10bf Rename gtkiconcachevalidator.h
Follow the same convention for private headers as newer parts of GTK.
2018-02-01 16:01:38 +01:00
Emmanuele Bassi
e090c1f1a9 Rename gtkiconcache.h
The gtkiconcache.h header is private, so rename it to follow the naming
scheme for private headers.
2018-02-01 15:34:57 +01:00
Emmanuele Bassi
a313417879 Replace boilerplate in GtkIcon
Be a good GObject citizen and use G_DECLARE_FINAL_TYPE instead of
writing the usual GObject boilerplate.
2018-02-01 15:30:39 +01:00
Matthias Clasen
8916ff8ffe iconview: Fix a problem with the previous change
After commit ffef28a7e8,
gtk-icon-browser was spewing critical warnings when
changing sections. Avoid that by respecting the return
value of gtk_tree_model_get_iter.
2018-01-31 17:44:26 +01:00
Benjamin Otte
02892c59d1 dnd: Remove unused member variable 2018-01-31 13:21:26 +01:00
Benjamin Otte
bdd2f68ab5 dnd: Move GdkDragProtocol to X11
It's not needed in the generic implementation, so don't have it there.
2018-01-31 13:21:26 +01:00
Benjamin Otte
3e0fab6b93 dnd: Remove 2 vfuncs that aren't needed
They're only used inside the X11 backend, and the backend can just call
its own function.
2018-01-31 13:21:26 +01:00
Timm Bäder
e8986d18c2 icon browser: Remove usage of stock-size property
Does not exist anymore.
2018-01-30 21:51:59 +01:00
Timm Bäder
972c0fa998 Revert "menu: Simplify popup_at_rect"
This reverts commit a29306cb1e.
2018-01-30 21:51:59 +01:00
Timm Bäder
c8a936cdcc range: Always queue an allocate if the adjustment changed
The slider gets its new size in size-allocate, so we have to do this
even if the range has no origin.
2018-01-30 21:51:50 +01:00
Jason Gerecke
6fd6ff2ea1 wayland: Add support for BTN_STYLUS3
BTN_STYLUS3 is defined by the Linux 4.15 kernel and is sent when the
third button on a stylus is pressed. At the moment, only Wacom's "Pro
Pen 3D" has three stylus buttons. Pressing this button triggers a button
8 event to be sent under X11, so we use the same mapping here.

https://bugzilla.gnome.org/show_bug.cgi?id=790033
2018-01-30 21:32:07 +01:00
Nuclear Sunshine
cb5c739f93 Add AGPL3-only licence to GtkAboutDialog
https://bugzilla.gnome.org/show_bug.cgi?id=792793
2018-01-28 14:36:28 +00:00
Timm Bäder
228b35c111 gl: Add test case for clipped cross fade nodes 2018-01-27 12:19:22 +01:00
Timm Bäder
6e70079e63 gl renderer: Reset clip when drawing offscreen
Just like we reset the scissor test and the viewport, we also can't use
the current clip anymore in this case.
2018-01-27 12:13:37 +01:00
Timm Bäder
c1882fe44e GskRoundedRect: Fix GSK_ROUNDED_RECT_INIT macro
GskRoundedRect does not have a .rect member, it's 'bounds'. Also,
properly initialize all fields, i.e. all the corners.
2018-01-27 12:11:49 +01:00
Timm Bäder
684624005a gl renderer: Fix hidpi cairo node rendering
We can't just unconditionally create a larger texture here, since the
incoming cairo surface might have a device scale that doesn't fit our
scale_factor. Instead, look up the surface device scale and use that.
2018-01-27 11:06:38 +01:00
Timm Bäder
1fb5d389db gl renderer: Make width/height relation more obvious
In add_offscreen_ops, we use the max_x/min_x values for the texture and
viewport width, and the max_y/min_y for the texture and viewport height.
2018-01-27 11:00:59 +01:00
Timm Bäder
794d9d266e inspector: Actually call the pick() vfunc when picking
Otherwise, overridden pick vfuncs don't work and we e.g. pick widgets
scrolled away in a viewport.
2018-01-26 17:29:30 +01:00
Timm Bäder
60fdeda599 entry: Remove unused struct members 2018-01-26 17:29:30 +01:00
Timm Bäder
a29306cb1e menu: Simplify popup_at_rect
No need to keep a separate current_event variable around, we don't use
it anyway.
2018-01-26 17:29:30 +01:00
Matthias Clasen
f00f5508d4 gdk: Stop referring to ::key-press/release-event
These signals are going away, don't mention them in
the docs.
2018-01-24 12:04:32 +01:00
Matthias Clasen
063592f350 entry completion: Stop using key-press/release-event
We can use the existing ::event handler for this.
2018-01-24 12:04:27 +01:00
Timm Bäder
6806c28b1e gsk: Add test case for last commit 2018-01-23 21:46:31 +01:00
Timm Bäder
e3557f681c gl renderer: Fix outset shadow outline transform
This fixes hidpi blurred outset shadows
2018-01-23 21:46:31 +01:00
Emmanuele Bassi
f83b3c8af2 Enforce UTF-8 encoding when opening C files
We have a couple of Python 3.x scripts that parse C files, and since C
does not have any encoding, we need to force one ourselves, to avoid the
case when we're running the build in a non-UTF-8 locale.

https://bugzilla.gnome.org/show_bug.cgi?id=792497
2018-01-23 14:04:49 +01:00
Daniel Boles
b91fc17a19 Widget: Don’t call reset() on NULL EventController
GtkGesture is a GtkEventController. gtk_event_controller_dispose() calls
_gtk_widget_remove_controller(). That NULLs the pointer-to-Controller in
our EventControllerData but does not delete said ECData from our GList.

Subsequently, if that same Widget gets unparent()ed, that method calls
unset_state_flags(), which leads to doing reset_controllers() if we are
insensitive. Now, unlike most most other loops over the GList of ECData,
reset_controllers() does not skip nodes whose pointer-to-Controller is
NULL. So, we call gtk_event_controller_reset(NULL) and get a CRITICAL.

This surfaced in a gtkmm program. The Gesture is destroyed before the
Widget. The Widget then gets dispose()d, which calls unparent()… boom.
I didn’t find an MCVE yet but would hope this logic is correct anyway:

The simplest fix is to make the loop in gtk_widget_reset_controllers()
skip GList nodes with a NULL Controller pointer, like most other such
loops, so we avoid passing the NULL to gtk_event_controller_reset().

In other, live cases, _gtk_widget_run_controllers() loops over the GList
and removes/frees nodes having NULL Controllers, so that should suffice.
But this clearly was not getting a chance to happen in the failing case.

https://bugzilla.gnome.org/show_bug.cgi?id=792624
2018-01-22 19:10:58 +00:00
GNOME Translation Robot
37482c81c7 Update Esperanto translation
(cherry picked from commit 814c55d473)
2018-01-22 18:35:04 +00:00
Juan Pablo Ugarte
f2019e61db GtkGestureMultiPress: check event state before emiting released signal
Fix bug 771986 "Inconsistent 'row-activated' signal emission before \
drag'n'drop, 'activate-on-single-click'=TRUE, 'reorderable'=TRUE"
2018-01-22 15:52:58 +01:00
Timm Bäder
fbd79d8fea widget: Only initialize bounds rect if necessary
We only use the graphene_rect_t version of the offset_clip for the
fallback cairo nodes.
2018-01-21 20:37:46 +01:00
Timm Bäder
fb81686a89 vulkan: Fix release builds 2018-01-21 15:23:17 +01:00
Timm Bäder
d6c2ef3b71 combobox: Remove some unneeded includes 2018-01-21 11:01:32 +01:00
Simon McVittie
e22990302a Set GDK_WINDOW_STATE_TILED if any edge is tiled
This state flag is used in several places in GTK+, for example to
ignore RESIZE_INC hints if tiled. Setting it is also necessary for
backwards compatibility with applications that changed their behaviour
when tiled, such as GNOME Terminal and its MATE fork.

Signed-off-by: Simon McVittie <smcv@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=789357
2018-01-20 13:10:49 +01:00
Georges Basile Stavracas Neto
42ff22f222 display-x11: Unset tiled state if _GTK_EDGE_CONSTRAINTS is supported
Commit c415bef5de introduced support for the new _GTK_EDGE_CONSTRAINTS
atom. If the compositor supports that atom, however, we were always
setting the tiled state, even if no actual tiling information is
available, where the correct action is to completely remove any traces
of the tiled state.

Fix that by correctly removing the tiled state when compositor supports
_GTK_EDGE_CONSTRAINTS Xatom.

https://bugzilla.gnome.org/show_bug.cgi?id=788516
2018-01-20 13:10:42 +01:00
Timm Bäder
4d36a0bf35 entrycompletion: Realize toplevel before attempting a grab
Otherwise, gtk_widget_get_window returns NULL and we can't successfully
perform a grab via the later gdk_set_grab call. This fixes the entry
completion in the file chooser not working.
2018-01-19 22:39:23 +01:00
Matthias Clasen
af0d876bb7 tests: Remove some unneeded gtk_widget_show calls
Widgets are visible by default now.
2018-01-19 23:29:13 +03:00
Matthias Clasen
ffef28a7e8 iconview: Fix updates with filter models
Filter models rely on views taking a ref on every node
they care about. GtkIconView was not doing that. Amazingly,
this has never shown up in a bug so far, until I spotted
the fallout in gnome-font-viewer.
2018-01-19 23:29:13 +03:00
Matthias Clasen
f942d6f53c Add a test for ::row-changed vs node refs
Test that filter models propagate ::row-changed if there is
an external reference on the node, and not otherwise. This
is showing up in buggy icon view behaviour, where the icon
view is not redrawing if the content changes in a model that
is below a filter model.
2018-01-19 23:29:13 +03:00
Carlos Garnacho
7d9af6d700 gtkwindow: Disconnect GdkSeat::device-removed callback on finalize
Otherwise dangling callbacks may lead to crashes.
2018-01-19 18:47:21 +01:00
Timm Bäder
8f4e0705dc gl renderer: Fix shadow node child offset
We shouldn't apply the shadow offset when drawing the child offscreen,
instead apply it afterwards when we draw it to the current render
target.
2018-01-19 15:00:22 +01:00
Timm Bäder
87bdfbb02c testsuite: Add another gl renderer test case 2018-01-19 14:59:31 +01:00
Timm Bäder
e4be37eb60 linkbutton: Only set widget cursor once 2018-01-19 13:21:41 +01:00
Timm Bäder
8224e7ac72 inspector: Allow picking insensitive widgets
The default gtk_widget_contains/gtk_widget_pick don't consider
insensitive widgets.
2018-01-19 10:16:15 +01:00
Timm Bäder
2dca8f935c csswidgetnode: Avoid some unnecessary work
The later code would just ref both styles and not do anything else.
2018-01-19 09:57:49 +01:00
Timm Bäder
f595c0dc1b widget-factory: Fix some layout issues
We have to explicitly set some of these to their default values so
expand-set is TRUE and the boxes stop propagating their expansion state
up the hierarchy.
2018-01-19 09:53:39 +01:00
Timm Bäder
3265013268 textview: Remove some stray debugging output
Leftover from 7046463b88
2018-01-19 08:17:03 +01:00
Matthias Clasen
351559fcfa Simplify all ui files again
Now even simpler!
2018-01-18 17:53:44 -05:00
Matthias Clasen
6c805ecb0f builder-tool: Try harder to find types
If g_type_from_name fails, try gtk_builder_get_type_from_name
before giving up. This fixes cases like GtkPrinterOptionWidget.
2018-01-18 17:45:12 -05:00
Timm Bäder
8a432b42a2 window: Ignore gtk_window_close calls from close-request handlers 2018-01-18 15:10:49 +01:00
Timm Bäder
aee4634ee5 widget: Always assign values to out parameter in translate_coordinates
safe guard against people using the returned coordinate values without
checking the return value of gtk_widget_translate_coordinates.
2018-01-18 14:45:13 +01:00
Timm Bäder
cc9a4c1720 widget: Initialize a local variable
We will later pass this variable on to some other functions, so be safe
against them using the value.
2018-01-18 14:45:13 +01:00
Timm Bäder
d607312080 aboutdialog: Only close on delete events
Clicking on the Credits button should not close the dialog.
2018-01-18 14:45:08 +01:00
Timm Bäder
41dac661a0 fontchooswerwidget: Center spinbutton next to scales vertically 2018-01-18 09:40:19 +01:00
Timm Bäder
41a922928e gl renderer: Render GL textures upside down
These come from an FBO so we need to flip the texture coords on the y
axis, just like we do everywhere else.
2018-01-18 08:21:11 +01:00
Matthias Clasen
182272c0ab Revert "inspector: Stop adding event controllers to the object tree"
This reverts commit 8f3cb2658a.

This didn't quite work out, since being in the object tree is
a prerequisite for showing up in the property editor.
2018-01-17 23:49:17 -05:00
Matthias Clasen
e1d81d096c Document new texture api 2018-01-17 21:45:08 -05:00
Matthias Clasen
47b7bfd2ba Use the new api to release resources
When we unrealize a GL area with outstanding textures,
call gdk_texture_release_gl on them to avoid later crashes.
2018-01-17 20:19:19 -05:00
Matthias Clasen
5e302ae2cc Add a way to release GL resources
The inspector may hold on to render nodes and textures
beyond the lifetime of the widget (and thus the GL
resources). To handle this situation, allow the widget
to explicitly release the GL resources, and make
the texture available on the clent-side as a cairo
surface. This lets the recorder still show the content
after the widget is gone.
2018-01-17 20:15:45 -05:00
Matthias Clasen
34c63b8e4f glarea: Drop the dispose vfunc
This was causing us to leak, in the following scenario:
1) gtk_widget_destroy is called on a GL area
2) dispose is run and clears the context
3) the GL area is unrealized, but the context is already cleared,
   so we leak all the GL buffers
2018-01-17 19:49:52 -05:00
Matthias Clasen
0429008b16 glarea: Always delete textures on unrealize
We need to make the context current for deleting
textures as well, so just do it unconditionally.
2018-01-17 19:49:05 -05:00
Matthias Clasen
6ea827cde5 glarea: Avoid a crash
We must only delete the texture if it is not NULL.
2018-01-17 19:48:33 -05:00
Matthias Clasen
cdb2fcb554 gdkgears: add a way to remove gears
This is needed to test the GL resource cleanup
code paths.
2018-01-17 19:47:45 -05:00
Matthias Clasen
4f50bf23d3 glarea: Add a pool for GL textures
Handle the situation that a GL texture might remain
in use (e.g. by a slow frame, or by the recorder)
In that case, we can't modify it but must use a
new one. Keep a pool of GL textures for this eventuality.
2018-01-17 19:15:14 -05:00
Matthias Clasen
18dc994de7 inspector: Don't leak recordings
g_list_model_get_item is transfer full, so we need
to drop the references we get from it. This was showing
up while testing the GL texture cache in GtkGLArea.
2018-01-17 19:12:55 -05:00
Timm Bäder
5e7b3030b9 rendernodeimpl: Fix a crash
We may get a NULL renderer here.
2018-01-17 21:57:20 +01:00
Timm Bäder
7c47c7cdaf applicationwindow: Fix measure implementation
Really calculate the menubar height, not the width.
2018-01-17 21:57:20 +01:00
Timm Bäder
e7b3909fd1 sizerequest: Fix for_size adjustment
We need to pull the proper size from the size request cache and adjust
it accordingly.
2018-01-17 21:57:20 +01:00
Timm Bäder
27c76db956 box: Simplify some code
All out varibles in measure implementations must be non-null and -1 is
the default value for the baseline parameters.
2018-01-17 21:57:20 +01:00
Timm Bäder
e763dac72e box: Remove self assignment 2018-01-17 21:57:19 +01:00
Timm Bäder
8ab2c79b77 box: Remove useless if statement
We already check right before this one whether child->pack != packing
and if so, we continue to the next iteration. So, no need to check again
whether the inverted condition child->pack == packing is true, because
it is.
2018-01-17 21:57:19 +01:00
Timm Bäder
12be5ccbb7 label: Update layout width directly form allocation
For the one update_layout_width call in size_allocate, we can just use
the passed-in allocation width instead of a separate (relatively slow)
gtk_widget_get_width call.
2018-01-17 21:57:19 +01:00
Timm Bäder
8ad1b09a3a widget: Clip redrawn area to widget clip
The clip can already be modified in size_allocate, so we never want a
widget to invalidate more than its actual clip region.
2018-01-17 21:57:19 +01:00
Timm Bäder
c2d4f05ce0 box: Remove some unneeded checks
We only call this function from the measure implementation and we should
never get NULL pointers there.
2018-01-17 21:57:19 +01:00
Timm Bäder
c475047501 box: Remove an unnecessary local variable 2018-01-17 21:57:19 +01:00
Timm Bäder
3604816b9c box: Use GtkWidget's widget list in get_size 2018-01-17 21:57:19 +01:00
Timm Bäder
cb0d2616ff listbox: Don't assume that row child == focus widget
With widgets supporting child widgets and custom GtkListBoxRow
subclasses, this might not be true.
2018-01-17 21:57:19 +01:00
Timm Bäder
229ef9d776 widget: Remove reparent special case
Since gtk_widget_reparent doesn't exist anymore, we can also remove this
special case.
2018-01-17 21:57:19 +01:00
Timm Bäder
d3329bb36b container: Remove some unused includes 2018-01-17 21:57:19 +01:00
Timm Bäder
5590a2a943 viewport: Remove some unused includes 2018-01-17 21:57:19 +01:00
Matthias Clasen
736ccd34f0 gl area: Avoid trivialities
If we have zero pixels, no need to snapshot anything,
and produce GL errors while doing so.
2018-01-17 14:43:50 -05:00
Matthias Clasen
b6d85b9e31 gtk-demo: Add gears to the bowl
Just for fun.
2018-01-17 14:39:46 -05:00
Matthias Clasen
f3927f1155 Drop GtkGLArea::has-alpha
We now always behave as if has-alpha is TRUE.

Update all callers.
2018-01-17 12:01:25 -05:00
Matthias Clasen
5711fb9b26 Convert gtkglarea to use snapshots
Just append a texture node.

Note that this is not 100% done yet. The GL area really
needs to keep a pool of textures, and only reuse them
once the GdkTexture object is gone.
2018-01-17 12:00:13 -05:00
Matthias Clasen
31fcf5b3a7 gsk: Handle GL textures
These textures already have a GL texture in them,
no need to create a new one.
2018-01-17 11:57:25 -05:00
Matthias Clasen
b366ea84a7 gdk: Add a gl texture implementation
This will be used to pass a GL textures from the application
(or rather, GtkGLArea) down to the GSK GL renderer.
2018-01-17 11:56:47 -05:00
Matthias Clasen
e7cab2bc0c Drop removed api from the docs
This should have been part of the previous commit.
2018-01-16 23:33:40 -05:00
Matthias Clasen
77bab4e027 gdk: Drop some unused cursor apis
The query function for cursor sizes and capabilities
are not very interesting. At least, they are not used
in GTK+, and all backends but X11 just hardcode
made-up values anyway. So, lets drop them.
2018-01-16 23:32:01 -05:00
Matthias Clasen
ab1f17cb9a inspector: Stop using gdk_display_get_default_cursor_size
If the cursor theme size setting has no value, just hardcode 32.
Also, allow ridiculously large cursors, just for fun.
2018-01-16 23:25:50 -05:00
Matthias Clasen
35c78a995e tooltip: Stop using gdk_display_get_default_cursor_size
It makes more sense to use the actual cursor theme size here.
2018-01-16 23:25:50 -05:00
Matthias Clasen
3fa0d4dad7 testgtk: Stop using gdk_display_get_maximal_cursor_size
This function is going away. Just make a reasonable assumption
that cursor sizes up to 128 are supported.
2018-01-16 23:25:50 -05:00
Chris Lamb
edd1b0974c gtk/queryimmodules.c: Make the output deterministic.
Whilst working on the Reproducible Builds effort [0], we noticed that
queryimmodules generates non-reproducible output as it iterates over the
filesystem without sorting.

Patch attached.

 [0] https://reproducible-builds.org/

Signed-off-by: Chris Lamb <lamby@debian.org>

https://bugzilla.gnome.org/show_bug.cgi?id=786528
2018-01-16 22:38:32 -05:00
Matthias Clasen
e2f3b9b1cc tree model sort: Fix set_sort_column
We were failing to change the sort order for the
default sort column in some cases. Fix that, and
add a testcase for this issue.

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

Add a testcase for the previous fix
2018-01-16 18:17:54 -05:00
Matthias Clasen
42369e31e2 tree model sort: Fix initial default sort func
gtk_tree_sortable_has_default_sort_func should return
FALSE initially.
2018-01-16 18:15:13 -05:00
Matthias Clasen
33ec75944f Fix the icontheme test
We rely on log messages here. Since logging is per-display
now, we need to set a display on our custom icontheme object
to get the expected log messages.
2018-01-16 15:42:28 -05:00
Matthias Clasen
e8079df420 mountoperation: Fix a crash
We only create the gesture when the dialog is needed,
so don't free it unconditionally.
2018-01-16 14:50:25 -05:00
Matthias Clasen
e0990b2311 Drop ::button-press/release event
We are no longer using these, and there are several gestures
that can be used instead. If you need to catch raw button events,
use the ::event signal.
2018-01-16 14:14:11 -05:00
Matthias Clasen
fb2df00f15 popover: Stop using ::button-press/release-event
Just use a generic ::event handler.
2018-01-16 14:14:10 -05:00
Matthias Clasen
f768ae4281 menushell: Stop using ::button-press/release-event
Merge the handlers into the existing handler for ::event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
e8dfbf35e8 menu: Remove stray references to 'button_press'
No code change, but this string was still used in
docs and comments.
2018-01-16 14:14:10 -05:00
Matthias Clasen
15e67e27ca places sidebar: Stop using ::button-press/release-event
We'll use a generic ::event signal instead.
2018-01-16 14:14:10 -05:00
Matthias Clasen
10ac015ac6 gtk-demo: Stop using ::button-release-event 2018-01-16 14:14:10 -05:00
Matthias Clasen
ba844df6f0 tests: Stop using ::button-press/release-event
The generic ::event signal works fine here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
0c1ac9add4 testsuite: Stop using ::button-press-event
We can use the generic ::event signal instead.
2018-01-16 14:14:10 -05:00
Matthias Clasen
a2bce67d3b tests: Stop using ::button-press-event
A gesture will do here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
64c3db931d Drop ::motion-notify-event
We no longer emit this signal. You can use various gestures
and event controllers instead. If you need to catch raw
motion events, use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
f90659cde8 places sidebar: Stop using ::motion-notify-event
We can use the generic ::event signal here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
822f802aec docs: Stop referring to specific event signals
These are going away.
2018-01-16 14:14:10 -05:00
Matthias Clasen
4d31a89ec0 gtk-demo: Stop using ::motion-notify-event in the hypertext demo
We already have a generic ::event handler, just use it for this.
2018-01-16 14:14:10 -05:00
Matthias Clasen
81b8f0493a tests: Stop using ::motion-notify-event
We can use the generic ::event signal here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
472f5e4b13 treeview: Stop using ::button-press-event
We can just use a gesture here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
8dcafc597c recent chooser: Stop using ::button-press-event
We can just use a multipress gesture here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
ab283933be mount operation: Stop using ::button-press-event
A multipress gesture does just fine here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
9dc14b630d testinput: Port to a drag gesture
This replaces both button-press-event and motion-notify-event
handlers.
2018-01-16 14:14:10 -05:00
Matthias Clasen
fa0f637268 entry completion: Drop another ::button-press-event handler
This one will be replaced by a generic ::event handler.
2018-01-16 14:14:10 -05:00
Matthias Clasen
4b613c2f6a docs: Stop referring to legacy event signals
These are going away.
2018-01-16 14:14:10 -05:00
Matthias Clasen
a94d2826ae entry completion: Stop using ::button-press-event
Just use the existing ::row-activated signal on the treeviews.
2018-01-16 14:14:10 -05:00
Matthias Clasen
75c92ba867 gtk-demo: Stop using ::button-press-event
Use gestures instead.
2018-01-16 14:14:10 -05:00
Matthias Clasen
33e2f31de4 testgtk: Stop using ::button-press-event
This one example can just as well use a gesture.
2018-01-16 14:14:10 -05:00
Matthias Clasen
1818e7bed2 places view: Stop using ::button-press-event
Instead, use a multi-press gesture in the row widget,
and emit ::popup-menu from there.
2018-01-16 14:14:10 -05:00
Matthias Clasen
270b6d3a84 file chooser: Use a multipress gesture
This replaces the use of ::button-press-event. There's two
issues with this commit:
1) We don't have a good way to do the equivalent of
   gdk_event_triggers_context_menu with gestures
2) We have to defer to and idle to avoid ordering
   issues with the treeviews own gestures
2018-01-16 14:14:10 -05:00
Matthias Clasen
c8a6a1138b Revert "file chooser: Allow activating without double-click"
This reverts commit fb0a13b7f0.

It is getting in the way of gesture conversion, and didn't
really make anybody happy anyway.
2018-01-16 14:14:10 -05:00
Matthias Clasen
f042d7a9a8 app chooser: Use a gesture
Instead of connecting to ::button-press-event, use
a multipress gesture here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
d810ff8445 Remove a leftover icon-size property
This made the 'style classes' demo crash.
2018-01-16 14:14:10 -05:00
Matthias Clasen
9ba5f053d9 Drop ::focus-in/out-event
These signals are no longer used in GTK+.
If you need to catch focus events, use the ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
ad4287e338 treeview: Stop using ::focus-out-event
We can just use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
7ae240199b file chooser entry: Stop using ::focus-out-event
Just use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
5cb1c606bb spin button: Stop using ::focus-out-event
Just use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
4f3065a5e8 calendar: Stop using ::focus-out-event
Use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
e733aa43cf color editor: stop using ::focus-out-event
Again, the has-focus property is sufficient.
2018-01-16 14:14:10 -05:00
Matthias Clasen
5d57f0be8a text cell renderer: Stop using ::focus-out-event
The has-focus property works fine here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
7af2f73608 spin cell renderer: Stop using ::focus-out-event
The has-focus property works fine here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
04adcff624 combo cell renderer: Stop using ::focus-out-event
The has-focus property works fine here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
6d1dbec9dd tests: Stop using ::focus-in/out-event
The has-focus property works just as well here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
e3e00a2673 popover: Stop using ::focus-in/out-event
We can use the is-active property of the window instead.
2018-01-16 14:14:10 -05:00
Matthias Clasen
b12371e1b0 application: Stop using ::focus-in-event
We are really interested in the active window, so use
that property directly.
2018-01-16 14:14:10 -05:00
Matthias Clasen
7277d657d9 window: Stop using ::focus-in/out-event
We can just use the generic ::event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
327ec24e51 text view: Stop using ::focus-in/out-event
We can just use the generic ::event here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
253ac15928 entry completion: Stop using ::focus-out-event
We can just use ::event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
8c6c2be316 entry: Stop using ::focus-in/out-event
We can just use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
144448d18b a11y: Stop using ::focus-in/out-event
We can just use the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
5759bc59c9 Drop gtk_widget_hide_on_delete
This function is misnamed - it is only ever relevant for
windows. And with the ::hide-on-delete property , it is
no longer necessary to use the signal for this simple case.
2018-01-16 14:14:10 -05:00
Matthias Clasen
2b59917a9d Drop ::event-after
This signal is not used in GTK+, and we are reducing the
amount of widget signals devoted to events in favor of
event controllers.
2018-01-16 14:14:10 -05:00
Matthias Clasen
1c2e09116a Drop ::grab-broken-event
This signal is no longer used in GTK+. Grab broken events
can be handled with the generic ::event signal.
2018-01-16 14:14:10 -05:00
Matthias Clasen
0583b80d1b button: Stop using ::grab-broken-event
The event-specific signals are going away. Just use ::event here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
4bbda548b7 menushell: Stop using ::grab-broken
The event-specific signals are going away. Just use ::event here.
2018-01-16 14:14:10 -05:00
Matthias Clasen
fa07fe2124 notebook: some cleanup 2018-01-16 14:14:10 -05:00
Matthias Clasen
af8bf498e9 notebook: Use a motion event controller
This lets us avoid the ::motion-notify-event handler.
2018-01-16 14:14:10 -05:00
Matthias Clasen
7046463b88 textview: Use a motion event controller
This lets us replace the ::motion-notify-event handler.
2018-01-16 14:14:10 -05:00
Matthias Clasen
f594807c0a Drop ::enter/leave-notify-event
These signals are no longer used in GTK+ and have a (not quite
perfect yet) replacement with GtkEventControllerMotion.

If you need to catch the raw events, the generic ::event
signal still works.
2018-01-16 14:14:10 -05:00
Matthias Clasen
06605d54f2 menu: Use a motion event controller
This lets us replace the ::enter/leave-notify-event handlers.
Not that there is a FIXME here - we currently can't get the
crossing mode from the event controller, so we have to fall
back to gtk_get_current_event().
2018-01-16 14:14:10 -05:00
Matthias Clasen
6acf276a1a menuitem: Use a motion event controller
This lets us replace the ::enter/leave-notify-event handlers.
Not that there is a FIXME here - we currently can't get the
crossing mode from the event controller, so we have to fall
back to gtk_get_current_event().
2018-01-16 14:14:10 -05:00
Matthias Clasen
118424bd93 iconview: Use a motion event controller
This can replace ::motion-notify-event and ::leave-notify-event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
ab4f4fb045 scrolled window: Use a motion event controller
This lets use replace one of the last uses of ::leave-notify-event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
9ceafd7c38 entry completion: Drop initial selection avoidance
This is a minor thing, and it is hard to recreate
with event controllers, so drop it for now.
2018-01-16 14:14:10 -05:00
Matthias Clasen
a2a80f8a15 treeview: Use a motion event controller
This replaces handlers for ::enter/leave/motion-notify-event.
2018-01-16 14:14:10 -05:00
Matthias Clasen
cf9074a2e9 Add x/y to GtkEventControllerMotion::enter
We have this information available in enter events,
and having it in the controller signal as well makes
porting easier.

Update existing users.
2018-01-16 14:14:10 -05:00
Matthias Clasen
a9d468a4c8 Drop ::configure-event
This signal is unused in GTK+ and configure events are handled
internally by GtkWindow.

If you need to catch configure events, the generic ::event
signal still works.
2018-01-16 14:14:10 -05:00
Matthias Clasen
59572e5fcf window: Stop using ::configure-event
We already have a generic ::event handler that we
can just press into service for this.
2018-01-16 14:14:10 -05:00
Matthias Clasen
8338b0f0cc testgtk: Stop using ::configure-event 2018-01-16 14:14:10 -05:00
Matthias Clasen
2e04817701 xim: Stop using ::configure-event
The generic ::event will do.
2018-01-16 14:14:10 -05:00
Matthias Clasen
cbf1ff98f7 tests: Stop using ::configure-event
The generic ::event will do.
2018-01-16 14:14:10 -05:00
Matthias Clasen
fa885f437c Drop ::touch-event
This signal is not used in GTK+, and has a suitable
replacement with GtkGesture and its subclasses.

If you need to catch the raw touch events, the generic ::event
signal still works, too.
2018-01-16 14:14:10 -05:00
Matthias Clasen
47712a826b Drop ::scroll-event
This signal is not used in GTK+, and has a suitable
replacement with GtkEventControllerScroll.

If you need to catch these events, the generic ::event
signal still works, too.
2018-01-16 14:14:10 -05:00
Matthias Clasen
e93c2517e6 Drop ::proximity-in-event and ::proximity-out-event
These are unused in GTK+, and are not very common.
If you need to catch these events, the generic ::event
signal still works.
2018-01-16 14:14:09 -05:00
Matthias Clasen
fd2a3b602f Drop ::map-event and ::unmap-event
These are unused in GTK+, and are not very common.
If you need to catch these events, the generic ::event
signal still works.
2018-01-16 14:14:09 -05:00
Matthias Clasen
ab53142c0f window: Stop using ::map-event
Use ::event here, since we want to drop the event-specific
signals, and we already have a handler for the generic signal.
2018-01-16 14:14:09 -05:00
Matthias Clasen
1e0ae936fe widget: Stop using ::map-event
Use ::event here, since we want to drop the event-specific
signals.
2018-01-16 14:14:09 -05:00
Matthias Clasen
7b581ca096 Drop GtkWidget::destroy-event
This signal is unused in GTK+, and is documented as
'hard to ever get', so there's no good reason for
keeping it.
2018-01-16 14:14:09 -05:00
Matthias Clasen
2b52b4be5d Drop GtkWidget::delete-event
Nobody is using this signal anymore, and ::delete is there
for the few places where it is needed.
2018-01-16 14:14:09 -05:00
Matthias Clasen
41e4c93443 Replace all remaining uses of delete-event 2018-01-16 14:14:09 -05:00
Matthias Clasen
a739ee6905 Replace GtkWidget::delete-event by GtkWindow::close-request
The event is not useful at all, so we are better off
with a signal that doesn't have it, and it is only
relevant on toplevel windows, so we don't need it on
GtkWidget.

With this commit, delete events no longer go through the
::event, ::delete-event, ::event-after widget signals,
but just cause the ::close-request signal on GtkWindow to be
emitted.
2018-01-16 14:14:09 -05:00
Matthias Clasen
1c3f8ba252 testoverlay: Use an event controller
We can stop using ::enter-notify-event here, and use
our new motion event controller instead.
2018-01-16 14:14:09 -05:00
Matthias Clasen
96b2b1b2f3 testgtk: Redo the event watcher case
Make this watch for emissions of ::event, since we
want to get rid of individual signals first.
2018-01-16 14:14:09 -05:00
Matthias Clasen
6ac33215a5 testgtk: Use an event controller for 'testing scrolling'
The current code was not working with smooth scroll events,
for starters.
2018-01-16 14:14:09 -05:00
Matthias Clasen
97f805b888 testinput: Drop some no-op signal handlers
These were not doing anything.
2018-01-16 14:14:09 -05:00
Matthias Clasen
76fea5c5fa treeview: Don't handle ::delete-event
I don't think there is a way to get a delete event
on this popup - there's no window decorations, no close
button, etc. So no need to handle ::delete-event.
2018-01-16 14:14:09 -05:00
Matthias Clasen
7e491fd3fc font chooser: Stop using ::scroll-event
We have an event controller for this purpose now.
2018-01-16 14:14:09 -05:00
Matthias Clasen
d2edcf489b treeview: Use a scroll event controller
This is the recommended way to deal with scroll events
now.
2018-01-16 14:14:09 -05:00
Matthias Clasen
3cb93a479a tests: Avoid a use of ::map-event
We can use the ::map signal here instead.
2018-01-16 14:14:09 -05:00
Matthias Clasen
1e8a336993 gtk-demo: Drop a use of ::event-after
It works just fine with ::event as well.
2018-01-16 14:14:09 -05:00
Matthias Clasen
4923da3550 Drop gtk_true and gtk_false
These functions are entirely trivial, their documentation
is much longer than their implementation, and it contains
an example that is annotated as "don't do this"...
2018-01-16 14:14:09 -05:00
Matthias Clasen
75271c44c2 inspector: Stop using ::delete-event signal
We can just use GtkWindow::hide-on-close instead.
2018-01-16 14:14:09 -05:00
Matthias Clasen
ff8ba1149d icon-browser: Stop connecting to ::delete-event
We can just use GtkWindow::hide-on-delete
2018-01-16 14:14:09 -05:00
Matthias Clasen
ca227af4ff widget-factory: Stop connecting to ::delete-event
We can use GtkWindow::hide-on-close instead
2018-01-16 14:14:09 -05:00
Matthias Clasen
eda3b43553 gtk-demo: Stop using ::delete-event 2018-01-16 14:14:09 -05:00
Matthias Clasen
67649763b6 tests: Stop using the delete-event signal
We can use ::destroy in most cases.
2018-01-16 14:14:09 -05:00
Matthias Clasen
e7bd666711 treeview: Stop using gtk_true 2018-01-16 14:14:09 -05:00
Matthias Clasen
f0fb705aae doc tools: Stop using gtk_true 2018-01-16 14:14:09 -05:00
Matthias Clasen
c4513a6737 dialog: Stop using the ::delete-event signal
We can achieve the desired result with a class handler
and the ::hide-on-close property.
2018-01-16 14:14:09 -05:00
Matthias Clasen
d6e92cd984 file chooser native: Stop connecting to ::delete-event
We can just use GtkWindow::hide-on-close.
2018-01-16 14:14:09 -05:00
Matthias Clasen
d0f071aae9 file chooser button: Stop connecting to ::delete-event
We can just use GtkWindow::hide-on-close.
2018-01-16 14:14:09 -05:00
Matthias Clasen
a1b6bf19c1 applicationwindow: Stop connecting to ::delete-event
We can just use GtkWindow::hide-on-close.
2018-01-16 14:14:09 -05:00
Matthias Clasen
59878f281f about dialog: Stop connecting to ::delete-event
We can just use GtkWindow::hide-on-close.
2018-01-16 14:14:09 -05:00
Matthias Clasen
c86e8d0e60 color button: Stop connecting to ::delete-event
We can just use GtkWindow::hide-on-close.
2018-01-16 14:14:09 -05:00
Matthias Clasen
b919c3348f font button: Use GtkWindow::hide-on-close
Instead of the ::delete-event signal.
2018-01-16 14:14:09 -05:00
Matthias Clasen
c04f192113 window: Add a hide-on-close property
This lets us avoid ::delete-event signal handlers for just
this purpose.
2018-01-16 14:14:09 -05:00
Piotr Drąg
0101bbd441 Update Polish translation 2018-01-15 22:19:28 +01:00
Matthias Clasen
370d666406 inspector: Avoid a critical
I forgot to initialized the text field when I added
it back.
2018-01-15 08:01:54 -05:00
Matthias Clasen
3358c1fb32 vulkan: use GDK_DISPLAY_NOTE
Where we have a display, we should use the per-display logging.
2018-01-15 08:01:01 -05:00
Timm Bäder
e048889a12 vulkan: Fix build
This was changed in e151058dff but
GDK_NOTE only takes 2 arguments.
2018-01-15 11:02:37 +01:00
Timm Bäder
22c0a77ac5 tests: Update gl outset shadow tests
The results are slightly different for these now.
2018-01-15 10:57:25 +01:00
Timm Bäder
4946810960 gl renderer: Render unblurred outset shadows differently
We don't need to draw anything to a texure for those.
2018-01-15 10:56:43 +01:00
Timm Bäder
df35d00a1d gskcairoblur: Don't apply y_scale twice
A version of 29f36fed08 but for the blur
we use in gsk.
2018-01-15 10:56:43 +01:00
Matthias Clasen
76ac46405f Update docs for debug cleanup
Drop mention of GDK_GL, GDK_VULKAN and GDK_RENDERING_MODE,
add docs for GSK_DEBUG and new debug keys that were added.
2018-01-14 17:05:04 -05:00
Matthias Clasen
978c597e94 inspector: Some logging support
Add a way to toggle debug output on and off
from the inspector. For now, we don't add a
log viewer here, since that has the risk of
deadlock until we've the logging completely
separated by display, and also requires us
to install a log writer function, which
libraries are not supposed to do.
2018-01-14 17:05:04 -05:00
Matthias Clasen
f9100719bd inspector: Turn off gsk debugging
We don't want debug spew from the renderer that
is used for the inspector window, so turn it off.
2018-01-14 17:05:04 -05:00
Matthias Clasen
2be16f36ed gsk: Add a setter for debug flags
We need to set the global flags, since these are picked
up initially by new renderers.
2018-01-14 17:05:04 -05:00
Matthias Clasen
ba21a7764b gsk: Reorganize env vars
Get rid of GSK_RENDERING_MODE and add the flags to GSK_DEBUG,
following the same pattern we use in gdk now.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c3215de005 gtk Use per-renderer flags for node names
We are moving to per-renderer flags, so lets check them here.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c56419818f gsk: make logging per-renderer
Add a setter for per-renderer debug flags, and use
them where possible. Some places don't have easy access
to a renderer, so this is not complete.
Also, use g_message instead of g_print throughout.
2018-01-14 17:05:04 -05:00
Matthias Clasen
782c76c146 gsk: Drop unused debug flags
We are not logging anything for transforms or rendernodes atm.
2018-01-14 17:05:04 -05:00
Matthias Clasen
55585aec73 gsk: Clarify a debug message
We are printing a window type, not a display.
2018-01-14 17:05:04 -05:00
Matthias Clasen
845ae20954 wayland: Use g_message for logging
g_printerr is not the best for this.
2018-01-14 17:05:04 -05:00
Matthias Clasen
1d2606dc94 Drop the cairo-recording debug flag
It is not very useful. The cairo-image option on the
other hand is has been useful in tracking down problems
in the past, so we'll keep it.
2018-01-14 17:05:04 -05:00
Matthias Clasen
08dc2cd6a8 Drop the gl-always debug option
This doesn't seem very useful.
2018-01-14 17:05:04 -05:00
Matthias Clasen
e151058dff Make gdk logging per-display
As far as possible, use per-display debug flags.

This will minimize the debug spew that we get from
the inspector if it is running on a separate display.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c5fc841285 gdk: Reorganize env vars
Drop GDK_GL, GDK_VULKAN and GDK_RENDERING_MODE.
Merge the useful bits into GDK_DEBUG.
Drop unused debug flags (CURSOR).
2018-01-14 17:05:04 -05:00
Matthias Clasen
af7f695068 Make geometry logging per-display
Use the new macro to do this.
2018-01-14 17:05:04 -05:00
Matthias Clasen
461d05f643 icon theme: Make logging per-display
As far as possible, for now. This needs some more
work to cover all locations.
2018-01-14 17:05:04 -05:00
Matthias Clasen
22e59ecd28 gtk: add a per-display log macro
This makes the conversion easier.
2018-01-14 17:05:04 -05:00
Matthias Clasen
c2793de6e2 Add a display property to keymaps
This is a general pattern we want to follow for all
objects in GDK. Also add a getter.
2018-01-14 17:05:04 -05:00
Piotr Drąg
a074eba16b Update Polish translation 2018-01-14 20:53:04 +01:00
Daniel Boles
e99992669c GdkMonitor: Fix link to nonexistent Display method
There is no gdk_display_get_monitors(). Instead, we have to use
gdk_display_get_n_monitors() and gdk_display_get_monitor(int).
2018-01-13 20:06:39 +00:00
Daniel Boles
db6127a118 HeaderBar: Explain use in conjunction w/ GtkWindow
After hinting how good GtkHeaderBar is for GtkWindow, let’s link to
the latter and indicate how users can make the two work together.
2018-01-13 20:06:20 +00:00
Daniel Boles
e0f69353bb Window: Mention GtkHeaderBar in set_titlebar() doc
This is the typical thing passed here and what most users want, so we
should mention it here, rather than requiring users to figure it out.
2018-01-13 20:06:20 +00:00
Daniel Boles
339d355dda Window: Clarify resize() doc about titlebar widget
Clarify the reference to HeaderBar, as it applies to any custom title
widget; HeaderBar is only the most common one used. Also, fix a typo.
2018-01-13 20:06:20 +00:00
Timm Bäder
f8d235ecc2 tooltip: Fix tooltip positions
Since gtk_widget_get_allocation doesn't return x/y values relative to
the GdkWindow anymore, we need to manually translate the widget
coordinates here.
2018-01-13 10:39:16 +01:00
Timm Bäder
e64028b41d tooltip: Remove some unused members 2018-01-13 10:23:01 +01:00
Timm Bäder
256bf3bf25 tooltip: Remove some unused includes 2018-01-13 10:23:01 +01:00
Timm Bäder
fc711040d1 tooltip: Remove custom picking code
Just use gtk_widget_pick here for now. This also makes tooltips of
widgets work which are not inside a container.
2018-01-13 10:23:01 +01:00
Timm Bäder
aa17c20951 window: Remove a resize grip mention from the docs 2018-01-13 10:23:01 +01:00
Timm Bäder
32166a9595 adwaita: Regenerate proper CSS 2018-01-13 07:39:54 +01:00
Timm Bäder
d8f6b12685 tooltip: Remove excessive padding
tooltips support padding now, just like everthing else.
2018-01-12 22:34:22 +01:00
Timm Bäder
c910a955d1 window: Fix tooltip allocation
Using get_preferred_size here does not work since it computes the
minimum height for the minimum width, but we want to know the minimum
height for the current width.
2018-01-12 22:34:22 +01:00
Timm Bäder
846a6e8157 tooltip: Fold a function into its only caller 2018-01-12 22:34:22 +01:00
Timm Bäder
badcf022bf gdk: Remove unused GdkStatus enum 2018-01-12 22:34:22 +01:00
Timm Bäder
abc0f67cf6 main: Set event user data earlier
event_widget is not modified anymore after the assignment from
handle_pointing event and we need the event's user data set for the
_gtk_window_check_handle_wm_event call.
2018-01-12 22:34:22 +01:00
Matthias Clasen
d1eb8cd809 x11: Only set the keymap display once
Not necessary to do this more than once.
2018-01-12 09:24:08 -05:00
Matthias Clasen
d72508590b wayland: Set display on keymaps
This was forgotten so far: The display of keymaps
was NULL.
2018-01-12 09:23:59 -05:00
Matthias Clasen
87e9f0895b Split NEWS
Split the NEWS file at the major release boundaries.
2018-01-10 19:06:45 -05:00
Matthias Clasen
0f76228c15 docs: Mention textures in the GtkImage docs
This is now the preferred way to load images.
2018-01-10 16:43:17 -05:00
Timm Bäder
185525a58d scrolledwindow: Remove workarounds
Instead of making sure here that the scrollbars are the last children,
just add the bin child as first one and keep the scrollbars last.
2018-01-10 16:36:59 +01:00
Timm Bäder
6652beae65 magnifier: gtk_snapshot_finish may return NULL 2018-01-10 16:36:59 +01:00
Matthias Clasen
76461a8004 Quiet a compiler warning
Avoid this warning the other way, without bumping the libvulkan
dependency.
2018-01-10 07:35:46 -05:00
Matthias Clasen
5009c691ac Revert "Quiet a compiler warning"
This reverts commit 888f289114.
2018-01-10 07:34:36 -05:00
Timm Bäder
60d3378dd1 entry: Fix text clipping
Clipping the text to the entire widget allocation is wrong if there are
icons involved.
2018-01-10 11:02:10 +01:00
Timm Bäder
6235b12ca4 entry: Fix get_text_allocation
These should be reported in GtkEntry coordinates, so relative to the
entry's origin. This fixes entrys with top/bottom padding applied.
2018-01-10 10:49:13 +01:00
Timm Bäder
77769a52b3 adwaita: Add some spacing to the scale value
So the slider does not overlap the value label. Since the value label is
allocated at the widget edge in gtk3, the correct fix here would
probably be to remove the 12px padding we apply to the entire scale and
instead apply it only to the trough.
2018-01-10 10:11:31 +01:00
Руслан Ижбулатов
266d4b31b8 GDK W32: Remove non-managed DnD code
All DnD is now managed in GDK.

This commit also rearranges some code in _gdk_win32_window_drag_begin().

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-01-10 16:57:31 +08:00
Руслан Ижбулатов
b11b342ad4 GDK W32: stop using the OWNERCHANGE event
It was removed completely. For now just comment out the code that used to emit it.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-01-10 16:57:24 +08:00
Timm Bäder
15b3f33965 adwaita: Fix scale styling for latest changes 2018-01-10 09:29:45 +01:00
Timm Bäder
b9531e3a7c scale: Allocate marks widget along the trough 2018-01-10 09:29:05 +01:00
Timm Bäder
04ade9483b testheightforwidth: Remove "vertical labels" test
This was testing lables with the angle property set, which doesn't exist
anymore.
2018-01-10 08:46:22 +01:00
Timm Bäder
31974e02ca renderbackground: Avoid excess css value lookups
We iterate over all background layers twice, so only lookup blend mode
vlaues once.
2018-01-10 08:46:22 +01:00
Timm Bäder
5e39f3c23b renderbackground: Add some constness 2018-01-10 08:46:22 +01:00
Timm Bäder
c9e6fcd5fa renderbackground: Pull out a gdk_rgba_is_clear check
We only call snapshot_color once, and this way it's clearer that nothing
will happen for a clear color from the caller side.
2018-01-10 08:46:22 +01:00
Timm Bäder
b6ee3490c3 GdkDrawingContext: Add missing nullable annotation 2018-01-10 08:46:22 +01:00
Timm Bäder
b9a05be2da gl renderer: Sprinkle some const around 2018-01-10 08:46:22 +01:00
Timm Bäder
1a8b9e9180 widget: Refine docs a bit 2018-01-10 08:46:22 +01:00
Matthias Clasen
6cab57d7ed Document the new GDK_VULKAN_DEVICE envvar
Best to document them while they're fresh.
2018-01-10 00:14:10 -05:00
Matthias Clasen
8d24105642 Document the GDK_VULKAN env var
This was not documented at all yet.
2018-01-10 00:11:25 -05:00
Matthias Clasen
adc780f2b8 Add missing debug keys to the docs
Several values for GDK_DEBUG were missing from the docs.
2018-01-10 00:09:25 -05:00
Matthias Clasen
4dbae1d4bf Drop unused GDK_GL values
And document the existing ones.
2018-01-10 00:02:23 -05:00
Matthias Clasen
0290b28564 Drop unused debug keys
The multihead, xim and xinerama keys do nothing anymore.
2018-01-09 23:21:33 -05:00
Matthias Clasen
0443892bc7 Drop no-longer-existing debug keys from the docs
There is no draw or nogl value for GDK_DEBUG.
2018-01-09 23:15:33 -05:00
Matthias Clasen
124a7969eb Drop another unused debug value
GTK_DEBUG_MULTIHEAD is unused as well.
2018-01-09 23:07:08 -05:00
Matthias Clasen
92e6557015 Remove an unused debug value
GTK_DEBUG_MISC is not used at all. Drop it.
2018-01-09 22:56:40 -05:00
Matthias Clasen
2ff75aafbd Docs: Drop section on commandline arguments
We no longer do that.
2018-01-09 20:40:47 -05:00
Matthias Clasen
ccdeaab1f9 vulkan: Add a way to specify a device
We should be smarter in picking a good device eventually,
but for now, we just allow to explicitly choose one. To
see a list of all devices, use GDK_VULKAN_DEVICE=list

To specify which device to use, use GDK_VULKAN_DEVICE=<number>
2018-01-09 20:33:04 -05:00
Matthias Clasen
0fe6d76ab6 Make size request warnings more useful
Print the css name of the widget in question, so we have
a chance of knowing that this is caused by the marks, not
by the slider.
2018-01-09 17:48:51 -05:00
Matthias Clasen
888f289114 Quiet a compiler warning
Vulkan grew a new error code.
2018-01-09 17:20:44 -05:00
Matthias Clasen
4908b5ef54 Fix file chooser
Now that the places sidebar is private, we need to
ensure the type is known.
2018-01-09 17:20:23 -05:00
Matthias Clasen
9a3b61ec9d Drop GtkPlacesSidebar from public API
This is a bit of filechooser internals that gets shared with
nautilus, which is fine, but it shouldn't be part of our
public API. There are no other users than nautilus.
2018-01-08 14:38:55 -05:00
Timm Bäder
bbf6e81c1f gl renderer: Fix shaders for gles
Remove uniform initializers, add casts to float, etc.
2018-01-08 19:23:06 +01:00
Timm Bäder
cd2a53851b gl: Fix copy&paste error in blur shader 2018-01-08 19:23:06 +01:00
Timm Bäder
8f3cb2658a inspector: Stop adding event controllers to the object tree
There's a dedicated "Gesture" page for all the gestures.
2018-01-08 19:23:06 +01:00
Sveinn í Felli
9e3b3c30b7 Update Icelandic translation
(cherry picked from commit d96a7c9e87)
2018-01-08 17:47:27 +00:00
Timm Bäder
0aca394a96 adwaita: Uncomment accidentally commented lines
The result looks wrong but the css looks right.
2018-01-08 17:44:37 +01:00
Timm Bäder
9a68c068a8 treeview: Stop rendering focus outline
This is done on a widget-level via css these days.
2018-01-08 17:44:37 +01:00
Timm Bäder
16cf4637e9 widget: Fix css padding debug drawing 2018-01-08 17:44:37 +01:00
Timm Bäder
f7ba3224b9 gl renderer: Bring back hexbox drawing 2018-01-08 17:44:37 +01:00
Timm Bäder
3176ae7e51 gl renderer: Use alpha uniform in inset shadow shader 2018-01-08 17:44:33 +01:00
Matthias Clasen
5ce2d77691 toolbutton: Fix off-center icons
When the toolbar style is both-horiz, and the item
is not important, we were not centering the icon in the
same way as in gtk3. The reason is that we overlooked
the expand child property being set to TRUE in this case.
2018-01-07 12:44:35 -05:00
Daniel Boles
b89bf98731 ScrolledWindow: add() before remove() in snippet
We can't remove() a child widget that wasn't already add()ed, of course.
2018-01-07 16:47:24 +00:00
Ting-Wei Lan
14b181ebd4 build: Use pkg-config to find iso-codes
Instead of hard-coding the path of iso-codes, we can get the prefix with
pkg-config. We still fallback to /usr when it is not available.

https://bugzilla.gnome.org/show_bug.cgi?id=792282
2018-01-07 14:53:41 +08:00
Matthias Clasen
3771c95c72 gsk: Move Vulkan sources to a subdirectory
Following what was already done for GL.
2018-01-06 09:36:55 -05:00
Rico Tzschichholz
3c38ebb906 filechooser: Add missing array annotations to add_choice() 2018-01-06 09:34:44 +01:00
Rico Tzschichholz
6e6e6d774f iconview: Prevent ownership transfer of cell out-param in get_item_at_pos() 2018-01-06 09:27:44 +01:00
Matthias Clasen
550f4bc854 gsk: Fix hexbox drawing for the Vulkan renderer
Just as in the cairo renderer, we can get this back
by using pango_cairo_show_glyph_string for populating
the cache.
2018-01-05 20:30:14 -05:00
Matthias Clasen
2bab983ecf gsk: Fix hexbox drawing for fallback rendering
pango does not currently export api for drawing hex boxes,
but by using pango_cairo_show_glyph_string, we can reuse its
implementation.
2018-01-05 18:55:23 -05:00
Matthias Clasen
258e504c6a Implement equal for GtkCssImageUrl
This should in theory speed some things up if the same
image is used in multiple places.
2018-01-05 17:15:44 -05:00
Matthias Clasen
36e09f3ad9 label: Properly handle multi-line selections
They were rendered as a single rectangle, which is not
what is expected. Same for multi-line links.
2018-01-05 15:54:49 -05:00
Matthias Clasen
c8770b3c63 file button: Don't leak rows
The file chooser button manually manages the memory of
data in its model, so it needs to explicitly free the
rows.
2018-01-05 11:50:22 -05:00
Khaled Hosny
079ee7e405 Update Arabic translation 2018-01-05 15:32:33 +02:00
Matthias Clasen
50975be4d0 wayland: Plug memory leaks
We were forgetting to free the GdkContentFormats
objects in an early exit case.
2018-01-04 22:55:04 -05:00
Matthias Clasen
407d3db2b6 Plug a memory leak
gdk_pixbuf_format_get_name returns newly allocated
strings.
2018-01-04 22:54:29 -05:00
Matthias Clasen
98da7730ea label: Plug a memory leak
We were sometimes leaking the content serializer object.
2018-01-04 22:24:43 -05:00
Matthias Clasen
3dd3ae1b9d font chooser: Plug a memory leak
We were leaking the hb_font object.
2018-01-04 22:24:21 -05:00
Matthias Clasen
e41e8c4c53 font chooser: Fix a memory leak
We were leaking the delayed font descriptions.
2018-01-04 21:19:28 -05:00
Matthias Clasen
0ed670ed62 Remove a dead macro
GCs have been dead for a long time.
2018-01-04 18:23:36 -05:00
Matthias Clasen
a670de4425 Quiet the doc build a bit 2018-01-04 18:22:47 -05:00
Matthias Clasen
ea6da7b1b8 gdk: Convince gtk-doc to include backend docs
This is almost as unpleasant with meson as it is with autotools.
2018-01-04 15:57:28 -05:00
Timm Bäder
7479e6cb50 notebook: Fix wrong tab widgets allocation
Since we allocate the tab widgets on demand, we have to queue an extra
resize here.
2018-01-04 21:41:35 +01:00
Timm Bäder
85fa396176 widget: Avoid casting event coordinates to int in contains() 2018-01-04 21:41:35 +01:00
Matthias Clasen
888a157ffa docs: Remove unused images
All the old cursor font images are unused.
2018-01-04 15:26:52 -05:00
Matthias Clasen
8a5b6d422f fontchooser: fix feature formatting
There was a " missing, causing some features to be missed.
2018-01-04 08:39:18 -05:00
Timm Bäder
33162eee1a window: Fix an event widget/target mixup
This makes dragging inside a GtkEntry in the window decoration work
again.
2018-01-04 13:16:24 +01:00
Timm Bäder
a89e88fc3e widget: Ignore non-gestures in _gtk_widget_consumes_motion
priv->event_controllers is a list of all event controllers, which aren't
all GtkGesture subclasses.
2018-01-04 13:15:15 +01:00
Timm Bäder
62ccf8743a filechooser: Manage spinner state
So we don't get an allocate every frame.
2018-01-04 12:20:27 +01:00
Timm Bäder
af6adb5bc0 gl renderer: Add test case for last commit 2018-01-04 12:20:27 +01:00
Timm Bäder
f729cbb760 gl renderer: Fix text color pre-multiplication 2018-01-04 12:20:27 +01:00
Timm Bäder
f55be762e2 recorder: Fix a button tooltip
This button will save the selected node to a file, not all recorded
frames.
2018-01-04 12:20:27 +01:00
Piotr Drąg
f94d72c012 Update POTFILES.skip 2018-01-03 21:28:36 +01:00
Matthias Clasen
ebeca18635 gtk-demo: Update font explorer example
Revise the UI (no more double checkboxes), add font variations,
update font features from the dialog, allow tweaking ranges.
2018-01-03 14:56:36 -05:00
Piotr Drąg
83c5b661f6 Update POTFILES.in 2018-01-03 20:24:05 +01:00
Matthias Clasen
a79f950dfe font chooser: Manage tweak button sensitivity
When we don't have any font features or variation axes,
there is no point in going to the tweak page, so disable
the action in this case.
2018-01-03 14:06:00 -05:00
Matthias Clasen
34b4de09fc font chooser dialog: Improve sensitivity handling
We should not tie the sensitivity of the select button
to the tweak action, since there may be fonts which are
selectable, but not tweakable.

Instead, enable the select button when a font is selected,
as it should be.
2018-01-03 14:05:33 -05:00
Matthias Clasen
7687393583 font chooser: Don't set hardcoded default features
We should rely on harfbuzz to select the right defaults.
2018-01-03 13:41:20 -05:00
Matthias Clasen
4cc68a97a8 font chooser: Support font variations
Add sliders for the available axes to the tweak page.
2018-01-03 13:28:33 -05:00
Matthias Clasen
379970082a font button: Take variations into account
We need to apply variations too, when we are using
the font to render the button label.
2018-01-03 13:07:55 -05:00
Matthias Clasen
fb51e438e9 Implement font-variation-settings
This is a CSS font level 4 property that lets us
use font variation settings from css.
2018-01-03 13:07:55 -05:00
Matthias Clasen
f259aa7e76 Bump the pango requirement
We want to use the new font variation api in pango 1.41.
2018-01-03 13:06:28 -05:00
Matthias Clasen
894a0c0ff4 font chooser: Add properties for features and language
These can't be returned as part of the font description,
so we need new api for them. For now, this is just readonly
properties. Maybe these should be writable too, eventually.
2018-01-03 12:18:18 -05:00
Matthias Clasen
ade33c6e14 Add font features on the tweak page 2018-01-03 12:18:18 -05:00
Matthias Clasen
15f8b2d0ae font chooser: Add a tweak page
Add a button the dialog's header bar that lets us
switch to a second page where we can customize
the selected font.

Make the font chooser widget export an action that the
dialog can use for the button. This has some advantages:
- we can export not just the toggle state, but also enabled
- we can reuse the same enabled state to make the select
  button insensitive when no font is selected

To determine whether a font is selected, listen to changes
of the list selection. And ensure that the font chooser is
in an initial state when mapped, even if we close the dialog
from the tweak page.
2018-01-03 12:18:18 -05:00
Matthias Clasen
70bae02612 font button: Remove show-font and show-size
These are now handled in a more systematic fashion
using GtkFontChooserLevel.
2018-01-03 12:18:18 -05:00
Matthias Clasen
f0526359d1 font chooser: introduce font chooser levels
This is a more systematic approach to reducing the
level of detail in the font chooser.
2018-01-03 12:18:18 -05:00
Matthias Clasen
78f9193d7e font chooser: Small revision of the UI
Show only the font names in the list, in their own
font, in order to make the list less noisy.
2018-01-03 12:18:18 -05:00
Timm Bäder
3f68475b6f Make a few more code samples compile 2018-01-03 17:11:32 +01:00
Timm Bäder
5cd138f0f2 entry: Remove some questionable code examples 2018-01-03 17:11:32 +01:00
Timm Bäder
614bcefa21 widget: Make all code snippets compile 2018-01-03 17:11:32 +01:00
Timm Bäder
cba24360b1 Move geometry management docs do GtkWidget
Both GtkWidget and GtkContainer had similar docs regarding hfw/wfh
geometry management. Move these just to GtkWidget. Also make sure the
examples compile, port everything from gtk_preferred_* to measure and
replace some occurrences of "container" with "widget" where container
was just used to refer to a widget with child widgets.
2018-01-03 17:11:32 +01:00
Timm Bäder
e8376f5c01 liststore: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Timm Bäder
3744bbdc27 searchbar: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Timm Bäder
cf9942e3cc menuitem: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Timm Bäder
3d9421509c expander: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Timm Bäder
9f86cb2b4e treeviewcolumn: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Timm Bäder
1c267398ef notebook: Make a code snippet compile 2018-01-03 17:11:32 +01:00
Timm Bäder
4a999cbd1f scrolledwindow: Fix code sample compilation 2018-01-03 17:11:32 +01:00
Krzesimir Nowak
7f300c9da7 examples, gtk-demo: Fix copy-pasta in signal name 2018-01-03 09:59:19 +01:00
Rico Tzschichholz
6aeae2c828 gdk: Drop invalid "transfer" g-i annotations 2018-01-03 08:26:21 +01:00
Rico Tzschichholz
14d64eaf95 dnd: Add g-i annotations for gdk_drop_read_async/finish 2018-01-03 08:18:47 +01:00
Rico Tzschichholz
543b21430b gsk: Add docs for gsk_texture_node_get_texture 2018-01-03 08:17:23 +01:00
Matthias Clasen
a25357007e Fix pointer obscuring in text view
The code for hiding the mouse cursor until the next motion
event was not working, probably due to a typo here.
2018-01-02 21:52:43 -05:00
Arnaud Bonatti
295726560e Add test for GtkActionable GtkListBoxRow.
https://bugzilla.gnome.org/show_bug.cgi?id=741633
2018-01-02 17:56:10 -08:00
Arnaud Bonatti
f1e3b503de Make GtkListBoxRow GtkActionable.
https://bugzilla.gnome.org/show_bug.cgi?id=741633
2018-01-02 17:56:10 -08:00
Matthias Clasen
9f94736c92 Remove selection-handling leftovers
The selection_get and selection_received vfuncs are
no longer used, remove them.
2018-01-02 18:14:14 -05:00
Matthias Clasen
48bfc9badf testinput: Make this work again
This test was not updated to using a draw func instead
of the ::draw signal yet. At the same time, make it use
::size-allocate instead of ::configure-event.
2018-01-02 18:14:13 -05:00
Matthias Clasen
12e4f4256d Drop an unused enum value
We haven't had a GtkWindow::frame-event since the
linux-fb backends demise.
2018-01-02 18:14:13 -05:00
Matthias Clasen
e522ff0532 testgtk: Fix the test scrolling test
We need to expand here, otherwise things look wrong.
2018-01-02 18:14:13 -05:00
Matthias Clasen
d3014c23b9 testgtk: Fix the scrolledwindow test
We need to expand here, otherwise things look wrong.
2018-01-02 18:14:13 -05:00
Matthias Clasen
473bbeb475 gtk-demo: Port the drawingarea demo to a gesture
Use a drag gesture here, just like in the drawing example.
2018-01-02 18:14:13 -05:00
Matthias Clasen
c9267e70a9 Port drawing example to gestures
Use a drag and a multi-press gesture.
2018-01-02 18:14:13 -05:00
Matthias Clasen
bb568a51d4 Make drawing example work again
Using ::configure-event and ::draw on a drawing area
doesn't work anymore. Use ::size-allocate and a
draw function instead.
2018-01-02 18:14:13 -05:00
Matthias Clasen
4d6fbdd19e Remove testthreads
As far as I can tell, this has not been in the Makefiles
since 2001...
2018-01-02 18:14:13 -05:00
Matthias Clasen
2c2288206e Drop an unintentional use of ::destroy-event
Clearly, ::destroy was meant here.
2018-01-02 18:14:13 -05:00
Matthias Clasen
ab256384b8 testsuite: Drop commented out and useless code
These two uses of ::delete-event were pointless.
2018-01-02 18:14:13 -05:00
Matthias Clasen
c0cd46355d Drop a no-longer-working test
Embedding toplevels does not work anymore.
2018-01-02 18:14:13 -05:00
Matthias Clasen
5f608a1d07 Revert "inspector: Stop using GtkWidget::event"
This reverts commit 1268440c35.

Turns out we'll keep ::event, so this was misguided.
2018-01-02 18:14:08 -05:00
Matthias Clasen
750341414d Revert "treeviewcolumn: Stop using GtkWidget::event"
This reverts commit da74314779.

Turns out we'll keep ::event, so this was misguided.
2018-01-02 18:14:04 -05:00
Matthias Clasen
506b436f09 Revert "text handler: Stop using GtkWidget::event"
This reverts commit 74f563b501.

Turns out we'll keep ::event, so this was misguided.
2018-01-02 18:13:34 -05:00
Matthias Clasen
361a3885b5 spinner cell: Avoid a crash
The icon helper is not used, so no point in crashing
while trying to destroy it.
2018-01-02 18:05:30 -05:00
Matthias Clasen
d072201b12 docs: Don't mention non-longer-existing signals
The ::window-state-event signal no longer exists.
2018-01-02 18:05:19 -05:00
Timm Bäder
6b44a70a09 GdkTexture: Add a missing (array) annotation 2018-01-02 18:56:19 +01:00
Timm Bäder
355b883f32 stack-allocate GtkCssLookup instances 2018-01-02 08:36:10 +01:00
Timm Bäder
fcc8d778b5 gl renderer: Avoid some code duplication 2018-01-02 08:10:06 +01:00
Timm Bäder
d1a08aa2a9 gl driver: Remove some type checks in a hot path 2018-01-02 08:10:06 +01:00
Timm Bäder
0e57d173b3 gl renderer: Remove an unnecessary block 2018-01-02 08:10:06 +01:00
Timm Bäder
9ef700b161 css parser: Reuse one GString
Instead of creating a new one for every ident, name and string, just
create one GString and reuse it. This means the GString we keep around
will grow to the maximum size of any ident, name or string we parse,
which is still not terribly large.
2018-01-02 08:10:06 +01:00
Daniel Boles
ab0edd1091 themes: missing specificity bump on expander arrow
Commit 4ee02725b4 made the :hover apply to
the title node, not the arrow node, but the selectors it added were not
caught by the recent commits fixing the specificity of title > arrow.
2018-01-01 21:22:23 +00:00
Daniel Boles
3bcbf4cf4e themes: Regenerate CSS to reflect recent commits
a lot of them, in this case
2018-01-01 19:53:43 +00:00
Daniel Boles
4878eea06b HighContrast: Avoid expander↔combobox interference
as per commit 4241c4bdbd
2018-01-01 18:54:13 +00:00
Matthias Clasen
17bad98084 emoji: Accept unpaired releases for variations
This enables a single long-press-move-release gesture
for picking a variation. This is not perfect yet: We
don't get hover in this case.
2017-12-30 23:24:22 -05:00
Matthias Clasen
72c9853999 list, flow box: Make unpaired releases opt-in
We don't want a pointer that is moved off a scrollbar
to trigger a row when it gets released. To avoid this,
require an explicit opt-in to handling unpaired-releases.
2017-12-30 23:23:16 -05:00
Matthias Clasen
1be0b6d2d5 dnd: Drop docs that are no longer relevant
We no longer take an event as argument, so no
need to explain how to obtain a suitable event.
2017-12-30 22:46:28 -05:00
Matthias Clasen
74f563b501 text handler: Stop using GtkWidget::event
This signal is going away.
2017-12-30 22:38:14 -05:00
Matthias Clasen
da74314779 treeviewcolumn: Stop using GtkWidget::event
This signal is going away.
2017-12-30 22:27:54 -05:00
Matthias Clasen
1268440c35 inspector: Stop using GtkWidget::event
This signal is going away.
2017-12-30 22:13:45 -05:00
Matthias Clasen
7d659b21e6 Drop deprecated text view layers
These have been marked as deprecated, so lets drop them.
2017-12-29 13:13:36 -05:00
Matthias Clasen
9c1207ed37 Update new css docs for new nowrap handling
This changes the recent additions to the css property
docs to also use <phrase role="nowrap">
2017-12-29 13:12:06 -05:00
Arnaud Rebillout
25523e60c3 gtk: remove non-breaking space, probably there by mistake
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:31 -05:00
Arnaud Rebillout
ed5f07e0e7 css docs: fix some formatting inconsistencies along the way
Mostly spaces.

Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:31 -05:00
Arnaud Rebillout
c1ce599e11 css docs: remove useless <para>
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:31 -05:00
Arnaud Rebillout
ea55471441 css docs: swap border-width and border-left shorthands, to keep going clockwise
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:31 -05:00
Arnaud Rebillout
b42fc417bd css docs: Fix duplicate border‑right‑width
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:31 -05:00
Arnaud Rebillout
b3871a76c4 css docs: Fix refentry and refname
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:30 -05:00
Arnaud Rebillout
ccf3b10528 css docs: Ensure the first column does not break for every table
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:30 -05:00
Arnaud Rebillout
98a28f4168 css docs: Get rid of non-breaking hyphens
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:30 -05:00
Arnaud Rebillout
3c7c4a019c css docs: Get rid of non-breaking spaces
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:30 -05:00
Arnaud Rebillout
73d6076967 css docs: Fix some angle brackets for percentage
Signed-off-by: Arnaud Rebillout <elboulangero@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=791710
2017-12-29 12:51:30 -05:00
Timm Bäder
c1573a1fda window: Avoid a set-but-not-used warning 2017-12-29 08:59:53 +01:00
Timm Bäder
f92cca5229 gl renderer: Fix release build 2017-12-29 08:59:47 +01:00
Timm Bäder
86a6131510 build: Rename a variable
Those aren't source headers...
2017-12-29 05:48:43 +01:00
Timm Bäder
6587864824 gl driver: Remove more unused API 2017-12-29 05:48:43 +01:00
Timm Bäder
e0436b3d59 gl renderer: Properly delete all shader programs 2017-12-29 05:48:43 +01:00
Timm Bäder
d2d18f74f8 gl driver: Remove gl-context property
No need for this to be a property.
2017-12-29 05:48:43 +01:00
Timm Bäder
1cbd4d229e gl driver: Remove dead warning code
_get_fbo never returns NULL.
2017-12-29 05:48:43 +01:00
Timm Bäder
c9656e2864 gl driver: Only support one fbo per texture 2017-12-29 05:48:43 +01:00
Timm Bäder
352590cf9f gl driver: Remove vao API
Unused.
2017-12-29 05:48:43 +01:00
Timm Bäder
825608af2a gl renderer: Remove unused parameter 2017-12-29 05:48:43 +01:00
Timm Bäder
4abbf929ad gl renderer: Remove some unused uniforms from shader 2017-12-29 05:48:42 +01:00
Timm Bäder
aeaab5557b gl renderer: Only draw what we have to 2017-12-29 05:48:42 +01:00
Timm Bäder
2bc10fa365 gl renderer: draw all outset shadows
Instead of falling back to cairo for most of them.
2017-12-29 05:48:40 +01:00
Timm Bäder
c4d5225aac testoutsetshadowdrawing: Add more samples 2017-12-28 16:48:35 +01:00
Timm Bäder
767df913d1 testsuite: Move gl renderer nodes files into their own directory
Otherwise, they get picked up by the other node tests.
2017-12-28 16:48:35 +01:00
Timm Bäder
e1c120623b tests: Fix the unblurred gl renderer output images
Some of these were wrong or empty.
2017-12-28 16:48:35 +01:00
Timm Bäder
9f2674077a gl renderer: Properly flip texture in render_texture path
Just do this on the CPU instead.
2017-12-28 16:48:35 +01:00
Timm Bäder
9675b8a310 showrendernode: Add some advanced options
1) Add a --compare cmd line switch that lets people compare the normal
     render path and the render_texture path.
  2) Add a -o cmd line switch that lets people render the given .node
     file to a texture and save that texture to the given png file name.
2017-12-28 16:48:35 +01:00
Timm Bäder
a61eecc22e snapshot: Don't create clip nodes with 0 width or height 2017-12-28 16:48:35 +01:00
Timm Bäder
a720a63fa3 gl renderer: Insert render target op in render_texture path 2017-12-28 16:48:35 +01:00
Timm Bäder
3158b481b7 testoutsetshadowdrawing: Add adwaita CSD window test case 2017-12-28 16:48:35 +01:00
Timm Bäder
8312ee0ebe testsuite: Add selected gl renderer test node files 2017-12-28 16:48:35 +01:00
Timm Bäder
006f2e32cf testheaderbar: Fix custom CSS 2017-12-28 16:48:35 +01:00
Matthias Clasen
4241c4bdbd Adwaita: Avoid expander<>combobox interference
Putting a combobox in an expander was causing the combo arrow
to go sideways. Increase the specificity with which we address
the expander arrow to avoid that.
2017-12-28 08:40:39 -05:00
Matthias Clasen
e90787d975 fontchooser: Add global keynav
Starting to type should focus the search entry and start
a search.
2017-12-27 17:29:24 -05:00
Matthias Clasen
3f012f6d01 Try again to make the a11y tests pass 2017-12-27 07:08:17 -05:00
Matthias Clasen
06ad134876 Add an unrealize function to GtkLabel
We need to drpo the primary clipboard when the label
is getting unrealized while holding it. This fixes
a crash in the accessibility-dump test.
2017-12-26 23:33:39 -05:00
Matthias Clasen
ed6992867e Fix the a11y tests 2017-12-26 23:16:18 -05:00
Matthias Clasen
90b016ef73 Fix the textbuffer test
The test was assuming that gtk_text_buffer_paste_clipboard is
synchronous, which is no longer the case.
2017-12-26 23:15:30 -05:00
Matthias Clasen
c176d0c3d8 Simplify ui files
Run gtk3-builder-tool simplify over all our ui files.
2017-12-26 23:12:37 -05:00
Matthias Clasen
1d28a7c2c1 Update NEWS 2017-12-26 20:11:09 -05:00
Matthias Clasen
7be6d18f27 Fix objects-finalize test
This test needs similar fixes to the notify test to
pass a display to GDK objects when instantiating them.
2017-12-26 20:11:09 -05:00
Matthias Clasen
1b6750c1f1 Fix notify test
We need to pass a display when creating more GDK objects now.
2017-12-26 20:06:06 -05:00
Matthias Clasen
8c10849094 Avoid excess notification for GdkEventControllerScroll::flags
We have a test that checks this, and it is the right thing to do.
2017-12-26 20:06:06 -05:00
Matthias Clasen
8d9414c228 Avoid excess notification for GdkCellRendererPixbuf::icon-size
We have a test that checks this, and it is right thing to do.
2017-12-26 20:06:06 -05:00
Matthias Clasen
6c33e37db2 Remove a duplicate doc comment
g-ir-scanner complains about this.
2017-12-26 19:19:12 -05:00
Matthias Clasen
5ba5f2c0c0 gdk: Cosmetic rewording of draw context docs
Avoid draw context <> drawing context confusion,
as far as possible.
2017-12-26 14:39:49 -05:00
Matthias Clasen
fa9037aed5 gdk: Slight doc rearrangement
Mainly, add GdkDrawContext to the docs.
2017-12-26 14:39:49 -05:00
Matthias Clasen
371d527092 window: Remove GtkButton reference from docs
GtkButton doesn't have its own window anymore, so it is
a misleading example here.
2017-12-26 14:39:49 -05:00
Matthias Clasen
5c9ea0cf4f display: Cosmetic doc changes 2017-12-26 14:39:49 -05:00
Matthias Clasen
5ec25cde21 cursor docs: Point to gtk_widget_set_cursor
This is the right API to use for applications.
2017-12-26 14:39:49 -05:00
Matthias Clasen
6374226d6b Add documentation for content (de)serializers 2017-12-26 14:39:49 -05:00
Matthias Clasen
e917949315 Document GdkClipboard::changed 2017-12-26 14:39:49 -05:00
Matthias Clasen
ca2a7c1efd Document more structs 2017-12-26 14:39:24 -05:00
Matthias Clasen
53522f3c25 Document GDK_DISPLAY_XDISPLAY 2017-12-26 13:14:07 -05:00
Matthias Clasen
6f82ba5e5e gdk: Document GdkVulkanContext
New API needs documentation.
2017-12-26 13:00:27 -05:00
Matthias Clasen
dbcf0d1b69 gdk: Move GdkWindowState enum around
We no longer have an event for this, so move the
enum to gdkwindow.h, where it belongs.
2017-12-26 13:00:27 -05:00
Matthias Clasen
bb992ff00d More documentation additions 2017-12-26 13:00:27 -05:00
Matthias Clasen
f307fa99a5 Drop gratitious use of GdkPoint
This is the only use of this undocumented struct,
and it does not make this code any better. Just drop it.
2017-12-26 13:00:27 -05:00
Matthias Clasen
f2ad5ddbb6 Some GdkMonitor documentation additions
Document the ::invalidated signal.
2017-12-26 13:00:27 -05:00
Matthias Clasen
951456dbed Remove leftover API from headers
gdk_window_mark_paint_from_clip was removed in
bddfd7bb41
2017-12-26 13:00:27 -05:00
Matthias Clasen
278c4583fc Document new event getters
New API needs documentation.
2017-12-26 13:00:27 -05:00
Matthias Clasen
d6985d793f Try to make the docs build more quiet
Not sure if this really makes a difference.
2017-12-26 13:00:27 -05:00
Matthias Clasen
97dcf2461e gdk: Remove the event structs from the documentation
No longer public api.
2017-12-26 13:00:27 -05:00
Matthias Clasen
d3920d17fa Document gdk_display_get_setting
New api needs documentation.
2017-12-26 11:51:28 -05:00
Matthias Clasen
22a43dafc8 Remove leftover gdk_event_request_motions from headers
The implementation of this function was removed in
44cb3ccfa1.
2017-12-26 11:51:28 -05:00
Matthias Clasen
1ee72e8ef4 Drop gsk_renderer_get/set_viewport from the docs
These no longer exist.
2017-12-26 11:51:28 -05:00
Matthias Clasen
ffe838e7de gdk: Document GdkDisplay::setting-changed
New api needs documentation.
2017-12-26 11:51:28 -05:00
Matthias Clasen
8df58f953d Some migration guide revisions
Add a few things, reword some others.
2017-12-26 11:51:28 -05:00
Matthias Clasen
7a483bbecc docs: Add new headerbar api
Some functions have been renamed here.
2017-12-26 09:01:57 -05:00
Matthias Clasen
d04f66eb52 Add GtkIconSize back to the docs
And document how it works now.
2017-12-26 08:40:43 -05:00
Matthias Clasen
d5f215f96d gdk: Reshuffle docs slightly
Deemphasize GdkPixbuf in the docs.
2017-12-25 16:40:47 -05:00
Ting-Wei Lan
999cf1b1dc docs: Fix the build of gdk4 documentation
https://bugzilla.gnome.org/show_bug.cgi?id=791926
2017-12-25 14:59:35 -05:00
Matthias Clasen
b379ca3e02 check button: Fix inconsistent state
This has been broken since the inconsistent state
was moved here in 2aea8dfee9.
2017-12-25 11:36:39 -05:00
Ting-Wei Lan
5f8e2fcf93 gdk/broadway/toarray.pl: Don't hard-code the path of perl
https://bugzilla.gnome.org/show_bug.cgi?id=791927
2017-12-25 12:25:54 +08:00
Matthias Clasen
3902a0d3b1 Fix the docs build
We no longer have GtkClipboard.
2017-12-22 22:59:00 -05:00
Matthias Clasen
03cacda09e css: Document font-variant and subproperties
Add the CSS font level 3 properties that we support now
to the docs.
2017-12-22 22:56:35 -05:00
Emmanuele Bassi
e847694e91 Update annotations for GdkDisplay
GdkDisplay is missing various annotations, and the introspection scanner
is complaining about it.
2017-12-21 19:13:28 +00:00
Emmanuele Bassi
90a4e33415 Update annotations for GdkEvent API
The GdkEvent API is missing some gtk-doc stanzas, as well as some
introspection annotations.
2017-12-21 19:07:02 +00:00
Emmanuele Bassi
f27dd8834b docs: Add missing signal parameter
The `flags` parameter is missing, and the introspection scanner is
complaining about it.
2017-12-21 19:00:28 +00:00
Emmanuele Bassi
18a56cd795 build: Ensure we introspect the print operation sources
The documentation and annotations for some of the print API is defined
in platform-specific source files, so we need to ensure we're passing
those files to the introspection scanner in order to avoid warnings, and
to get the appropriate introspected API.
2017-12-21 18:57:25 +00:00
Emmanuele Bassi
cc80a2ec8e Annotate gdk_x11_display_get_screen()
We're missing the gtk-doc stanza, as well as the transfer annotation for
the returned pointer.
2017-12-21 18:49:25 +00:00
Emmanuele Bassi
6c0de43669 Remove unnecessary introspection annotation
Transfer annotations do not apply to integral types.
2017-12-21 18:46:08 +00:00
Emmanuele Bassi
f1ef422871 broadway: Use correct type in assignment
The new type propagation for g_object_ref() is raising a compiler
warning for an assignment with a different type.
2017-12-21 18:42:26 +00:00
Timm Bäder
862fd6f4e8 widgetbowl: Add blurred box shadow demo 2017-12-21 19:12:33 +01:00
Timm Bäder
7a2d30323e gl renderer: try doing outset box shadows
Still fall back in cases we can't handle that way.
2017-12-21 19:12:33 +01:00
Timm Bäder
8b880de4a2 tests: Add outset shadow drawing test 2017-12-21 19:12:33 +01:00
Timm Bäder
d211f42091 gl renderer: Remove unused vertex shader 2017-12-21 19:12:32 +01:00
Timm Bäder
f044b01549 gl renderer: Don't crash if the first op is an opacity one 2017-12-21 19:12:32 +01:00
Timm Bäder
490e15021c gl renderer: Force cross-fade nodes offscreen 2017-12-21 19:12:32 +01:00
Timm Bäder
48be2aed23 gl renderer: Use one function per op type to apply data 2017-12-21 19:12:32 +01:00
Timm Bäder
28499032da gl renderer: Don't leak gl resources 2017-12-21 19:12:32 +01:00
Timm Bäder
5eb4f65c32 showrendernode: Show at least the root node bounds 2017-12-21 19:12:32 +01:00
Timm Bäder
ee27b17a12 gl renderer: Fix indentation mishap 2017-12-21 19:12:32 +01:00
Timm Bäder
a83037c440 gl renderer: Implement cross fade nodes 2017-12-21 19:12:32 +01:00
Timm Bäder
bed03aa319 gl renderer: Fix linear gradient shader color calculation
This fixes both the wrong headerbar color and the broken border color in
of the circular button in the widget-factory.
2017-12-21 19:12:32 +01:00
Timm Bäder
eb221ff305 gl renderer: Only take glyph texture alpha into account
This way, we can use the very same coloring program to draw text shadows
of fonts with colored glyphs.
2017-12-21 19:12:32 +01:00
Timm Bäder
075e6ac266 gl renderer: Fix shadow nodes if the child is a container 2017-12-21 19:12:32 +01:00
Timm Bäder
18e7d777a2 gl renderer: Move declarations to the beginning of the block 2017-12-21 19:12:32 +01:00
Timm Bäder
e9be72a73e gl renderer: Fix use of uninitialized values 2017-12-21 19:12:32 +01:00
Timm Bäder
33457b4035 gl renderer: Ensure texture sizes arent 0
We already ceil() the given float texture sizes here, so if they are
valid, the result should definitely be > 0. Textures with size 0 can't
be properly used, especially not as render targets, where they will
trigger an assertion failure later in a glCheckFramebuffer call.
2017-12-21 19:12:32 +01:00
Timm Bäder
49c7cf36e4 gl renderer: Fix inset and outset shadows in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
b03f08960b gl renderer: Fix cairo node surface size in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
d9e135dcb5 gl renderer: Fix rounded clips in hidpi 2017-12-21 19:12:32 +01:00
Timm Bäder
3411e648b4 gl renderer: Handle borders in hidpi better 2017-12-21 19:12:32 +01:00
Timm Bäder
64400e82b5 gl renderer: Default to 0px clip and border radius
Finally fix the division by 0 in the clip code.
2017-12-21 19:12:32 +01:00
Timm Bäder
703c4cf003 gl renderer: Ignore render ops before we have a valid program 2017-12-21 19:12:32 +01:00
Timm Bäder
2d3e87da46 gl renderer: Try to fix border rendering 2017-12-21 19:12:32 +01:00
Timm Bäder
a59f380d31 gl renderer: Use one function per node-type
So a profiler can actually tell me what's slow and not just point at
_add_render_ops in all cases.
2017-12-21 19:12:32 +01:00
Timm Bäder
ab53ee7377 gl renderer: Don't render opacity nodes offscreen
We already drag a u_alpha uniform around in every shader, so use that
one.
2017-12-21 19:12:32 +01:00
Timm Bäder
ac6b7b24f9 tests: Add border drawing test 2017-12-21 19:12:32 +01:00
Timm Bäder
fd0b7caa7c gl renderer: Fix shadow shader
We need to take the alpha of the shadow color into account as well.
2017-12-21 19:12:32 +01:00
Timm Bäder
476450b93e gl renderer: Ignore shadow color matrix nodes...
... if the color matrix nodes don't touch the child alpha.
2017-12-21 19:12:32 +01:00
Timm Bäder
98ba28b5d7 gl renderer: Add a helper function
We'll use this for the common case of a color matrix node inside a
shadow node.
2017-12-21 19:12:32 +01:00
Timm Bäder
49785974cf gl renderer: Don't zero initialize render ops GArray 2017-12-21 19:12:32 +01:00
Timm Bäder
7cc868910b gl renderer: Avoid crashing tooltips 2017-12-21 19:12:31 +01:00
Timm Bäder
39a241b763 gl renderer: Sort border sides by color 2017-12-21 19:12:31 +01:00
Timm Bäder
c9af94f6db gl renderer: Keep track of border program state 2017-12-21 19:12:31 +01:00
Timm Bäder
f978bf057f gl renderer: Avoid using a new modelview for shadow nodes
We can just move the vertex data directly.
2017-12-21 19:12:31 +01:00
Timm Bäder
7ad8f211c6 gl renderer: Default to GL_LINEAR scaling filters 2017-12-21 19:12:31 +01:00
Timm Bäder
5cdd46e38e gl renderer: Remove superfluous modelview matrix changes 2017-12-21 19:12:31 +01:00
Timm Bäder
1fce25c7af gl renderer: Remove unused struct member 2017-12-21 19:12:31 +01:00
Timm Bäder
9479bb6bfc gl renderer: Keep track of color matrix op state 2017-12-21 19:12:31 +01:00
Timm Bäder
b33d85b594 gl renderer: Avoid consecutive opacity ops 2017-12-21 19:12:31 +01:00
Timm Bäder
a0e033b2cd gl renderer: Define debug structs inline 2017-12-21 19:12:31 +01:00
Timm Bäder
5d0c279351 gl renderer: Add more detailed render op output 2017-12-21 19:12:31 +01:00
Timm Bäder
7831d9a463 gl renderer: Only draw blurred shadow nodes once 2017-12-21 19:12:31 +01:00
Timm Bäder
7dc6a46cff gl renderer: Remove consecutive clip ops 2017-12-21 19:12:31 +01:00
Timm Bäder
bb69d64a0f gl renderer: Rename a macro 2017-12-21 19:12:31 +01:00
Timm Bäder
8463040ad1 gl renderer: Fix debugging output 2017-12-21 19:12:31 +01:00
Timm Bäder
3b7cfd068b gl renderer: Implement simple border nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
8089cde977 gl renderer: Don't render unblurred text shadows to a texture
We can do the same thing by simply drawing the text in the given shadow
color.
2017-12-21 19:12:31 +01:00
Timm Bäder
d5a759652f gl renderer: Split out text rendering function
We'll use that for text shadow nodes
2017-12-21 19:12:31 +01:00
Timm Bäder
e95b356465 gl renderer: Implement simple shadow nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
c524ac7bb5 gl renderer: Split out a utility function 2017-12-21 19:12:31 +01:00
Timm Bäder
8c9e203458 gl renderer: Fix inset shadow offset calculation 2017-12-21 19:12:31 +01:00
Timm Bäder
47c4bf5be0 gl renderer: Implement unblurred outset shadows 2017-12-21 19:12:31 +01:00
Timm Bäder
5c7838e168 gl renderer: Rework program creation
Make sure all uniform names have to match between the shader names and
the _location integers we save in every Program struct.
2017-12-21 19:12:31 +01:00
Timm Bäder
388157b995 gl renderer: Implement unblurred inset shadows 2017-12-21 19:12:31 +01:00
Timm Bäder
6a1a70c677 gl renderer: Implement blur nodes 2017-12-21 19:12:31 +01:00
Timm Bäder
ff1cacb54a gl renderer: Remove some unused members 2017-12-21 19:12:31 +01:00
Timm Bäder
19700fccb2 gl renderer: Keep track of current program color value 2017-12-21 19:12:31 +01:00
Timm Bäder
2865ab84a9 gl renderer: Don't draw texture nodes to a framebuffer
We don't need to create a texture from a texture node. We can simply use
its texture instead and draw it however we want.
2017-12-21 19:12:31 +01:00
Timm Bäder
e3264d5fd3 gl renderer: Implement color matrix nodes again 2017-12-21 19:12:31 +01:00
Timm Bäder
cb9c4e362c gl render ops: Rename a member 2017-12-21 19:12:31 +01:00
Timm Bäder
b56a7afd19 gl renderer: Factor out a helper function for offscreen drawing 2017-12-21 19:12:30 +01:00
Timm Bäder
95051e13c3 gl ops: Remove dead code
This is already checked further up in that function
2017-12-21 19:12:30 +01:00
Timm Bäder
832920c6ba gl renderer: Optimize text drawing
Text nodes will almost always end up using the exact same texture and
the same program. So, in that case we can simply add vertex data for all
the characters we need to draw and use just one draw call.
2017-12-21 19:12:30 +01:00
Timm Bäder
fa564e1f93 gl renderer: Remove unused VAO 2017-12-21 19:12:30 +01:00
Timm Bäder
d5eeb9d6f0 gl renderer: Stop collecting VAOs in clear_tree
We don't use that part of the gl driver anymore.
2017-12-21 19:12:30 +01:00
Timm Bäder
6606c1f682 gl renderer: Only check for color glyphs once per text node
It does not depend on the glyph, so no need to do it once for every
glyph.
2017-12-21 19:12:30 +01:00
Timm Bäder
5615fd26c2 gl renderer: Implement cairo nodes again 2017-12-21 19:12:30 +01:00
Timm Bäder
a1d3e77347 gl renderer: Move render ops into separate file 2017-12-21 19:12:30 +01:00
Timm Bäder
823369f275 gsk: Move all gskgl* files into gl/ 2017-12-21 19:12:30 +01:00
Timm Bäder
358c139a43 gl renderer: Rework once more
Last time, I swear.
2017-12-21 19:12:30 +01:00
Timm Bäder
dd1a9745db gl renderer: Don't initialize modelview matrix twice 2017-12-21 19:12:30 +01:00
Timm Bäder
59a7584386 gl renderer: Group render node types by render item creation 2017-12-21 19:12:30 +01:00
Timm Bäder
f4304336ea gl renderer: Don't pass MVP to shaders
We already pass both modelview and projection matrix individually.
2017-12-21 19:12:30 +01:00
Timm Bäder
4cf2a482ea gl: Add glyph cache
Based on the one used by the vulkan renderer
2017-12-21 19:12:30 +01:00
Timm Bäder
3e23f6c22b gl renderer: Remove unused member 2017-12-21 19:12:30 +01:00
Timm Bäder
9b400134d5 gl renderer: Remove unused shaders 2017-12-21 19:12:30 +01:00
Timm Bäder
e05b0ae9a4 test-render-nodes: Add transformed clip nodes test 2017-12-21 19:12:30 +01:00
Timm Bäder
7a739e80ef showrendernode: Resize window to a reasonable size instead 2017-12-21 19:12:30 +01:00
Timm Bäder
33aa61ef2c gl renderer: Save clip in every node 2017-12-21 19:12:30 +01:00
Timm Bäder
1f5fd4d564 gl renderer: Don't create framebuffer for texture opacity children
Slowly a pattern emerges...
2017-12-21 19:12:30 +01:00
Timm Bäder
24e69bb877 gl renderer: Implement rounded clip nodes
mostly a proof of concept
2017-12-21 19:12:30 +01:00
Timm Bäder
cd730ccff5 gl renderer: save on some frame buffers
If the child of a color matrix node is a texture, we can directly use
that instead of drawing it to a texture first and then using that
texture.
2017-12-21 19:12:30 +01:00
Timm Bäder
1d1c6a98ce GskGLDriver: Add profiler
Count the newly created textures, the reused ones and the uploads from
cairo surfaces per frame.
2017-12-21 19:12:30 +01:00
Timm Bäder
ddb77d6c9b GskGLDriver: Use float for texture size in create_texture
Render nodes can end up with bounds < 1 since they are floats, and the
implicit cast to int ends up creating a texture with 0 width or height.
Use ceil() instead in create_texture so we don't have to do that on the
caller side everywhere.
2017-12-21 18:25:52 +01:00
Timm Bäder
4aa3f51016 test-render-nodes: Add color matrix test 2017-12-21 18:25:52 +01:00
Timm Bäder
8c8583d04f test-render-nodes: Print a warning if we didn't generate anything 2017-12-21 18:25:52 +01:00
Timm Bäder
04742f320e build: Remove unused variable 2017-12-21 18:25:52 +01:00
Timm Bäder
851a5d48c3 add tests/showrendernode
A .node file viewer.
2017-12-21 18:25:52 +01:00
Timm Bäder
6bce14bee2 Rework the GL renderer 2017-12-21 18:25:52 +01:00
Timm Bäder
5fa5008ee9 gl renderer: Remove some unused code 2017-12-21 18:25:52 +01:00
Timm Bäder
fe7db31663 gl driver: Make some members const 2017-12-21 18:25:52 +01:00
Timm Bäder
b488329104 GskRenderer: Remove viewport property 2017-12-21 18:25:52 +01:00
Timm Bäder
19871cfd68 snapshot: Add & use API for linear gradient nodes
This way, we can also clip the created node bounds to the current clip
of the GtkSnapshot. This works as long as we don't modify the start and
end points, and happens all the time while rendering.
2017-12-21 18:25:52 +01:00
Timm Bäder
d9f1620b2f snapshot: Directly clip color nodes
Clipping a color node is trivial so we do it here directly since that
might later save the entire clip node as well as freeing the fragment
shaders from coloring lots of pixels that will be clipped away.
2017-12-21 18:25:52 +01:00
Timm Bäder
8107b1a2dd snapshot: Fix typo 2017-12-21 18:25:51 +01:00
Timm Bäder
964c6f7d58 x11: Fix wrong condition when unsetting transient-for
Setting a new transient-for parent is only possible if the given parent
window is valid, not when it is NULL or valid.
2017-12-21 18:25:51 +01:00
Matthias Clasen
1c3f343baf Remove font-name leftovers
There were still a few places where the font-name
property was used internally.
2017-12-21 12:18:53 -05:00
Matthias Clasen
559a2bf033 Add a missing include 2017-12-21 12:18:10 -05:00
Matthias Clasen
6ff3222cbd font button: Drop the font-name property
We already have the GtkFontChooser::font property
which serves the same purpose, so get rid of the
duplication.
2017-12-21 11:10:44 -05:00
Matthias Clasen
9620e1e97f tests: Stop using gtk_font_button_get_font_name
It is going away.
2017-12-21 11:10:13 -05:00
Matthias Clasen
8581345acc Remove debug spew 2017-12-21 08:04:26 -05:00
Matthias Clasen
495d00e925 Fix a mis-merge 2017-12-20 10:36:25 -05:00
Matthias Clasen
22f9562928 Implement font-feature-settings
This is a missing part of the CSS font level 3 module.
2017-12-20 10:31:30 -05:00
Matthias Clasen
6042b82964 Update the docs for GtkCssChange
The docs were out of sync with the flags we actually have.
2017-12-20 08:46:03 -05:00
Carlos Garnacho
f93837ceb2 gdk: Remove leftover variable
This is unused and leaked.
2017-12-19 22:58:51 +01:00
Matthias Clasen
5478bd59bf Fix a crash introduced in the previous commit
The signatures of row-inserted and row-deleted are not
identical, so we need to be a bit more careful here.
2017-12-19 14:17:55 -05:00
Matthias Clasen
1b05474979 font chooser: Simplify some code
Instead of separate handlers, just keep a single
handler for both row-inserted and row-deleted.
Slightly less work that way.
2017-12-19 12:10:47 -05:00
Matthias Clasen
e5154547f8 font chooser: Stop listening to style-updated
The only time a style-updated indicates we need
to reload fonts is when it is synthesized by GtkSettings
in response to a fontconfig timestamp change, but
we are listening to those already, anyway.
2017-12-19 11:45:56 -05:00
Timm Bäder
827d04c482 gtk4-demo: Fix font-features UI file 2017-12-19 09:46:27 +01:00
Timm Bäder
f393552fec x11: Guard against NULL window
Otherwise, the NULL parent window causes a crash in the
GDK_WINDOW_IS_DESTROYED call.
2017-12-19 07:39:37 +01:00
Timm Bäder
fcbbaae63c window: Make sure an event has a display
This fixes a crash happening later on when something tries to access the
event's display.
2017-12-19 07:39:29 +01:00
Matthias Clasen
675a4111e9 emoji: Skip overly wide fallback rendering
Some emoji fonts (such as Emoji One), render Emoji sequences
such as some of the family variations using multiple individual
glyphs. This rendering is too wide and breaks our grid layout.
Therefore, we will just skip any sequence whose rendering is
more than twice as wide as a simple smiley.
2017-12-17 22:11:24 -05:00
Matthias Clasen
22269902ed Avoid calling unsetenv too late
Stash the DESKTOP_AUTOSTART_ID env var in a constructor,
before any threads have been created.

https://bugzilla.gnome.org/show_bug.cgi?id=790963
2017-12-17 17:32:05 -05:00
Matthias Clasen
845f2657db cups: Warn only once if colord is not available
No need to keep complaining about this.

https://bugzilla.gnome.org/show_bug.cgi?id=791650
2017-12-17 17:09:55 -05:00
Matthias Clasen
08c699c745 wayland: Handle scale 3 for cursors
This is just a bandaid solution to make scale 3 work.
If people seriously want to go for scales larger than
that, we need a better solution.
2017-12-17 16:41:54 -05:00
Matthias Clasen
9a7624b47a inspector: Allow to bump scale to 3
Might as well allow this, for 'large scale testing'.
2017-12-17 16:40:10 -05:00
Matthias Clasen
21064a41b5 Remove unneeded deprecation guards
No deprecated api used in here, it seems.
2017-12-17 13:15:18 -05:00
Matthias Clasen
1293209d23 Don't place dnd cursor in placeholder text
That is just misleading - the entire placeholder text is going
to be replaced by the drop.
2017-12-17 10:52:33 -05:00
Benjamin Otte
f824439137 dnd: Get rid of IPC widgets
Instead, pass the source window to gdk_drag_begin().

Also make Wayland use this window instead of the one under the pointer
(though those 2 Windows are most likely the same anyway).
2017-12-16 02:48:12 +01:00
Benjamin Otte
3438dcdd4e x11: Add necessary NULL check 2017-12-16 02:48:12 +01:00
Benjamin Otte
8f6194a883 dnd: Remove unused function
The function was referencing itself in ways that bamboozled gcc:
  static void
  foo (void)
  {
    g_signal_handlers_disconnect_by_func (NULL, foo, NULL);
  }

Well done, function, you get your own commit!
2017-12-16 02:48:12 +01:00
Benjamin Otte
aab86f8b98 x11: Try getting ipc_window vs source_window right
This is in preparation for splitting these. Unfortunately, source_window
== ipc_window, so this isn't very debuggable yet.
2017-12-16 02:48:12 +01:00
Benjamin Otte
510581e0ef x11: Use gdk_drag_context_get_display() 2017-12-16 02:48:12 +01:00
Benjamin Otte
5f326d7ec6 x11: Create IPC window outselves
Ignore the passed in IPC window.
2017-12-16 02:48:12 +01:00
Matthias Clasen
4573d2d19b listbox: Fix a crash during keynav
The code was asserting something that was not always holding
true. We can hit row == NULL here on page-up too. Handle that
case by moving to the first row.

https://bugzilla.gnome.org/show_bug.cgi?id=791549
2017-12-15 18:48:50 -05:00
Benjamin Otte
cb9867cb48 dnd: Remove handler for nonexisting signal
The signal has been gone since e3e9bf4bea
2017-12-15 23:57:33 +01:00
Benjamin Otte
31119c89df gtk: Remove unused include 2017-12-15 23:53:18 +01:00
Benjamin Otte
a04afde35c gdk: Remove DRAG_STATUS and DROP_FINISHED events
Those are source-side events that are handled by signals of the
Dragontext these days.
2017-12-15 23:48:36 +01:00
Matthias Clasen
61843d60b2 x11: Avoid crash in fallback move emulation
Quietly do nothing when there is already an ongoing operation.
This matches the behavior of the ewmh code, and is much nicer
than a crash.

https://bugzilla.gnome.org/show_bug.cgi?id=789054
2017-12-15 16:19:09 -05:00
Juan Pablo Ugarte
e0ce028c88 css: Fix segfault when GtkCssStyleChange is NULL on gtk_widget_real_style_updated()
https://bugzilla.gnome.org/show_bug.cgi?id=791281
2017-12-15 10:28:21 -03:00
Matthias Clasen
a326884df8 Mention keymaps in the migration guide
Just another bullet point.
2017-12-15 07:48:36 -05:00
Matthias Clasen
fa27d171d0 Drop gdk_keymap_get_for_display
It has been replaced by gdk_display_get_keymap.
2017-12-15 07:46:35 -05:00
Matthias Clasen
e92c0e85ec Replace gdk_keymap_get_for_display by gdk_display_get_keymap
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Matthias Clasen
1012bbeecf Add gdk_display_get_keymap
This is just a better name for gdk_keymap_get_for_display.
2017-12-15 06:53:13 -05:00
Matthias Clasen
fd85ff0c7a Drop gdk_keymap_get_default()
It is better to use the explicit keymap getter - the
default display may not even use the current gdk backend.
2017-12-14 23:57:54 -05:00
Matthias Clasen
9194ee4973 gdk: Drop GDK_DAMAGE
We haven't been generating events of this type
since we dropped offscreen windows.
2017-12-14 23:35:08 -05:00
Matthias Clasen
65fc43a1f3 Drop GDK_CLIENT_EVENT
We never generate events of this type, so no need
to carry it around.
2017-12-14 22:55:03 -05:00
Matthias Clasen
8d42ab6b91 gdk: Remove explicit event type numbering
The numeric values of event types are irrelevant,
so we don't need to declare them explicitly.
2017-12-14 22:43:53 -05:00
Matthias Clasen
bcf570cc16 Move code around
gdk_window_set_state is now an ordinary (private) setter,
so it should live in gdkwindow.c.
2017-12-14 22:35:27 -05:00
Matthias Clasen
11a946df39 gdk: Drop GdkEventWindowState
No longer generate this event. Instead, emit change
notification for GdkWindow::state.
2017-12-14 22:24:06 -05:00
Matthias Clasen
a4a2ecb21a widget: Remove the ::window-state-event signal
We no longer use this signal, so remove it.
2017-12-14 22:24:06 -05:00
Matthias Clasen
0313b8f0bc gtk: Stop handling GdkEventWindowState
These events have been superseded by GdkWindow::state.
2017-12-14 22:24:06 -05:00
Matthias Clasen
8476fc3fb0 menu: Stop using GdkEventWindowState
These events are going away.
2017-12-14 22:24:06 -05:00
Matthias Clasen
c1f9d7cb16 a11y: Stop using GdkEventWindowState
These events are going way.
2017-12-14 22:24:06 -05:00
Matthias Clasen
40d57ff884 headerbar: Stop using GdkEventWindowState
Use GdkWindow::state instead - the event is going away.
2017-12-14 22:24:06 -05:00
Matthias Clasen
ce251133c0 gtk-demo: Stop using GdkEventWindowState
Use GdkWindow::state instead - the event is going away.
2017-12-14 22:24:06 -05:00
Matthias Clasen
2c267a3cf1 testgtk: Stop using GdkEventWindowState
Use GdkWindow::state instead - the event is going away.
2017-12-14 22:24:06 -05:00
Matthias Clasen
1e1904a9b8 gtk: Stop using GdkEventWindowState
We can instead use the new GdkWindow::state property
change notification. The event is going away.
2017-12-14 22:24:06 -05:00
Matthias Clasen
e5b1867118 gdk: Add a GdkWindow::state property
This will eventually replace the window state event.
2017-12-14 22:24:06 -05:00
Daniel Boles
fe20fc3128 FileChooser: Update set_local_only() doc’s default
The property now defaults to FALSE, but the setter doc didn’t reflect it

While here, add a missing apostrophe too.

https://bugzilla.gnome.org/show_bug.cgi?id=791176
2017-12-14 15:36:43 +00:00
Benjamin Otte
84431ab927 x11: Remove GdkAtom usage from dnd code
Use strings instead.
2017-12-14 13:46:37 +01:00
Benjamin Otte
5d70bbf4c4 display: Remove leftover old clipboard APIs 2017-12-14 13:35:32 +01:00
Krzesimir Nowak
5a0fb278d1 x11: Fix erroneous & to be && 2017-12-14 13:35:32 +01:00
Benjamin Otte
920259c250 x11: Get rid of default Atom converters
No, using the default Wayland display is not okay to query Atoms.
2017-12-14 13:35:32 +01:00
Benjamin Otte
52b1a46549 device: Make axis label a regular string
Atoms are about to die.
2017-12-14 13:35:32 +01:00
Stas Solovey
b1f11464b6 Update Russian translation
(cherry picked from commit d69f998c26)
2017-12-14 09:58:21 +00:00
Matthias Clasen
75dd3315e6 Drop atom apis from the docs
These no longer exist.
2017-12-13 23:47:51 -05:00
Matthias Clasen
84eaf3da7d Drop atom-related cast macros
These don't really add anything, just drop them.
2017-12-13 23:47:02 -05:00
Matthias Clasen
54a6273191 Drop gdk_atom_intern
Atoms are just interned strings now, so we can just
use g_intern_string.
2017-12-13 23:39:03 -05:00
Matthias Clasen
4c083c1ed4 Drop gdk_atom_name
Since atoms are just interned strings now, we can just
cast them to const char * where needed.
2017-12-13 23:26:23 -05:00
Matthias Clasen
e3e9bf4bea Remove no-longer-used signals
GtkWidget::selection-get and ::selection-received are no
longer used, so get rid of them.
2017-12-13 22:53:50 -05:00
Benjamin Otte
b49a9b9933 dnd: Remove gdk_drag_get_selection()
Without selections, drags can't have them either.

Also included is removing the selection from GtkSelectionData.

Includes a bunch of crude cleanups to Wayland code that no longer has to
care about selection atoms.
2017-12-14 04:39:22 +01:00
Benjamin Otte
65fcff87b2 gdk: Remove ability to request selection notifications
Without selections, that's kinda pointless.
2017-12-14 04:20:48 +01:00
Benjamin Otte
f2bb2024c8 gdk: Remove properties
They are not used anymore.

Gone with them are PropertyNotify events.
2017-12-14 03:05:34 +01:00
Benjamin Otte
82aa0eacb2 broadway: Make compile after GdkEvent objectification 2017-12-14 03:05:34 +01:00
Benjamin Otte
38d8fa0b6a gesture: Fix gcc constness warning 2017-12-14 03:05:34 +01:00
Benjamin Otte
d7f34874ab x11: Make unsetting transient-for work
... and just unset it from GtkWindow instead of fiddling with
properties.
2017-12-14 03:05:34 +01:00
Benjamin Otte
a4b42f0b73 gdk: Remove selection defines
And with it, remove the selections section from the docs.

So selections are gone for good now.
2017-12-14 03:05:34 +01:00
Georges Basile Stavracas Neto
8993a51893 vulkan: Destroy buffer before releasing associate memory
Exact same issue as the previous commit.
2017-12-13 23:14:58 -02:00
Georges Basile Stavracas Neto
147a455171 vulkan: Destroy image before releasing associate memory
VkImage contains a reference to the VkDeviceMemory and, because
the current code frees the VkDeviceMemory before destroying the
VkImage that references it, a warning is triggered by the validation
layers.

This is not critical, since we release both resources at the same
place. But the warning triggered by the validation layers sums up
adding 1 MB per second of extra debug logging, making the debugging
process much more painful.

This commit simply swaps the destruction order, and destroys the
VkImage first, then the now unused VkDeviceMemory.
2017-12-13 22:49:16 -02:00
Piotr Drąg
192bdae280 Update POTFILES.in 2017-12-14 01:15:17 +01:00
Carlos Garnacho
2f65a2f5cc gdk: Make gdk_display_peek_event() Return a reference to the event
No need to copy it.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
332b640cd3 gtk: Make gtk_get_current_event() return a reference
All callers in gtk seem to be ok with it, and it makes sense if
we are dealing with events as "static after delivered".
2017-12-14 01:05:48 +01:00
Carlos Garnacho
ee178947d7 gtk: Avoid some event copies
Those places can do with an extra reference.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
d491e49fd6 gtk: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Carlos Garnacho
b03d3fb268 gdk/wayland: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Carlos Garnacho
3021edc38d gdk/x11: s/gdk_event_free/g_object_unref/ 2017-12-14 01:05:48 +01:00
Carlos Garnacho
f79ac6d30b gdk: Remove gdk_window_[gs]et_event_compression()
Motion compression is now the unmodifiable default, callers may
call gdk_event_get_motion_history() to check the uncoalesced
motion history.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
47f04afa48 gtk: Remove CONSTRUCT_ONLY flag from GtkEventControllerScroll::flags
There is a gtk_event_controller_scroll_set_flags() call that's meant
to be called after construction (eg. due to scrolledwindow relayouts
hiding/showing scrollbars). The property shouldn't be construct-only
for consistence.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
ea216accd7 gdk: Implement motion history as motion event data
In the motion compression phase the coalesced events will be saved
as a GdkTimeCoord on the motion event that shall be delivered.

For simplicity (and because history doesn't make much sense otherwise)
event history is only recorded while there are buttons pressed, this
also tidily ensures that those coalesced events would have the same
target widget on the gtk side than the delivered one, because of
implicit grabs.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
a040ed55cc gdk: Keep reference on tools from motion/button events. 2017-12-14 01:05:48 +01:00
Carlos Garnacho
8c9231dbb4 gdk: Move additional code in gdk_event_new() to GdkEvent::constructed
Now that the type is a construct only property, we can initialize the
event fields properly here.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
5ee1d4893a gdk: Make GdkEvent type a construct only property
So it must be set at the time of doing g_object_new().
2017-12-14 01:05:48 +01:00
Carlos Garnacho
ca89ad75b4 gdk: Remove gdk_event_is_allocated()
All events are allocated now.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
0c8c9f59fc gtk: Adapt marshallers to GdkEvent as GObject 2017-12-14 01:05:48 +01:00
Carlos Garnacho
2acbb7b01d gdk: Turn GdkEvent into a GObject
Two warts remain. gdk_event_copy() should be unnecessary as
events should be considered static after delivery, so g_object_ref()
should be just as good. There's a few exceptional cases that the event
is copied and then modifier for later processing, those cases should be
reconsidered individually.

And gdk_event_free() could be likewise turned into g_object_unref(),
many callers remain though.
2017-12-14 01:05:48 +01:00
Carlos Garnacho
1e1f2a6e67 gdk: Remove GdkDisplay from GdkEventPrivate
And add it to GdkEventAny.
2017-12-14 01:05:08 +01:00
Carlos Garnacho
8595e4b1d1 gdk: Figure out the GdkSeat of an event from the GdkDevice
Removes the need for gdk_event_set_seat() and the GdkSeat field from
GdkEventPrivate.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
526486da6b gdk: Use allocated events
Stack allocated GdkEvent structs will not be ok when events become
objects.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
33330ad001 gtk/a11y: Use allocated events
Using stack allocated GdkEvent will not be ok when they become
objects.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
59cab36035 gdk: Fold GdkEventPrivate fields into event structs
Now all events structs are private, it doesn't make as much sense
having GdkEventPrivate wrapping allocating events. This is a first
step towards removing it.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
64decbfd74 gdk: Remove GdkEventType argument from GdkEvent union
It won't stand true anymore that the GdkEventType argument is the
first field of the GdkEvent* structs. All callers have been updated
to use event->any.type instead.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
b9db0b55cb gdk: Refurbish GdkEvent struct hierarchy
Make all specific event structs contain a GdkEventAny, so the base
struct can be extended without modifying structs all over the place.
2017-12-14 00:58:32 +01:00
Matthias Clasen
9aba77e31b Redo drag source event handling
Let the gesture itself handle the events.
2017-12-13 18:56:42 -05:00
Benjamin Otte
54f9aef0d4 gdk: Remove gdk_selection_convert()
It's not used anymore.
2017-12-14 00:44:26 +01:00
Benjamin Otte
ca5f859dc8 dnd: Only send DELETE request on X11
This is Xdnd-specific and doesn't need to happen elsewhere.
2017-12-13 23:52:55 +01:00
Benjamin Otte
4042d5f242 gdk: Remove ability to own a selection
With this, the GDK_EVENT_SELECTION_REQUEST and GDK_EVENT_SELECTION_CLEAR
and the associated GtkWidget signals are gone, too.
2017-12-13 23:39:02 +01:00
Benjamin Otte
53081bd1d8 tests: Remove testselection
With selections goig away, this test is not very useful anymore.
2017-12-13 19:40:24 +01:00
Benjamin Otte
cb3ef5b642 xxx: don't claim dnd selection 2017-12-13 19:37:11 +01:00
Benjamin Otte
b66052f3ce gdk: Remove gdk_selection_add_targets()
It's not needed anymore, now that we can look at the content provider's
formats.

Alose remove all the API in GTK that was used to set it.
2017-12-13 19:27:51 +01:00
Benjamin Otte
65eab87238 x11: Move selection handling to GDK
Instead of claiming the selection in GTK, claim it in the X11 dnd code.
Also handle SelectionRequest and SelectionClear X events there.
2017-12-13 18:31:06 +01:00
Benjamin Otte
8648d5409e dnd: Pass content to gdk_drag_begin()
Instead of just passing the GdkContentFormats, we are now passing the
GdkContentProvider to gdk_drag_begin().
This means that GDK itself can now query the data from the provider
directly instead of having to send selection events.

Use this to provide the private API gdk_drag_context_write() that allows
backends to pass an output stream that this data will be written to.
Implement this as the mechanism for providing drag data on Wayland.

And to make this all work, implement a content provider named
GtkDragContent that is implemented by reverting to the old DND
drag-data-get machinery inside GTK, so for widgets everything works just
like before.
2017-12-13 15:05:27 +01:00
Matthias Clasen
c30cd885dd A forgotten file
These changes belong to the scale button autoscrollling
commit.
2017-12-12 23:23:17 -05:00
Matthias Clasen
9b29369222 Make sure events have displays
This seems to be necessary if you want to call
gdk_display_put_event on them.
2017-12-12 23:21:26 -05:00
Matthias Clasen
7e02ad648c toolbar: Stop using legacy event signals
We can reuse the button gesture here.
2017-12-12 22:55:48 -05:00
Matthias Clasen
fa7ef93bc5 scalebutton: Add autoscrolling
Use the smooth autoscrolling that the scale can do,
and at the same time stop using legacy event signals.
2017-12-12 22:21:43 -05:00
Matthias Clasen
05fbd32c4d button: Add private api to get at the gesture
Attaching another gesture from the outside does not
work currently, so let widgets share their button's
gesture for now.
2017-12-12 22:18:19 -05:00
Matthias Clasen
b891d205dd range: Add private api to autoscroll
This will be used to scroll the scale in scale buttons.
2017-12-12 22:17:49 -05:00
Matthias Clasen
2f6f8a7e6f path bar: Drop non-functional hold-to-scroll code
Scrolling a path bar is of marginal usefulness - you need to
find a really deep place in your filesystem hierarchy in order
to scroll one or two places at best. And the code we had for
this was not working. And it was using legacy event handlers.
Instead of fixing it, remove it.
2017-12-12 20:49:31 -05:00
Benjamin Otte
fb0fdddd76 x11: Refactor xevent filtering some more
We now have a GdkX11Display::xevent signal that gets emitted for every
XEvent and allows you to interrupt processing via TRUE/FALSE return
values.
These return values to correspond to GDK_FILTER_REMOVE and
GDK_FILTER_CONTINUE respectively.

The GDK_FILTER_TRANSLATE case from gdk_window_add_filter() is now meant
to be handled via gdk_display_put_event().
2017-12-13 01:55:56 +01:00
Matthias Clasen
76b93f5598 widget-factory: Avoid a legacy event handler
We can use a gesture instead, here.
2017-12-12 19:46:10 -05:00
Benjamin Otte
4b33a34ce3 x11: Use GdkX11Display::translate-event more 2017-12-13 01:09:32 +01:00
Benjamin Otte
2d86c1a869 x11: Make clipboard use translate-event signal 2017-12-13 00:56:52 +01:00
Benjamin Otte
c93ddf62c3 gdk: Clean up marshalers
Don't generate marshallers that are not needed.

Use the default ones if they exist.
2017-12-13 00:56:52 +01:00
Benjamin Otte
0d1ea05658 x11: Add GdkX11Display:translate-event signal
This is supposed to replace gdk_window_add_filter() in the long run.
2017-12-13 00:56:52 +01:00
Benjamin Otte
f34297cfba x11: Constify XEvent usage 2017-12-13 00:56:52 +01:00
Benjamin Otte
8a453924a0 gdk: Remove gdk_event_put(), peek() etc
We don't want to treat events like they don't belong to displays. So
instead, people should use gdk_display_put/peek/get_event().
2017-12-13 00:56:52 +01:00
Benjamin Otte
5df527edaf x11: Refactor code
This is in preparation for DND.

It moves a lot of code from gdkclipboard-x11.c to
gdkselectionoutputstream-x11.c to untangle it from GdkX11Clipboard
usage.
2017-12-13 00:56:52 +01:00
Benjamin Otte
80dcdd3df6 gdk: Remove unused function
Fun fact: This function was never used.
2017-12-13 00:56:52 +01:00
Matthias Clasen
1b9aa1b708 a11y: drop the focus tracker
This code was doing horrible things, and the atk documentation
for the focus tracking feature says that this is deprecated and
not used anymore. So lets not do it.
2017-12-12 14:49:44 -05:00
Matthias Clasen
33fdcca2cf placesview: Make middle click work
This does not cost us much, and improves consistency.
2017-12-12 13:56:15 -05:00
Matthias Clasen
6896e9402e Deprecate many legacy event signals
Mark the following signals as deprecated:
event, event-after, button-press-event, button-release-event,
touch-event, scroll-event, motion-notify-event, enter-notify-event,
leave-notify-event, property-notify-event, selection-clear-event,
selection-request-event, selection-notify-event, selection-received,
selection-get, proximity-in-event, proximity-out-event. Most
of these have suitable replacements in event controllers and
gestures already. The selection-related signals will soon be
irrelevant when selection handling moves to GDK.

Set G_ENABLE_DIAGNOSTIC=1 to see deprecation
warnings for uses of these signals.
2017-12-12 11:04:49 -05:00
Matthias Clasen
20bdb347cd Install gtkeventcontrollermotion.h
Public headers need to be listed in gtk/meson.build.
This was overlooked when I added the controller.
2017-12-12 10:39:16 -05:00
Piotr Drąg
cb8888a985 Update POTFILES.in 2017-12-12 16:33:22 +01:00
Matthias Clasen
a20a828b57 Add GtkEventControllMotion to the docs 2017-12-12 10:26:03 -05:00
Matthias Clasen
c3851c5469 paned: Stop using motion notify
We can use the new motion event controller that
was introduced for this purpose.
2017-12-12 09:42:05 -05:00
Matthias Clasen
3aa6890e3e about dialog: Stop using event-after as well
We can just use a multipress gesture for this purpose.
2017-12-12 09:42:05 -05:00
Matthias Clasen
56a41f174e about dialog: Stop using motion notify
We can use the new motion event controller for this.
2017-12-12 09:42:05 -05:00
Matthias Clasen
ecdf8c64fe label: Use GtkEventControllerMotion
This lets us avoid legacy event signals here.
2017-12-12 09:42:05 -05:00
Matthias Clasen
911f9fb0ee Add a simple motion eventcontroller
This can serve as a replacement for the legacy
event signals for enter/leave/motion notify.
2017-12-12 09:42:05 -05:00
Matthias Clasen
d871fd12cc Try to make a composite entry
This is an attempt to see how much work is needed to
reproduce entry icons by just putting an entry and images
in a box, with some css glue.
2017-12-12 09:42:05 -05:00
Benjamin Otte
b80d14ba19 placessidebar: Don't use root coordinates 2017-12-12 00:31:49 +01:00
Benjamin Otte
04ac4c66ae dnd: Pass device, not event
You don't start a dnd operation with a device, you start it with an
event.
2017-12-12 00:31:49 +01:00
Benjamin Otte
23c798b41d dnd: No longer allow passing -1
Nobody ever does that and special cases are evil.
2017-12-12 00:29:51 +01:00
Benjamin Otte
756b276070 dnd: Remove button argument from drag_begin()
It was unused.
2017-12-12 00:29:51 +01:00
1625 changed files with 167528 additions and 156946 deletions

63
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,63 @@
stages:
- build
- flatpak
.cache-paths: &cache-paths
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/master:v1
stage: build
script:
- bash -x ./.gitlab-ci/test-docker.sh
artifacts:
when: on_failure
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
cache:
key: "$CI_JOB_NAME"
<<: *cache-paths
.mingw-defaults: &mingw-defaults
stage: build
tags:
- win32
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
cache:
key: "%CI_JOB_NAME%"
<<: *cache-paths
msys2-mingw32:
variables:
MSYSTEM: "MINGW32"
CHERE_INVOKING: "yes"
<<: *mingw-defaults
.flatpak-defaults: &flatpak-defaults
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
stage: flatpak
artifacts:
paths:
- "${APPID}-dev.flatpak"
expire_in: 1 day
script:
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
flatpak:demo:
variables:
APPID: org.gtk.Demo
<<: *flatpak-defaults
flatpak:widget-factory:
variables:
APPID: org.gtk.WidgetFactory
<<: *flatpak-defaults

80
.gitlab-ci/Dockerfile Normal file
View File

@@ -0,0 +1,80 @@
FROM fedora:28
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
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 \
gtk-doc \
iso-codes \
itstool \
json-glib-devel \
libattr-devel \
libepoxy-devel \
libffi-devel \
libmount-devel \
librsvg2 \
libselinux-devel \
libXcomposite-devel \
libXcursor-devel \
libXcursor-devel \
libXdamage-devel \
libXfixes-devel \
libXi-devel \
libXinerama-devel \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libwayland-egl-devel \
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 \
which \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
USER user
WORKDIR /home/user
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}

11
.gitlab-ci/run-docker.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
set -e
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v1"
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .
sudo docker run --rm --security-opt label=disable \
--volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
--tty --interactive "${TAG}" bash

32
.gitlab-ci/test-docker.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
set -e
srcdir=$(pwd)
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
ccache --zero-stats
ccache --show-stats
export CCACHE_DISABLE=true
meson \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dbroadway-backend=true \
-Dvulkan=yes \
_build $srcdir
unset CCACHE_DISABLE
cd _build
ninja
ccache --show-stats
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test \
--print-errorlogs \
--suite=gtk+ \
--no-suite=gtk+:gsk \
--no-suite=gtk+:a11y

52
.gitlab-ci/test-msys2.sh Normal file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
set -e
if [[ "$MSYSTEM" == "MINGW32" ]]; then
export MSYS2_ARCH="i686"
else
export MSYS2_ARCH="x86_64"
fi
# Update everything
pacman --noconfirm -Suy
# Install the required packages
pacman --noconfirm -S --needed \
base-devel \
git \
mingw-w64-$MSYS2_ARCH-toolchain \
mingw-w64-$MSYS2_ARCH-ccache \
mingw-w64-$MSYS2_ARCH-pkg-config \
mingw-w64-$MSYS2_ARCH-gobject-introspection \
mingw-w64-$MSYS2_ARCH-meson \
mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \
mingw-w64-$MSYS2_ARCH-atk \
mingw-w64-$MSYS2_ARCH-cairo \
mingw-w64-$MSYS2_ARCH-gdk-pixbuf2 \
mingw-w64-$MSYS2_ARCH-glib2 \
mingw-w64-$MSYS2_ARCH-graphene \
mingw-w64-$MSYS2_ARCH-json-glib \
mingw-w64-$MSYS2_ARCH-libepoxy \
mingw-w64-$MSYS2_ARCH-pango \
mingw-w64-$MSYS2_ARCH-fribidi \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
mingw-w64-$MSYS2_ARCH-shared-mime-info
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# Build
ccache --zero-stats
ccache --show-stats
export CCACHE_DISABLE=true
meson \
-Denable-x11-backend=false \
-Denable-wayland-backend=false \
-Denable-win32-backend=true \
_build
unset CCACHE_DISABLE
ninja -C _build
ccache --show-stats

View File

@@ -0,0 +1,36 @@
## 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
<!--
- Screenshots or screen recordings are useful for visual errors
- Please report any warning or message printed on the terminal
-->

View File

@@ -0,0 +1,34 @@
## 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.
-->
## 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
-->
## Warnings
<!--
- If the application generates warning messages before crashing please
report them here
-->
## Backtrace
<!--
- 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,23 @@ 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. The [CODE-OWNERS](./docs-CODE-OWNERS)
document contains the list of core contributors to GTK and the areas for
which they are responsible.

8107
NEWS

File diff suppressed because it is too large Load Diff

903
NEWS.pre-2.0 Normal file
View File

@@ -0,0 +1,903 @@
Overview of Changes in GTK+ 2.0.0
=================================
* GtkTreeView fixes [Jonathan Blandford, Kristian Rietveld, Darin Adler]
* Build fixes [Anders Carlsson, Tor Lillqvist, Manish Singh]
* Bug fixes. [Thomas Leonard, Owen Taylor]
Overview of Changes in GTK+ 2.0.0 rc1
=====================================
* GtkTreeView fixes [Kristian Rietveld, Jonathan Blandford, Richard Hult]
* Text widget fixes [Havoc Pennington]
* Efficiency fixes when using Xft [Owen Taylor]
* Key handling fixes and other fixes for Win32 [Hans Breuer, Tor Lillqvist]
* Try to fix key handling without XKEYBOARD extension [Owen]
* Documentation fixes and improvements
[Matthias Clasen, Alexey Malyshev, Akira Tagoh, Vitaly Tishkov]
* Widget drawing improvements [Soeren Sandmann]
* Allow cycling between multiple menu bars with <Control>Tab [Owen]
* Try to build libraries with only shared library dependencies on Xft to
deal with transition to Xft2 [Owen]
* Portability fixes [Owen, Miroslaw Dobrzanski-Neumann]
* Don't use red as the default cursor color [Owen]
* Bug fixes, bug fixes, bug fixes.
Other contributors: Darin Adler, Jacob Berkman, Kevin Breit, Hans Breuer,
Anders Carlsson, Damon Chaplin, Finlay Dobbie, Jody Goldberg,
Andreas J. Guelzow, Scott Guilbeaux, Vlad Harchev, James Henstridge,
Tim Janik, Satyajit Kanungo, Charles Kerr, Sergey Kuzminov, Miles Lane,
Alexander Larsson, Paolo Maggi, Skip Montaro, Jan Mynarik, Sven Neumann,
Padraig O'Briain, Narayani Pattipati, Mark Patton, Havoc Pennington,
Ettore Perazzoli, Guillermo S. Romero, Manish Singh, Morten Welinder
Overview of Changes in GTK+ 1.3.15
==================================
* New stock and improved icon images
[Tuomas Kuosmanen, Jakub Steiner, Anders Carlsson]
* Widget drawing improvements for check and radio buttons,
spinbuttons [Soeren Sandmann]
* Clean up module search path algorithm, use GTK_PATH [Owen Taylor]
* Add GtkSetting for font name. [Richard Hestilow]
* Much improved key matching code, accelerators work independent
of group [Owen]
* Make mnemonics work for embedded GtkPlug widgets [Owen]
* Keynav improvements for GtkTreeView [Kristian Rietveld]
* Fix gtk_tree_view_scroll_to_cell() [Jonathan Blandford]
* Rename gtk_tree_view_get_iter_root() and gtk_tree_path_new_root()
to gtk_tree_view_get_iter_first() and gtk_tree_path_new_first(),
add compatibility macros.
* GtkTreeView bug fixes [Kristian, Anders, Damon Chaplin]
* GtkTextView bug fixes [Havoc Pennington]
* Pad class structures for future binary compatibility [Owen]
* Tutorial improvements [Sven Neumann, Matthias Clasen]
* Fixes for MULTIPLE selection target [Gregory Merchan, Owen]
* Fix problems with initial widget size [Owen]
* AIX compilation fixes [Miroslaw Dobrzanski-Neumann]
* Win32 fixes [Hans Breuer, Tor Lillqvist]
* Miscellaneous bug fixes
Other contributors: David L. Cooper, Eric Fischer, Jody Goldberg,
Satajyit Kanungo, Thomas Leonard, Mark Patton, Manish Singh,
Nicolas Setton
Overview of Changes in GTK+ 1.3.14
==================================
* Keyboard focus improvements [Owen Taylor]
* Code cleanup [Matthias Clasen, Manish Singh, Darin Adler]
* Fix accidentally exported variables [Mark McLoughlin]
* GtkTreeView fixes [Jonathan Blandford, Kristian Rietveld, John Harper, Darin]
* Default to yellow tooltips [Owen]
* RC file fixes for reloading, priorities [Owen, Matthias]
* GtkMenu behavior improvements and bug fixes [Owen, Arnaud Charlet]
* GtkTextView fixes [Havoc Pennington, Daniel Elstner, Dennis Bjorklund]
* Improve keynav for paned widgets, tooltips, spin buttons, notebooks,
scrolled windows [Soeren Sandmann, Padraig, Owen]
* Add Emacs/Default key themes [Owen]
* Win32 fixes [Hans Breuer, Tor Lillqvist]
* Ethiopic input methods [Daniel Yacob]
* Opaque paned window resizing [Soeren]
* Tweak table expansion behavior [Tim Janik]
* Fix GtkCalendar focus drawing [Bill Haneman]
* Allow themeable cursor thickness [Bill]
* Start of fixing of tutorial for GTK+-2.0 [Matthias]
* Add a ::adjust-bounds signal to GtkRange to allow spreadsheet style
scrollbars. [Jody Goldberg]
* Add the ability to turn on multiple selection for GtkFileSel [Manish]
* Bug fixes
Other contributors: Jacob Berkman, Padraig O'Briain, Anders Carlsson,
Johan Dahlin, Richard Hult, Stefan Kost, Alex Larsson, Thomas Leonard,
Paolo Maggi, Alexey Malyshev, Federico Mena Quintero, Skip Montaro,
Sven Neumann, Havoc Pennington, Laszlo Peter, Christian Rose, Joe Shaw,
Kevin Vandersloot, Morten Welinder, Peter Williams
Overview of Changes in GTK+ 1.3.13
==================================
* Tree view fixes. [Kristian Rietveld, Jonathan Blandford, Anders Carlsson]
* Tree view support for low-vision themes [Bill Haneman]
* Text view bug fixes. [Havoc Pennington]
* Win32 fixes and improvements. [Tor Lillqvist, Hans Breuer,
Archaeopteryx Software]
* Documentation improvements [Matthias Clasen, Havoc Pennington]
* Accelerate alpha compositing using RENDER extension if present,
and optimize the non-RENDER case a lot. [Owen Taylor]
* Add support for "optional keybindings" (action signal returns FALSE) [Owen]
* Fixed the infamous changing directory deletes filename bug
[Owen and a cast of thousands]
* Add mouse cursor hiding for text widgets [Anders Carlsson]
* Simple Hangul input module [Yusuke Tabata]
* Removed the scary startup warning.
* GdkPixbuf pixel handling fixes [Owen, Michael Hore, Jim Cape]
* Converted GtkFileSelection and GtkFontSelection to use GtKTreeView widgets
instead of the deprecated GtkCList [Owen]
* gtkhsv.h was installed by mistake, fixed that. [reported by Ross Burton]
* gdk_pixbuf_render_to_drawable() now also handles alpha pixbufs.
* Made Gtkimage draw GtkPixmap, GtkImage, GdkPixbuf insensitive, prelighted,
etc. [Havoc, Owen]
* Marked gtk_item_factory_path_from_widget() G_CONST_RETURN. [Matt Wilson]
* gtk_image_menu_item_new_from_stock() now falls back to
new_with_mnemonic, for consistency with gtk_button_new_from_stock()
[Havoc Pennington]
* GdkModifierType is now consistently used for modifier mask parameters
[Mark Patton]
* gtk_widget_set_accel_path() is now publically exported.
Other contributors: Darin Adler, Jeffrey Baker, Damon Chaplin, Brian Cameron,
Murray Cumming, James Henstridge, Jacob Berkman, Arnaud Charlet, Jeff Franks,
Jeff Garzik, Jody Goldberg, Diego Gonzalez, Melvin Hadasht, Raja Harinath,
Tim Janik, Mike Kestner, Mathieu Lacage, Alex Larsson, Ryan Lovett,
Mark McLoughlin, Sven Neumann, Padraig O'Briain, Xavier Ordoquy, Chris Phelps,
Detlef Reichl, Guillermo S. Romero, Federico Mena Quintero, Manish Singh,
HideToshi Tajima, Vitaly Tishkov, Jon Trowbridge, Sergey Vlasov.
Overview of Changes in GTK+ 1.3.12
==================================
* Fix problems with PNG saving [Michael Natterer]
* Cleanups of deprecated usages [Sebastian Wilhelmi]
* Win32 fixes [Tor Lillqvist]
* Documentation improvements [Matthias Clasen, Havoc Pennington,
Vitaly Tishkov]
* Frame buffer port fixes [Manish Singh]
* GtkTextView bug fixes [Havoc Pennington, Chris Phelps]
* Menu behavior improvements [Kristian Rietveld]
* Make focus line width configurable, focus color work on
dark themes. [Bill Haneman, Owen Taylor]
* Add state argument to gtk_paint_focus() [Bill]
* Added incremental revalidation to tree view, for better apparent speed
[Jonathan Blandford]
* Remove useless gtk_tree_view_column_cell_event() [Jonathan]
* Display XIM status in a separate window [HideToshi Tajima]
* Add GDK_DEBUG=nograbs to disable pointer, keyboard grabs [Jacob Berkman]
* Add menu of Unicode control characters to GtkEntry, GtkTextView
[Dov Grobgeld, Havoc]
* Pass key releases along to input methods [Owen]
* Many bug fixes
Other contributors: Darin Adler, Fabrice Bellet, Chris Blizzard,
Hans Breuer, Anders Carlsson, Damon Chaplin, Murray Cumming, Jeff Franks,
James Henstridge, Tim Janik, Alex Larsson, George Lebl, Kjartan, Maraas,
Sven Neumann, Seth Nickell, Padraig O'Briain, Soeren Sandmann, Manish Singh,
Matt Wilson
Overview of Changes in GTK+ 1.3.11
==================================
* Massive rework of accelerator API and implementation (Tim Janik)
* Major fixes to resizing and redrawing to eliminate hysteresis
and optimize. (Owen Taylor, Soeren Sandmann)
* Make many widgets NO_WINDOW to improve appearance and reduce
drawing overhead (Owen)
* Text view fixes (Havoc Pennington)
* Make child widgets in GtkTextView work (Havoc)
* GtkTreeModelSort fixage (Jonathan Blandford, Kristian Rietveld)
* Clean up GtkTreeView drag and drop support (Owen)
* Misc tree view fixes and improvements (Jonathan, Kristian, Anders, Matt Wilson)
* Add gtk_window_get/set_focus(), gtk_window_set_default() as public
functions (Owen, Damian Ivereigh)
* Fixes to GtkPlug/GtkSocket (Michael Meeks, Owen)
* Change button ordering in standard dialogs to correspond to
GNOME usability project proposal (Gregory Merchan)
* Add support for context sensitivity in input methods (Owen)
* Hook up gtk_im_context_set_use_preedit() (Hidetoshi Tajima)
* Fix gdk_window_scroll() and other aspects of big windows (Owen)
* Remove need for X connection for class initialization (Jacob Berkman)
* Propagate key events to parents of focused widget (Owen)
* Don't export normal GTK+ marshalers, export deprecated compat marshalers (Owen)
* Many Win32 Fixes and improvements (Hans Breuer, Tor Lillqvist)
* Bug and documentation fixing (Matthias Clasen, Anders Carlsson,
Jacob Berkman, others.)
Other Contributors:
Darin Adler, Marius Andreiana, Erwann Chenede, Murray Cumming, Janet Davis,
Daniel Egger, Daniel Elstner, Jeff Franks, Alex Larsson, George Lebl,
Sergey Kuzminov, Eric Lemings, Arkadiusz Miskiewicz, Padraig O'Briain, Sven Neumann,
Kristian Rietveld, Nicolas Setton, Manish Singh, Vitaly Tishkov, Sebastian Wilhelmi,
Michael Natterer
Overview of Changes in GTK+ 1.3.10
==================================
* GtkTextView fixes [Havoc Pennington]
* GtkTreeView fixes and improvements [Jonathan Blandford, Kristian,
Manish Singh, Joshua Pritikin, Oleg Maiboroda, James Henstridge]
* gtkdemo improvements [Kristian Rietveld]
* Drag and drop fixes to generic code and widgets
[Owen Taylor, Damian Ivereigh]
* Documentation improvement [Havoc Pennington, Matthias Clasen]
* Spelling fixes [Jacob Berkman]
* Move signals to the GtkEditable interface [Kristian]
* Further stock image improvements [Jakub Steiner]
* Support text chunks for the PGN loader, add gdk_pixbuf_get_option()
[Sven Neumann]
* Rename gdk_pixbuf_new_from_stream back to new_from_inline [Owen]
* Automatically call setlocale(), unless explicitly disabled [Owen]
* Property addition to various widgets [Michael Meeks, Owen]
* Support building with automake-1.4 [James]
* Make GtkRadioButton groups act as a single focus point [Owen]
* Move gdk_window_lookup etc. to be cross-platform [Matthias]
* Draw spinbuttons variably sized [Kristian]
* Separate GdkAtom out from X atoms for compatibility with future
multihead changes [Owen]
* Require gdk_threads_init() to be explicitly called instead
of piggybacking off of g_thread_init(). [Owen]
* Improvements to text-view/label/entry popup menus [Damian, Jacob, Owen]
* Bug fixes and cleanup [Matthias, others]
Other Contributors:
Mark McLoughin, Mikael Hermansson, Soeren Sandmann, Anders Carlsson,
Tim Janik, Murray Cumming, Hidetoshi Tajima, Padraig O'Briain,
Hans Breuer, Vitaly Tishkov, Dov Grobgeld
Overview of Changes in GTK+ 1.3.9
=================================
* Add editable text cells to GtkTreeView.
Keynav, drawing fixes in GtkTreeView [Jonathan Blandford]
* Text widget no longer always has a \n in it. [Havoc Pennington]
* Text widget bug fixes [Havoc, Dov Grobgeld, Hidetoshi Tajima]
* Allow -1 for width/height in gdk_pixbuf_render_*(). [Matthias Clasen]
* Minor fix for major resizing problems in recent releases [Owen Taylor]
* Restore ability to set _set properties to TRUE for
GtkCellRendererText, GtkTextTag [Owen]
* Cursor drawing improvements [Owen]
* Win32 fixes [Hans Breuer]
* Mark various functions as deprecated or private.
* Misc bug fixes, portability fixes, and cleanups.
Other Contributors:
Vitaly Tishkov, Christian Rose, Frank Belew, Jeff Franks, Sven Neumann,
Kristian Rietveld, Vitaly Tishkov, Joshua N. Pritikin, Matt Wilson,
James Henstridge, Detlef Reichl
Overview of Changes in GTK+ 1.3.8
=================================
* GtkTreeView and GtkTreeModel API cleanups/improvements [Jrb]
* GtkOptionMenu scrollwheel support [Alex]
* GtkModule search paths [Owen]
* Documenatation updates [Havoc,Jrb]
* Major Gdk cleanup [Owen]
* Miscellaneous other fixes/cleanups
Other Contributors:
Joshua N Pritikin, Padraig O'Briain, Jakub Steiner, Matthias Clasen,
Matt Wilson, James Henstridge
Overview of Changes in GTK+ 1.3.7
=================================
* Many Pixbuf (loader) improvements [Matthias Clasen, Soeren Sandmann]
* Added publically installed utility gdk-pixbuf-csource to generate
inlined pixbufs in C source code [Tim Janik]
* Optional movement of button children on press [Soeren, Owen Taylor]
* Interactive searching in GtkTreeView [Kristian Rietveld]
* Sorting/ordering improvements for GtkTreeView [Kris, Jonathan Blandford]
* Animation of expander motion for GtkTreeView [Anders Carlsson]
* Lots of misc GtkTreeView fixes and improvements [Jonathan]
* New/improved stock icons [Jakub Steiner]
* Code and API rework for window resizing [Havoc Pennington]
* Converted accel groups to GObject [James Henstridge]
* More property support improvements
* Add facility for "secondary" buttons in
GtkButtonBox/GtkDialog [Gregory Merchan]
* Disentangled child visability from MAPPED state [Owen]
* Plug/Socket improvements and port to the XEMBED protocol [Owen]
* Added priorities for styles in RC files,
support multiple parse contents [Owen]
* Made GdkVisual and GdkDevice GObjects [Alexander Larsson]
* Key binding improvements [Havoc]
* Added GtkWidget::event-after signal since normal event handling
is now aborted as soon as a handler returned TRUE [Tim]
* Dnd fixes and improved icon support [Owen]
* Removed GtkPacker widget
* Fixing missing paired getters/setters [Kris]
* Nuked remaining GtkArg cruft, implemented container/child properties [Tim]
* Added window grab groups [Owen]
* Many frame buffer improvements [Alex]
* Win32 fixes and improvements [Hans Breuer]
* Warning fixes [Darin Adler]
* Miscellaneous bug and API fixes [Matthias et. al]
Other Contributors:
Joshua N Pritikin, Hidetoshi Tajima, Manish Singh, ERDI Gergo, Jens Finke,
Chema Celorio, Lee Mallabone, Vitaly Tishkov, Sebastian Wilhelmi,
Nicola Girardi, Sven Neumann, Padraig O'Briain, Michael Natterer,
Suresh Chandrasekharan, Jonas Borgström, Jay Cox, Michael Meeks,
Mathias Hasselmann, Peter Williams, Thomas Broyer, Kjartan Maraas,
Joel Becker, Jeff Franks, Brian Cameron, Skip Montanaro
Overview of Changes in GTK+ 1.3.6
=================================
* Properly renders strikethrough text
* win32 fixes
* Added "scale" property to GtkTextTag and GtkCellRendererText to do
relative font scaling
* Added "format_value" signal to GtkScale to reformat value text
* framebuffer fixes
* Property support added to lots of widgets
* Many GtkTreeView new features and API/implementation fixes
* Lots of new_with_mnemonic() convenience functions
* Change GtkImageMenuItem API to be more consistent/useful
* Added lots of new stock items/icons
* Rewrote GtkRange/GtkScale/GtkScrollbar, includes support for
enabling/disabling extra scrollbar stepper arrows in gtkrc so NeXT
themes won't need broken hacks
* Convenience API for GtkRange similar to the one added to GtkSpinButton
a while back
* Make menubar/toolbar work properly with xthickness/ythickness of 1 or 0,
and move some attributes from program settings to user settings.
Allows nice 1-pixel-bevel themes.
* Moved ::focus virtual function from GtkContainer to GtkWidget
* Plenty of bug fixes
Overview of Changes in GTK+ 1.3.5
=================================
* New default theme based on Raleigh theme for 1.2.x.
* Dependency on the ATK library added as a step to
providing accessibility-enabling interfaces
* XEMBED-based GtkPlug/GtkSocket now basically works.
* Drag and drop of column headers in GtkTreeView
* GtkColorSelector work: hooks for saving and propagating palette, UI tweaks,
and API sanitation
* Key binding fixes
* Configurable padding/spacing in a lot of places
* Invisible text in GtkTextView fixed
* SHM segments now created with a mode of 0600
* Bug fixes
Overview of Changes in GTK+ 1.3.4
=================================
* Win32 fixes
* GtkTreeView improvements and fixes
* Fix glib-2.0.m4
* Miscellaneous bug fixes
Overview of Changes in GTK+ 1.3.3
=================================
[ 5600 lines of ChangeLog ]
* API cleanups
* Win32 work (Tor, Hans Breuer)
* Focus improvements (Owen)
* Frame buffer improvements (Alex)
* Work on GtkTextView (Havoc)
* Much work on GtkTreeView (Jonathan)
* Selectable labels (Havoc)
* Converted many arguments to properties (Lee Mallabone, John Margaglione)
* Add exact regions to GdkExposeEvent, propagate it. (Alex)
* Added ability to have resize grips in status bars (etc.) using
_NET_WM_MOVERESIZE protocol. (Havoc)
* Added mnemnonic mechanism to make setting underline accelerators
much easier. (Alex)
* Add per-style property mechanism to allow themes to change
geometry parameters. (Tim)
* Added global settings mechanisms for settings such as double-click
time. (Tim, Owen)
* Various support functions for new and old WM properties (Havoc, Alex)
* Add TRUE-stops-returns for boolean-returning signals (Ron Steinke)
Overview of Changes in GTK+ 1.3.2
=================================
GTK Core:
* New stock-icon and stock-item system. Use themeable pixbufs in
dialogs, buttons, etc. [Havoc]
* Theme engines reworked to use derivation and new object system. [Owen]
* Added GtkClipboard object for simple selection handling. [Owen]
* Make GtkEditable an interface, move implementation to GtkOldEditable for
compat. [Owen]
* Better handling of default directionality. [Robert]
* Use GSignal as backend for GtkSignal and other GObject stuff. [Tim]
* Move theme engines to GTypePlugin. [Owen]
GDK:
* Beginning of implementation of client parts of new window manager spec. [Owen]
* Make gdk_drawable_get_image() work with backing store. [Havoc]
Widgets:
* New text widget [Havoc]
- Adjustable tab handling.
- Ability to have scrolling side areas in new text widget for tabs/line numbers.
- Many cleanups and small improvements.
* Improvements to submenu navigation [Nils Barth/David Santiago] and
scrolling menus. [Alex]
* Simplification of progress bar API. [Havoc]
* Make GtkImage a generic image-display widget. [Havoc]
* New GtkTreeView tree widget. Model/view architecture, flexible rendering,
large datasets, etc. [Jonathan]
* New GtkMessageBox widget for message display. [Havoc]
* Allow labels to have contents set from XML-like markup language. [Havoc]
* Make dialogs derive from GtkDialog and use stock buttons. [Havoc]
Internationalization:
* Proper character set conversion for clipboard/selection. [Owen]
* New input method system via loadable modules; support on-the-spot
preedit in GtkEntry and new text widget; allow switching input methods
on the fly; include modules for XIM and demo Cyrillic-transliteration
module. [Owen]
* VIQR, Thai, and Inuktitut input methods. [Robert]
* Convert po files to UTF-8. [Robert]
gdk-pixbuf:
* Full-alpha compositing for gdk-pixbuf on drawable. [Havoc]
* Add simple saving to gdk-pixbuf. [David Welton/Havoc]
* Add improved error handling with GError to gdk-pixbuf. [Havoc]
Ports:
* Much work on Win32 Port. [Tor/Hans]
* Much work on Linux-FB Port. [Elliot/Alex]
Misc:
* Start of new gtk-demo demo program. [Owen/Jonathan]
* Bug fixes and more bug fixes.
Overview of Changes in GTK+ 1.3.1:
* GTK+ now uses the Pango library for text manipulation. All
strings in GTK+ now are in Unicode, languages written
from right-to-left, and complex-text languages are now supported.
* The gdk-pixbuf library for image loading and manipulation is
has been integrated with GTK+.
* The GTK+ object system has mostly been moved to GLib, separating
it from the GUI code. Many significant enhancements have been
made as part of this.
* A new text widget is now included. This started as a port
of the Tk text widget, and includes such features of the Tk
text widget as tags, marks, and unicode text support. It
has been enhanced to support model-view operation and the
full power of Pango.
* The GDK library has been extensively revised to support multiple
windowing systems. The only fully functional backend in 1.3.1
is the X11 backend, however, ports to Win32, Linux-framebuffer,
Nano-X, BeOS, and MacOS exist in various states of completion,
and at least some of these will be finished and integrated in
before the final GTK+-2.0 release.
* 32-bit coordinates are now supported throughout GDK and GTK+
(they are emulated where not supported by the windowing system.)
* Many minor bug fixes and enhancements. Incompatible changes
are documented in docs/Changes-2.0.txt
Overview of Changes in GTK+ 1.2.8:
* GNU Make 3.79 bug workaround
* FAQ and tutorial updates and improvements
* Miscellaneous bug fixes: CList, Calendar, rc-files, FontSelection
Overview of Changes in GTK+ 1.2.7:
* More header cleanups.
* Fixed activation bug for insensitive widgets.
* Locale fixes to RC file parsing code.
* Miscellaneous bugfixes for Item Factory, CList, CTree, X Selections,
HScale, VScale, Pixmap, Viewport, OptionMenu, Entry and Notebook.
* Upgrade to libtool 1.3.4.
Overview of Changes in GTK+ 1.2.6:
* container queue_resize fixes
* gtk[vh]scale: minor fixups
* rename idle to idle_id in testgtk to avoid conflicts with
broken libs
* More consistent naming of gtkrc files
* Added language support: ro, uk
Overview of Changes in GTK+ 1.2.5:
* more GtkCTree and GtkWindow bug fixes.
* more redraw/resize queue fixes, better expose event
discarding code.
* more miscellaneous bugs fixed
* new configure.in option --disable-rebuilds to completely disable
rebuilds of autogenerated sources.
* check for 5.002 now, to avoid failing autogeneration build rules due
to old perl versions.
* fonts (and fontsets) are cached now.
* more autogeneration make rules and dependency fixups, we should be
save with autogeneration up to make -j12 now ;)
* new window position GTK_WIN_POS_CENTER_ALWAYS, which will recenter the
GtkWindow on every size change.
* major rework of window manager hints handling code, fixed a bunch of
races with the new resizing code.
* the new wm hints and resizing code is absolutely perfect and bug free now,
it only lacks testing ;)
* fixed up various rc style memory problems.
* gtk_widget_modify_style() now properly changes the style of realized widgets
and references the style passed into it. if people worked around this bug,
this will introduce a slight memory leak in their code.
The code should typically look like:
GtkRcStyle *rc_style = gtk_rc_style_new ();
[...]
gtk_widget_modify_style (widget, rc_style);
gtk_rc_style_unref (rc_style);
* fix problems with positioning menus offscreen.
* GtkText fixes for some crashes and drawing errors.
* Better handling for unexpected window destroys in GDK and GTK+.
This should make it possible to use a GtkPlug and catch the
case where its parent socket is randomly killed.
* FAQ updates.
* FileSelection i18n patches, RadioButton fixups.
* many translation improvements.
* miscellaneous other bugs fixed.
Overview of Changes in GTK+ 1.2.4:
* DnD improvements (drags can be canceled with Esc now).
* suppressed configure event reordering in Gdk.
* rewrite of Gtk's configure event handling.
* major improvements for the object argument system (Elena Devdariani).
* major bugfixes for threading, GtkNotebook, GtkItemFactory, GtkCList and
GtkCTree.
* tutorial/FAQ updates, new file generation.txt on autogenerated sources.
* configure's --with-glib= is "officially" unsupported.
* upgrade to libtool 1.3.3.
* various buglets fixed.
Overview of Changes in GTK+ 1.2.3:
* Upgrade to libtool 1.3
* Check for dgettext (for systems with old versions of GNU Gettext)
* Many bug fixes (see ChangeLog for details)
Overview of Changes in GTK+ 1.2.2:
* Improved Dnd behaviour with Motif applications.
* Bug fixes for the Gtk selection code.
* Minor bug fixes to the Gdk Atom cache and Dnd code (with --display option).
* Bug fixes and leak plugs for the Gdk IM code.
* Added gtk_object_get() facility to retrieve object arguments easily.
The var args list expects ("arg-name", &value) pairs.
* Fixed mapping for GdkInputCondition<->GIOCondition, this should fix
problems where closed pipes were no longer signaling GDK_INPUT_READ on
systems with a native poll().
* Some cleanups to GtkLabel's memory allocation code (shouldn't leak memory
anymore).
* We don't attempt to lookup xpm color "None" anymore, this should prevent
eXodus (commercial X windows server) from popping up a color dialog every
time a transparent pixmap is created.
* Fixed bug where Gtk timeout/idle handlers would execute without the global
Gdk lock being held.
* Other minor bug fixes.
Overview of Changes in GTK+ 1.2.1:
* Many Bug fixes have been applied to the menu and accelerator code.
* GtkItemFactory can "adopt" foreign menu items now and manage their
accelerator installation. This is often required to get GtkItemFactory
like accelerator propagation between different windows with the same
menu hierarchy and for centralized parsing and saving of accelerators.
* GtkCList/GtkCTree buttons should always display correctly now.
* Miscellaneous other bug fixes.
What's New in GTK+ 1.2.0 (since 1.0.x):
* New widgets: GtkFontSelector, GtkPacker, GtkItemFactory, GtkCTree,
GtkInvisible, GtkCalendar, GtkLayout, GtkPlug, GtkSocket
* Many new features and robustness for existing widgets
* Theme support
* New DND implementation
* Internationalization of standard dialogs
* New key binding system
* Tearoff menus and menu accelerators
* Wide character support for entry and text
* Resizing code has been overhauled
* Queued redraws of partial areas
* Far better support for object arguments
* Speed optimizations
* Runtime loading of dynamic modules
* Support for GLib log domains
* Tutorial improvements
* A bug fix or two
Overview of Changes in GTK+ 1.1.16:
* Major fixes and improvements for handlebox
* A change to the way widget->requisition works. Now,
widget->requisition is always what the widget requested,
unmodified by the usize. See Changes-1.2.txt for details.
This correct various bugs with gtk_widget_set_usize().
* Fixes for XIM on X11R5 systems
* Don't allow cut-and-paste of text in password-style entries
* --enable-debug is now on by default for the development release.
(When compiling for "production", use --enable-debug=minimum)
* Handle systems where Helvetica is not present more gracefully
* Fixes for memory leaks
* CList and CTree fixes
* Bug fixes for drawing problems.
* Miscellaneous bug fixes to GtkLabel, GtkCList, GtkCTree,
GtkColorsel, Focusing, DND
* Tutorial improvements
Overview of Changes in GTK+ 1.1.15:
* Tutorial Updates
* Added --libs gthread to gtk-config
* Bug fixes
What is new in GTK+ 1.1.14:
* Additions to docs/Changes-1.2.txt
* Just warn when loading theme engine fails
* CLAMP GtkScale digits to a meaningful range
* GTK_LOCALDIR is now defined in a better fashion
* New functions (feature freeze, we know...):
gtk_menu_set_title()
gtk_toggle_button_get_active()
* Some locale fixups in gtkrc code
* Fixes to make gtk_radio_button_set_group() keep only
one radio button in the group active
* Foreign windows are now always treated as viewable; this fixes
a problem where updating didn't occur properly in GtkPlug
* DND fixes for 64 bit architectures, and for specifying operations
with modifier keys.
* Major revisions to GtkLayout: avoid having to create window
for NO_WINDOW children, adjust allocations of children as
scrolled so queued draws work, and a resize is queued instead
of allocating directly in a put() or move()
What is new in GTK+ 1.1.13:
* Dnd and selection bug fixes and memory purification.
* Widget sensitivity fixups.
* Tooltips windows are now named "gtk-tooltips" so rc file rules
can match tooltips windows. Fixed interaction of tooltips and NO_WINDOW
widgets.
* Spin buttons now update their values upon value retrieval.
* Overhaul of the resizing vs. redrawing logic to reduce redrawing needs
a lot. Gtk makes full use of the draw_area coalescing code now, which
got minorly improved as well.
* Containers map their Gdk windows after their children now to reduce
expose event generation.
* Gdk event queue fixups, this solves the double-click problems people were
recently having.
* Account for the fact that GSource's are only properly reentrant from
within dispatch(), thus we don't do Gdk event processing from within
check() or prepare() anymore.
* Rc files feature a bg_pixmap value of "<none>" now.
* Improved session management support in Gdk.
* Automatic disabling of NLS if no gettext is found should work now.
* Removed deprecated functions, docs/Changes-1.2.txt gives an overview.
* Gtk+ development now requires GNU autoconf 2.13, GNU automake 1.4
and GNU libtool 1.2d.
* More bug fixes all over the place.
What is new in GTK+ 1.1.12:
* Korean translation added
* Fixed memory leaks
* A few other bug fixes
What is new in GTK+ 1.1.11:
* Dutch, Japanese, Swedish, Polish, and Norwegian translations
* Removed deprecated _interp variants: gtk_container_foreach_interp,
gtk_idle_add_interp, gtk_timeout_add_interp, gtk_signal_connect_interp
* Lots of cast corrections
* Many fixes
What is new in GTK+ 1.1.9:
* Check for broken glibc 2.0 mb functions and avoid them
* Label and Entry display fixes
* Move main thread back to GDK, for locking when translating events
* Bug fixes
What is new in GTK+ 1.1.8:
* Added support for gettext and the localization of the standard
dialogs.
* Added line-wrapping for the label, and JUSTIFY_FILL
* Support reordering via drag and drop in CList and CTree.
* Replaced GtkDrawWindow widget with a GTK_USER_DRAW flag
* Extended gtkpaned API to support minimum sizes and proportional
resizing.
* Changed the handling of shared memory segments so as to
remove the need for GTK+ to set up signal handlers.
* Re-implemented event loop in terms of the event loop
that has been added to GLib 1.1.8
* Added 'grab_focus' signal to allow keyboard accelerators
for entries.
* Load locale specific RC files if present.
* Bug fixes.
What is new in GTK+ 1.1.7:
* Fixed memory mis-allocation in default files code
* Various event handling fixes
* Wide character support for entry and text
* Destroy widgets _after_ propagating unrealize signals through
widget hierarchy
* Only build XIM-support if available
* Tutorial and examples updates
* Added gtk_drag_source_unset()
What is new in GTK+ 1.1.6:
* The signal system now features emission hooks with special semantics,
refer to the ChangeLog for this.
* Minor? speedups and memory reductions to the emission handling of the
signal system.
* _interp() function variants are deprecated now. the corresponding *_full()
variants are provided for a long time now.
* Dnd abort timeout increased to 10 minutes.
* GtkScrolledWindow inherits from GtkBin now.
* GTK_POLICY_NEVER is implemented for scrolled windows now.
* Lots of API clean ups.
* Incremental freezing abilities.
* Integrated widgets from the GNOME tree: GtkLayout, GtkPlug and GtkSocket.
* New window functions for transient relationship, default size, and
geometry hints
* Default rc files are now read in (<sysconfdir/etc/gtkrc and ~/.gtkrc)
GTK_RC_FILES environment variable and functions are provided to configure
this behavior
* Read doc/Changes-1.2.txt to properly adapt your code.
* Bug Fixes.
What is new in GTK+ 1.1.5:
* Theme integration
* Widget style modification is now handled through GtkRcStyles
* GtkPixmaps now grey out pixmaps when insensitive
* Notebook enhancements
* Shadow configurability for menubars and handleboxes
* DND enhancements
* gtkfilesel now supports automounters better
* Implementation of expose compression
* Queued redraws of partial areas
* Scrolledwindow (+Viewport) source incompatibilities, children that are added
to a scrolled window don't get an automatic viewport anymore. a convenience
function gtk_scrolled_window_add_with_viewport() is supplied for this task
* Deprecated functions will now issue a message, informing the programmer about
the use of this function. These functions will get removed in future versions
* Non-functional functions got removed entirely
* gtk_widget_new() and gtk_object_new() will now auto-construct new objects.
A new function gtk_object_default_construct() is provided now which should
be called after every gtk_type_new() to perform the auto-construction
* Improved argument support of several widgets
* Bug Fixes
What is new in GTK+ 1.1.3:
* GtkCList/GtkCTree now have the ability to:
- hide/show individual columns
- disable/enable column resizing
- set min and max for column widths
- set expander style of the ctree
- set/get row and cell styles
- set spacing between tree expander and cell contents in ctree
- toggle auto_resize for columns
* Must enhanced DND support, removed old DND code
* Idle functions are now implemented via GHook, giving a slight speed
improvement
* An environment variable GTK_MODULES which takes a colon separated
list of module names GTK+ will now automatically load at gtk_init() startup
* GtkFontSel now has support for an extra 'base' filter
* New function gdk_window_set_root_origin to get the real geometry taking
into account window manager offsets
* New function gtk_text_set_line_wrap to toggle line wrapping
* New function gtk_widget_add_events which safely adds additional
events to a widget's event mask
* New function gdk_event_get_time to get the timestamp from a generic
event
* New widget GtkCalendar
* New widget GtkInvisible - InputOnly offscreen windows used for reliable
pointer grabs and selection handling in DND code
* New functions gtk_object_remove_no_notify[_by_id] to remove a certain
data portion without invocation of its destroy notifier
* gtk_spin_button_construct is now deprecated, use gtk_spin_button_configure
instead
* gtk_clist_set_border is now deprecated, use gtk_clist_set_shadow_type
instead
* Removed functions gtk_object_set_data_destroy[_by_id]
* Documentation additions/updates
* HTML and plain text files are now included in the distribution
* Bug fixes, typeness corrections, and general fixups
What is new in GTK+ 1.1.2:
* Gtk+ is now featuring runtime loading of dynamic modules via the
--gtk-modules= command line switch. such modules have to export a
G_MODULE_EXPORT void gtk_module_init (gint *argc, gchar ***argv);
function which will be invoked to initialize the module. since such
modules may create new widget types, they are always resident.
* The tutorial has been updated again.
* Changes to menus including tearoff menus and accelerators.
* Better support for modal dialogs.
* Removed CAN_FOCUS by default from scrollbars and button children of toolbar.
* More improvements and fixes for GtkCList and GtkCTree (i.e. row sorting).
* GtkCTree rows can be unselectable now.
* The GtkCTree API has undergone major renames (see ChangeLog entry from Lars
Hamann on Tue Aug 18 00:29:13 1998).
* A bunch of varargs functions changed to get va_lists working on systems that
implement va_lists as arrays.
* Improvements to the gdkrgb code.
* Improvements to Gdk color handling so we greatly reduce server traffic and
don't leak colors anymore.
* Improved internal widget tree iterators (the GtkContainer::foreach signal
vanished because of this).
* Option menus can have the keyboard focus now.
* More fixups to the text widget.
* GtkFileSelection should behave much more nicely in combination with AFS now.
* Support for label underlining.
* Support for GLib 1.1.3 log domains.
* Documentation improvements.
* Configuration fixes on various platforms.
* Miscellaneous fixes to XInput support.
* Build with shared library dependencies on Linux
* Fix for a major bug in the type systems memory allocation code that could
cause random crashes.
* Libtool update to version 1.2b.
* Lots of bugfixes and cleanups again ;)
What is new in GTK+ 1.1.1:
* Tutorial updates and additions.
* Key binding support for GtkListItems and GtkList.
* Extended selection mode and autoscrolling for GtkLists.
* A GtkCtree now operates on GtkCTreeNode* structures rather than GList*.
* GtkCTreeNodes can now be created from GNode trees.
* Bug fixes for GtkNotebook, GtkCList, GtkCombo and GdkWindow reparentation.
What is new in GTK+ 1.1.0:
* New widget GtkFontSelector.
* New featureful progress bar.
* New container widget GtkPacker.
* New object GtkItemFactory, GtkMenuFactory is deprecated.
* New key binding system, configurable via rcfiles, similar to styles.
* New widget GtkCTree with drag selections and keyboard movement and
and horizontal scrolling. Features also implemented for GtkCList.
* Significant speedups to widget creation and destruction through caching
colormap and visual queries to the XServer.
* Speedups for type creation and especially gtk_type_is_a() checks.
* Speedups in signal lookup, creation and emissions and connection handling.
* Minor speedups with object data allocation and destruction.
* Additions to the signal handling API (e.g. *_emitv).
* Support for rc-file reparsing.
* Resizing logic is now implemented on container widget basis, rather than
for toplevel GtkWindows only.
* Buttons support relief styles now.
* Some widgets are now allocated through memchunks to behave more memory wise.
* Newly included file gtkfeatures.h which defines compatibility macros to
test for certain API features upon program compilation.
* Child arguments support for container widgets.
* Far better support for object arguments, revamp of the underlying
mechanism for speed and reusability. Child/object arguments don't
need to be preceded by the "GtkType::" portion anymore.
* Removed GtkAcceleratorTable in favour of GtkAccelGroup, accelerator display
is now performed by a new widget GtkAccelLabel.
* Overhaul of the resizing code. Resizing behaviour can now be specified
on GtkContainer basis, so the underlying algorithm isn't only available
for GtkWindows.
* GtkTables are now fully resizable.
* The GtkType system now supports an additional base class initialization
function.
* GtkStyles and key bindings can now be looked up depending on the base
types of a widget, through a new keyword `class' in rc files.
* GtkButton derives from GtkBin (finally).
* More descriptive error messages on rc parsing.
* Runtime information is available to query enum/flag definition values.
* Upgrade to libtool-1.2
* Legions of bug fixes, memory leaks, segfaults, of-by-something errors...
including those that already went into the 1.0.x branch.
* A big bunch of features and cosmetic fixups that just got lost in
the masses of changesonfigure problem when cross-compiling

6951
NEWS.pre-3.0 Normal file

File diff suppressed because it is too large Load Diff

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
-------------------
@@ -34,8 +36,8 @@ Building and installing
In order to build GTK+ you will need:
- a C99 compatible compiler
- Python 3
- [a C99 compatible compiler](https://wiki.gnome.org/Projects/GLib/CompilerRequirements)
- [Python 3](https://www.python.org/)
- [Meson](http://mesonbuild.com)
- [Ninja](https://ninja-build.org)
@@ -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,73 @@
{
"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" : "wayland",
"buildsystem" : "autotools",
"builddir" : true,
"config-opts" : [
"--disable-documentation"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/wayland-project/wayland.git"
}
]
},
{
"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,73 @@
{
"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" : "wayland",
"buildsystem" : "autotools",
"builddir" : true,
"config-opts" : [
"--disable-documentation"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/wayland-project/wayland.git"
}
]
},
{
"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,6 +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...
gtk4-query-immodules > ${gtk_libdir}/gtk-${gtk_api_version}/${gtk_abi_version}/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
@@ -280,6 +286,10 @@
/* Define to 1 if linux/memfd.h exists */
#mesondefine HAVE_LINUX_MEMFD_H
#mesondefine HAVE_LINUX_INPUT_H
#mesondefine HAVE_DEV_EVDEV_INPUT_H
#mesondefine GTK_SYSCONFDIR
#mesondefine GTK_LOCALEDIR
@@ -289,3 +299,9 @@
#mesondefine GTK_LIBDIR
#mesondefine GTK_PRINT_BACKENDS
#mesondefine HAVE_HARFBUZZ
#mesondefine HAVE_PANGOFT
#mesondefine ISO_CODES_PREFIX

View File

@@ -457,34 +457,44 @@ 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 gboolean
demo_application_window_state_event (GtkWidget *widget,
GdkEventWindowState *event)
static void
surface_state_changed (GtkWidget *widget)
{
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
gboolean res = GDK_EVENT_PROPAGATE;
GdkWindowState changed, new_state;
GdkSurfaceState new_state;
if (GTK_WIDGET_CLASS (demo_application_window_parent_class)->window_state_event)
res = GTK_WIDGET_CLASS (demo_application_window_parent_class)->window_state_event (widget, event);
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;
}
gdk_event_get_window_state ((GdkEvent *)event, &changed, &new_state);
window->maximized = (new_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
window->fullscreen = (new_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
static void
demo_application_window_realize (GtkWidget *widget)
{
GTK_WIDGET_CLASS (demo_application_window_parent_class)->realize (widget);
return res;
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_surface (widget),
surface_state_changed, widget);
GTK_WIDGET_CLASS (demo_application_window_parent_class)->unrealize (widget);
}
static void
@@ -506,7 +516,8 @@ demo_application_window_class_init (DemoApplicationWindowClass *class)
object_class->constructed = demo_application_window_constructed;
widget_class->size_allocate = demo_application_window_size_allocate;
widget_class->window_state_event = demo_application_window_state_event;
widget_class->realize = demo_application_window_realize;
widget_class->unrealize = demo_application_window_unrealize;
widget_class->destroy = demo_application_window_destroy;
gtk_widget_class_set_template_from_resource (widget_class, "/application_demo/application.ui");

View File

@@ -7,35 +7,29 @@
<property name="icon-name">document-open</property>
<child>
<object class="GtkGrid">
<property name="visible">1</property>
<child>
<object class="GtkToolbar">
<property name="visible">1</property>
<property name="hexpand">1</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkMenuToolButton" id="menutool">
<property name="visible">1</property>
<property name="icon-name">document-open</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="icon-name">application-exit</property>
<property name="action-name">app.quit</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">1</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="icon-name">applications-other</property>
<property name="action-name">win.logo</property>
</object>
@@ -54,7 +48,6 @@
<object class="GtkBox" id="content_area">
<child>
<object class="GtkLabel" id="message">
<property name="visible">1</property>
<property name="hexpand">1</property>
</object>
</child>
@@ -64,10 +57,9 @@
<object class="GtkBox">
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="label" translatable="yes">_OK</property>
<property name="use_underline">1</property>
<property name="use-underline">1</property>
<signal name="clicked" handler="clicked_cb"/>
</object>
</child>
@@ -81,11 +73,9 @@
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="buffer">buffer</property>
@@ -100,7 +90,6 @@
<child>
<object class="GtkStatusbar" id="status">
<property name="hexpand">1</property>
<property name="visible">1</property>
</object>
<packing>
<property name="left-attach">0</property>

View File

@@ -2,21 +2,16 @@
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="resizable">0</property>
<property name="title">CSS Blend Modes</property>
<property name="default_width">400</property>
<property name="default_height">300</property>
<property name="default-width">400</property>
<property name="default-height">300</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Blend mode:</property>
<property name="xalign">0</property>
<style>
@@ -24,128 +19,108 @@
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<property name="min_content_width">150</property>
<property name="can-focus">1</property>
<property name="vexpand">1</property>
<property name="shadow-type">in</property>
<property name="min-content-width">150</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkStackSwitcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="hexpand">True</property>
<property name="hexpand">1</property>
<property name="stack">stack</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hhomogeneous">False</property>
<property name="vhomogeneous">False</property>
<property name="transition_type">crossfade</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="hhomogeneous">0</property>
<property name="vhomogeneous">0</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">False</property>
<property name="vexpand">True</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<property name="vexpand">1</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Duck</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Background</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="duck"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="gradient"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">
Blended picture</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<style>
<class name="blend0"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
@@ -157,87 +132,72 @@ Blended picture</property>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">False</property>
<property name="vexpand">True</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<property name="vexpand">1</property>
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Red</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Blue</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="red"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="blue"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">
Blended picture</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<style>
<class name="blend1"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
@@ -249,71 +209,59 @@ Blended picture</property>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="cyan"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="magenta"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<style>
<class name="yellow"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<style>
<class name="blend2"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Cyan</property>
<property name="xalign">0</property>
<style>
@@ -321,14 +269,12 @@ Blended picture</property>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Magenta</property>
<property name="xalign">0</property>
<style>
@@ -336,14 +282,12 @@ Blended picture</property>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Yellow</property>
<property name="xalign">0</property>
<style>
@@ -351,14 +295,12 @@ Blended picture</property>
</style>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Blended picture</property>
<property name="xalign">0</property>
<attributes>
@@ -366,8 +308,8 @@ Blended picture</property>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
@@ -378,14 +320,13 @@ Blended picture</property>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>

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;
}
@@ -88,11 +88,12 @@ find_toplevel_at_pointer (GdkDisplay *display)
}
static gboolean
button_release_event_cb (GtkWidget *widget,
GdkEventButton *event,
gboolean *clicked)
release_event_cb (GtkWidget *widget,
GdkEvent *event,
gboolean *clicked)
{
*clicked = TRUE;
if (gdk_event_get_event_type (event) == GDK_BUTTON_RELEASE)
*clicked = TRUE;
return TRUE;
}
@@ -127,16 +128,16 @@ 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)
{
gboolean clicked = FALSE;
g_signal_connect (popup, "button-release-event",
G_CALLBACK (button_release_event_cb), &clicked);
g_signal_connect (popup, "event",
G_CALLBACK (release_event_cb), &clicked);
/* Process events until clicked is set by button_release_event_cb.
/* Process events until clicked is set by our button release event handler.
* We pass in may_block=TRUE since we want to wait if there
* are no events currently.
*/

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);
}
@@ -207,34 +210,29 @@ paste_image (GtkMenuItem *item,
data);
}
static gboolean
button_press (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
static void
pressed_cb (GtkGesture *gesture,
int n_press,
double x,
double y,
GtkWidget *image)
{
GtkWidget *menu;
GtkWidget *item;
guint button;
gdk_event_get_button ((GdkEvent *)event, &button);
if (button != GDK_BUTTON_SECONDARY)
return FALSE;
menu = gtk_menu_new ();
item = gtk_menu_item_new_with_mnemonic (_("_Copy"));
g_signal_connect (item, "activate", G_CALLBACK (copy_image), data);
g_signal_connect (item, "activate", G_CALLBACK (copy_image), image);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = gtk_menu_item_new_with_mnemonic (_("_Paste"));
g_signal_connect (item, "activate", G_CALLBACK (paste_image), data);
g_signal_connect (item, "activate", G_CALLBACK (paste_image), image);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
return TRUE;
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
}
GtkWidget *
@@ -246,6 +244,7 @@ do_clipboard (GtkWidget *do_widget)
GtkWidget *label;
GtkWidget *entry, *button;
GtkWidget *image;
GtkGesture *gesture;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
@@ -322,8 +321,10 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (drag_data_received), image);
/* context menu on image */
g_signal_connect (image, "button-press-event",
G_CALLBACK (button_press), image);
gesture = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
/* Create the second image */
image = gtk_image_new_from_icon_name ("process-stop");
@@ -345,8 +346,10 @@ do_clipboard (GtkWidget *do_widget)
G_CALLBACK (drag_data_received), image);
/* context menu on image */
g_signal_connect (image, "button-press-event",
G_CALLBACK (button_press), image);
gesture = gtk_gesture_multi_press_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
}
if (!gtk_widget_get_visible (window))

File diff suppressed because it is too large Load Diff

View File

@@ -3,6 +3,7 @@
<gresource prefix="/ui">
<file preprocess="xml-stripblanks">main.ui</file>
<file preprocess="xml-stripblanks">appmenu.ui</file>
<file>theme.css</file>
</gresource>
<gresource prefix="/application_demo">
<file>application.c</file>
@@ -121,6 +122,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>
@@ -159,10 +161,10 @@
<file>expander.c</file>
<file>filtermodel.c</file>
<file>fishbowl.c</file>
<file>widgetbowl.c</file>
<file>flowbox.c</file>
<file>foreigndrawing.c</file>
<file>font_features.c</file>
<file>fontplane.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
<file>headerbar.c</file>
@@ -179,7 +181,11 @@
<file>modelbutton.c</file>
<file>overlay.c</file>
<file>overlay2.c</file>
<file>paint.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>
@@ -200,10 +206,10 @@
<file>textview.c</file>
<file>textscroll.c</file>
<file>theming_style_classes.c</file>
<file>toolpalette.c</file>
<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>
@@ -224,6 +230,7 @@
</gresource>
<gresource prefix="/font_features">
<file>font-features.ui</file>
<file>fontplane.c</file>
</gresource>
<gresource prefix="/spinbutton">
<file>spinbutton.ui</file>

View File

@@ -31,16 +31,14 @@
</accessibility>
</object>
<object class="GtkWindow" id="window1">
<property name="default_height">250</property>
<property name="default_width">440</property>
<property name="default-height">250</property>
<property name="default-width">440</property>
<property name="title" translatable="yes">Builder</property>
<child>
<object class="GtkBox" id="vbox1">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkMenuBar" id="menubar1">
<property name="visible">1</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-menubar">
<property name="AtkObject::accessible-name">The menubar</property>
@@ -48,35 +46,30 @@
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">1</property>
<property name="label" translatable="yes">_File</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu">
<child>
<object class="GtkMenuItem" id="new_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_New</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="open_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Open</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="save_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Save</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="save_as_item">
<property name="visible">1</property>
<property name="label" translatable="yes">Save _As</property>
<property name="use-underline">1</property>
<accelerator key="s" modifiers="primary | shift-mask" signal="activate"/>
@@ -84,12 +77,10 @@
</child>
<child>
<object class="GtkSeparatorMenuItem">
<property name="visible">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="quit_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Quit</property>
<property name="use-underline">1</property>
<property name="action-name">win.quit</property>
@@ -101,28 +92,24 @@
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">1</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu">
<child>
<object class="GtkMenuItem" id="copy_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Copy</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="cut_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Cut</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="paste_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Paste</property>
<property name="use-underline">1</property>
</object>
@@ -133,14 +120,12 @@
</child>
<child>
<object class="GtkMenuItem">
<property name="visible">1</property>
<property name="label" translatable="yes">_Help</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu">
<child>
<object class="GtkMenuItem" id="help_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_Help</property>
<property name="use-underline">1</property>
<property name="action-name">win.help</property>
@@ -148,7 +133,6 @@
</child>
<child>
<object class="GtkMenuItem" id="about_item">
<property name="visible">1</property>
<property name="label" translatable="yes">_About</property>
<property name="use-underline">1</property>
<property name="action-name">win.about</property>
@@ -162,7 +146,6 @@
</child>
<child>
<object class="GtkToolbar" id="toolbar1">
<property name="visible">1</property>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-toolbar">
<property name="AtkObject::accessible-name">The toolbar</property>
@@ -170,7 +153,6 @@
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">New</property>
<property name="tooltip-text" translatable="yes">Create a new file</property>
<property name="icon-name">document-new</property>
@@ -178,7 +160,6 @@
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Open</property>
<property name="tooltip-text" translatable="yes">Open a file</property>
<property name="icon-name">document-open</property>
@@ -186,7 +167,6 @@
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Save</property>
<property name="tooltip-text" translatable="yes">Save a file</property>
<property name="icon-name">document-save</property>
@@ -195,12 +175,10 @@
</child>
<child>
<object class="GtkSeparatorToolItem">
<property name="visible">1</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Copy</property>
<property name="tooltip-text" translatable="yes">Copy selected object into the clipboard</property>
<property name="icon-name">edit-copy</property>
@@ -208,7 +186,6 @@
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Cut</property>
<property name="tooltip-text" translatable="yes">Cut selected object into the clipboard</property>
<property name="icon-name">edit-cut</property>
@@ -216,7 +193,6 @@
</child>
<child>
<object class="GtkToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Paste</property>
<property name="tooltip-text" translatable="yes">Paste object from the clipboard</property>
<property name="icon-name">edit-paste</property>
@@ -229,12 +205,10 @@
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="shadow_type">in</property>
<property name="visible">1</property>
<property name="shadow-type">in</property>
<property name="expand">1</property>
<child>
<object class="GtkTreeView" id="treeview1">
<property name="visible">1</property>
<property name="model">liststore1</property>
<property name="tooltip-column">3</property>
<child internal-child="accessible">
@@ -287,7 +261,6 @@
</child>
<child>
<object class="GtkStatusbar" id="statusbar1">
<property name="visible">1</property>
</object>
<packing>
<property name="position">3</property>

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

@@ -4,8 +4,8 @@
* of various kinds.
*
* This demo has two drawing areas. The checkerboard area shows
* how you can just draw something; all you have to do is write
* a signal handler for expose_event, as shown here.
* how you can just draw something; all you have to do is set a function
* via gtk_drawing_area_set_draw_func(), as shown here.
*
* The "scribble" area is a bit more advanced, and shows how to handle
* events such as button presses and mouse motion. Click the mouse
@@ -86,45 +86,41 @@ 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 gboolean
scribble_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
static double start_x;
static double start_y;
static void
drag_begin (GtkGestureDrag *gesture,
double x,
double y,
GtkWidget *area)
{
double x, y;
guint button;
start_x = x;
start_y = y;
gdk_event_get_button ((GdkEvent *)event, &button);
gdk_event_get_coords ((GdkEvent *)event, &x, &y);
if (button == GDK_BUTTON_PRIMARY)
draw_brush (widget, x, y);
/* We've handled the event, stop processing */
return TRUE;
draw_brush (area, x, y);
}
static gboolean
scribble_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
static void
drag_update (GtkGestureDrag *gesture,
double x,
double y,
GtkWidget *area)
{
double x, y;
GdkModifierType state;
gdk_event_get_state ((GdkEvent *)event, &state);
gdk_event_get_coords ((GdkEvent *)event, &x, &y);
if (state & GDK_BUTTON1_MASK)
draw_brush (widget, x, y);
/* We've handled it, stop processing */
return TRUE;
draw_brush (area, start_x + x, start_y + y);
}
static void
drag_end (GtkGestureDrag *gesture,
double x,
double y,
GtkWidget *area)
{
draw_brush (area, start_x + x, start_y + y);
}
static void
checkerboard_draw (GtkDrawingArea *da,
@@ -141,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.
*/
@@ -189,6 +185,7 @@ do_drawingarea (GtkWidget *do_widget)
GtkWidget *vbox;
GtkWidget *da;
GtkWidget *label;
GtkGesture *drag;
if (!window)
{
@@ -247,11 +244,14 @@ do_drawingarea (GtkWidget *do_widget)
g_signal_connect (da, "size-allocate",
G_CALLBACK (scribble_size_allocate), NULL);
/* Event signals */
g_signal_connect (da, "motion-notify-event",
G_CALLBACK (scribble_motion_notify_event), NULL);
g_signal_connect (da, "button-press-event",
G_CALLBACK (scribble_button_press_event), NULL);
drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
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

@@ -34,31 +34,31 @@
<property name="title" translatable="yes">Filter Model</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">1</property>
<property name="margin">10</property>
<property name="row_spacing">10</property>
<property name="column_spacing">10</property>
<property name="column_homogeneous">1</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<property name="column-homogeneous">1</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">1</property>
<property name="label" translatable="yes">Original</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<accessibility>
<relation type="label-for" target="treeview1"/>
</accessibility>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="treeview1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="model">liststore1</property>
<property name="headers_clickable">0</property>
<property name="headers-clickable">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>
@@ -84,18 +84,20 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="treeview2">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="headers_clickable">0</property>
<property name="search_column">0</property>
<property name="can-focus">1</property>
<property name="headers-clickable">0</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection3"/>
</child>
@@ -133,46 +135,52 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">1</property>
<property name="label" translatable="yes">Computed Columns</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<accessibility>
<relation type="label-for" target="treeview2"/>
</accessibility>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">1</property>
<property name="label" translatable="yes">Filtered</property>
<property name="xalign">0</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<accessibility>
<relation type="label-for" target="treeview3"/>
</accessibility>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="treeview3">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="headers_clickable">0</property>
<property name="search_column">0</property>
<property name="can-focus">1</property>
<property name="headers-clickable">0</property>
<property name="search-column">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection5"/>
</child>
@@ -192,10 +200,13 @@
</child>
</object>
</child>
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>

View File

@@ -8,165 +8,268 @@
#include <gtk/gtk.h>
#include "gtkfishbowl.h"
#include "gtkgears.h"
GtkWidget *allow_changes;
const char *const css =
".blurred-button {"
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
"}"
"";
#define N_STATS 5
char **icon_names = NULL;
gsize n_icon_names = 0;
#define STATS_UPDATE_TIME G_USEC_PER_SEC
static void
init_icon_names (GtkIconTheme *theme)
{
GPtrArray *icons;
GList *l, *icon_list;
typedef struct _Stats Stats;
struct _Stats {
gint64 last_stats;
gint64 last_frame;
gint last_suggestion;
guint frame_counter_max;
if (icon_names)
return;
guint stats_index;
guint frame_counter[N_STATS];
guint item_counter[N_STATS];
icon_list = gtk_icon_theme_list_icons (theme, NULL);
icons = g_ptr_array_new ();
for (l = icon_list; l; l = l->next)
{
if (g_str_has_suffix (l->data, "symbolic"))
continue;
g_ptr_array_add (icons, g_strdup (l->data));
}
n_icon_names = icons->len;
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
icon_names = (char **) g_ptr_array_free (icons, FALSE);
/* don't free strings, we assigned them to the array */
g_list_free_full (icon_list, g_free);
}
static const char *
get_random_icon_name (GtkIconTheme *theme)
{
init_icon_names (theme);
return icon_names[g_random_int_range(0, n_icon_names)];
}
GtkWidget *
create_icon (void)
{
GtkWidget *image;
image = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
return image;
}
static GtkWidget *
create_button (void)
{
return gtk_button_new_with_label ("Button");
}
static GtkWidget *
create_blurred_button (void)
{
GtkWidget *w = gtk_button_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
return w;
}
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
}
static GtkWidget *
create_level_bar (void)
{
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
/* Force them to be a bit larger */
gtk_widget_set_size_request (w, 200, -1);
return w;
}
static GtkWidget *
create_spinner (void)
{
GtkWidget *w = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (w));
return w;
}
static GtkWidget *
create_spinbutton (void)
{
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
return w;
}
static GtkWidget *
create_label (void)
{
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
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)
{
GtkWidget *w = gtk_gears_new ();
gtk_widget_set_size_request (w, 100, 100);
return w;
}
static GtkWidget *
create_switch (void)
{
GtkWidget *w = gtk_switch_new ();
gtk_switch_set_state (GTK_SWITCH (w), TRUE);
return w;
}
static const struct {
const char *name;
GtkWidget * (*create_func) (void);
} widget_types[] = {
{ "Icon", create_icon },
{ "Button", create_button },
{ "Blurbutton", create_blurred_button },
{ "Fontbutton", create_font_button },
{ "Levelbar", create_level_bar },
{ "Label", create_label },
{ "Spinner", create_spinner },
{ "Spinbutton", create_spinbutton },
{ "Video", create_video },
{ "Gears", create_gears },
{ "Switch", create_switch },
};
static Stats *
get_stats (GtkWidget *widget)
{
static GQuark stats_quark = 0;
Stats *stats;
if (G_UNLIKELY (stats_quark == 0))
stats_quark = g_quark_from_static_string ("stats");
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
if (stats == NULL)
{
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 int selected_widget_type = -1;
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
static void
do_stats (GtkWidget *widget,
GtkWidget *info_label,
gint *suggested_change)
set_widget_type (GtkFishbowl *fishbowl,
int widget_type_index)
{
Stats *stats;
gint64 frame_time;
GtkWidget *window, *headerbar;
stats = get_stats (widget);
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
if (widget_type_index == selected_widget_type)
return;
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
{
char *new_label;
guint i, n_frames;
selected_widget_type = widget_type_index;
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);
gtk_fishbowl_set_creation_func (fishbowl,
widget_types[selected_widget_type].create_func);
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;
}
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]);
}
window = gtk_widget_get_toplevel (GTK_WIDGET (fishbowl));
headerbar = gtk_window_get_titlebar (GTK_WINDOW (window));
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
widget_types[selected_widget_type].name);
}
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;
else
stats->last_suggestion = 0;
}
void
next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index;
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
{
if (suggested_change)
*suggested_change = 0;
}
new_index = selected_widget_type + 1;
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]);
set_widget_type (fishbowl, new_index);
}
static void
stats_update (GtkWidget *widget)
void
prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
Stats *stats;
GtkFishbowl *fishbowl = user_data;
int new_index;
stats = get_stats (widget);
if (selected_widget_type - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected_widget_type - 1;
stats->item_counter[stats->stats_index] = gtk_fishbowl_get_count (GTK_FISHBOWL (widget));
set_widget_type (fishbowl, new_index);
}
static gboolean
move_fish (GtkWidget *bowl,
GdkFrameClock *frame_clock,
gpointer info_label)
{
gint suggested_change = 0;
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);
return G_SOURCE_CONTINUE;
}
GtkWidget *
do_fishbowl (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
static GtkCssProvider *provider = NULL;
if (provider == NULL)
{
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
if (!window)
{
GtkBuilder *builder;
GtkWidget *bowl, *info_label;
GtkWidget *bowl;
g_type_ensure (GTK_TYPE_FISHBOWL);
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
gtk_builder_add_callback_symbols (builder,
"next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb),
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
gtk_fishbowl_set_use_icons (GTK_FISHBOWL (bowl), TRUE);
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
set_widget_type (GTK_FISHBOWL (bowl), 0);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_realize (window);
gtk_widget_add_tick_callback (bowl, move_fish, info_label, NULL);
}
if (!gtk_widget_get_visible (window))

View File

@@ -5,34 +5,66 @@
<property name="title" translatable="yes">Fishbowl</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="">
<property name="visible">True</property>
<property name="show-title-buttons">True</property>
<property name="show-title-buttons">1</property>
<child>
<object class="GtkLabel" id="info_label">
<property name="visible">True</property>
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property>
<signal name="clicked" handler="prev_button_clicked_cb" object="bowl" swapped="no"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property>
<signal name="clicked" handler="next_button_clicked_cb" object="bowl" swapped="no"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">fps</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" bind-source="bowl" bind-property="count">0</property>
<property name="label" bind-source="bowl" bind-property="framerate"/>
</object>
<packing>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label">Icons, </property>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" bind-source="bowl" bind-property="count"/>
</object>
<packing>
<property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="changes_allow">
<property name="active">False</property>
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean"/>
<property name="icon-name">changes-allow</property>
<property name="relief">none</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
</packing>
</child>
<child>
@@ -43,7 +75,7 @@
<property name="relief">none</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
</packing>
</child>
</object>
@@ -52,6 +84,7 @@
<object class="GtkFishbowl" id="bowl">
<property name="visible">True</property>
<property name="animating">True</property>
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
</object>
</child>
</object>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

315
demos/gtk-demo/fontplane.c Normal file
View File

@@ -0,0 +1,315 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "fontplane.h"
#include "gtk.h"
enum {
PROP_0,
PROP_WEIGHT_ADJUSTMENT,
PROP_WIDTH_ADJUSTMENT
};
G_DEFINE_TYPE (GtkFontPlane, gtk_font_plane, GTK_TYPE_WIDGET)
static double
adjustment_get_normalized_value (GtkAdjustment *adj)
{
return (gtk_adjustment_get_value (adj) - gtk_adjustment_get_lower (adj)) /
(gtk_adjustment_get_upper (adj) - gtk_adjustment_get_lower (adj));
}
static void
val_to_xy (GtkFontPlane *plane,
gint *x,
gint *y)
{
gdouble u, v;
gint width, height;
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
u = adjustment_get_normalized_value (plane->width_adj);
v = adjustment_get_normalized_value (plane->weight_adj);
*x = CLAMP (width * u, 0, width - 1);
*y = CLAMP (height * (1 - v), 0, height - 1);
}
static void
plane_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkFontPlane *plane = GTK_FONT_PLANE (widget);
gint x, y;
gint width, height;
cairo_t *cr;
val_to_xy (plane, &x, &y);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height));
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_rectangle (cr, 0, 0, width, height);
cairo_paint (cr);
cairo_move_to (cr, 0, y + 0.5);
cairo_line_to (cr, width, y + 0.5);
cairo_move_to (cr, x + 0.5, 0);
cairo_line_to (cr, x + 0.5, height);
if (gtk_widget_has_visible_focus (widget))
{
cairo_set_line_width (cr, 3.0);
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6);
cairo_stroke_preserve (cr);
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr);
}
else
{
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgba (cr, 0.8, 0.8, 0.8, 0.8);
cairo_stroke (cr);
}
cairo_destroy (cr);
}
static void
set_cross_cursor (GtkWidget *widget,
gboolean enabled)
{
if (enabled)
gtk_widget_set_cursor_from_name (widget, "crosshair");
else
gtk_widget_set_cursor (widget, NULL);
}
static void
adj_changed (GtkFontPlane *plane)
{
gtk_widget_queue_draw (GTK_WIDGET (plane));
}
static void
adjustment_set_normalized_value (GtkAdjustment *adj,
double val)
{
gtk_adjustment_set_value (adj,
gtk_adjustment_get_lower (adj) +
val * (gtk_adjustment_get_upper (adj) - gtk_adjustment_get_lower (adj)));
}
static void
update_value (GtkFontPlane *plane,
gint x,
gint y)
{
GtkWidget *widget = GTK_WIDGET (plane);
gdouble u, v;
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
adjustment_set_normalized_value (plane->width_adj, u);
adjustment_set_normalized_value (plane->weight_adj, v);
gtk_widget_queue_draw (widget);
}
static void
hold_action (GtkGestureLongPress *gesture,
gdouble x,
gdouble y,
GtkFontPlane *plane)
{
gboolean handled;
g_signal_emit_by_name (plane, "popup-menu", &handled);
}
static void
plane_drag_gesture_begin (GtkGestureDrag *gesture,
gdouble start_x,
gdouble start_y,
GtkFontPlane *plane)
{
guint button;
button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
if (button == GDK_BUTTON_SECONDARY)
{
gboolean handled;
g_signal_emit_by_name (plane, "popup-menu", &handled);
}
if (button != GDK_BUTTON_PRIMARY)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
return;
}
set_cross_cursor (GTK_WIDGET (plane), TRUE);
update_value (plane, start_x, start_y);
gtk_widget_grab_focus (GTK_WIDGET (plane));
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
plane_drag_gesture_update (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y,
GtkFontPlane *plane)
{
gdouble start_x, start_y;
gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
&start_x, &start_y);
update_value (plane, start_x + offset_x, start_y + offset_y);
}
static void
plane_drag_gesture_end (GtkGestureDrag *gesture,
gdouble offset_x,
gdouble offset_y,
GtkFontPlane *plane)
{
set_cross_cursor (GTK_WIDGET (plane), FALSE);
}
static void
gtk_font_plane_init (GtkFontPlane *plane)
{
GtkGesture *gesture;
gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE);
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
gesture = gtk_gesture_drag_new ();
g_signal_connect (gesture, "drag-begin",
G_CALLBACK (plane_drag_gesture_begin), plane);
g_signal_connect (gesture, "drag-update",
G_CALLBACK (plane_drag_gesture_update), plane);
g_signal_connect (gesture, "drag-end",
G_CALLBACK (plane_drag_gesture_end), plane);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
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 (gesture),
TRUE);
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
}
static void
plane_finalize (GObject *object)
{
GtkFontPlane *plane = GTK_FONT_PLANE (object);
g_clear_object (&plane->weight_adj);
g_clear_object (&plane->width_adj);
G_OBJECT_CLASS (gtk_font_plane_parent_class)->finalize (object);
}
static void
plane_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkFontPlane *plane = GTK_FONT_PLANE (object);
GtkAdjustment *adjustment;
switch (prop_id)
{
case PROP_WEIGHT_ADJUSTMENT:
adjustment = GTK_ADJUSTMENT (g_value_get_object (value));
if (adjustment)
{
plane->weight_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (adj_changed), plane);
}
break;
case PROP_WIDTH_ADJUSTMENT:
adjustment = GTK_ADJUSTMENT (g_value_get_object (value));
if (adjustment)
{
plane->width_adj = g_object_ref_sink (adjustment);
g_signal_connect_swapped (adjustment, "value-changed", G_CALLBACK (adj_changed), plane);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_font_plane_class_init (GtkFontPlaneClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->finalize = plane_finalize;
object_class->set_property = plane_set_property;
widget_class->snapshot = plane_snapshot;
g_object_class_install_property (object_class,
PROP_WEIGHT_ADJUSTMENT,
g_param_spec_object ("weight-adjustment",
NULL,
NULL,
GTK_TYPE_ADJUSTMENT,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (object_class,
PROP_WIDTH_ADJUSTMENT,
g_param_spec_object ("width-adjustment",
NULL,
NULL,
GTK_TYPE_ADJUSTMENT,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY));
}
GtkWidget *
gtk_font_plane_new (GtkAdjustment *weight_adj,
GtkAdjustment *width_adj)
{
return g_object_new (GTK_TYPE_FONT_PLANE,
"weight-adjustment", weight_adj,
"width-adjustment", width_adj,
NULL);
}

View File

@@ -0,0 +1,64 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_FONT_PLANE_H__
#define __GTK_FONT_PLANE_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GTK_TYPE_FONT_PLANE (gtk_font_plane_get_type ())
#define GTK_FONT_PLANE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_FONT_PLANE, GtkFontPlane))
#define GTK_FONT_PLANE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FONT_PLANE, GtkFontPlaneClass))
#define GTK_IS_FONT_PLANE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_COLOR_PLANE))
#define GTK_IS_FONT_PLANE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_COLOR_PLANE))
#define GTK_FONT_PLANE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FONT_PLANE, GtkFontPlaneClass))
typedef struct _GtkFontPlane GtkFontPlane;
typedef struct _GtkFontPlaneClass GtkFontPlaneClass;
struct _GtkFontPlane
{
GtkWidget parent_instance;
GtkAdjustment *weight_adj;
GtkAdjustment *width_adj;
GtkGesture *drag_gesture;
};
struct _GtkFontPlaneClass
{
GtkWidgetClass parent_class;
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
};
GType gtk_font_plane_get_type (void) G_GNUC_CONST;
GtkWidget * gtk_font_plane_new (GtkAdjustment *width_adj,
GtkAdjustment *weight_adj);
G_END_DECLS
#endif /* __GTK_FONT_PLANE_H__ */

View File

@@ -33,7 +33,7 @@ demos = []
for demo_file in in_files:
filename = demo_file[demo_file.rfind('/')+1:]
demo_name = filename.replace(".c", "")
with open(demo_file, 'r') as f:
with open(demo_file, 'r', encoding='utf-8') as f:
title = f.readline().replace("/*", "").strip()

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

@@ -24,13 +24,18 @@ typedef struct _GtkFishbowlChild GtkFishbowlChild;
struct _GtkFishbowlPrivate
{
GtkFishCreationFunc creation_func;
GList *children;
guint count;
gint64 last_frame_time;
gint64 update_delay;
guint tick_id;
guint use_icons: 1;
double framerate;
int last_benchmark_change;
guint benchmark : 1;
};
struct _GtkFishbowlChild
@@ -45,18 +50,25 @@ struct _GtkFishbowlChild
enum {
PROP_0,
PROP_ANIMATING,
PROP_BENCHMARK,
PROP_COUNT,
PROP_FRAMERATE,
PROP_UPDATE_DELAY,
NUM_PROPERTIES
};
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_CONTAINER)
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_WIDGET)
static void
gtk_fishbowl_init (GtkFishbowl *fishbowl)
{
gtk_widget_set_has_window (GTK_WIDGET (fishbowl), FALSE);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
gtk_widget_set_has_surface (GTK_WIDGET (fishbowl), FALSE);
priv->update_delay = G_USEC_PER_SEC;
}
/**
@@ -72,15 +84,6 @@ gtk_fishbowl_new (void)
return g_object_new (GTK_TYPE_FISHBOWL, NULL);
}
void
gtk_fishbowl_set_use_icons (GtkFishbowl *fishbowl,
gboolean use_icons)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
priv->use_icons = use_icons;
}
static void
gtk_fishbowl_measure (GtkWidget *widget,
GtkOrientation orientation,
@@ -127,8 +130,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 +141,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 +152,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);
}
}
@@ -164,10 +164,9 @@ new_speed (void)
}
static void
gtk_fishbowl_add (GtkContainer *container,
GtkWidget *widget)
gtk_fishbowl_add (GtkFishbowl *fishbowl,
GtkWidget *widget)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child_info;
@@ -189,13 +188,12 @@ gtk_fishbowl_add (GtkContainer *container,
}
static void
gtk_fishbowl_remove (GtkContainer *container,
GtkWidget *widget)
gtk_fishbowl_remove (GtkFishbowl *fishbowl,
GtkWidget *widget)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GtkWidget *widget_container = GTK_WIDGET (container);
GtkWidget *widget_bowl = GTK_WIDGET (fishbowl);
GList *children;
for (children = priv->children; children; children = children->next)
@@ -212,8 +210,8 @@ gtk_fishbowl_remove (GtkContainer *container,
g_list_free (children);
g_free (child);
if (was_visible && gtk_widget_get_visible (widget_container))
gtk_widget_queue_resize (widget_container);
if (was_visible && gtk_widget_get_visible (widget_bowl))
gtk_widget_queue_resize (widget_bowl);
priv->count--;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]);
@@ -222,26 +220,6 @@ gtk_fishbowl_remove (GtkContainer *container,
}
}
static void
gtk_fishbowl_forall (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GtkFishbowlChild *child;
GList *children;
children = priv->children;
while (children)
{
child = children->data;
children = children->next;
(* callback) (child->widget, callback_data);
}
}
static void
gtk_fishbowl_dispose (GObject *object)
{
@@ -267,10 +245,18 @@ gtk_fishbowl_set_property (GObject *object,
gtk_fishbowl_set_animating (fishbowl, g_value_get_boolean (value));
break;
case PROP_BENCHMARK:
gtk_fishbowl_set_benchmark (fishbowl, g_value_get_boolean (value));
break;
case PROP_COUNT:
gtk_fishbowl_set_count (fishbowl, g_value_get_uint (value));
break;
case PROP_UPDATE_DELAY:
gtk_fishbowl_set_update_delay (fishbowl, g_value_get_int64 (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -291,10 +277,22 @@ gtk_fishbowl_get_property (GObject *object,
g_value_set_boolean (value, gtk_fishbowl_get_animating (fishbowl));
break;
case PROP_BENCHMARK:
g_value_set_boolean (value, gtk_fishbowl_get_benchmark (fishbowl));
break;
case PROP_COUNT:
g_value_set_uint (value, gtk_fishbowl_get_count (fishbowl));
break;
case PROP_FRAMERATE:
g_value_set_double (value, gtk_fishbowl_get_framerate (fishbowl));
break;
case PROP_UPDATE_DELAY:
g_value_set_int64 (value, gtk_fishbowl_get_update_delay (fishbowl));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -306,7 +304,6 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
object_class->dispose = gtk_fishbowl_dispose;
object_class->set_property = gtk_fishbowl_set_property;
@@ -315,10 +312,6 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
widget_class->measure = gtk_fishbowl_measure;
widget_class->size_allocate = gtk_fishbowl_size_allocate;
container_class->add = gtk_fishbowl_add;
container_class->remove = gtk_fishbowl_remove;
container_class->forall = gtk_fishbowl_forall;
props[PROP_ANIMATING] =
g_param_spec_boolean ("animating",
"animating",
@@ -326,13 +319,36 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
FALSE,
G_PARAM_READWRITE);
props[PROP_BENCHMARK] =
g_param_spec_boolean ("benchmark",
"Benchmark",
"Adapt the count property to hit the maximum framerate",
FALSE,
G_PARAM_READWRITE);
props[PROP_COUNT] =
g_param_spec_uint ("count",
"Count",
"Number of widgets",
0, G_MAXUINT,
0,
G_PARAM_READABLE);
G_PARAM_READWRITE);
props[PROP_FRAMERATE] =
g_param_spec_double ("framerate",
"Framerate",
"Framerate of this widget in frames per second",
0, G_MAXDOUBLE,
0,
G_PARAM_READABLE);
props[PROP_UPDATE_DELAY] =
g_param_spec_int64 ("update-delay",
"Update delay",
"Number of usecs between updates",
0, G_MAXINT64,
G_USEC_PER_SEC,
G_PARAM_READWRITE);
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
}
@@ -345,96 +361,58 @@ gtk_fishbowl_get_count (GtkFishbowl *fishbowl)
return priv->count;
}
char **icon_names = NULL;
gsize n_icon_names = 0;
static void
init_icon_names (GtkIconTheme *theme)
{
GPtrArray *icons;
GList *l, *icon_list;
if (icon_names)
return;
icon_list = gtk_icon_theme_list_icons (theme, NULL);
icons = g_ptr_array_new ();
for (l = icon_list; l; l = l->next)
{
if (g_str_has_suffix (l->data, "symbolic"))
continue;
g_ptr_array_add (icons, g_strdup (l->data));
}
n_icon_names = icons->len;
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
icon_names = (char **) g_ptr_array_free (icons, FALSE);
/* don't free strings, we assigned them to the array */
g_list_free_full (icon_list, g_free);
}
static const char *
get_random_icon_name (GtkIconTheme *theme)
{
init_icon_names (theme);
return icon_names[g_random_int_range(0, n_icon_names)];
}
static GType
get_random_widget_type ()
{
GType types[] = {
GTK_TYPE_SWITCH,
GTK_TYPE_BUTTON,
GTK_TYPE_ENTRY,
GTK_TYPE_SPIN_BUTTON,
GTK_TYPE_FONT_BUTTON,
GTK_TYPE_SCROLLBAR,
GTK_TYPE_SCALE,
GTK_TYPE_LEVEL_BAR,
GTK_TYPE_PROGRESS_BAR,
GTK_TYPE_RADIO_BUTTON,
GTK_TYPE_CHECK_BUTTON
};
return types[g_random_int_range (0, G_N_ELEMENTS (types))];
}
void
gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
guint count)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
if (priv->count == count)
return;
g_object_freeze_notify (G_OBJECT (fishbowl));
while (priv->count > count)
{
gtk_container_remove (GTK_CONTAINER (fishbowl),
((GtkFishbowlChild *) priv->children->data)->widget);
gtk_fishbowl_remove (fishbowl, gtk_widget_get_first_child (GTK_WIDGET (fishbowl)));
}
while (priv->count < count)
{
GtkWidget *new_widget;
if (priv->use_icons)
{
new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
gtk_image_set_icon_size (GTK_IMAGE (new_widget), GTK_ICON_SIZE_LARGE);
}
else
new_widget = g_object_new (get_random_widget_type (), NULL);
new_widget = priv->creation_func ();
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
gtk_fishbowl_add (fishbowl, new_widget);
}
g_object_thaw_notify (G_OBJECT (fishbowl));
}
gboolean
gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
return priv->benchmark;
}
void
gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
gboolean benchmark)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
if (priv->benchmark == benchmark)
return;
priv->benchmark = benchmark;
if (!benchmark)
priv->last_benchmark_change = 0;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_BENCHMARK]);
}
gboolean
gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
{
@@ -443,6 +421,111 @@ gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
return priv->tick_id != 0;
}
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
gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GdkFrameClock *frame_clock;
GdkFrameTimings *start, *end;
gint64 start_counter, end_counter;
gint64 n_frames, expected_frames;
gint64 start_timestamp, end_timestamp;
gint64 interval;
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
if (frame_clock == NULL)
return;
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)
{
start_timestamp = gdk_frame_timings_get_frame_time (start);
end_timestamp = gdk_frame_timings_get_frame_time (end);
}
n_frames = end_counter - start_counter;
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
if (!priv->benchmark)
return;
interval = gdk_frame_timings_get_refresh_interval (end);
if (interval == 0)
{
interval = guess_refresh_interval (frame_clock);
if (interval == 0)
return;
}
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
if (n_frames >= expected_frames)
{
if (priv->last_benchmark_change > 0)
priv->last_benchmark_change *= 2;
else
priv->last_benchmark_change = 1;
}
else if (n_frames + 1 < expected_frames)
{
if (priv->last_benchmark_change < 0)
priv->last_benchmark_change--;
else
priv->last_benchmark_change = -1;
}
else
{
priv->last_benchmark_change = 0;
}
gtk_fishbowl_set_count (fishbowl, MAX (1, (int) priv->count + priv->last_benchmark_change));
}
static gboolean
gtk_fishbowl_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
@@ -453,9 +536,11 @@ gtk_fishbowl_tick (GtkWidget *widget,
GtkFishbowlChild *child;
GList *l;
gint64 frame_time, elapsed;
gboolean do_update;
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
elapsed = frame_time - priv->last_frame_time;
do_update = frame_time / priv->update_delay != priv->last_frame_time / priv->update_delay;
priv->last_frame_time = frame_time;
/* last frame was 0, so we're just starting to animate */
@@ -494,6 +579,9 @@ gtk_fishbowl_tick (GtkWidget *widget,
gtk_widget_queue_allocate (widget);
if (do_update)
gtk_fishbowl_do_update (fishbowl);
return G_SOURCE_CONTINUE;
}
@@ -518,8 +606,57 @@ gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
priv->last_frame_time = 0;
gtk_widget_remove_tick_callback (GTK_WIDGET (fishbowl), priv->tick_id);
priv->tick_id = 0;
priv->framerate = 0;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
}
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_ANIMATING]);
}
double
gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
return priv->framerate;
}
gint64
gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
return priv->update_delay;
}
void
gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
gint64 update_delay)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
if (priv->update_delay == update_delay)
return;
priv->update_delay = update_delay;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_UPDATE_DELAY]);
}
void
gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
GtkFishCreationFunc creation_func)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
g_object_freeze_notify (G_OBJECT (fishbowl));
gtk_fishbowl_set_count (fishbowl, 0);
priv->last_benchmark_change = 0;
priv->creation_func = creation_func;
gtk_fishbowl_set_count (fishbowl, 1);
g_object_thaw_notify (G_OBJECT (fishbowl));
}

View File

@@ -32,29 +32,37 @@ G_BEGIN_DECLS
typedef struct _GtkFishbowl GtkFishbowl;
typedef struct _GtkFishbowlClass GtkFishbowlClass;
typedef GtkWidget * (* GtkFishCreationFunc) (void);
struct _GtkFishbowl
{
GtkContainer container;
GtkWidget parent;
};
struct _GtkFishbowlClass
{
GtkContainerClass parent_class;
GtkWidgetClass parent_class;
};
GType gtk_fishbowl_get_type (void) G_GNUC_CONST;
GtkWidget* gtk_fishbowl_new (void);
void gtk_fishbowl_set_use_icons (GtkFishbowl *fishbowl,
gboolean use_icons);
guint gtk_fishbowl_get_count (GtkFishbowl *fishbowl);
void gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
guint count);
gboolean gtk_fishbowl_get_animating (GtkFishbowl *fishbowl);
void gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
gboolean animating);
gboolean gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl);
void gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
gboolean animating);
double gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl);
gint64 gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl);
void gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
gint64 update_delay);
void gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
GtkFishCreationFunc creation_func);
G_END_DECLS

960
demos/gtk-demo/gtkgears.c Normal file
View File

@@ -0,0 +1,960 @@
/* The rendering code in here is taken from es2gears, which has the
* following copyright notice:
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Ported to GLES2.
* Kristian Høgsberg <krh@bitplanet.net>
* May 3, 2010
*
* Improve GLES2 port:
* * Refactor gear drawing.
* * Use correct normals for surfaces.
* * Improve shader.
* * Use perspective projection transformation.
* * Add FPS count.
* * Add comments.
* Alexandros Frantzis <alexandros.frantzis@linaro.org>
* Jul 13, 2010
*/
#include "config.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <epoxy/gl.h>
#include "gtkgears.h"
#define STRIPS_PER_TOOTH 7
#define VERTICES_PER_TOOTH 34
#define GEAR_VERTEX_STRIDE 6
#ifndef HAVE_SINCOS
static void
sincos (double x, double *_sin, double *_cos)
{
*_sin = sin (x);
*_cos = cos (x);
}
#endif
/**
* Struct describing the vertices in triangle strip
*/
struct vertex_strip {
/** The first vertex in the strip */
GLint first;
/** The number of consecutive vertices in the strip after the first */
GLint count;
};
/* Each vertex consist of GEAR_VERTEX_STRIDE GLfloat attributes */
typedef GLfloat GearVertex[GEAR_VERTEX_STRIDE];
/**
* Struct representing a gear.
*/
struct gear {
/** The array of vertices comprising the gear */
GearVertex *vertices;
/** The number of vertices comprising the gear */
int nvertices;
/** The array of triangle strips comprising the gear */
struct vertex_strip *strips;
/** The number of triangle strips comprising the gear */
int nstrips;
};
typedef struct {
/* The view rotation [x, y, z] */
GLfloat view_rot[GTK_GEARS_N_AXIS];
/* The Vertex Array Object */
GLuint vao;
/* The shader program */
GLuint program;
/* The gears */
struct gear *gear1;
struct gear *gear2;
struct gear *gear3;
/** The Vertex Buffer Object holding the vertices in the graphics card */
GLuint gear_vbo[3];
/** The location of the shader uniforms */
GLuint ModelViewProjectionMatrix_location;
GLuint NormalMatrix_location;
GLuint LightSourcePosition_location;
GLuint MaterialColor_location;
/* The current gear rotation angle */
GLfloat angle;
/* The projection matrix */
GLfloat ProjectionMatrix[16];
/* The direction of the directional light for the scene */
GLfloat LightSourcePosition[4];
gint64 first_frame_time;
guint tick;
GtkLabel *fps_label;
} GtkGearsPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GtkGears, gtk_gears, GTK_TYPE_GL_AREA)
static gboolean gtk_gears_render (GtkGLArea *area,
GdkGLContext *context);
static void gtk_gears_reshape (GtkGLArea *area,
int width,
int height);
static void gtk_gears_realize (GtkWidget *widget);
static void gtk_gears_unrealize (GtkWidget *widget);
static gboolean gtk_gears_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data);
static void destroy_gear (struct gear *g);
GtkWidget *
gtk_gears_new (void)
{
return g_object_new (gtk_gears_get_type (),
"has-depth-buffer", TRUE,
NULL);
}
static void
gtk_gears_init (GtkGears *gears)
{
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
priv->view_rot[GTK_GEARS_X_AXIS] = 20.0;
priv->view_rot[GTK_GEARS_Y_AXIS] = 30.0;
priv->view_rot[GTK_GEARS_Z_AXIS] = 20.0;
priv->LightSourcePosition[0] = 5.0;
priv->LightSourcePosition[1] = 5.0;
priv->LightSourcePosition[2] = 10.0;
priv->LightSourcePosition[3] = 1.0;
priv->tick = gtk_widget_add_tick_callback (GTK_WIDGET (gears), gtk_gears_tick, gears, NULL);
}
static void
gtk_gears_finalize (GObject *obj)
{
GtkGears *gears = GTK_GEARS (obj);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
gtk_widget_remove_tick_callback (GTK_WIDGET (gears), priv->tick);
g_clear_object (&priv->fps_label);
g_clear_pointer (&priv->gear1, destroy_gear);
g_clear_pointer (&priv->gear2, destroy_gear);
g_clear_pointer (&priv->gear3, destroy_gear);
G_OBJECT_CLASS (gtk_gears_parent_class)->finalize (obj);
}
static void
gtk_gears_class_init (GtkGearsClass *klass)
{
GTK_GL_AREA_CLASS (klass)->render = gtk_gears_render;
GTK_GL_AREA_CLASS (klass)->resize = gtk_gears_reshape;
GTK_WIDGET_CLASS (klass)->realize = gtk_gears_realize;
GTK_WIDGET_CLASS (klass)->unrealize = gtk_gears_unrealize;
G_OBJECT_CLASS (klass)->finalize = gtk_gears_finalize;
}
/*
* Fills a gear vertex.
*
* @param v the vertex to fill
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coortinate
* @param n pointer to the normal table
*
* @return the operation error code
*/
static GearVertex *
vert (GearVertex *v,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat n[3])
{
v[0][0] = x;
v[0][1] = y;
v[0][2] = z;
v[0][3] = n[0];
v[0][4] = n[1];
v[0][5] = n[2];
return v + 1;
}
static void
destroy_gear (struct gear *g)
{
g_free (g->strips);
g_free (g);
}
/**
* Create a gear wheel.
*
* @param inner_radius radius of hole at center
* @param outer_radius radius at center of teeth
* @param width width of gear
* @param teeth number of teeth
* @param tooth_depth depth of tooth
*
* @return pointer to the constructed struct gear
*/
static struct gear *
create_gear (GLfloat inner_radius,
GLfloat outer_radius,
GLfloat width,
GLint teeth,
GLfloat tooth_depth)
{
GLfloat r0, r1, r2;
GLfloat da;
GearVertex *v;
struct gear *gear;
double s[5], c[5];
GLfloat normal[3];
int cur_strip = 0;
int i;
/* Allocate memory for the gear */
gear = g_malloc (sizeof *gear);
/* Calculate the radii used in the gear */
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
/* Allocate memory for the triangle strip information */
gear->nstrips = STRIPS_PER_TOOTH * teeth;
gear->strips = g_malloc0_n (gear->nstrips, sizeof (*gear->strips));
/* Allocate memory for the vertices */
gear->vertices = g_malloc0_n (VERTICES_PER_TOOTH * teeth, sizeof(*gear->vertices));
v = gear->vertices;
for (i = 0; i < teeth; i++) {
/* A set of macros for making the creation of the gears easier */
#define GEAR_POINT(p, r, da) do { p.x = (r) * c[(da)]; p.y = (r) * s[(da)]; } while(0)
#define SET_NORMAL(x, y, z) do { \
normal[0] = (x); normal[1] = (y); normal[2] = (z); \
} while(0)
#define GEAR_VERT(v, point, sign) vert((v), p[(point)].x, p[(point)].y, (sign) * width * 0.5, normal)
#define START_STRIP do { \
gear->strips[cur_strip].first = v - gear->vertices; \
} while(0);
#define END_STRIP do { \
int _tmp = (v - gear->vertices); \
gear->strips[cur_strip].count = _tmp - gear->strips[cur_strip].first; \
cur_strip++; \
} while (0)
#define QUAD_WITH_NORMAL(p1, p2) do { \
SET_NORMAL((p[(p1)].y - p[(p2)].y), -(p[(p1)].x - p[(p2)].x), 0); \
v = GEAR_VERT(v, (p1), -1); \
v = GEAR_VERT(v, (p1), 1); \
v = GEAR_VERT(v, (p2), -1); \
v = GEAR_VERT(v, (p2), 1); \
} while(0)
struct point {
GLfloat x;
GLfloat y;
};
/* Create the 7 points (only x,y coords) used to draw a tooth */
struct point p[7];
/* Calculate needed sin/cos for varius angles */
sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
GEAR_POINT(p[0], r2, 1);
GEAR_POINT(p[1], r2, 2);
GEAR_POINT(p[2], r1, 0);
GEAR_POINT(p[3], r1, 3);
GEAR_POINT(p[4], r0, 0);
GEAR_POINT(p[5], r1, 4);
GEAR_POINT(p[6], r0, 4);
/* Front face */
START_STRIP;
SET_NORMAL(0, 0, 1.0);
v = GEAR_VERT(v, 0, +1);
v = GEAR_VERT(v, 1, +1);
v = GEAR_VERT(v, 2, +1);
v = GEAR_VERT(v, 3, +1);
v = GEAR_VERT(v, 4, +1);
v = GEAR_VERT(v, 5, +1);
v = GEAR_VERT(v, 6, +1);
END_STRIP;
/* Inner face */
START_STRIP;
QUAD_WITH_NORMAL(4, 6);
END_STRIP;
/* Back face */
START_STRIP;
SET_NORMAL(0, 0, -1.0);
v = GEAR_VERT(v, 6, -1);
v = GEAR_VERT(v, 5, -1);
v = GEAR_VERT(v, 4, -1);
v = GEAR_VERT(v, 3, -1);
v = GEAR_VERT(v, 2, -1);
v = GEAR_VERT(v, 1, -1);
v = GEAR_VERT(v, 0, -1);
END_STRIP;
/* Outer face */
START_STRIP;
QUAD_WITH_NORMAL(0, 2);
END_STRIP;
START_STRIP;
QUAD_WITH_NORMAL(1, 0);
END_STRIP;
START_STRIP;
QUAD_WITH_NORMAL(3, 1);
END_STRIP;
START_STRIP;
QUAD_WITH_NORMAL(5, 3);
END_STRIP;
}
gear->nvertices = (v - gear->vertices);
return gear;
}
/**
* Multiplies two 4x4 matrices.
*
* The result is stored in matrix m.
*
* @param m the first matrix to multiply
* @param n the second matrix to multiply
*/
static void
multiply (GLfloat *m, const GLfloat *n)
{
GLfloat tmp[16];
const GLfloat *row, *column;
div_t d;
int i, j;
for (i = 0; i < 16; i++) {
tmp[i] = 0;
d = div(i, 4);
row = n + d.quot * 4;
column = m + d.rem;
for (j = 0; j < 4; j++)
tmp[i] += row[j] * column[j * 4];
}
memcpy(m, &tmp, sizeof tmp);
}
/**
* Rotates a 4x4 matrix.
*
* @param[in,out] m the matrix to rotate
* @param angle the angle to rotate
* @param x the x component of the direction to rotate to
* @param y the y component of the direction to rotate to
* @param z the z component of the direction to rotate to
*/
static void
rotate(GLfloat *m, GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
{
double s = sin (angle);
double c = cos (angle);
GLfloat r[16] = {
x * x * (1 - c) + c, y * x * (1 - c) + z * s, x * z * (1 - c) - y * s, 0,
x * y * (1 - c) - z * s, y * y * (1 - c) + c, y * z * (1 - c) + x * s, 0,
x * z * (1 - c) + y * s, y * z * (1 - c) - x * s, z * z * (1 - c) + c, 0,
0, 0, 0, 1
};
multiply(m, r);
}
/**
* Translates a 4x4 matrix.
*
* @param[in,out] m the matrix to translate
* @param x the x component of the direction to translate to
* @param y the y component of the direction to translate to
* @param z the z component of the direction to translate to
*/
static void
translate(GLfloat *m, GLfloat x, GLfloat y, GLfloat z)
{
GLfloat t[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, x, y, z, 1 };
multiply(m, t);
}
/**
* Creates an identity 4x4 matrix.
*
* @param m the matrix make an identity matrix
*/
static void
identity(GLfloat *m)
{
GLfloat t[16] = {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
};
memcpy(m, t, sizeof(t));
}
/**
* Transposes a 4x4 matrix.
*
* @param m the matrix to transpose
*/
static void
transpose(GLfloat *m)
{
GLfloat t[16] = {
m[0], m[4], m[8], m[12],
m[1], m[5], m[9], m[13],
m[2], m[6], m[10], m[14],
m[3], m[7], m[11], m[15]};
memcpy(m, t, sizeof(t));
}
/**
* Inverts a 4x4 matrix.
*
* This function can currently handle only pure translation-rotation matrices.
* Read http://www.gamedev.net/community/forums/topic.asp?topic_id=425118
* for an explanation.
*/
static void
invert(GLfloat *m)
{
GLfloat t[16];
identity(t);
// Extract and invert the translation part 't'. The inverse of a
// translation matrix can be calculated by negating the translation
// coordinates.
t[12] = -m[12]; t[13] = -m[13]; t[14] = -m[14];
// Invert the rotation part 'r'. The inverse of a rotation matrix is
// equal to its transpose.
m[12] = m[13] = m[14] = 0;
transpose(m);
// inv(m) = inv(r) * inv(t)
multiply(m, t);
}
/**
* Calculate a perspective projection transformation.
*
* @param m the matrix to save the transformation in
* @param fovy the field of view in the y direction
* @param aspect the view aspect ratio
* @param zNear the near clipping plane
* @param zFar the far clipping plane
*/
void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar)
{
GLfloat tmp[16];
double sine, cosine, cotangent, deltaZ;
GLfloat radians = fovy / 2 * M_PI / 180;
identity(tmp);
deltaZ = zFar - zNear;
sincos(radians, &sine, &cosine);
if ((deltaZ == 0) || (sine == 0) || (aspect == 0))
return;
cotangent = cosine / sine;
tmp[0] = cotangent / aspect;
tmp[5] = cotangent;
tmp[10] = -(zFar + zNear) / deltaZ;
tmp[11] = -1;
tmp[14] = -2 * zNear * zFar / deltaZ;
tmp[15] = 0;
memcpy(m, tmp, sizeof(tmp));
}
/**
* Draws a gear.
*
* @param gear the gear to draw
* @param transform the current transformation matrix
* @param x the x position to draw the gear at
* @param y the y position to draw the gear at
* @param angle the rotation angle of the gear
* @param color the color of the gear
*/
static void
draw_gear(GtkGears *self,
struct gear *gear,
GLuint gear_vbo,
GLfloat *transform,
GLfloat x,
GLfloat y,
GLfloat angle,
const GLfloat color[4])
{
GtkGearsPrivate *priv = gtk_gears_get_instance_private (self);
GLfloat model_view[16];
GLfloat normal_matrix[16];
GLfloat model_view_projection[16];
int n;
/* Translate and rotate the gear */
memcpy(model_view, transform, sizeof (model_view));
translate(model_view, x, y, 0);
rotate(model_view, 2 * G_PI * angle / 360.0, 0, 0, 1);
/* Create and set the ModelViewProjectionMatrix */
memcpy(model_view_projection, priv->ProjectionMatrix, sizeof(model_view_projection));
multiply(model_view_projection, model_view);
glUniformMatrix4fv(priv->ModelViewProjectionMatrix_location, 1, GL_FALSE,
model_view_projection);
/*
* Create and set the NormalMatrix. It's the inverse transpose of the
* ModelView matrix.
*/
memcpy(normal_matrix, model_view, sizeof (normal_matrix));
invert(normal_matrix);
transpose(normal_matrix);
glUniformMatrix4fv(priv->NormalMatrix_location, 1, GL_FALSE, normal_matrix);
/* Set the gear color */
glUniform4fv(priv->MaterialColor_location, 1, color);
/* Set the vertex buffer object to use */
glBindBuffer(GL_ARRAY_BUFFER, gear_vbo);
/* Set up the position of the attributes in the vertex buffer object */
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), NULL);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), (GLfloat *) 0 + 3);
/* Enable the attributes */
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
/* Draw the triangle strips that comprise the gear */
for (n = 0; n < gear->nstrips; n++) {
glDrawArrays(GL_TRIANGLE_STRIP, gear->strips[n].first, gear->strips[n].count);
}
/* Disable the attributes */
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(0);
}
/* new window size or exposure */
static void
gtk_gears_reshape (GtkGLArea *area, int width, int height)
{
GtkGearsPrivate *priv = gtk_gears_get_instance_private ((GtkGears *) area);
/* Update the projection matrix */
perspective (priv->ProjectionMatrix, 60.0, width / (float)height, 1.0, 1024.0);
/* Set the viewport */
glViewport (0, 0, (GLint) width, (GLint) height);
}
static gboolean
gtk_gears_render (GtkGLArea *area,
GdkGLContext *context)
{
static const GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
static const GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
static const GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
GtkGears *self = GTK_GEARS (area);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (self);
GLfloat transform[16];
identity (transform);
glClearColor (0.0, 0.0, 0.0, 0.0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* Translate and rotate the view */
translate (transform, 0, 0, -20);
rotate (transform, 2 * G_PI * priv->view_rot[0] / 360.0, 1, 0, 0);
rotate (transform, 2 * G_PI * priv->view_rot[1] / 360.0, 0, 1, 0);
rotate (transform, 2 * G_PI * priv->view_rot[2] / 360.0, 0, 0, 1);
/* Draw the gears */
draw_gear (self, priv->gear1, priv->gear_vbo[0], transform, -3.0, -2.0, priv->angle, red);
draw_gear (self, priv->gear2, priv->gear_vbo[1], transform, 3.1, -2.0, -2 * priv->angle - 9.0, green);
draw_gear (self, priv->gear3, priv->gear_vbo[2], transform, -3.1, 4.2, -2 * priv->angle - 25.0, blue);
return TRUE;
}
static const char vertex_shader_gl[] =
"#version 150\n"
"\n"
"in vec3 position;\n"
"in vec3 normal;\n"
"\n"
"uniform mat4 ModelViewProjectionMatrix;\n"
"uniform mat4 NormalMatrix;\n"
"uniform vec4 LightSourcePosition;\n"
"uniform vec4 MaterialColor;\n"
"\n"
"smooth out vec4 Color;\n"
"\n"
"void main(void)\n"
"{\n"
" // Transform the normal to eye coordinates\n"
" vec3 N = normalize(vec3(NormalMatrix * vec4(normal, 1.0)));\n"
"\n"
" // The LightSourcePosition is actually its direction for directional light\n"
" vec3 L = normalize(LightSourcePosition.xyz);\n"
"\n"
" // Multiply the diffuse value by the vertex color (which is fixed in this case)\n"
" // to get the actual color that we will use to draw this vertex with\n"
" float diffuse = max(dot(N, L), 0.0);\n"
" Color = diffuse * MaterialColor;\n"
"\n"
" // Transform the position to clip coordinates\n"
" gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0);\n"
"}";
static const char fragment_shader_gl[] =
"#version 150\n"
"\n"
"smooth in vec4 Color;\n"
"\n"
"void main(void)\n"
"{\n"
" gl_FragColor = Color;\n"
"}";
static const char vertex_shader_gles[] =
"attribute vec3 position;\n"
"attribute vec3 normal;\n"
"\n"
"uniform mat4 ModelViewProjectionMatrix;\n"
"uniform mat4 NormalMatrix;\n"
"uniform vec4 LightSourcePosition;\n"
"uniform vec4 MaterialColor;\n"
"\n"
"varying vec4 Color;\n"
"\n"
"void main(void)\n"
"{\n"
" // Transform the normal to eye coordinates\n"
" vec3 N = normalize(vec3(NormalMatrix * vec4(normal, 1.0)));\n"
"\n"
" // The LightSourcePosition is actually its direction for directional light\n"
" vec3 L = normalize(LightSourcePosition.xyz);\n"
"\n"
" // Multiply the diffuse value by the vertex color (which is fixed in this case)\n"
" // to get the actual color that we will use to draw this vertex with\n"
" float diffuse = max(dot(N, L), 0.0);\n"
" Color = diffuse * MaterialColor;\n"
"\n"
" // Transform the position to clip coordinates\n"
" gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0);\n"
"}";
static const char fragment_shader_gles[] =
"precision mediump float;\n"
"varying vec4 Color;\n"
"\n"
"void main(void)\n"
"{\n"
" gl_FragColor = Color;\n"
"}";
static void
gtk_gears_realize (GtkWidget *widget)
{
GtkGLArea *glarea = GTK_GL_AREA (widget);
GtkGears *gears = GTK_GEARS (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
GdkGLContext *context;
GLuint vao, v, f, program;
const char *p;
char msg[512];
GTK_WIDGET_CLASS (gtk_gears_parent_class)->realize (widget);
gtk_gl_area_make_current (glarea);
if (gtk_gl_area_get_error (glarea) != NULL)
return;
context = gtk_gl_area_get_context (glarea);
glEnable (GL_CULL_FACE);
glEnable (GL_DEPTH_TEST);
/* Create the VAO */
glGenVertexArrays (1, &vao);
glBindVertexArray (vao);
priv->vao = vao;
/* Compile the vertex shader */
if (gdk_gl_context_get_use_es (context))
p = vertex_shader_gles;
else
p = vertex_shader_gl;
v = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(v, 1, &p, NULL);
glCompileShader(v);
glGetShaderInfoLog(v, sizeof msg, NULL, msg);
g_print ("vertex shader info: %s\n", msg);
/* Compile the fragment shader */
if (gdk_gl_context_get_use_es (context))
p = fragment_shader_gles;
else
p = fragment_shader_gl;
f = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(f, 1, &p, NULL);
glCompileShader(f);
glGetShaderInfoLog(f, sizeof msg, NULL, msg);
g_print ("fragment shader info: %s\n", msg);
/* Create and link the shader program */
program = glCreateProgram();
glAttachShader(program, v);
glAttachShader(program, f);
glBindAttribLocation(program, 0, "position");
glBindAttribLocation(program, 1, "normal");
glLinkProgram(program);
glGetProgramInfoLog(program, sizeof msg, NULL, msg);
g_print ("program info: %s\n", msg);
glDeleteShader (v);
glDeleteShader (f);
/* Enable the shaders */
glUseProgram(program);
priv->program = program;
/* Get the locations of the uniforms so we can access them */
priv->ModelViewProjectionMatrix_location = glGetUniformLocation(program, "ModelViewProjectionMatrix");
priv->NormalMatrix_location = glGetUniformLocation(program, "NormalMatrix");
priv->LightSourcePosition_location = glGetUniformLocation(program, "LightSourcePosition");
priv->MaterialColor_location = glGetUniformLocation(program, "MaterialColor");
/* Set the LightSourcePosition uniform which is constant throught the program */
glUniform4fv(priv->LightSourcePosition_location, 1, priv->LightSourcePosition);
/* make the gears */
priv->gear1 = create_gear(1.0, 4.0, 1.0, 20, 0.7);
/* Store the vertices in a vertex buffer object (VBO) */
glGenBuffers (1, &(priv->gear_vbo[0]));
glBindBuffer (GL_ARRAY_BUFFER, priv->gear_vbo[0]);
glBufferData (GL_ARRAY_BUFFER,
priv->gear1->nvertices * sizeof(GearVertex),
priv->gear1->vertices,
GL_STATIC_DRAW);
priv->gear2 = create_gear(0.5, 2.0, 2.0, 10, 0.7);
glGenBuffers (1, &(priv->gear_vbo[1]));
glBindBuffer (GL_ARRAY_BUFFER, priv->gear_vbo[1]);
glBufferData (GL_ARRAY_BUFFER,
priv->gear2->nvertices * sizeof(GearVertex),
priv->gear2->vertices,
GL_STATIC_DRAW);
priv->gear3 = create_gear(1.3, 2.0, 0.5, 10, 0.7);
glGenBuffers (1, &(priv->gear_vbo[2]));
glBindBuffer (GL_ARRAY_BUFFER, priv->gear_vbo[2]);
glBufferData (GL_ARRAY_BUFFER,
priv->gear3->nvertices * sizeof(GearVertex),
priv->gear3->vertices,
GL_STATIC_DRAW);
}
static void
gtk_gears_unrealize (GtkWidget *widget)
{
GtkGLArea *glarea = GTK_GL_AREA (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private ((GtkGears *) widget);
gtk_gl_area_make_current (glarea);
if (gtk_gl_area_get_error (glarea) != NULL)
return;
/* Release the resources associated with OpenGL */
if (priv->gear_vbo[0] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[0]));
if (priv->gear_vbo[1] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[1]));
if (priv->gear_vbo[2] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[2]));
if (priv->vao != 0)
glDeleteVertexArrays (1, &priv->vao);
if (priv->program != 0)
glDeleteProgram (priv->program);
priv->ModelViewProjectionMatrix_location = 0;
priv->NormalMatrix_location = 0;
priv->LightSourcePosition_location = 0;
priv->MaterialColor_location = 0;
GTK_WIDGET_CLASS (gtk_gears_parent_class)->unrealize (widget);
}
static gboolean
gtk_gears_tick (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GtkGears *gears = GTK_GEARS (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
GdkFrameTimings *timings, *previous_timings;
gint64 previous_frame_time = 0;
gint64 frame_time;
gint64 history_start, history_len;
gint64 frame;
char *s;
frame = gdk_frame_clock_get_frame_counter (frame_clock);
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
if (priv->first_frame_time == 0)
{
/* No need for changes on first frame */
priv->first_frame_time = frame_time;
if (priv->fps_label)
gtk_label_set_label (priv->fps_label, "FPS: ---");
return G_SOURCE_CONTINUE;
}
/* glxgears advances 70 degrees per second, so do the same */
priv->angle = fmod ((frame_time - priv->first_frame_time) / (double)G_USEC_PER_SEC * 70.0, 360.0);
gtk_widget_queue_draw (widget);
history_start = gdk_frame_clock_get_history_start (frame_clock);
if (priv->fps_label && frame % 60 == 0)
{
history_len = frame - history_start;
if (history_len > 0)
{
previous_timings = gdk_frame_clock_get_timings (frame_clock, frame - history_len);
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
s = g_strdup_printf ("FPS: %-4.1f", (G_USEC_PER_SEC * history_len) / (double)(frame_time - previous_frame_time));
gtk_label_set_label (priv->fps_label, s);
g_free (s);
}
}
timings = gdk_frame_clock_get_current_timings (frame_clock);
previous_timings = gdk_frame_clock_get_timings (frame_clock,
gdk_frame_timings_get_frame_counter (timings) - 1);
if (previous_timings != NULL)
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
return G_SOURCE_CONTINUE;
}
void
gtk_gears_set_axis (GtkGears *gears, int axis, double value)
{
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
if (axis < 0 || axis >= GTK_GEARS_N_AXIS)
return;
priv->view_rot[axis] = value;
gtk_widget_queue_draw (GTK_WIDGET (gears));
}
double
gtk_gears_get_axis (GtkGears *gears, int axis)
{
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
if (axis < 0 || axis >= GTK_GEARS_N_AXIS)
return 0.0;
return priv->view_rot[axis];
}
void
gtk_gears_set_fps_label (GtkGears *gears, GtkLabel *label)
{
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
if (label)
g_object_ref (label);
g_clear_object (&priv->fps_label);
priv->fps_label = label;
}

48
demos/gtk-demo/gtkgears.h Normal file
View File

@@ -0,0 +1,48 @@
#ifndef __GTK_GEARS_H__
#define __GTK_GEARS_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
enum {
GTK_GEARS_X_AXIS,
GTK_GEARS_Y_AXIS,
GTK_GEARS_Z_AXIS,
GTK_GEARS_N_AXIS
};
#define GTK_TYPE_GEARS (gtk_gears_get_type ())
#define GTK_GEARS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
GTK_TYPE_GEARS, \
GtkGears))
#define GTK_IS_GEARS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
GTK_TYPE_GEARS))
typedef struct _GtkGears GtkGears;
typedef struct _GtkGearsClass GtkGearsClass;
struct _GtkGears {
GtkGLArea parent;
};
struct _GtkGearsClass {
GtkGLAreaClass parent_class;
};
GType gtk_gears_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_gears_new (void);
void gtk_gears_set_axis (GtkGears *gears,
int axis,
double value);
double gtk_gears_get_axis (GtkGears *gears,
int axis);
void gtk_gears_set_fps_label (GtkGears *gears,
GtkLabel *label);
G_END_DECLS
#endif /* __GTK_GEARS_H__ */

View File

@@ -105,14 +105,14 @@ follow_if_link (GtkWidget *text_view,
/* Links can be activated by pressing Enter.
*/
static gboolean
key_press_event (GtkWidget *text_view,
GdkEventKey *event)
key_pressed (GtkEventController *controller,
guint keyval,
guint keycode,
GdkModifierType modifiers,
GtkWidget *text_view)
{
GtkTextIter iter;
GtkTextBuffer *buffer;
guint keyval;
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
switch (keyval)
{
@@ -128,14 +128,18 @@ key_press_event (GtkWidget *text_view,
break;
}
return FALSE;
return GDK_EVENT_PROPAGATE;
}
static void set_cursor_if_appropriate (GtkTextView *text_view,
gint x,
gint y);
/* Links can also be activated by clicking or tapping.
*/
static gboolean
event_after (GtkWidget *text_view,
GdkEvent *ev)
event_cb (GtkWidget *text_view,
GdkEvent *ev)
{
GtkTextIter start, end, iter;
GtkTextBuffer *buffer;
@@ -145,6 +149,11 @@ event_after (GtkWidget *text_view,
type = gdk_event_get_event_type (ev);
gdk_event_get_coords (ev, &ex, &ey);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
ex, ey, &x, &y);
if (type == GDK_BUTTON_RELEASE)
{
guint button;
@@ -153,14 +162,17 @@ event_after (GtkWidget *text_view,
if (button != GDK_BUTTON_PRIMARY)
return FALSE;
}
else if (type == GDK_MOTION_NOTIFY)
{
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
return FALSE;
}
else if (type == GDK_TOUCH_END)
{
}
else
return FALSE;
gdk_event_get_coords (ev, &ex, &ey);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
/* we shouldn't follow a link if the user has selected something */
@@ -168,10 +180,6 @@ event_after (GtkWidget *text_view,
if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
return FALSE;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
ex, ey, &x, &y);
if (gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y))
follow_if_link (text_view, &iter);
@@ -223,25 +231,6 @@ set_cursor_if_appropriate (GtkTextView *text_view,
g_slist_free (tags);
}
/* Update the cursor image if the pointer moved.
*/
static gboolean
motion_notify_event (GtkWidget *text_view,
GdkEventMotion *event)
{
gdouble ex, ey;
gint x, y;
gdk_event_get_coords ((GdkEvent *)event, &ex, &ey);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
ex, ey, &x, &y);
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
return FALSE;
}
GtkWidget *
do_hypertext (GtkWidget *do_widget)
{
@@ -252,6 +241,7 @@ do_hypertext (GtkWidget *do_widget)
GtkWidget *view;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkEventController *controller;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
@@ -266,12 +256,11 @@ do_hypertext (GtkWidget *do_widget)
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
g_signal_connect (view, "key-press-event",
G_CALLBACK (key_press_event), NULL);
g_signal_connect (view, "event-after",
G_CALLBACK (event_after), NULL);
g_signal_connect (view, "motion-notify-event",
G_CALLBACK (motion_notify_event), NULL);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
gtk_widget_add_controller (view, controller);
g_signal_connect (view, "event",
G_CALLBACK (event_cb), NULL);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

View File

@@ -261,9 +261,7 @@ start_progressive_loading (GtkWidget *image)
* The timeout simply simulates a slow data source by inserting
* pauses in the reading process.
*/
load_timeout = gdk_threads_add_timeout (150,
progressive_timeout,
image);
load_timeout = g_timeout_add (150, progressive_timeout, image);
g_source_set_name_by_id (load_timeout, "[gtk+] progressive_timeout");
}
@@ -319,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)
{
@@ -338,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),
@@ -397,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),
@@ -417,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

@@ -0,0 +1,239 @@
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <string.h>
#include <errno.h>
#include <locale.h>
#include <sys/stat.h>
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <hb-ot.h>
#include "language-names.h"
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
static GHashTable *language_map;
static char *
get_first_item_in_semicolon_list (const char *list)
{
char **items;
char *item;
items = g_strsplit (list, "; ", 2);
item = g_strdup (items[0]);
g_strfreev (items);
return item;
}
static char *
capitalize_utf8_string (const char *str)
{
char first[8] = { 0 };
if (!str)
return NULL;
g_unichar_to_utf8 (g_unichar_totitle (g_utf8_get_char (str)), first);
return g_strconcat (first, g_utf8_offset_to_pointer (str, 1), NULL);
}
static char *
get_display_name (const char *language)
{
const char *translated;
char *tmp;
char *name;
translated = dgettext ("iso_639", language);
tmp = get_first_item_in_semicolon_list (translated);
name = capitalize_utf8_string (tmp);
g_free (tmp);
return name;
}
static void
languages_parse_start_tag (GMarkupParseContext *ctx,
const char *element_name,
const char **attr_names,
const char **attr_values,
gpointer user_data,
GError **error)
{
const char *ccode_longB;
const char *ccode_longT;
const char *ccode;
const char *ccode_id;
const char *lang_name;
char *display_name;
if (!(g_str_equal (element_name, "iso_639_entry") ||
g_str_equal (element_name, "iso_639_3_entry")) ||
attr_names == NULL ||
attr_values == NULL)
return;
ccode = NULL;
ccode_longB = NULL;
ccode_longT = NULL;
ccode_id = NULL;
lang_name = NULL;
while (*attr_names && *attr_values)
{
if (g_str_equal (*attr_names, "iso_639_1_code"))
{
if (**attr_values)
{
if (strlen (*attr_values) != 2)
return;
ccode = *attr_values;
}
}
else if (g_str_equal (*attr_names, "iso_639_2B_code"))
{
if (**attr_values)
{
if (strlen (*attr_values) != 3)
return;
ccode_longB = *attr_values;
}
}
else if (g_str_equal (*attr_names, "iso_639_2T_code"))
{
if (**attr_values)
{
if (strlen (*attr_values) != 3)
return;
ccode_longT = *attr_values;
}
}
else if (g_str_equal (*attr_names, "id"))
{
if (**attr_values)
{
if (strlen (*attr_values) != 2 &&
strlen (*attr_values) != 3)
return;
ccode_id = *attr_values;
}
}
else if (g_str_equal (*attr_names, "name"))
{
lang_name = *attr_values;
}
++attr_names;
++attr_values;
}
if (lang_name == NULL)
return;
display_name = get_display_name (lang_name);
if (ccode != NULL)
g_hash_table_insert (language_map,
pango_language_from_string (ccode),
g_strdup (display_name));
if (ccode_longB != NULL)
g_hash_table_insert (language_map,
pango_language_from_string (ccode_longB),
g_strdup (display_name));
if (ccode_longT != NULL)
g_hash_table_insert (language_map,
pango_language_from_string (ccode_longT),
g_strdup (display_name));
if (ccode_id != NULL)
g_hash_table_insert (language_map,
pango_language_from_string (ccode_id),
g_strdup (display_name));
g_free (display_name);
}
static void
languages_variant_init (const char *variant)
{
gboolean res;
gsize buf_len;
char *buf = NULL;
char *filename = NULL;
GError *error = NULL;
bindtextdomain (variant, ISO_CODES_LOCALESDIR);
bind_textdomain_codeset (variant, "UTF-8");
error = NULL;
filename = g_strconcat (ISO_CODES_DATADIR, "/", variant, ".xml", NULL);
res = g_file_get_contents (filename, &buf, &buf_len, &error);
if (res)
{
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
languages_init (void)
{
if (language_map)
return;
language_map = g_hash_table_new_full (NULL, NULL, NULL, g_free);
languages_variant_init ("iso_639");
languages_variant_init ("iso_639_3");
}
const char *
get_language_name (PangoLanguage *language)
{
languages_init ();
return (const char *) g_hash_table_lookup (language_map, language);
}
const char *
get_language_name_for_tag (guint32 tag)
{
hb_language_t lang;
const char *s;
lang = hb_ot_tag_to_language (tag);
s = hb_language_to_string (lang);
return get_language_name (pango_language_from_string (s));
}

View File

@@ -0,0 +1,13 @@
#ifndef LANGUAGE_NAMES_H
#define LANGUAGE_NAMES_H
#include <pango/pango.h>
G_BEGIN_DECLS
const char * get_language_name (PangoLanguage *language);
const char * get_language_name_for_tag (guint32 tag);
G_END_DECLS
#endif

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" },
@@ -296,8 +296,7 @@ do_list_store (GtkWidget *do_widget)
/* finish & show */
gtk_window_set_default_size (GTK_WINDOW (window), 280, 250);
g_signal_connect (window, "delete-event",
G_CALLBACK (window_closed), NULL);
g_signal_connect (window, "destroy", G_CALLBACK (window_closed), NULL);
}
if (!gtk_widget_get_visible (window))

View File

@@ -3,61 +3,53 @@
<!-- interface-requires gtk+ 3.10 -->
<!-- interface-requires gtkdemo 3.10 -->
<object class="GtkMenu" id="menu1">
<property name="visible">1</property>
<child>
<object class="GtkMenuItem" id="menuitem1">
<property name="visible">1</property>
<property name="label" translatable="yes">Email message</property>
<property name="use_underline">1</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem2">
<property name="visible">1</property>
<property name="label" translatable="yes">Embed message</property>
<property name="use_underline">1</property>
<property name="use-underline">1</property>
</object>
</child>
</object>
<template class="GtkMessageRow" parent="GtkListBoxRow">
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">1</property>
<property name="hexpand">1</property>
<child>
<object class="GtkImage" id="avatar_image">
<property name="width_request">32</property>
<property name="height_request">32</property>
<property name="visible">1</property>
<property name="width-request">32</property>
<property name="height-request">32</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="margin_top">8</property>
<property name="margin_bottom">8</property>
<property name="margin_start">8</property>
<property name="margin_end">8</property>
<property name="margin-top">8</property>
<property name="margin-bottom">8</property>
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="icon-name">image-missing</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="height">5</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="baseline_position">top</property>
<property name="baseline-position">top</property>
<child>
<object class="GtkButton" id="button2">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="valign">baseline</property>
<property name="relief">none</property>
<child>
<object class="GtkLabel" id="source_name">
<property name="visible">1</property>
<property name="valign">baseline</property>
<property name="label" translatable="0">Username</property>
<attributes>
@@ -69,7 +61,6 @@
</child>
<child>
<object class="GtkLabel" id="source_nick">
<property name="visible">1</property>
<property name="valign">baseline</property>
<property name="label" translatable="0">@nick</property>
<style>
@@ -82,7 +73,6 @@
</child>
<child>
<object class="GtkLabel" id="short_time_label">
<property name="visible">1</property>
<property name="valign">baseline</property>
<property name="label" translatable="yes">38m</property>
<style>
@@ -90,42 +80,42 @@
</style>
</object>
<packing>
<property name="pack_type">end</property>
<property name="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="content_label">
<property name="visible">1</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="xalign">0</property>
<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>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="resent_box">
<child>
<object class="GtkImage" id="image2">
<property name="visible">1</property>
<property name="icon_name">media-playlist-repeat</property>
<property name="icon-name">media-playlist-repeat</property>
</object>
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">1</property>
<property name="label" translatable="yes">Resent by</property>
</object>
<packing>
@@ -135,9 +125,8 @@
<child>
<object class="GtkLinkButton" id="resent_by_button">
<property name="label" translatable="0">reshareer</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="uri">http://www.gtk.org</property>
</object>
@@ -147,20 +136,18 @@
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
<property name="visible">1</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="expand_button">
<property name="label" translatable="yes">Expand</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<signal name="clicked" handler="expand_clicked" swapped="yes"/>
</object>
@@ -171,18 +158,16 @@
<child>
<object class="GtkButton" id="reply-button">
<property name="label" translatable="yes">Reply</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
</object>
</child>
<child>
<object class="GtkButton" id="reshare-button">
<property name="label" translatable="yes">Reshare</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<signal name="clicked" handler="reshare_clicked" swapped="yes"/>
</object>
@@ -193,9 +178,8 @@
<child>
<object class="GtkButton" id="favorite-buttton">
<property name="label" translatable="yes">Favorite</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<signal name="clicked" handler="favorite_clicked" swapped="yes"/>
</object>
@@ -205,14 +189,12 @@
</child>
<child>
<object class="GtkMenuButton" id="more-button">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<property name="popup">menu1</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">1</property>
<property name="label" translatable="yes">More...</property>
</object>
</child>
@@ -228,53 +210,44 @@
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="details_revealer">
<property name="visible">1</property>
<child>
<object class="GtkBox" id="box5">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box7">
<property name="visible">1</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<property name="margin-top">2</property>
<property name="margin-bottom">2</property>
<property name="spacing">8</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">1</property>
<property name="shadow_type">none</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="n_reshares_label">
<property name="visible">1</property>
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
Reshares</property>
<property name="use_markup">1</property>
<property name="use-markup">1</property>
</object>
</child>
<child type="label_item">
</child>
<child type="label_item"/>
</object>
</child>
<child>
<object class="GtkFrame" id="frame2">
<property name="visible">1</property>
<property name="shadow_type">none</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="n_favorites_label">
<property name="visible">1</property>
<property name="label" translatable="0">&lt;b&gt;2&lt;/b&gt;
FAVORITES</property>
<property name="use_markup">1</property>
<property name="use-markup">1</property>
</object>
</child>
<child type="label_item">
</child>
<child type="label_item"/>
</object>
<packing>
<property name="position">1</property>
@@ -287,10 +260,8 @@ FAVORITES</property>
</child>
<child>
<object class="GtkBox" id="box6">
<property name="visible">1</property>
<child>
<object class="GtkLabel" id="detailed_time_label">
<property name="visible">1</property>
<property name="label" translatable="0">4:25 AM - 14 Jun 13 </property>
<style>
<class name="dim-label"/>
@@ -300,9 +271,8 @@ FAVORITES</property>
<child>
<object class="GtkButton" id="button5">
<property name="label" translatable="yes">Details</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="relief">none</property>
<style>
<class name="dim-label"/>
@@ -321,8 +291,8 @@ FAVORITES</property>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
</object>

View File

@@ -250,7 +250,7 @@ static gchar *types[] =
"GtkTreeSelection ",
"GdkDisplay ",
"GdkScreen ",
"GdkWindow ",
"GdkSurface ",
"GdkEventButton ",
"GdkCursor ",
"GtkTreeIter ",
@@ -532,7 +532,106 @@ fontify (GtkTextBuffer *source_buffer)
}
}
static GtkWidget *create_text (GtkWidget **text_view, gboolean is_source);
static GtkWidget *
display_image (const char *resource)
{
GtkWidget *sw, *image;
image = gtk_image_new_from_resource (resource);
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), image);
return sw;
}
static GtkWidget *
display_text (const char *resource)
{
GtkTextBuffer *buffer;
GtkWidget *textview, *sw;
GBytes *bytes;
bytes = g_resources_lookup_data (resource, 0, NULL);
g_assert (bytes);
g_assert (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL));
textview = gtk_text_view_new ();
g_object_set (textview,
"left-margin", 20,
"right-margin", 20,
"top-margin", 20,
"bottom-margin", 20,
NULL);
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
/* Make it a bit nicer for text. */
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (textview), 2);
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (textview), 2);
buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
if (g_str_has_suffix (resource, ".c"))
fontify (buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
g_bytes_unref (bytes);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (sw), textview);
return sw;
}
static GtkWidget *
display_video (const char *resource)
{
GtkWidget *video;
video = gtk_video_new_for_resource (resource);
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
return video;
}
static GtkWidget *
display_nothing (const char *resource)
{
GtkWidget *widget;
char *str;
str = g_strdup_printf ("The lazy GTK developers forgot to add a way to display the resource '%s'", resource);
widget = gtk_label_new (str);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
g_free (str);
return widget;
}
static struct {
const char *extension;
GtkWidget * (* display_func) (const char *resource);
} display_funcs[] = {
{ ".gif", display_image },
{ ".jpg", display_image },
{ ".png", display_image },
{ ".c", display_text },
{ ".css", display_text },
{ ".glsl", display_text },
{ ".h", display_text },
{ ".txt", display_text },
{ ".ui", display_text },
{ ".webm", display_video }
};
static void
add_data_tab (const gchar *demoname)
@@ -540,7 +639,7 @@ add_data_tab (const gchar *demoname)
gchar *resource_dir, *resource_name;
gchar **resources;
GtkWidget *widget, *label;
guint i;
guint i, j;
resource_dir = g_strconcat ("/", demoname, NULL);
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
@@ -554,58 +653,22 @@ 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)
for (j = 0; j < G_N_ELEMENTS(display_funcs); j++)
{
GBytes *bytes;
/* So we've used the best API available to figure out it's
* not an image. Let's try something else then.
*/
g_object_ref_sink (widget);
g_object_unref (widget);
bytes = g_resources_lookup_data (resource_name, 0, NULL);
g_assert (bytes);
if (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
{
/* Looks like it parses as text. Dump it into a textview then! */
GtkTextBuffer *buffer;
GtkWidget *textview;
widget = create_text (&textview, FALSE);
buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
if (g_str_has_suffix (resource_name, ".c"))
fontify (buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
}
else
{
g_warning ("Don't know how to display resource '%s'", resource_name);
widget = NULL;
}
g_bytes_unref (bytes);
if (g_str_has_suffix (resource_name, display_funcs[j].extension))
break;
}
if (GTK_IS_IMAGE (widget))
{
GtkWidget *sw;
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (sw), widget);
widget = sw;
}
if (j < G_N_ELEMENTS(display_funcs))
widget = display_funcs[j].display_func (resource_name);
else
widget = display_nothing (resource_name);
label = gtk_label_new (resources[i]);
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
gtk_container_child_set (GTK_CONTAINER (notebook),
GTK_WIDGET (widget),
widget,
"tab-expand", TRUE,
NULL);
@@ -825,49 +888,6 @@ selection_cb (GtkTreeSelection *selection,
g_free (filename);
}
static GtkWidget *
create_text (GtkWidget **view,
gboolean is_source)
{
GtkWidget *scrolled_window;
GtkWidget *text_view;
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_NONE);
*view = text_view = gtk_text_view_new ();
g_object_set (text_view,
"left-margin", 20,
"right-margin", 20,
"top-margin", 20,
"bottom-margin", 20,
NULL);
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
if (is_source)
{
gtk_text_view_set_monospace (GTK_TEXT_VIEW (text_view), TRUE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
}
else
{
/* Make it a bit nicer for text. */
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2);
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2);
}
return scrolled_window;
}
static void
populate_model (GtkTreeModel *model)
{
@@ -977,6 +997,41 @@ scrollbar_popup (GtkWidget *scrollbar, GtkWidget *menu)
return TRUE;
}
static void
settings__notify_gtk_theme_name (GObject *gobject,
GParamSpec *pspec,
gpointer data)
{
static GtkCssProvider *css_provider;
GtkWidget *window = data;
char *theme_name;
g_object_get (gobject, "gtk-theme-name", &theme_name, NULL);
if (g_strcmp0 (theme_name, "Adwaita") == 0)
{
if (css_provider == NULL)
{
css_provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (css_provider, "/ui/theme.css");
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
GTK_STYLE_PROVIDER (css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
}
else
{
if (css_provider != NULL)
{
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window),
GTK_STYLE_PROVIDER (css_provider));
g_clear_object (&css_provider);
}
}
g_free (theme_name);
}
static void
activate (GApplication *app)
{
@@ -1009,6 +1064,20 @@ activate (GApplication *app)
win_entries, G_N_ELEMENTS (win_entries),
window);
g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
G_CALLBACK (settings__notify_gtk_theme_name),
window);
if (gtk_get_minor_version () % 2 != 0)
{
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (window));
gtk_style_context_add_class (context, "devel");
}
settings__notify_gtk_theme_name (G_OBJECT (gtk_widget_get_settings (GTK_WIDGET (window))),
NULL,
window);
notebook = (GtkWidget *)gtk_builder_get_object (builder, "notebook");
info_view = (GtkWidget *)gtk_builder_get_object (builder, "info-textview");

View File

@@ -19,24 +19,20 @@
<property name="default-width">800</property>
<property name="default-height">600</property>
<property name="title">GTK+ Demo</property>
<signal name="delete-event" handler="gtk_false" swapped="no"/>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
<property name="visible">1</property>
<property name="show-title-buttons">1</property>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="can_focus">1</property>
<property name="action_name">win.run</property>
<property name="can-focus">1</property>
<property name="action-name">win.run</property>
<style>
<class name="text-button"/>
</style>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">Run</property>
</object>
</child>
@@ -46,23 +42,19 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<child>
<object class="GtkFrame">
<property name="visible">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="width_request">120</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="hscrollbar_policy">never</property>
<property name="min_content_width">150</property>
<property name="width-request">120</property>
<property name="can-focus">1</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<child>
<object class="GtkTreeView" id="treeview">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="model">treestore</property>
<property name="headers_visible">0</property>
<property name="headers-visible">0</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection">
<property name="mode">browse</property>
@@ -92,77 +84,70 @@
</child>
<child>
<object class="GtkNotebook" id="notebook">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="scrollable">1</property>
<property name="enable_popup">1</property>
<property name="show_border">0</property>
<property name="enable-popup">1</property>
<property name="show-border">0</property>
<property name="expand">1</property>
<child>
<object class="GtkScrolledWindow">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<child>
<object class="GtkTextView" id="info-textview">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="left-margin">20</property>
<property name="right-margin">20</property>
<property name="top-margin">20</property>
<property name="bottom-margin">20</property>
<property name="pixels_above_lines">2</property>
<property name="pixels_below_lines">2</property>
<property name="pixels-above-lines">2</property>
<property name="pixels-below-lines">2</property>
<property name="editable">0</property>
<property name="wrap_mode">word</property>
<property name="cursor_visible">0</property>
<property name="wrap-mode">word</property>
<property name="cursor-visible">0</property>
</object>
</child>
</object>
<packing>
<property name="tab_expand">1</property>
<property name="tab-expand">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">_Info</property>
<property name="use_underline">1</property>
<property name="use-underline">1</property>
</object>
<packing>
<property name="tab_expand">1</property>
<property name="tab_fill">0</property>
<property name="tab-expand">1</property>
<property name="tab-fill">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="source-scrolledwindow">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<child>
<object class="GtkTextView" id="source-textview">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="left-margin">20</property>
<property name="right-margin">20</property>
<property name="top-margin">20</property>
<property name="bottom-margin">20</property>
<property name="editable">0</property>
<property name="cursor_visible">0</property>
<property name="cursor-visible">0</property>
</object>
</child>
</object>
<packing>
<property name="position">1</property>
<property name="tab_expand">1</property>
<property name="tab-expand">1</property>
</packing>
</child>
<child type="tab">
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label" translatable="yes">Source</property>
</object>
<packing>
<property name="position">1</property>
<property name="tab_fill">0</property>
<property name="tab-fill">0</property>
</packing>
</child>
</object>

View File

@@ -26,7 +26,6 @@ demos = files([
'expander.c',
'filtermodel.c',
'fishbowl.c',
'widgetbowl.c',
'foreigndrawing.c',
'gestures.c',
'glarea.c',
@@ -45,6 +44,10 @@ demos = files([
'modelbutton.c',
'overlay.c',
'overlay2.c',
'paint.c',
'paintable.c',
'paintable_animated.c',
'paintable_mediastream.c',
'panes.c',
'pickers.c',
'pixbufs.c',
@@ -66,15 +69,18 @@ demos = files([
'textview.c',
'textscroll.c',
'theming_style_classes.c',
'toolpalette.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
@@ -94,11 +100,12 @@ gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
source_dir: '.')
executable('gtk4-demo',
'main.c', 'gtkfishbowl.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',
@@ -107,6 +114,7 @@ executable('gtk4-demo-application',
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
@@ -126,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

@@ -4,23 +4,19 @@
<object class="GtkWindow" id="window1">
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">1</property>
<property name="show-title-buttons">1</property>
<property name="title" translatable="yes">Model Button</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="margin">80</property>
<child>
<object class="GtkMenuButton">
<property name="visible">1</property>
<property name="popover">thing_a</property>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">Color</property>
<property name="hexpand">1</property>
</object>
@@ -29,11 +25,9 @@
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">1</property>
<property name="popover">thing_b</property>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">Flavors</property>
<property name="hexpand">1</property>
</object>
@@ -42,11 +36,9 @@
</child>
<child>
<object class="GtkMenuButton">
<property name="visible">1</property>
<property name="popover">thing_c</property>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">Tools</property>
<property name="hexpand">1</property>
</object>
@@ -59,12 +51,10 @@
<object class="GtkPopover" id="thing_a">
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="margin">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="action-name">win.color</property>
<property name="action-target">'red'</property>
<property name="text">Red</property>
@@ -73,7 +63,6 @@
</child>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="action-name">win.color</property>
<property name="action-target">'green'</property>
<property name="text">Green</property>
@@ -82,7 +71,6 @@
</child>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="action-name">win.color</property>
<property name="action-target">'blue'</property>
<property name="text">Blue</property>
@@ -95,32 +83,27 @@
<object class="GtkPopover" id="thing_b">
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="margin">10</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="action-name">win.chocolate</property>
<property name="text">Chocolate</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="action-name">win.vanilla</property>
<property name="text">Vanilla</property>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">1</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="action-name">win.sprinkles</property>
<property name="text">Add Sprinkles</property>
</object>
@@ -131,13 +114,11 @@
<object class="GtkPopover" id="thing_c">
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="margin">10</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="text">Hammer</property>
<property name="role">check</property>
<signal name="clicked" handler="tool_clicked"/>
@@ -145,7 +126,6 @@
</child>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="text">Screwdriver</property>
<property name="role">check</property>
<signal name="clicked" handler="tool_clicked"/>
@@ -153,7 +133,6 @@
</child>
<child>
<object class="GtkModelButton">
<property name="visible">1</property>
<property name="text">Drill</property>
<property name="role">check</property>
<signal name="clicked" handler="tool_clicked"/>

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>

283
demos/gtk-demo/paint.c Normal file
View File

@@ -0,0 +1,283 @@
/* Paint
*
* Demonstrates practical handling of drawing tablets in a real world
* usecase.
*/
#include <gtk/gtk.h>
typedef struct
{
GtkWidget parent_instance;
cairo_surface_t *surface;
cairo_t *cr;
GdkRGBA draw_color;
} DrawingArea;
typedef struct
{
GtkWidgetClass parent_class;
} DrawingAreaClass;
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
static void
drawing_area_ensure_surface (DrawingArea *area,
gint width,
gint height)
{
if (!area->surface ||
cairo_image_surface_get_width (area->surface) != width ||
cairo_image_surface_get_height (area->surface) != height)
{
cairo_surface_t *surface;
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
width, height);
if (area->surface)
{
cairo_t *cr;
cr = cairo_create (surface);
cairo_set_source_surface (cr, area->surface, 0, 0);
cairo_paint (cr);
cairo_surface_destroy (area->surface);
cairo_destroy (area->cr);
cairo_destroy (cr);
}
area->surface = surface;
area->cr = cairo_create (surface);
}
}
static void
drawing_area_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline)
{
DrawingArea *area = (DrawingArea *) widget;
drawing_area_ensure_surface (area, allocation->width, allocation->height);
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation, baseline);
}
static void
drawing_area_map (GtkWidget *widget)
{
GtkAllocation allocation;
GTK_WIDGET_CLASS (drawing_area_parent_class)->map (widget);
gtk_widget_get_allocation (widget, &allocation);
drawing_area_ensure_surface ((DrawingArea *) widget,
allocation.width, allocation.height);
}
static void
drawing_area_unmap (GtkWidget *widget)
{
DrawingArea *area = (DrawingArea *) widget;
g_clear_pointer (&area->cr, cairo_destroy);
g_clear_pointer (&area->surface, cairo_surface_destroy);
GTK_WIDGET_CLASS (drawing_area_parent_class)->unmap (widget);
}
static void
drawing_area_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
DrawingArea *area = (DrawingArea *) widget;
GtkAllocation allocation;
cairo_t *cr;
gtk_widget_get_allocation (widget, &allocation);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (
0, 0,
allocation.width,
allocation.height
));
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_source_surface (cr, area->surface, 0, 0);
cairo_paint (cr);
cairo_set_source_rgb (cr, 0.6, 0.6, 0.6);
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
cairo_stroke (cr);
cairo_destroy (cr);
}
static void
drawing_area_class_init (DrawingAreaClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
widget_class->size_allocate = drawing_area_size_allocate;
widget_class->snapshot = drawing_area_snapshot;
widget_class->map = drawing_area_map;
widget_class->unmap = drawing_area_unmap;
}
static void
drawing_area_apply_stroke (DrawingArea *area,
GdkDeviceTool *tool,
gdouble x,
gdouble y,
gdouble pressure)
{
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
{
cairo_set_line_width (area->cr, 10 * pressure);
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
}
else
{
cairo_set_line_width (area->cr, 4 * pressure);
cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE);
}
cairo_set_source_rgba (area->cr, area->draw_color.red,
area->draw_color.green, area->draw_color.blue,
area->draw_color.alpha * pressure);
//cairo_set_source_rgba (area->cr, 0, 0, 0, pressure);
cairo_line_to (area->cr, x, y);
cairo_stroke (area->cr);
cairo_move_to (area->cr, x, y);
}
static void
stylus_gesture_down (GtkGestureStylus *gesture,
gdouble x,
gdouble y,
DrawingArea *area)
{
cairo_new_path (area->cr);
}
static void
stylus_gesture_motion (GtkGestureStylus *gesture,
gdouble x,
gdouble y,
DrawingArea *area)
{
GdkTimeCoord *backlog;
GdkDeviceTool *tool;
gdouble pressure;
guint n_items;
tool = gtk_gesture_stylus_get_device_tool (gesture);
if (gtk_gesture_stylus_get_backlog (gesture, &backlog, &n_items))
{
guint i;
for (i = 0; i < n_items; i++)
{
drawing_area_apply_stroke (area, tool,
backlog[i].axes[GDK_AXIS_X],
backlog[i].axes[GDK_AXIS_Y],
backlog[i].axes[GDK_AXIS_PRESSURE]);
}
g_free (backlog);
}
else
{
if (!gtk_gesture_stylus_get_axis (gesture, GDK_AXIS_PRESSURE, &pressure))
pressure = 1;
drawing_area_apply_stroke (area, tool, x, y, pressure);
}
gtk_widget_queue_draw (GTK_WIDGET (area));
}
static void
drawing_area_init (DrawingArea *area)
{
GtkGesture *gesture;
gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE);
gesture = gtk_gesture_stylus_new ();
g_signal_connect (gesture, "down",
G_CALLBACK (stylus_gesture_down), area);
g_signal_connect (gesture, "motion",
G_CALLBACK (stylus_gesture_motion), area);
gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture));
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
}
GtkWidget *
drawing_area_new (void)
{
return g_object_new (drawing_area_get_type (), NULL);
}
void
drawing_area_set_color (DrawingArea *area,
GdkRGBA *color)
{
area->draw_color = *color;
}
static void
color_button_color_set (GtkColorButton *button,
DrawingArea *draw_area)
{
GdkRGBA color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
drawing_area_set_color (draw_area, &color);
}
GtkWidget *
do_paint (GtkWidget *toplevel)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *draw_area, *headerbar, *colorbutton;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
draw_area = drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), draw_area);
headerbar = gtk_header_bar_new ();
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Paint");
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set",
G_CALLBACK (color_button_color_set), draw_area);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

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

@@ -0,0 +1,177 @@
/* 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));
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
(height - size) / 2.0,
size, size));
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

@@ -43,32 +43,28 @@
<object class="GtkWindow" id="window">
<child>
<object class="GtkBox" id="box">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="primary_icon_name">edit-find</property>
<property name="secondary_icon_name">edit-clear</property>
<property name="can-focus">1</property>
<property name="primary-icon-name">edit-find</property>
<property name="secondary-icon-name">edit-clear</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="shadow_type">in</property>
<property name="can-focus">1</property>
<property name="shadow-type">in</property>
<property name="max-content-height">100</property>
<child>
<object class="GtkTreeView" id="treeview1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="vexpand">1</property>
<property name="model">liststore1</property>
<property name="headers_visible">0</property>
<property name="enable_search">0</property>
<property name="search_column">2</property>
<property name="headers-visible">0</property>
<property name="enable-search">0</property>
<property name="search-column">2</property>
<child internal-child="selection">
<object class="GtkTreeSelection" id="treeview-selection1"/>
</child>

View File

@@ -2,22 +2,19 @@
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window">
<property name="default_width">300</property>
<property name="default_height">300</property>
<property name="default-width">300</property>
<property name="default-height">300</property>
<property name="title">Revealer</property>
<child>
<object class="GtkGrid">
<property name="visible">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkRevealer" id="revealer0">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -30,12 +27,10 @@
</child>
<child>
<object class="GtkRevealer" id="revealer1">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -48,12 +43,10 @@
</child>
<child>
<object class="GtkRevealer" id="revealer2">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-right</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -66,11 +59,9 @@
</child>
<child>
<object class="GtkRevealer" id="revealer3">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -83,12 +74,10 @@
</child>
<child>
<object class="GtkRevealer" id="revealer4">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-left</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -101,12 +90,10 @@
</child>
<child>
<object class="GtkRevealer" id="revealer5">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -119,12 +106,10 @@
</child>
<child>
<object class="GtkRevealer" id="revealer6">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-right</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -137,11 +122,9 @@
</child>
<child>
<object class="GtkRevealer" id="revealer7">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>
@@ -154,12 +137,10 @@
</child>
<child>
<object class="GtkRevealer" id="revealer8">
<property name="visible">1</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-left</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">large</property>
</object>

View File

@@ -23,52 +23,56 @@
<property name="title" translatable="yes">Scales</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">1</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<property name="margin">20</property>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<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>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScale">
<property name="visible">1</property>
<property name="can_focus">1</property>
<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="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>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<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>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScale">
<property name="visible">1</property>
<property name="can_focus">1</property>
<object class="GtkScale" id="scale_marks">
<property name="can-focus">1</property>
<property name="width-request">200</property>
<property name="draw_value">0</property>
<property name="draw-value">0</property>
<property name="adjustment">adjustment2</property>
<property name="hexpand">1</property>
<marks>
@@ -78,32 +82,39 @@
<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>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<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>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkScale">
<property name="visible">1</property>
<property name="can_focus">1</property>
<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="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>
@@ -113,8 +124,8 @@
</marks>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>

View File

@@ -0,0 +1,184 @@
#include "config.h"
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <hb-ot.h>
#include "script-names.h"
static struct {
GUnicodeScript script;
hb_script_t hb_script;
const char *name;
} scripts[] =
{
{ G_UNICODE_SCRIPT_COMMON, HB_SCRIPT_COMMON, NULL },
{ G_UNICODE_SCRIPT_INHERITED, HB_SCRIPT_INHERITED, NULL },
{ G_UNICODE_SCRIPT_ARABIC, HB_SCRIPT_ARABIC, NC_("Script", "Arabic") },
{ G_UNICODE_SCRIPT_ARMENIAN, HB_SCRIPT_ARMENIAN, NC_("Script", "Armenian") },
{ G_UNICODE_SCRIPT_BENGALI, HB_SCRIPT_BENGALI, NC_("Script", "Bengali") },
{ G_UNICODE_SCRIPT_BOPOMOFO, HB_SCRIPT_BOPOMOFO, NC_("Script", "Bopomofo") },
{ G_UNICODE_SCRIPT_CHEROKEE, HB_SCRIPT_CHEROKEE, NC_("Script", "Cherokee") },
{ G_UNICODE_SCRIPT_COPTIC, HB_SCRIPT_COPTIC, NC_("Script", "Coptic") },
{ G_UNICODE_SCRIPT_CYRILLIC, HB_SCRIPT_CYRILLIC, NC_("Script", "Cyrillic") },
{ G_UNICODE_SCRIPT_DESERET, HB_SCRIPT_DESERET, NC_("Script", "Deseret") },
{ G_UNICODE_SCRIPT_DEVANAGARI, HB_SCRIPT_DEVANAGARI, NC_("Script", "Devanagari") },
{ G_UNICODE_SCRIPT_ETHIOPIC, HB_SCRIPT_ETHIOPIC, NC_("Script", "Ethiopic") },
{ G_UNICODE_SCRIPT_GEORGIAN, HB_SCRIPT_GEORGIAN, NC_("Script", "Georgian") },
{ G_UNICODE_SCRIPT_GOTHIC, HB_SCRIPT_GOTHIC, NC_("Script", "Gothic") },
{ G_UNICODE_SCRIPT_GREEK, HB_SCRIPT_GREEK, NC_("Script", "Greek") },
{ G_UNICODE_SCRIPT_GUJARATI, HB_SCRIPT_GUJARATI, NC_("Script", "Gujarati") },
{ G_UNICODE_SCRIPT_GURMUKHI, HB_SCRIPT_GURMUKHI, NC_("Script", "Gurmukhi") },
{ G_UNICODE_SCRIPT_HAN, HB_SCRIPT_HAN, NC_("Script", "Han") },
{ G_UNICODE_SCRIPT_HANGUL, HB_SCRIPT_HANGUL, NC_("Script", "Hangul") },
{ G_UNICODE_SCRIPT_HEBREW, HB_SCRIPT_HEBREW, NC_("Script", "Hebrew") },
{ G_UNICODE_SCRIPT_HIRAGANA, HB_SCRIPT_HIRAGANA, NC_("Script", "Hiragana") },
{ G_UNICODE_SCRIPT_KANNADA, HB_SCRIPT_KANNADA, NC_("Script", "Kannada") },
{ G_UNICODE_SCRIPT_KATAKANA, HB_SCRIPT_KATAKANA, NC_("Script", "Katakana") },
{ G_UNICODE_SCRIPT_KHMER, HB_SCRIPT_KHMER, NC_("Script", "Khmer") },
{ G_UNICODE_SCRIPT_LAO, HB_SCRIPT_LAO, NC_("Script", "Lao") },
{ G_UNICODE_SCRIPT_LATIN, HB_SCRIPT_LATIN, NC_("Script", "Latin") },
{ G_UNICODE_SCRIPT_MALAYALAM, HB_SCRIPT_MALAYALAM, NC_("Script", "Malayalam") },
{ G_UNICODE_SCRIPT_MONGOLIAN, HB_SCRIPT_MONGOLIAN, NC_("Script", "Mongolian") },
{ G_UNICODE_SCRIPT_MYANMAR, HB_SCRIPT_MYANMAR, NC_("Script", "Myanmar") },
{ G_UNICODE_SCRIPT_OGHAM, HB_SCRIPT_OGHAM, NC_("Script", "Ogham") },
{ G_UNICODE_SCRIPT_OLD_ITALIC, HB_SCRIPT_OLD_ITALIC, NC_("Script", "Old Italic") },
{ G_UNICODE_SCRIPT_ORIYA, HB_SCRIPT_ORIYA, NC_("Script", "Oriya") },
{ G_UNICODE_SCRIPT_RUNIC, HB_SCRIPT_RUNIC, NC_("Script", "Runic") },
{ G_UNICODE_SCRIPT_SINHALA, HB_SCRIPT_SINHALA, NC_("Script", "Sinhala") },
{ G_UNICODE_SCRIPT_SYRIAC, HB_SCRIPT_SYRIAC, NC_("Script", "Syriac") },
{ G_UNICODE_SCRIPT_TAMIL, HB_SCRIPT_TAMIL, NC_("Script", "Tamil") },
{ G_UNICODE_SCRIPT_TELUGU, HB_SCRIPT_TELUGU, NC_("Script", "Telugu") },
{ G_UNICODE_SCRIPT_THAANA, HB_SCRIPT_THAANA, NC_("Script", "Thaana") },
{ G_UNICODE_SCRIPT_THAI, HB_SCRIPT_THAI, NC_("Script", "Thai") },
{ G_UNICODE_SCRIPT_TIBETAN, HB_SCRIPT_TIBETAN, NC_("Script", "Tibetan") },
{ G_UNICODE_SCRIPT_CANADIAN_ABORIGINAL, HB_SCRIPT_CANADIAN_ABORIGINAL, NC_("Script", "Canadian Aboriginal") },
{ G_UNICODE_SCRIPT_YI, HB_SCRIPT_YI, NC_("Script", "Yi") },
{ G_UNICODE_SCRIPT_TAGALOG, HB_SCRIPT_TAGALOG, NC_("Script", "Tagalog") },
{ G_UNICODE_SCRIPT_HANUNOO, HB_SCRIPT_HANUNOO, NC_("Script", "Hanunoo") },
{ G_UNICODE_SCRIPT_BUHID, HB_SCRIPT_BUHID, NC_("Script", "Buhid") },
{ G_UNICODE_SCRIPT_TAGBANWA, HB_SCRIPT_TAGBANWA, NC_("Script", "Tagbanwa") },
{ G_UNICODE_SCRIPT_BRAILLE, HB_SCRIPT_BRAILLE, NC_("Script", "Braille") },
{ G_UNICODE_SCRIPT_CYPRIOT, HB_SCRIPT_CYPRIOT, NC_("Script", "Cypriot") },
{ G_UNICODE_SCRIPT_LIMBU, HB_SCRIPT_LIMBU, NC_("Script", "Limbu") },
{ G_UNICODE_SCRIPT_OSMANYA, HB_SCRIPT_OSMANYA, NC_("Script", "Osmanya") },
{ G_UNICODE_SCRIPT_SHAVIAN, HB_SCRIPT_SHAVIAN, NC_("Script", "Shavian") },
{ G_UNICODE_SCRIPT_LINEAR_B, HB_SCRIPT_LINEAR_B, NC_("Script", "Linear B") },
{ G_UNICODE_SCRIPT_TAI_LE, HB_SCRIPT_TAI_LE, NC_("Script", "Tai Le") },
{ G_UNICODE_SCRIPT_UGARITIC, HB_SCRIPT_UGARITIC, NC_("Script", "Ugaritic") },
{ G_UNICODE_SCRIPT_NEW_TAI_LUE, HB_SCRIPT_NEW_TAI_LUE, NC_("Script", "New Tai Lue") },
{ G_UNICODE_SCRIPT_BUGINESE, HB_SCRIPT_BUGINESE, NC_("Script", "Buginese") },
{ G_UNICODE_SCRIPT_GLAGOLITIC, HB_SCRIPT_GLAGOLITIC, NC_("Script", "Glagolitic") },
{ G_UNICODE_SCRIPT_TIFINAGH, HB_SCRIPT_TIFINAGH, NC_("Script", "Tifinagh") },
{ G_UNICODE_SCRIPT_SYLOTI_NAGRI, HB_SCRIPT_SYLOTI_NAGRI, NC_("Script", "Syloti Nagri") },
{ G_UNICODE_SCRIPT_OLD_PERSIAN, HB_SCRIPT_OLD_PERSIAN, NC_("Script", "Old Persian") },
{ G_UNICODE_SCRIPT_KHAROSHTHI, HB_SCRIPT_KHAROSHTHI, NC_("Script", "Kharoshthi") },
{ G_UNICODE_SCRIPT_UNKNOWN, HB_SCRIPT_UNKNOWN, NC_("Script", "Unknown") },
{ G_UNICODE_SCRIPT_BALINESE, HB_SCRIPT_BALINESE, NC_("Script", "Balinese") },
{ G_UNICODE_SCRIPT_CUNEIFORM, HB_SCRIPT_CUNEIFORM, NC_("Script", "Cuneiform") },
{ G_UNICODE_SCRIPT_PHOENICIAN, HB_SCRIPT_PHOENICIAN, NC_("Script", "Phoenician") },
{ G_UNICODE_SCRIPT_PHAGS_PA, HB_SCRIPT_PHAGS_PA, NC_("Script", "Phags-pa") },
{ G_UNICODE_SCRIPT_NKO, HB_SCRIPT_NKO, NC_("Script", "N'Ko") },
{ G_UNICODE_SCRIPT_KAYAH_LI, HB_SCRIPT_KAYAH_LI, NC_("Script", "Kayah Li") },
{ G_UNICODE_SCRIPT_LEPCHA, HB_SCRIPT_LEPCHA, NC_("Script", "Lepcha") },
{ G_UNICODE_SCRIPT_REJANG, HB_SCRIPT_REJANG, NC_("Script", "Rejang") },
{ G_UNICODE_SCRIPT_SUNDANESE, HB_SCRIPT_SUNDANESE, NC_("Script", "Sundanese") },
{ G_UNICODE_SCRIPT_SAURASHTRA, HB_SCRIPT_SAURASHTRA, NC_("Script", "Saurashtra") },
{ G_UNICODE_SCRIPT_CHAM, HB_SCRIPT_CHAM, NC_("Script", "Cham") },
{ G_UNICODE_SCRIPT_OL_CHIKI, HB_SCRIPT_OL_CHIKI, NC_("Script", "Ol Chiki") },
{ G_UNICODE_SCRIPT_VAI, HB_SCRIPT_VAI, NC_("Script", "Vai") },
{ G_UNICODE_SCRIPT_CARIAN, HB_SCRIPT_CARIAN, NC_("Script", "Carian") },
{ G_UNICODE_SCRIPT_LYCIAN, HB_SCRIPT_LYCIAN, NC_("Script", "Lycian") },
{ G_UNICODE_SCRIPT_LYDIAN, HB_SCRIPT_LYDIAN, NC_("Script", "Lydian") },
{ G_UNICODE_SCRIPT_AVESTAN, HB_SCRIPT_AVESTAN, NC_("Script", "Avestan") },
{ G_UNICODE_SCRIPT_BAMUM, HB_SCRIPT_BAMUM, NC_("Script", "Bamum") },
{ G_UNICODE_SCRIPT_EGYPTIAN_HIEROGLYPHS, HB_SCRIPT_EGYPTIAN_HIEROGLYPHS, NC_("Script", "Egyptian Hieroglpyhs") },
{ G_UNICODE_SCRIPT_IMPERIAL_ARAMAIC, HB_SCRIPT_IMPERIAL_ARAMAIC, NC_("Script", "Imperial Aramaic") },
{ G_UNICODE_SCRIPT_INSCRIPTIONAL_PAHLAVI, HB_SCRIPT_INSCRIPTIONAL_PAHLAVI, NC_("Script", "Inscriptional Pahlavi") },
{ G_UNICODE_SCRIPT_INSCRIPTIONAL_PARTHIAN, HB_SCRIPT_INSCRIPTIONAL_PARTHIAN, NC_("Script", "Inscriptional Parthian") },
{ G_UNICODE_SCRIPT_JAVANESE, HB_SCRIPT_JAVANESE, NC_("Script", "Javanese") },
{ G_UNICODE_SCRIPT_KAITHI, HB_SCRIPT_KAITHI, NC_("Script", "Kaithi") },
{ G_UNICODE_SCRIPT_LISU, HB_SCRIPT_LISU, NC_("Script", "Lisu") },
{ G_UNICODE_SCRIPT_MEETEI_MAYEK, HB_SCRIPT_MEETEI_MAYEK, NC_("Script", "Meetei Mayek") },
{ G_UNICODE_SCRIPT_OLD_SOUTH_ARABIAN, HB_SCRIPT_OLD_SOUTH_ARABIAN, NC_("Script", "Old South Arabian") },
{ G_UNICODE_SCRIPT_OLD_TURKIC, HB_SCRIPT_OLD_TURKIC, NC_("Script", "Old Turkic") },
{ G_UNICODE_SCRIPT_SAMARITAN, HB_SCRIPT_SAMARITAN, NC_("Script", "Samaritan") },
{ G_UNICODE_SCRIPT_TAI_THAM, HB_SCRIPT_TAI_THAM, NC_("Script", "Tai Tham") },
{ G_UNICODE_SCRIPT_TAI_VIET, HB_SCRIPT_TAI_VIET, NC_("Script", "Tai Viet") },
{ G_UNICODE_SCRIPT_BATAK, HB_SCRIPT_BATAK, NC_("Script", "Batak") },
{ G_UNICODE_SCRIPT_BRAHMI, HB_SCRIPT_BRAHMI, NC_("Script", "Brahmi") },
{ G_UNICODE_SCRIPT_MANDAIC, HB_SCRIPT_MANDAIC, NC_("Script", "Mandaic") },
{ G_UNICODE_SCRIPT_CHAKMA, HB_SCRIPT_CHAKMA, NC_("Script", "Chakma") },
{ G_UNICODE_SCRIPT_MEROITIC_CURSIVE, HB_SCRIPT_MEROITIC_CURSIVE, NC_("Script", "Meroitic Cursive") },
{ G_UNICODE_SCRIPT_MEROITIC_HIEROGLYPHS, HB_SCRIPT_MEROITIC_HIEROGLYPHS, NC_("Script", "Meroitic Hieroglyphs") },
{ G_UNICODE_SCRIPT_MIAO, HB_SCRIPT_MIAO, NC_("Script", "Miao") },
{ G_UNICODE_SCRIPT_SHARADA, HB_SCRIPT_SHARADA, NC_("Script", "Sharada") },
{ G_UNICODE_SCRIPT_SORA_SOMPENG, HB_SCRIPT_SORA_SOMPENG, NC_("Script", "Sora Sompeng") },
{ G_UNICODE_SCRIPT_TAKRI, HB_SCRIPT_TAKRI, NC_("Script", "Takri") },
{ G_UNICODE_SCRIPT_BASSA_VAH, HB_SCRIPT_BASSA_VAH, NC_("Script", "Bassa") },
{ G_UNICODE_SCRIPT_CAUCASIAN_ALBANIAN, HB_SCRIPT_CAUCASIAN_ALBANIAN, NC_("Script", "Caucasian Albanian") },
{ G_UNICODE_SCRIPT_DUPLOYAN, HB_SCRIPT_DUPLOYAN, NC_("Script", "Duployan") },
{ G_UNICODE_SCRIPT_ELBASAN, HB_SCRIPT_ELBASAN, NC_("Script", "Elbasan") },
{ G_UNICODE_SCRIPT_GRANTHA, HB_SCRIPT_GRANTHA, NC_("Script", "Grantha") },
{ G_UNICODE_SCRIPT_KHOJKI, HB_SCRIPT_KHOJKI, NC_("Script", "Kjohki") },
{ G_UNICODE_SCRIPT_KHUDAWADI, HB_SCRIPT_KHUDAWADI, NC_("Script", "Khudawadi, Sindhi") },
{ G_UNICODE_SCRIPT_LINEAR_A, HB_SCRIPT_LINEAR_A, NC_("Script", "Linear A") },
{ G_UNICODE_SCRIPT_MAHAJANI, HB_SCRIPT_MAHAJANI, NC_("Script", "Mahajani") },
{ G_UNICODE_SCRIPT_MANICHAEAN, HB_SCRIPT_MANICHAEAN, NC_("Script", "Manichaean") },
{ G_UNICODE_SCRIPT_MENDE_KIKAKUI, HB_SCRIPT_MENDE_KIKAKUI, NC_("Script", "Mende Kikakui") },
{ G_UNICODE_SCRIPT_MODI, HB_SCRIPT_MODI, NC_("Script", "Modi") },
{ G_UNICODE_SCRIPT_MRO, HB_SCRIPT_MRO, NC_("Script", "Mro") },
{ G_UNICODE_SCRIPT_NABATAEAN, HB_SCRIPT_NABATAEAN, NC_("Script", "Nabataean") },
{ G_UNICODE_SCRIPT_OLD_NORTH_ARABIAN, HB_SCRIPT_OLD_NORTH_ARABIAN, NC_("Script", "Old North Arabian") },
{ G_UNICODE_SCRIPT_OLD_PERMIC, HB_SCRIPT_OLD_PERMIC, NC_("Script", "Old Permic") },
{ G_UNICODE_SCRIPT_PAHAWH_HMONG, HB_SCRIPT_PAHAWH_HMONG, NC_("Script", "Pahawh Hmong") },
{ G_UNICODE_SCRIPT_PALMYRENE, HB_SCRIPT_PALMYRENE, NC_("Script", "Palmyrene") },
{ G_UNICODE_SCRIPT_PAU_CIN_HAU, HB_SCRIPT_PAU_CIN_HAU, NC_("Script", "Pau Cin Hau") },
{ G_UNICODE_SCRIPT_PSALTER_PAHLAVI, HB_SCRIPT_PSALTER_PAHLAVI, NC_("Script", "Psalter Pahlavi") },
{ G_UNICODE_SCRIPT_SIDDHAM, HB_SCRIPT_SIDDHAM, NC_("Script", "Siddham") },
{ G_UNICODE_SCRIPT_TIRHUTA, HB_SCRIPT_TIRHUTA, NC_("Script", "Tirhuta") },
{ G_UNICODE_SCRIPT_WARANG_CITI, HB_SCRIPT_WARANG_CITI, NC_("Script", "Warang Citi") },
{ G_UNICODE_SCRIPT_AHOM, HB_SCRIPT_AHOM, NC_("Script", "Ahom") },
{ G_UNICODE_SCRIPT_ANATOLIAN_HIEROGLYPHS, HB_SCRIPT_ANATOLIAN_HIEROGLYPHS, NC_("Script", "Anatolian Hieroglyphs") },
{ G_UNICODE_SCRIPT_HATRAN, HB_SCRIPT_HATRAN, NC_("Script", "Hatran") },
{ G_UNICODE_SCRIPT_MULTANI, HB_SCRIPT_MULTANI, NC_("Script", "Multani") },
{ G_UNICODE_SCRIPT_OLD_HUNGARIAN, HB_SCRIPT_OLD_HUNGARIAN, NC_("Script", "Old Hungarian") },
{ G_UNICODE_SCRIPT_SIGNWRITING, HB_SCRIPT_SIGNWRITING, NC_("Script", "Signwriting") },
{ G_UNICODE_SCRIPT_ADLAM, HB_SCRIPT_ADLAM, NC_("Script", "Adlam") },
{ G_UNICODE_SCRIPT_BHAIKSUKI, HB_SCRIPT_BHAIKSUKI, NC_("Script", "Bhaiksuki") },
{ G_UNICODE_SCRIPT_MARCHEN, HB_SCRIPT_MARCHEN, NC_("Script", "Marchen") },
{ G_UNICODE_SCRIPT_NEWA, HB_SCRIPT_NEWA, NC_("Script", "Newa") },
{ G_UNICODE_SCRIPT_OSAGE, HB_SCRIPT_OSAGE, NC_("Script", "Osage") },
{ G_UNICODE_SCRIPT_TANGUT, HB_SCRIPT_TANGUT, NC_("Script", "Tangut") },
{ G_UNICODE_SCRIPT_MASARAM_GONDI, HB_SCRIPT_INVALID, NC_("Script", "Masaram Gondi") },
{ G_UNICODE_SCRIPT_NUSHU, HB_SCRIPT_INVALID, NC_("Script", "Nushu") },
{ G_UNICODE_SCRIPT_SOYOMBO, HB_SCRIPT_INVALID, NC_("Script", "Soyombo") },
{ G_UNICODE_SCRIPT_ZANABAZAR_SQUARE, HB_SCRIPT_INVALID, NC_("Script", "Zanabazar Square") },
};
const char *
get_script_name (GUnicodeScript script)
{
int i;
for (i = 0; i < G_N_ELEMENTS (scripts); i++)
{
if (scripts[i].script == script)
return g_dpgettext2 (GETTEXT_PACKAGE, "Script", scripts[i].name);
}
return NULL;
}
const char *
get_script_name_for_tag (guint32 tag)
{
int i;
for (i = 0; i < G_N_ELEMENTS (scripts); i++)
{
if (scripts[i].hb_script == hb_script_from_iso15924_tag (tag))
return g_dpgettext2 (GETTEXT_PACKAGE, "Script", scripts[i].name);
}
return NULL;
}

View File

@@ -0,0 +1,13 @@
#ifndef SCRIPT_NAMES_H
#define SCRIPT_NAMES_H
#include <glib.h>
G_BEGIN_DECLS
const char * get_script_name (GUnicodeScript script);
const char * get_script_name_for_tag (guint32 tag);
G_END_DECLS
#endif

View File

@@ -31,7 +31,10 @@ window_key_press_event_cb (GtkWidget *widget,
GdkEvent *event,
GtkSearchBar *bar)
{
return gtk_search_bar_handle_event (bar, event);
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS)
return gtk_search_bar_handle_event (bar, event);
return GDK_EVENT_PROPAGATE;
}
static void
@@ -99,8 +102,7 @@ do_search_entry2 (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), searchbar);
/* Hook the search bar to key presses */
g_signal_connect (window, "key-press-event",
G_CALLBACK (window_key_press_event_cb), searchbar);
g_signal_connect (window, "event", G_CALLBACK (window_key_press_event_cb), searchbar);
/* Help */
label = gtk_label_new ("Start Typing to search");

View File

@@ -1,104 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-boxes">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="section-name">shortcuts</property>
<property name="max-height">12</property>
<!-- Overview shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Overview</property>
<property name="view">overview</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F1</property>
<property name="title" translatable="yes">Help</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;n</property>
<property name="title" translatable="yes">Create a new box</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;f</property>
<property name="title" translatable="yes">Search</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;k</property>
<property name="title" translatable="yes">Keyboard shortcuts</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;q</property>
<property name="title" translatable="yes">Close Window/Quit Boxes</property>
</object>
</child>
</object>
</child>
<!-- Wizard and Properties shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Box Creation and Properties</property>
<property name="view">wizard</property>
<!-- LTR -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">ltr</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
<property name="title" translatable="yes">Switch to the next page</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">ltr</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Switch to the previous page</property>
</object>
</child>
<!-- RTL -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">rtl</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Switch to the next page</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">rtl</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
<property name="title" translatable="yes">Switch to the previous page</property>
@@ -106,62 +81,48 @@
</child>
</object>
</child>
<!-- Display shortcuts -->
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Box Display</property>
<property name="view">display</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Control_L+Alt_L</property>
<property name="title" translatable="yes">Grab/Ungrab keyboard</property>
</object>
</child>
<!-- LTR -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">ltr</property>
<property name="accelerator">&lt;Alt&gt;Left</property>
<property name="title" translatable="yes">Back to overview</property>
</object>
</child>
<!-- RTL -->
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="direction">rtl</property>
<property name="accelerator">&lt;Alt&gt;Right</property>
<property name="title" translatable="yes">Back to overview</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Ctrl&gt;q</property>
<property name="title" translatable="yes">Close window/Quit Boxes</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F11</property>
<property name="title" translatable="yes">Fullscreen/Restore from fullscreen</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,49 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-builder">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="section-name">editor</property>
<property name="title" translatable="yes">Editor Shortcuts</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Global Search</property>
<property name="accelerator">&lt;ctrl&gt;period</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Preferences</property>
<property name="accelerator">&lt;ctrl&gt;comma</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Command Bar</property>
<property name="accelerator">&lt;ctrl&gt;Return</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Terminal</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;t</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Keyboard Shortcuts</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;question</property>
</object>
@@ -52,25 +44,21 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Panels</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Toggle left panel</property>
<property name="accelerator">F9</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Toggle right panel</property>
<property name="accelerator">&lt;shift&gt;F9</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Toggle bottom panel</property>
<property name="accelerator">&lt;ctrl&gt;F9</property>
</object>
@@ -79,18 +67,15 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Touchpad gestures</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-right</property>
<property name="title" translatable="yes">Switch to the next document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-left</property>
<property name="title" translatable="yes">Switch to the previous document</property>
</object>
@@ -99,46 +84,39 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Files</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;n</property>
<property name="title" translatable="yes">Create new document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;o</property>
<property name="title" translatable="yes">Open a document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;s</property>
<property name="title" translatable="yes">Save the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;w</property>
<property name="title" translatable="yes">Close the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;alt&gt;Page_Down</property>
<property name="title" translatable="yes">Switch to the next document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;alt&gt;Page_Up</property>
<property name="title" translatable="yes">Switch to the previous document</property>
</object>
@@ -147,32 +125,27 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Find and replace</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;f</property>
<property name="title" translatable="yes">Find</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;g</property>
<property name="title" translatable="yes">Find the next match</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;g</property>
<property name="title" translatable="yes">Find the previous match</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;k</property>
<property name="title" translatable="yes">Clear highlight</property>
</object>
@@ -181,25 +154,21 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Copy and Paste</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;c</property>
<property name="title" translatable="yes">Copy selected text to clipboard</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;x</property>
<property name="title" translatable="yes">Cut selected text to clipboard</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;v</property>
<property name="title" translatable="yes">Paste text from clipboard</property>
</object>
@@ -208,18 +177,15 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Undo and Redo</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;z</property>
<property name="title" translatable="yes">Undo previous command</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;z</property>
<property name="title" translatable="yes">Redo previous command</property>
</object>
@@ -228,46 +194,39 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Editing</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;a</property>
<property name="title" translatable="yes">Increment number at cursor</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;x</property>
<property name="title" translatable="yes">Decrement number at cursor</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;j</property>
<property name="title" translatable="yes">Join selected lines</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;space</property>
<property name="title" translatable="yes">Show completion window</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Insert</property>
<property name="title" translatable="yes">Toggle overwrite</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;alt&gt;i</property>
<property name="title" translatable="yes">Reindent line</property>
</object>
@@ -276,74 +235,63 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Navigation</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;n</property>
<property name="title" translatable="yes">Move to next error in file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;p</property>
<property name="title" translatable="yes">Move to previous error in file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;shift&gt;&lt;alt&gt;Left</property>
<property name="title" translatable="yes">Move to previous edit location</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;shift&gt;&lt;alt&gt;Right</property>
<property name="title" translatable="yes">Move to next edit location</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;period</property>
<property name="title" translatable="yes">Jump to definition of symbol</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;&lt;shift&gt;Up</property>
<property name="title" translatable="yes">Move sectionport up within the file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;&lt;shift&gt;Down</property>
<property name="title" translatable="yes">Move sectionport down within the file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;&lt;shift&gt;End</property>
<property name="title" translatable="yes">Move sectionport to end of file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;&lt;shift&gt;Home</property>
<property name="title" translatable="yes">Move sectionport to beginning of file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;percent</property>
<property name="title" translatable="yes">Move to matching bracket</property>
</object>
@@ -352,18 +300,15 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Selections</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;a</property>
<property name="title" translatable="yes">Select all</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;backslash</property>
<property name="title" translatable="yes">Unselect all</property>
</object>
@@ -374,45 +319,38 @@
</child>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="max-height">16</property>
<property name="section-name">terminal</property>
<property name="title" translatable="yes">Terminal Shortcuts</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Global Search</property>
<property name="accelerator">&lt;ctrl&gt;period</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Preferences</property>
<property name="accelerator">&lt;ctrl&gt;comma</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Command Bar</property>
<property name="accelerator">&lt;ctrl&gt;Return</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Terminal</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;t</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="title" translatable="yes">Keyboard Shortcuts</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;question</property>
</object>
@@ -421,18 +359,15 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Copy and Paste</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;c</property>
<property name="title" translatable="yes">Copy selected text to clipboard</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;shift&gt;v</property>
<property name="title" translatable="yes">Paste text from clipboard</property>
</object>
@@ -441,122 +376,98 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Switching</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;1...9</property>
<property name="title" translatable="yes">Switch to n-th tab</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">'Special' combinations</property>
<property name="title" translatable="yes">&apos;Special&apos; combinations</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">t+t</property>
<property name="title" translatable="yes">You want tea ?</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;shift&gt;&lt;ctrl&gt;</property>
<property name="title" translatable="yes">Shift Control</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&amp;&lt;ctrl&gt;</property>
<property name="title" translatable="yes">Control Control</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Control_L&amp;Control_R</property>
<property name="title" translatable="yes">Left and right control</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">All gestures</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-pinch</property>
<property name="title" translatable="yes">A stock pinch gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-stretch</property>
<property name="title" translatable="yes">A stock stretch gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-rotate-clockwise</property>
<property name="title" translatable="yes">A stock rotation gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-rotate-counterclockwise</property>
<property name="title" translatable="yes">A stock rotation gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-left</property>
<property name="title" translatable="yes">A stock swipe gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-right</property>
<property name="title" translatable="yes">A stock swipe gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-swipe-left</property>
<property name="title" translatable="yes">A stock swipe gesture</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-swipe-right</property>
<property name="title" translatable="yes">A stock swipe gesture</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,42 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-clocks">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="section-name">shortcuts</property>
<property name="max-height">10</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;Page_Down</property>
<property name="title" translatable="yes">Go to the next section</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;Page_Up</property>
<property name="title" translatable="yes">Go to the previous section</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;Q</property>
<property name="title" translatable="yes">Quit</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;Right</property>
<property name="direction">ltr</property>
<property name="title" translatable="yes">Forward</property>
@@ -44,7 +37,6 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;Left</property>
<property name="direction">ltr</property>
<property name="title" translatable="yes">Back</property>
@@ -52,7 +44,6 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;alt&gt;Left</property>
<property name="direction">rtl</property>
<property name="title" translatable="yes">Forward</property>
@@ -60,7 +51,6 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;Right</property>
<property name="direction">rtl</property>
<property name="title" translatable="yes">Back</property>
@@ -70,19 +60,16 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="view">world</property>
<property name="title" translatable="yes">World Clocks</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;N</property>
<property name="title" translatable="yes">Add a world clock</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;S</property>
<property name="title" translatable="yes">Select world clocks</property>
</object>
@@ -91,19 +78,16 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="view">alarm</property>
<property name="title" translatable="yes">Alarm</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;N</property>
<property name="title" translatable="yes">Add an alarm</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;S</property>
<property name="title" translatable="yes">Select alarms</property>
</object>
@@ -112,26 +96,22 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="view">stopwatch</property>
<property name="title" translatable="yes">Stopwatch</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Return space</property>
<property name="title" translatable="yes">Start / Stop / Continue</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">L</property>
<property name="title" translatable="yes">Lap</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Delete</property>
<property name="title" translatable="yes">Reset</property>
</object>
@@ -140,19 +120,16 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="view">timer</property>
<property name="title" translatable="yes">Timer</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Return space</property>
<property name="title" translatable="yes">Start / Stop / Pause</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Delete</property>
<property name="title" translatable="yes">Reset</property>
</object>
@@ -162,5 +139,4 @@
</object>
</child>
</object>
</interface>

View File

@@ -1,28 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkShortcutsWindow" id="shortcuts-gedit">
<property name="modal">1</property>
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<property name="section-name">shortcuts</property>
<property name="max-height">12</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Touchpad gestures</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-right</property>
<property name="title" translatable="yes">Switch to the next document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="shortcut-type">gesture-two-finger-swipe-left</property>
<property name="title" translatable="yes">Switch to the previous document</property>
</object>
@@ -31,46 +26,39 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Documents</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;N</property>
<property name="title" translatable="yes">Create new document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;O</property>
<property name="title" translatable="yes">Open a document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;S</property>
<property name="title" translatable="yes">Save the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;W</property>
<property name="title" translatable="yes">Close the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Alt&gt;Page_Down</property>
<property name="title" translatable="yes">Switch to the next document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Alt&gt;Page_Up</property>
<property name="title" translatable="yes">Switch to the previous document</property>
</object>
@@ -79,46 +67,39 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Find and Replace</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;F</property>
<property name="title" translatable="yes">Find</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;G</property>
<property name="title" translatable="yes">Find the next match</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Shift&gt;G</property>
<property name="title" translatable="yes">Find the previous match</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;H</property>
<property name="title" translatable="yes">Find and Replace</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;&lt;Shift&gt;K</property>
<property name="title" translatable="yes">Clear highlight</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;I</property>
<property name="title" translatable="yes">Go to line</property>
</object>
@@ -127,11 +108,9 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Tools</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;shift&gt;F7</property>
<property name="title" translatable="yes">Check spelling</property>
</object>
@@ -140,25 +119,21 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title" translatable="yes">Miscellaneous</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F11</property>
<property name="title" translatable="yes">Fullscreen on / off</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;ctrl&gt;P</property>
<property name="title" translatable="yes">Print the document</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Insert</property>
<property name="title" translatable="yes">Toggle insert / overwrite</property>
</object>
@@ -168,5 +143,4 @@
</object>
</child>
</object>
</interface>

View File

@@ -1,60 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.17 -->
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Shortcuts</property>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="margin">50</property>
<property name="spacing">10</property>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Builder</property>
<signal name="clicked" handler="builder_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">GEdit</property>
<signal name="clicked" handler="gedit_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Clocks - All</property>
<signal name="clicked" handler="clocks_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Clocks - Stopwatch</property>
<signal name="clicked" handler="clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Boxes</property>
<signal name="clicked" handler="boxes_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Boxes - Wizard</property>
<signal name="clicked" handler="boxes_shortcuts_wizard" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Boxes - Display</property>
<signal name="clicked" handler="boxes_shortcuts_display" swapped="1" object="window1"/>
</object>

View File

@@ -33,14 +33,14 @@ hex_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
gchar *buf;
gint val;
gdouble val;
adjustment = gtk_spin_button_get_adjustment (spin_button);
val = (gint) gtk_adjustment_get_value (adjustment);
val = gtk_adjustment_get_value (adjustment);
if (fabs (val) < 1e-5)
buf = g_strdup ("0x00");
else
buf = g_strdup_printf ("0x%.2X", val);
buf = g_strdup_printf ("0x%.2X", (gint) val);
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
gtk_spin_button_set_text (spin_button, buf);
g_free (buf);

View File

@@ -3,189 +3,176 @@
<object class="GtkAdjustment" id="basic_adjustment">
<property name="lower">-10000</property>
<property name="upper">10000</property>
<property name="step_increment">0.5</property>
<property name="page_increment">100</property>
<property name="step-increment">0.5</property>
<property name="page-increment">100</property>
</object>
<object class="GtkAdjustment" id="hex_adjustment">
<property name="upper">255</property>
<property name="step_increment">1</property>
<property name="page_increment">16</property>
<property name="step-increment">1</property>
<property name="page-increment">16</property>
</object>
<object class="GtkAdjustment" id="time_adjustment">
<property name="upper">1410</property>
<property name="step_increment">30</property>
<property name="page_increment">60</property>
<property name="step-increment">30</property>
<property name="page-increment">60</property>
</object>
<object class="GtkAdjustment" id="month_adjustment">
<property name="lower">1</property>
<property name="upper">12</property>
<property name="value">1</property>
<property name="step_increment">1</property>
<property name="page_increment">5</property>
<property name="step-increment">1</property>
<property name="page-increment">5</property>
</object>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Spin Button</property>
<child>
<object class="GtkGrid">
<property name="visible">1</property>
<property name="margin">20</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">_Numeric</property>
<property name="use_underline">1</property>
<property name="mnemonic_widget">basic_spin</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">basic_spin</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="basic_spin">
<property name="visible">1</property>
<property name="halign">start</property>
<property name="width_chars">5</property>
<property name="width-chars">5</property>
<property name="adjustment">basic_adjustment</property>
<property name="climb_rate">1</property>
<property name="climb-rate">1</property>
<property name="digits">2</property>
<property name="numeric">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="basic_label">
<property name="visible">1</property>
<property name="width_chars">10</property>
<property name="width-chars">10</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">_Hexadecimal</property>
<property name="use_underline">1</property>
<property name="mnemonic_widget">hex_spin</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">hex_spin</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="hex_spin">
<property name="visible">1</property>
<property name="halign">start</property>
<property name="width_chars">4</property>
<property name="width-chars">4</property>
<property name="adjustment">hex_adjustment</property>
<signal name="input" handler="hex_spin_input"/>
<signal name="output" handler="hex_spin_output"/>
<property name="wrap">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="hex_label">
<property name="visible">1</property>
<property name="width_chars">10</property>
<property name="width-chars">10</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">_Time</property>
<property name="use_underline">1</property>
<property name="mnemonic_widget">time_spin</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">time_spin</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="time_spin">
<property name="visible">1</property>
<property name="halign">start</property>
<property name="width_chars">5</property>
<property name="width-chars">5</property>
<property name="adjustment">time_adjustment</property>
<signal name="input" handler="time_spin_input"/>
<signal name="output" handler="time_spin_output"/>
<property name="wrap">1</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="time_label">
<property name="visible">1</property>
<property name="width_chars">10</property>
<property name="width-chars">10</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">2</property>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">1</property>
<property name="label">_Month</property>
<property name="use_underline">1</property>
<property name="mnemonic_widget">month_spin</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">month_spin</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="month_spin">
<property name="visible">1</property>
<property name="halign">start</property>
<property name="width_chars">9</property>
<property name="width-chars">9</property>
<signal name="input" handler="month_spin_input"/>
<signal name="output" handler="month_spin_output"/>
<property name="adjustment">month_adjustment</property>
<property name="wrap">1</property>
<property name="update_policy">if-valid</property>
<property name="update-policy">if-valid</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="month_label">
<property name="visible">1</property>
<property name="width_chars">10</property>
<property name="width-chars">10</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">3</property>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>

View File

@@ -5,26 +5,22 @@
<property name="title" translatable="yes">Stack</property>
<child>
<object class="GtkGrid">
<property name="visible">1</property>
<child>
<object class="GtkStackSwitcher">
<property name="visible">1</property>
<property name="stack">stack</property>
<property name="halign">center</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="stack">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage">
<property name="visible">1</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="icon-name">gtk3-demo</property>
@@ -37,9 +33,7 @@
<child>
<object class="GtkCheckButton">
<property name="label" translatable="yes">Page 2</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="draw_indicator">1</property>
<property name="can-focus">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
@@ -50,7 +44,6 @@
</child>
<child>
<object class="GtkSpinner">
<property name="visible">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="active">1</property>
@@ -62,8 +55,8 @@
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>

10
demos/gtk-demo/theme.css Normal file
View File

@@ -0,0 +1,10 @@
window.devel headerbar {
background: #cbd2d9 -gtk-icontheme("system-run-symbolic") 70% 0/64px 64px no-repeat, linear-gradient(to left, #a5b1bd 0%, #a5b1bd 8%, @theme_bg_color 25%);
box-shadow: inset 0 1px #f1f3f5;
border-color: #909fae;
color: rgba(46, 52, 54, 0.2);
}
window.devel headerbar label {
color: @theme_fg_color;
}

View File

@@ -5,7 +5,6 @@
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="show-arrow">0</property>
<style>
@@ -13,11 +12,10 @@
</style>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
<packing>
<property name="homogeneous">1</property>
@@ -25,11 +23,10 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
</object>
<packing>
@@ -38,12 +35,11 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
<packing>
<property name="homogeneous">1</property>
@@ -51,11 +47,10 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Raised</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<style>
<class name="raised"/>
</style>
@@ -66,11 +61,10 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Raised Active</property>
<property name="use_underline">1</property>
<property name="is_important">1</property>
<property name="icon_name">edit-find</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
<style>
<class name="raised"/>
@@ -82,12 +76,11 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use_underline">1</property>
<property name="icon_name">edit-find</property>
<property name="is_important">1</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find</property>
<property name="is-important">1</property>
<property name="active">1</property>
</object>
<packing>
@@ -96,12 +89,10 @@
</child>
<child>
<object class="GtkToolItem">
<property name="visible">1</property>
<child>
<object class="GtkEntry" id="entry1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="invisible_char">•</property>
<property name="can-focus">1</property>
<property name="invisible-char"></property>
<property name="placeholder-text" translatable="yes">Search...</property>
<property name="secondary-icon-name">edit-find-symbolic</property>
</object>
@@ -110,11 +101,10 @@
</child>
<child>
<object class="GtkToolItem">
<property name="visible">1</property>
<child>
<object class="GtkSwitch" id="switch1">
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="can-focus">1</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>
</object>
@@ -123,7 +113,6 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="valign">center</property>
<property name="halign">center</property>
<style>
@@ -132,17 +121,15 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">And I'm another button</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="label" translatable="yes">And I&apos;m another button</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
<packing>
<property name="position">1</property>
@@ -151,9 +138,8 @@
<child>
<object class="GtkButton">
<property name="label" translatable="yes">This is a button party!</property>
<property name="visible">1</property>
<property name="can_focus">1</property>
<property name="receives_default">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
<packing>
<property name="position">2</property>
@@ -163,19 +149,16 @@
</child>
<child>
<object class="GtkToolbar">
<property name="visible">1</property>
<property name="hexpand">1</property>
<property name="icon_size">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use_underline">1</property>
<property name="icon_name">list-add-symbolic</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
<packing>
<property name="homogeneous">1</property>
@@ -183,10 +166,9 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use_underline">1</property>
<property name="icon_name">list-add-symbolic</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
<packing>
<property name="homogeneous">1</property>
@@ -195,8 +177,8 @@
<child>
<object class="GtkToggleToolButton">
<property name="label" translatable="yes">Active</property>
<property name="use_underline">1</property>
<property name="icon_name">list-remove-symbolic</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
<packing>
@@ -205,10 +187,9 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use_underline">1</property>
<property name="icon_name">list-remove-symbolic</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
<packing>
@@ -217,11 +198,10 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use_underline">1</property>
<property name="icon_name">edit-find-symbolic</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing>
<property name="homogeneous">1</property>
@@ -229,11 +209,10 @@
</child>
<child>
<object class="GtkToggleToolButton">
<property name="visible">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use_underline">1</property>
<property name="icon_name">go-up-symbolic</property>
<property name="use-underline">1</property>
<property name="icon-name">go-up-symbolic</property>
<property name="active">1</property>
</object>
<packing>
@@ -244,12 +223,9 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="spacing">10</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Plain</property>
<property name="halign">end</property>
<property name="hexpand">1</property>
@@ -258,7 +234,6 @@
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Destructive</property>
<style>
<class name="destructive-action"/>
@@ -267,7 +242,6 @@
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Suggested</property>
<style>
<class name="suggested-action"/>

View File

@@ -1,795 +0,0 @@
/* Tool Palette
*
* A tool palette widget shows groups of toolbar items as a grid of icons
* or a list of names.
*/
#include <string.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static void load_icon_items (GtkToolPalette *palette);
static void load_toggle_items (GtkToolPalette *palette);
static void load_special_items (GtkToolPalette *palette);
typedef struct _CanvasItem CanvasItem;
struct _CanvasItem
{
GdkPixbuf *pixbuf;
gdouble x, y;
};
static gboolean drag_data_requested_for_drop = FALSE;
static CanvasItem *drop_item = NULL;
static GList *canvas_items = NULL;
/********************************/
/* ====== Canvas drawing ====== */
/********************************/
static CanvasItem*
canvas_item_new (GtkWidget *widget,
GtkToolButton *button,
gdouble x,
gdouble y)
{
CanvasItem *item = NULL;
const gchar *icon_name;
GdkPixbuf *pixbuf;
GtkIconTheme *icon_theme;
icon_name = gtk_tool_button_get_icon_name (button);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
pixbuf = gtk_icon_theme_load_icon (icon_theme,
icon_name,
48,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
if (pixbuf)
{
item = g_slice_new0 (CanvasItem);
item->pixbuf = pixbuf;
item->x = x;
item->y = y;
}
return item;
}
static void
canvas_item_free (CanvasItem *item)
{
g_object_unref (item->pixbuf);
g_slice_free (CanvasItem, item);
}
static void
canvas_item_draw (const CanvasItem *item,
cairo_t *cr,
gboolean preview)
{
gdouble cx = gdk_pixbuf_get_width (item->pixbuf);
gdouble cy = gdk_pixbuf_get_height (item->pixbuf);
gdk_cairo_set_source_pixbuf (cr,
item->pixbuf,
item->x - cx * 0.5,
item->y - cy * 0.5);
if (preview)
cairo_paint_with_alpha (cr, 0.6);
else
cairo_paint (cr);
}
static gboolean
canvas_draw (GtkWidget *widget,
cairo_t *cr)
{
GList *iter;
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
for (iter = canvas_items; iter; iter = iter->next)
canvas_item_draw (iter->data, cr, FALSE);
if (drop_item)
canvas_item_draw (drop_item, cr, TRUE);
return TRUE;
}
/*****************************/
/* ====== Palette DnD ====== */
/*****************************/
static void
palette_drop_item (GtkToolItem *drag_item,
GtkToolItemGroup *drop_group,
gint x,
gint y)
{
GtkWidget *drag_group = gtk_widget_get_parent (GTK_WIDGET (drag_item));
GtkToolItem *drop_item = gtk_tool_item_group_get_drop_item (drop_group, x, y);
gint drop_position = -1;
if (drop_item)
drop_position = gtk_tool_item_group_get_item_position (GTK_TOOL_ITEM_GROUP (drop_group), drop_item);
if (GTK_TOOL_ITEM_GROUP (drag_group) != drop_group)
{
gboolean homogeneous, expand, fill, new_row;
g_object_ref (drag_item);
gtk_container_child_get (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item),
"homogeneous", &homogeneous,
"expand", &expand,
"fill", &fill,
"new-row", &new_row,
NULL);
gtk_container_remove (GTK_CONTAINER (drag_group), GTK_WIDGET (drag_item));
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (drop_group),
drag_item, drop_position);
gtk_container_child_set (GTK_CONTAINER (drop_group), GTK_WIDGET (drag_item),
"homogeneous", homogeneous,
"expand", expand,
"fill", fill,
"new-row", new_row,
NULL);
g_object_unref (drag_item);
}
else
gtk_tool_item_group_set_item_position (GTK_TOOL_ITEM_GROUP (drop_group),
drag_item, drop_position);
}
static void
palette_drop_group (GtkToolPalette *palette,
GtkToolItemGroup *drag_group,
GtkToolItemGroup *drop_group)
{
gint drop_position = -1;
if (drop_group)
drop_position = gtk_tool_palette_get_group_position (palette, drop_group);
gtk_tool_palette_set_group_position (palette, drag_group, drop_position);
}
static void
palette_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection,
guint time,
gpointer data)
{
GtkAllocation allocation;
GtkToolItemGroup *drop_group = NULL;
GtkWidget *drag_palette = gtk_drag_get_source_widget (context);
GtkWidget *drag_item = NULL;
while (drag_palette && !GTK_IS_TOOL_PALETTE (drag_palette))
drag_palette = gtk_widget_get_parent (drag_palette);
if (drag_palette)
{
drag_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (drag_palette),
selection);
drop_group = gtk_tool_palette_get_drop_group (GTK_TOOL_PALETTE (widget),
x, y);
}
if (GTK_IS_TOOL_ITEM_GROUP (drag_item))
palette_drop_group (GTK_TOOL_PALETTE (drag_palette),
GTK_TOOL_ITEM_GROUP (drag_item),
drop_group);
else if (GTK_IS_TOOL_ITEM (drag_item) && drop_group)
{
gtk_widget_get_allocation (GTK_WIDGET (drop_group), &allocation);
palette_drop_item (GTK_TOOL_ITEM (drag_item),
drop_group,
x - allocation.x,
y - allocation.y);
}
}
/********************************/
/* ====== Passive Canvas ====== */
/********************************/
static void
passive_canvas_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection,
guint time,
gpointer data)
{
/* find the tool button, which is the source of this DnD operation */
GtkWidget *palette = gtk_drag_get_source_widget (context);
CanvasItem *canvas_item = NULL;
GtkWidget *tool_item = NULL;
while (palette && !GTK_IS_TOOL_PALETTE (palette))
palette = gtk_widget_get_parent (palette);
if (palette)
tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
selection);
g_assert (NULL == drop_item);
/* append a new canvas item when a tool button was found */
if (GTK_IS_TOOL_ITEM (tool_item))
canvas_item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
if (canvas_item)
{
canvas_items = g_list_append (canvas_items, canvas_item);
gtk_widget_queue_draw (widget);
}
}
/************************************/
/* ====== Interactive Canvas ====== */
/************************************/
static gboolean
interactive_canvas_drag_motion (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
if (drop_item)
{
/* already have a drop indicator - just update position */
drop_item->x = x;
drop_item->y = y;
gtk_widget_queue_draw (widget);
gdk_drag_status (context, GDK_ACTION_COPY, time);
}
else
{
/* request DnD data for creating a drop indicator */
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
if (!target)
return FALSE;
drag_data_requested_for_drop = FALSE;
gtk_drag_get_data (widget, context, target, time);
}
return TRUE;
}
static void
interactive_canvas_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
GtkSelectionData *selection,
guint time,
gpointer data)
{
/* find the tool button which is the source of this DnD operation */
GtkWidget *palette = gtk_drag_get_source_widget (context);
GtkWidget *tool_item = NULL;
CanvasItem *item;
while (palette && !GTK_IS_TOOL_PALETTE (palette))
palette = gtk_widget_get_parent (palette);
if (palette)
tool_item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
selection);
/* create a canvas item when a tool button was found */
g_assert (NULL == drop_item);
if (!GTK_IS_TOOL_ITEM (tool_item))
return;
if (drop_item)
{
canvas_item_free (drop_item);
drop_item = NULL;
}
item = canvas_item_new (widget, GTK_TOOL_BUTTON (tool_item), x, y);
/* Either create a new item or just create a preview item,
depending on why the drag data was requested. */
if(drag_data_requested_for_drop)
{
canvas_items = g_list_append (canvas_items, item);
drop_item = NULL;
gtk_drag_finish (context, TRUE, time);
} else
{
drop_item = item;
gdk_drag_status (context, GDK_ACTION_COPY, time);
}
gtk_widget_queue_draw (widget);
}
static gboolean
interactive_canvas_drag_drop (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
guint time,
gpointer data)
{
GdkAtom target = gtk_drag_dest_find_target (widget, context, NULL);
if (!target)
return FALSE;
drag_data_requested_for_drop = TRUE;
gtk_drag_get_data (widget, context, target, time);
return FALSE;
}
static void
interactive_canvas_drag_leave (gpointer data)
{
if (drop_item)
{
GtkWidget *widget = GTK_WIDGET (data);
canvas_item_free (drop_item);
drop_item = NULL;
if (widget)
gtk_widget_queue_draw (widget);
}
}
static void
on_combo_orientation_changed (GtkComboBox *combo_box,
gpointer user_data)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
GtkScrolledWindow *sw;
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
GtkTreeIter iter;
gint val = 0;
sw = GTK_SCROLLED_WINDOW (gtk_widget_get_parent (GTK_WIDGET (palette)));
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
return;
gtk_tree_model_get (model, &iter, 1, &val, -1);
gtk_orientable_set_orientation (GTK_ORIENTABLE (palette), val);
if (val == GTK_ORIENTATION_HORIZONTAL)
gtk_scrolled_window_set_policy (sw, GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
else
gtk_scrolled_window_set_policy (sw, GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
}
static void
on_combo_style_changed (GtkComboBox *combo_box,
gpointer user_data)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (user_data);
GtkTreeModel *model = gtk_combo_box_get_model (combo_box);
GtkTreeIter iter;
gint val = 0;
if (!gtk_combo_box_get_active_iter (combo_box, &iter))
return;
gtk_tree_model_get (model, &iter, 1, &val, -1);
if (val == -1)
gtk_tool_palette_unset_style (palette);
else
gtk_tool_palette_set_style (palette, val);
}
GtkWidget *
do_toolpalette (GtkWidget *do_widget)
{
GtkWidget *box = NULL;
GtkWidget *hbox = NULL;
GtkWidget *combo_orientation = NULL;
GtkListStore *orientation_model = NULL;
GtkWidget *combo_style = NULL;
GtkListStore *style_model = NULL;
GtkCellRenderer *cell_renderer = NULL;
GtkTreeIter iter;
GtkWidget *palette = NULL;
GtkWidget *palette_scroller = NULL;
GtkWidget *notebook = NULL;
GtkWidget *contents = NULL;
GtkWidget *contents_scroller = NULL;
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), "Tool Palette");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 600);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
/* Add widgets to control the ToolPalette appearance: */
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
g_object_set (box, "margin", 6, NULL);
gtk_container_add (GTK_CONTAINER (window), box);
/* Orientation combo box: */
orientation_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_list_store_append (orientation_model, &iter);
gtk_list_store_set (orientation_model, &iter,
0, "Horizontal",
1, GTK_ORIENTATION_HORIZONTAL,
-1);
gtk_list_store_append (orientation_model, &iter);
gtk_list_store_set (orientation_model, &iter,
0, "Vertical",
1, GTK_ORIENTATION_VERTICAL,
-1);
combo_orientation =
gtk_combo_box_new_with_model (GTK_TREE_MODEL (orientation_model));
cell_renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_orientation),
cell_renderer,
TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_orientation),
cell_renderer,
"text", 0,
NULL);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_orientation), &iter);
gtk_box_pack_start (GTK_BOX (box), combo_orientation);
/* Style combo box: */
style_model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_list_store_append (style_model, &iter);
gtk_list_store_set (style_model, &iter,
0, "Text",
1, GTK_TOOLBAR_TEXT,
-1);
gtk_list_store_append (style_model, &iter);
gtk_list_store_set (style_model, &iter,
0, "Both",
1, GTK_TOOLBAR_BOTH,
-1);
gtk_list_store_append (style_model, &iter);
gtk_list_store_set (style_model, &iter,
0, "Both: Horizontal",
1, GTK_TOOLBAR_BOTH_HORIZ,
-1);
gtk_list_store_append (style_model, &iter);
gtk_list_store_set (style_model, &iter,
0, "Icons",
1, GTK_TOOLBAR_ICONS,
-1);
gtk_list_store_append (style_model, &iter);
gtk_list_store_set (style_model, &iter,
0, "Default",
1, -1, /* A custom meaning for this demo. */
-1);
combo_style = gtk_combo_box_new_with_model (GTK_TREE_MODEL (style_model));
cell_renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_style),
cell_renderer,
TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_style),
cell_renderer,
"text", 0,
NULL);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_style), &iter);
gtk_box_pack_start (GTK_BOX (box), combo_style);
/* Add hbox */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
gtk_box_pack_start (GTK_BOX (box), hbox);
/* Add and fill the ToolPalette: */
palette = gtk_tool_palette_new ();
load_icon_items (GTK_TOOL_PALETTE (palette));
load_toggle_items (GTK_TOOL_PALETTE (palette));
load_special_items (GTK_TOOL_PALETTE (palette));
palette_scroller = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_vexpand (palette_scroller, TRUE);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (palette_scroller),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
g_object_set (palette_scroller, "margin", 6, NULL);
gtk_widget_set_hexpand (palette_scroller, TRUE);
gtk_container_add (GTK_CONTAINER (palette_scroller), palette);
gtk_container_add (GTK_CONTAINER (hbox), palette_scroller);
/* Connect signals: */
g_signal_connect (combo_orientation, "changed",
G_CALLBACK (on_combo_orientation_changed), palette);
g_signal_connect (combo_style, "changed",
G_CALLBACK (on_combo_style_changed), palette);
/* Keep the widgets in sync: */
on_combo_orientation_changed (GTK_COMBO_BOX (combo_orientation), palette);
/* ===== notebook ===== */
notebook = gtk_notebook_new ();
g_object_set (notebook, "margin", 6, NULL);
gtk_box_pack_end (GTK_BOX(hbox), notebook);
/* ===== DnD for tool items ===== */
g_signal_connect (palette, "drag-data-received",
G_CALLBACK (palette_drag_data_received), NULL);
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
palette,
GTK_DEST_DEFAULT_ALL,
GTK_TOOL_PALETTE_DRAG_ITEMS |
GTK_TOOL_PALETTE_DRAG_GROUPS,
GDK_ACTION_MOVE);
/* ===== passive DnD dest ===== */
contents = gtk_drawing_area_new ();
g_object_connect (contents,
"draw", canvas_draw, NULL,
"drag-data-received", passive_canvas_drag_data_received, NULL,
NULL);
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
contents,
GTK_DEST_DEFAULT_ALL,
GTK_TOOL_PALETTE_DRAG_ITEMS,
GDK_ACTION_COPY);
contents_scroller = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
gtk_container_add (GTK_CONTAINER (contents_scroller), contents);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
contents_scroller,
gtk_label_new ("Passive DnD Mode"));
g_object_set (contents_scroller, "margin", 6, NULL);
/* ===== interactive DnD dest ===== */
contents = gtk_drawing_area_new ();
g_object_connect (contents,
"draw", canvas_draw, NULL,
"drag-motion", interactive_canvas_drag_motion, NULL,
"drag-data-received", interactive_canvas_drag_data_received, NULL,
"drag-leave", interactive_canvas_drag_leave, contents,
"drag-drop", interactive_canvas_drag_drop, NULL,
NULL);
gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette),
contents,
GTK_DEST_DEFAULT_HIGHLIGHT,
GTK_TOOL_PALETTE_DRAG_ITEMS,
GDK_ACTION_COPY);
contents_scroller = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (contents_scroller),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
gtk_container_add (GTK_CONTAINER (contents_scroller), contents);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), contents_scroller,
gtk_label_new ("Interactive DnD Mode"));
}
if (!gtk_widget_get_visible (window))
{
gtk_widget_show (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
static void
load_icon_items (GtkToolPalette *palette)
{
GList *contexts;
GList *l;
GtkIconTheme *icon_theme;
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (palette)));
contexts = gtk_icon_theme_list_contexts (icon_theme);
for (l = contexts; l; l = l->next)
{
gchar *context = l->data;
GList *icon_names;
GList *ll;
const guint max_icons = 10;
guint icons_count = 0;
GtkWidget *group = gtk_tool_item_group_new (context);
gtk_container_add (GTK_CONTAINER (palette), group);
if (g_strcmp0 (context, "Animations") == 0)
continue;
g_message ("Got context '%s'", context);
icon_names = gtk_icon_theme_list_icons (icon_theme, context);
icon_names = g_list_sort (icon_names, (GCompareFunc) strcmp);
for (ll = icon_names; ll; ll = ll->next)
{
GtkToolItem *item;
gchar *id = ll->data;
if (g_str_equal (id, "emblem-desktop"))
continue;
if (g_str_has_suffix (id, "-symbolic"))
continue;
g_message ("Got id '%s'", id);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), id);
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
/* Prevent us having an insane number of icons: */
++icons_count;
if(icons_count >= max_icons)
break;
}
g_list_free_full (icon_names, g_free);
}
g_list_free_full (contexts, g_free);
}
static void
load_toggle_items (GtkToolPalette *palette)
{
GSList *toggle_group = NULL;
GtkToolItem *item;
GtkWidget *group;
char *label;
int i;
group = gtk_tool_item_group_new ("Radio Item");
gtk_container_add (GTK_CONTAINER (palette), group);
for (i = 1; i <= 10; ++i)
{
label = g_strdup_printf ("#%d", i);
item = gtk_radio_tool_button_new (toggle_group);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), label);
g_free (label);
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
toggle_group = gtk_radio_tool_button_get_group (GTK_RADIO_TOOL_BUTTON (item));
}
}
static GtkToolItem *
create_entry_item (const char *text)
{
GtkToolItem *item;
GtkWidget *entry;
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), text);
gtk_entry_set_width_chars (GTK_ENTRY (entry), 5);
item = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (item), entry);
return item;
}
static void
load_special_items (GtkToolPalette *palette)
{
GtkToolItem *item;
GtkWidget *group;
GtkWidget *label_button;
group = gtk_tool_item_group_new (NULL);
label_button = gtk_button_new_with_label ("Advanced Features");
gtk_widget_show (label_button);
gtk_tool_item_group_set_label_widget (GTK_TOOL_ITEM_GROUP (group),
label_button);
gtk_container_add (GTK_CONTAINER (palette), group);
item = create_entry_item ("homogeneous=FALSE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, NULL);
item = create_entry_item ("homogeneous=FALSE, expand=TRUE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, "expand", TRUE,
NULL);
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, fill=FALSE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, "expand", TRUE,
"fill", FALSE, NULL);
item = create_entry_item ("homogeneous=FALSE, expand=TRUE, new-row=TRUE");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE, "expand", TRUE,
"new-row", TRUE, NULL);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-up");
gtk_tool_item_set_tooltip_text (item, "Show on vertical palettes only");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_tool_item_set_visible_horizontal (item, FALSE);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next");
gtk_tool_item_set_tooltip_text (item, "Show on horizontal palettes only");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_tool_item_set_visible_vertical (item, FALSE);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "edit-delete");
gtk_tool_item_set_tooltip_text (item, "Do not show at all");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_widget_hide (GTK_WIDGET (item));
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "view-fullscreen");
gtk_tool_item_set_tooltip_text (item, "Expanded this item");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
gtk_container_child_set (GTK_CONTAINER (group), GTK_WIDGET (item),
"homogeneous", FALSE,
"expand", TRUE,
NULL);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "help-browser");
gtk_tool_item_set_tooltip_text (item, "A regular item");
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
}

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,359 +0,0 @@
/* 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.
*/
#include <gtk/gtk.h>
#include "gtkfishbowl.h"
GtkWidget *fishbowl;
static GtkWidget *
create_button (void)
{
return gtk_button_new_with_label ("Button");;
}
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
}
static GtkWidget *
create_level_bar (void)
{
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
/* Force them to be a bit larger */
gtk_widget_set_size_request (w, 200, -1);
return w;
}
static GtkWidget *
create_spinner (void)
{
GtkWidget *w = gtk_spinner_new ();
gtk_spinner_start (GTK_SPINNER (w));
return w;
}
static GtkWidget *
create_spinbutton (void)
{
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
return w;
}
static GtkWidget *
create_label (void)
{
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
return w;
}
static const struct {
const char *name;
GtkWidget * (*create_func) (void);
} widget_types[] = {
{ "Button", create_button },
{ "Fontbutton", create_font_button },
{ "Levelbar" , create_level_bar },
{ "Label" , create_label },
{ "Spinner" , create_spinner },
{ "Spinbutton", create_spinbutton },
};
static int selected_widget_type = -1;
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
#define N_STATS 5
#define STATS_UPDATE_TIME G_USEC_PER_SEC
static void
set_widget_type (GtkWidget *headerbar,
int widget_type_index)
{
GList *children, *l;
if (widget_type_index == selected_widget_type)
return;
/* Remove everything */
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
for (l = children; l; l = l->next)
{
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget*)l->data);
}
g_list_free (children);
selected_widget_type = widget_type_index;
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
widget_types[selected_widget_type].name);
}
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 *
get_stats (GtkWidget *widget)
{
static GQuark stats_quark = 0;
Stats *stats;
if (G_UNLIKELY (stats_quark == 0))
stats_quark = g_quark_from_static_string ("stats");
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
if (stats == NULL)
{
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 void
do_stats (GtkWidget *widget,
GtkWidget *info_label,
gint *suggested_change)
{
Stats *stats;
gint64 frame_time;
stats = get_stats (widget);
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
{
char *new_label;
guint i, n_frames;
n_frames = 0;
for (i = 0; i < N_STATS; i++)
{
n_frames += stats->frame_counter[i];
}
new_label = g_strdup_printf ("widgets - %.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);
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;
}
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;
else
stats->last_suggestion = 0;
}
else
{
if (suggested_change)
*suggested_change = 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));
}
static gboolean
move_fish (GtkWidget *bowl,
GdkFrameClock *frame_clock,
gpointer info_label)
{
gint suggested_change = 0;
do_stats (bowl, info_label, &suggested_change);
if (suggested_change > 0)
{
int i;
for (i = 0; i < suggested_change; i ++)
{
GtkWidget *new_widget = widget_types[selected_widget_type].create_func ();
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
}
}
else if (suggested_change < 0)
{
GList *children, *l;
int n_removed = 0;
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
for (l = children; l; l = l->next)
{
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget *)l->data);
n_removed ++;
if (n_removed >= (-suggested_change))
break;
}
g_list_free (children);
}
stats_update (bowl);
return G_SOURCE_CONTINUE;
}
static void
next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkWidget *headerbar = user_data;
int new_index;
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = selected_widget_type + 1;
set_widget_type (headerbar, new_index);
}
static void
prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkWidget *headerbar = user_data;
int new_index;
if (selected_widget_type - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected_widget_type - 1;
set_widget_type (headerbar, new_index);
}
GtkWidget *
do_widgetbowl (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *info_label;
GtkWidget *count_label;
GtkWidget *titlebar;
GtkWidget *title_box;
GtkWidget *left_box;
GtkWidget *next_button;
GtkWidget *prev_button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
titlebar = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (titlebar), TRUE);
info_label = gtk_label_new ("widget - 00.0 fps");
count_label = gtk_label_new ("0");
fishbowl = gtk_fishbowl_new ();
title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
prev_button = gtk_button_new_from_icon_name ("pan-start-symbolic");
next_button = gtk_button_new_from_icon_name ("pan-end-symbolic");
left_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
g_object_bind_property (fishbowl, "count", count_label, "label", 0);
g_signal_connect (next_button, "clicked", G_CALLBACK (next_button_clicked_cb), titlebar);
g_signal_connect (prev_button, "clicked", G_CALLBACK (prev_button_clicked_cb), titlebar);
gtk_fishbowl_set_animating (GTK_FISHBOWL (fishbowl), TRUE);
gtk_widget_set_hexpand (title_box, TRUE);
gtk_widget_set_halign (title_box, GTK_ALIGN_END);
gtk_window_set_titlebar (GTK_WINDOW (window), titlebar);
gtk_container_add (GTK_CONTAINER (title_box), count_label);
gtk_container_add (GTK_CONTAINER (title_box), info_label);
gtk_header_bar_pack_end (GTK_HEADER_BAR (titlebar), title_box);
gtk_container_add (GTK_CONTAINER (window), fishbowl);
gtk_style_context_add_class (gtk_widget_get_style_context (left_box), "linked");
gtk_container_add (GTK_CONTAINER (left_box), prev_button);
gtk_container_add (GTK_CONTAINER (left_box), next_button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (titlebar), left_box);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_widget_realize (window);
gtk_widget_add_tick_callback (fishbowl, move_fish, info_label, NULL);
set_widget_type (titlebar, 0);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -32,7 +32,7 @@ media-view-subtitles=The icon used to show subtitles in a media player
[network]
Name=Network
Description=Icons related to network status");
Description=Icons related to network status
network-transmit-receive=The icon used data is being both transmitted and received simultaneously, while the computing device is connected to a network
network-transmit=The icon used when data is being transmitted, while the computing device is connected to a network

View File

@@ -286,13 +286,16 @@ populate (IconBrowserWindow *win)
}
static gboolean
key_press_event_cb (GtkWidget *widget,
GdkEvent *event,
gpointer data)
key_event_cb (GtkEventController *controller,
guint keyval,
guint keycode,
GdkModifierType state,
gpointer data)
{
IconBrowserWindow *win = data;
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar), event);
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar),
gtk_get_current_event ());
}
static void
@@ -451,6 +454,7 @@ static void
icon_browser_window_init (IconBrowserWindow *win)
{
GdkContentFormats *list;
GtkEventController *controller;
gtk_widget_init_template (GTK_WIDGET (win));
@@ -467,6 +471,7 @@ icon_browser_window_init (IconBrowserWindow *win)
setup_image_dnd (win->image3);
setup_image_dnd (win->image4);
setup_image_dnd (win->image5);
setup_image_dnd (win->image6);
setup_scalable_image_dnd (win->image6);
win->contexts = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, context_free);
@@ -479,12 +484,30 @@ icon_browser_window_init (IconBrowserWindow *win)
symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
gtk_widget_add_controller (GTK_WIDGET (win), controller);
populate (win);
}
static void
icon_browser_window_finalize (GObject *object)
{
IconBrowserWindow *win = ICON_BROWSER_WINDOW (object);
g_hash_table_unref (win->contexts);
G_OBJECT_CLASS (icon_browser_window_parent_class)->finalize (object);
}
static void
icon_browser_window_class_init (IconBrowserWindowClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = icon_browser_window_finalize;
g_type_ensure (ICON_STORE_TYPE);
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
@@ -515,7 +538,6 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), item_activated);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), selected_context_changed);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), key_press_event_cb);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), copy_to_clipboard);
}

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

@@ -1,38 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.8 -->
<object class="IconStore" id="store">
</object>
<object class="IconStore" id="store"/>
<object class="GtkTreeModelFilter" id="filter_model">
<property name="child_model">store</property>
<property name="child-model">store</property>
</object>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<signal name="key-press-event" handler="key_press_event_cb"/>
<child type="titlebar">
<object class="GtkHeaderBar" id="header">
<property name="visible">True</property>
<property name="title" translatable="yes">Icon Browser</property>
<property name="show-title-buttons">True</property>
<property name="show-title-buttons">1</property>
<child type="title">
<object class="GtkBox">
<property name="visible">True</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkRadioButton" id="normal_radio">
<property name="visible">True</property>
<property name="draw_indicator">False</property>
<property name="draw-indicator">0</property>
<property name="label" translatable="yes">Normal</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="symbolic_radio">
<property name="visible">True</property>
<property name="draw_indicator">False</property>
<property name="draw-indicator">0</property>
<property name="label" translatable="yes">Symbolic</property>
<property name="group">normal_radio</property>
<signal name="toggled" handler="symbolic_toggled"/>
@@ -42,13 +36,11 @@
</child>
<child>
<object class="GtkToggleButton" id="search">
<property name="visible">True</property>
<style>
<class name="image-button"/>
</style>
<child>
<object class="GtkImage" id="search-icon">
<property name="visible">True</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
</child>
@@ -61,32 +53,24 @@
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkListBox" id="context_list">
<property name="visible">True</property>
<property name="selection_mode">single</property>
<signal name="selected-rows-changed" handler="selected_context_changed"/>
</object>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox" id="content_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="visible">True</property>
<property name="search-mode-enabled" bind-source="search" bind-property="active" bind-flags="bidirectional"/>
<child>
<object class="GtkSearchEntry" id="searchentry">
<property name="visible">True</property>
<signal name="search-changed" handler="search_text_changed"/>
</object>
</child>
@@ -94,29 +78,24 @@
</child>
<child>
<object class="GtkScrolledWindow" id="sw">
<property name="visible">True</property>
<property name="expand">True</property>
<property name="expand">1</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<child>
<object class="GtkIconView" id="list">
<property name="visible">True</property>
<property name="model">filter_model</property>
<property name="selection-mode">none</property>
<property name="activate-on-single-click">True</property>
<property name="activate-on-single-click">1</property>
<signal name="item_activated" handler="item_activated"/>
<child>
<object class="GtkCellRendererPixbuf" id="cell">
<property name="xpad">10</property>
<property name="ypad">10</property>
<property name="stock-size">6</property>
</object>
</child>
<child>
<object class="GtkCellRendererText" id="text_cell">
<property name="xpad">10</property>
<property name="ypad">10</property>
<property name="xalign">0.5</property>
</object>
</child>
</object>
@@ -137,24 +116,25 @@
</widgets>
</object>
<object class="GtkDialog" id="details">
<property name="modal">True</property>
<property name="modal">1</property>
<property name="use-header-bar">1</property>
<property name="resizable">False</property>
<signal name="delete-event" handler="gtk_widget_hide_on_delete"/>
<property name="resizable">0</property>
<property name="hide-on-close">1</property>
<child internal-child="vbox">
<object class="GtkBox">
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="margin">10</property>
<property name="row-spacing">18</property>
<property name="column-spacing">18</property>
<property name="halign">center</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<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>
@@ -163,9 +143,11 @@
</child>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<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>
@@ -174,9 +156,11 @@
</child>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<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>
@@ -185,9 +169,11 @@
</child>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<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>
@@ -196,9 +182,11 @@
</child>
<child>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<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>
@@ -207,25 +195,28 @@
</child>
<child>
<object class="GtkImage" id="image6">
<property name="visible">True</property>
<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>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">16×16</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image1"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
@@ -234,13 +225,15 @@
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">24×24</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image2"/>
</accessibility>
</object>
<packing>
<property name="left-attach">1</property>
@@ -249,13 +242,15 @@
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">32×32</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image3"/>
</accessibility>
</object>
<packing>
<property name="left-attach">2</property>
@@ -264,13 +259,15 @@
</child>
<child>
<object class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">48×48</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image4"/>
</accessibility>
</object>
<packing>
<property name="left-attach">3</property>
@@ -279,13 +276,15 @@
</child>
<child>
<object class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">64×64</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image5"/>
</accessibility>
</object>
<packing>
<property name="left-attach">4</property>
@@ -294,13 +293,15 @@
</child>
<child>
<object class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">scalable</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image6"/>
</accessibility>
</object>
<packing>
<property name="left-attach">5</property>
@@ -311,7 +312,6 @@
</child>
<child>
<object class="GtkButton">
<property name="visible">True</property>
<property name="label" translatable="yes">Copy to Clipboard</property>
<property name="halign">center</property>
<property name="valign">center</property>
@@ -322,8 +322,7 @@
<child>
<object class="GtkLabel" id="description">
<property name="margin">10</property>
<property name="visible">True</property>
<property name="wrap">True</property>
<property name="wrap">1</property>
<property name="max-width-chars">60</property>
<property name="valign">start</property>
</object>

View File

@@ -2,28 +2,23 @@
<object class="GtkShortcutsWindow" id="help_overlay">
<child>
<object class="GtkShortcutsSection">
<property name="visible">1</property>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title">General</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">F1</property>
<property name="title">Show About Dialog</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;q</property>
<property name="title">Quit</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;d</property>
<property name="title">Switch to dark theme</property>
</object>
@@ -32,26 +27,22 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title">Traditional</property>
<property name="view">page2</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;s</property>
<property name="title">Search</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">Delete</property>
<property name="title">Delete</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;b</property>
<property name="title">Set background</property>
</object>
@@ -60,26 +51,22 @@
</child>
<child>
<object class="GtkShortcutsGroup">
<property name="visible">1</property>
<property name="title">Modern</property>
<property name="view">page3</property>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;o</property>
<property name="title">Open a file</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;r</property>
<property name="title">Start recording</property>
</object>
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">1</property>
<property name="accelerator">&lt;Primary&gt;l</property>
<property name="title">Lock or unlock</property>
</object>

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);
@@ -1082,7 +1082,7 @@ set_accel (GtkApplication *app, GtkWidget *widget)
typedef struct
{
GtkTextView tv;
cairo_surface_t *surface;
GdkPixbuf *pixbuf;
} MyTextView;
typedef GtkTextViewClass MyTextViewClass;
@@ -1101,10 +1101,10 @@ my_tv_draw_layer (GtkTextView *widget,
{
MyTextView *tv = (MyTextView *)widget;
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->surface)
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->pixbuf)
{
cairo_save (cr);
cairo_set_source_surface (cr, tv->surface, 0.0, 0.0);
gdk_cairo_set_source_pixbuf (cr, tv->pixbuf, 0.0, 0.0);
cairo_paint_with_alpha (cr, 0.333);
cairo_restore (cr);
}
@@ -1115,8 +1115,7 @@ my_tv_finalize (GObject *object)
{
MyTextView *tv = (MyTextView *)object;
if (tv->surface)
cairo_surface_destroy (tv->surface);
g_clear_object (&tv->pixbuf);
G_OBJECT_CLASS (my_text_view_parent_class)->finalize (object);
}
@@ -1134,18 +1133,14 @@ my_text_view_class_init (MyTextViewClass *class)
static void
my_text_view_set_background (MyTextView *tv, const gchar *filename)
{
GdkPixbuf *pixbuf;
GError *error = NULL;
if (tv->surface)
cairo_surface_destroy (tv->surface);
tv->surface = NULL;
g_clear_object (&tv->pixbuf);
if (filename == NULL)
return;
pixbuf = gdk_pixbuf_new_from_file (filename, &error);
tv->pixbuf = gdk_pixbuf_new_from_file (filename, &error);
if (error)
{
g_warning ("%s", error->message);
@@ -1153,10 +1148,6 @@ my_text_view_set_background (MyTextView *tv, const gchar *filename)
return;
}
tv->surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
g_object_unref (pixbuf);
gtk_widget_queue_draw (GTK_WIDGET (tv));
}
@@ -1278,8 +1269,13 @@ textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *butt
}
static gboolean
osd_frame_button_press (GtkWidget *frame, GdkEventButton *event, gpointer data)
osd_frame_pressed (GtkGestureMultiPress *gesture,
int press,
double x,
double y,
gpointer data)
{
GtkWidget *frame = data;
GtkWidget *osd;
gboolean visible;
@@ -1609,6 +1605,27 @@ adjustment3_value_changed (GtkAdjustment *adj, GtkProgressBar *pbar)
gtk_progress_bar_set_fraction (pbar, fraction);
}
static void
settings__notify_gtk_theme_name (GObject *gobject,
GParamSpec *pspec,
gpointer data)
{
GtkWidget *window = data;
char *theme_name = NULL;
g_object_get (gobject, "gtk-theme-name", &theme_name, NULL);
if (g_strcmp0 (theme_name, "Adwaita") == 0)
{
if (gtk_get_minor_version () % 2 != 0)
gtk_style_context_add_class (gtk_widget_get_style_context (window), "devel");
}
else
gtk_style_context_remove_class (gtk_widget_get_style_context (window), "devel");
g_free (theme_name);
}
static void
activate (GApplication *app)
{
@@ -1668,13 +1685,13 @@ activate (GApplication *app)
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
gtk_builder_add_callback_symbol (builder, "osd_frame_button_press", (GCallback)osd_frame_button_press);
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
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);
@@ -1684,6 +1701,13 @@ activate (GApplication *app)
win_entries, G_N_ELEMENTS (win_entries),
window);
g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
G_CALLBACK (settings__notify_gtk_theme_name),
window);
settings__notify_gtk_theme_name (G_OBJECT (gtk_settings_get_default ()),
NULL,
window);
for (i = 0; i < G_N_ELEMENTS (accels); i++)
gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);

View File

@@ -24,3 +24,14 @@
.border-ridge {
border-width: 2px;
}
window.devel headerbar {
background: #cbd2d9 -gtk-icontheme("system-run-symbolic") 70% 0/64px 64px no-repeat, linear-gradient(to left, #a5b1bd 0%, #a5b1bd 8%, @theme_bg_color 25%);
box-shadow: inset 0 1px #f1f3f5;
border-color: #909fae;
color: rgba(46, 52, 54, 0.2);
}
window.devel headerbar label {
color: @theme_fg_color;
}

File diff suppressed because it is too large Load Diff

68
docs/CODE-OWNERS Normal file
View File

@@ -0,0 +1,68 @@
# These are the people responsible for subsystems in GTK; if you're opening
# a merge request for files listed here, please add the following people to
# the list of reviewers
# The syntax of this file is similar to the GitHub CODEOWNERS file:
# https://help.github.com/articles/about-codeowners/
# Which, in turn, is similar to the .gitignore and .gitattributes files:
#
# - comments start with `#`
# - the first column contains paths and globs
# - the second column contains GitLab user names or email addresses,
# separated by spaces
#
# If you want to be responsible for code reviews in specific sections of
# the GTK code base, add yourself here.
# Maintainer
* @matthiasc
# Build system
meson.build @ebassi @nirbheek
*.py @ebassi
# CSS
gtk/gtkcss*.[ch] @otte @baedert
gtk/gtkstyle*.[ch] @otte @baedert
# Gestures
gtk/gtkeventcontroller* @carlosg
gtk/gtkgesture*.[ch] @carlosg
# GtkFileChooser
gtk/gtkfilechooser* @federico
gtk/gtkfilesystem* @federico
gtk/gtkfilefilter* @federico
# GtkFontChooser
gtk/gtkfontchooser* @matthiasc
# Input methods
gtk/gtkimcontext* @carlosg
# Media
gtk/gtkmedia* @otte
# GSK
gsk @otte @baedert @ebassi
# GL rendering
gsk/gl @baedert @ebassi
# Vulkan rendering
gsk/vulkan
# Documentation
docs/ @ebassi @dboles
# Wayland
gdk/wayland @jadahl
# X11
gdk/x11 @ofourdan @matthiasc
# Themes
gtk/themes @lapoc @jimmac
# Inspector
gtk/inspector @otte @matthiasc

View File

@@ -439,41 +439,91 @@ Public headers should never be included directly:
#error "Only <gtk/gtk.h> can be included directly."
#endif
All headers should have inclusion guards (for internal usage)
and C++ guards:
Private headers should include the public header first, if one exists:
#ifndef __GTK_FOO_PRIVATE_H__
#define __GTK_FOO_PRIVATE_H__
#include "gtkfoo.h"
...
#endif /* __GTK_FOO_PRIVATE_H__ */
All headers should have inclusion guards:
#ifndef __GTK_FOO_H__
#define __GTK_FOO_H__
#include <gtk/gtk-bar.h>
...
#endif /* __GTK_FOO_H__ */
You can also use the "once" pragma instead of the classic pre-processor guard:
#pragma once
Additionally, public headers should use C++ guards around their declarations:
G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
GType gtk_foo_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget * gtk_foo_new (void);
...
G_END_DECLS
#endif /* __GTK_FOO_H__ */
+ Includes
GTK+ source files should never include the global gtk.h header, but
instead include the individual headers that are needed. Every file must
include config.h first, then its own header, then other GTK+ headers
that it needs, then system and third-party headers that it needs.
GTK+ source files must never include the global gtk.h header; instead, it
should include the individual headers that are needed.
Every source file must include config.h first, followed by the header matching
the source file, either the public installed header, or the private header, if
it exists.
/* valid */
#include "config.h"
#include "gtkfoo.h"
#include "gtkwidget.h"
Source files should then include project headers, in alphabetical order,
starting from headers in the current directory; then headers in
sub-directories; and, finally, in paths relative to the top-level
directory:
#include "config.h"
#include "gtkfooprivate.h"
#include "gtkbutton.h"
#include "gtkwidget.h"
...
#include "a11y/gtkwidgetaccessible.h"
#include "gdk/gdkwindowprivate.h"
Finally, source files should include the system headers last:
#include "config.h"
#include "gtkbarprivate.h"
#include "gtkcontainerprivate.h"
#include "a11y/gtkcontaineraccessible.h"
#include "a11y/gtkwidgetaccessible.h"
#include "gdk/gdkwindowprivate.h"
#include <graphene.h>
#include <string.h>
Cyclic dependencies should be avoided if at all possible; for instance, you
could use additional headers to break cycles.
+ GObject
@@ -484,7 +534,6 @@ Typedef declarations should be placed at the beginning of the file:
typedef struct _GtkFoo GtkFoo;
typedef struct _GtkFooClass GtkFooClass;
typedef struct _GtkFooPrivate GtkFooPrivate;
This includes enumeration types:
@@ -499,26 +548,21 @@ And callback types:
typedef void (* GtkCallback) (GtkWidget *widget,
gpointer user_data);
Instance structures should only contain the parent type, and optionally a
pointer to a private data structure, and they should be annotated as
"private" using the gtk-doc trigraph:
Instance structures should only contain the parent type:
struct _GtkFoo
{
/*< private >*/
GtkWidget parent_instance;
GtkFooPrivate *priv;
};
The private data pointer is optional and should be omitted in newly
written classes.
You should use the G_DECLARE_DERIVABLE_TYPE() and G_DECLARE_FINAL_TYPE()
macros in newly written headers.
Always use the G_DEFINE_TYPE(), G_DEFINE_TYPE_WITH_PRIVATE(), and
G_DEFINE_TYPE_WITH_CODE() macros, or their abstract variants
G_DEFINE_ABSTRACT_TYPE(), G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(), and
G_DEFINE_ABSTRACT_TYPE_WITH_CODE(); also, use the similar macros for
defining interfaces and boxed types.
Inside your source file, always use the G_DEFINE_TYPE(),
G_DEFINE_TYPE_WITH_PRIVATE(), and G_DEFINE_TYPE_WITH_CODE() macros, or their
abstract variants G_DEFINE_ABSTRACT_TYPE(),
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(), and G_DEFINE_ABSTRACT_TYPE_WITH_CODE();
also, use the similar macros for defining interfaces, quarks, and boxed types.
All the properties should be stored inside the private data structure, which
is defined inside the source file - or, if needed, inside a private header
@@ -526,14 +570,14 @@ file; the private header filename must end with "private.h" and must not be
installed.
The private data structure should only be accessed internally either using the
pointer inside the instance structure, if one is available, or the generated
pointer inside the instance structure, for legacy code, or the generated
instance private data getter function for your type. You should never use the
G_TYPE_INSTANCE_GET_PRIVATE() macro or the g_type_instance_get_private()
function.
Interface types should always have the dummy typedef for cast purposes:
typedef struct _GtkFoo GtkFoo;
typedef struct _GtkFoo GtkFoo;
The interface structure should have "Interface" postfixed to the dummy typedef:
@@ -564,19 +608,16 @@ Inline functions are usually preferable to private macros.
Public macros should not be used unless they evaluate to a constant.
+ Public API
+ Symbol visibility
Avoid exporting variables as public API, since this is cumbersome on some
Any symbol that is not explicitly annotated using a GDK_AVAILABLE_IN_*
macro is considered internal, and not exported in the shared library.
Never export variables as public API, since this is cumbersome on some
platforms. It is always preferable to add getters and setters instead.
All public functions must be listed in the gtk.symbols file.
+ Private API
Non-exported functions that are needed in more than one source file
should be named "_gtk_...", and declared in a private header file.
Underscore-prefixed functions are never exported.
should be declared in a private header file.
Non-exported functions that are only needed in one source file
should be declared static.
@@ -638,4 +679,4 @@ of tabs, etc.
It is ok to update the style of a code block or function when you
are touching it anyway, but sweeping whitespace changes obscure the
git history and should be avoided.
source revision history, and should be avoided.

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

@@ -71,9 +71,6 @@ straightforward manner.
void gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time);
void gdk_drop_reply (GdkDragContext *context,
gboolean ok,
guint32 time);
void gdk_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time);
@@ -81,19 +78,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

@@ -22,37 +22,35 @@
<xi:include href="xml/gdkdisplaymanager.xml" />
<xi:include href="xml/gdkdisplay.xml" />
<xi:include href="xml/gdkseat.xml" />
<xi:include href="xml/gdkmonitor.xml" />
<xi:include href="xml/gdkdevice.xml" />
<xi:include href="xml/gdkdevicepad.xml" />
<xi:include href="xml/gdkmonitor.xml" />
<xi:include href="xml/regions.xml" />
<xi:include href="xml/pixbufs.xml" />
<xi:include href="xml/textures.xml" />
<xi:include href="xml/gdkpaintable.xml" />
<xi:include href="xml/rgba_colors.xml" />
<xi:include href="xml/cursors.xml" />
<xi:include href="xml/windows.xml" />
<xi:include href="xml/gdksurface.xml" />
<xi:include href="xml/gdkframeclock.xml" />
<xi:include href="xml/gdkframetimings.xml" />
<xi:include href="xml/gdkdrawingcontext.xml" />
<xi:include href="xml/gdkdrawcontext.xml" />
<xi:include href="xml/gdkglcontext.xml" />
<xi:include href="xml/gdkvulkancontext.xml" />
<xi:include href="xml/events.xml" />
<xi:include href="xml/event_structs.xml" />
<xi:include href="xml/keys.xml" />
<xi:include href="xml/selections.xml" />
<xi:include href="xml/gdkclipboard.xml" />
<xi:include href="xml/dnd.xml" />
<xi:include href="xml/gdkcontentformats.xml" />
<xi:include href="xml/gdkcontentprovider.xml" />
<xi:include href="xml/gdkcontentserializer.xml" />
<xi:include href="xml/gdkcontentdeserializer.xml" />
<xi:include href="xml/gdkclipboard.xml" />
<xi:include href="xml/dnd.xml" />
<xi:include href="xml/properties.xml" />
<xi:include href="xml/threads.xml" />
<xi:include href="xml/gdkapplaunchcontext.xml" />
<xi:include href="xml/pixbufs.xml" />
<xi:include href="xml/pango_interaction.xml" />
<xi:include href="xml/cairo_interaction.xml" />
<xi:include href="xml/x_interaction.xml" />
<xi:include href="xml/wayland_interaction.xml" />
<xi:include href="xml/gdkapplaunchcontext.xml" />
</reference>
<index id="api-index-full">
@@ -63,54 +61,6 @@
<title>Index of deprecated symbols</title>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-0" role="3.0">
<title>Index of new symbols in 3.0</title>
<xi:include href="xml/api-index-3.0.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-2" role="3.2">
<title>Index of new symbols in 3.2</title>
<xi:include href="xml/api-index-3.2.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-4" role="3.4">
<title>Index of new symbols in 3.4</title>
<xi:include href="xml/api-index-3.4.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-6" role="3.6">
<title>Index of new symbols in 3.6</title>
<xi:include href="xml/api-index-3.6.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-8" role="3.8">
<title>Index of new symbols in 3.8</title>
<xi:include href="xml/api-index-3.8.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-10" role="3.10">
<title>Index of new symbols in 3.10</title>
<xi:include href="xml/api-index-3.10.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-12" role="3.12">
<title>Index of new symbols in 3.12</title>
<xi:include href="xml/api-index-3.12.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-14" role="3.14">
<title>Index of new symbols in 3.14</title>
<xi:include href="xml/api-index-3.14.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-16" role="3.16">
<title>Index of new symbols in 3.16</title>
<xi:include href="xml/api-index-3.16.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-18" role="3.18">
<title>Index of new symbols in 3.18</title>
<xi:include href="xml/api-index-3.18.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-20" role="3.20">
<title>Index of new symbols in 3.20</title>
<xi:include href="xml/api-index-3.20.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-22" role="3.22">
<title>Index of new symbols in 3.22</title>
<xi:include href="xml/api-index-3.22.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>

View File

@@ -12,14 +12,7 @@ GDK_WINDOWING_QUARTZ
GDK_WINDOWING_WAYLAND
<SUBSECTION>
GDK_VERSION_3_0
GDK_VERSION_3_2
GDK_VERSION_3_4
GDK_VERSION_3_6
GDK_VERSION_3_8
GDK_VERSION_3_10
GDK_VERSION_3_12
GDK_VERSION_3_14
GDK_VERSION_4_0
GDK_VERSION_MIN_REQUIRED
GDK_VERSION_MAX_ALLOWED
GDK_DISABLE_DEPRECATION_WARNINGS
@@ -49,20 +42,28 @@ gdk_input_source_get_type
gdk_modifier_intent_get_type
gdk_modifier_type_get_type
gdk_notify_type_get_type
gdk_property_state_get_type
gdk_prop_mode_get_type
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
GDK_AVAILABLE_IN_ALL
GDK_UNAVAILABLE
GDK_DEPRECATED
GDK_DEPRECATED_FOR
GDK_DEPRECATED_IN_4_0
GDK_DEPRECATED_IN_4_0_FOR
GDK_VERSION_CUR_STABLE
GDK_VERSION_PREV_STABLE
</SECTION>
<SECTION>
@@ -84,15 +85,7 @@ gdk_display_put_event
gdk_display_has_pending
gdk_display_is_rgba
gdk_display_is_composited
gdk_display_supports_cursor_color
gdk_display_supports_cursor_alpha
gdk_display_get_default_cursor_size
gdk_display_get_maximal_cursor_size
gdk_display_get_default_group
gdk_display_supports_selection_notification
gdk_display_request_selection_notification
gdk_display_supports_clipboard_persistence
gdk_display_store_clipboard
gdk_display_supports_shapes
gdk_display_supports_input_shapes
gdk_display_get_app_launch_context
@@ -103,10 +96,11 @@ 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
gdk_display_get_keymap
<SUBSECTION Standard>
GDK_DISPLAY
@@ -173,194 +167,174 @@ gdk_rgba_get_type
</SECTION>
<SECTION>
<TITLE>Windows</TITLE>
<FILE>windows</FILE>
GdkWindow
GdkWindowType
GdkWindowClass
GdkWindowHints
<TITLE>GdkSurface</TITLE>
<FILE>gdksurface</FILE>
GdkSurface
GdkSurfaceType
GdkSurfaceClass
GdkSurfaceHints
GdkGeometry
GdkGravity
GdkAnchorHints
GdkWindowEdge
GdkWindowTypeHint
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_window_mark_paint_from_clip
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_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_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
<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_add_filter
gdk_window_remove_filter
GdkFilterFunc
GdkFilterReturn
GdkXEvent
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_window_get_event_compression
gdk_window_set_event_compression
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_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>
@@ -395,64 +369,28 @@ gdk_content_formats_union_deserialize_mime_types
<SUBSECTION>
GdkContentFormatsBuilder
gdk_content_formats_builder_new
gdk_content_formats_builder_free
gdk_content_formats_builder_free_to_formats
gdk_content_formats_builder_add_formats
gdk_content_formats_builder_add_gtype
gdk_content_formats_builder_add_mime_type
<SUBSECTION>
gdk_content_formats_builder_ref
gdk_content_formats_builder_unref
gdk_content_formats_builder_to_formats
<SUBSECTION Private>
GDK_TYPE_FILE_LIST
gdk_file_list_get_type
gdk_content_formats_get_type
</SECTION>
<SECTION>
<TITLE>Selections</TITLE>
<FILE>selections</FILE>
GDK_SELECTION_PRIMARY
GDK_SELECTION_SECONDARY
GDK_SELECTION_CLIPBOARD
GDK_TARGET_BITMAP
GDK_TARGET_COLORMAP
GDK_TARGET_DRAWABLE
GDK_TARGET_PIXMAP
GDK_TARGET_STRING
GDK_SELECTION_TYPE_ATOM
GDK_SELECTION_TYPE_BITMAP
GDK_SELECTION_TYPE_COLORMAP
GDK_SELECTION_TYPE_DRAWABLE
GDK_SELECTION_TYPE_INTEGER
GDK_SELECTION_TYPE_PIXMAP
GDK_SELECTION_TYPE_WINDOW
GDK_SELECTION_TYPE_STRING
gdk_selection_owner_set
gdk_selection_owner_set_for_display
gdk_selection_owner_get
gdk_selection_owner_get_for_display
gdk_selection_convert
gdk_selection_property_get
gdk_selection_send_notify
gdk_selection_send_notify_for_display
</SECTION>
<SECTION>
<TITLE>Properties and Atoms</TITLE>
<FILE>properties</FILE>
GdkAtom
GDK_ATOM_TO_POINTER
GDK_POINTER_TO_ATOM
gdk_text_property_to_utf8_list_for_display
gdk_utf8_to_string_target
gdk_atom_intern
gdk_atom_intern_static_string
gdk_atom_name
gdk_property_get
gdk_property_change
GdkPropMode
gdk_property_delete
<SUBSECTION Standard>
GDK_TYPE_PROP_MODE
</SECTION>
<SECTION>
@@ -465,16 +403,13 @@ 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_cairo_get_clip_rectangle
gdk_cairo_get_drawing_context
gdk_cairo_set_source_rgba
gdk_cairo_set_source_pixbuf
gdk_cairo_rectangle
gdk_cairo_region
gdk_cairo_region_create_from_surface
gdk_cairo_surface_create_from_pixbuf
gdk_cairo_draw_from_gl
gdk_cairo_surface_upload_to_gl
</SECTION>
@@ -495,29 +430,11 @@ gdk_rectangle_contains_point
gdk_rectangle_get_type
</SECTION>
<SECTION>
<TITLE>Threads</TITLE>
<FILE>threads</FILE>
GDK_THREADS_ENTER
GDK_THREADS_LEAVE
gdk_threads_init
gdk_threads_enter
gdk_threads_leave
gdk_threads_add_idle
gdk_threads_add_idle_full
gdk_threads_add_timeout
gdk_threads_add_timeout_full
gdk_threads_add_timeout_seconds
gdk_threads_add_timeout_seconds_full
</SECTION>
<SECTION>
<TITLE>Keyboard Handling</TITLE>
<FILE>keys</FILE>
GdkKeymap
GdkKeymapKey
gdk_keymap_get_default
gdk_keymap_get_for_display
gdk_keymap_lookup_key
gdk_keymap_translate_keyboard_state
gdk_keymap_get_entries_for_keyval
@@ -602,15 +519,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
@@ -630,6 +547,8 @@ GDK_DEVICE_GET_CLASS
GDK_IS_DEVICE
GDK_IS_DEVICE_CLASS
GDK_TYPE_DEVICE
GDK_DEVICE_TOOL
GDK_IS_DEVICE_TOOL
<SUBSECTION Private>
GdkDeviceClass
@@ -654,6 +573,7 @@ gdk_device_pad_get_feature_group
GDK_TYPE_DEVICE_PAD
GDK_DEVICE_PAD
GDK_IS_DEVICE_PAD
GDK_DEVICE_PAD_GET_IFACE
<SUBSECTION Private>
gdk_device_pad_get_type
@@ -689,8 +609,12 @@ gdk_seat_capabilities_get_type
<SECTION>
<TITLE>Events</TITLE>
<FILE>events</FILE>
GdkEvent
GdkEventType
GdkEventMask
GdkScrollDirection
GdkCrossingMode
GdkNotifyType
GDK_CURRENT_TIME
GDK_PRIORITY_EVENTS
GDK_PRIORITY_REDRAW
@@ -701,14 +625,10 @@ GDK_BUTTON_MIDDLE
GDK_BUTTON_SECONDARY
<SUBSECTION>
gdk_events_pending
gdk_event_peek
gdk_event_get
gdk_event_put
gdk_event_new
gdk_event_copy
gdk_event_free
gdk_event_get_axis
gdk_event_get_axes
gdk_event_get_button
gdk_event_get_click_count
gdk_event_get_coords
@@ -720,11 +640,10 @@ 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
gdk_event_request_motions
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
@@ -732,7 +651,25 @@ gdk_event_triggers_context_menu
gdk_event_get_seat
gdk_event_get_scancode
gdk_event_get_pointer_emulated
gdk_event_get_crossing_detail
gdk_event_get_crossing_mode
gdk_event_get_drag_context
gdk_event_get_focus_in
gdk_event_get_grab_surface
gdk_event_get_motion_history
gdk_event_get_key_group
gdk_event_get_key_is_modifier
gdk_event_get_pad_axis_value
gdk_event_get_pad_button
gdk_event_get_pad_group_mode
gdk_event_get_string
gdk_event_get_touch_emulating_pointer
gdk_event_get_touchpad_angle_delta
gdk_event_get_touchpad_deltas
gdk_event_get_touchpad_gesture_n_fingers
gdk_event_get_touchpad_gesture_phase
gdk_event_get_touchpad_scale
gdk_event_is_sent
<SUBSECTION>
gdk_event_handler_set
GdkEventFunc
@@ -750,71 +687,55 @@ gdk_event_get_device_tool
gdk_event_set_device_tool
<SUBSECTION Standard>
GDK_TYPE_EVENT
GDK_TYPE_EVENT_MASK
GDK_TYPE_EVENT_TYPE
GDK_TYPE_CROSSING_MODE
GDK_TYPE_SCROLL_DIRECTION
GDK_TYPE_NOTIFY_TYPE
GDK_IS_EVENT
gdk_event_get_type
</SECTION>
<SECTION>
<TITLE>Event Structures</TITLE>
<FILE>event_structs</FILE>
GdkEvent
<FILE>gdkpaintable</FILE>
<TITLE>GdkPaintable/TITLE>
GdkPaintable
GdkPaintableFlags
gdk_paintable_get_current_image
gdk_paintable_snapshot
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
<SUBSECTION>
GdkEventAny
GdkEventKey
GdkEventButton
GdkEventTouch
GdkEventScroll
GdkEventMotion
GdkEventExpose
GdkEventCrossing
GdkEventFocus
GdkEventConfigure
GdkEventProperty
GdkEventSelection
GdkEventDND
GdkEventProximity
GdkEventWindowState
GdkEventOwnerChange
GdkEventGrabBroken
GdkEventTouchpadSwipe
GdkEventTouchpadPinch
GdkEventPadButton
GdkEventPadAxis
GdkEventPadGroupMode
<SUBSECTION>
GdkScrollDirection
GdkCrossingMode
GdkNotifyType
GdkPropertyState
GdkWindowState
<SUBSECTION Standard>
GDK_TYPE_CROSSING_MODE
GDK_TYPE_EVENT
GDK_TYPE_NOTIFY_TYPE
GDK_TYPE_PROPERTY_STATE
GDK_TYPE_SCROLL_DIRECTION
GDK_TYPE_WINDOW_STATE
GDK_TYPE_OWNER_CHANGE
gdk_paintable_invalidate_contents
gdk_paintable_invalidate_size
gdk_paintable_new_empty
<SUBSECTION Private>
gdk_event_get_type
gdk_owner_change_get_type
GDK_TYPE_PAINTABLE
gdk_paintable_get_type
</SECTION>
<SECTION>
<TITLE>Textures</TITLE>
<FILE>textures</FILE>
GdkTexture
gdk_texture_new_for_data
gdk_texture_new_for_pixbuf
gdk_texture_new_from_resource
gdk_texture_new_from_file
gdk_texture_get_width
gdk_texture_get_height
gdk_texture_download
gdk_texture_save_to_png
GdkMemoryFormat
GDK_MEMORY_DEFAULT
gdk_memory_texture_new
gdk_gl_texture_new
gdk_gl_texture_release
<SUBSECTION Standard>
GdkTextureClass
@@ -822,6 +743,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>
@@ -838,6 +769,8 @@ gdk_cursor_get_hotspot_y
<SUBSECTION Standard>
GDK_TYPE_CURSOR
GDK_CURSOR
GDK_IS_CURSOR
<SUBSECTION Private>
gdk_cursor_get_type
@@ -849,14 +782,11 @@ gdk_cursor_get_type
<FILE>dnd</FILE>
GdkDragContext
GdkDragCancelReason
gdk_drag_get_selection
gdk_drop_reply
gdk_drag_drop_done
gdk_drag_begin
gdk_drop_finish
GdkDragAction
gdk_drag_status
gdk_drag_drop_succeeded
gdk_drag_context_get_display
gdk_drag_context_get_actions
@@ -864,10 +794,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_set_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>
@@ -889,7 +818,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
@@ -914,7 +843,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
@@ -925,27 +854,22 @@ 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_extents
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
gdk_x11_atom_to_xatom
gdk_x11_atom_to_xatom_for_display
gdk_x11_xatom_to_atom
gdk_x11_xatom_to_atom_for_display
gdk_x11_get_xatom_by_name
gdk_x11_get_xatom_by_name_for_display
gdk_x11_get_xatom_name
gdk_x11_get_xatom_name_for_display
gdk_x11_set_sm_client_id
gdk_x11_display_text_property_to_text_list
@@ -1032,12 +956,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
@@ -1054,8 +978,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>
@@ -1068,13 +992,14 @@ gdk_wayland_device_get_wl_pointer
gdk_wayland_device_get_wl_seat
gdk_wayland_display_get_wl_compositor
gdk_wayland_display_get_wl_display
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_display_query_registry
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
@@ -1095,18 +1020,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>
@@ -1144,9 +1069,21 @@ gdk_frame_clock_get_history_start
gdk_frame_clock_get_timings
gdk_frame_clock_get_current_timings
gdk_frame_clock_get_refresh_info
<SUBSECTION Private>
GDK_FRAME_CLOCK
GDK_FRAME_CLOCK_CLASS
GDK_FRAME_CLOCK_GET_CLASS
GDK_FRAME_CLOCK_IDLE
GDK_FRAME_CLOCK_IDLE_CLASS
GDK_FRAME_CLOCK_IDLE_GET_CLASS
GDK_IS_FRAME_CLOCK
GDK_IS_FRAME_CLOCK_CLASS
GDK_IS_FRAME_CLOCK_IDLE
GDK_IS_FRAME_CLOCK_IDLE_CLASS
GdkFrameClockPrivate
gdk_frame_clock_get_type
gdk_frame_clock_idle_get_type
</SECTION>
<SECTION>
@@ -1162,14 +1099,18 @@ gdk_frame_timings_get_presentation_time
gdk_frame_timings_get_refresh_interval
gdk_frame_timings_get_predicted_presentation_time
<SUBSECTION Private>
gdk_frame_get_type
gdk_frame_timings_get_type
</SECTION>
<SECTION>
<FILE>gdkdrawcontext</FILE>
GdkDrawContext
gdk_draw_context_get_display
gdk_draw_context_get_window
gdk_draw_context_get_surface
gdk_draw_context_begin_frame
gdk_draw_context_end_frame
gdk_draw_context_is_in_frame
gdk_draw_context_get_frame_region
<SUBSECTION Standard>
GDK_DRAW_CONTEXT
@@ -1185,7 +1126,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
@@ -1203,7 +1144,6 @@ gdk_gl_context_is_legacy
<SUBSECTION>
GdkGLError
gdk_gl_context_realize
gdk_gl_context_get_damage
gdk_gl_context_make_current
gdk_gl_context_get_current
gdk_gl_context_clear_current
@@ -1248,20 +1188,12 @@ GDK_IS_MONITOR
</SECTION>
<SECTION>
<FILE>gdkdrawingcontext</FILE>
GdkDrawingContext
gdk_drawing_context_get_window
gdk_drawing_context_get_clip
gdk_drawing_context_get_cairo_context
gdk_drawing_context_is_valid
gdk_drawing_context_get_paint_context
<FILE>gdkcairocontext</FILE>
GdkCairoContext
gdk_cairo_context_cairo_create
<SUBSECTION Standard>
gdk_drawing_context_get_type
GdkDrawingContextClass
GDK_TYPE_DRAWING_CONTEXT
GDK_DRAWING_CONTEXT
GDK_IS_DRAWING_CONTEXT
gdk_cairo_context_get_type
</SECTION>
<SECTION>
@@ -1329,6 +1261,11 @@ gdk_content_provider_write_mime_type_finish
gdk_content_provider_get_value
<SUBSECTION Standard>
GDK_CONTENT_PROVIDER
GDK_CONTENT_PROVIDER_CLASS
GDK_CONTENT_PROVIDER_GET_CLASS
GDK_IS_CONTENT_PROVIDER
GDK_IS_CONTENT_PROVIDER_CLASS
GdkContentProviderClass
gdk_content_provider_get_type
</SECTION>
@@ -1388,3 +1325,4 @@ GDK_CONTENT_DESERIALIZER
GDK_IS_CONTENT_DESERIALIZER
gdk_content_deserializer_get_type
</SECTION>

View File

@@ -1,18 +1,26 @@
gdk_app_launch_context_get_type
gdk_clipboard_get_type
gdk_content_deserializer_get_type
gdk_content_formats_get_type
gdk_content_serializer_get_type
gdk_cursor_get_type
gdk_device_get_type
gdk_device_pad_get_type
gdk_device_tool_get_type
gdk_display_get_type
gdk_display_manager_get_type
gdk_drag_context_get_type
gdk_drawing_context_get_type
gdk_event_get_type
gdk_frame_clock_get_type
gdk_gl_context_get_type
gdk_gl_texture_get_type
gdk_keymap_get_type
gdk_memory_texture_get_type
gdk_monitor_get_type
gdk_paintable_get_type
gdk_rgba_get_type
gdk_seat_get_type
gdk_window_get_type
gdk_content_serializer_get_type
gdk_content_deserializer_get_type
gdk_clipboard_get_type
gdk_content_formats_get_type
gdk_snapshot_get_type
gdk_surface_get_type
gdk_texture_get_type
gdk_vulkan_context_get_type

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 B

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