1
0
Fork 0

core/util: Drop duplicated MetaLocaleDirection

Clutter has an enum for that already, just use it instead of mapping between the types

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3962>
This commit is contained in:
Bilal Elmoussaoui 2024-08-20 17:20:35 +02:00 committed by Marge Bot
parent 4f606261d3
commit 5176a828eb
6 changed files with 7 additions and 31 deletions

View file

@ -2111,7 +2111,7 @@ handle_activate_window_menu (MetaDisplay *display,
meta_window_get_client_area_rect (display->focus_window, &child_rect);
x = frame_rect.x + child_rect.x;
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
if (clutter_get_text_direction () == CLUTTER_TEXT_DIRECTION_RTL)
x += child_rect.width;
y = frame_rect.y + child_rect.y;

View file

@ -133,7 +133,7 @@ find_next_cascade (MetaWindow *window,
int cascade_stage;
MtkRectangle work_area;
MetaLogicalMonitor *current;
gboolean ltr = meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR;
gboolean ltr = clutter_get_text_direction () == CLUTTER_TEXT_DIRECTION_LTR;
/* This is a "fuzzy" cascade algorithm.
* For each window in the list, we find where we'd cascade a
@ -541,7 +541,7 @@ center_tile_rect_in_area (MtkRectangle *rect,
*/
fluff = (work_area->width % (rect->width + 1)) / 2;
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR)
if (clutter_get_text_direction () == CLUTTER_TEXT_DIRECTION_LTR)
rect->x = work_area->x + fluff;
else
rect->x = work_area->x + work_area->width - rect->width - fluff;
@ -580,7 +580,7 @@ find_first_fit (MetaWindow *window,
GList *tmp;
MtkRectangle rect;
MtkRectangle work_area;
gboolean ltr = meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR;
gboolean ltr = clutter_get_text_direction () == CLUTTER_TEXT_DIRECTION_LTR;
retval = FALSE;

View file

@ -1420,7 +1420,7 @@ button_layout_handler (GVariant *value,
g_strfreev (sides);
/* Invert the button layout for RTL languages */
if (meta_get_locale_direction() == META_LOCALE_DIRECTION_RTL)
if (clutter_get_text_direction() == CLUTTER_TEXT_DIRECTION_RTL)
{
MetaButtonLayout rtl_layout;
int j;

View file

@ -512,21 +512,6 @@ meta_external_binding_name_for_action (guint keybinding_action)
return g_strdup_printf ("external-grab-%u", keybinding_action);
}
MetaLocaleDirection
meta_get_locale_direction (void)
{
switch (clutter_get_text_direction ())
{
case CLUTTER_TEXT_DIRECTION_LTR:
return META_LOCALE_DIRECTION_LTR;
case CLUTTER_TEXT_DIRECTION_RTL:
return META_LOCALE_DIRECTION_RTL;
default:
g_assert_not_reached ();
return 0;
}
}
char *
meta_generate_random_id (GRand *rand,
int length)

View file

@ -625,7 +625,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
meta_workspace_manager_calc_workspace_layout (workspace->manager, num_workspaces,
new_space, &layout2);
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
if (clutter_get_text_direction () == CLUTTER_TEXT_DIRECTION_RTL)
{
if (layout1.current_col > layout2.current_col)
direction = META_MOTION_RIGHT;
@ -1264,7 +1264,7 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
meta_verbose ("Getting neighbor of %d in direction %s",
current_space, meta_motion_direction_to_string (direction));
ltr = (meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR);
ltr = (clutter_get_text_direction () == CLUTTER_TEXT_DIRECTION_LTR);
switch (direction)
{

View file

@ -93,15 +93,6 @@ char* meta_external_binding_name_for_action (guint keybinding_action);
META_EXPORT
char* meta_g_utf8_strndup (const gchar *src, gsize n);
typedef enum
{
META_LOCALE_DIRECTION_LTR,
META_LOCALE_DIRECTION_RTL,
} MetaLocaleDirection;
META_EXPORT
MetaLocaleDirection meta_get_locale_direction (void);
META_EXPORT
void meta_add_clutter_debug_flags (ClutterDebugFlag debug_flags,
ClutterDrawDebugFlag draw_flags,