Compare commits

..

3 Commits

Author SHA1 Message Date
Ernestas Kulik cb7202ac6f gtkselection: Drop gtk_selection_data_get_targets()
As the data isn’t set anywhere with the type “ATOM”, this doesn’t work
as expected and can be replaced by a target atom check.
2018-07-31 23:29:26 +03:00
Ernestas Kulik ef632da8b6 gtkselection: Drop format field
It’s not used anywhere in a meaningful way and looks safe to rip out and
replace with a hardcoded constant where appropriate.
2018-07-31 23:29:26 +03:00
Ernestas Kulik 0967f6f3fc tests: testdnd: Use G_N_ELEMENTS macro
Wasted some horizontal screen estate, but beats rolling our own thing.
2018-07-31 23:29:26 +03:00
124 changed files with 8899 additions and 11494 deletions
+3 -3
View File
@@ -48,9 +48,9 @@ $ ninja
```
**Note**: For information about submitting patches and pushing changes
to Git, see the [README.md](./README.md) and [README.commits.md](./README.commits.md) files. In particular,
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.commits.md](./README.commits.md).
understanding `README.commmits`.
Typically, you should work on your own branch:
@@ -60,6 +60,6 @@ $ 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)
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.
+9 -8
View File
@@ -7,23 +7,25 @@ avoid unnecessary breakage, and to take advantage of the knowledge
about GTK+ that has been built up over the years, we'd like to ask
people committing to GTK+ to follow a few rules:
0. Ask first. If your changes are major, or could possibly break existing
0) Ask first. If your changes are major, or could possibly break existing
code, you should always ask. If your change is minor and you've
been working on GTK+ for a while it probably isn't necessary
to ask. But when in doubt, ask. Even if your change is correct,
somebody may know a better way to do things.
If you are making changes to GTK+, you should be subscribed
to gtk-devel-list@gnome.org. (Subscription address:
gtk-devel-list-request@gnome.org.) This is a good place to ask
about intended changes.
#gtk+ on GIMPNet (irc.gimp.org, irc.us.gimp.org, irc.eu.gimp.org, ...)
is also a good place to find GTK+ developers to discuss changes with,
however, email to gtk-devel-list is the most certain and preferred
method.
0. Ask _first_.
1) Ask _first_.
0. With git, we no longer maintain a ChangeLog file, but you are expected
2) With git, we no longer maintain a ChangeLog file, but you are expected
to produce a meaningful commit message. Changes without a sufficient
commit message will be reverted. See below for the expected format
of commit messages.
@@ -37,13 +39,13 @@ Notes:
* The expected format for git commit messages is as follows:
```
=== begin example commit ===
Short explanation of the commit
Longer explanation explaining exactly what's changed, whether any
external or private interfaces changed, what bugs were fixed (with bug
tracker reference if applicable) and so forth. Be concise but not too brief.
```
=== end example commit ===
- Always add a brief description of the commit to the _first_ line of
the commit and terminate by two newlines (it will work without the
@@ -58,8 +60,8 @@ tracker reference if applicable) and so forth. Be concise but not too brief.
punctuation and capital letters where appropriate. Normally, for patches
sent to a mailing list it's copied from there.
- When committing code on behalf of others use the `--author` option, e.g.
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
- When committing code on behalf of others use the --author option, e.g.
git commit -a --author "Joe Coder <joe@coder.org>" and --signoff.
Owen Taylor
@@ -68,4 +70,3 @@ Owen Taylor
Matthias Clasen
31 Mar 2009
-5
View File
@@ -31,11 +31,6 @@ Information about mailing lists can be found at
- http://www.gtk.org/mailing-lists.php
Nightly documentation can be found at
- Gtk: https://gnome.pages.gitlab.gnome.org/gtk/gtk/
- Gdk: https://gnome.pages.gitlab.gnome.org/gtk/gdk/
- Gsk: https://gnome.pages.gitlab.gnome.org/gtk/gsk/
Building and installing
-----------------------
+1
View File
@@ -5,6 +5,7 @@
"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": [
@@ -5,6 +5,7 @@
"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": [
+1 -3
View File
@@ -134,9 +134,7 @@ static GtkWidget *
create_video (void)
{
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
GtkWidget *w = gtk_picture_new_for_paintable (GDK_PAINTABLE (stream));
gtk_widget_set_size_request (w, 64, 64);
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);
+1 -1
View File
@@ -129,7 +129,7 @@ foreach icon_size: [ '16x16', '22x22', '24x24', '32x32', '48x48', '256x256', ]
endforeach
# desktop file
install_data('org.gtk.Demo.desktop', install_dir: gtk_applicationsdir)
install_data('gtk4-demo.desktop', install_dir: gtk_applicationsdir)
# GSettings
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
+1 -1
View File
@@ -17,4 +17,4 @@ executable('gtk4-icon-browser',
link_args: extra_demo_ldflags,
install: true)
install_data('org.gtk.IconBrowser.desktop', install_dir: gtk_applicationsdir)
install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)
+1 -1
View File
@@ -13,7 +13,7 @@ executable('gtk4-widget-factory',
install: true)
# desktop file
install_data('org.gtk.WidgetFactory.desktop', install_dir: gtk_applicationsdir)
install_data('gtk4-widget-factory.desktop', install_dir: gtk_applicationsdir)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
+1 -1
View File
@@ -388,7 +388,7 @@
</informalfigure>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/org.gtk.exampleapp.desktop" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.desktop" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Note that <replaceable>@<!-- -->bindir@</replaceable> needs to be replaced
+3
View File
@@ -758,6 +758,9 @@ gtk_container_child_set_valist
gtk_container_child_notify
gtk_container_child_notify_by_pspec
gtk_container_forall
gtk_container_get_focus_chain
gtk_container_set_focus_chain
gtk_container_unset_focus_chain
gtk_container_class_find_child_property
gtk_container_class_install_child_property
gtk_container_class_install_child_properties
-28
View File
@@ -177,22 +177,6 @@
</para>
</section>
<section>
<title>Set a proper app_id</title>
<para>
In GTK+4 we want the application's #GApplication
'application-id' (and therefore the D-Bus name), the desktop
file basename and Wayland's xdg-shell app_id to match. In
order to achieve this with GTK+3 call g_set_prgname() with the same
application id you passed to #GtkApplication. Rename your
desktop files to match the application id if needed.
</para>
<para>
The call to g_set_prgname() can be removed once you fully migrated
to GTK+4.
</para>
</section>
</section>
<section>
@@ -286,14 +270,6 @@
</para>
</section>
<section>
<title>Stop using GtkEventBox</title>
<para>
GtkEventBox is no longer needed and has been removed.
All widgets receive all events.
</para>
</section>
<section>
<title>Adapt to GtkHeaderBar API changes</title>
<para>
@@ -432,10 +408,6 @@
from ui files it run the command <command>gtk4-builder-tool simplify --replace</command>
on them.
</para>
<para>
The function gtk_widget_show_all(), the #GtkWidget::no-show-all property
and its getter and setter have been removed in GTK+ 4, so you should stop using them.
</para>
</section>
<section>
+2 -2
View File
@@ -2,8 +2,8 @@ To make gnome-shell use the desktop file and icon for this example
while running it uninstalled, do the following:
mkdir -p ~/.local/share/applications
sed -e "s#@bindir@#$PWD#" org.gtk.exampleapp.desktop \
> ~/.local/share/applications/org.gtk.exampleapp.desktop
sed -e "s#@bindir@#$PWD#" exampleapp.desktop \
> ~/.local/share/applications/lt-exampleapp.desktop
mkdir -p ~/.local/share/icons/hicolor/48x48/apps
cp exampleapp.png ~/.local/share/icons/hicolor/48x48/apps
+31 -3
View File
@@ -461,6 +461,12 @@ gdk_surface_get_property (GObject *object,
}
}
static gboolean
gdk_surface_is_subsurface (GdkSurface *surface)
{
return surface->surface_type == GDK_SURFACE_SUBSURFACE;
}
static GdkSurface *
gdk_surface_get_impl_surface (GdkSurface *surface)
{
@@ -549,7 +555,10 @@ recompute_visible_regions_internal (GdkSurface *private,
old_abs_y = private->abs_y;
/* Update absolute position */
if (gdk_surface_has_impl (private))
if ((gdk_surface_has_impl (private) &&
private->surface_type != GDK_SURFACE_SUBSURFACE) ||
(gdk_surface_is_toplevel (private) &&
private->surface_type == GDK_SURFACE_SUBSURFACE))
{
/* Native surfaces and toplevel subsurfaces start here */
private->abs_x = 0;
@@ -668,6 +677,15 @@ gdk_surface_new (GdkDisplay *display,
if (parent != NULL)
g_warning (G_STRLOC "Toplevel surfaces must be created without a parent");
break;
case GDK_SURFACE_SUBSURFACE:
#ifdef GDK_WINDOWING_WAYLAND
if (!GDK_IS_WAYLAND_DISPLAY (display))
{
g_warning (G_STRLOC "Subsurface surfaces can only be used on Wayland");
return NULL;
}
#endif
break;
case GDK_SURFACE_CHILD:
break;
default:
@@ -697,6 +715,11 @@ gdk_surface_new (GdkDisplay *display,
native = TRUE; /* Always use native surfaces for toplevels */
}
#ifdef GDK_WINDOWING_WAYLAND
if (surface->surface_type == GDK_SURFACE_SUBSURFACE)
native = TRUE; /* Always use native windows for subsurfaces as well */
#endif
if (native)
{
/* Create the impl */
@@ -899,6 +922,7 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
case GDK_SURFACE_TOPLEVEL:
case GDK_SURFACE_CHILD:
case GDK_SURFACE_TEMP:
case GDK_SURFACE_SUBSURFACE:
if (surface->parent)
{
if (surface->parent->children)
@@ -1149,7 +1173,10 @@ gdk_surface_get_parent (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
return surface->parent;
if (gdk_surface_is_subsurface (surface))
return surface->transient_for;
else
return surface->parent;
}
/**
@@ -1169,7 +1196,8 @@ gdk_surface_get_toplevel (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
while (surface->surface_type == GDK_SURFACE_CHILD)
while (surface->surface_type == GDK_SURFACE_CHILD ||
surface->surface_type == GDK_SURFACE_SUBSURFACE)
{
if (gdk_surface_is_toplevel (surface))
break;
+7 -2
View File
@@ -43,7 +43,11 @@ typedef struct _GdkGeometry GdkGeometry;
* GdkSurfaceType:
* @GDK_SURFACE_TOPLEVEL: toplevel window (used to implement #GtkWindow)
* @GDK_SURFACE_CHILD: child surface (used to implement e.g. #GtkEntry)
* @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement #GtkMenu)
* @GDK_SURFACE_TEMP: override redirect temporary surface (used to implement
* #GtkMenu)
* @GDK_SURFACE_SUBSURFACE: subsurface; This surface is visually
* tied to a toplevel, and is moved/stacked with it. Currently this window
* type is only implemented in Wayland
*
* Describes the kind of surface.
*/
@@ -51,7 +55,8 @@ typedef enum
{
GDK_SURFACE_TOPLEVEL,
GDK_SURFACE_CHILD,
GDK_SURFACE_TEMP
GDK_SURFACE_TEMP,
GDK_SURFACE_SUBSURFACE
} GdkSurfaceType;
/* Size restriction enumeration.
+226 -10
View File
@@ -117,6 +117,7 @@ struct _GdkSurfaceImplWayland
struct zxdg_popup_v6 *zxdg_popup_v6;
struct gtk_surface1 *gtk_surface;
struct wl_subsurface *wl_subsurface;
struct wl_egl_window *egl_window;
struct wl_egl_window *dummy_egl_window;
struct zxdg_exported_v1 *xdg_exported;
@@ -217,6 +218,8 @@ static void gdk_wayland_surface_maybe_configure (GdkSurface *surface,
static void maybe_set_gtk_surface_dbus_properties (GdkSurface *surface);
static void maybe_set_gtk_surface_modal (GdkSurface *surface);
static void gdk_surface_request_transient_parent_commit (GdkSurface *surface);
static void gdk_wayland_surface_sync_margin (GdkSurface *surface);
static void gdk_wayland_surface_sync_input_region (GdkSurface *surface);
static void gdk_wayland_surface_sync_opaque_region (GdkSurface *surface);
@@ -1027,6 +1030,31 @@ gdk_wayland_surface_sync_input_region (GdkSurface *surface)
impl->input_region_dirty = FALSE;
}
static void
gdk_wayland_set_input_region_if_empty (GdkSurface *surface)
{
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
GdkWaylandDisplay *display;
struct wl_region *empty;
if (!impl->input_region_dirty)
return;
if (impl->input_region == NULL)
return;
if (!cairo_region_is_empty (impl->input_region))
return;
display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
empty = wl_compositor_create_region (display->compositor);
wl_surface_set_input_region (impl->display_server.wl_surface, empty);
wl_region_destroy (empty);
impl->input_region_dirty = FALSE;
}
static void
surface_enter (void *data,
struct wl_surface *wl_surface,
@@ -1065,6 +1093,61 @@ static const struct wl_surface_listener surface_listener = {
surface_leave
};
static void
on_parent_surface_committed (GdkSurfaceImplWayland *parent_impl,
GdkSurface *surface)
{
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
g_signal_handler_disconnect (parent_impl,
impl->parent_surface_committed_handler);
impl->parent_surface_committed_handler = 0;
wl_subsurface_set_desync (impl->display_server.wl_subsurface);
/* Special case if the input region is empty, it won't change on resize */
gdk_wayland_set_input_region_if_empty (surface);
}
static void
gdk_wayland_surface_create_subsurface (GdkSurface *surface)
{
GdkSurfaceImplWayland *impl, *parent_impl = NULL;
GdkWaylandDisplay *display_wayland;
impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
if (!impl->display_server.wl_surface)
return; /* Bail out, surface and subsurface will be created later when shown */
if (impl->display_server.wl_subsurface)
return;
if (impl->transient_for)
parent_impl = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl);
if (parent_impl && parent_impl->display_server.wl_surface)
{
display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
impl->display_server.wl_subsurface =
wl_subcompositor_get_subsurface (display_wayland->subcompositor,
impl->display_server.wl_surface, parent_impl->display_server.wl_surface);
wl_subsurface_set_position (impl->display_server.wl_subsurface,
surface->x + surface->abs_x,
surface->y + surface->abs_y);
/* In order to synchronize the initial position with the initial frame
* content, wait with making the subsurface desynchronized until after
* the parent was committed.
*/
impl->parent_surface_committed_handler =
g_signal_connect_object (parent_impl, "committed",
G_CALLBACK (on_parent_surface_committed),
surface, 0);
gdk_surface_request_transient_parent_commit (surface);
}
}
static void
gdk_wayland_surface_create_surface (GdkSurface *surface)
{
@@ -1432,9 +1515,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
impl->initial_fullscreen_output = NULL;
app_id = impl->application.application_id;
if (app_id == NULL)
app_id = g_get_prgname ();
app_id = g_get_prgname ();
if (app_id == NULL)
app_id = "GTK+ Application";
@@ -1486,8 +1567,6 @@ gdk_wayland_surface_handle_configure_popup (GdkSurface *surface,
&flipped_x,
&flipped_y);
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
g_signal_emit_by_name (surface,
"moved-to-rect",
&flipped_rect,
@@ -1710,15 +1789,23 @@ get_real_parent_and_translate (GdkSurface *surface,
while (parent)
{
GdkSurfaceImplWayland *parent_impl =
GDK_SURFACE_IMPL_WAYLAND (parent->impl);
GdkSurface *effective_parent = gdk_surface_get_parent (parent);
if (gdk_surface_has_native (parent) && !effective_parent)
if ((gdk_surface_has_native (parent) &&
!parent_impl->display_server.wl_subsurface) ||
!effective_parent)
break;
*x += parent->x;
*y += parent->y;
parent = effective_parent;
if (gdk_surface_has_native (parent) &&
parent_impl->display_server.wl_subsurface)
parent = parent->transient_for;
else
parent = effective_parent;
}
return parent;
@@ -2378,9 +2465,38 @@ should_map_as_popup (GdkSurface *surface)
break;
}
if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
return FALSE;
}
static gboolean
should_map_as_subsurface (GdkSurface *surface)
{
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_SUBSURFACE)
return TRUE;
if (GDK_SURFACE_TYPE (surface) != GDK_SURFACE_TEMP)
return FALSE;
/* if we want a popup, we do not want a subsurface */
if (should_map_as_popup (surface))
return FALSE;
if (impl->transient_for)
{
GdkSurfaceImplWayland *impl_parent;
impl_parent = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl);
/* subsurface require that the parent is mapped */
if (impl_parent->mapped)
return TRUE;
else
g_warning ("Couldn't map surface %p as subsurface because its parent is not mapped.",
surface);
}
return FALSE;
}
@@ -2416,7 +2532,15 @@ gdk_wayland_surface_map (GdkSurface *surface)
if (impl->mapped || impl->use_custom_surface)
return;
if (should_map_as_popup (surface))
if (should_map_as_subsurface (surface))
{
if (impl->transient_for)
gdk_wayland_surface_create_subsurface (surface);
else
g_warning ("Couldn't map surface %p as susburface yet because it doesn't have a parent",
surface);
}
else if (should_map_as_popup (surface))
{
gboolean create_fallback = FALSE;
struct wl_seat *grab_input_seat;
@@ -2517,6 +2641,26 @@ gdk_wayland_surface_show (GdkSurface *surface,
gdk_wayland_surface_map (surface);
}
static void
unmap_subsurface (GdkSurface *surface)
{
GdkSurfaceImplWayland *impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
GdkSurfaceImplWayland *parent_impl;
g_return_if_fail (impl->display_server.wl_subsurface);
g_return_if_fail (impl->transient_for);
parent_impl = GDK_SURFACE_IMPL_WAYLAND (impl->transient_for->impl);
wl_subsurface_destroy (impl->display_server.wl_subsurface);
if (impl->parent_surface_committed_handler)
{
g_signal_handler_disconnect (parent_impl,
impl->parent_surface_committed_handler);
impl->parent_surface_committed_handler = 0;
}
impl->display_server.wl_subsurface = NULL;
}
static void
unmap_popups_for_surface (GdkSurface *surface)
{
@@ -2617,6 +2761,9 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
impl->initial_configure_received = FALSE;
}
if (impl->display_server.wl_subsurface)
unmap_subsurface (surface);
if (impl->awaiting_frame)
{
GdkFrameClock *frame_clock;
@@ -2690,6 +2837,32 @@ gdk_surface_wayland_restack_toplevel (GdkSurface *surface,
{
}
static void
gdk_surface_request_transient_parent_commit (GdkSurface *surface)
{
GdkSurfaceImplWayland *surface_impl, *impl;
GdkFrameClock *frame_clock;
surface_impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
if (!surface_impl->transient_for)
return;
impl = GDK_SURFACE_IMPL_WAYLAND (surface_impl->transient_for->impl);
if (!impl->display_server.wl_surface || impl->pending_commit)
return;
frame_clock = gdk_surface_get_frame_clock (surface_impl->transient_for);
if (!frame_clock)
return;
impl->pending_commit = TRUE;
gdk_frame_clock_request_phase (frame_clock,
GDK_FRAME_CLOCK_PHASE_AFTER_PAINT);
}
static void
gdk_surface_wayland_move_resize (GdkSurface *surface,
gboolean with_move,
@@ -2708,6 +2881,14 @@ gdk_surface_wayland_move_resize (GdkSurface *surface,
surface->x = x;
surface->y = y;
impl->position_method = POSITION_METHOD_MOVE_RESIZE;
if (impl->display_server.wl_subsurface)
{
wl_subsurface_set_position (impl->display_server.wl_subsurface,
surface->x + surface->abs_x,
surface->y + surface->abs_y);
gdk_surface_request_transient_parent_commit (surface);
}
}
}
@@ -3233,6 +3414,9 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface,
unset_transient_for_exported (surface);
if (impl->display_server.wl_subsurface)
unmap_subsurface (surface);
previous_parent = impl->transient_for;
impl->transient_for = parent;
@@ -3245,6 +3429,9 @@ gdk_wayland_surface_set_transient_for (GdkSurface *surface,
g_list_remove (display_wayland->orphan_dialogs, surface);
}
gdk_wayland_surface_sync_parent (surface, NULL);
if (should_map_as_subsurface (surface) &&
parent && gdk_surface_is_visible (surface))
gdk_wayland_surface_create_subsurface (surface);
}
static void
@@ -3911,6 +4098,34 @@ _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
impl->grab_input_seat = seat;
}
/**
* gdk_wayland_surface_new_subsurface: (constructor)
* @display: the display to create the surface on
* @position: position relative to the transient surface
*
* Creates a new subsurface surface.
*
* Returns: (transfer full): the new #GdkSurface
**/
GdkSurface *
gdk_wayland_surface_new_subsurface (GdkDisplay *display,
const GdkRectangle *position)
{
GdkSurfaceAttr attr;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (position != NULL, NULL);
attr.wclass = GDK_INPUT_OUTPUT;
attr.x = position->x;
attr.y = position->y;
attr.width = position->width;
attr.height = position->height;
attr.surface_type = GDK_SURFACE_SUBSURFACE;
return gdk_surface_new (display, NULL, &attr);
}
/**
* gdk_wayland_surface_get_wl_surface:
* @surface: (type GdkWaylandSurface): a #GdkSurface
@@ -4318,7 +4533,8 @@ gdk_wayland_surface_set_transient_for_exported (GdkSurface *surface,
g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (surface), FALSE);
g_return_val_if_fail (GDK_IS_WAYLAND_DISPLAY (display), FALSE);
g_return_val_if_fail (!should_map_as_popup (surface), FALSE);
g_return_val_if_fail (!should_map_as_subsurface (surface) &&
!should_map_as_popup (surface), FALSE);
impl = GDK_SURFACE_IMPL_WAYLAND (surface->impl);
display_wayland = GDK_WAYLAND_DISPLAY (display);
+4 -26
View File
@@ -2712,35 +2712,13 @@ gdk_event_translate (MSG *msg,
event = gdk_event_new (GDK_SCROLL);
event->any.surface = window;
event->scroll.direction = GDK_SCROLL_SMOOTH;
if (msg->message == WM_MOUSEWHEEL)
{
UINT lines_multiplier = 3;
event->scroll.delta_y = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / (gdouble) WHEEL_DELTA;
/* -1 means that we should scroll in screens, not lines.
* Right now GDK doesn't support that.
*/
if (SystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &lines_multiplier, 0) &&
lines_multiplier != (UINT) -1)
event->scroll.delta_y *= (gdouble) lines_multiplier;
}
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_UP : GDK_SCROLL_DOWN;
else if (msg->message == WM_MOUSEHWHEEL)
{
UINT chars_multiplier = 3;
event->scroll.delta_x = (gdouble) GET_WHEEL_DELTA_WPARAM (msg->wParam) / (gdouble) WHEEL_DELTA;
/* There doesn't seem to be any indication that
* h-scroll has an equivalent of the "screen" mode,
* indicated by multiplier being (UINT) -1.
*/
if (SystemParametersInfo (SPI_GETWHEELSCROLLCHARS, 0, &chars_multiplier, 0))
event->scroll.delta_x *= (gdouble) chars_multiplier;
}
/* It seems that delta values given by Windows are
* inverted (positive delta scrolls up, not down).
*/
event->scroll.delta_x *= -1.0;
event->scroll.delta_y *= -1.0;
event->scroll.direction = (((short) HIWORD (msg->wParam)) > 0) ?
GDK_SCROLL_RIGHT : GDK_SCROLL_LEFT;
event->scroll.time = _gdk_win32_get_next_tick (msg->time);
event->scroll.x = (gint16) point.x / impl->surface_scale;
event->scroll.y = (gint16) point.y / impl->surface_scale;
+11 -1
View File
@@ -258,13 +258,22 @@ gtk_action_bar_set_child_property (GtkContainer *container,
}
}
static void
gtk_action_bar_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkActionBar *self = GTK_ACTION_BAR (widget);
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (self);
gtk_widget_snapshot_child (GTK_WIDGET (self), priv->revealer, snapshot);
}
static void
gtk_action_bar_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline)
{
GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
gtk_widget_size_allocate (priv->revealer, allocation, baseline);
}
@@ -355,6 +364,7 @@ gtk_action_bar_class_init (GtkActionBarClass *klass)
object_class->get_property = gtk_action_bar_get_property;
object_class->finalize = gtk_action_bar_finalize;
widget_class->snapshot = gtk_action_bar_snapshot;
widget_class->size_allocate = gtk_action_bar_size_allocate;
widget_class->measure = gtk_action_bar_measure_;
widget_class->destroy = gtk_action_bar_destroy;
+8 -141
View File
@@ -24,13 +24,9 @@
#include "gtkapplicationprivate.h"
#include "gtksettings.h"
#include "gtkprivate.h"
G_DEFINE_TYPE (GtkApplicationImplDBus, gtk_application_impl_dbus, GTK_TYPE_APPLICATION_IMPL)
#define DBUS_BUS_NAME "org.freedesktop.DBus"
#define DBUS_OBJECT_PATH "/org/freedesktop/DBus"
#define DBUS_BUS_INTERFACE "org.freedesktop.DBus"
#define GNOME_DBUS_NAME "org.gnome.SessionManager"
#define GNOME_DBUS_OBJECT_PATH "/org/gnome/SessionManager"
#define GNOME_DBUS_INTERFACE "org.gnome.SessionManager"
@@ -39,9 +35,6 @@ G_DEFINE_TYPE (GtkApplicationImplDBus, gtk_application_impl_dbus, GTK_TYPE_APPLI
#define XFCE_DBUS_OBJECT_PATH "/org/xfce/SessionManager"
#define XFCE_DBUS_INTERFACE "org.xfce.Session.Manager"
#define XFCE_DBUS_CLIENT_INTERFACE "org.xfce.Session.Client"
#define GNOME_SCREENSAVER_DBUS_NAME "org.gnome.ScreenSaver"
#define GNOME_SCREENSAVER_DBUS_OBJECT_PATH "/org/gnome/ScreenSaver"
#define GNOME_SCREENSAVER_DBUS_INTERFACE "org.gnome.ScreenSaver"
static void
unregister_client (GtkApplicationImplDBus *dbus)
@@ -178,63 +171,6 @@ stash_desktop_autostart_id (void)
g_unsetenv ("DESKTOP_AUTOSTART_ID");
}
static void
screensaver_signal_session (GDBusProxy *proxy,
const char *sender_name,
const char *signal_name,
GVariant *parameters,
GtkApplication *application)
{
gboolean active;
if (!g_str_equal (signal_name, "ActiveChanged"))
return;
g_variant_get (parameters, "(b)", &active);
gtk_application_set_screensaver_active (application, active);
}
static void
screensaver_signal_portal (GDBusConnection *connection,
const char *sender_name,
const char *object_path,
const char *interface_name,
const char *signal_name,
GVariant *parameters,
gpointer data)
{
GtkApplication *application = data;
gboolean active;
GVariant *state;
if (!g_str_equal (signal_name, "StateChanged"))
return;
g_variant_get (parameters, "(o@a{sv})", NULL, &state);
g_variant_lookup (state, "screensaver-active", "b", &active);
gtk_application_set_screensaver_active (application, active);
}
static void
create_monitor_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GDBusProxy *proxy = G_DBUS_PROXY (source);
GError *error = NULL;
GVariant *ret = NULL;
ret = g_dbus_proxy_call_finish (proxy, result, &error);
if (ret == NULL)
{
g_warning ("Creating a portal monitor failed: %s", error->message);
g_error_free (error);
return;
}
g_variant_unref (ret);
}
static void
gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
gboolean register_session)
@@ -259,9 +195,6 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
dbus->object_path = g_application_get_dbus_object_path (G_APPLICATION (impl->application));
dbus->unique_name = g_dbus_connection_get_unique_name (dbus->session);
if (gtk_should_use_portal ())
goto out;
g_debug ("Connecting to session manager");
/* Try the GNOME session manager first */
@@ -303,27 +236,6 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
if (!register_session)
goto out;
dbus->ss_proxy = gtk_application_get_proxy_if_service_present (dbus->session,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START |
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_NONE,
GNOME_SCREENSAVER_DBUS_NAME,
GNOME_SCREENSAVER_DBUS_OBJECT_PATH,
GNOME_SCREENSAVER_DBUS_INTERFACE,
&error);
if (error)
{
g_debug ("Failed to get the GNOME screensaver proxy: %s", error->message);
g_clear_error (&error);
g_clear_object (&dbus->ss_proxy);
}
if (dbus->ss_proxy)
{
g_signal_connect (dbus->ss_proxy, "g-signal",
G_CALLBACK (screensaver_signal_session), impl->application);
}
g_debug ("Registering client '%s' '%s'", dbus->application_id, client_id);
res = g_dbus_proxy_call_sync (dbus->sm_proxy,
@@ -392,9 +304,9 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
if (id && id[0])
{
res = g_dbus_connection_call_sync (dbus->session,
DBUS_BUS_NAME,
DBUS_OBJECT_PATH,
DBUS_BUS_INTERFACE,
"org.freedesktop.DBus",
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"GetId",
NULL,
NULL,
@@ -428,51 +340,16 @@ gtk_application_impl_dbus_startup (GtkApplicationImpl *impl,
{
dbus->inhibit_proxy = gtk_application_get_proxy_if_service_present (dbus->session,
G_DBUS_PROXY_FLAGS_NONE,
PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_INHIBIT_INTERFACE,
"org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop",
"org.freedesktop.portal.Inhibit",
&error);
if (error)
{
g_debug ("Failed to get an inhibit portal proxy: %s", error->message);
g_clear_error (&error);
goto end;
}
if (register_session)
{
char *token;
GVariantBuilder opt_builder;
/* Monitor screensaver state */
dbus->session_id = gtk_get_portal_session_path (dbus->session, &token);
dbus->state_changed_handler =
g_dbus_connection_signal_subscribe (dbus->session,
PORTAL_BUS_NAME,
PORTAL_INHIBIT_INTERFACE,
"StateChanged",
PORTAL_OBJECT_PATH,
NULL,
G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE,
screensaver_signal_portal,
impl->application,
NULL);
g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&opt_builder, "{sv}",
"session_handle_token", g_variant_new_string (token));
g_dbus_proxy_call (dbus->inhibit_proxy,
"CreateMonitor",
g_variant_new ("(sa{sv})", "", &opt_builder),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT,
NULL,
create_monitor_cb, dbus);
g_free (token);
}
}
end:;
}
static void
@@ -731,9 +608,9 @@ gtk_application_impl_dbus_uninhibit (GtkApplicationImpl *impl,
if (handle->cookie == cookie)
{
g_dbus_connection_call (dbus->session,
PORTAL_BUS_NAME,
"org.freedesktop.portal.Desktop",
handle->handle,
PORTAL_REQUEST_INTERFACE,
"org.freedesktop.portal.Request",
"Close",
g_variant_new ("()"),
G_VARIANT_TYPE_UNIT,
@@ -790,21 +667,11 @@ gtk_application_impl_dbus_finalize (GObject *object)
{
GtkApplicationImplDBus *dbus = (GtkApplicationImplDBus *) object;
g_dbus_connection_call (dbus->session,
PORTAL_BUS_NAME,
dbus->session_id,
PORTAL_SESSION_INTERFACE,
"Close",
NULL, NULL, 0, -1, NULL, NULL, NULL);
g_free (dbus->session_id);
g_dbus_connection_signal_unsubscribe (dbus->session, dbus->state_changed_handler);
g_clear_object (&dbus->inhibit_proxy);
g_slist_free_full (dbus->inhibit_handles, inhibit_handle_free);
g_free (dbus->app_menu_path);
g_free (dbus->menubar_path);
g_clear_object (&dbus->sm_proxy);
g_clear_object (&dbus->ss_proxy);
G_OBJECT_CLASS (gtk_application_impl_dbus_parent_class)->finalize (object);
}
-37
View File
@@ -137,7 +137,6 @@ static guint gtk_application_signals[LAST_SIGNAL];
enum {
PROP_ZERO,
PROP_REGISTER_SESSION,
PROP_SCREENSAVER_ACTIVE,
PROP_APP_MENU,
PROP_MENUBAR,
PROP_ACTIVE_WINDOW,
@@ -158,7 +157,6 @@ typedef struct
guint last_window_id;
gboolean register_session;
gboolean screensaver_active;
GtkActionMuxer *muxer;
GtkBuilder *menus_builder;
gchar *help_overlay_path;
@@ -536,10 +534,6 @@ gtk_application_get_property (GObject *object,
g_value_set_boolean (value, priv->register_session);
break;
case PROP_SCREENSAVER_ACTIVE:
g_value_set_boolean (value, priv->screensaver_active);
break;
case PROP_APP_MENU:
g_value_set_object (value, gtk_application_get_app_menu (application));
break;
@@ -667,24 +661,6 @@ gtk_application_class_init (GtkApplicationClass *class)
FALSE,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
/**
* GtkApplication:screensaver-active:
*
* This property is %TRUE if GTK+ believes that the screensaver is
* currently active. GTK+ only tracks session state (including this)
* when #GtkApplication::register-session is set to %TRUE.
*
* Tracking the screensaver state is supported on Linux.
*
* Since: 3.24
*/
gtk_application_props[PROP_SCREENSAVER_ACTIVE] =
g_param_spec_boolean ("screensaver-active",
P_("Screensaver Active"),
P_("Whether the screensaver is active"),
FALSE,
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
gtk_application_props[PROP_APP_MENU] =
g_param_spec_object ("app-menu",
P_("Application menu"),
@@ -1394,16 +1370,3 @@ gtk_application_get_menu_by_id (GtkApplication *application,
return G_MENU (object);
}
void
gtk_application_set_screensaver_active (GtkApplication *application,
gboolean active)
{
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
if (priv->screensaver_active != active)
{
priv->screensaver_active = active;
g_object_notify (G_OBJECT (application), "screensaver-active");
}
}
-6
View File
@@ -45,9 +45,6 @@ void gtk_application_insert_action_group (GtkAppl
GtkApplicationAccels * gtk_application_get_application_accels (GtkApplication *application);
void gtk_application_set_screensaver_active (GtkApplication *application,
gboolean active);
#define GTK_TYPE_APPLICATION_IMPL (gtk_application_impl_get_type ())
#define GTK_APPLICATION_IMPL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
GTK_TYPE_APPLICATION_IMPL, \
@@ -132,13 +129,10 @@ typedef struct
GDBusProxy *sm_proxy;
GDBusProxy *client_proxy;
gchar *client_path;
GDBusProxy *ss_proxy;
/* Portal support */
GDBusProxy *inhibit_proxy;
GSList *inhibit_handles;
guint state_changed_handler;
char * session_id;
} GtkApplicationImplDBus;
typedef struct
+143 -17
View File
@@ -886,9 +886,128 @@ gtk_box_pack (GtkBox *box,
gtk_widget_thaw_child_notify (child);
}
static void
gtk_box_get_size (GtkWidget *widget,
GtkOrientation orientation,
gint *minimum_size,
gint *natural_size,
gint *minimum_baseline,
gint *natural_baseline)
{
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
gint nvis_children;
gint minimum, natural;
gint minimum_above, natural_above;
gint minimum_below, natural_below;
gboolean have_baseline;
gint min_baseline, nat_baseline;
GtkWidget *child;
have_baseline = FALSE;
minimum = natural = 0;
minimum_above = natural_above = 0;
minimum_below = natural_below = 0;
min_baseline = nat_baseline = -1;
nvis_children = 0;
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
if (_gtk_widget_get_visible (child))
{
gint child_minimum, child_natural;
gint child_minimum_baseline = -1, child_natural_baseline = -1;
gtk_widget_measure (child,
orientation,
-1,
&child_minimum, &child_natural,
&child_minimum_baseline, &child_natural_baseline);
if (priv->orientation == orientation)
{
if (priv->homogeneous)
{
minimum = MAX (minimum, child_minimum);
natural = MAX (natural, child_natural);
}
else
{
minimum += child_minimum;
natural += child_natural;
}
}
else
{
if (child_minimum_baseline >= 0)
{
have_baseline = TRUE;
minimum_below = MAX (minimum_below, child_minimum - child_minimum_baseline);
natural_below = MAX (natural_below, child_natural - child_natural_baseline);
minimum_above = MAX (minimum_above, child_minimum_baseline);
natural_above = MAX (natural_above, child_natural_baseline);
}
else
{
/* The biggest mins and naturals in the opposing orientation */
minimum = MAX (minimum, child_minimum);
natural = MAX (natural, child_natural);
}
}
nvis_children += 1;
}
}
if (nvis_children > 0 && priv->orientation == orientation)
{
gint spacing = get_spacing (box);
if (priv->homogeneous)
{
minimum *= nvis_children;
natural *= nvis_children;
}
minimum += (nvis_children - 1) * spacing;
natural += (nvis_children - 1) * spacing;
}
minimum = MAX (minimum, minimum_below + minimum_above);
natural = MAX (natural, natural_below + natural_above);
if (have_baseline)
{
switch (priv->baseline_pos)
{
case GTK_BASELINE_POSITION_TOP:
min_baseline = minimum_above;
nat_baseline = natural_above;
break;
case GTK_BASELINE_POSITION_CENTER:
min_baseline = minimum_above + (minimum - (minimum_above + minimum_below)) / 2;
nat_baseline = natural_above + (natural - (natural_above + natural_below)) / 2;
break;
case GTK_BASELINE_POSITION_BOTTOM:
min_baseline = minimum - minimum_below;
nat_baseline = natural - natural_below;
break;
default:
break;
}
}
*minimum_size = minimum;
*natural_size = natural;
*minimum_baseline = min_baseline;
*natural_baseline = nat_baseline;
}
static void
gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
int for_size,
gint avail_size,
gint *minimum_size,
gint *natural_size,
gint *minimum_baseline,
@@ -919,7 +1038,7 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
spacing = get_spacing (box);
sizes = g_newa (GtkRequestedSize, nvis_children);
extra_space = MAX (0, for_size - (nvis_children - 1) * spacing);
extra_space = avail_size - (nvis_children - 1) * spacing;
/* Retrieve desired size for visible children */
for (i = 0, child = _gtk_widget_get_first_child (widget);
@@ -1061,16 +1180,16 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box,
static void
gtk_box_compute_size_for_orientation (GtkBox *box,
int for_size,
int *minimum_size,
int *natural_size)
gint avail_size,
gint *minimum_size,
gint *natural_size)
{
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
GtkWidget *child;
const int spacing = get_spacing (box);
int nvis_children = 0;
int required_size = 0, required_natural = 0;
int largest_child = 0, largest_natural = 0;
gint nvis_children = 0;
gint required_size = 0, required_natural = 0, child_size, child_natural;
gint largest_child = 0, largest_natural = 0;
gint spacing = get_spacing (box);
for (child = gtk_widget_get_first_child (GTK_WIDGET (box));
child != NULL;
@@ -1078,16 +1197,18 @@ gtk_box_compute_size_for_orientation (GtkBox *box,
{
if (_gtk_widget_get_visible (child))
{
int child_size, child_natural;
gtk_widget_measure (child,
priv->orientation,
for_size,
avail_size,
&child_size, &child_natural,
NULL, NULL);
largest_child = MAX (largest_child, child_size);
largest_natural = MAX (largest_natural, child_natural);
if (child_size > largest_child)
largest_child = child_size;
if (child_natural > largest_natural)
largest_natural = child_natural;
required_size += child_size;
required_natural += child_natural;
@@ -1122,13 +1243,18 @@ gtk_box_measure (GtkWidget *widget,
int *minimum_baseline,
int *natural_baseline)
{
GtkBox *box = GTK_BOX (widget);
GtkBox *box = GTK_BOX (widget);
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
if (priv->orientation != orientation)
gtk_box_compute_size_for_opposing_orientation (box, for_size, minimum, natural, minimum_baseline, natural_baseline);
if (for_size < 0)
gtk_box_get_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
else
gtk_box_compute_size_for_orientation (box, for_size, minimum, natural);
{
if (priv->orientation != orientation)
gtk_box_compute_size_for_opposing_orientation (box, for_size, minimum, natural, minimum_baseline, natural_baseline);
else
gtk_box_compute_size_for_orientation (box, for_size, minimum, natural);
}
}
static void
+17
View File
@@ -256,6 +256,22 @@ gtk_check_button_get_property (GObject *object,
}
}
static void
gtk_check_button_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
GtkWidget *child;
if (priv->draw_indicator)
gtk_widget_snapshot_child (widget, priv->indicator_widget, snapshot);
child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
gtk_widget_snapshot_child (widget, child, snapshot);
}
static void
gtk_check_button_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction)
@@ -290,6 +306,7 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
widget_class->measure = gtk_check_button_measure;
widget_class->size_allocate = gtk_check_button_size_allocate;
widget_class->snapshot = gtk_check_button_snapshot;
widget_class->state_flags_changed = gtk_check_button_state_flags_changed;
widget_class->direction_changed = gtk_check_button_direction_changed;
+1 -1
View File
@@ -355,7 +355,7 @@ gtk_color_button_drag_data_get (GtkWidget *widget,
gtk_selection_data_set (selection_data,
gtk_selection_data_get_target (selection_data),
16, (guchar *)dropped, 8);
(guchar *)dropped, 8);
}
static void
+9 -10
View File
@@ -20,7 +20,7 @@
#include "gtkcolorpickerprivate.h"
#include "gtkcolorpickerportalprivate.h"
#include "gtkcolorpickershellprivate.h"
#include "gtkcolorpickerkwinprivate.h"
#include "gtkprivate.h"
#include <gio/gio.h>
@@ -53,16 +53,15 @@ gtk_color_picker_new (void)
{
GtkColorPicker *picker;
picker = gtk_color_picker_portal_new ();
if (!picker)
picker = gtk_color_picker_shell_new ();
if (!picker)
picker = gtk_color_picker_kwin_new ();
if (!picker)
g_debug ("No suitable GtkColorPicker implementation");
if (gtk_should_use_portal ())
picker = gtk_color_picker_portal_new ();
else
g_debug ("Using %s for picking colors", G_OBJECT_TYPE_NAME (picker));
picker = gtk_color_picker_shell_new ();
if (picker)
g_debug ("Using %s for picking colors", g_type_name_from_instance (picker));
else
g_debug ("No suitable GtkColorPicker implementation\n");
return picker;
}
-187
View File
@@ -1,187 +0,0 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2018, 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 "gtkcolorpickerkwinprivate.h"
#include <gio/gio.h>
struct _GtkColorPickerKwin
{
GObject parent_instance;
GDBusProxy *kwin_proxy;
GTask *task;
};
struct _GtkColorPickerKwinClass
{
GObjectClass parent_class;
};
static GInitableIface *initable_parent_iface;
static void gtk_color_picker_kwin_initable_iface_init (GInitableIface *iface);
static void gtk_color_picker_kwin_iface_init (GtkColorPickerInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkColorPickerKwin, gtk_color_picker_kwin, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gtk_color_picker_kwin_initable_iface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_COLOR_PICKER, gtk_color_picker_kwin_iface_init))
static gboolean
gtk_color_picker_kwin_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
GtkColorPickerKwin *picker = GTK_COLOR_PICKER_KWIN (initable);
char *owner;
picker->kwin_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
"org.kde.KWin",
"/ColorPicker",
"org.kde.kwin.ColorPicker",
NULL,
error);
if (picker->kwin_proxy == NULL)
{
g_debug ("Failed to create kwin colorpicker proxy");
return FALSE;
}
owner = g_dbus_proxy_get_name_owner (picker->kwin_proxy);
if (owner == NULL)
{
g_debug ("org.kde.kwin.ColorPicker not provided");
g_clear_object (&picker->kwin_proxy);
return FALSE;
}
g_free (owner);
return TRUE;
}
static void
gtk_color_picker_kwin_initable_iface_init (GInitableIface *iface)
{
initable_parent_iface = g_type_interface_peek_parent (iface);
iface->init = gtk_color_picker_kwin_initable_init;
}
static void
gtk_color_picker_kwin_init (GtkColorPickerKwin *picker)
{
}
static void
gtk_color_picker_kwin_finalize (GObject *object)
{
GtkColorPickerKwin *picker = GTK_COLOR_PICKER_KWIN (object);
g_clear_object (&picker->kwin_proxy);
G_OBJECT_CLASS (gtk_color_picker_kwin_parent_class)->finalize (object);
}
static void
gtk_color_picker_kwin_class_init (GtkColorPickerKwinClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gtk_color_picker_kwin_finalize;
}
GtkColorPicker *
gtk_color_picker_kwin_new (void)
{
return GTK_COLOR_PICKER (g_initable_new (GTK_TYPE_COLOR_PICKER_KWIN, NULL, NULL, NULL));
}
static void
color_picked (GObject *source,
GAsyncResult *res,
gpointer data)
{
GtkColorPickerKwin *picker = GTK_COLOR_PICKER_KWIN (data);
GError *error = NULL;
GVariant *ret;
ret = g_dbus_proxy_call_finish (picker->kwin_proxy, res, &error);
if (ret == NULL)
{
g_task_return_error (picker->task, error);
}
else
{
GdkRGBA c;
guint32 color;
g_variant_get (ret, "(u)", &color);
c.blue = ( color & 0xff) / 255.0;
c.green = ((color >> 8) & 0xff) / 255.0;
c.red = ((color >> 16) & 0xff) / 255.0;
c.alpha = ((color >> 24) & 0xff) / 255.0;
g_task_return_pointer (picker->task, gdk_rgba_copy (&c), (GDestroyNotify)gdk_rgba_free);
g_variant_unref (ret);
}
g_clear_object (&picker->task);
}
static void
gtk_color_picker_kwin_pick (GtkColorPicker *cp,
GAsyncReadyCallback callback,
gpointer user_data)
{
GtkColorPickerKwin *picker = GTK_COLOR_PICKER_KWIN (cp);
if (picker->task)
return;
picker->task = g_task_new (picker, NULL, callback, user_data);
g_dbus_proxy_call (picker->kwin_proxy,
"pick",
NULL,
0,
-1,
NULL,
color_picked,
picker);
}
static GdkRGBA *
gtk_color_picker_kwin_pick_finish (GtkColorPicker *cp,
GAsyncResult *res,
GError **error)
{
g_return_val_if_fail (g_task_is_valid (res, cp), NULL);
return g_task_propagate_pointer (G_TASK (res), error);
}
static void
gtk_color_picker_kwin_iface_init (GtkColorPickerInterface *iface)
{
iface->pick = gtk_color_picker_kwin_pick;
iface->pick_finish = gtk_color_picker_kwin_pick_finish;
}
-41
View File
@@ -1,41 +0,0 @@
/*
* GTK - The GIMP Toolkit
* Copyright (C) 2018 Red Hat, Inc.
* All rights reserved.
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_COLOR_PICKER_KWIN_H__
#define __GTK_COLOR_PICKER_KWIN_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkcolorpickerprivate.h>
G_BEGIN_DECLS
#define GTK_TYPE_COLOR_PICKER_KWIN gtk_color_picker_kwin_get_type ()
G_DECLARE_FINAL_TYPE (GtkColorPickerKwin, gtk_color_picker_kwin, GTK, COLOR_PICKER_KWIN, GObject)
GDK_AVAILABLE_IN_ALL
GtkColorPicker * gtk_color_picker_kwin_new (void);
G_END_DECLS
#endif /* __GTK_COLOR_PICKER_KWIN_H__ */
+18 -13
View File
@@ -18,7 +18,6 @@
#include "config.h"
#include "gtkcolorpickerportalprivate.h"
#include "gtkprivate.h"
#include <gio/gio.h>
struct _GtkColorPickerPortal
@@ -53,28 +52,25 @@ gtk_color_picker_portal_initable_init (GInitable *initable,
GVariant *ret;
guint version;
if (!gtk_should_use_portal ())
return FALSE;
picker->portal_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_SCREENSHOT_INTERFACE,
"org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop",
"org.freedesktop.portal.Screenshot",
NULL,
error);
if (picker->portal_proxy == NULL)
{
g_debug ("Failed to create screenshot portal proxy");
g_debug ("Failed to create screnshot portal proxy");
return FALSE;
}
owner = g_dbus_proxy_get_name_owner (picker->portal_proxy);
if (owner == NULL)
{
g_debug ("%s not provided", PORTAL_SCREENSHOT_INTERFACE);
g_debug ("org.freedesktop.portal.Screenshot not provided");
g_clear_object (&picker->portal_proxy);
return FALSE;
}
@@ -178,9 +174,11 @@ gtk_color_picker_portal_pick (GtkColorPicker *cp,
{
GtkColorPickerPortal *picker = GTK_COLOR_PICKER_PORTAL (cp);
GVariantBuilder options;
GDBusConnection *connection;
char *token;
GDBusConnection *connection;
char *sender;
char *handle;
int i;
if (picker->task)
return;
@@ -189,10 +187,16 @@ gtk_color_picker_portal_pick (GtkColorPicker *cp,
connection = g_dbus_proxy_get_connection (picker->portal_proxy);
handle = gtk_get_portal_request_path (connection, &token);
token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
sender = g_strdup (g_dbus_connection_get_unique_name (connection) + 1);
for (i = 0; sender[i]; i++)
if (sender[i] == '.')
sender[i] = '_';
handle = g_strdup_printf ("/org/freedesktop/portal/desktop/request/%s/%s", sender, token);
picker->portal_signal_id = g_dbus_connection_signal_subscribe (connection,
PORTAL_BUS_NAME,
PORTAL_REQUEST_INTERFACE,
"org.freedesktop.portal.Desktop",
"org.freedesktop.portal.Request",
"Response",
handle,
NULL,
@@ -202,6 +206,7 @@ gtk_color_picker_portal_pick (GtkColorPicker *cp,
NULL);
g_free (handle);
g_free (sender);
g_variant_builder_init (&options, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&options, "{sv}", "handle_token", g_variant_new_string (token));
+2 -5
View File
@@ -119,7 +119,7 @@ color_picked (GObject *source,
{
GtkColorPickerShell *picker = GTK_COLOR_PICKER_SHELL (data);
GError *error = NULL;
GVariant *ret, *dict;
GVariant *ret;
ret = g_dbus_proxy_call_finish (picker->shell_proxy, res, &error);
@@ -131,15 +131,12 @@ color_picked (GObject *source,
{
GdkRGBA c;
g_variant_get (ret, "(@a{sv})", &dict);
c.alpha = 1;
if (!g_variant_lookup (dict, "color", "(ddd)", &c.red, &c.green, &c.blue))
if (!g_variant_lookup (ret, "color", "(ddd)", &c.red, &c.green, &c.blue))
g_task_return_new_error (picker->task, G_IO_ERROR, G_IO_ERROR_FAILED, "No color received");
else
g_task_return_pointer (picker->task, gdk_rgba_copy (&c), (GDestroyNotify)gdk_rgba_free);
g_variant_unref (dict);
g_variant_unref (ret);
}
+3 -1
View File
@@ -202,7 +202,7 @@ swatch_drag_data_get (GtkWidget *widget,
gtk_selection_data_set (selection_data,
g_intern_static_string ("application/x-color"),
16, (guchar *)vals, 8);
(guchar *)vals, 8);
}
static void
@@ -380,6 +380,8 @@ gtk_color_swatch_measure (GtkWidget *widget,
GtkColorSwatchPrivate *priv = gtk_color_swatch_get_instance_private (swatch);
gint w, h, min;
swatch = GTK_COLOR_SWATCH (widget);
gtk_widget_measure (priv->overlay_widget,
orientation,
-1,
+399
View File
@@ -117,6 +117,29 @@
* the same translatable, comments and context attributes that are used
* for regular properties.
*
* Containers can have a <focus-chain> element containing multiple
* <widget> elements, one for each child that should be added to the focus
* chain. The name attribute gives the id of the widget.
*
* An example of these properties in UI definitions:
* |[
* <object class="GtkBox">
* <child>
* <object class="GtkEntry" id="entry1"/>
* <packing>
* <property name="pack-type">start</property>
* </packing>
* </child>
* <child>
* <object class="GtkEntry" id="entry2"/>
* </child>
* <focus-chain>
* <widget name="entry1"/>
* <widget name="entry2"/>
* </focus-chain>
* </object>
* ]|
*
*/
@@ -124,6 +147,7 @@ struct _GtkContainerPrivate
{
guint resize_handler;
guint has_focus_chain : 1;
guint restyle_pending : 1;
};
@@ -153,6 +177,8 @@ static void gtk_container_real_check_resize (GtkContainer *container
static void gtk_container_compute_expand (GtkWidget *widget,
gboolean *hexpand_p,
gboolean *vexpand_p);
static gboolean gtk_container_focus (GtkWidget *widget,
GtkDirectionType direction);
static void gtk_container_real_set_focus_child (GtkContainer *container,
GtkWidget *widget);
@@ -180,10 +206,16 @@ static void gtk_container_buildable_custom_tag_end (GtkBuildable *buildable,
GObject *child,
const gchar *tagname,
gpointer *data);
static void gtk_container_buildable_custom_finished (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *tagname,
gpointer data);
/* --- variables --- */
static GQuark vadjustment_key_id;
static GQuark hadjustment_key_id;
static GQuark quark_focus_chain;
static guint container_signals[LAST_SIGNAL] = { 0 };
static gint GtkContainer_private_offset;
static GtkWidgetClass *gtk_container_parent_class = NULL;
@@ -278,9 +310,11 @@ gtk_container_class_init (GtkContainerClass *class)
vadjustment_key_id = g_quark_from_static_string ("gtk-vadjustment");
hadjustment_key_id = g_quark_from_static_string ("gtk-hadjustment");
quark_focus_chain = g_quark_from_static_string ("gtk-container-focus-chain");
widget_class->destroy = gtk_container_destroy;
widget_class->compute_expand = gtk_container_compute_expand;
widget_class->focus = gtk_container_focus;
widget_class->get_request_mode = gtk_container_get_request_mode;
class->add = gtk_container_add_unimplemented;
@@ -340,6 +374,7 @@ gtk_container_buildable_init (GtkBuildableIface *iface)
iface->add_child = gtk_container_buildable_add_child;
iface->custom_tag_start = gtk_container_buildable_custom_tag_start;
iface->custom_tag_end = gtk_container_buildable_custom_tag_end;
iface->custom_finished = gtk_container_buildable_custom_finished;
}
static void
@@ -567,6 +602,85 @@ static const GMarkupParser packing_parser =
packing_text_element,
};
typedef struct
{
gchar *name;
gint line;
gint col;
} FocusChainWidget;
static void
focus_chain_widget_free (gpointer data)
{
FocusChainWidget *fcw = data;
g_free (fcw->name);
g_free (fcw);
}
typedef struct
{
GSList *items;
GObject *object;
GtkBuilder *builder;
gint line;
gint col;
} FocusChainData;
static void
focus_chain_start_element (GMarkupParseContext *context,
const gchar *element_name,
const gchar **names,
const gchar **values,
gpointer user_data,
GError **error)
{
FocusChainData *data = (FocusChainData*)user_data;
if (strcmp (element_name, "widget") == 0)
{
const gchar *name;
FocusChainWidget *fcw;
if (!_gtk_builder_check_parent (data->builder, context, "focus-chain", error))
return;
if (!g_markup_collect_attributes (element_name, names, values, error,
G_MARKUP_COLLECT_STRING, "name", &name,
G_MARKUP_COLLECT_INVALID))
{
_gtk_builder_prefix_error (data->builder, context, error);
return;
}
fcw = g_new (FocusChainWidget, 1);
fcw->name = g_strdup (name);
g_markup_parse_context_get_position (context, &fcw->line, &fcw->col);
data->items = g_slist_prepend (data->items, fcw);
}
else if (strcmp (element_name, "focus-chain") == 0)
{
if (!_gtk_builder_check_parent (data->builder, context, "object", error))
return;
if (!g_markup_collect_attributes (element_name, names, values, error,
G_MARKUP_COLLECT_INVALID, "", NULL,
G_MARKUP_COLLECT_INVALID))
_gtk_builder_prefix_error (data->builder, context, error);
}
else
{
_gtk_builder_error_unhandled_tag (data->builder, context,
"GtkContainer", element_name,
error);
}
}
static const GMarkupParser focus_chain_parser =
{
focus_chain_start_element
};
static gboolean
gtk_container_buildable_custom_tag_start (GtkBuildable *buildable,
GtkBuilder *builder,
@@ -593,6 +707,20 @@ gtk_container_buildable_custom_tag_start (GtkBuildable *buildable,
*parser = packing_parser;
*parser_data = data;
return TRUE;
}
else if (!child && strcmp (tagname, "focus-chain") == 0)
{
FocusChainData *data;
data = g_slice_new0 (FocusChainData);
data->items = NULL;
data->object = G_OBJECT (buildable);
data->builder = builder;
*parser = focus_chain_parser;
*parser_data = data;
return TRUE;
}
@@ -621,6 +749,45 @@ gtk_container_buildable_custom_tag_end (GtkBuildable *buildable,
child, tagname, parser_data);
}
static void
gtk_container_buildable_custom_finished (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
const gchar *tagname,
gpointer parser_data)
{
if (strcmp (tagname, "focus-chain") == 0)
{
FocusChainData *data = (FocusChainData*)parser_data;
FocusChainWidget *fcw;
GSList *l;
GList *chain;
GObject *object;
chain = NULL;
for (l = data->items; l; l = l->next)
{
fcw = l->data;
object = _gtk_builder_lookup_object (builder, fcw->name, fcw->line, fcw->col);
if (!object)
continue;
chain = g_list_prepend (chain, object);
}
gtk_container_set_focus_chain (GTK_CONTAINER (data->object), chain);
g_list_free (chain);
g_slist_free_full (data->items, focus_chain_widget_free);
g_slice_free (FocusChainData, data);
return;
}
if (parent_buildable_iface->custom_finished)
parent_buildable_iface->custom_finished (buildable, builder,
child, tagname, parser_data);
}
/**
* gtk_container_child_type:
* @container: a #GtkContainer
@@ -1274,6 +1441,12 @@ gtk_container_destroy (GtkWidget *widget)
if (priv->restyle_pending)
priv->restyle_pending = FALSE;
/* do this before walking child widgets, to avoid
* removing children from focus chain one by one.
*/
if (priv->has_focus_chain)
gtk_container_unset_focus_chain (container);
gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
GTK_WIDGET_CLASS (gtk_container_parent_class)->destroy (widget);
@@ -1710,6 +1883,12 @@ gtk_container_real_set_focus_child (GtkContainer *container,
}
}
static GList*
get_focus_chain (GtkContainer *container)
{
return g_object_get_qdata (G_OBJECT (container), quark_focus_chain);
}
static GtkWidgetPath *
gtk_container_real_get_path_for_child (GtkContainer *container,
GtkWidget *child)
@@ -1724,6 +1903,73 @@ gtk_container_real_get_path_for_child (GtkContainer *container,
return path;
}
/* Utility function, equivalent to g_list_reverse */
static void
reverse_ptr_array (GPtrArray *arr)
{
int i;
for (i = 0; i < arr->len / 2; i ++)
{
void *a = g_ptr_array_index (arr, i);
void *b = g_ptr_array_index (arr, arr->len - 1 - i);
arr->pdata[i] = b;
arr->pdata[arr->len - 1 - i] = a;
}
}
static gboolean
gtk_container_focus (GtkWidget *widget,
GtkDirectionType direction)
{
GtkContainerPrivate *priv;
gint return_val = FALSE;
GtkContainer *container;
g_return_val_if_fail (GTK_IS_CONTAINER (widget), FALSE);
container = GTK_CONTAINER (widget);
priv = gtk_container_get_instance_private (container);
if (!priv->has_focus_chain)
{
return_val = GTK_WIDGET_CLASS (gtk_container_parent_class)->focus (widget, direction);
}
else
{
GList *focus_chain;
GList *l;
GPtrArray *child_array;
/* Here we compute the next focus child based on the focus chain set on @container.
* If we move via TAB, we consider the focus chain widgets in the order given to us (or in reverse).
* If UP/DOWN/LEFT/RIGHT are used, we sort the focus chain like normal, using their allocation. */
focus_chain = get_focus_chain (container);
child_array = g_ptr_array_sized_new (g_list_length (focus_chain));
for (l = focus_chain; l; l = l->next)
g_ptr_array_add (child_array, l->data);
if (direction == GTK_DIR_TAB_BACKWARD)
{
/* Reverse order for gtk_widget_focus_move to consider */
reverse_ptr_array (child_array);
}
else if (direction != GTK_DIR_TAB_FORWARD)
{
/* Nothing to be done. We don't sort the children, and we don't reverse them either. */
gtk_widget_focus_sort (widget, direction, child_array);
}
return_val = gtk_widget_focus_move (widget, direction, child_array);
g_ptr_array_free (child_array, TRUE);
}
return return_val;
}
static void
gtk_container_children_callback (GtkWidget *widget,
gpointer client_data)
@@ -1734,6 +1980,159 @@ gtk_container_children_callback (GtkWidget *widget,
*children = g_list_prepend (*children, widget);
}
static void
chain_widget_destroyed (GtkWidget *widget,
gpointer user_data)
{
GtkContainer *container;
GList *chain;
container = GTK_CONTAINER (user_data);
chain = g_object_get_qdata (G_OBJECT (container), quark_focus_chain);
chain = g_list_remove (chain, widget);
g_signal_handlers_disconnect_by_func (widget,
chain_widget_destroyed,
user_data);
g_object_set_qdata (G_OBJECT (container), quark_focus_chain, chain);
}
/**
* gtk_container_set_focus_chain:
* @container: a #GtkContainer
* @focusable_widgets: (transfer none) (element-type GtkWidget):
* the new focus chain
*
* Sets a focus chain, overriding the one computed automatically by GTK+.
*
* In principle each widget in the chain should be a descendant of the
* container, but this is not enforced by this method, since its allowed
* to set the focus chain before you pack the widgets, or have a widget
* in the chain that isnt always packed. The necessary checks are done
* when the focus chain is actually traversed.
**/
void
gtk_container_set_focus_chain (GtkContainer *container,
GList *focusable_widgets)
{
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
GList *chain;
GList *tmp_list;
g_return_if_fail (GTK_IS_CONTAINER (container));
if (priv->has_focus_chain)
gtk_container_unset_focus_chain (container);
priv->has_focus_chain = TRUE;
chain = NULL;
tmp_list = focusable_widgets;
while (tmp_list != NULL)
{
g_return_if_fail (GTK_IS_WIDGET (tmp_list->data));
/* In principle each widget in the chain should be a descendant
* of the container, but we don't want to check that here. It's
* expensive and also it's allowed to set the focus chain before
* you pack the widgets, or have a widget in the chain that isn't
* always packed. So we check for ancestor during actual traversal.
*/
chain = g_list_prepend (chain, tmp_list->data);
g_signal_connect (tmp_list->data,
"destroy",
G_CALLBACK (chain_widget_destroyed),
container);
tmp_list = tmp_list->next;
}
chain = g_list_reverse (chain);
g_object_set_qdata (G_OBJECT (container), quark_focus_chain, chain);
}
/**
* gtk_container_get_focus_chain:
* @container: a #GtkContainer
* @focusable_widgets: (element-type GtkWidget) (out) (transfer container): location
* to store the focus chain of the
* container, or %NULL. You should free this list
* using g_list_free() when you are done with it, however
* no additional reference count is added to the
* individual widgets in the focus chain.
*
* Retrieves the focus chain of the container, if one has been
* set explicitly. If no focus chain has been explicitly
* set, GTK+ computes the focus chain based on the positions
* of the children. In that case, GTK+ stores %NULL in
* @focusable_widgets and returns %FALSE.
*
* Returns: %TRUE if the focus chain of the container
* has been set explicitly.
**/
gboolean
gtk_container_get_focus_chain (GtkContainer *container,
GList **focus_chain)
{
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
if (focus_chain)
{
if (priv->has_focus_chain)
*focus_chain = g_list_copy (get_focus_chain (container));
else
*focus_chain = NULL;
}
return priv->has_focus_chain;
}
/**
* gtk_container_unset_focus_chain:
* @container: a #GtkContainer
*
* Removes a focus chain explicitly set with gtk_container_set_focus_chain().
**/
void
gtk_container_unset_focus_chain (GtkContainer *container)
{
GtkContainerPrivate *priv = gtk_container_get_instance_private (container);
g_return_if_fail (GTK_IS_CONTAINER (container));
if (priv->has_focus_chain)
{
GList *chain;
GList *tmp_list;
chain = get_focus_chain (container);
priv->has_focus_chain = FALSE;
g_object_set_qdata (G_OBJECT (container), quark_focus_chain, NULL);
tmp_list = chain;
while (tmp_list != NULL)
{
g_signal_handlers_disconnect_by_func (tmp_list->data,
chain_widget_destroyed,
container);
tmp_list = tmp_list->next;
}
g_list_free (chain);
}
}
/**
* gtk_container_set_focus_vadjustment:
* @container: a #GtkContainer
+9
View File
@@ -134,6 +134,15 @@ void gtk_container_foreach (GtkContainer *container,
GDK_AVAILABLE_IN_ALL
GList* gtk_container_get_children (GtkContainer *container);
GDK_AVAILABLE_IN_ALL
void gtk_container_set_focus_chain (GtkContainer *container,
GList *focusable_widgets);
GDK_AVAILABLE_IN_ALL
gboolean gtk_container_get_focus_chain (GtkContainer *container,
GList **focusable_widgets);
GDK_AVAILABLE_IN_ALL
void gtk_container_unset_focus_chain (GtkContainer *container);
/* Widget-level methods */
GDK_AVAILABLE_IN_ALL
void gtk_container_set_focus_vadjustment (GtkContainer *container,
-1
View File
@@ -166,7 +166,6 @@ gtk_drag_get_data_finish (GtkDragGetData *data,
sdata.target = data->mime_type;
sdata.type = data->mime_type;
sdata.format = 8;
sdata.length = size;
sdata.data = bytes;
sdata.display = gtk_widget_get_display (data->widget);
+4 -11
View File
@@ -577,8 +577,10 @@ gtk_entry_completion_constructed (GObject *object)
/* pack it all */
priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_use_subsurface (GTK_WINDOW (priv->popup_window), TRUE);
gtk_window_set_resizable (GTK_WINDOW (priv->popup_window), FALSE);
gtk_window_set_type_hint (GTK_WINDOW(priv->popup_window), GDK_SURFACE_TYPE_HINT_COMBO);
gtk_window_set_type_hint (GTK_WINDOW(priv->popup_window),
GDK_SURFACE_TYPE_HINT_COMBO);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed",
@@ -1461,16 +1463,7 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
gtk_tree_path_free (path);
}
if (gtk_window_get_transient_for (GTK_WINDOW (completion->priv->popup_window)))
{
gdk_surface_move_to_rect (_gtk_widget_get_surface (completion->priv->popup_window),
&allocation,
GDK_GRAVITY_SOUTH,
GDK_GRAVITY_NORTH,
GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_SLIDE_X,
0, 0);
gtk_widget_show (completion->priv->popup_window);
}
gtk_window_move (GTK_WINDOW (completion->priv->popup_window), x, y);
}
static void
+21 -11
View File
@@ -152,9 +152,9 @@ send_close (FilechooserPortalData *data)
GDBusMessage *message;
GError *error = NULL;
message = g_dbus_message_new_method_call (PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_FILECHOOSER_INTERFACE,
message = g_dbus_message_new_method_call ("org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop",
"org.freedesktop.portal.FileChooser",
"Close");
g_dbus_message_set_body (message,
g_variant_new ("(o)", data->portal_handle));
@@ -216,8 +216,8 @@ open_file_msg_cb (GObject *source_object,
data->portal_response_signal_id =
g_dbus_connection_signal_subscribe (data->connection,
PORTAL_BUS_NAME,
PORTAL_REQUEST_INTERFACE,
"org.freedesktop.portal.Desktop",
"org.freedesktop.portal.Request",
"Response",
data->portal_handle,
NULL,
@@ -296,17 +296,27 @@ show_portal_file_chooser (GtkFileChooserNative *self,
gboolean multiple;
const char *title;
char *token;
char *sender;
int i;
message = g_dbus_message_new_method_call (PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_FILECHOOSER_INTERFACE,
message = g_dbus_message_new_method_call ("org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop",
"org.freedesktop.portal.FileChooser",
data->method_name);
data->portal_handle = gtk_get_portal_request_path (data->connection, &token);
token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
sender = g_strdup (g_dbus_connection_get_unique_name (data->connection) + 1);
for (i = 0; sender[i]; i++)
if (sender[i] == '.')
sender[i] = '_';
data->portal_handle = g_strdup_printf ("/org/fredesktop/portal/desktop/request/%s/%s", sender, token);
g_free (sender);
data->portal_response_signal_id =
g_dbus_connection_signal_subscribe (data->connection,
PORTAL_BUS_NAME,
PORTAL_REQUEST_INTERFACE,
"org.freedesktop.portal.Desktop",
"org.freedesktop.portal.Request",
"Response",
data->portal_handle,
NULL,
+1 -21
View File
@@ -6092,7 +6092,7 @@ gtk_file_chooser_widget_get_default_size (GtkFileChooserEmbed *chooser_embed,
{
gtk_widget_get_preferred_size (priv->extra_align,
&req, NULL);
*default_height += gtk_box_get_spacing (GTK_BOX (priv->box)) + req.height;
*default_height += gtk_box_get_spacing (GTK_BOX (chooser_embed)) + req.height;
}
}
@@ -7355,23 +7355,6 @@ recent_idle_cleanup (gpointer data)
g_free (load_data);
}
static gboolean
recent_item_is_private (GtkRecentInfo *info)
{
gboolean is_private = FALSE;
if (gtk_recent_info_get_private_hint (info))
{
const gchar *app_name = g_get_application_name ();
gchar **recent_apps = gtk_recent_info_get_applications (info, NULL);
is_private = !g_strv_contains ((const char *const*) recent_apps,
app_name);
g_strfreev (recent_apps);
}
return is_private;
}
/* Populates the file system model with the GtkRecentInfo* items
* in the provided list; frees the items
*/
@@ -7393,9 +7376,6 @@ populate_model_with_recent_items (GtkFileChooserWidget *impl,
GtkRecentInfo *info = l->data;
GFile *file;
if (recent_item_is_private (info))
continue;
file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
_gtk_file_system_model_add_and_query_file (priv->recent_model,
file,
+1
View File
@@ -82,6 +82,7 @@
typedef struct
{
GtkWidget *widget;
gint x;
gint y;
} GtkFixedChild;
+8 -1
View File
@@ -773,6 +773,8 @@ change_tweak (GSimpleAction *action,
g_simple_action_set_state (action, state);
}
#if defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT)
typedef struct {
guint32 tag;
GtkAdjustment *adjustment;
@@ -819,6 +821,8 @@ axis_free (gpointer v)
g_free (a);
}
#endif
static void
gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
{
@@ -831,7 +835,9 @@ gtk_font_chooser_widget_init (GtkFontChooserWidget *fontchooser)
gtk_widget_init_template (GTK_WIDGET (fontchooser));
#if defined(HAVE_HARFBUZZ) && defined(HAVE_PANGOFT)
priv->axes = g_hash_table_new_full (axis_hash, axis_equal, NULL, axis_free);
#endif
/* Default preview string */
priv->preview_text = g_strdup (pango_language_get_sample_string (NULL));
@@ -1183,7 +1189,8 @@ gtk_font_chooser_widget_finalize (GObject *object)
g_list_free_full (priv->feature_items, g_free);
g_hash_table_unref (priv->axes);
if (priv->axes)
g_hash_table_unref (priv->axes);
g_free (priv->font_features);
+2 -2
View File
@@ -187,8 +187,8 @@ gtk_gesture_stylus_get_axis (GtkGestureStylus *gesture,
/**
* gtk_gesture_stylus_get_axes:
* @gesture: a GtkGestureStylus
* @axes: (array): array of requested axes, terminated with #GDK_AXIS_IGNORE
* @values: (out) (array): return location for the axis values
* @axes: array of requested axes, terminated with #GDK_AXIS_IGNORE
* @values: (out): return location for the axis values
*
* Returns the current values for the requested @axes. This function
* must be called from either the #GtkGestureStylus:down,
+1 -1
View File
@@ -72,7 +72,7 @@
* # CSS nodes
*
* GtkImage has a single CSS node with the name image. The style classes
* .normal-icons or .large-icons may appear, depending on the #GtkImage:icon-size
* .normal-icons or .large-icons may appear, depending on the #GtkImage::icon-size
* property.
*/
+1 -1
View File
@@ -1440,7 +1440,7 @@ gtk_level_bar_get_offset_value (GtkLevelBar *self,
GList *existing;
GtkLevelBarOffset *offset = NULL;
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), FALSE);
g_return_val_if_fail (GTK_IS_LEVEL_BAR (self), 0.0);
existing = g_list_find_custom (priv->offsets, name, offset_find_func);
if (existing)
-1
View File
@@ -444,7 +444,6 @@ gtk_link_button_drag_data_get_cb (GtkWidget *widget,
uri = g_strdup_printf ("%s\r\n", priv->uri);
gtk_selection_data_set (selection,
gtk_selection_data_get_target (selection),
8,
(guchar *) uri,
strlen (uri));
+3 -11
View File
@@ -2262,7 +2262,6 @@ gtk_list_box_remove (GtkContainer *container,
gboolean was_visible;
gboolean was_selected;
GtkListBoxRow *row;
GSequenceIter *iter;
GSequenceIter *next;
was_visible = gtk_widget_get_visible (child);
@@ -2296,8 +2295,7 @@ gtk_list_box_remove (GtkContainer *container,
}
row = GTK_LIST_BOX_ROW (child);
iter = ROW_PRIV (row)->iter;
if (g_sequence_iter_get_sequence (iter) != priv->children)
if (g_sequence_iter_get_sequence (ROW_PRIV (row)->iter) != priv->children)
{
g_warning ("Tried to remove non-child %p", child);
return;
@@ -2328,15 +2326,9 @@ gtk_list_box_remove (GtkContainer *container,
if (row == priv->drag_highlighted_row)
gtk_list_box_drag_unhighlight_row (box);
next = gtk_list_box_get_next_visible (box, iter);
next = gtk_list_box_get_next_visible (box, ROW_PRIV (row)->iter);
gtk_widget_unparent (child);
g_sequence_remove (iter);
/* After unparenting, those values are garbage */
iter = NULL;
row = NULL;
child = NULL;
g_sequence_remove (ROW_PRIV (row)->iter);
if (gtk_widget_get_visible (widget))
gtk_list_box_update_header (box, next);
+2 -2
View File
@@ -1597,9 +1597,9 @@ handle_pointing_event (GdkEvent *event)
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_UPDATE:
case GDK_MOTION_NOTIFY:
target = gtk_widget_pick (toplevel_widget, x, y);
target = gtk_widget_pick (GTK_WIDGET (toplevel), x, y);
if (target == NULL)
target = toplevel_widget;
target = GTK_WIDGET (toplevel);
old_target = update_pointer_focus_state (toplevel, event, target);
if (event->any.type == GDK_MOTION_NOTIFY || event->any.type == GDK_ENTER_NOTIFY)
+37 -3
View File
@@ -1529,6 +1529,8 @@ gtk_menu_popup_internal (GtkMenu *menu,
menu_shell->priv->parent_menu_shell = parent_menu_shell;
priv->seen_item_enter = FALSE;
/* Find the last viewable ancestor, and make an X grab on it
*/
parent = GTK_WIDGET (menu);
@@ -2028,6 +2030,8 @@ gtk_menu_popdown (GtkMenu *menu)
menu_shell->priv->active = FALSE;
menu_shell->priv->ignore_enter = FALSE;
priv->have_position = FALSE;
gtk_menu_stop_scrolling (menu);
gtk_menu_stop_navigating_submenu (menu);
@@ -2576,7 +2580,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
child_allocation.width = (r - l) * base_width;
child_allocation.height = 0;
child_allocation.x = l * base_width;
child_allocation.y = - priv->scroll_offset;
child_allocation.y = 0;
for (i = 0; i < b; i++)
{
@@ -2705,6 +2709,7 @@ static void gtk_menu_measure (GtkWidget *widget,
NULL, NULL);
max_toggle_size = indicator_width;
gtk_widget_destroy (menu_item);
g_object_ref_sink (menu_item);
g_object_unref (menu_item);
}
@@ -2761,6 +2766,32 @@ static void gtk_menu_measure (GtkWidget *widget,
single_height += arrow_border.top + arrow_border.bottom;
min_height = MIN (min_height, single_height);
if (priv->have_position)
{
GdkDisplay *display;
GdkMonitor *monitor;
GdkRectangle workarea;
GtkBorder border;
display = gtk_widget_get_display (priv->toplevel);
monitor = gdk_display_get_monitor (display, priv->monitor_num);
gdk_monitor_get_workarea (monitor, &workarea);
if (priv->position_y + min_height > workarea.y + workarea.height)
min_height = workarea.y + workarea.height - priv->position_y;
if (priv->position_y + nat_height > workarea.y + workarea.height)
nat_height = workarea.y + workarea.height - priv->position_y;
_gtk_window_get_shadow_width (GTK_WINDOW (priv->toplevel), &border);
if (priv->position_y + border.top < workarea.y)
{
min_height -= workarea.y - (priv->position_y + border.top);
nat_height -= workarea.y - (priv->position_y + border.top);
}
}
*minimum = min_height;
*natural = nat_height;
@@ -3695,7 +3726,6 @@ gtk_menu_scroll_to (GtkMenu *menu,
gtk_css_node_set_state (bottom_arrow_node, priv->lower_arrow_state);
priv->scroll_offset = offset;
gtk_widget_queue_allocate (GTK_WIDGET (menu));
}
static gboolean
@@ -4048,10 +4078,14 @@ gtk_menu_move_current (GtkMenuShell *menu_shell,
static gint
get_visible_size (GtkMenu *menu)
{
GtkAllocation allocation;
GtkWidget *widget = GTK_WIDGET (menu);
GtkBorder arrow_border;
gint menu_height;
menu_height = gtk_widget_get_height (GTK_WIDGET (menu));
gtk_widget_get_allocation (widget, &allocation);
menu_height = allocation.height;
get_arrows_border (menu, &arrow_border);
menu_height -= arrow_border.top;
+1
View File
@@ -1151,6 +1151,7 @@ gtk_menu_button_set_popover (GtkMenuButton *menu_button,
g_signal_connect_swapped (priv->popover, "destroy",
G_CALLBACK (popover_destroy_cb), menu_button);
update_popover_direction (menu_button);
gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET (menu_button)), "menu-button");
}
if (popover && priv->menu)
+3
View File
@@ -31,6 +31,7 @@
#include "gtkcontainerprivate.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenuprivate.h"
#include "gtkmenushellprivate.h"
#include "gtkmenuitemprivate.h"
#include "gtkmenubar.h"
@@ -1190,6 +1191,7 @@ gtk_real_menu_item_select (GtkMenuItem *menu_item)
gtk_widget_set_state_flags (GTK_WIDGET (menu_item),
GTK_STATE_FLAG_PRELIGHT, FALSE);
gtk_widget_queue_draw (GTK_WIDGET (menu_item));
}
static void
@@ -1202,6 +1204,7 @@ gtk_real_menu_item_deselect (GtkMenuItem *menu_item)
gtk_widget_unset_state_flags (GTK_WIDGET (menu_item),
GTK_STATE_FLAG_PRELIGHT);
gtk_widget_queue_draw (GTK_WIDGET (menu_item));
}
static gboolean
+5
View File
@@ -72,6 +72,8 @@ struct _GtkMenuPrivate
GtkWidget *top_arrow_widget;
GtkWidget *bottom_arrow_widget;
GtkEventController *key_controller;
gint scroll_offset;
gint saved_scroll_offset;
gint scroll_step;
@@ -86,7 +88,9 @@ struct _GtkMenuPrivate
guint upper_arrow_prelight : 1;
guint lower_arrow_prelight : 1;
guint have_position : 1;
guint have_layout : 1;
guint seen_item_enter : 1;
guint ignore_button_release : 1;
guint no_toggle_size : 1;
guint drag_already_pressed : 1;
@@ -97,6 +101,7 @@ struct _GtkMenuPrivate
gint heights_length;
gint requested_height;
gboolean initially_pushed_in;
gint monitor_num;
/* Cached layout information */
+24
View File
@@ -852,6 +852,29 @@ gtk_model_button_size_allocate (GtkWidget *widget,
}
}
static void
gtk_model_button_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
if (GTK_MODEL_BUTTON (widget)->iconic)
{
GTK_WIDGET_CLASS (gtk_model_button_parent_class)->snapshot (widget, snapshot);
}
else
{
GtkWidget *child;
GtkModelButton *button = GTK_MODEL_BUTTON (widget);
if (gtk_widget_get_visible (button->indicator_widget))
gtk_widget_snapshot_child (widget, button->indicator_widget, snapshot);
child = gtk_bin_get_child (GTK_BIN (widget));
if (child)
gtk_widget_snapshot_child (widget, child, snapshot);
}
}
static void
gtk_model_button_destroy (GtkWidget *widget)
{
@@ -908,6 +931,7 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
widget_class->measure = gtk_model_button_measure;
widget_class->size_allocate = gtk_model_button_size_allocate;
widget_class->snapshot = gtk_model_button_snapshot;
widget_class->destroy = gtk_model_button_destroy;
widget_class->state_flags_changed = gtk_model_button_state_flags_changed;
widget_class->direction_changed = gtk_model_button_direction_changed;
+1 -2
View File
@@ -3212,14 +3212,13 @@ gtk_notebook_drag_data_get (GtkWidget *widget,
{
gtk_selection_data_set (data,
target,
8,
(void*) &priv->detached_tab->child,
sizeof (gpointer));
priv->rootwindow_drop = FALSE;
}
else if (target == g_intern_static_string ("application/x-rootwindow-drop"))
{
gtk_selection_data_set (data, target, 8, NULL, 0);
gtk_selection_data_set (data, target, NULL, 0);
priv->rootwindow_drop = TRUE;
}
}
+1 -1
View File
@@ -441,7 +441,7 @@ gtk_overlay_remove (GtkContainer *container,
*
* A widgets index in the @overlay children list determines which order
* the children are drawn if they overlap. The first child is drawn at
* the bottom. It also affects the focus order.
* the bottom. It also affects the default focus chain order.
*/
void
gtk_overlay_reorder_overlay (GtkOverlay *overlay,
+182 -217
View File
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -25,6 +25,7 @@ G_BEGIN_DECLS
typedef struct _GtkPathBar GtkPathBar;
typedef struct _GtkPathBarClass GtkPathBarClass;
typedef struct _GtkPathBarPrivate GtkPathBarPrivate;
#define GTK_TYPE_PATH_BAR (gtk_path_bar_get_type ())
@@ -36,7 +37,9 @@ typedef struct _GtkPathBarClass GtkPathBarClass;
struct _GtkPathBar
{
GtkContainer parent_instance;
GtkContainer parent;
GtkPathBarPrivate *priv;
};
struct _GtkPathBarClass
+1 -1
View File
@@ -939,7 +939,7 @@ gtk_picture_get_can_shrink (GtkPicture *self)
*
* This text will be made available to accessibility tools.
*
* If the picture cannot be described textually, set this property to %NULL.
* If the picture cannot be described textually, set this proeprty to %NULL.
*/
void
gtk_picture_set_alternative_text (GtkPicture *self,
+1 -8
View File
@@ -1964,7 +1964,6 @@ drag_data_get_callback (GtkWidget *widget,
{
gtk_selection_data_set (data,
target,
8,
(void*)&sidebar->drag_row,
sizeof (gpointer));
}
@@ -2368,13 +2367,7 @@ volume_mount_cb (GObject *source_object,
error->code != G_IO_ERROR_ALREADY_MOUNTED)
{
name = g_volume_get_name (G_VOLUME (source_object));
if (g_str_has_prefix (error->message, "Error unlocking"))
/* Translators: This means that unlocking an encrypted storage
* device failed. %s is the name of the device.
*/
primary = g_strdup_printf (_("Error unlocking “%s”"), name);
else
primary = g_strdup_printf (_("Unable to access “%s”"), name);
primary = g_strdup_printf (_("Unable to access “%s”"), name);
g_free (name);
emit_show_error_message (sidebar, primary, error->message);
g_free (primary);
+18 -16
View File
@@ -37,7 +37,6 @@
#include "gtkshow.h"
#include "gtkintl.h"
#include "gtkwindowprivate.h"
#include "gtkprivate.h"
typedef struct {
@@ -62,8 +61,6 @@ portal_data_free (gpointer data)
{
PortalData *portal = data;
if (portal->parent)
gtk_window_unexport_handle (portal->parent);
g_object_unref (portal->op);
g_object_unref (portal->proxy);
if (portal->loop)
@@ -380,7 +377,7 @@ prepare_print_response (GDBusConnection *connection,
{
PortalData *portal = data;
guint32 response;
GVariant *options = NULL;
GVariant *options;
if (portal->response_signal_id != 0)
{
@@ -429,9 +426,6 @@ prepare_print_response (GDBusConnection *connection,
else
portal->result = GTK_PRINT_OPERATION_RESULT_CANCEL;
if (options)
g_variant_unref (options);
if (portal->loop)
g_main_loop_quit (portal->loop);
}
@@ -467,8 +461,8 @@ prepare_print_called (GObject *source,
portal->response_signal_id);
portal->response_signal_id =
g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (G_DBUS_PROXY (portal->proxy)),
PORTAL_BUS_NAME,
PORTAL_REQUEST_INTERFACE,
"org.freedesktop.portal.Desktop",
"org.freedesktop.portal.Request",
"Response",
handle,
NULL,
@@ -497,9 +491,9 @@ create_portal_data (GtkPrintOperation *op,
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
PORTAL_BUS_NAME,
PORTAL_OBJECT_PATH,
PORTAL_PRINT_INTERFACE,
"org.freedesktop.portal.Desktop",
"/org/freedesktop/portal/desktop",
"org.freedesktop.portal.Print",
NULL,
&error);
@@ -561,14 +555,22 @@ call_prepare_print (GtkPrintOperation *op,
GtkPrintOperationPrivate *priv = op->priv;
GVariantBuilder opt_builder;
char *token;
char *sender;
int i;
portal->prepare_print_handle =
gtk_get_portal_request_path (g_dbus_proxy_get_connection (portal->proxy), &token);
token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
sender = g_strdup (g_dbus_connection_get_unique_name (g_dbus_proxy_get_connection (portal->proxy)) + 1);
for (i = 0; sender[i]; i++)
if (sender[i] == '.')
sender[i] = '_';
portal->prepare_print_handle = g_strdup_printf ("/org/fredesktop/portal/desktop/request/%s/%s", sender, token);
g_free (sender);
portal->response_signal_id =
g_dbus_connection_signal_subscribe (g_dbus_proxy_get_connection (G_DBUS_PROXY (portal->proxy)),
PORTAL_BUS_NAME,
PORTAL_REQUEST_INTERFACE,
"org.freedesktop.portal.Desktop",
"org.freedesktop.portal.Request",
"Response",
portal->prepare_print_handle,
NULL,
-36
View File
@@ -291,39 +291,3 @@ gtk_should_use_portal (void)
return use_portal[0] == '1';
}
static char *
get_portal_path (GDBusConnection *connection,
const char *kind,
char **token)
{
char *sender;
int i;
char *path;
*token = g_strdup_printf ("gtk%d", g_random_int_range (0, G_MAXINT));
sender = g_strdup (g_dbus_connection_get_unique_name (connection) + 1);
for (i = 0; sender[i]; i++)
if (sender[i] == '.')
sender[i] = '_';
path = g_strconcat (PORTAL_OBJECT_PATH, "/", kind, "/", sender, "/", token, NULL);
g_free (sender);
return path;
}
char *
gtk_get_portal_request_path (GDBusConnection *connection,
char **token)
{
return get_portal_path (connection, "request", token);
}
char *
gtk_get_portal_session_path (GDBusConnection *connection,
char **token)
{
return get_portal_path (connection, "session", token);
}
-13
View File
@@ -110,19 +110,6 @@ gdouble _gtk_get_slowdown (void);
void _gtk_set_slowdown (gdouble slowdown_factor);
gboolean gtk_should_use_portal (void);
char *gtk_get_portal_request_path (GDBusConnection *connection,
char **token);
char *gtk_get_portal_session_path (GDBusConnection *connection,
char **token);
#define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop"
#define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop"
#define PORTAL_REQUEST_INTERFACE "org.freedesktop.portal.Request"
#define PORTAL_SESSION_INTERFACE "org.freedesktop.portal.Session"
#define PORTAL_FILECHOOSER_INTERFACE "org.freedesktop.portal.FileChooser"
#define PORTAL_PRINT_INTERFACE "org.freedesktop.portal.Print"
#define PORTAL_SCREENSHOT_INTERFACE "org.freedesktop.portal.Screenshot"
#define PORTAL_INHIBIT_INTERFACE "org.freedesktop.portal.Inhibit"
#ifdef G_OS_WIN32
void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
+3 -5
View File
@@ -193,7 +193,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
const char *utf8_string = [s UTF8String];
gtk_selection_data_set (selection_data,
target, 8,
target,
(guchar *)utf8_string, strlen (utf8_string));
}
}
@@ -211,7 +211,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
color[2] = 0xffff * [nscolor blueComponent];
color[3] = 0xffff * [nscolor alphaComponent];
gtk_selection_data_set (selection_data, target, 16, (guchar *)color, 8);
gtk_selection_data_set (selection_data, target, (guchar *)color, 8);
}
else if (target == g_intern_static_string ("text/uri-list"))
{
@@ -265,7 +265,7 @@ _gtk_quartz_get_selection_data_from_pasteboard (NSPasteboard *pasteboard,
if (data)
{
gtk_selection_data_set (selection_data,
target, 8,
target,
[data bytes], [data length]);
}
}
@@ -279,12 +279,10 @@ _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard,
{
NSString *type;
GdkDisplay *display;
gint format;
const guchar *data;
NSUInteger length;
display = gtk_selection_data_get_display (selection_data);
format = gtk_selection_data_get_format (selection_data);
data = gtk_selection_data_get_data (selection_data);
length = gtk_selection_data_get_length (selection_data);
+14 -18
View File
@@ -140,13 +140,7 @@ enum {
LAST_PROP
};
enum {
GROUP_CHANGED,
N_SIGNALS
};
static GParamSpec *radio_button_props[LAST_PROP] = { NULL, };
static guint signals[N_SIGNALS] = { 0 };
static void gtk_radio_button_destroy (GtkWidget *widget);
static gboolean gtk_radio_button_focus (GtkWidget *widget,
@@ -163,6 +157,8 @@ static void gtk_radio_button_get_property (GObject *object,
G_DEFINE_TYPE_WITH_PRIVATE (GtkRadioButton, gtk_radio_button, GTK_TYPE_CHECK_BUTTON)
static guint group_changed_signal = 0;
static void
gtk_radio_button_class_init (GtkRadioButtonClass *class)
{
@@ -209,13 +205,13 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
* more buttons to a different one, but not when the composition
* of the group that a button belongs to changes.
*/
signals[GROUP_CHANGED] = g_signal_new (I_("group-changed"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
group_changed_signal = g_signal_new (I_("group-changed"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GtkRadioButtonClass, group_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_RADIO_BUTTON_ACCESSIBLE);
gtk_widget_class_set_css_name (widget_class, I_("radiobutton"));
@@ -344,15 +340,15 @@ gtk_radio_button_set_group (GtkRadioButton *radio_button,
g_object_ref (radio_button);
g_object_notify_by_pspec (G_OBJECT (radio_button), radio_button_props[PROP_GROUP]);
g_signal_emit (radio_button, signals[GROUP_CHANGED], 0);
g_signal_emit (radio_button, group_changed_signal, 0);
if (old_group_singleton)
{
g_signal_emit (old_group_singleton, signals[GROUP_CHANGED], 0);
g_signal_emit (old_group_singleton, group_changed_signal, 0);
g_object_unref (old_group_singleton);
}
if (new_group_singleton)
{
g_signal_emit (new_group_singleton, signals[GROUP_CHANGED], 0);
g_signal_emit (new_group_singleton, group_changed_signal, 0);
g_object_unref (new_group_singleton);
}
@@ -608,9 +604,9 @@ gtk_radio_button_destroy (GtkWidget *widget)
priv->group = NULL;
if (old_group_singleton)
g_signal_emit (old_group_singleton, signals[GROUP_CHANGED], 0);
g_signal_emit (old_group_singleton, group_changed_signal, 0);
if (was_in_group)
g_signal_emit (radio_button, signals[GROUP_CHANGED], 0);
g_signal_emit (radio_button, group_changed_signal, 0);
GTK_WIDGET_CLASS (gtk_radio_button_parent_class)->destroy (widget);
}
+10 -4
View File
@@ -668,20 +668,20 @@ gtk_css_style_snapshot_border (GtkCssStyle *style,
{
GtkBorderImage border_image;
float border_width[4];
graphene_rect_t bounds;
cairo_t *cr;
border_width[0] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
border_width[1] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
border_width[2] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
border_width[3] = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
graphene_rect_init (&bounds, 0, 0, width, height);
if (gtk_border_image_init (&border_image, style))
{
cairo_t *cr;
graphene_rect_t bounds;
double double_width[4] = { border_width[0], border_width[1], border_width[2], border_width[3] };
graphene_rect_init (&bounds, 0, 0, width, height);
gtk_snapshot_push_debug (snapshot, "CSS border image");
cr = gtk_snapshot_append_cairo (snapshot,
&bounds);
@@ -725,6 +725,12 @@ gtk_css_style_snapshot_border (GtkCssStyle *style,
}
}
gboolean
gtk_css_style_render_has_outline (GtkCssStyle *style)
{
return _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_OUTLINE_WIDTH), 100) > 0;
}
static void
compute_outline_rect (GtkCssStyle *style,
gdouble x,
+1
View File
@@ -34,6 +34,7 @@ void gtk_css_style_snapshot_border (GtkCssStyle
gdouble width,
gdouble height);
gboolean gtk_css_style_render_has_outline (GtkCssStyle *style);
void gtk_css_style_snapshot_outline (GtkCssStyle *style,
GtkSnapshot *snapshot,
gdouble width,
+6 -8
View File
@@ -617,20 +617,20 @@ gtk_revealer_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkRevealer *revealer = GTK_REVEALER (widget);
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
GtkRevealerTransitionType transition;
GtkWidget *child;
gboolean clip_child;
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child == NULL || !gtk_widget_get_mapped (child))
return;
transition = effective_transition (revealer);
clip_child = transition != GTK_REVEALER_TRANSITION_TYPE_NONE &&
transition != GTK_REVEALER_TRANSITION_TYPE_CROSSFADE &&
gtk_progress_tracker_get_state (&priv->tracker) != GTK_PROGRESS_STATE_AFTER;
if (clip_child)
if (transition == GTK_REVEALER_TRANSITION_TYPE_NONE ||
transition == GTK_REVEALER_TRANSITION_TYPE_CROSSFADE)
{
gtk_widget_snapshot_child (widget, child, snapshot);
}
else
{
gtk_snapshot_push_clip (snapshot,
&GRAPHENE_RECT_INIT(
@@ -641,8 +641,6 @@ gtk_revealer_snapshot (GtkWidget *widget,
gtk_widget_snapshot_child (widget, child, snapshot);
gtk_snapshot_pop (snapshot);
}
else
gtk_widget_snapshot_child (widget, child, snapshot);
}
/**
+3 -20
View File
@@ -1341,29 +1341,12 @@ scroll_controller_decelerate (GtkEventControllerScroll *scroll,
GtkScrolledWindow *scrolled_window)
{
gdouble unit_x, unit_y;
gboolean shifted;
GdkModifierType state;
if (!gtk_get_current_event_state (&state))
return;
shifted = (state & GDK_SHIFT_MASK) != 0;
unit_x = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL);
unit_y = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL);
if (shifted)
{
gtk_scrolled_window_decelerate (scrolled_window,
initial_vel_y * unit_x,
initial_vel_x * unit_y);
}
else
{
gtk_scrolled_window_decelerate (scrolled_window,
initial_vel_x * unit_x,
initial_vel_y * unit_y);
}
gtk_scrolled_window_decelerate (scrolled_window,
initial_vel_x * unit_x,
initial_vel_y * unit_y);
}
static void
+18 -102
View File
@@ -299,22 +299,6 @@ gtk_selection_data_get_data_type (const GtkSelectionData *selection_data)
return selection_data->type;
}
/**
* gtk_selection_data_get_format:
* @selection_data: a pointer to a #GtkSelectionData-struct.
*
* Retrieves the format of the selection.
*
* Returns: the format of the selection.
**/
gint
gtk_selection_data_get_format (const GtkSelectionData *selection_data)
{
g_return_val_if_fail (selection_data != NULL, 0);
return selection_data->format;
}
/**
* gtk_selection_data_get_data: (skip)
* @selection_data: a pointer to a
@@ -388,7 +372,6 @@ gtk_selection_data_get_display (const GtkSelectionData *selection_data)
* gtk_selection_data_set:
* @selection_data: a pointer to a #GtkSelectionData-struct.
* @type: the type of selection data
* @format: format (number of bits in a unit)
* @data: (array length=length): pointer to the data (will be copied)
* @length: length of the data
*
@@ -399,7 +382,6 @@ gtk_selection_data_get_display (const GtkSelectionData *selection_data)
void
gtk_selection_data_set (GtkSelectionData *selection_data,
GdkAtom type,
gint format,
const guchar *data,
gint length)
{
@@ -408,7 +390,6 @@ gtk_selection_data_set (GtkSelectionData *selection_data,
g_free (selection_data->data);
selection_data->type = type;
selection_data->format = format;
if (data)
{
@@ -442,7 +423,7 @@ selection_set_string (GtkSelectionData *selection_data,
{
gtk_selection_data_set (selection_data,
g_intern_static_string ("STRING"),
8, (guchar *) latin1, strlen (latin1));
(guchar *) latin1, strlen (latin1));
g_free (latin1);
return TRUE;
@@ -462,16 +443,15 @@ selection_set_compound_text (GtkSelectionData *selection_data,
gchar *tmp;
guchar *text;
GdkAtom encoding;
gint format;
gint new_length;
if (GDK_IS_X11_DISPLAY (selection_data->display))
{
tmp = g_strndup (str, len);
if (gdk_x11_display_utf8_to_compound_text (selection_data->display, tmp,
&encoding, &format, &text, &new_length))
&encoding, NULL, &text, &new_length))
{
gtk_selection_data_set (selection_data, encoding, format, text, new_length);
gtk_selection_data_set (selection_data, encoding, text, new_length);
gdk_x11_free_compound_text (text);
result = TRUE;
@@ -578,7 +558,7 @@ selection_set_text_plain (GtkSelectionData *selection_data,
gtk_selection_data_set (selection_data,
selection_data->target,
8, (guchar *) result, strlen (result));
(guchar *) result, strlen (result));
g_free (result);
return TRUE;
@@ -661,7 +641,7 @@ gtk_selection_data_set_text (GtkSelectionData *selection_data,
{
gtk_selection_data_set (selection_data,
utf8_atom,
8, (guchar *)str, len);
(guchar *)str, len);
return TRUE;
}
else if (selection_data->target == g_intern_static_string ("STRING"))
@@ -715,7 +695,7 @@ gtk_selection_data_get_text (const GtkSelectionData *selection_data)
gint i;
gint count = gdk_text_property_to_utf8_list_for_display (selection_data->display,
selection_data->type,
selection_data->format,
8,
selection_data->data,
selection_data->length,
&list);
@@ -784,7 +764,7 @@ gtk_selection_data_set_pixbuf (GtkSelectionData *selection_data,
NULL);
if (result)
gtk_selection_data_set (selection_data,
atom, 8, (guchar *)str, len);
atom, (guchar *)str, len);
g_free (type);
g_free (str);
g_strfreev (mimes);
@@ -963,7 +943,7 @@ gtk_selection_data_set_uris (GtkSelectionData *selection_data,
{
gtk_selection_data_set (selection_data,
text_uri_list_atom,
8, (guchar *)result, length);
(guchar *)result, length);
g_free (result);
@@ -1001,7 +981,7 @@ gtk_selection_data_get_uris (const GtkSelectionData *selection_data)
gchar **list;
gint count = gdk_text_property_to_utf8_list_for_display (selection_data->display,
utf8_atom,
selection_data->format,
8,
selection_data->data,
selection_data->length,
&list);
@@ -1014,52 +994,6 @@ gtk_selection_data_get_uris (const GtkSelectionData *selection_data)
return result;
}
/**
* gtk_selection_data_get_targets:
* @selection_data: a #GtkSelectionData object
* @targets: (out) (array length=n_atoms) (transfer container):
* location to store an array of targets. The result stored
* here must be freed with g_free().
* @n_atoms: location to store number of items in @targets.
*
* Gets the contents of @selection_data as an array of targets.
* This can be used to interpret the results of getting
* the standard TARGETS target that is always supplied for
* any selection.
*
* Returns: %TRUE if @selection_data contains a valid
* array of targets, otherwise %FALSE.
**/
gboolean
gtk_selection_data_get_targets (const GtkSelectionData *selection_data,
GdkAtom **targets,
gint *n_atoms)
{
g_return_val_if_fail (selection_data != NULL, FALSE);
if (selection_data->length >= 0 &&
selection_data->format == 32 &&
selection_data->type == g_intern_static_string ("ATOM"))
{
if (targets)
*targets = g_memdup (selection_data->data, selection_data->length);
if (n_atoms)
*n_atoms = selection_data->length / sizeof (GdkAtom);
return TRUE;
}
else
{
if (targets)
*targets = NULL;
if (n_atoms)
*n_atoms = -1;
return FALSE;
}
}
/**
* gtk_targets_include_text:
* @targets: (array length=n_targets): an array of #GdkAtoms
@@ -1117,21 +1051,15 @@ gtk_targets_include_text (GdkAtom *targets,
gboolean
gtk_selection_data_targets_include_text (const GtkSelectionData *selection_data)
{
GdkAtom *targets;
gint n_targets;
gboolean result = FALSE;
GdkAtom target;
g_return_val_if_fail (selection_data != NULL, FALSE);
init_atoms ();
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
{
result = gtk_targets_include_text (targets, n_targets);
g_free (targets);
}
target = gtk_selection_data_get_target (selection_data);
return result;
return gtk_targets_include_text (&target, 1);
}
/**
@@ -1190,21 +1118,15 @@ gboolean
gtk_selection_data_targets_include_image (const GtkSelectionData *selection_data,
gboolean writable)
{
GdkAtom *targets;
gint n_targets;
gboolean result = FALSE;
GdkAtom target;
g_return_val_if_fail (selection_data != NULL, FALSE);
init_atoms ();
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
{
result = gtk_targets_include_image (targets, n_targets, writable);
g_free (targets);
}
target = gtk_selection_data_get_target (selection_data);
return result;
return gtk_targets_include_image (&target, 1, writable);
}
/**
@@ -1258,21 +1180,15 @@ gtk_targets_include_uri (GdkAtom *targets,
gboolean
gtk_selection_data_targets_include_uri (const GtkSelectionData *selection_data)
{
GdkAtom *targets;
gint n_targets;
gboolean result = FALSE;
GdkAtom target;
g_return_val_if_fail (selection_data != NULL, FALSE);
init_atoms ();
if (gtk_selection_data_get_targets (selection_data, &targets, &n_targets))
{
result = gtk_targets_include_uri (targets, n_targets);
g_free (targets);
}
target = gtk_selection_data_get_target (selection_data);
return result;
return gtk_targets_include_uri (&target, 1);
}
/**
-7
View File
@@ -49,8 +49,6 @@ GdkAtom gtk_selection_data_get_target (const GtkSelectionData *selectio
GDK_AVAILABLE_IN_ALL
GdkAtom gtk_selection_data_get_data_type (const GtkSelectionData *selection_data);
GDK_AVAILABLE_IN_ALL
gint gtk_selection_data_get_format (const GtkSelectionData *selection_data);
GDK_AVAILABLE_IN_ALL
const guchar *gtk_selection_data_get_data (const GtkSelectionData *selection_data);
GDK_AVAILABLE_IN_ALL
gint gtk_selection_data_get_length (const GtkSelectionData *selection_data);
@@ -65,7 +63,6 @@ GdkDisplay *gtk_selection_data_get_display (const GtkSelectionData *selectio
GDK_AVAILABLE_IN_ALL
void gtk_selection_data_set (GtkSelectionData *selection_data,
GdkAtom type,
gint format,
const guchar *data,
gint length);
GDK_AVAILABLE_IN_ALL
@@ -90,10 +87,6 @@ gboolean gtk_selection_data_set_uris (GtkSelectionData *selection_data,
GDK_AVAILABLE_IN_ALL
gchar **gtk_selection_data_get_uris (const GtkSelectionData *selection_data);
GDK_AVAILABLE_IN_ALL
gboolean gtk_selection_data_get_targets (const GtkSelectionData *selection_data,
GdkAtom **targets,
gint *n_atoms);
GDK_AVAILABLE_IN_ALL
gboolean gtk_selection_data_targets_include_text (const GtkSelectionData *selection_data);
GDK_AVAILABLE_IN_ALL
-1
View File
@@ -40,7 +40,6 @@ struct _GtkSelectionData
/*< private >*/
GdkAtom target;
GdkAtom type;
gint format;
guchar *data;
gint length;
GdkDisplay *display;
+57 -60
View File
@@ -209,92 +209,89 @@ _gtk_size_request_cache_commit (SizeRequestCache *cache,
* the Clutter toolkit but has evolved for other GTK+ requirements.
*/
gboolean
_gtk_size_request_cache_lookup (const SizeRequestCache *cache,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
_gtk_size_request_cache_lookup (SizeRequestCache *cache,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
guint i, p;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
const CachedSizeX *result = NULL;
if (for_size < 0)
{
if (cache->flags[GTK_ORIENTATION_HORIZONTAL].cached_size_valid)
{
const CachedSizeX *result = &cache->cached_size_x;
*minimum = result->minimum_size;
*natural = result->natural_size;
return TRUE;
}
return FALSE;
}
{
if (cache->flags[orientation].cached_size_valid)
result = &cache->cached_size_x;
}
else
{
guint i;
/* Search for an already cached size */
for (i = 0, p = cache->flags[GTK_ORIENTATION_HORIZONTAL].n_cached_requests; i < p; i++)
{
for (i = 0; i < cache->flags[orientation].n_cached_requests; i++)
{
const SizeRequestX *cur = cache->requests_x[i];
if (cur->lower_for_size <= for_size &&
cur->upper_for_size >= for_size)
{
const CachedSizeX *result = &cur->cached_size;
*minimum = result->minimum_size;
*natural = result->natural_size;
return TRUE;
}
}
return FALSE;
result = &cur->cached_size;
break;
}
}
}
if (result)
{
*minimum = result->minimum_size;
*natural = result->natural_size;
*minimum_baseline = -1;
*natural_baseline = -1;
return TRUE;
}
else
return FALSE;
}
else
{
const CachedSizeY *result = NULL;
if (for_size < 0)
{
if (cache->flags[GTK_ORIENTATION_VERTICAL].cached_size_valid)
{
const CachedSizeY *result = &cache->cached_size_y;
*minimum = result->minimum_size;
*natural = result->natural_size;
*minimum_baseline = result->minimum_baseline;
*natural_baseline = result->natural_baseline;
return TRUE;
}
return FALSE;
}
{
if (cache->flags[orientation].cached_size_valid)
result = &cache->cached_size_y;
}
else
{
guint i;
/* Search for an already cached size */
for (i = 0, p = cache->flags[GTK_ORIENTATION_VERTICAL].n_cached_requests; i < p; i++)
{
for (i = 0; i < cache->flags[orientation].n_cached_requests; i++)
{
const SizeRequestY *cur = cache->requests_y[i];
if (cur->lower_for_size <= for_size &&
cur->upper_for_size >= for_size)
{
const CachedSizeY *result = &cur->cached_size;
result = &cur->cached_size;
break;
}
}
}
*minimum = result->minimum_size;
*natural = result->natural_size;
*minimum_baseline = result->minimum_baseline;
*natural_baseline = result->natural_baseline;
return TRUE;
}
}
return FALSE;
}
if (result)
{
*minimum = result->minimum_size;
*natural = result->natural_size;
*minimum_baseline = result->minimum_baseline;
*natural_baseline = result->natural_baseline;
return TRUE;
}
else
return FALSE;
}
}
+1 -1
View File
@@ -91,7 +91,7 @@ void _gtk_size_request_cache_commit (SizeRequestCach
int natural_size,
int minimum_baseline,
int natural_baseline);
gboolean _gtk_size_request_cache_lookup (const SizeRequestCache *cache,
gboolean _gtk_size_request_cache_lookup (SizeRequestCache *cache,
GtkOrientation orientation,
int for_size,
int *minimum,
+14 -10
View File
@@ -67,7 +67,13 @@ enum {
PROP_ACTIVE
};
G_DEFINE_TYPE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
struct _GtkSpinnerPrivate
{
guint active : 1;
};
typedef struct _GtkSpinnerPrivate GtkSpinnerPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GtkSpinner, gtk_spinner, GTK_TYPE_WIDGET)
#define DEFAULT_SIZE 16
@@ -112,22 +118,18 @@ gtk_spinner_snapshot (GtkWidget *widget,
GTK_CSS_IMAGE_BUILTIN_SPINNER);
}
static gboolean
gtk_spinner_get_active (GtkSpinner *spinner)
{
return (gtk_widget_get_state_flags ((GtkWidget *)spinner) & GTK_STATE_FLAG_CHECKED) > 0;
}
static void
gtk_spinner_set_active (GtkSpinner *spinner,
gboolean active)
{
gboolean current_active = gtk_spinner_get_active (spinner);
GtkSpinnerPrivate *priv = gtk_spinner_get_instance_private (spinner);
active = !!active;
if (active != current_active)
if (priv->active != active)
{
priv->active = active;
g_object_notify (G_OBJECT (spinner), "active");
if (active)
@@ -145,10 +147,12 @@ gtk_spinner_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
GtkSpinnerPrivate *priv = gtk_spinner_get_instance_private (GTK_SPINNER (object));
switch (param_id)
{
case PROP_ACTIVE:
g_value_set_boolean (value, gtk_spinner_get_active (GTK_SPINNER (object)));
g_value_set_boolean (value, priv->active);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
-1
View File
@@ -7653,7 +7653,6 @@ gtk_text_view_drag_data_get (GtkWidget *widget,
{
gtk_selection_data_set (selection_data,
g_intern_static_string ("GTK_TEXT_BUFFER_CONTENTS"),
8, /* bytes */
(void*)&buffer,
sizeof (buffer));
}
+222 -76
View File
@@ -107,6 +107,8 @@ struct _GtkTooltip
GtkWidget *tooltip_widget;
gdouble last_x;
gdouble last_y;
GdkSurface *last_surface;
guint timeout_id;
@@ -598,104 +600,246 @@ gtk_tooltip_run_requery (GtkWidget **widget,
return return_value;
}
static void
get_bounding_box (GtkWidget *widget,
GdkRectangle *bounds)
{
GtkWidget *toplevel;
GtkAllocation allocation;
GdkSurface *surface;
gint x, y;
gint w, h;
gint x1, y1;
gint x2, y2;
gint x3, y3;
gint x4, y4;
surface = gtk_widget_get_parent_surface (widget);
if (surface == NULL)
surface = gtk_widget_get_surface (widget);
gtk_widget_get_allocation (widget, &allocation);
x = allocation.x;
y = allocation.y;
w = allocation.width;
h = allocation.height;
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (toplevel) && !GTK_IS_WINDOW (widget))
{
GtkWidget *parent = gtk_widget_get_parent (widget);
gtk_widget_translate_coordinates (parent, toplevel,
x, y,
&x, &y);
}
if (GTK_IS_WINDOW (widget))
{
GtkBorder border = { 0, };
_gtk_window_get_shadow_width (GTK_WINDOW (widget), &border);
x += border.left;
y += border.right;
w -= border.left + border.right;
h -= border.top + border.bottom;
}
gdk_surface_get_root_coords (surface, x, y, &x1, &y1);
gdk_surface_get_root_coords (surface, x + w, y, &x2, &y2);
gdk_surface_get_root_coords (surface, x, y + h, &x3, &y3);
gdk_surface_get_root_coords (surface, x + w, y + h, &x4, &y4);
#define MIN4(a,b,c,d) MIN(MIN(a,b),MIN(c,d))
#define MAX4(a,b,c,d) MAX(MAX(a,b),MAX(c,d))
bounds->x = floor (MIN4 (x1, x2, x3, x4));
bounds->y = floor (MIN4 (y1, y2, y3, y4));
bounds->width = ceil (MAX4 (x1, x2, x3, x4)) - bounds->x;
bounds->height = ceil (MAX4 (y1, y2, y3, y4)) - bounds->y;
}
static void
gtk_tooltip_position (GtkTooltip *tooltip,
GdkDisplay *display,
GtkWidget *new_tooltip_widget,
GdkDevice *device)
GtkWidget *new_tooltip_widget)
{
GtkSettings *settings;
GdkRectangle anchor_rect;
GdkSurface *surface;
GdkSurface *effective_toplevel;
GtkWidget *toplevel;
int rect_anchor_dx = 0;
int cursor_size;
int anchor_rect_padding;
gint x, y, width, height;
GdkMonitor *monitor;
GdkRectangle workarea;
guint cursor_size;
GdkRectangle bounds;
GtkBorder border;
#define MAX_DISTANCE 32
gtk_widget_realize (GTK_WIDGET (tooltip->current_window));
surface = _gtk_widget_get_surface (GTK_WIDGET (tooltip->current_window));
gtk_widget_set_visible (GTK_WIDGET (tooltip->current_window), TRUE);
tooltip->tooltip_widget = new_tooltip_widget;
toplevel = _gtk_widget_get_toplevel (new_tooltip_widget);
gtk_widget_translate_coordinates (new_tooltip_widget, toplevel,
0, 0,
&anchor_rect.x, &anchor_rect.y);
_gtk_window_get_shadow_width (GTK_WINDOW (tooltip->current_window), &border);
anchor_rect.width = gtk_widget_get_allocated_width (new_tooltip_widget);
anchor_rect.height = gtk_widget_get_allocated_height (new_tooltip_widget);
width = gtk_widget_get_allocated_width (GTK_WIDGET (tooltip->current_window)) - border.left - border.right;
height = gtk_widget_get_allocated_height (GTK_WIDGET (tooltip->current_window)) - border.top - border.bottom;
settings = gtk_settings_get_for_display (display);
g_object_get (settings,
monitor = gdk_display_get_monitor_at_point (display, tooltip->last_x, tooltip->last_y);
gdk_monitor_get_workarea (monitor, &workarea);
get_bounding_box (new_tooltip_widget, &bounds);
/* Position the tooltip */
g_object_get (gtk_widget_get_settings (GTK_WIDGET (tooltip->current_window)),
"gtk-cursor-theme-size", &cursor_size,
NULL);
if (device)
anchor_rect_padding = MAX (4, cursor_size - 32);
else
anchor_rect_padding = 4;
/* Try below */
x = bounds.x + bounds.width / 2 - width / 2;
y = bounds.y + bounds.height + 4;
anchor_rect.x -= anchor_rect_padding;
anchor_rect.y -= anchor_rect_padding;
anchor_rect.width += anchor_rect_padding * 2;
anchor_rect.height += anchor_rect_padding * 2;
if (device)
if (y + height <= workarea.y + workarea.height)
{
const int max_x_distance = 32;
/* Max 48x48 icon + default padding */
const int max_anchor_rect_height = 48 + 8;
int pointer_x, pointer_y;
if (tooltip->keyboard_mode_enabled)
goto found;
/*
* For pointer position triggered tooltips, implement the following
* semantics:
*
* If the anchor rectangle is too tall (meaning if we'd be constrained
* and flip, it'd flip too far away), rely only on the pointer position
* to position the tooltip. The approximate pointer cursorrectangle is
* used as a anchor rectantgle.
*
* If the anchor rectangle isn't to tall, make sure the tooltip isn't too
* far away from the pointer position.
*/
effective_toplevel = _gtk_widget_get_surface (new_tooltip_widget);
gdk_surface_get_device_position (effective_toplevel,
device,
&pointer_x, &pointer_y, NULL);
if (anchor_rect.height > max_anchor_rect_height)
if (y <= tooltip->last_y + cursor_size + MAX_DISTANCE)
{
anchor_rect.x = pointer_x - 4;
anchor_rect.y = pointer_y - 4;
anchor_rect.width = cursor_size;
anchor_rect.height = cursor_size;
if (tooltip->last_x + cursor_size + MAX_DISTANCE < x)
x = tooltip->last_x + cursor_size + MAX_DISTANCE;
else if (x + width < tooltip->last_x - MAX_DISTANCE)
x = tooltip->last_x - MAX_DISTANCE - width;
goto found;
}
else
}
/* Try above */
x = bounds.x + bounds.width / 2 - width / 2;
y = bounds.y - height - 4;
if (y >= workarea.y)
{
if (tooltip->keyboard_mode_enabled)
goto found;
if (y + height >= tooltip->last_y - MAX_DISTANCE)
{
int anchor_point_x;
int x_distance;
if (tooltip->last_x + cursor_size + MAX_DISTANCE < x)
x = tooltip->last_x + cursor_size + MAX_DISTANCE;
else if (x + width < tooltip->last_x - MAX_DISTANCE)
x = tooltip->last_x - MAX_DISTANCE - width;
anchor_point_x = anchor_rect.x + anchor_rect.width / 2;
x_distance = pointer_x - anchor_point_x;
if (x_distance > max_x_distance)
rect_anchor_dx = x_distance - max_x_distance;
else if (x_distance < -max_x_distance)
rect_anchor_dx = x_distance + max_x_distance;
goto found;
}
}
gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
GTK_WINDOW (toplevel));
/* Try right FIXME: flip on rtl ? */
x = bounds.x + bounds.width + 4;
y = bounds.y + bounds.height / 2 - height / 2;
gdk_surface_move_to_rect (surface,
&anchor_rect,
GDK_GRAVITY_SOUTH,
GDK_GRAVITY_NORTH,
GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_SLIDE_X,
rect_anchor_dx, 0);
if (x + width <= workarea.x + workarea.width)
{
if (tooltip->keyboard_mode_enabled)
goto found;
if (x <= tooltip->last_x + cursor_size + MAX_DISTANCE)
{
if (tooltip->last_y + cursor_size + MAX_DISTANCE < y)
y = tooltip->last_y + cursor_size + MAX_DISTANCE;
else if (y + height < tooltip->last_y - MAX_DISTANCE)
y = tooltip->last_y - MAX_DISTANCE - height;
goto found;
}
}
/* Try left FIXME: flip on rtl ? */
x = bounds.x - width - 4;
y = bounds.y + bounds.height / 2 - height / 2;
if (x >= workarea.x)
{
if (tooltip->keyboard_mode_enabled)
goto found;
if (x + width >= tooltip->last_x - MAX_DISTANCE)
{
if (tooltip->last_y + cursor_size + MAX_DISTANCE < y)
y = tooltip->last_y + cursor_size + MAX_DISTANCE;
else if (y + height < tooltip->last_y - MAX_DISTANCE)
y = tooltip->last_y - MAX_DISTANCE - height;
goto found;
}
}
/* Fallback */
if (tooltip->keyboard_mode_enabled)
{
x = bounds.x + bounds.width / 2 - width / 2;
y = bounds.y + bounds.height + 4;
}
else
{
/* At cursor */
x = tooltip->last_x + cursor_size * 3 / 4;
y = tooltip->last_y + cursor_size * 3 / 4;
}
found:
/* Show it */
if (x + width > workarea.x + workarea.width)
x -= x - (workarea.x + workarea.width) + width;
else if (x < workarea.x)
x = workarea.x;
if (y + height > workarea.y + workarea.height)
y -= y - (workarea.y + workarea.height) + height;
else if (y < workarea.y)
y = workarea.y;
if (!tooltip->keyboard_mode_enabled)
{
/* don't pop up under the pointer */
if (x <= tooltip->last_x && tooltip->last_x < x + width &&
y <= tooltip->last_y && tooltip->last_y < y + height)
y = tooltip->last_y - height - 2;
}
#ifdef GDK_WINDOWING_WAYLAND
/* set the transient parent on the tooltip when running with the Wayland
* backend to allow correct positioning of the tooltip windows
*/
if (GDK_IS_WAYLAND_DISPLAY (display))
{
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget);
if (GTK_IS_WINDOW (toplevel))
gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
GTK_WINDOW (toplevel));
}
#endif
#ifdef GDK_WINDOWING_MIR
/* Set the transient parent on the tooltip when running with the Mir
* backend to allow correct positioning of the tooltip windows */
if (GDK_IS_MIR_DISPLAY (display))
{
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (tooltip->tooltip_widget);
if (GTK_IS_WINDOW (toplevel))
gtk_window_set_transient_for (GTK_WINDOW (tooltip->current_window),
GTK_WINDOW (toplevel));
}
#endif
x -= border.left;
y -= border.top;
gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
gtk_widget_show (GTK_WIDGET (tooltip->current_window));
}
@@ -705,7 +849,6 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
gint x, y;
GdkSurface *surface;
GtkWidget *tooltip_widget;
GdkDevice *device;
GtkTooltip *tooltip;
gboolean return_value = FALSE;
@@ -715,10 +858,10 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
{
x = y = -1;
tooltip_widget = tooltip->keyboard_widget;
device = NULL;
}
else
{
GdkDevice *device;
gint tx, ty;
surface = tooltip->last_surface;
@@ -731,6 +874,9 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
gdk_surface_get_device_position (surface, device, &x, &y, NULL);
gdk_surface_get_root_coords (surface, x, y, &tx, &ty);
tooltip->last_x = tx;
tooltip->last_y = ty;
tooltip_widget = _gtk_widget_find_at_coords (surface, x, y, &x, &y);
}
@@ -762,7 +908,7 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
G_CALLBACK (gtk_tooltip_display_closed), tooltip);
}
gtk_tooltip_position (tooltip, display, tooltip_widget, device);
gtk_tooltip_position (tooltip, display, tooltip_widget);
/* Now a tooltip is visible again on the display, make sure browse
* mode is enabled.
+1
View File
@@ -77,6 +77,7 @@ gtk_tooltip_window_init (GtkTooltipWindow *self)
gtk_widget_init_template (GTK_WIDGET (self));
gtk_window_set_use_subsurface (window, TRUE);
_gtk_window_request_csd (window);
}
-1
View File
@@ -293,7 +293,6 @@ gtk_tree_set_row_drag_data (GtkSelectionData *selection_data,
gtk_selection_data_set (selection_data,
g_intern_static_string ("GTK_TREE_MODEL_ROW"),
8, /* bytes */
(void*)trd,
struct_size);
+17 -15
View File
@@ -2868,8 +2868,8 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->halign = GTK_ALIGN_FILL;
priv->valign = GTK_ALIGN_FILL;
priv->width_request = -1;
priv->height_request = -1;
priv->width = -1;
priv->height = -1;
_gtk_size_request_cache_init (&priv->requests);
@@ -7685,7 +7685,9 @@ gtk_widget_get_display (GtkWidget *widget)
*
* This function is used by custom widget implementations; if you're
* writing an app, youd use gtk_widget_grab_focus() to move the focus
* to a particular widget.
* to a particular widget, and gtk_container_set_focus_chain() to
* change the focus tab order. So you may want to investigate those
* functions instead.
*
* gtk_widget_child_focus() is called by containers as the user moves
* around the window using keyboard shortcuts. @direction indicates
@@ -7822,16 +7824,16 @@ gtk_widget_set_usize_internal (GtkWidget *widget,
g_object_freeze_notify (G_OBJECT (widget));
if (width > -2 && priv->width_request != width)
if (width > -2 && priv->width != width)
{
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_WIDTH_REQUEST]);
priv->width_request = width;
priv->width = width;
changed = TRUE;
}
if (height > -2 && priv->height_request != height)
if (height > -2 && priv->height != height)
{
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_HEIGHT_REQUEST]);
priv->height_request = height;
priv->height = height;
changed = TRUE;
}
@@ -7917,10 +7919,10 @@ gtk_widget_get_size_request (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
if (width)
*width = priv->width_request;
*width = priv->width;
if (height)
*height = priv->height_request;
*height = priv->height;
}
/*< private >
@@ -7935,7 +7937,7 @@ gtk_widget_has_size_request (GtkWidget *widget)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
return !(priv->width_request == -1 && priv->height_request == -1);
return !(priv->width == -1 && priv->height == -1);
}
/**
@@ -8673,10 +8675,10 @@ gtk_widget_adjust_size_request (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL && priv->width_request > 0)
*minimum_size = MAX (*minimum_size, priv->width_request);
else if (orientation == GTK_ORIENTATION_VERTICAL && priv->height_request > 0)
*minimum_size = MAX (*minimum_size, priv->height_request);
if (orientation == GTK_ORIENTATION_HORIZONTAL && priv->width > 0)
*minimum_size = MAX (*minimum_size, priv->width);
else if (orientation == GTK_ORIENTATION_VERTICAL && priv->height > 0)
*minimum_size = MAX (*minimum_size, priv->height);
/* Fix it if set_size_request made natural size smaller than min size.
* This would also silently fix broken widgets, but we warn about them
@@ -8703,7 +8705,7 @@ gtk_widget_adjust_baseline_request (GtkWidget *widget,
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
if (priv->height_request >= 0)
if (priv->height >= 0)
{
/* No baseline support for explicitly set height */
*minimum_baseline = -1;
+2 -2
View File
@@ -89,8 +89,8 @@ tab_sort_func (gconstpointer a,
if (y1 == y2)
{
const float x1 = child_bounds1.origin.x + (child_bounds1.size.width / 2.0f);
const float x2 = child_bounds2.origin.x + (child_bounds2.size.width / 2.0f);
const float x1 = child_bounds1.origin.y + (child_bounds1.size.width / 2.0f);
const float x2 = child_bounds2.origin.y + (child_bounds2.size.width / 2.0f);
if (text_direction == GTK_TEXT_DIR_RTL)
return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1);
+4 -2
View File
@@ -106,8 +106,8 @@ struct _GtkWidgetPrivate
guint8 verifying_invariants_count;
#endif
int width_request;
int height_request;
gint width;
gint height;
GtkBorder margin;
/* Animations and other things to update on clock ticks */
@@ -236,6 +236,8 @@ void _gtk_widget_synthesize_crossing (GtkWidget *fro
GdkDevice *device,
GdkCrossingMode mode);
static inline gpointer _gtk_widget_peek_request_cache (GtkWidget *widget);
void _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
GtkWidget *toplevel,
gpointer user_data);
+30 -5
View File
@@ -272,6 +272,7 @@ typedef struct
guint fullscreen : 1;
guint tiled : 1;
guint use_subsurface : 1;
guint hide_on_close : 1;
guint in_emit_close_request : 1;
@@ -3440,10 +3441,11 @@ gtk_window_unset_transient_for (GtkWindow *window)
*
* Passing %NULL for @parent unsets the current transient window.
*
* This function can also be used to attach a new
* On Wayland, this function can also be used to attach a new
* #GTK_WINDOW_POPUP to a #GTK_WINDOW_TOPLEVEL parent already mapped
* on screen so that the #GTK_WINDOW_POPUP will be
* positioned relative to the #GTK_WINDOW_TOPLEVEL surface.
* on screen so that the #GTK_WINDOW_POPUP will be created as a
* subsurface-based window #GDK_SURFACE_SUBSURFACE which can be
* positioned at will relatively to the #GTK_WINDOW_TOPLEVEL surface.
*
* On Windows, this function puts the child window on top of the parent,
* much as the window manager would have done on X.
@@ -6845,7 +6847,19 @@ gtk_window_realize (GtkWidget *widget)
allocation.height);
break;
case GTK_WINDOW_POPUP:
surface = gdk_surface_new_popup (gtk_widget_get_display (widget), &allocation);
#ifdef GDK_WINDOWING_WAYLAND
if (priv->use_subsurface &&
GDK_IS_WAYLAND_DISPLAY (gtk_widget_get_display (widget)))
{
surface = gdk_wayland_surface_new_subsurface (gtk_widget_get_display (widget),
&allocation);
}
else
#endif
{
surface = gdk_surface_new_popup (gtk_widget_get_display (widget),
&allocation);
}
break;
default:
g_error (G_STRLOC": Unknown window type %d!", priv->type);
@@ -10911,6 +10925,18 @@ gtk_window_enable_debugging (GtkWindow *window,
return TRUE;
}
void
gtk_window_set_use_subsurface (GtkWindow *window,
gboolean use_subsurface)
{
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
g_return_if_fail (GTK_IS_WINDOW (window));
g_return_if_fail (!_gtk_widget_get_realized (GTK_WIDGET (window)));
priv->use_subsurface = use_subsurface;
}
void
gtk_window_set_hardcoded_surface (GtkWindow *window,
GdkSurface *surface)
@@ -10959,7 +10985,6 @@ gtk_window_export_handle (GtkWindow *window,
handle_str = g_strdup_printf ("x11:%x", xid);
callback (window, handle_str, user_data);
g_free (handle_str);
return TRUE;
}
+2
View File
@@ -116,6 +116,8 @@ gboolean _gtk_window_is_popover_widget (GtkWindow *window,
GdkTexture * gtk_window_get_icon_for_size (GtkWindow *window,
int size);
void gtk_window_set_use_subsurface (GtkWindow *window,
gboolean use_subsurface);
void gtk_window_set_hardcoded_surface (GtkWindow *window,
GdkSurface *surface);
+34 -5
View File
@@ -16,7 +16,7 @@ gtk_cargs = [
gtk_private_sources = files([
'fallback-c89.c',
'fnmatch.c',
'tools/gdkpixbufutils.c',
'gdkpixbufutils.c',
'gtkactionhelper.c',
'gtkactionmuxer.c',
'gtkactionobservable.c',
@@ -31,7 +31,6 @@ gtk_private_sources = files([
'gtkcoloreditor.c',
'gtkcolorplane.c',
'gtkcolorpicker.c',
'gtkcolorpickerkwin.c',
'gtkcolorpickerportal.c',
'gtkcolorpickershell.c',
'gtkcolorscale.c',
@@ -113,7 +112,7 @@ gtk_private_sources = files([
'gtkhsla.c',
'gtkicon.c',
'gtkiconcache.c',
'tools/gtkiconcachevalidator.c',
'gtkiconcachevalidator.c',
'gtkiconhelper.c',
'gtkkineticscrolling.c',
'gtkkeyhash.c',
@@ -1077,6 +1076,38 @@ libgtk_dep = declare_dependency(sources: gtk_dep_sources,
link_with: libgtk,
link_args: common_ldflags)
# Installed tools
gtk_tools = [
['gtk4-query-settings', ['gtk-query-settings.c']],
['gtk4-builder-tool', ['gtk-builder-tool.c']],
['gtk4-update-icon-cache', ['updateiconcache.c', 'gtkiconcachevalidator.c']],
['gtk4-encode-symbolic-svg', ['encodesymbolic.c', 'gdkpixbufutils.c']],
]
if os_unix
gtk_tools += [['gtk4-launch', ['gtk-launch.c']]]
endif
foreach tool: gtk_tools
tool_name = tool.get(0)
tool_srcs = tool.get(1)
exe = executable(tool_name, tool_srcs,
include_directories: [confinc],
c_args: gtk_cargs,
dependencies: libgtk_dep,
install: true)
set_variable(tool_name.underscorify(), exe) # used in testsuites
endforeach
# Data to install
install_data('gtkbuilder.rng',
install_dir: join_paths(gtk_datadir, 'gtk-4.0'))
install_data('gtkbuilder.loc', 'gtkbuilder.its',
install_dir: join_paths(gtk_datadir, 'gettext/its'))
if quartz_enabled
# HACK: install_data() doesn't allow installing under a different name (#1487)
# FIXME: or maybe just rename it to gtk-keys.css in the src tree?
@@ -1085,5 +1116,3 @@ if quartz_enabled
configuration: configuration_data(),
install_dir: join_paths(get_option('datadir'), 'themes/Mac/gtk-4.0'))
endif
subdir('tools')
+1 -1
View File
@@ -91,7 +91,7 @@ static struct {
{ 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 Hieroglyphs") },
{ 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") },
-32
View File
@@ -1,32 +0,0 @@
# Installed tools
gtk_tools = [
['gtk4-query-settings', ['gtk-query-settings.c']],
['gtk4-builder-tool', ['gtk-builder-tool.c']],
['gtk4-update-icon-cache', ['updateiconcache.c', 'gtkiconcachevalidator.c']],
['gtk4-encode-symbolic-svg', ['encodesymbolic.c', 'gdkpixbufutils.c']],
]
if os_unix
gtk_tools += [['gtk4-launch', ['gtk-launch.c']]]
endif
foreach tool: gtk_tools
tool_name = tool.get(0)
tool_srcs = tool.get(1)
exe = executable(tool_name, tool_srcs,
include_directories: [confinc],
c_args: gtk_cargs,
dependencies: libgtk_dep,
install: true)
set_variable(tool_name.underscorify(), exe) # used in testsuites
endforeach
# Data to install
install_data('gtkbuilder.rng',
install_dir: join_paths(gtk_datadir, 'gtk-4.0'))
install_data('gtkbuilder.loc', 'gtkbuilder.its',
install_dir: join_paths(gtk_datadir, 'gettext/its'))
-2
View File
@@ -41,8 +41,6 @@
<child>
<object class="GtkButton" id="picker_button">
<property name="icon-name">color-select-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="tooltip-text" translatable="yes">Pick a color from the screen</property>
<signal name="clicked" handler="pick_color"/>
<style>
-1
View File
@@ -60,7 +60,6 @@
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin-start">4px</property>
<property name="visible">False</property>
</object>
</child>
</object>
@@ -595,7 +595,6 @@ scan_directory (const gchar *base_path,
{
GHashTable *dir_hash;
GDir *dir;
GList *list = NULL, *iterator = NULL;
const gchar *name;
gchar *dir_path;
gboolean dir_added = FALSE;
@@ -613,13 +612,6 @@ scan_directory (const gchar *base_path,
while ((name = g_dir_read_name (dir)))
{
list = g_list_prepend (list, g_strdup (name));
}
list = g_list_sort (list, (GCompareFunc) strcmp);
for (iterator = list; iterator; iterator = iterator->next)
{
name = iterator->data;
gchar *path;
gboolean retval;
int flags = 0;
@@ -698,7 +690,6 @@ scan_directory (const gchar *base_path,
g_free (path);
}
g_list_free_full (list, g_free);
g_dir_close (dir);
/* Move dir into the big file hash */
+4 -4
View File
@@ -55,6 +55,7 @@ gtk/a11y/gtkrenderercellaccessible.c
gtk/a11y/gtkscalebuttonaccessible.c
gtk/a11y/gtkspinneraccessible.c
gtk/a11y/gtkswitchaccessible.c
gtk/encodesymbolic.c
gtk/gtkaboutdialog.c
gtk/gtkaccelgroup.c
gtk/gtkaccellabel.c
@@ -82,6 +83,7 @@ gtk/gtkbuildable.c
gtk/gtkbuilder.c
gtk/gtkbuilder-menus.c
gtk/gtkbuilderparser.c
gtk/gtk-builder-tool.c
gtk/gtkbutton.c
gtk/gtkcalendar.c
gtk/gtkcellareabox.c
@@ -176,6 +178,7 @@ gtk/gtkimmulticontext.c
gtk/gtkinfobar.c
gtk/gtkinvisible.c
gtk/gtklabel.c
gtk/gtk-launch.c
gtk/gtklayout.c
gtk/gtklevelbar.c
gtk/gtklinkbutton.c
@@ -320,10 +323,7 @@ gtk/open-type-layout.h
gtk/paper_names.c
gtk/paper_names_offsets.c
gtk/script-names.c
gtk/tools/encodesymbolic.c
gtk/tools/gtk-builder-tool.c
gtk/tools/gtk-launch.c
gtk/tools/updateiconcache.c
gtk/updateiconcache.c
modules/media/gtkffmediafile.c
modules/media/gtkgstsink.c
modules/printbackends/gtkprintbackendcloudprint.c
+1968 -2025
View File
File diff suppressed because it is too large Load Diff

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