From 15f881f9679adc18259a96a17b6ca1c33dffdd3b Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 13 Feb 2012 20:37:28 -0500 Subject: [PATCH] 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 --- js/ui/appDisplay.js | 2 +- js/ui/dash.js | 2 +- js/ui/dateMenu.js | 2 +- js/ui/environment.js | 5 ---- js/ui/iconGrid.js | 2 +- js/ui/layout.js | 6 ++--- js/ui/messageTray.js | 18 +++++++-------- js/ui/overview.js | 6 ++--- js/ui/panel.js | 20 ++++++++-------- js/ui/popupMenu.js | 14 +++++------ js/ui/viewSelector.js | 4 ++-- js/ui/windowManager.js | 6 ++--- js/ui/workspace.js | 2 +- js/ui/workspaceThumbnail.js | 2 +- js/ui/workspacesView.js | 4 ++-- src/st/st-box-layout.c | 2 +- src/st/st-private.c | 2 +- src/st/st-scroll-view-fade.c | 2 +- src/st/st-scroll-view.c | 6 ++--- src/st/st-table.c | 4 ++-- src/st/st-widget.c | 45 +----------------------------------- src/st/st-widget.h | 13 ----------- 22 files changed, 54 insertions(+), 115 deletions(-) diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js index 5fe1d7d01..4e8bf3d17 100644 --- a/js/ui/appDisplay.js +++ b/js/ui/appDisplay.js @@ -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); diff --git a/js/ui/dash.js b/js/ui/dash.js index 5035915a7..018674b34 100644 --- a/js/ui/dash.js +++ b/js/ui/dash.js @@ -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; diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js index 05b4d095b..f6368dabb 100644 --- a/js/ui/dateMenu.js +++ b/js/ui/dateMenu.js @@ -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); diff --git a/js/ui/environment.js b/js/ui/environment.js index 95bdc5f2d..fc78064ea 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -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); diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js index b7023026c..54b792a07 100644 --- a/js/ui/iconGrid.js +++ b/js/ui/iconGrid.js @@ -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 { diff --git a/js/ui/layout.js b/js/ui/layout.js index ae6ceb349..66bf995b9 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -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; diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index d8dfde05a..f9c275d29 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -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('' + title + ''); 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; diff --git a/js/ui/overview.js b/js/ui/overview.js index 2fb28e318..7858c34b4 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -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; diff --git a/js/ui/panel.js b/js/ui/panel.js index d8a9a9315..97cbf7d51 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -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); diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index c0e26a239..ea8d60b6f 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -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; diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index fa0418ca3..4ba9c9499 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -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 { diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 637d842ea..69f8e194f 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -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) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 1d48bfd98..81af030ea 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -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; diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index ed1a28323..79eef04b5 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -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(); diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 925f791b2..eed675eb6 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -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; diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index f75cbcff5..8be7582d6 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -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; diff --git a/src/st/st-private.c b/src/st/st-private.c index 21ca09a9e..aac3993c2 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -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; } diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c index 404d3e555..b9f250a66 100644 --- a/src/st/st-scroll-view-fade.c +++ b/src/st/st-scroll-view-fade.c @@ -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); diff --git a/src/st/st-scroll-view.c b/src/st/st-scroll-view.c index 34da25357..cca7f0bce 100644 --- a/src/st/st-scroll-view.c +++ b/src/st/st-scroll-view.c @@ -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; diff --git a/src/st/st-table.c b/src/st/st-table.c index f059bf539..8b29906e1 100644 --- a/src/st/st-table.c +++ b/src/st/st-table.c @@ -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; diff --git a/src/st/st-widget.c b/src/st/st-widget.c index 6f3a76fda..d5ac4e69a 100644 --- a/src/st/st-widget.c +++ b/src/st/st-widget.c @@ -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 diff --git a/src/st/st-widget.h b/src/st/st-widget.h index ed1e50863..060d5f6fc 100644 --- a/src/st/st-widget.h +++ b/src/st/st-widget.h @@ -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);