Compare commits

..

43 Commits

Author SHA1 Message Date
Matthias Clasen
c5988a22a4 gpu: Add a front cache
This copies the approach taken in the gl renderer to avoid much
of the hash table lookup overhead by means of a front cache.
2024-01-20 11:19:23 -05:00
Matthias Clasen
498bf67cec gpu: Print more detailed cache statistics
Print out stale glyphs and dead pixel ratios.
2024-01-20 08:50:50 -05:00
Matthias Clasen
65455cdb91 gpu: Rework glyph aging
Instead of counting atlas occupancy by itesm, count how many
dead pixels we have, and free the atlas if more than half of its
pixels are dead. This matches what the GL renderer does.

As part of this, change when glyphs are freed. We now keep them
in the hash table until their atlas is freed and we only do dead
pixel accounting when should_collect is called. This keeps the
glyphs available for use from the cache as long as are in the atlas.

If a stale glyph is sused, we 'revive' itby removing its pixels
from the dead.

This matches more closely what the gl renderer does.
2024-01-20 08:48:33 -05:00
Matthias Clasen
d4963ba2e5 gpu: Make cache freeing more robust
Currently, we only free an atlas when all its glyphs are gone,
but we might revisit that in the future, so be prepared for it.
2024-01-20 08:05:38 -05:00
Matthias Clasen
ec5fed6cc4 gpu: Fix atlas allocation logic
The code wasn't careful enough, and could make the last slice
higher than the atlas, or put the image into a too-narrow slice.

Add more assertions.
2024-01-20 08:05:38 -05:00
Matthias Clasen
b7ae5404a3 gsk: Reshuffle code a bit
Move the atlas allocation to the atlas section in the code.
2024-01-20 08:05:38 -05:00
Matthias Clasen
fb4f210430 gpu: Fix ordering problem in clear_cache()
We must free the glyphs before their atlases, since we now maintain
the item count of the atlas when glyphs are freed.
2024-01-20 08:05:30 -05:00
Matthias Clasen
82df109444 gpu: Fix atlas freeing
We need to unset current_atlas if we free that one.
2024-01-20 08:05:30 -05:00
Matthias Clasen
bd84142f43 gpu: Evict stale atlases from the cache
We evict atlases when they are old and unused.
2024-01-20 08:05:30 -05:00
Matthias Clasen
65074bbbac gpu: Count glyphs on atlases
That is the only way to know when its safe to gc an atlas. We can't
do that if there's still glyphs living on it.
2024-01-20 08:05:30 -05:00
Matthias Clasen
21fb5ec0b2 gpu: Evict stale glyphs from the cache 2024-01-20 08:05:30 -05:00
Matthias Clasen
e57f92b7e9 gpu: Fix texture eviction
If we gc a cached texture for which the GdkTexture is still alive,
the cached texture object will remain accessible via the render
data, so need to make sure not to leave a dangling pointer behind
here.
2024-01-20 08:05:30 -05:00
Matthias Clasen
e94e348ad5 gpu: Evict stale textures from the cache
Fixes: #6346
2024-01-20 08:05:30 -05:00
Matthias Clasen
91234e75f8 gpu: Start doing gc
Call gc periodically from a timeout.
2024-01-20 08:05:30 -05:00
Matthias Clasen
212e9a6957 gpu: Print some cache stats
This reuses the GLYPHCACHE debug flag that is used for the same
purpose in the gl renderer.
2024-01-20 08:05:30 -05:00
Matthias Clasen
b4b7e9b040 gpu: Fix up gc
Make the gc loop free the the right item.
2024-01-20 08:04:43 -05:00
Matthias Clasen
c3fcf0f7b0 gpu: Plug a memory leak
This looks like just a leftover line.
2024-01-20 08:02:20 -05:00
Matthias Clasen
60fc48e71f gpu: Cosmetics
s/timestsamp/timestamp/
2024-01-20 08:01:59 -05:00
Danial Behzadi
01d9886eea Update Persian translation 2024-01-20 11:22:43 +00:00
Danial Behzadi
a97231c8bf Update Persian translation
(cherry picked from commit 58425405d2)
2024-01-20 11:13:44 +00:00
Matthias Clasen
8ac8a027b2 Merge branch 'wip/no-seat' into 'main'
Fix possible crashers if no seats are available

See merge request GNOME/gtk!6787
2024-01-20 03:30:12 +00:00
Carlos Garnacho
070f3a61ac gdk/wayland: Bail out on titlebar gestures with no seat
This API might be called programmatically at a time that there's no
seats, handle this situation by returning FALSE in the GDK API.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6335
2024-01-20 01:27:27 +01:00
Carlos Garnacho
022347fa85 gdk/wayland: Avoid activation paths with no seats
When a toplevel is focused programmatically and there is no
underlying seat, we cannot attempt to focus it with no
focus to be obtained, nor serials serials to use.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6335
2024-01-20 01:27:27 +01:00
Matthias Clasen
ebb6076aca Merge branch 'matthiasc/for-main' into 'main'
inspector: Update logging tab

See merge request GNOME/gtk!6783
2024-01-19 16:46:06 +00:00
Matthias Clasen
7b66bc45aa Cosmetics
Add some vim modelines.
2024-01-19 09:26:32 -05:00
Matthias Clasen
698aa7c0f3 inspector: Update logging tab
The verbose flag was missing in the gsk section.
2024-01-19 09:26:32 -05:00
Matthias Clasen
70699efc71 Merge branch 'matthiasc/for-main' into 'main'
Automate profile setting

See merge request GNOME/gtk!6781
2024-01-19 03:49:58 +00:00
Matthias Clasen
cebc95f253 Automate profile setting
We can derive whether we are build a developement snapshot or
a stable version from the minor version number. So do that.
This way, we'll get the devel profile selected in the nightly
SDK, which will make the commit sha appear in the inspector,
which is useful to determine what nightly users are testing.
2024-01-18 21:26:39 -05:00
Matthias Clasen
f9c6bd125b Merge branch 'inspector-git-sha' into 'main'
build: Move demo header generation

See merge request GNOME/gtk!6780
2024-01-19 01:41:40 +00:00
Matthias Clasen
4733ca193b inspector: Show git sha for the build 2024-01-18 20:22:00 -05:00
Matthias Clasen
c7b345f73e build: Move and rename demo_conf.h header
We want to use the same header in the inspector, so move it to
the toplevel. And since it is no longer for demos only, rename
it to profile_conf.h, and also rename the build option back
to profile.
2024-01-18 20:20:58 -05:00
Matthias Clasen
1fbc61f2cb Merge branch 'static_text_widgets_are_not_special' into 'main'
a11y: Remove special handling of accessible names for static text widgets

See merge request GNOME/gtk!6776
2024-01-18 16:01:29 +00:00
Matthias Clasen
565694ede5 Merge branch 'wip/chergert/fix-expression-weak-ref-uaf' into 'main'
expression: use indirection to safely finalize object expression

See merge request GNOME/gtk!6778
2024-01-18 16:00:55 +00:00
Christian Hergert
0df03b054d expression: guard against UAF with indirection
When using g_object_weak_ref(), it is important that you can discover
weather or not it is safe to call g_object_weak_unref(). That is
problematic if you use a naked pointer to structure. Additionally,
if a GWeakRef is used, and things are not cleaned up carefully,
GObject itself will try to write to it. So ensuring that the GWeakRef
is cleared safely before the owning struct is finalized is paramount.
That is difficult if you are unsure wheather or not your weak_ref
callback has been called.

This introduces WeakRefGuard which is an indirection pointer that is
cleared on the first unref. There are only ever two references. When
the owning struct is finalized or the weak ref callback is called, an
unref will occur and the guard will clear the data pointer.
2024-01-17 19:25:31 -08:00
Christian Hergert
73d01d3130 expression: release target if evaulation fails
Related #6341
2024-01-17 19:25:00 -08:00
Matthias Clasen
80f3357117 Merge branch 'dboles/Notebook-DropTarget-GTK4' into 'main'
Notebook: Update doc on how to accept dropped tabs

See merge request GNOME/gtk!6450
2024-01-18 02:28:18 +00:00
Lukáš Tyrychtr
d5b34aecdd a11y: Remove special handling of accessible names for static text widgets
By doing this, we gain the capability to send notifications when their
accessible names change. Also, it simplifies the accessible name
generation logic.
2024-01-17 12:49:38 +01:00
Matthias Clasen
d16d2135e6 Merge branch 'demos-fix-commit-sha' into 'main'
Flatpak demos fix missing commit sha

See merge request GNOME/gtk!6774
2024-01-17 02:51:35 +00:00
Matthias Clasen
53b52abd30 Merge branch 'matthiasc/for-main' into 'main'
Shrink the repeat-repeats tests

See merge request GNOME/gtk!6775
2024-01-17 02:40:22 +00:00
Matthias Clasen
e55e9e3b36 Shrink the repeat-repeats tests
This was triggering timeouts in ci.
2024-01-16 20:58:02 -05:00
Matthias Clasen
9f9cea219f Merge branch 'dnd-cursor-names' into 'main'
dnd: Use standard cursor names

Closes #6337

See merge request GNOME/gtk!6770
2024-01-17 01:33:41 +00:00
Jan Willem Eriks
cf8cca8724 Flatpak builds pass the commit sha as environment variable
This variable is refrenced at build-aux/meson/gen-demo-header.py but never passed to the flatpak builder.
This fixes that the flatpak build don't have their commit in the about window.
2024-01-16 20:45:01 +01:00
Daniel Boles
473881357c Notebook: Update doc on how to accept dropped tabs
It was still giving out-of-date info about how GTK3 did this. Update per
reading the current code, so readers have proper guidance on doing this.
2023-10-02 16:39:49 +01:00
27 changed files with 835 additions and 517 deletions

View File

@@ -28,7 +28,7 @@ flatpak build ${builddir} meson \
-Ddemo-profile=devel \
_flatpak_build
flatpak build ${builddir} ninja -C _flatpak_build install
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
flatpak-builder \
--user --disable-rofiles-fuse \

View File

@@ -24,7 +24,7 @@
#include "demos.h"
#include "fontify.h"
#include "demo_conf.h"
#include "profile_conf.h"
static GtkWidget *info_view;
static GtkWidget *source_view;

View File

@@ -236,7 +236,7 @@ foreach flag: common_cflags
endif
endforeach
gtkdemo_deps += [ demo_conf_h ]
gtkdemo_deps += [ profile_conf_h ]
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],

View File

