st: Remove custom text direction stuff
Clutter has its own built-in system for managing text directions, like GTK+. Convert over to use this. https://bugzilla.gnome.org/show_bug.cgi?id=670034
This commit is contained in:
parent
d5285674ae
commit
15f881f967
@ -624,7 +624,7 @@ const AppIconMenu = new Lang.Class({
|
||||
|
||||
_init: function(source) {
|
||||
let side = St.Side.LEFT;
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
side = St.Side.RIGHT;
|
||||
|
||||
this.parent(source.actor, 0.5, side);
|
||||
|
@ -110,7 +110,7 @@ const DashItemContainer = new Lang.Class({
|
||||
let xOffset = node.get_length('-x-offset');
|
||||
|
||||
let x;
|
||||
if (St.Widget.get_default_direction () == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
x = stageX - this._label.get_width() - xOffset;
|
||||
else
|
||||
x = stageX + this.actor.get_width() + xOffset;
|
||||
|
@ -52,7 +52,7 @@ const DateMenuButton = new Lang.Class({
|
||||
let vbox;
|
||||
|
||||
let menuAlignment = 0.25;
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
menuAlignment = 1.0 - menuAlignment;
|
||||
this.parent(menuAlignment);
|
||||
|
||||
|
@ -48,11 +48,6 @@ function init() {
|
||||
window.C_ = Gettext.pgettext;
|
||||
window.ngettext = Gettext.ngettext;
|
||||
|
||||
// Set the default direction for St widgets (this needs to be done before any use of St)
|
||||
if (Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL) {
|
||||
St.Widget.set_default_direction(St.TextDirection.RTL);
|
||||
}
|
||||
|
||||
// Miscellaneous monkeypatching
|
||||
_patchContainerClass(St.BoxLayout);
|
||||
_patchContainerClass(St.Table);
|
||||
|
@ -251,7 +251,7 @@ const IconGrid = new Lang.Class({
|
||||
let childYSpacing = Math.max(0, height - childNaturalHeight) / 2;
|
||||
|
||||
let childBox = new Clutter.ActorBox();
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL) {
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
|
||||
let _x = box.x2 - (x + width);
|
||||
childBox.x1 = Math.floor(_x - childXSpacing);
|
||||
} else {
|
||||
|
@ -22,7 +22,7 @@ const LayoutManager = new Lang.Class({
|
||||
Name: 'LayoutManager',
|
||||
|
||||
_init: function () {
|
||||
this._rtl = (St.Widget.get_default_direction() == St.TextDirection.RTL);
|
||||
this._rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||
this.monitors = [];
|
||||
this.primaryMonitor = null;
|
||||
this.primaryIndex = -1;
|
||||
@ -405,7 +405,7 @@ const HotCorner = new Lang.Class({
|
||||
|
||||
this.actor.add_actor(this._corner);
|
||||
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL) {
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL) {
|
||||
this._corner.set_position(this.actor.width - this._corner.width, 0);
|
||||
this.actor.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
} else {
|
||||
@ -457,7 +457,7 @@ const HotCorner = new Lang.Class({
|
||||
|
||||
ripple._opacity = startOpacity;
|
||||
|
||||
if (ripple.get_direction() == St.TextDirection.RTL)
|
||||
if (ripple.get_text_direction() == Clutter.TextDirection.RTL)
|
||||
ripple.set_anchor_point_from_gravity(Clutter.Gravity.NORTH_EAST);
|
||||
|
||||
ripple.visible = true;
|
||||
|
@ -423,7 +423,7 @@ const Notification = new Lang.Class({
|
||||
this._bannerBodyText = null;
|
||||
this._bannerBodyMarkup = false;
|
||||
this._titleFitsInBannerMode = true;
|
||||
this._titleDirection = St.TextDirection.NONE;
|
||||
this._titleDirection = Clutter.TextDirection.DEFAULT;
|
||||
this._spacing = 0;
|
||||
this._scrollPolicy = Gtk.PolicyType.AUTOMATIC;
|
||||
this._imageBin = null;
|
||||
@ -544,9 +544,9 @@ const Notification = new Lang.Class({
|
||||
this._titleLabel.clutter_text.set_markup('<b>' + title + '</b>');
|
||||
|
||||
if (Pango.find_base_dir(title, -1) == Pango.Direction.RTL)
|
||||
this._titleDirection = St.TextDirection.RTL;
|
||||
this._titleDirection = Clutter.TextDirection.RTL;
|
||||
else
|
||||
this._titleDirection = St.TextDirection.LTR;
|
||||
this._titleDirection = Clutter.TextDirection.LTR;
|
||||
|
||||
// Let the title's text direction control the overall direction
|
||||
// of the notification - in case where different scripts are used
|
||||
@ -554,7 +554,7 @@ const Notification = new Lang.Class({
|
||||
// arguably for action buttons as well. Labels other than the title
|
||||
// will be allocated at the available width, so that their alignment
|
||||
// is done correctly automatically.
|
||||
this._table.set_direction(this._titleDirection);
|
||||
this._table.set_text_direction(this._titleDirection);
|
||||
|
||||
// Unless the notification has custom content, we save this._bannerBodyText
|
||||
// to add it to the content of the notification if the notification is
|
||||
@ -802,7 +802,7 @@ const Notification = new Lang.Class({
|
||||
|
||||
let titleBox = new Clutter.ActorBox();
|
||||
let titleBoxW = Math.min(titleNatW, availWidth);
|
||||
if (this._titleDirection == St.TextDirection.RTL) {
|
||||
if (this._titleDirection == Clutter.TextDirection.RTL) {
|
||||
titleBox.x1 = availWidth - titleBoxW;
|
||||
titleBox.x2 = availWidth;
|
||||
} else {
|
||||
@ -821,7 +821,7 @@ const Notification = new Lang.Class({
|
||||
} else {
|
||||
let bannerBox = new Clutter.ActorBox();
|
||||
|
||||
if (this._titleDirection == St.TextDirection.RTL) {
|
||||
if (this._titleDirection == Clutter.TextDirection.RTL) {
|
||||
bannerBox.x1 = 0;
|
||||
bannerBox.x2 = titleBox.x1 - this._spacing;
|
||||
|
||||
@ -1005,9 +1005,9 @@ const Source = new Lang.Class({
|
||||
let childBox = new Clutter.ActorBox();
|
||||
|
||||
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._counterBin.get_preferred_size();
|
||||
let direction = this.actor.get_direction();
|
||||
let direction = this.actor.get_text_direction();
|
||||
|
||||
if (direction == St.TextDirection.LTR) {
|
||||
if (direction == Clutter.TextDirection.LTR) {
|
||||
// allocate on the right in LTR
|
||||
childBox.x1 = box.x2 - naturalWidth;
|
||||
childBox.x2 = box.x2;
|
||||
@ -1491,7 +1491,7 @@ const MessageTray = new Lang.Class({
|
||||
this._summaryBin.x = 0;
|
||||
this._summaryBin.width = monitor.width;
|
||||
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
this._corner.x = 0;
|
||||
else
|
||||
this._corner.x = Main.layoutManager.trayBox.width - 1;
|
||||
|
@ -357,7 +357,7 @@ const Overview = new Lang.Class({
|
||||
let direction;
|
||||
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
||||
direction = stageX > this._dragStartX ? -1 : 1;
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
direction *= -1;
|
||||
} else {
|
||||
direction = stageY > this._dragStartY ? -1 : 1;
|
||||
@ -449,7 +449,7 @@ const Overview = new Lang.Class({
|
||||
return true;
|
||||
|
||||
if (this._scrollDirection == SwipeScrollDirection.HORIZONTAL) {
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
this._scrollAdjustment.value -= (dx / primary.width) * this._scrollAdjustment.page_size;
|
||||
else
|
||||
this._scrollAdjustment.value += (dx / primary.width) * this._scrollAdjustment.page_size;
|
||||
@ -490,7 +490,7 @@ const Overview = new Lang.Class({
|
||||
this.hide();
|
||||
|
||||
let primary = Main.layoutManager.primaryMonitor;
|
||||
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
||||
let rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||
|
||||
let contentY = Main.panel.actor.height;
|
||||
let contentHeight = primary.height - contentY - Main.messageTray.actor.height;
|
||||
|
@ -412,12 +412,12 @@ const AppMenuButton = new Lang.Class({
|
||||
|
||||
let [minWidth, minHeight, naturalWidth, naturalHeight] = this._iconBox.get_preferred_size();
|
||||
|
||||
let direction = this.actor.get_direction();
|
||||
let direction = this.actor.get_text_direction();
|
||||
|
||||
let yPadding = Math.floor(Math.max(0, allocHeight - naturalHeight) / 2);
|
||||
childBox.y1 = yPadding;
|
||||
childBox.y2 = childBox.y1 + Math.min(naturalHeight, allocHeight);
|
||||
if (direction == St.TextDirection.LTR) {
|
||||
if (direction == Clutter.TextDirection.LTR) {
|
||||
childBox.x1 = 0;
|
||||
childBox.x2 = childBox.x1 + Math.min(naturalWidth, allocWidth);
|
||||
} else {
|
||||
@ -434,7 +434,7 @@ const AppMenuButton = new Lang.Class({
|
||||
childBox.y1 = yPadding;
|
||||
childBox.y2 = childBox.y1 + Math.min(naturalHeight, allocHeight);
|
||||
|
||||
if (direction == St.TextDirection.LTR) {
|
||||
if (direction == Clutter.TextDirection.LTR) {
|
||||
childBox.x1 = Math.floor(iconWidth / 2);
|
||||
childBox.x2 = Math.min(childBox.x1 + naturalWidth, allocWidth);
|
||||
} else {
|
||||
@ -443,7 +443,7 @@ const AppMenuButton = new Lang.Class({
|
||||
}
|
||||
this._label.actor.allocate(childBox, flags);
|
||||
|
||||
if (direction == St.TextDirection.LTR) {
|
||||
if (direction == Clutter.TextDirection.LTR) {
|
||||
childBox.x1 = Math.floor(iconWidth / 2) + this._label.actor.width;
|
||||
childBox.x2 = childBox.x1 + this._spinner.actor.width;
|
||||
childBox.y1 = box.y1;
|
||||
@ -653,7 +653,7 @@ const ActivitiesButton = new Lang.Class({
|
||||
let primary = Main.layoutManager.primaryMonitor;
|
||||
let hotBox = new Clutter.ActorBox();
|
||||
let ok, x, y;
|
||||
if (actor.get_direction() == St.TextDirection.LTR) {
|
||||
if (actor.get_text_direction() == Clutter.TextDirection.LTR) {
|
||||
[ok, x, y] = actor.transform_stage_point(primary.x, primary.y)
|
||||
} else {
|
||||
[ok, x, y] = actor.transform_stage_point(primary.x + primary.width, primary.y);
|
||||
@ -807,7 +807,7 @@ const PanelCorner = new Lang.Class({
|
||||
|
||||
let rtlAwareContainer = this._box instanceof St.BoxLayout;
|
||||
if (rtlAwareContainer &&
|
||||
this._box.get_direction() == St.TextDirection.RTL) {
|
||||
this._box.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
if (this._side == St.Side.LEFT)
|
||||
side = St.Side.RIGHT;
|
||||
else if (this._side == St.Side.RIGHT)
|
||||
@ -928,14 +928,14 @@ const Panel = new Lang.Class({
|
||||
this._rightBox = new St.BoxLayout({ name: 'panelRight' });
|
||||
this.actor.add_actor(this._rightBox);
|
||||
|
||||
if (this.actor.get_direction() == St.TextDirection.RTL)
|
||||
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL)
|
||||
this._leftCorner = new PanelCorner(this._rightBox, St.Side.LEFT);
|
||||
else
|
||||
this._leftCorner = new PanelCorner(this._leftBox, St.Side.LEFT);
|
||||
|
||||
this.actor.add_actor(this._leftCorner.actor);
|
||||
|
||||
if (this.actor.get_direction() == St.TextDirection.RTL)
|
||||
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL)
|
||||
this._rightCorner = new PanelCorner(this._leftBox, St.Side.RIGHT);
|
||||
else
|
||||
this._rightCorner = new PanelCorner(this._rightBox, St.Side.RIGHT);
|
||||
@ -1011,7 +1011,7 @@ const Panel = new Lang.Class({
|
||||
|
||||
childBox.y1 = 0;
|
||||
childBox.y2 = allocHeight;
|
||||
if (this.actor.get_direction() == St.TextDirection.RTL) {
|
||||
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
childBox.x1 = allocWidth - Math.min(Math.floor(sideWidth),
|
||||
leftNaturalWidth);
|
||||
childBox.x2 = allocWidth;
|
||||
@ -1030,7 +1030,7 @@ const Panel = new Lang.Class({
|
||||
|
||||
childBox.y1 = 0;
|
||||
childBox.y2 = allocHeight;
|
||||
if (this.actor.get_direction() == St.TextDirection.RTL) {
|
||||
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
childBox.x1 = 0;
|
||||
childBox.x2 = Math.min(Math.floor(sideWidth),
|
||||
rightNaturalWidth);
|
||||
|
@ -273,7 +273,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
let height = box.y2 - box.y1;
|
||||
let direction = this.actor.get_direction();
|
||||
let direction = this.actor.get_text_direction();
|
||||
|
||||
if (this._dot) {
|
||||
// The dot is placed outside box
|
||||
@ -283,7 +283,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
let dotBox = new Clutter.ActorBox();
|
||||
let dotWidth = Math.round(box.x1 / 2);
|
||||
|
||||
if (direction == St.TextDirection.LTR) {
|
||||
if (direction == Clutter.TextDirection.LTR) {
|
||||
dotBox.x1 = Math.round(box.x1 / 4);
|
||||
dotBox.x2 = dotBox.x1 + dotWidth;
|
||||
} else {
|
||||
@ -296,7 +296,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
}
|
||||
|
||||
let x;
|
||||
if (direction == St.TextDirection.LTR)
|
||||
if (direction == Clutter.TextDirection.LTR)
|
||||
x = box.x1;
|
||||
else
|
||||
x = box.x2;
|
||||
@ -311,7 +311,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
let availWidth, extraWidth;
|
||||
if (this._columnWidths) {
|
||||
if (child.span == -1) {
|
||||
if (direction == St.TextDirection.LTR)
|
||||
if (direction == Clutter.TextDirection.LTR)
|
||||
availWidth = box.x2 - x;
|
||||
else
|
||||
availWidth = x - box.x1;
|
||||
@ -323,7 +323,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
extraWidth = availWidth - naturalWidth;
|
||||
} else {
|
||||
if (child.span == -1) {
|
||||
if (direction == St.TextDirection.LTR)
|
||||
if (direction == Clutter.TextDirection.LTR)
|
||||
availWidth = box.x2 - x;
|
||||
else
|
||||
availWidth = x - box.x1;
|
||||
@ -333,7 +333,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
extraWidth = 0;
|
||||
}
|
||||
|
||||
if (direction == St.TextDirection.LTR) {
|
||||
if (direction == Clutter.TextDirection.LTR) {
|
||||
if (child.expand) {
|
||||
childBox.x1 = x;
|
||||
childBox.x2 = x + availWidth;
|
||||
@ -371,7 +371,7 @@ const PopupBaseMenuItem = new Lang.Class({
|
||||
|
||||
child.actor.allocate(childBox, flags);
|
||||
|
||||
if (direction == St.TextDirection.LTR)
|
||||
if (direction == Clutter.TextDirection.LTR)
|
||||
x += availWidth + this._spacing;
|
||||
else
|
||||
x -= availWidth + this._spacing;
|
||||
|
@ -486,7 +486,7 @@ const ViewSelector = new Lang.Class({
|
||||
let childBox = new Clutter.ActorBox();
|
||||
childBox.y1 = 0;
|
||||
childBox.y2 = allocHeight;
|
||||
if (this.actor.get_direction() == St.TextDirection.RTL) {
|
||||
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
childBox.x1 = allocWidth - barNatWidth;
|
||||
childBox.x2 = allocWidth;
|
||||
} else {
|
||||
@ -495,7 +495,7 @@ const ViewSelector = new Lang.Class({
|
||||
}
|
||||
this._tabBox.allocate(childBox, flags);
|
||||
|
||||
if (this.actor.get_direction() == St.TextDirection.RTL) {
|
||||
if (this.actor.get_text_direction() == Clutter.TextDirection.RTL) {
|
||||
childBox.x1 = 0;
|
||||
childBox.x2 = searchNatWidth;
|
||||
} else {
|
||||
|
@ -186,7 +186,7 @@ const WindowManager = new Lang.Class({
|
||||
|
||||
let primary = Main.layoutManager.primaryMonitor;
|
||||
let xDest = primary.x;
|
||||
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
xDest += primary.width;
|
||||
|
||||
Tweener.addTween(actor,
|
||||
@ -567,7 +567,7 @@ const WindowManager = new Lang.Class({
|
||||
},
|
||||
|
||||
actionMoveWorkspaceLeft: function() {
|
||||
let rtl = (St.Widget.get_default_direction() == St.TextDirection.RTL);
|
||||
let rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||
let indexToActivate = activeWorkspaceIndex;
|
||||
if (rtl && activeWorkspaceIndex < global.screen.n_workspaces - 1)
|
||||
@ -583,7 +583,7 @@ const WindowManager = new Lang.Class({
|
||||
},
|
||||
|
||||
actionMoveWorkspaceRight: function() {
|
||||
let rtl = (St.Widget.get_default_direction() == St.TextDirection.RTL);
|
||||
let rtl = (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL);
|
||||
let activeWorkspaceIndex = global.screen.get_active_workspace_index();
|
||||
let indexToActivate = activeWorkspaceIndex;
|
||||
if (rtl && activeWorkspaceIndex > 0)
|
||||
|
@ -528,7 +528,7 @@ const WindowOverlay = new Lang.Class({
|
||||
|
||||
let settings = new Gio.Settings({ schema: BUTTON_LAYOUT_SCHEMA });
|
||||
let layout = settings.get_string(BUTTON_LAYOUT_KEY);
|
||||
let rtl = St.Widget.get_default_direction() == St.TextDirection.RTL;
|
||||
let rtl = Clutter.get_default_text_direction() == Clutter.TextDirection.RTL;
|
||||
|
||||
let split = layout.split(":");
|
||||
let side;
|
||||
|
@ -952,7 +952,7 @@ const ThumbnailsBox = new Lang.Class({
|
||||
},
|
||||
|
||||
_allocate: function(actor, box, flags) {
|
||||
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
||||
let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL);
|
||||
|
||||
// See comment about this._background in _init()
|
||||
let themeNode = this._background.get_theme_node();
|
||||
|
@ -790,7 +790,7 @@ const WorkspacesDisplay = new Lang.Class({
|
||||
let controlsVisible = this._controls.get_theme_node().get_length('visible-width');
|
||||
let controlsReserved = controlsVisible * (1 - this._zoomFraction) + controlsNatural * this._zoomFraction;
|
||||
|
||||
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
||||
let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL);
|
||||
if (rtl) {
|
||||
childBox.x2 = controlsReserved;
|
||||
childBox.x1 = childBox.x2 - controlsNatural;
|
||||
@ -850,7 +850,7 @@ const WorkspacesDisplay = new Lang.Class({
|
||||
|
||||
let [x, y] = this.actor.get_transformed_position();
|
||||
|
||||
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
||||
let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL);
|
||||
|
||||
let clipWidth = width - controlsVisible;
|
||||
let clipHeight = (fullHeight / fullWidth) * clipWidth;
|
||||
|
@ -611,7 +611,7 @@ st_box_layout_allocate (ClutterActor *actor,
|
||||
gint n_expand_children = 0, i;
|
||||
gfloat expand_amount, shrink_amount;
|
||||
BoxChildShrink *shrinks = NULL;
|
||||
gboolean flip = (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
|
||||
gboolean flip = (clutter_actor_get_text_direction (actor) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
&& (!priv->is_vertical);
|
||||
ClutterActor *child;
|
||||
|
||||
|
@ -257,7 +257,7 @@ _st_get_align_factors (StWidget *widget,
|
||||
break;
|
||||
}
|
||||
|
||||
if (st_widget_get_direction (widget) == ST_TEXT_DIRECTION_RTL)
|
||||
if (clutter_actor_get_text_direction (CLUTTER_ACTOR (widget)) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
*x_align_out = 1.0 - *x_align_out;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ st_scroll_view_fade_paint_target (ClutterOffscreenEffect *effect)
|
||||
|
||||
if (v_scroll_visible)
|
||||
{
|
||||
if (st_widget_get_direction (ST_WIDGET (self->actor)) == ST_TEXT_DIRECTION_RTL)
|
||||
if (clutter_actor_get_text_direction (self->actor) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
fade_area[0][0] += clutter_actor_get_width (vscroll);
|
||||
|
||||
fade_area[1][0] -= clutter_actor_get_width (vscroll);
|
||||
|
@ -583,7 +583,7 @@ st_scroll_view_allocate (ClutterActor *actor,
|
||||
/* Vertical scrollbar */
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll))
|
||||
{
|
||||
if (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
|
||||
if (clutter_actor_get_text_direction (actor) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
{
|
||||
child_box.x1 = content_box.x1;
|
||||
child_box.x2 = content_box.x1 + sb_width;
|
||||
@ -602,7 +602,7 @@ st_scroll_view_allocate (ClutterActor *actor,
|
||||
/* Horizontal scrollbar */
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll))
|
||||
{
|
||||
if (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
|
||||
if (clutter_actor_get_text_direction (actor) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
{
|
||||
child_box.x1 = content_box.x1 + (vscrollbar_visible ? sb_width : 0);
|
||||
child_box.x2 = content_box.x2;
|
||||
@ -627,7 +627,7 @@ st_scroll_view_allocate (ClutterActor *actor,
|
||||
sb_width = 0;
|
||||
|
||||
/* Child */
|
||||
if (st_widget_get_direction (ST_WIDGET (actor)) == ST_TEXT_DIRECTION_RTL)
|
||||
if (clutter_actor_get_text_direction (actor) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
{
|
||||
child_box.x1 = content_box.x1 + sb_width;
|
||||
child_box.x2 = content_box.x2;
|
||||
|
@ -224,7 +224,7 @@ st_table_homogeneous_allocate (ClutterActor *self,
|
||||
gfloat col_width, row_height;
|
||||
gint row_spacing, col_spacing;
|
||||
StTablePrivate *priv = ST_TABLE (self)->priv;
|
||||
gboolean ltr = st_widget_get_direction (ST_WIDGET (self)) == ST_TEXT_DIRECTION_LTR;
|
||||
gboolean ltr = clutter_actor_get_text_direction (self) == CLUTTER_TEXT_DIRECTION_LTR;
|
||||
ClutterActor *child;
|
||||
|
||||
col_spacing = priv->col_spacing;
|
||||
@ -587,7 +587,7 @@ st_table_preferred_allocate (ClutterActor *self,
|
||||
(int) (content_box->y2 - content_box->y1),
|
||||
col_widths);
|
||||
|
||||
ltr = (st_widget_get_direction (ST_WIDGET (self)) == ST_TEXT_DIRECTION_LTR);
|
||||
ltr = (clutter_actor_get_text_direction (self) == CLUTTER_TEXT_DIRECTION_LTR);
|
||||
|
||||
for (child = clutter_actor_get_first_child (self);
|
||||
child != NULL;
|
||||
|
@ -65,8 +65,6 @@ struct _StWidgetPrivate
|
||||
gboolean hover : 1;
|
||||
gboolean can_focus : 1;
|
||||
|
||||
StTextDirection direction;
|
||||
|
||||
AtkObject *accessible;
|
||||
|
||||
ClutterActor *label_actor;
|
||||
@ -557,7 +555,7 @@ st_widget_get_theme_node (StWidget *widget)
|
||||
* direction, to allow to adapt the CSS when necessary without
|
||||
* requiring separate style sheets.
|
||||
*/
|
||||
if (st_widget_get_direction (widget) == ST_TEXT_DIRECTION_RTL)
|
||||
if (clutter_actor_get_text_direction (CLUTTER_ACTOR (widget)) == CLUTTER_TEXT_DIRECTION_RTL)
|
||||
direction_pseudo_class = "rtl";
|
||||
else
|
||||
direction_pseudo_class = "ltr";
|
||||
@ -1499,47 +1497,6 @@ st_widget_ensure_style (StWidget *widget)
|
||||
st_widget_recompute_style (widget, NULL);
|
||||
}
|
||||
|
||||
static StTextDirection default_direction = ST_TEXT_DIRECTION_LTR;
|
||||
|
||||
StTextDirection
|
||||
st_widget_get_default_direction (void)
|
||||
{
|
||||
return default_direction;
|
||||
}
|
||||
|
||||
void
|
||||
st_widget_set_default_direction (StTextDirection dir)
|
||||
{
|
||||
g_return_if_fail (dir != ST_TEXT_DIRECTION_NONE);
|
||||
|
||||
default_direction = dir;
|
||||
}
|
||||
|
||||
StTextDirection
|
||||
st_widget_get_direction (StWidget *self)
|
||||
{
|
||||
g_return_val_if_fail (ST_IS_WIDGET (self), ST_TEXT_DIRECTION_LTR);
|
||||
|
||||
if (self->priv->direction != ST_TEXT_DIRECTION_NONE)
|
||||
return self->priv->direction;
|
||||
else
|
||||
return default_direction;
|
||||
}
|
||||
|
||||
void
|
||||
st_widget_set_direction (StWidget *self, StTextDirection dir)
|
||||
{
|
||||
StTextDirection old_direction;
|
||||
|
||||
g_return_if_fail (ST_IS_WIDGET (self));
|
||||
|
||||
old_direction = st_widget_get_direction (self);
|
||||
self->priv->direction = dir;
|
||||
|
||||
if (old_direction != st_widget_get_direction (self))
|
||||
st_widget_style_changed (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* st_widget_set_track_hover:
|
||||
* @widget: A #StWidget
|
||||
|
@ -35,12 +35,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
ST_TEXT_DIRECTION_NONE,
|
||||
ST_TEXT_DIRECTION_LTR,
|
||||
ST_TEXT_DIRECTION_RTL
|
||||
} StTextDirection;
|
||||
|
||||
#define ST_TYPE_WIDGET (st_widget_get_type ())
|
||||
#define ST_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ST_TYPE_WIDGET, StWidget))
|
||||
#define ST_IS_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ST_TYPE_WIDGET))
|
||||
@ -129,13 +123,6 @@ gboolean st_widget_get_hover (StWidget *widg
|
||||
|
||||
void st_widget_ensure_style (StWidget *widget);
|
||||
|
||||
StTextDirection st_widget_get_default_direction (void);
|
||||
void st_widget_set_default_direction (StTextDirection dir);
|
||||
|
||||
StTextDirection st_widget_get_direction (StWidget *self);
|
||||
void st_widget_set_direction (StWidget *self,
|
||||
StTextDirection dir);
|
||||
|
||||
void st_widget_set_can_focus (StWidget *widget,
|
||||
gboolean can_focus);
|
||||
gboolean st_widget_get_can_focus (StWidget *widget);
|
||||
|
Loading…
Reference in New Issue
Block a user