mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter: Add fribidi dependency and copy deprecated pango functions
Pango functions pango_unichar_direction() and pango_find_base_dir() have been deprecated in pango 1.44, since these are used mostly clutter and gtk, copy the code from pango and use fribidi dependency explicitly. This is the same strategy used by Gtk. https://gitlab.gnome.org/GNOME/mutter/merge_requests/583
This commit is contained in:
parent
45244852ac
commit
7a6c755833
@ -303,6 +303,11 @@ gboolean _clutter_util_matrix_decompose (const ClutterMatrix *src,
|
|||||||
ClutterVertex *translate_p,
|
ClutterVertex *translate_p,
|
||||||
ClutterVertex4 *perspective_p);
|
ClutterVertex4 *perspective_p);
|
||||||
|
|
||||||
|
PangoDirection _clutter_pango_unichar_direction (gunichar ch);
|
||||||
|
|
||||||
|
PangoDirection _clutter_pango_find_base_dir (const gchar *text,
|
||||||
|
gint length);
|
||||||
|
|
||||||
typedef struct _ClutterPlane
|
typedef struct _ClutterPlane
|
||||||
{
|
{
|
||||||
float v0[3];
|
float v0[3];
|
||||||
|
@ -751,7 +751,7 @@ clutter_text_create_layout_no_cache (ClutterText *text,
|
|||||||
if (priv->password_char != 0)
|
if (priv->password_char != 0)
|
||||||
pango_dir = PANGO_DIRECTION_NEUTRAL;
|
pango_dir = PANGO_DIRECTION_NEUTRAL;
|
||||||
else
|
else
|
||||||
pango_dir = pango_find_base_dir (contents, contents_len);
|
pango_dir = _clutter_pango_find_base_dir (contents, contents_len);
|
||||||
|
|
||||||
if (pango_dir == PANGO_DIRECTION_NEUTRAL)
|
if (pango_dir == PANGO_DIRECTION_NEUTRAL)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "clutter-build-config.h"
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
|
#include <fribidi.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
@ -696,3 +697,45 @@ clutter_interval_register_progress_func (GType value_type,
|
|||||||
|
|
||||||
G_UNLOCK (progress_funcs);
|
G_UNLOCK (progress_funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PangoDirection
|
||||||
|
_clutter_pango_unichar_direction (gunichar ch)
|
||||||
|
{
|
||||||
|
FriBidiCharType fribidi_ch_type;
|
||||||
|
|
||||||
|
G_STATIC_ASSERT (sizeof (FriBidiChar) == sizeof (gunichar));
|
||||||
|
|
||||||
|
fribidi_ch_type = fribidi_get_bidi_type (ch);
|
||||||
|
|
||||||
|
if (!FRIBIDI_IS_STRONG (fribidi_ch_type))
|
||||||
|
return PANGO_DIRECTION_NEUTRAL;
|
||||||
|
else if (FRIBIDI_IS_RTL (fribidi_ch_type))
|
||||||
|
return PANGO_DIRECTION_RTL;
|
||||||
|
else
|
||||||
|
return PANGO_DIRECTION_LTR;
|
||||||
|
}
|
||||||
|
|
||||||
|
PangoDirection
|
||||||
|
_clutter_pango_find_base_dir (const gchar *text,
|
||||||
|
gint length)
|
||||||
|
{
|
||||||
|
PangoDirection dir = PANGO_DIRECTION_NEUTRAL;
|
||||||
|
const gchar *p;
|
||||||
|
|
||||||
|
g_return_val_if_fail (text != NULL || length == 0, PANGO_DIRECTION_NEUTRAL);
|
||||||
|
|
||||||
|
p = text;
|
||||||
|
while ((length < 0 || p < text + length) && *p)
|
||||||
|
{
|
||||||
|
gunichar wc = g_utf8_get_char (p);
|
||||||
|
|
||||||
|
dir = _clutter_pango_unichar_direction (wc);
|
||||||
|
|
||||||
|
if (dir != PANGO_DIRECTION_NEUTRAL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
p = g_utf8_next_char (p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
@ -250,7 +250,8 @@ get_direction (XkbDescPtr xkb,
|
|||||||
{
|
{
|
||||||
int level = 0;
|
int level = 0;
|
||||||
KeySym sym = XkbKeySymEntry (xkb, code, level, group);
|
KeySym sym = XkbKeySymEntry (xkb, code, level, group);
|
||||||
PangoDirection dir = pango_unichar_direction (clutter_keysym_to_unicode (sym));
|
PangoDirection dir =
|
||||||
|
_clutter_pango_unichar_direction (clutter_keysym_to_unicode (sym));
|
||||||
|
|
||||||
switch (dir)
|
switch (dir)
|
||||||
{
|
{
|
||||||
|
@ -38,6 +38,7 @@ clutter_pkg_deps = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
clutter_pkg_private_deps = [
|
clutter_pkg_private_deps = [
|
||||||
|
fribidi_dep,
|
||||||
gdk_pixbuf_dep,
|
gdk_pixbuf_dep,
|
||||||
gthread_dep,
|
gthread_dep,
|
||||||
gmodule_no_export_dep,
|
gmodule_no_export_dep,
|
||||||
|
@ -9,6 +9,7 @@ mutter_plugin_api_version = '3'
|
|||||||
libmutter_api_version = '4'
|
libmutter_api_version = '4'
|
||||||
|
|
||||||
# generic version requirements
|
# generic version requirements
|
||||||
|
fribidi_req = '>= 1.0.0'
|
||||||
glib_req = '>= 2.53.2'
|
glib_req = '>= 2.53.2'
|
||||||
gi_req = '>= 0.9.5'
|
gi_req = '>= 0.9.5'
|
||||||
gtk3_req = '>= 3.19.8'
|
gtk3_req = '>= 3.19.8'
|
||||||
@ -86,6 +87,7 @@ pango_dep = dependency('pango', version: pango_req)
|
|||||||
cairo_dep = dependency('cairo', version: cairo_req)
|
cairo_dep = dependency('cairo', version: cairo_req)
|
||||||
cairo_gobject_dep = dependency('cairo-gobject', version: cairo_req)
|
cairo_gobject_dep = dependency('cairo-gobject', version: cairo_req)
|
||||||
pangocairo_dep = dependency('pangocairo', version: pangocairo_req)
|
pangocairo_dep = dependency('pangocairo', version: pangocairo_req)
|
||||||
|
fribidi_dep = dependency('fribidi', version: fribidi_req)
|
||||||
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas',
|
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas',
|
||||||
version: gsettings_desktop_schemas_req)
|
version: gsettings_desktop_schemas_req)
|
||||||
glib_dep = dependency('glib-2.0', version: glib_req)
|
glib_dep = dependency('glib-2.0', version: glib_req)
|
||||||
|
Loading…
Reference in New Issue
Block a user