@@ -4,7 +4,7 @@
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "demo_conf.h"
#include "profile_conf.h"
struct _IconBrowserApp
{

View File

@@ -14,7 +14,7 @@ iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
executable('gtk4-icon-browser',
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
dependencies: [ libgtk_dep, profile_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,

View File

@@ -1,16 +1,3 @@
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
demo_profile = get_option('demo-profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
command: [gen_demo_header, meson.project_source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,
build_always_stale: true,
)
)
# appdata
appdata_config = configuration_data()

View File

@@ -12,7 +12,7 @@ node_editor_resources = gnome.compile_resources('node_editor_resources',
executable('gtk4-node-editor',
sources: [node_editor_sources, node_editor_resources],
dependencies: [ libgtk_dep, demo_conf_h ],
dependencies: [ libgtk_dep, profile_conf_h ],
include_directories: confinc,
c_args: common_cflags,
win_subsystem: 'windows',

View File

@@ -25,7 +25,7 @@
#include "node-editor-window.h"
#include "demo_conf.h"
#include "profile_conf.h"
static const char *css =
"textview.editor {"

View File

@@ -1,7 +1,7 @@
executable('gtk4-print-editor',
sources: ['print-editor.c'],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
dependencies: [ libgtk_dep, profile_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,

View File

@@ -4,7 +4,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "demo_conf.h"
#include "profile_conf.h"
static GtkWidget *main_window;
static GFile *filename = NULL;

View File

@@ -66,7 +66,7 @@ endif
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
dependencies: [ libgtk_dep, profile_conf_h ],
include_directories: confinc,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,

View File

@@ -25,7 +25,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "demo_conf.h"
#include "profile_conf.h"
static void
change_dark_state (GSimpleAction *action,

View File

@@ -1973,8 +1973,10 @@ gdk_wayland_toplevel_titlebar_gesture (GdkToplevel *toplevel,
return FALSE;
seat = gdk_display_get_default_seat (surface->display);
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
if (!seat)
return FALSE;
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (GDK_WAYLAND_SEAT (seat), NULL);
gtk_surface1_titlebar_gesture (wayland_toplevel->display_server.gtk_surface,
@@ -2155,15 +2157,14 @@ gdk_wayland_toplevel_focus (GdkToplevel *toplevel,
GdkWaylandSurface *wayland_surface = GDK_WAYLAND_SURFACE (toplevel);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
GdkWaylandSeat *seat =
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
gchar *startup_id = NULL;
startup_id = g_steal_pointer (&display_wayland->startup_notification_id);
if (display_wayland->xdg_activation)
if (seat && display_wayland->xdg_activation)
{
GdkWaylandSeat *seat =
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
/* If the focus request does not have a startup ID associated, get a
* new token to activate the window.
*/

View File

@@ -3,17 +3,28 @@
#include "gskgpudeviceprivate.h"
#include "gskgpuframeprivate.h"
#include "gskgpuimageprivate.h"
#include "gskgpuuploadopprivate.h"
#include "gdk/gdkdisplayprivate.h"
#include "gdk/gdktextureprivate.h"
#include "gsk/gskdebugprivate.h"
#define MAX_SLICES_PER_ATLAS 64
#define ATLAS_SIZE 1024
#define MAX_ATLAS_ITEM_SIZE 256
G_STATIC_ASSERT (MAX_ATLAS_ITEM_SIZE < ATLAS_SIZE);
#define MAX_DEAD_PIXELS (ATLAS_SIZE * ATLAS_SIZE / 2)
#define CACHE_GC_TIMEOUT 1 /* seconds */
#define CACHE_MAX_AGE (G_TIME_SPAN_SECOND * 4) /* 4 seconds, in µs */
typedef struct _GskGpuCached GskGpuCached;
typedef struct _GskGpuCachedClass GskGpuCachedClass;
typedef struct _GskGpuCachedAtlas GskGpuCachedAtlas;
@@ -21,6 +32,15 @@ typedef struct _GskGpuCachedGlyph GskGpuCachedGlyph;
typedef struct _GskGpuCachedTexture GskGpuCachedTexture;
typedef struct _GskGpuDevicePrivate GskGpuDevicePrivate;
typedef struct _GlyphKey GlyphKey;
struct _GlyphKey
{
PangoFont *font;
PangoGlyph glyph;
GskGpuGlyphLookupFlags flags;
float scale;
};
struct _GskGpuDevicePrivate
{
GdkDisplay *display;
@@ -34,6 +54,11 @@ struct _GskGpuDevicePrivate
GHashTable *glyph_cache;
GskGpuCachedAtlas *current_atlas;
struct {
GlyphKey key;
GskGpuCachedGlyph *value;
} front[256];
};
G_DEFINE_TYPE_WITH_PRIVATE (GskGpuDevice, gsk_gpu_device, G_TYPE_OBJECT)
@@ -48,18 +73,40 @@ struct _GskGpuCachedClass
GskGpuCached *cached);
gboolean (* should_collect) (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestsamp);
gint64 timestamp);
};
struct _GskGpuCached
{
const GskGpuCachedClass *class;
GskGpuCachedAtlas *atlas;
GskGpuCached *next;
GskGpuCached *prev;
gint64 timestamp;
gboolean stale;
guint pixels; /* For glyphs, pixels. For atlases, dead pixels */
};
static inline void
mark_as_stale (GskGpuCached *cached,
gboolean stale)
{
if (cached->stale != stale)
{
cached->stale = stale;
if (cached->atlas)
{
if (stale)
((GskGpuCached *) cached->atlas)->pixels += cached->pixels;
else
((GskGpuCached *) cached->atlas)->pixels -= cached->pixels;
}
}
}
static void
gsk_gpu_cached_free (GskGpuDevice *device,
GskGpuCached *cached)
@@ -75,6 +122,8 @@ gsk_gpu_cached_free (GskGpuDevice *device,
else
priv->first_cached = cached->next;
mark_as_stale (cached, TRUE);
cached->class->free (device, cached);
}
@@ -114,7 +163,8 @@ gsk_gpu_cached_use (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
/* FIXME */
cached->timestamp = timestamp;
mark_as_stale (cached, FALSE);
}
/* }}} */
@@ -137,10 +187,23 @@ static void
gsk_gpu_cached_atlas_free (GskGpuDevice *device,
GskGpuCached *cached)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
GskGpuCachedAtlas *self = (GskGpuCachedAtlas *) cached;
GskGpuCached *c, *next;
/* Free all remaining glyphs on this atlas */
for (c = priv->first_cached; c != NULL; c = next)
{
next = c->next;
if (c->atlas == self)
gsk_gpu_cached_free (device, c);
}
if (priv->current_atlas == self)
priv->current_atlas = NULL;
g_object_unref (self->image);
g_free (self);
}
@@ -149,8 +212,7 @@ gsk_gpu_cached_atlas_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
/* FIXME */
return FALSE;
return cached->pixels > MAX_DEAD_PIXELS;
}
static const GskGpuCachedClass GSK_GPU_CACHED_ATLAS_CLASS =
@@ -171,298 +233,6 @@ gsk_gpu_cached_atlas_new (GskGpuDevice *device)
return self;
}
/* }}} */
/* {{{ CachedTexture */
struct _GskGpuCachedTexture
{
GskGpuCached parent;
/* atomic */ GdkTexture *texture;
GskGpuImage *image;
};
static void
gsk_gpu_cached_texture_free (GskGpuDevice *device,
GskGpuCached *cached)
{
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
gboolean texture_still_alive;
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
g_object_unref (self->image);
if (!texture_still_alive)
g_free (self);
}
static gboolean
gsk_gpu_cached_texture_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
/* FIXME */
return FALSE;
}
static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
{
sizeof (GskGpuCachedTexture),
gsk_gpu_cached_texture_free,
gsk_gpu_cached_texture_should_collect
};
static void
gsk_gpu_cached_texture_destroy_cb (gpointer data)
{
GskGpuCachedTexture *cache = data;
gboolean cache_still_alive;
cache_still_alive = g_atomic_pointer_exchange (&cache->texture, NULL) != NULL;
if (!cache_still_alive)
g_free (cache);
}
static GskGpuCachedTexture *
gsk_gpu_cached_texture_new (GskGpuDevice *device,
GdkTexture *texture,
GskGpuImage *image)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
GskGpuCachedTexture *self;
if (gdk_texture_get_render_data (texture, device))
gdk_texture_clear_render_data (texture);
else if ((self = g_hash_table_lookup (priv->texture_cache, texture)))
{
g_hash_table_remove (priv->texture_cache, texture);
g_object_weak_unref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
}
self = gsk_gpu_cached_new (device, &GSK_GPU_CACHED_TEXTURE_CLASS, NULL);
self->texture = texture;
self->image = g_object_ref (image);
if (!gdk_texture_set_render_data (texture, device, self, gsk_gpu_cached_texture_destroy_cb))
{
g_object_weak_ref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
g_hash_table_insert (priv->texture_cache, texture, self);
}
return self;
}
/* }}} */
/* {{{ CachedGlyph */
struct _GskGpuCachedGlyph
{
GskGpuCached parent;
PangoFont *font;
PangoGlyph glyph;
GskGpuGlyphLookupFlags flags;
float scale;
GskGpuImage *image;
graphene_rect_t bounds;
graphene_point_t origin;
};
static void
gsk_gpu_cached_glyph_free (GskGpuDevice *device,
GskGpuCached *cached)
{
GskGpuCachedGlyph *self = (GskGpuCachedGlyph *) cached;
g_object_unref (self->font);
g_object_unref (self->image);
g_free (self);
}
static gboolean
gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestsamp)
{
/* FIXME */
return FALSE;
}
static guint
gsk_gpu_cached_glyph_hash (gconstpointer data)
{
const GskGpuCachedGlyph *glyph = data;
return GPOINTER_TO_UINT (glyph->font) ^
glyph->glyph ^
(glyph->flags << 24) ^
((guint) glyph->scale * PANGO_SCALE);
}
static gboolean
gsk_gpu_cached_glyph_equal (gconstpointer v1,
gconstpointer v2)
{
const GskGpuCachedGlyph *glyph1 = v1;
const GskGpuCachedGlyph *glyph2 = v2;
return glyph1->font == glyph2->font
&& glyph1->glyph == glyph2->glyph
&& glyph1->flags == glyph2->flags
&& glyph1->scale == glyph2->scale;
}
static const GskGpuCachedClass GSK_GPU_CACHED_GLYPH_CLASS =
{
sizeof (GskGpuCachedGlyph),
gsk_gpu_cached_glyph_free,
gsk_gpu_cached_glyph_should_collect
};
/* }}} */
/* {{{ GskGpuDevice */
void
gsk_gpu_device_gc (GskGpuDevice *self,
gint64 timestamp)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GskGpuCached *cached, *next;
for (cached = priv->first_cached; cached != NULL; cached = next)
{
next = cached->next;
if (gsk_gpu_cached_should_collect (self, cached, timestamp))
gsk_gpu_cached_free (self, priv->first_cached);
}
}
static void
gsk_gpu_device_clear_cache (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
for (GskGpuCached *cached = priv->first_cached; cached; cached = cached->next)
{
if (cached->prev == NULL)
g_assert (priv->first_cached == cached);
else
g_assert (cached->prev->next == cached);
if (cached->next == NULL)
g_assert (priv->last_cached == cached);
else
g_assert (cached->next->prev == cached);
}
while (priv->first_cached)
gsk_gpu_cached_free (self, priv->first_cached);
g_assert (priv->last_cached == NULL);
}
static void
gsk_gpu_device_dispose (GObject *object)
{
GskGpuDevice *self = GSK_GPU_DEVICE (object);
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
gsk_gpu_device_clear_cache (self);
g_hash_table_unref (priv->glyph_cache);
g_hash_table_unref (priv->texture_cache);
G_OBJECT_CLASS (gsk_gpu_device_parent_class)->dispose (object);
}
static void
gsk_gpu_device_finalize (GObject *object)
{
GskGpuDevice *self = GSK_GPU_DEVICE (object);
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
g_object_unref (priv->display);
G_OBJECT_CLASS (gsk_gpu_device_parent_class)->finalize (object);
}
static void
gsk_gpu_device_class_init (GskGpuDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gsk_gpu_device_dispose;
object_class->finalize = gsk_gpu_device_finalize;
}
static void
gsk_gpu_device_init (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
priv->glyph_cache = g_hash_table_new (gsk_gpu_cached_glyph_hash,
gsk_gpu_cached_glyph_equal);
priv->texture_cache = g_hash_table_new (g_direct_hash,
g_direct_equal);
}
void
gsk_gpu_device_setup (GskGpuDevice *self,
GdkDisplay *display,
gsize max_image_size)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
priv->display = g_object_ref (display);
priv->max_image_size = max_image_size;
}
GdkDisplay *
gsk_gpu_device_get_display (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
return priv->display;
}
gsize
gsk_gpu_device_get_max_image_size (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
return priv->max_image_size;
}
GskGpuImage *
gsk_gpu_device_create_offscreen_image (GskGpuDevice *self,
gboolean with_mipmap,
GdkMemoryDepth depth,
gsize width,
gsize height)
{
return GSK_GPU_DEVICE_GET_CLASS (self)->create_offscreen_image (self, with_mipmap, depth, width, height);
}
GskGpuImage *
gsk_gpu_device_create_upload_image (GskGpuDevice *self,
gboolean with_mipmap,
GdkMemoryFormat format,
gsize width,
gsize height)
{
return GSK_GPU_DEVICE_GET_CLASS (self)->create_upload_image (self, with_mipmap, format, width, height);
}
GskGpuImage *
gsk_gpu_device_create_download_image (GskGpuDevice *self,
GdkMemoryDepth depth,
gsize width,
gsize height)
{
return GSK_GPU_DEVICE_GET_CLASS (self)->create_download_image (self, depth, width, height);
}
/* This rounds up to the next number that has <= 2 bits set:
* 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, ...
* That is roughly sqrt(2), so it should limit waste
@@ -520,25 +290,397 @@ gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
if (!can_add_slice)
return FALSE;
if (y + height > ATLAS_SIZE)
return FALSE;
atlas->n_slices++;
if (atlas->n_slices == MAX_SLICES_PER_ATLAS)
atlas->slices[i].height = ATLAS_SIZE - y;
else
atlas->slices[i].height = round_up_atlas_size (MAX (height, 4));
atlas->slices[i].height = MIN (round_up_atlas_size (MAX (height, 4)), ATLAS_SIZE - y);
atlas->slices[i].width = 0;
best_y = y;
best_slice = i;
}
g_assert (best_slice < MAX_SLICES_PER_ATLAS);
*out_x = atlas->slices[best_slice].width;
*out_y = best_y;
atlas->slices[best_slice].width += width;
g_assert (atlas->slices[best_slice].height >= height);
g_assert (atlas->slices[best_slice].width <= ATLAS_SIZE);
g_assert (best_y + atlas->slices[best_slice].height <= ATLAS_SIZE);
return TRUE;
}
/* }}} */
/* {{{ CachedTexture */
struct _GskGpuCachedTexture
{
GskGpuCached parent;
/* atomic */ GdkTexture *texture;
GskGpuImage *image;
};
static void
gsk_gpu_cached_texture_free (GskGpuDevice *device,
GskGpuCached *cached)
{
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
gboolean texture_still_alive;
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
g_clear_object (&self->image);
if (!texture_still_alive)
g_free (self);
}
static gboolean
gsk_gpu_cached_texture_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
return timestamp - cached->timestamp > CACHE_MAX_AGE;
}
static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
{
sizeof (GskGpuCachedTexture),
gsk_gpu_cached_texture_free,
gsk_gpu_cached_texture_should_collect
};
static void
gsk_gpu_cached_texture_destroy_cb (gpointer data)
{
GskGpuCachedTexture *cache = data;
gboolean cache_still_alive;
cache_still_alive = g_atomic_pointer_exchange (&cache->texture, NULL) != NULL;
if (!cache_still_alive)
g_free (cache);
}
static GskGpuCachedTexture *
gsk_gpu_cached_texture_new (GskGpuDevice *device,
GdkTexture *texture,
GskGpuImage *image)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
GskGpuCachedTexture *self;
if (gdk_texture_get_render_data (texture, device))
gdk_texture_clear_render_data (texture);
else if ((self = g_hash_table_lookup (priv->texture_cache, texture)))
{
g_hash_table_remove (priv->texture_cache, texture);
g_object_weak_unref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
}
self = gsk_gpu_cached_new (device, &GSK_GPU_CACHED_TEXTURE_CLASS, NULL);
self->texture = texture;
self->image = g_object_ref (image);
if (!gdk_texture_set_render_data (texture, device, self, gsk_gpu_cached_texture_destroy_cb))
{
g_object_weak_ref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
g_hash_table_insert (priv->texture_cache, texture, self);
}
return self;
}
/* }}} */
/* {{{ CachedGlyph */
struct _GskGpuCachedGlyph
{
GskGpuCached parent;
GlyphKey key;
GskGpuImage *image;
graphene_rect_t bounds;
graphene_point_t origin;
};
static void
gsk_gpu_cached_glyph_free (GskGpuDevice *device,
GskGpuCached *cached)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
GskGpuCachedGlyph *self = (GskGpuCachedGlyph *) cached;
g_hash_table_remove (priv->glyph_cache, self);
g_object_unref (self->key.font);
g_object_unref (self->image);
g_free (self);
}
static gboolean
gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
if (timestamp - cached->timestamp > CACHE_MAX_AGE)
mark_as_stale (cached, TRUE);
/* Glyphs are only collected when their atlas is freed */
return FALSE;
}
static guint
gsk_gpu_cached_glyph_hash (gconstpointer data)
{
const GskGpuCachedGlyph *glyph = data;
return GPOINTER_TO_UINT (glyph->key.font) ^
glyph->key.glyph ^
(glyph->key.flags << 24) ^
((guint) glyph->key.scale * PANGO_SCALE);
}
static gboolean
gsk_gpu_cached_glyph_equal (gconstpointer v1,
gconstpointer v2)
{
const GskGpuCachedGlyph *glyph1 = v1;
const GskGpuCachedGlyph *glyph2 = v2;
return glyph1->key.font == glyph2->key.font
&& glyph1->key.glyph == glyph2->key.glyph
&& glyph1->key.flags == glyph2->key.flags
&& glyph1->key.scale == glyph2->key.scale;
}
static const GskGpuCachedClass GSK_GPU_CACHED_GLYPH_CLASS =
{
sizeof (GskGpuCachedGlyph),
gsk_gpu_cached_glyph_free,
gsk_gpu_cached_glyph_should_collect
};
/* }}} */
/* {{{ GskGpuDevice */
static void
print_cache_stats (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GskGpuCached *cached;
guint glyphs = 0;
guint stale_glyphs = 0;
guint textures = 0;
guint atlases = 0;
GString *ratios = g_string_new ("");
for (cached = priv->first_cached; cached != NULL; cached = cached->next)
{
if (cached->class == &GSK_GPU_CACHED_GLYPH_CLASS)
{
glyphs++;
if (cached->stale)
stale_glyphs++;
}
else if (cached->class == &GSK_GPU_CACHED_TEXTURE_CLASS)
textures++;
else if (cached->class == &GSK_GPU_CACHED_ATLAS_CLASS)
{
double ratio;
atlases++;
ratio = (double) cached->pixels / (double) (ATLAS_SIZE * ATLAS_SIZE);
if (ratios->len == 0)
g_string_append (ratios, " (ratios ");
else
g_string_append (ratios, ", ");
g_string_append_printf (ratios, "%.2f", ratio);
}
}
if (ratios->len > 0)
g_string_append (ratios, ")");
gdk_debug_message ("cached items\n"
" glyphs: %5u (%u stale)\n"
" textures: %5u\n"
" atlases: %5u%s",
glyphs, stale_glyphs, textures, atlases, ratios->str);
g_string_free (ratios, TRUE);
}
void
gsk_gpu_device_gc (GskGpuDevice *self,
gint64 timestamp)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GskGpuCached *cached, *prev;
/* We walk the cache from the end so we don't end up with prev
* begin a leftover glyph on the atlas we are freeing
*/
for (cached = priv->last_cached; cached != NULL; cached = prev)
{
prev = cached->prev;
if (gsk_gpu_cached_should_collect (self, cached, timestamp))
gsk_gpu_cached_free (self, cached);
}
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
print_cache_stats (self);
}
static void
gsk_gpu_device_clear_cache (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
for (GskGpuCached *cached = priv->first_cached; cached; cached = cached->next)
{
if (cached->prev == NULL)
g_assert (priv->first_cached == cached);
else
g_assert (cached->prev->next == cached);
if (cached->next == NULL)
g_assert (priv->last_cached == cached);
else
g_assert (cached->next->prev == cached);
}
/* We clear the cache from the end so glyphs get freed before their atlas */
while (priv->last_cached)
gsk_gpu_cached_free (self, priv->last_cached);
g_assert (priv->last_cached == NULL);
}
static void
gsk_gpu_device_dispose (GObject *object)
{
GskGpuDevice *self = GSK_GPU_DEVICE (object);
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
gsk_gpu_device_clear_cache (self);
g_hash_table_unref (priv->glyph_cache);
g_hash_table_unref (priv->texture_cache);
g_clear_handle_id (&priv->cache_gc_source, g_source_remove);
G_OBJECT_CLASS (gsk_gpu_device_parent_class)->dispose (object);
}
static void
gsk_gpu_device_finalize (GObject *object)
{
GskGpuDevice *self = GSK_GPU_DEVICE (object);
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
g_object_unref (priv->display);
G_OBJECT_CLASS (gsk_gpu_device_parent_class)->finalize (object);
}
static void
gsk_gpu_device_class_init (GskGpuDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gsk_gpu_device_dispose;
object_class->finalize = gsk_gpu_device_finalize;
}
static void
gsk_gpu_device_init (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
priv->glyph_cache = g_hash_table_new (gsk_gpu_cached_glyph_hash,
gsk_gpu_cached_glyph_equal);
priv->texture_cache = g_hash_table_new (g_direct_hash,
g_direct_equal);
}
static gboolean
cache_gc_source_callback (gpointer data)
{
GskGpuDevice *self = data;
gsk_gpu_device_gc (self, g_get_monotonic_time ());
return G_SOURCE_CONTINUE;
}
void
gsk_gpu_device_setup (GskGpuDevice *self,
GdkDisplay *display,
gsize max_image_size)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
priv->display = g_object_ref (display);
priv->max_image_size = max_image_size;
priv->cache_gc_source = g_timeout_add_seconds (CACHE_GC_TIMEOUT, cache_gc_source_callback, self);
}
GdkDisplay *
gsk_gpu_device_get_display (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
return priv->display;
}
gsize
gsk_gpu_device_get_max_image_size (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
return priv->max_image_size;
}
GskGpuImage *
gsk_gpu_device_create_offscreen_image (GskGpuDevice *self,
gboolean with_mipmap,
GdkMemoryDepth depth,
gsize width,
gsize height)
{
return GSK_GPU_DEVICE_GET_CLASS (self)->create_offscreen_image (self, with_mipmap, depth, width, height);
}
GskGpuImage *
gsk_gpu_device_create_upload_image (GskGpuDevice *self,
gboolean with_mipmap,
GdkMemoryFormat format,
gsize width,
gsize height)
{
return GSK_GPU_DEVICE_GET_CLASS (self)->create_upload_image (self, with_mipmap, format, width, height);
}
GskGpuImage *
gsk_gpu_device_create_download_image (GskGpuDevice *self,
GdkMemoryDepth depth,
gsize width,
gsize height)
{
return GSK_GPU_DEVICE_GET_CLASS (self)->create_download_image (self, depth, width, height);
}
static void
gsk_gpu_device_ensure_atlas (GskGpuDevice *self,
gboolean recreate,
@@ -576,20 +718,14 @@ gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
return NULL;
gsk_gpu_device_ensure_atlas (self, FALSE, timestamp);
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
{
gsk_gpu_cached_use (self, (GskGpuCached *) priv->current_atlas, timestamp);
return priv->current_atlas->image;
}
return priv->current_atlas->image;
gsk_gpu_device_ensure_atlas (self, TRUE, timestamp);
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
{
gsk_gpu_cached_use (self, (GskGpuCached *) priv->current_atlas, timestamp);
return priv->current_atlas->image;
}
return priv->current_atlas->image;
return NULL;
}
@@ -606,10 +742,8 @@ gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
if (cache == NULL)
cache = g_hash_table_lookup (priv->texture_cache, texture);
if (cache)
{
return g_object_ref (cache->image);
}
if (cache && cache->image)
return g_object_ref (cache->image);
return NULL;
}
@@ -639,10 +773,10 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GskGpuCachedGlyph lookup = {
.font = font,
.glyph = glyph,
.flags = flags,
.scale = scale
.key.font = font,
.key.glyph = glyph,
.key.flags = flags,
.key.scale = scale
};
GskGpuCachedGlyph *cache;
PangoRectangle ink_rect;
@@ -650,18 +784,35 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
graphene_point_t origin;
GskGpuImage *image;
gsize atlas_x, atlas_y, padding;
guint64 timestamp = gsk_gpu_frame_get_timestamp (frame);
guint front_index = glyph & 0xFF;
if (memcmp (&lookup.key, &priv->front[front_index], sizeof (GlyphKey)) == 0)
{
cache = priv->front[front_index].value;
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
*out_bounds = cache->bounds;
*out_origin = cache->origin;
return cache->image;
}
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
if (cache)
{
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
memcpy (&priv->front[front_index].key, &lookup.key, sizeof (GlyphKey));
priv->front[front_index].value = cache;
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
*out_bounds = cache->bounds;
*out_origin = cache->origin;
return cache->image;
}
cache = g_new (GskGpuCachedGlyph, 1);
pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
origin.x = floor (ink_rect.x * scale / PANGO_SCALE);
origin.y = floor (ink_rect.y * scale / PANGO_SCALE);
@@ -670,7 +821,7 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
padding = 1;
image = gsk_gpu_device_add_atlas_image (self,
gsk_gpu_frame_get_timestamp (frame),
timestamp,
rect.size.width + 2 * padding, rect.size.height + 2 * padding,
&atlas_x, &atlas_y);
if (image)
@@ -689,12 +840,13 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
cache = gsk_gpu_cached_new (self, &GSK_GPU_CACHED_GLYPH_CLASS, NULL);
}
cache->font = g_object_ref (font),
cache->glyph = glyph,
cache->flags = flags,
cache->scale = scale,
cache->key.font = g_object_ref (font),
cache->key.glyph = glyph,
cache->key.flags = flags,
cache->key.scale = scale,
cache->bounds = rect,
cache->image = image,
((GskGpuCached *) cache)->pixels = (rect.size.width + 2 * padding) * (rect.size.height + 2 * padding);
cache->origin = GRAPHENE_POINT_INIT (- origin.x + (flags & 3) / 4.f,
- origin.y + ((flags >> 2) & 3) / 4.f);
@@ -713,11 +865,16 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
cache->origin.y + padding));
g_hash_table_insert (priv->glyph_cache, cache, cache);
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
memcpy (&priv->front[front_index].key, &lookup.key, sizeof (GlyphKey));
priv->front[front_index].value = cache;
*out_bounds = cache->bounds;
*out_origin = cache->origin;
return cache->image;
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */

