mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
util: Move the text direction stuff out of MetaUI
GTK+ doesn't need to be initialized to get locale direction, which means we can do this without bringing up MetaUI at all.
This commit is contained in:
@ -2900,7 +2900,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_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
|
||||
x += child_rect.width;
|
||||
|
||||
y = frame_rect.y + child_rect.y;
|
||||
|
@ -1697,7 +1697,7 @@ button_layout_handler (GVariant *value,
|
||||
g_strfreev (sides);
|
||||
|
||||
/* Invert the button layout for RTL languages */
|
||||
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||
if (meta_get_locale_direction() == META_LOCALE_DIRECTION_RTL)
|
||||
{
|
||||
MetaButtonLayout rtl_layout;
|
||||
int j;
|
||||
|
@ -946,5 +946,19 @@ meta_later_remove (guint later_id)
|
||||
}
|
||||
}
|
||||
|
||||
MetaLocaleDirection
|
||||
meta_get_locale_direction (void)
|
||||
{
|
||||
switch (gtk_get_locale_direction ())
|
||||
{
|
||||
case GTK_TEXT_DIR_LTR:
|
||||
return META_LOCALE_DIRECTION_LTR;
|
||||
case GTK_TEXT_DIR_RTL:
|
||||
return META_LOCALE_DIRECTION_RTL;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
/* eof util.c */
|
||||
|
||||
|
@ -524,7 +524,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
|
||||
meta_screen_calc_workspace_layout (workspace->screen, num_workspaces,
|
||||
new_space, &layout2);
|
||||
|
||||
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
||||
if (meta_get_locale_direction () == META_LOCALE_DIRECTION_RTL)
|
||||
{
|
||||
if (layout1.current_col > layout2.current_col)
|
||||
direction = META_MOTION_RIGHT;
|
||||
@ -1087,7 +1087,7 @@ meta_workspace_get_neighbor (MetaWorkspace *workspace,
|
||||
meta_verbose ("Getting neighbor of %d in direction %s\n",
|
||||
current_space, meta_motion_direction_to_string (direction));
|
||||
|
||||
ltr = meta_ui_get_direction() == META_UI_DIRECTION_LTR;
|
||||
ltr = (meta_get_locale_direction () == META_LOCALE_DIRECTION_LTR);
|
||||
|
||||
switch (direction)
|
||||
{
|
||||
|
Reference in New Issue
Block a user