[gnome-shell/wip/carlosg/cleanup-gtk-usage: 8/12] st: Add StDirectionType enum
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/cleanup-gtk-usage: 8/12] st: Add StDirectionType enum
- Date: Wed, 28 Nov 2018 16:51:03 +0000 (UTC)
commit 816d9a10e3aa1eeb036a8621e68e3ef73791183b
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 27 13:58:25 2018 +0100
st: Add StDirectionType enum
In order to replace GTK+'s GtkDirectionType. It's bit-compatible with it,
too. All callers have been updated to use it.
This is a purely accessory change in terms of X11 Display usage cleanup,
but helps see better what is left.
js/gdm/loginDialog.js | 3 +--
js/ui/appDisplay.js | 17 ++++++++---------
js/ui/ctrlAltTab.js | 3 +--
js/ui/grabHelper.js | 3 +--
js/ui/iconGrid.js | 7 +++----
js/ui/lookingGlass.js | 3 +--
js/ui/messageTray.js | 3 +--
js/ui/panel.js | 2 +-
js/ui/panelMenu.js | 3 +--
js/ui/popupMenu.js | 7 +++----
js/ui/screenShield.js | 3 +--
js/ui/search.js | 9 ++++-----
js/ui/shellEntry.js | 3 +--
js/ui/viewSelector.js | 21 ++++++++++-----------
js/ui/windowMenu.js | 3 +--
src/shell-stack.c | 2 +-
src/st/st-bin.c | 2 +-
src/st/st-entry.c | 2 +-
src/st/st-focus-manager.c | 16 ++++++++--------
src/st/st-widget.c | 38 +++++++++++++++++++-------------------
src/st/st-widget.h | 14 ++++++++++++--
21 files changed, 80 insertions(+), 84 deletions(-)
---
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 4f7435cc6..00cbbf94c 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -23,7 +23,6 @@ const Gdm = imports.gi.Gdm;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Pango = imports.gi.Pango;
@@ -188,7 +187,7 @@ var UserList = new Lang.Class({
if (global.stage.get_key_focus() != this.actor)
return;
- let focusSet = this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ let focusSet = this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
if (!focusSet) {
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._moveFocusToItems();
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 27000e23a..640ecd12d 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
const Shell = imports.gi.Shell;
const Lang = imports.lang;
const Signals = imports.signals;
@@ -176,7 +175,7 @@ var BaseAppView = new Lang.Class({
_selectAppInternal(id) {
if (this._items[id])
- this._items[id].actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ this._items[id].actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
else
log('No such application ' + id);
},
@@ -1494,18 +1493,18 @@ var AppFolderPopup = new Lang.Class({
let isLtr = Clutter.get_default_text_direction() == Clutter.TextDirection.LTR;
switch (event.get_key_symbol()) {
case Clutter.Down:
- direction = Gtk.DirectionType.TAB_FORWARD;
+ direction = St.DirectionType.TAB_FORWARD;
break;
case Clutter.Right:
- direction = isLtr ? Gtk.DirectionType.TAB_FORWARD :
- Gtk.DirectionType.TAB_BACKWARD;
+ direction = isLtr ? St.DirectionType.TAB_FORWARD :
+ St.DirectionType.TAB_BACKWARD;
break;
case Clutter.Up:
- direction = Gtk.DirectionType.TAB_BACKWARD;
+ direction = St.DirectionType.TAB_BACKWARD;
break;
case Clutter.Left:
- direction = isLtr ? Gtk.DirectionType.TAB_BACKWARD :
- Gtk.DirectionType.TAB_FORWARD;
+ direction = isLtr ? St.DirectionType.TAB_BACKWARD :
+ St.DirectionType.TAB_FORWARD;
break;
default:
return Clutter.EVENT_PROPAGATE;
@@ -1718,7 +1717,7 @@ var AppIcon = new Lang.Class({
_onKeyboardPopupMenu() {
this.popupMenu();
- this._menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ this._menu.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
},
getId() {
diff --git a/js/ui/ctrlAltTab.js b/js/ui/ctrlAltTab.js
index 8ab1db9ba..dcdb3a74f 100644
--- a/js/ui/ctrlAltTab.js
+++ b/js/ui/ctrlAltTab.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
@@ -61,7 +60,7 @@ var CtrlAltTabManager = new Lang.Class({
if (item.focusCallback)
item.focusCallback(timestamp);
else
- item.root.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ item.root.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
},
// Sort the items into a consistent order; panel first, tray last,
diff --git a/js/ui/grabHelper.js b/js/ui/grabHelper.js
index 38e116fd9..b4aa0871a 100644
--- a/js/ui/grabHelper.js
+++ b/js/ui/grabHelper.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
@@ -190,7 +189,7 @@ var GrabHelper = new Lang.Class({
if (params.focus) {
params.focus.grab_key_focus();
} else if (newFocus && hadFocus) {
- if (!newFocus.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false))
+ if (!newFocus.navigate_focus(null, St.DirectionType.TAB_FORWARD, false))
newFocus.grab_key_focus();
}
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 82b335cc5..8775ae3ac 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
-const Gtk = imports.gi.Gtk;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
@@ -965,8 +964,8 @@ var PaginatedIconGrid = new Lang.Class({
this._translatedChildren = [];
this.emit('space-opened');
} else {
- this._translateChildren(childrenUp, Gtk.DirectionType.UP, nRowsUp);
- this._translateChildren(childrenDown, Gtk.DirectionType.DOWN, nRowsDown);
+ this._translateChildren(childrenUp, St.DirectionType.UP, nRowsUp);
+ this._translateChildren(childrenDown, St.DirectionType.DOWN, nRowsDown);
this._translatedChildren = childrenUp.concat(childrenDown);
}
},
@@ -976,7 +975,7 @@ var PaginatedIconGrid = new Lang.Class({
if (translationY == 0)
return;
- if (direction == Gtk.DirectionType.UP)
+ if (direction == St.DirectionType.UP)
translationY *= -1;
for (let i = 0; i < children.length; i++) {
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 34c60cb65..b84a714ba 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -5,7 +5,6 @@ const Cogl = imports.gi.Cogl;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
const Meta = imports.gi.Meta;
const Pango = imports.gi.Pango;
const St = imports.gi.St;
@@ -193,7 +192,7 @@ var Notebook = new Lang.Class({
// Focus the new tab before unmapping the old one
let tabData = this._tabs[index];
- if (!tabData.scrollView.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false))
+ if (!tabData.scrollView.navigate_focus(null, St.DirectionType.TAB_FORWARD, false))
this.actor.grab_key_focus();
this._unselect();
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index f8e2f0b9f..048db2c27 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
const Atk = imports.gi.Atk;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
@@ -90,7 +89,7 @@ var FocusGrabber = new Lang.Class({
this._focusActorChangedId = global.stage.connect('notify::key-focus',
this._focusActorChanged.bind(this));
- if (!this._actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false))
+ if (!this._actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false))
this._actor.grab_key_focus();
this._focused = true;
diff --git a/js/ui/panel.js b/js/ui/panel.js
index 1c6445a35..7b08dd597 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -1001,7 +1001,7 @@ var Panel = new Lang.Class({
menu.toggle();
if (menu.isOpen)
- menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ menu.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
},
toggleAppMenu() {
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js
index 401419dec..3e70daee1 100644
--- a/js/ui/panelMenu.js
+++ b/js/ui/panelMenu.js
@@ -2,7 +2,6 @@
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
@@ -167,7 +166,7 @@ var Button = new Lang.Class({
if (symbol == Clutter.KEY_Left || symbol == Clutter.KEY_Right) {
let group = global.focus_manager.get_group(this.actor);
if (group) {
- let direction = (symbol == Clutter.KEY_Left) ? Gtk.DirectionType.LEFT :
Gtk.DirectionType.RIGHT;
+ let direction = (symbol == Clutter.KEY_Left) ? St.DirectionType.LEFT :
St.DirectionType.RIGHT;
group.navigate_focus(this.actor, direction, false);
return Clutter.EVENT_STOP;
}
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index f33c579ff..fa59a6691 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
-const Gtk = imports.gi.Gtk;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Lang = imports.lang;
@@ -560,7 +559,7 @@ var PopupMenuBase = new Lang.Class({
let sensitive = menuItem.getSensitive();
if (!sensitive && this._activeMenuItem == menuItem) {
if (!this.actor.navigate_focus(menuItem.actor,
- Gtk.DirectionType.TAB_FORWARD,
+ St.DirectionType.TAB_FORWARD,
true))
this.actor.grab_key_focus();
} else if (sensitive && this._activeMenuItem == null) {
@@ -849,7 +848,7 @@ var PopupMenu = new Lang.Class({
} else if (symbol == navKey) {
if (!this.isOpen)
this.toggle();
- this.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ this.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
return Clutter.EVENT_STOP;
} else
return Clutter.EVENT_PROPAGATE;
@@ -1182,7 +1181,7 @@ var PopupSubMenuMenuItem = new Lang.Class({
if (symbol == Clutter.KEY_Right) {
this._setOpenState(true);
- this.menu.actor.navigate_focus(null, Gtk.DirectionType.DOWN, false);
+ this.menu.actor.navigate_focus(null, St.DirectionType.DOWN, false);
return Clutter.EVENT_STOP;
} else if (symbol == Clutter.KEY_Left && this._getOpenState()) {
this._setOpenState(false);
diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 3c115eb51..ed08b2cea 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -6,7 +6,6 @@ const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
const GnomeDesktop = imports.gi.GnomeDesktop;
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@@ -926,7 +925,7 @@ var ScreenShield = new Lang.Class({
if (this._dialog) {
this._dialog.actor.grab_key_focus();
- this._dialog.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ this._dialog.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
}
},
diff --git a/js/ui/search.js b/js/ui/search.js
index 88d6c3bee..4d490597c 100644
--- a/js/ui/search.js
+++ b/js/ui/search.js
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
const Lang = imports.lang;
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
-const Gtk = imports.gi.Gtk;
const Meta = imports.gi.Meta;
const Signals = imports.signals;
const Shell = imports.gi.Shell;
@@ -702,10 +701,10 @@ var SearchResults = new Lang.Class({
navigateFocus(direction) {
let rtl = this.actor.get_text_direction() == Clutter.TextDirection.RTL;
- if (direction == Gtk.DirectionType.TAB_BACKWARD ||
- direction == (rtl ? Gtk.DirectionType.RIGHT
- : Gtk.DirectionType.LEFT) ||
- direction == Gtk.DirectionType.UP) {
+ if (direction == St.DirectionType.TAB_BACKWARD ||
+ direction == (rtl ? St.DirectionType.RIGHT
+ : St.DirectionType.LEFT) ||
+ direction == St.DirectionType.UP) {
this.actor.navigate_focus(null, direction, false);
return;
}
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 9db5136e6..4fab9e16e 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter;
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const St = imports.gi.St;
@@ -72,7 +71,7 @@ var EntryMenu = new Lang.Class({
this.parent(animate);
this._entry.add_style_pseudo_class('focus');
- let direction = Gtk.DirectionType.TAB_FORWARD;
+ let direction = St.DirectionType.TAB_FORWARD;
if (!this.actor.navigate_focus(null, direction, false))
this.actor.grab_key_focus();
},
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 6a235eccd..ca21ed43e 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -3,7 +3,6 @@
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
-const Gtk = imports.gi.Gtk;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
const Signals = imports.signals;
@@ -37,8 +36,8 @@ var FocusTrap = new Lang.Class({
Extends: St.Widget,
vfunc_navigate_focus(from, direction) {
- if (direction == Gtk.DirectionType.TAB_FORWARD ||
- direction == Gtk.DirectionType.TAB_BACKWARD)
+ if (direction == St.DirectionType.TAB_FORWARD ||
+ direction == St.DirectionType.TAB_BACKWARD)
return this.parent(from, direction);
return false;
}
@@ -406,7 +405,7 @@ var ViewSelector = new Lang.Class({
_a11yFocusPage(page) {
this._showAppsButton.checked = page == this._appsPage;
- page.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ page.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
},
_onShowAppsButtonToggled() {
@@ -435,10 +434,10 @@ var ViewSelector = new Lang.Class({
this.startSearch(event);
} else if (!this._searchActive && !global.stage.key_focus) {
if (symbol == Clutter.Tab || symbol == Clutter.Down) {
- this._activePage.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ this._activePage.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
return Clutter.EVENT_STOP;
} else if (symbol == Clutter.ISO_Left_Tab) {
- this._activePage.navigate_focus(null, Gtk.DirectionType.TAB_BACKWARD, false);
+ this._activePage.navigate_focus(null, St.DirectionType.TAB_BACKWARD, false);
return Clutter.EVENT_STOP;
}
}
@@ -566,22 +565,22 @@ var ViewSelector = new Lang.Class({
let arrowNext, nextDirection;
if (entry.get_text_direction() == Clutter.TextDirection.RTL) {
arrowNext = Clutter.Left;
- nextDirection = Gtk.DirectionType.LEFT;
+ nextDirection = St.DirectionType.LEFT;
} else {
arrowNext = Clutter.Right;
- nextDirection = Gtk.DirectionType.RIGHT;
+ nextDirection = St.DirectionType.RIGHT;
}
if (symbol == Clutter.Tab) {
- this._searchResults.navigateFocus(Gtk.DirectionType.TAB_FORWARD);
+ this._searchResults.navigateFocus(St.DirectionType.TAB_FORWARD);
return Clutter.EVENT_STOP;
} else if (symbol == Clutter.ISO_Left_Tab) {
this._focusTrap.can_focus = false;
- this._searchResults.navigateFocus(Gtk.DirectionType.TAB_BACKWARD);
+ this._searchResults.navigateFocus(St.DirectionType.TAB_BACKWARD);
this._focusTrap.can_focus = true;
return Clutter.EVENT_STOP;
} else if (symbol == Clutter.Down) {
- this._searchResults.navigateFocus(Gtk.DirectionType.DOWN);
+ this._searchResults.navigateFocus(St.DirectionType.DOWN);
return Clutter.EVENT_STOP;
} else if (symbol == arrowNext && this._text.position == -1) {
this._searchResults.navigateFocus(nextDirection);
diff --git a/js/ui/windowMenu.js b/js/ui/windowMenu.js
index 11d4f17b6..3f79fa7ac 100644
--- a/js/ui/windowMenu.js
+++ b/js/ui/windowMenu.js
@@ -1,6 +1,5 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*
-const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const St = imports.gi.St;
@@ -229,7 +228,7 @@ var WindowMenuManager = new Lang.Class({
this._sourceActor.show();
menu.open(BoxPointer.PopupAnimation.NONE);
- menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+ menu.actor.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
menu.connect('open-state-changed', (menu_, isOpen) => {
if (isOpen)
return;
diff --git a/src/shell-stack.c b/src/shell-stack.c
index f04bb58df..7fc760925 100644
--- a/src/shell-stack.c
+++ b/src/shell-stack.c
@@ -146,7 +146,7 @@ shell_stack_get_preferred_width (ClutterActor *actor,
static gboolean
shell_stack_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction)
+ StDirectionType direction)
{
ClutterActor *top_actor;
diff --git a/src/st/st-bin.c b/src/st/st-bin.c
index 21b36876a..f013909e8 100644
--- a/src/st/st-bin.c
+++ b/src/st/st-bin.c
@@ -200,7 +200,7 @@ st_bin_popup_menu (StWidget *widget)
static gboolean
st_bin_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction)
+ StDirectionType direction)
{
StBinPrivate *priv = st_bin_get_instance_private (ST_BIN (widget));
ClutterActor *bin_actor = CLUTTER_ACTOR (widget);
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index a9c062937..f52f4bb66 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -338,7 +338,7 @@ st_entry_style_changed (StWidget *self)
static gboolean
st_entry_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction)
+ StDirectionType direction)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (widget);
diff --git a/src/st/st-focus-manager.c b/src/st/st-focus-manager.c
index 93f74157e..0753d7902 100644
--- a/src/st/st-focus-manager.c
+++ b/src/st/st-focus-manager.c
@@ -75,7 +75,7 @@ st_focus_manager_stage_event (ClutterActor *stage,
gpointer user_data)
{
StFocusManager *manager = user_data;
- GtkDirectionType direction;
+ StDirectionType direction;
gboolean wrap_around = FALSE;
ClutterActor *focused, *group;
@@ -85,26 +85,26 @@ st_focus_manager_stage_event (ClutterActor *stage,
switch (event->key.keyval)
{
case CLUTTER_KEY_Up:
- direction = GTK_DIR_UP;
+ direction = ST_DIR_UP;
break;
case CLUTTER_KEY_Down:
- direction = GTK_DIR_DOWN;
+ direction = ST_DIR_DOWN;
break;
case CLUTTER_KEY_Left:
- direction = GTK_DIR_LEFT;
+ direction = ST_DIR_LEFT;
break;
case CLUTTER_KEY_Right:
- direction = GTK_DIR_RIGHT;
+ direction = ST_DIR_RIGHT;
break;
case CLUTTER_KEY_Tab:
if (event->key.modifier_state & CLUTTER_SHIFT_MASK)
- direction = GTK_DIR_TAB_BACKWARD;
+ direction = ST_DIR_TAB_BACKWARD;
else
- direction = GTK_DIR_TAB_FORWARD;
+ direction = ST_DIR_TAB_FORWARD;
wrap_around = TRUE;
break;
case CLUTTER_KEY_ISO_Left_Tab:
- direction = GTK_DIR_TAB_BACKWARD;
+ direction = ST_DIR_TAB_BACKWARD;
wrap_around = TRUE;
break;
diff --git a/src/st/st-widget.c b/src/st/st-widget.c
index db984ac9b..b5b83a3e1 100644
--- a/src/st/st-widget.c
+++ b/src/st/st-widget.c
@@ -136,7 +136,7 @@ static void st_widget_recompute_style (StWidget *widget,
StThemeNode *old_theme_node);
static gboolean st_widget_real_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction);
+ StDirectionType direction);
static AtkObject * st_widget_get_accessible (ClutterActor *actor);
@@ -1872,7 +1872,7 @@ st_widget_popup_menu (StWidget *self)
static GList *
filter_by_position (GList *children,
ClutterActorBox *rbox,
- GtkDirectionType direction)
+ StDirectionType direction)
{
ClutterActorBox cbox;
ClutterVertex abs_vertices[4];
@@ -1892,28 +1892,28 @@ filter_by_position (GList *children,
*/
switch (direction)
{
- case GTK_DIR_UP:
+ case ST_DIR_UP:
if (cbox.y2 > rbox->y1 + 0.1)
continue;
break;
- case GTK_DIR_DOWN:
+ case ST_DIR_DOWN:
if (cbox.y1 < rbox->y2 - 0.1)
continue;
break;
- case GTK_DIR_LEFT:
+ case ST_DIR_LEFT:
if (cbox.x2 > rbox->x1 + 0.1)
continue;
break;
- case GTK_DIR_RIGHT:
+ case ST_DIR_RIGHT:
if (cbox.x1 < rbox->x2 - 0.1)
continue;
break;
- case GTK_DIR_TAB_BACKWARD:
- case GTK_DIR_TAB_FORWARD:
+ case ST_DIR_TAB_BACKWARD:
+ case ST_DIR_TAB_FORWARD:
default:
g_return_val_if_reached (NULL);
}
@@ -1970,7 +1970,7 @@ sort_by_distance (gconstpointer a,
static gboolean
st_widget_real_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction)
+ StDirectionType direction)
{
StWidgetPrivate *priv = st_widget_get_instance_private (widget);
ClutterActor *widget_actor, *focus_child;
@@ -2022,15 +2022,15 @@ st_widget_real_navigate_focus (StWidget *widget,
}
children = st_widget_get_focus_chain (widget);
- if (direction == GTK_DIR_TAB_FORWARD ||
- direction == GTK_DIR_TAB_BACKWARD)
+ if (direction == ST_DIR_TAB_FORWARD ||
+ direction == ST_DIR_TAB_BACKWARD)
{
/* At this point we know that we want to navigate focus to one of
* @widget's immediate children; the next one after @focus_child, or the
* first one if @focus_child is %NULL. (With "next" and "first" being
* determined by @direction.)
*/
- if (direction == GTK_DIR_TAB_BACKWARD)
+ if (direction == ST_DIR_TAB_BACKWARD)
children = g_list_reverse (children);
if (focus_child)
@@ -2068,20 +2068,20 @@ st_widget_real_navigate_focus (StWidget *widget,
clutter_actor_box_from_vertices (&sort_box, abs_vertices);
switch (direction)
{
- case GTK_DIR_UP:
+ case ST_DIR_UP:
sort_box.y1 = sort_box.y2;
break;
- case GTK_DIR_DOWN:
+ case ST_DIR_DOWN:
sort_box.y2 = sort_box.y1;
break;
- case GTK_DIR_LEFT:
+ case ST_DIR_LEFT:
sort_box.x1 = sort_box.x2;
break;
- case GTK_DIR_RIGHT:
+ case ST_DIR_RIGHT:
sort_box.x2 = sort_box.x1;
break;
- case GTK_DIR_TAB_FORWARD:
- case GTK_DIR_TAB_BACKWARD:
+ case ST_DIR_TAB_FORWARD:
+ case ST_DIR_TAB_BACKWARD:
default:
g_warn_if_reached ();
}
@@ -2151,7 +2151,7 @@ st_widget_real_navigate_focus (StWidget *widget,
gboolean
st_widget_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction,
+ StDirectionType direction,
gboolean wrap_around)
{
g_return_val_if_fail (ST_IS_WIDGET (widget), FALSE);
diff --git a/src/st/st-widget.h b/src/st/st-widget.h
index 4f351ea9e..36a632567 100644
--- a/src/st/st-widget.h
+++ b/src/st/st-widget.h
@@ -38,6 +38,16 @@ G_BEGIN_DECLS
#define ST_TYPE_WIDGET (st_widget_get_type ())
G_DECLARE_DERIVABLE_TYPE (StWidget, st_widget, ST, WIDGET, ClutterActor)
+typedef enum
+{
+ ST_DIR_TAB_FORWARD,
+ ST_DIR_TAB_BACKWARD,
+ ST_DIR_UP,
+ ST_DIR_DOWN,
+ ST_DIR_LEFT,
+ ST_DIR_RIGHT,
+} StDirectionType;
+
typedef struct _StWidgetClass StWidgetClass;
/**
@@ -64,7 +74,7 @@ struct _StWidgetClass
*/
gboolean (* navigate_focus) (StWidget *self,
ClutterActor *from,
- GtkDirectionType direction);
+ StDirectionType direction);
GType (* get_accessible_type) (void);
GList * (* get_focus_chain) (StWidget *widget);
@@ -113,7 +123,7 @@ void st_widget_set_can_focus (StWidget *widg
gboolean st_widget_get_can_focus (StWidget *widget);
gboolean st_widget_navigate_focus (StWidget *widget,
ClutterActor *from,
- GtkDirectionType direction,
+ StDirectionType direction,
gboolean wrap_around);
ClutterActor * st_widget_get_label_actor (StWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]