View File

@@ -1355,22 +1355,6 @@ gtk_at_context_get_text_accumulate (GtkATContext *self,
}
}
/* Step 2.G */
if (GTK_IS_LABEL (self->accessible))
{
const char *text = gtk_label_get_text (GTK_LABEL (self->accessible));
if (text && not_just_space (text))
append_with_space (res, text);
return;
}
else if (GTK_IS_INSCRIPTION (self->accessible))
{
const char *text = gtk_inscription_get_text (GTK_INSCRIPTION (self->accessible));
if (text && not_just_space (text))
append_with_space (res, text);
return;
}
/* Step 2.I */
if (GTK_IS_WIDGET (self->accessible))
{

View File

@@ -162,6 +162,45 @@
* ```
*/
typedef struct _WeakRefGuard WeakRefGuard;
struct _WeakRefGuard
{
gatomicrefcount ref_count;
gpointer data;
};
static WeakRefGuard *
weak_ref_guard_new (gpointer data)
{
WeakRefGuard *guard;
guard = g_new0 (WeakRefGuard, 1);
g_atomic_ref_count_init (&guard->ref_count);
guard->data = data;
return guard;
}
static WeakRefGuard *
weak_ref_guard_ref (WeakRefGuard *guard)
{
g_atomic_ref_count_inc (&guard->ref_count);
return guard;
}
static void
weak_ref_guard_unref (WeakRefGuard *guard)
{
/* Always clear data pointer after first unref so that it
* cannot be accessed unless both the expression/watch is
* valid _and_ the weak ref is still active.
*/
guard->data = NULL;
if (g_atomic_ref_count_dec (&guard->ref_count))
g_free (guard);
}
typedef struct _GtkExpressionClass GtkExpressionClass;
typedef struct _GtkExpressionSubWatch GtkExpressionSubWatch;
@@ -230,7 +269,8 @@ struct _GtkExpressionTypeInfo
struct _GtkExpressionWatch
{
GtkExpression *expression;
GObject *this;
WeakRefGuard *guard;
GWeakRef this_wr;
GDestroyNotify user_destroy;
GtkExpressionNotify notify;
gpointer user_data;
@@ -903,6 +943,7 @@ struct _GtkObjectExpression
{
GtkExpression parent;
WeakRefGuard *guard;
GWeakRef object_wr;
GSList *watches;
};
@@ -917,15 +958,22 @@ static void
gtk_object_expression_weak_ref_cb (gpointer data,
GObject *object)
{
GtkObjectExpression *self = (GtkObjectExpression *) data;
GSList *iter = self->watches;
WeakRefGuard *guard = data;
GtkObjectExpression *self = guard->data;
while (iter)
if (self != NULL)
{
GtkObjectExpressionWatch *owatch = iter->data;
iter = iter->next;
owatch->notify (owatch->user_data);
GSList *iter = self->watches;
while (iter)
{
GtkObjectExpressionWatch *owatch = iter->data;
iter = iter->next;
owatch->notify (owatch->user_data);
}
}
weak_ref_guard_unref (guard);
}
static void
@@ -938,10 +986,21 @@ gtk_object_expression_finalize (GtkExpression *expr)
if (object != NULL)
{
g_object_weak_unref (object, gtk_object_expression_weak_ref_cb, self);
g_object_weak_unref (object, gtk_object_expression_weak_ref_cb, self->guard);
weak_ref_guard_unref (self->guard);
g_object_unref (object);
}
else
{
/* @object has been disposed. Which means that either our
* gtk_object_expression_weak_ref_cb has been called or we
* can expect it to be called shortly after this. No need to
* call g_object_weak_unref() or unref the handle which will
* be unref'ed by that callback.
*/
}
g_clear_pointer (&self->guard, weak_ref_guard_unref);
g_weak_ref_clear (&self->object_wr);
g_assert (self->watches == NULL);
@@ -1041,10 +1100,14 @@ gtk_object_expression_new (GObject *object)
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
result = gtk_expression_alloc (GTK_TYPE_OBJECT_EXPRESSION, G_OBJECT_TYPE (object));
self = (GtkObjectExpression *) result;
self = (GtkObjectExpression *) result;
g_weak_ref_init (&self->object_wr, object);
g_object_weak_ref (object, gtk_object_expression_weak_ref_cb, self);
self->guard = weak_ref_guard_new (self);
g_object_weak_ref (object,
gtk_object_expression_weak_ref_cb,
weak_ref_guard_ref (self->guard));
return result;
}
@@ -1867,12 +1930,19 @@ static void
gtk_expression_watch_this_cb (gpointer data,
GObject *this)
{
GtkExpressionWatch *watch = data;
WeakRefGuard *guard = data;
GtkExpressionWatch *watch = guard->data;
watch->this = NULL;
if (watch != NULL)
{
g_weak_ref_set (&watch->this_wr, NULL);
watch->notify (watch->user_data);
gtk_expression_watch_unwatch (watch);
watch->notify (watch->user_data);
gtk_expression_watch_unwatch (watch);
}
weak_ref_guard_unref (guard);
}
static void
@@ -1926,9 +1996,12 @@ gtk_expression_watch (GtkExpression *self,
watch = g_atomic_rc_box_alloc0 (sizeof (GtkExpressionWatch) + gtk_expression_watch_size (self));
watch->expression = gtk_expression_ref (self);
watch->this = this_;
watch->guard = weak_ref_guard_new (watch);
g_weak_ref_init (&watch->this_wr, this_);
if (this_)
g_object_weak_ref (this_, gtk_expression_watch_this_cb, watch);
g_object_weak_ref (this_,
gtk_expression_watch_this_cb,
weak_ref_guard_ref (watch->guard));
watch->notify = notify;
watch->user_data = user_data;
watch->user_destroy = user_destroy;
@@ -1962,6 +2035,10 @@ gtk_expression_watch_finalize (gpointer data)
GtkExpressionWatch *watch G_GNUC_UNUSED = data;
g_assert (!gtk_expression_watch_is_watching (data));
weak_ref_guard_unref (watch->guard);
g_weak_ref_clear (&watch->this_wr);
}
/**
@@ -1991,17 +2068,27 @@ gtk_expression_watch_unref (GtkExpressionWatch *watch)
void
gtk_expression_watch_unwatch (GtkExpressionWatch *watch)
{
GObject *this;
if (!gtk_expression_watch_is_watching (watch))
return;
gtk_expression_subwatch_finish (watch->expression, (GtkExpressionSubWatch *) watch->sub);
if (watch->this)
g_object_weak_unref (watch->this, gtk_expression_watch_this_cb, watch);
this = g_weak_ref_get (&watch->this_wr);
if (this)
{
g_object_weak_unref (this, gtk_expression_watch_this_cb, watch->guard);
weak_ref_guard_unref (watch->guard);
g_weak_ref_set (&watch->this_wr, NULL);
}
if (watch->user_destroy)
watch->user_destroy (watch->user_data);
g_clear_object (&this);
g_clear_pointer (&watch->expression, gtk_expression_unref);
gtk_expression_watch_unref (watch);
@@ -2024,12 +2111,19 @@ gboolean
gtk_expression_watch_evaluate (GtkExpressionWatch *watch,
GValue *value)
{
GObject *this;
gboolean ret;
g_return_val_if_fail (watch != NULL, FALSE);
if (!gtk_expression_watch_is_watching (watch))
return FALSE;
return gtk_expression_evaluate (watch->expression, watch->this, value);
this = g_weak_ref_get (&watch->this_wr);
ret = gtk_expression_evaluate (watch->expression, this, value);
g_clear_object (&this);
return ret;
}
typedef struct {
@@ -2086,6 +2180,8 @@ gtk_expression_bind_free (gpointer data)
GtkExpressionBind *bind = data;
GObject *target = g_weak_ref_get (&bind->target_wr);
g_weak_ref_set (&bind->target_wr, NULL);
if (target)
{
GSList *binds;
@@ -2124,7 +2220,10 @@ gtk_expression_bind_notify (gpointer data)
return;
if (!gtk_expression_watch_evaluate (bind->watch, &value))
return;
{
g_object_unref (target);
return;
}
g_object_set_property (target, bind->pspec->name, &value);
g_object_unref (target);

View File

@@ -805,6 +805,11 @@ gtk_inscription_set_text (GtkInscription *self,
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL,
text,
-1);
}
/**

View File

@@ -3086,6 +3086,11 @@ gtk_label_set_label_internal (GtkLabel *self,
g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_LABEL]);
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
GTK_ACCESSIBLE_PROPERTY_LABEL,
self->label,
-1);
return TRUE;
}

View File

@@ -6991,9 +6991,10 @@ gtk_notebook_get_tab_detachable (GtkNotebook *notebook,
*
* If you want a widget to interact with a notebook through DnD
* (i.e.: accept dragged tabs from it) it must be set as a drop
* destination and accept the target “GTK_NOTEBOOK_TAB”. The notebook
* will fill the selection with a GtkWidget** pointing to the child
* widget that corresponds to the dropped tab.
* destination by adding to it a [class@Gtk.DropTarget] controller that accepts
* the GType `GTK_TYPE_NOTEBOOK_PAGE`. The `:value` of said drop target will be
* preloaded with a [class@Gtk.NotebookPage] object that corresponds to the
* dropped tab, so you can process the value via `::accept` or `::drop` signals.
*
* Note that you should use [method@Gtk.Notebook.detach_tab] instead
* of [method@Gtk.Notebook.remove_page] if you want to remove the tab

View File

@@ -38,6 +38,8 @@
#include "gdk/gdkdebugprivate.h"
#include "gdk/gdkdisplayprivate.h"
#include "profile_conf.h"
#include <epoxy/gl.h>
#ifdef GDK_WINDOWING_X11
@@ -193,7 +195,16 @@ init_version (GtkInspectorGeneral *gen)
g_object_unref (gsk_renderer);
gdk_surface_destroy (surface);
gtk_label_set_text (GTK_LABEL (gen->gtk_version), GTK_VERSION);
if (g_strcmp0 (PROFILE, "devel") == 0)
{
char *version = g_strdup_printf ("%s-%s", GTK_VERSION, VCS_TAG);
gtk_label_set_text (GTK_LABEL (gen->gtk_version), version);
g_free (version);
}
else
{
gtk_label_set_text (GTK_LABEL (gen->gtk_version), GTK_VERSION);
}
gtk_label_set_text (GTK_LABEL (gen->gdk_backend), backend);
gtk_label_set_text (GTK_LABEL (gen->gsk_renderer), renderer);
}

View File

@@ -67,6 +67,7 @@ struct _GtkInspectorLogs
GtkWidget *shaders;
GtkWidget *surface;
GtkWidget *glyphcache;
GtkWidget *verbose;
GtkWidget *actions;
GtkWidget *builder;
@@ -147,6 +148,7 @@ flag_toggled (GtkWidget *button,
update_flag (logs->shaders, &flags, GSK_DEBUG_SHADERS);
update_flag (logs->surface, &flags, GSK_DEBUG_SURFACE);
update_flag (logs->glyphcache, &flags, GSK_DEBUG_GLYPH_CACHE);
update_flag (logs->verbose, &flags, GSK_DEBUG_VERBOSE);
gsk_set_debug_flags (flags);
toplevels = gtk_window_list_toplevels ();
@@ -210,6 +212,7 @@ gtk_inspector_logs_class_init (GtkInspectorLogsClass *klass)
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, shaders);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, surface);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, glyphcache);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, verbose);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, actions);
gtk_widget_class_bind_template_child (widget_class, GtkInspectorLogs, builder);

View File

@@ -158,6 +158,12 @@
<signal name="toggled" handler="flag_toggled"/>
</object>
</child>
<child>
<object class="GtkCheckButton" id="verboe">
<property name="label">Verbose</property>
<signal name="toggled" handler="flag_toggled"/>
</object>
</child>
</object>
</child>
<child>

View File

@@ -1028,6 +1028,7 @@ gtk_deps = [
epoxy_dep,
libm,
graphene_dep,
profile_conf_h,
]
if x11_enabled

View File

@@ -785,6 +785,27 @@ project_build_root = meson.current_build_dir()
gen_visibility_macros = find_program('build-aux/meson/gen-visibility-macros.py')
gen_profile_conf = find_program('build-aux/meson/gen-profile-conf.py')
profile = get_option('profile')
if profile == 'auto'
if gtk_minor_version.is_even()
profile = 'default'
else
profile = 'devel'
endif
endif
profile_conf_h = declare_dependency(
sources: custom_target('profile-conf',
command: [gen_profile_conf, meson.project_source_root(), profile],
capture: true,
output: 'profile_conf.h',
build_by_default: true,
build_always_stale: true,
)
)
subdir('gdk/version')
subdir('gtk/css')
subdir('gdk')

View File

@@ -124,15 +124,15 @@ option('man-pages',
option('demo-profile',
type: 'combo',
choices: [ 'default', 'devel' ],
value: 'default',
description : 'Profile to use for demos')
choices: [ 'auto', 'default', 'devel' ],
value: 'auto',
deprecated: 'profile')
option('profile',
type: 'combo',
choices: [ 'default', 'devel' ],
value: 'default',
deprecated: 'demo-profile')
choices: [ 'auto', 'default', 'devel' ],
value: 'auto',
description : 'Profile to use for demos')
option('build-demos',
type: 'boolean',

273
po/fa.po
View File

@@ -6,14 +6,14 @@
# Mahyar Moghimi <mahyar.moqimi@gmail.com>, 2010.
# Ali Yousefi Sabzevar <aysabzevar@gmail.com>, 2010.
# Arash Mousavi <mousavi.arash@gmail.com>, 2011-2017.
# Danial Behzadi <dani.behzi@ubuntu.com>, 2018-2023.
# Danial Behzadi <dani.behzi@ubuntu.com>, 2018-2024.
#
msgid ""
msgstr ""
"Project-Id-Version: gtk+ 2.6\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
"POT-Creation-Date: 2023-11-27 21:52+0000\n"
"PO-Revision-Date: 2023-11-28 12:17+0330\n"
"POT-Creation-Date: 2024-01-20 11:14+0000\n"
"PO-Revision-Date: 2024-01-20 14:52+0330\n"
"Last-Translator: Danial Behzadi <dani.behzi@ubuntu.com>\n"
"Language-Team: Persian <>\n"
"Language: fa\n"
@@ -23,7 +23,7 @@ msgstr ""
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Poedit-Bookmarks: 133,-1,-1,-1,-1,-1,-1,-1,-1,-1\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Generator: Poedit 3.4.1\n"
"X-Generator: Poedit 3.4.2\n"
#: gdk/broadway/gdkbroadway-server.c:135
#, c-format
@@ -34,11 +34,11 @@ msgstr "نوع نمایشگر broadway پشتیبانی نمی‌شود: %s"
msgid "This clipboard cannot store data."
msgstr "این تخته‌گیره نمی‌تواند داده ذخیره کند."
#: gdk/gdkclipboard.c:287 gdk/gdkclipboard.c:785 gdk/gdkclipboard.c:1085
#: gdk/gdkclipboard.c:287 gdk/gdkclipboard.c:786 gdk/gdkclipboard.c:1086
msgid "Cannot read from empty clipboard."
msgstr "نمی‌توان از تخته‌گیرهٔ خالی خواند."
#: gdk/gdkclipboard.c:318 gdk/gdkclipboard.c:1135 gdk/gdkdrag.c:618
#: gdk/gdkclipboard.c:318 gdk/gdkclipboard.c:1136 gdk/gdkdrag.c:618
msgid "No compatible formats to transfer clipboard contents."
msgstr "هیچ قالب سازگاری برای انتقال محتویات تخته‌گیره وجود ندارد."
@@ -53,57 +53,57 @@ msgstr "نمی‌توان محتوا را به شکل «%s» فراهم کرد"
msgid "Cannot provide contents as %s"
msgstr "نمی‌توان محتوا را به شکل %s فراهم کرد"
#: gdk/gdkdisplay.c:169 gdk/gdkglcontext.c:455
#: gdk/gdkdisplay.c:170 gdk/gdkglcontext.c:462
msgid "The current backend does not support OpenGL"
msgstr "پسانه در حال حاضر از OpenGL پشتیبانی نمی‌کند"
#: gdk/gdkdisplay.c:1268 gdk/gdksurface.c:1268 gdk/gdkvulkancontext.c:1479
#: gdk/gdkdisplay.c:1296 gdk/gdkvulkancontext.c:1581
msgid "Vulkan support disabled via GDK_DEBUG"
msgstr "پشتیبانی از ولکان به دست GDK_DEBUG از کار افتاده"
#: gdk/gdkdisplay.c:1300
#: gdk/gdkdisplay.c:1350
msgid "GL support disabled via GDK_DEBUG"
msgstr "پشتیبانی از GL به دست GDK_DEBUG از کار افتاده"
#: gdk/gdkdisplay.c:1596
#: gdk/gdkdisplay.c:1646
msgid "No EGL configuration available"
msgstr "هیچ پیکربندی‌ای برای EGL موجود نیست"
#: gdk/gdkdisplay.c:1604
#: gdk/gdkdisplay.c:1654
msgid "Failed to get EGL configurations"
msgstr "شکست در گرفتن پیکربندی EGL"
#: gdk/gdkdisplay.c:1634
#: gdk/gdkdisplay.c:1684
msgid "No EGL configuration with required features found"
msgstr "هیچ پیکربندی‌ای با ویژگی‌های موردنیاز برای EGL موجود نیست"
#: gdk/gdkdisplay.c:1641
#: gdk/gdkdisplay.c:1691
msgid "No perfect EGL configuration found"
msgstr "هیچ پیکربندی بی‌نظیری برایEGL موجود نیست"
#: gdk/gdkdisplay.c:1683
#: gdk/gdkdisplay.c:1733
#, c-format
msgid "EGL implementation is missing extension %s"
msgid_plural "EGL implementation is missing %2$d extensions: %1$s"
msgstr[0] "پیاده سازی EGL %2$Id افزونه کم دارد: %1$s"
#: gdk/gdkdisplay.c:1733
#: gdk/gdkdisplay.c:1783
msgid "libEGL not available in this sandbox"
msgstr "libEGL در این قرنطینه موجود نیست"
#: gdk/gdkdisplay.c:1734
#: gdk/gdkdisplay.c:1784
msgid "libEGL not available"
msgstr "libEGL موجود نیست"
#: gdk/gdkdisplay.c:1744
#: gdk/gdkdisplay.c:1794
msgid "Failed to create EGL display"
msgstr "شکست در ایجاد نمایشگر EGL"
#: gdk/gdkdisplay.c:1754
#: gdk/gdkdisplay.c:1804
msgid "Could not initialize EGL display"
msgstr "نتوانست نمایشگر EGL را راه‌اندازی کند"
#: gdk/gdkdisplay.c:1765
#: gdk/gdkdisplay.c:1815
#, c-format
msgid "EGL version %d.%d is too old. GTK requires %d.%d"
msgstr "EGL نگارش %Id. %Id بیش از حد قدیمی است. GTK به %Id.%Id نیاز دارد"
@@ -116,37 +116,37 @@ msgstr "کشیدن و رها کردن از دیگر برنامه‌ها پشتی
msgid "No compatible formats to transfer contents."
msgstr "هیچ قالب سازگاری برای انتقال محتویات وجود ندارد."
#: gdk/gdkglcontext.c:415 gdk/x11/gdkglcontext-glx.c:642
#: gdk/gdkglcontext.c:422 gdk/x11/gdkglcontext-glx.c:642
msgid "No GL API allowed."
msgstr "هیچ رابط برنامه‌نویسی GLای مجاز نیست."
#: gdk/gdkglcontext.c:438 gdk/win32/gdkglcontext-win32-wgl.c:385
#: gdk/win32/gdkglcontext-win32-wgl.c:528 gdk/win32/gdkglcontext-win32-wgl.c:572
#: gdk/gdkglcontext.c:445 gdk/win32/gdkglcontext-win32-wgl.c:381
#: gdk/win32/gdkglcontext-win32-wgl.c:524 gdk/win32/gdkglcontext-win32-wgl.c:568
#: gdk/x11/gdkglcontext-glx.c:688
msgid "Unable to create a GL context"
msgstr "امکان ساخت زمینه مناسب برای GL نبود"
#: gdk/gdkglcontext.c:1299
#: gdk/gdkglcontext.c:1306
msgid "OpenGL ES disabled via GDK_DEBUG"
msgstr "OpenGL ES به دست GDK_DEBUG از کار افتاد"
#: gdk/gdkglcontext.c:1311
#: gdk/gdkglcontext.c:1318
msgid "OpenGL disabled via GDK_DEBUG"
msgstr "OpenGL به دست GDK_DEBUG از کار افتاد"
#: gdk/gdkglcontext.c:1322
#: gdk/gdkglcontext.c:1329
#, c-format
msgid "Application does not support %s API"
msgstr "برنامه از API مربوط به %s پشتبانی نمی‌کند"
#. translators: This is about OpenGL backend names, like
#. * "Trying to use X11 GLX, but EGL is already in use"
#: gdk/gdkglcontext.c:1979
#: gdk/gdkglcontext.c:2124
#, c-format
msgid "Trying to use %s, but %s is already in use"
msgstr "تلاش شد از %s استفاده شود، ولی %s از پیش در حال استفاده است"
#: gdk/gdktexture.c:530
#: gdk/gdktexture.c:580
msgid "Unknown image format."
msgstr "قالب تصویر ناشناخته."
@@ -537,7 +537,7 @@ msgstr "خطا در تفسیر پروندهٔ JPEG (%s)"
msgid "Unsupported JPEG colorspace (%d)"
msgstr "فضای رنگ JPEG پشتیبانی نشده (%Id)"
#: gdk/loaders/gdkjpeg.c:203 gdk/loaders/gdkpng.c:280 gdk/loaders/gdktiff.c:472
#: gdk/loaders/gdkjpeg.c:203 gdk/loaders/gdkpng.c:286 gdk/loaders/gdktiff.c:472
#, c-format
msgid "Not enough memory for image size %ux%u"
msgstr "حافظهٔ ناکافی برای اندازهٔ تصویر %Iu×%Iu"
@@ -547,16 +547,21 @@ msgstr "حافظهٔ ناکافی برای اندازهٔ تصویر %Iu×%Iu"
msgid "Error reading png (%s)"
msgstr "خطای خواندن png) %s)"
#: gdk/loaders/gdkpng.c:211
#: gdk/loaders/gdkpng.c:212
#, c-format
msgid "Unsupported depth %u in png image"
msgstr "عمق پشتیبانی‌نشدهٔ %Iu در تصویر png"
#: gdk/loaders/gdkpng.c:261
#: gdk/loaders/gdkpng.c:262
#, c-format
msgid "Unsupported color type %u in png image"
msgstr "گونهٔ رنگ پشتیبانی نشدهٔ %Iu در تصویر png"
#: gdk/loaders/gdkpng.c:272
#, c-format
msgid "Image stride too large for image size %ux%u"
msgstr "گام تصویر بیش از حد بزرگ برای اندازهٔ تصویر %Iu×%Iu"
#: gdk/loaders/gdktiff.c:358
msgid "Failed to load RGB data from TIFF file"
msgstr "نمی‌توان داده‌های RGB را از پروندهٔ TIFF بار کرد"
@@ -699,21 +704,21 @@ msgstr "IDataObject_GetData (0x%x) شکست خورد. 0x%lx را برگردان
msgid "Failed to transmute DnD data W32 format 0x%x to %p (%s)"
msgstr "شکست در تغییر شکل قالب W32 دادهٔ ک‌ور 0x%x به %p (%s)"
#: gdk/win32/gdkglcontext-win32-wgl.c:319
#: gdk/win32/gdkglcontext-win32-wgl.c:315
msgid "No GL implementation is available"
msgstr "هیچ پیاده سازی GLای پیدا نشد"
#: gdk/win32/gdkglcontext-win32-wgl.c:394
#: gdk/win32/gdkglcontext-win32-wgl.c:390
#, c-format
msgid "WGL version %d.%d is too low, need at least %d.%d"
msgstr "WGL نگارش %Id. %Id بیش از حد قدیمی است. کمینه به %Id.%Id نیاز است"
#: gdk/win32/gdkglcontext-win32-wgl.c:412
#: gdk/win32/gdkglcontext-win32-wgl.c:408
#, c-format
msgid "GL implementation cannot share GL contexts"
msgstr "پیاده‌سازی GL نمی‌تواند بافتارهای GL را هم‌رساند"
#: gdk/win32/gdkglcontext-win32-wgl.c:692
#: gdk/win32/gdkglcontext-win32-wgl.c:688
msgid "No available configurations for the given pixel format"
msgstr "هیچ پیکربندی برای قالب نقطه‌ای ارائه شده موجود نیست"
@@ -813,11 +818,16 @@ msgstr "قالب نامعتبر در تبدیل متن ترکیبی."
msgid "Unsupported encoding “%s”"
msgstr "رمزنگاری پشتیبانی‌نشدهٔ %s"
#: gsk/gl/gskglrenderer.c:135
#: gsk/gl/gskglrenderer.c:204
#, c-format
msgid "This GLES %d.%d implementation does not support half-float vertex data"
msgstr "این پشتیبانی EGL %Id.%Id از داده‌های رأس نیم‌شناور پیشتیبانی نمی‌کند"
#: gsk/gpu/gskgldevice.c:238
#, c-format
msgid "OpenGL ES 2.0 is not supported by this renderer."
msgstr "نگارش ۲٫۰ OpenGL ES به دست این پرداختگر پشتیبانی نمی‌شود."
#: gtk/a11y/gtkatspiaction.c:239
msgctxt "accessibility"
msgid "Click"
@@ -1014,7 +1024,7 @@ msgid "Invalid"
msgstr "نامعتبر"
#. This label is displayed in a treeview cell displaying an accelerator
#. * when the cell is clicked to change the acelerator.
#. * when the cell is clicked to change the accelerator.
#.
#: gtk/deprecated/gtkcellrendereraccel.c:436
#: gtk/deprecated/gtkcellrendereraccel.c:729
@@ -1193,35 +1203,39 @@ msgstr "نگارش ۲٫۰ پروانهٔ آپاچی"
msgid "Mozilla Public License 2.0"
msgstr "پروانهٔ عمومی موزیلا ۲٫۰"
#: gtk/gtkaboutdialog.c:963
#: gtk/gtkaboutdialog.c:137
msgid "BSD Zero-Clause License"
msgstr "پروانهٔ بی‌بند BSD"
#: gtk/gtkaboutdialog.c:964
msgid "Website"
msgstr "پایگاه وب"
#: gtk/gtkaboutdialog.c:999 gtk/ui/gtkapplication-quartz.ui:6
#: gtk/gtkaboutdialog.c:1000 gtk/ui/gtkapplication-quartz.ui:6
#, c-format
msgid "About %s"
msgstr "دربارهٔ %s"
#: gtk/gtkaboutdialog.c:2089
#: gtk/gtkaboutdialog.c:2090
msgid "Created by"
msgstr "ایجاد شده به دست"
#: gtk/gtkaboutdialog.c:2092
#: gtk/gtkaboutdialog.c:2093
msgid "Documented by"
msgstr "مستند شده به دست"
#: gtk/gtkaboutdialog.c:2102
#: gtk/gtkaboutdialog.c:2103
msgid "Translated by"
msgstr "بازگردانی به دست"
#: gtk/gtkaboutdialog.c:2107
#: gtk/gtkaboutdialog.c:2108
msgid "Design by"
msgstr "طرّاحی به دست"
#. Translators: this is the license preamble; the string at the end
#. * contains the name of the license as link text.
#.
#: gtk/gtkaboutdialog.c:2272
#: gtk/gtkaboutdialog.c:2273
#, c-format
msgid ""
"This program comes with absolutely no warranty.\n"
@@ -1714,6 +1728,16 @@ msgctxt "accessibility"
msgid "block quote"
msgstr "نقل‌قول مستقیم"
#: gtk/gtkaccessible.c:837
msgctxt "accessibility"
msgid "article"
msgstr "حرف تعریف"
#: gtk/gtkaccessible.c:838
msgctxt "accessibility"
msgid "comment"
msgstr "نظر"
#: gtk/gtkalertdialog.c:668 gtk/print/gtkcustompaperunixdialog.c:322
#: gtk/gtkmessagedialog.c:166 gtk/ui/gtkassistant.ui:40
msgid "_Close"
@@ -1723,7 +1747,7 @@ msgstr "_بستن"
#. * suspend or screen locking, and the caller hasn't specified
#. * a reason.
#.
#: gtk/gtkapplication-dbus.c:721
#: gtk/gtkapplication-dbus.c:721 gtk/gtkapplication-dbus.c:763
msgid "Reason not specified"
msgstr "دلیل مشخّص نشده"
@@ -2196,7 +2220,7 @@ msgstr "یک پرونده با همان نام در حال حاضر وجود د
#: gtk/gtkfiledialog.c:843 gtk/gtkmessagedialog.c:170 gtk/gtkmessagedialog.c:179
#: gtk/gtkmountoperation.c:608 gtk/print/gtkpagesetupunixdialog.c:282
#: gtk/print/gtkprintbackend.c:638 gtk/print/gtkprintunixdialog.c:682
#: gtk/print/gtkprintunixdialog.c:839 gtk/gtkwindow.c:6234
#: gtk/print/gtkprintunixdialog.c:839 gtk/gtkwindow.c:6253
#: gtk/ui/gtkappchooserdialog.ui:48 gtk/ui/gtkassistant.ui:52
#: gtk/ui/gtkcolorchooserdialog.ui:36 gtk/ui/gtkfontchooserdialog.ui:27
msgid "_Cancel"
@@ -2284,7 +2308,7 @@ msgid "If you delete an item, it will be permanently lost."
msgstr "اگر موردی را پاک کنید، برای همیشه از دست خواهد رفت."
#: gtk/gtkfilechooserwidget.c:1183 gtk/gtkfilechooserwidget.c:1781
#: gtk/gtklabel.c:5695 gtk/gtktext.c:6147 gtk/gtktextview.c:9018
#: gtk/gtklabel.c:5702 gtk/gtktext.c:6147 gtk/gtktextview.c:9018
msgid "_Delete"
msgstr "_حذف"
@@ -2609,7 +2633,7 @@ msgstr "دگرگونه‌های سبک"
msgid "Character Variations"
msgstr "دگرگونه‌های نویسه"
#: gtk/gtkglarea.c:305
#: gtk/gtkglarea.c:309
msgid "OpenGL context creation failed"
msgstr "ساخت زمینه OpenGL شکست خورد"
@@ -2622,31 +2646,31 @@ msgstr "بستن"
msgid "Close the infobar"
msgstr "بستن نوار اطّلاعات"
#: gtk/gtklabel.c:5692 gtk/gtktext.c:6135 gtk/gtktextview.c:9006
#: gtk/gtklabel.c:5699 gtk/gtktext.c:6135 gtk/gtktextview.c:9006
msgid "Cu_t"
msgstr "_برش"
#: gtk/gtklabel.c:5693 gtk/gtktext.c:6139 gtk/gtktextview.c:9010
#: gtk/gtklabel.c:5700 gtk/gtktext.c:6139 gtk/gtktextview.c:9010
msgid "_Copy"
msgstr "_رونوشت"
#: gtk/gtklabel.c:5694 gtk/gtktext.c:6143 gtk/gtktextview.c:9014
#: gtk/gtklabel.c:5701 gtk/gtktext.c:6143 gtk/gtktextview.c:9014
msgid "_Paste"
msgstr "_چسباندن"
#: gtk/gtklabel.c:5700 gtk/gtktext.c:6156 gtk/gtktextview.c:9039
#: gtk/gtklabel.c:5707 gtk/gtktext.c:6156 gtk/gtktextview.c:9039
msgid "Select _All"
msgstr "انتخاب _همه"
#: gtk/gtklabel.c:5705
#: gtk/gtklabel.c:5712
msgid "_Open Link"
msgstr "_گشودن پیوند"
#: gtk/gtklabel.c:5709
#: gtk/gtklabel.c:5716
msgid "Copy _Link Address"
msgstr "_رونوشت از نشانی پیوند"
#: gtk/gtklabel.c:5753 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
#: gtk/gtklabel.c:5760 gtk/gtktext.c:2716 gtk/gtktextview.c:9088
msgid "Context menu"
msgstr "فهرست بافتاری"
@@ -2717,7 +2741,7 @@ msgid "Play"
msgstr "پخش"
#: gtk/gtkmessagedialog.c:162 gtk/gtkmessagedialog.c:180
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6235
#: gtk/print/gtkprintbackend.c:639 gtk/gtkwindow.c:6254
msgid "_OK"
msgstr "_تأیید"
@@ -3542,7 +3566,7 @@ msgstr "کشیدن به راست"
#. Translators: This is placeholder text for the search entry in the shortcuts window
#: gtk/gtkshortcutswindow.c:879 gtk/gtkshortcutswindow.c:946
#: gtk/gtkshortcutswindow.c:951
#: gtk/gtkshortcutswindow.c:952
msgid "Search Shortcuts"
msgstr "جست‌وجوی میان‌برها"
@@ -3556,12 +3580,12 @@ msgstr "میان‌برها"
msgid "Search Results"
msgstr "نتایج جست‌وجو"
#: gtk/gtkshortcutswindow.c:1013 gtk/ui/gtkemojichooser.ui:349
#: gtk/gtkshortcutswindow.c:1014 gtk/ui/gtkemojichooser.ui:349
#: gtk/ui/gtkfilechooserwidget.ui:239
msgid "No Results Found"
msgstr "هیچ نتیجه‌ای پیدا نشد"
#: gtk/gtkshortcutswindow.c:1024 gtk/ui/gtkemojichooser.ui:362
#: gtk/gtkshortcutswindow.c:1025 gtk/ui/gtkemojichooser.ui:362
#: gtk/ui/gtkfilechooserwidget.ui:252 gtk/ui/gtkplacesview.ui:218
msgid "Try a different search"
msgstr "جست‌وجو دیگری را امتحان کنید"
@@ -3583,12 +3607,12 @@ msgstr "بر_گردان"
msgid "_Redo"
msgstr "_انجام دوباره"
#: gtk/gtkwindow.c:6223
#: gtk/gtkwindow.c:6242
#, c-format
msgid "Do you want to use GTK Inspector?"
msgstr "می‌خواهید از بازرس +GTK استفاده کنید؟"
#: gtk/gtkwindow.c:6225
#: gtk/gtkwindow.c:6244
#, c-format
msgid ""
"GTK Inspector is an interactive debugger that lets you explore and modify the "
@@ -3598,7 +3622,7 @@ msgstr ""
"بازرس +GTK یک بازرس تعاملی است که به شما اجازه پیمایش و تغییر هسته برنامه‌های +GTK "
"را می‌دهد. استفاده از آن ممکن است باعث شود که برنامه‌ها قفل کنند یا از هم بپاشند."
#: gtk/gtkwindow.c:6230
#: gtk/gtkwindow.c:6249
msgid "Dont show this message again"
msgstr "این پیام را دوباره نشان نده"
@@ -3777,39 +3801,39 @@ msgid "CSS Property"
msgstr "مشخصه CSS"
# farmaan
#: gtk/inspector/general.c:349
#: gtk/inspector/general.c:363
msgctxt "GL version"
msgid "None"
msgstr "هیچ‌کدام"
#: gtk/inspector/general.c:426
#: gtk/inspector/general.c:441
msgctxt "GL version"
msgid "Unknown"
msgstr "ناشناخته"
#: gtk/inspector/general.c:491
#: gtk/inspector/general.c:503
msgctxt "Vulkan device"
msgid "Disabled"
msgstr "از کار افتاده"
#: gtk/inspector/general.c:492 gtk/inspector/general.c:493
#: gtk/inspector/general.c:504 gtk/inspector/general.c:505
msgctxt "Vulkan version"
msgid "Disabled"
msgstr "از کار افتاده"
# farmaan
#: gtk/inspector/general.c:549
#: gtk/inspector/general.c:555
msgctxt "Vulkan device"
msgid "None"
msgstr "هیچ‌کدام"
# farmaan
#: gtk/inspector/general.c:550 gtk/inspector/general.c:551
#: gtk/inspector/general.c:556 gtk/inspector/general.c:557
msgctxt "Vulkan version"
msgid "None"
msgstr "هیچ‌کدام"
#: gtk/inspector/general.c:882
#: gtk/inspector/general.c:895
msgid "IM Context is hardcoded by GTK_IM_MODULE"
msgstr "بافتار IM به دست GTK_IM_MODULE به صورت سخت رمز شده است"
@@ -3861,43 +3885,51 @@ msgstr "RGBA بصری"
msgid "Composited"
msgstr "مرکب"
#: gtk/inspector/general.ui:559
#: gtk/inspector/general.ui:538
msgid "Protocols"
msgstr "شیوه‌نامه‌ها"
#: gtk/inspector/general.ui:594
msgid "GL Version"
msgstr "نسخهٔ GL"
#: gtk/inspector/general.ui:586
#: gtk/inspector/general.ui:621
msgid "GL Backend Version"
msgstr "نگارش پسانهٔ GL"
#: gtk/inspector/general.ui:636
#: gtk/inspector/general.ui:671
msgid "GL Backend Vendor"
msgstr "سازندهٔ پسانهٔ GL"
#: gtk/inspector/general.ui:663
#: gtk/inspector/general.ui:698
msgid "GL_VENDOR"
msgstr "GL_VENDOR"
#: gtk/inspector/general.ui:692
#: gtk/inspector/general.ui:727
msgid "GL_RENDERER"
msgstr "GL_RENDERER"
#: gtk/inspector/general.ui:721
#: gtk/inspector/general.ui:756
msgid "GL_VERSION"
msgstr "GL_VERSION"
#: gtk/inspector/general.ui:750
#: gtk/inspector/general.ui:785
msgid "GL_SHADING_LANGUAGE_VERSION"
msgstr "GL_SHADING_LANGUAGE_VERSION"
#: gtk/inspector/general.ui:789
#: gtk/inspector/general.ui:813 gtk/inspector/general.ui:929
msgid "Extensions"
msgstr "افزونه‌ها"
#: gtk/inspector/general.ui:849
msgid "Vulkan Device"
msgstr "افزارهٔ ولکان"
#: gtk/inspector/general.ui:816
#: gtk/inspector/general.ui:876
msgid "Vulkan API version"
msgstr "نگارش API ولکان"
#: gtk/inspector/general.ui:843
#: gtk/inspector/general.ui:903
msgid "Vulkan driver version"
msgstr "نگارش راه‌انداز ولکان"
@@ -4315,49 +4347,52 @@ msgstr "نمایش آهنگ قاب"
msgid "Show Graphic Updates"
msgstr "نمایش بروزرسانی‌های گرافیکی"
#: gtk/inspector/visual.ui:435
msgid "Show Fallback Rendering"
msgstr "نمایش پرداخت جایگزین"
#: gtk/inspector/visual.ui:430
msgid ""
"Tints all the places where the current renderer uses Cairo instead of the GPU."
msgstr "تیره کردن تمام جاهایی که پرداختگر کنونی به جای GPU از کایرو استفاده می‌کند."
#: gtk/inspector/visual.ui:460
#: gtk/inspector/visual.ui:436
msgid "Show Cairo Rendering"
msgstr "نمایش پرداخت کایرو"
#: gtk/inspector/visual.ui:461
msgid "Show Baselines"
msgstr "نمایش مبناها"
#: gtk/inspector/visual.ui:488
#: gtk/inspector/visual.ui:489
msgid "Show Layout Borders"
msgstr "نمایش حاشیه‌های چیدمان"
#: gtk/inspector/visual.ui:545
#: gtk/inspector/visual.ui:546
msgid "CSS Padding"
msgstr "فاصله‌دهی CSS"
#: gtk/inspector/visual.ui:555
#: gtk/inspector/visual.ui:556
msgid "CSS Border"
msgstr "لبهٔ CSS"
#: gtk/inspector/visual.ui:565
#: gtk/inspector/visual.ui:566
msgid "CSS Margin"
msgstr "حاشیهٔ CSS"
#: gtk/inspector/visual.ui:575
#: gtk/inspector/visual.ui:576
msgid "Widget Margin"
msgstr "حاشیهٔ ابزارک"
#: gtk/inspector/visual.ui:610
#: gtk/inspector/visual.ui:611
msgid "Show Focus"
msgstr "نمایش تمرکز"
#: gtk/inspector/visual.ui:635
#: gtk/inspector/visual.ui:636
msgid "Show Accessibility warnings"
msgstr "شنمایش هشدارهای دسترسی‌پذیری"
#: gtk/inspector/visual.ui:660
#, fuzzy
#| msgid "Show Graphic Updates"
#: gtk/inspector/visual.ui:661
msgid "Show Graphics Offload"
msgstr "نمایش بروزرسانی‌های گرافیکی"
msgstr "نمایش تخلیهٔ گرافیکی"
#: gtk/inspector/visual.ui:692
#: gtk/inspector/visual.ui:693
msgid "Inspect Inspector"
msgstr "بازرسی بازرس"
@@ -7187,7 +7222,7 @@ msgid "Use style from CSS file"
msgstr "استفادهٔ سبک از پروندهٔ CSS"
#: tools/gtk-builder-tool-preview.c:187 tools/gtk-builder-tool-screenshot.c:370
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-render.c:204
#: tools/gtk-builder-tool-validate.c:268 tools/gtk-rendernode-tool-render.c:203
#: tools/gtk-rendernode-tool-show.c:113
#, c-format
msgid "Could not initialize windowing system\n"
@@ -7232,12 +7267,12 @@ msgstr ""
"پروندهٔ %s موجود است.\n"
"برای پایکالی از --force استفاده کنید.\n"
#: tools/gtk-builder-tool-screenshot.c:332 tools/gtk-rendernode-tool-render.c:172
#: tools/gtk-builder-tool-screenshot.c:332 tools/gtk-rendernode-tool-render.c:171
#, c-format
msgid "Output written to %s.\n"
msgstr "خروجی در %s نوشته شد.\n"
#: tools/gtk-builder-tool-screenshot.c:336 tools/gtk-rendernode-tool-render.c:176
#: tools/gtk-builder-tool-screenshot.c:336 tools/gtk-rendernode-tool-render.c:175
#, c-format
msgid "Failed to save %s: %s\n"
msgstr "شکست در ذخیرهٔ %s: %s\n"
@@ -7254,7 +7289,7 @@ msgstr "ذخیره به شکل پروندهٔ گره به‌جای png"
msgid "Overwrite existing file"
msgstr "رونویسی پروندهٔ موجود"
#: tools/gtk-builder-tool-screenshot.c:363 tools/gtk-rendernode-tool-render.c:197
#: tools/gtk-builder-tool-screenshot.c:363 tools/gtk-rendernode-tool-render.c:196
msgid "FILE…"
msgstr "پرونده…"
@@ -7452,10 +7487,8 @@ msgid "Allow cubic Bézier curves"
msgstr "اجازه به منحی‌های درجه سوم بزیه"
#: tools/gtk-path-tool-decompose.c:86
#, fuzzy
#| msgid "Allow cubic Bézier curves"
msgid "Allow conic Bézier curves"
msgstr "اجازه به منحی‌های درجه سوم بزیه"
msgstr "اجازه به منحی‌های مخروطی بزیه"
#: tools/gtk-path-tool-decompose.c:87 tools/gtk-path-tool-info.c:88
#: tools/gtk-path-tool-render.c:125 tools/gtk-path-tool-restrict.c:38
@@ -7519,10 +7552,9 @@ msgid "%d cubics"
msgstr "%Id درجه سوم"
#: tools/gtk-path-tool-info.c:159
#, fuzzy, c-format
#| msgid "%d cubics"
#, c-format
msgid "%d conics"
msgstr "%Id درجه سوم"
msgstr "%Id مخروطی"
#: tools/gtk-path-tool-render.c:117 tools/gtk-path-tool-show.c:140
msgid "Fill the path (the default)"
@@ -7729,23 +7761,23 @@ msgid ""
"Perform various tasks on GTK render nodes.\n"
"\n"
"Commands:\n"
" benchmark Benchmark rendering of a node\n"
" info Provide information about the node\n"
" show Show the node\n"
" render Take a screenshot of the node\n"
"\n"
msgstr ""
"استفاده:\n"
" gtk4-builder-tool [دستور] [‫گزینه…‬] FILE\n"
" gtk4-rendermode-tool [دستور] [‫گزینه…‬] پرونده‬\n"
"\n"
"انجام وظایف مختلف روی پرونده‌های .ui مربوط به GtkBuilder.\n"
"انجام وظایف مختلف روی گره‌های پرداخت GTK\n"
"\n"
"دستورها:\n"
" validate تصدیق پرونده\n"
" simplify ساده سازی پرونده\n"
" enumerate فهرست کردن تمام اشیای نام‌دار\n"
" preview پیش‌نمایش پرونده\n"
"\n"
" screenshot نماگرفت از پرونده\n"
" benchmark محک پرداخت یک گره\n"
" info فراهم کردن اطَلاعات دربارهٔ گره\n"
" show نمایش گره\n"
" render نماگرفت از گره\n"
"\n"
#: tools/gtk-rendernode-tool-info.c:191
@@ -7772,7 +7804,7 @@ msgstr "خاستگاه: %g × %g\n"
msgid "Provide information about the render node."
msgstr "اطّلاعاتی دربارهٔ گره پرداختگر فراهم می‌کند."
#: tools/gtk-rendernode-tool-info.c:236 tools/gtk-rendernode-tool-render.c:225
#: tools/gtk-rendernode-tool-info.c:236 tools/gtk-rendernode-tool-render.c:224
#: tools/gtk-rendernode-tool-show.c:134
#, c-format
msgid "No .node file specified\n"
@@ -7797,19 +7829,24 @@ msgstr ""
msgid "Failed to generate SVG: %s\n"
msgstr "شکست در ایجاد SVG: %s\n"
#: tools/gtk-rendernode-tool-render.c:196
#: tools/gtk-rendernode-tool-render.c:150
#, c-format
msgid "Failed to create renderer: %s\n"
msgstr "شکست در ایجاد پرداختگر: %s\n"
#: tools/gtk-rendernode-tool-render.c:195
msgid "Renderer to use"
msgstr "پرداختگر مورد استفاده"
#: tools/gtk-rendernode-tool-render.c:196
#: tools/gtk-rendernode-tool-render.c:195
msgid "RENDERER"
msgstr "RENDERER"
#: tools/gtk-rendernode-tool-render.c:212
#: tools/gtk-rendernode-tool-render.c:211
msgid "Render a .node file to an image."
msgstr "پرداخت یک پروندهٔ .node در یک تصویر."
#: tools/gtk-rendernode-tool-render.c:231
#: tools/gtk-rendernode-tool-render.c:230
#, c-format
msgid "Can only render a single .node file to a single output file\n"
msgstr "تنها می‌تواند یک تک‌پروندهٔ .noide را در یک پروندهٔ خروحی پرداخت کند\n"
@@ -7827,12 +7864,12 @@ msgstr "نمایش گره پرداختگر."
msgid "Can only preview a single .node file\n"
msgstr "تنها می‌تواند یک تک‌پروندهٔ .node را پیش‌نمایش دهد\n"
#: tools/gtk-rendernode-tool-utils.c:51
#: tools/gtk-rendernode-tool-utils.c:54
#, c-format
msgid "Error at %s: %s\n"
msgstr "خطا در %s: %s\n"
#: tools/gtk-rendernode-tool-utils.c:69
#: tools/gtk-rendernode-tool-utils.c:72
#, c-format
msgid "Failed to load node file: %s\n"
msgstr "شکست در بار کردن پروندهٔ گره: %s\n"