Skip to content

Commit 2b063df

Browse files
committed
Rename Focusable to Widget
1 parent 3ff15b8 commit 2b063df

14 files changed

Lines changed: 37 additions & 37 deletions

lib/Gestures/ActorTarget.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* It will propagate gesture events to all direct descendants that are also {@link ActorTarget}s.
1111
* If a new child (or target via {@link add_target}) is added, its progress will be synced.
1212
*/
13-
public class Gala.ActorTarget : Focusable, GestureTarget {
13+
public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
1414
public bool animating { get { return ongoing_animations > 0; } }
1515

1616
private double[] current_progress;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Gala.FocusController : Clutter.Action {
1717
}
1818

1919
construct {
20-
// In the case the key focus moves out of our focusable tree by some other means
20+
// In the case the key focus moves out of our widget tree by some other means
2121
// make sure we can recapture it
2222
stage.key_press_event.connect (check_focus);
2323
}
@@ -27,15 +27,15 @@ public class Gala.FocusController : Clutter.Action {
2727
}
2828

2929
private bool check_focus (Clutter.Event event) requires (
30-
actor is Focusable && !(actor.get_parent () is Focusable) // Make sure we are only attached to root focusables
30+
actor is Widget && !(actor.get_parent () is Widget) // Make sure we are only attached to root widgets
3131
) {
3232
var direction = FocusDirection.get_for_event (event);
3333

3434
if (direction == null) {
3535
return Clutter.EVENT_PROPAGATE;
3636
}
3737

38-
if (!((Focusable) actor).focus (direction)) {
38+
if (!((Widget) actor).focus (direction)) {
3939
#if HAS_MUTTER47
4040
stage.context.get_backend ().get_default_seat ().bell_notify ();
4141
#else
@@ -68,6 +68,6 @@ public class Gala.FocusController : Clutter.Action {
6868

6969
private void set_focus_visible (bool visible) {
7070
actor.set_qdata (focus_visible_quark, visible);
71-
(stage.key_focus as Focusable)?.focus_changed ();
71+
(stage.key_focus as Widget)?.focus_changed ();
7272
}
7373
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ public enum Gala.FocusDirection {
2828
}
2929

3030
namespace Gala.FocusUtils {
31-
public void filter_children_for_direction (Gee.List<Focusable> children, Clutter.Actor focus_actor, FocusDirection direction) {
32-
Focusable? focus_child = null;
31+
public void filter_children_for_direction (Gee.List<Widget> children, Clutter.Actor focus_actor, FocusDirection direction) {
32+
Widget? focus_child = null;
3333
foreach (var child in children) {
3434
if (focus_actor in child) {
35-
focus_child = (Focusable) child;
35+
focus_child = (Widget) child;
3636
break;
3737
}
3838
}
3939

40-
var to_retain = new Gee.LinkedList<Focusable> ();
40+
var to_retain = new Gee.LinkedList<Widget> ();
4141
to_retain.add_all_iterator (children.filter ((c) => {
4242
if (focus_child == null || c == focus_child) {
4343
return true;
@@ -67,7 +67,7 @@ namespace Gala.FocusUtils {
6767
return {(int) actor.x, (int) actor.y, (int) actor.width, (int) actor.height};
6868
}
6969

70-
public void sort_children_for_direction (Gee.List<Focusable> children, FocusDirection direction) {
70+
public void sort_children_for_direction (Gee.List<Widget> children, FocusDirection direction) {
7171
children.sort ((a, b) => {
7272
if (direction == UP && a.y + a.height > b.y + b.height ||
7373
direction == DOWN && a.y < b.y ||
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Authored by: Leonhard Kargl <leo.kargl@proton.me>
66
*/
77

8-
public class Gala.Focusable : Clutter.Actor {
8+
public class Gala.Widget : ActorTarget {
99
public bool can_focus { get; set; default = false; }
1010
public bool has_visible_focus { get; private set; default = false; }
1111

@@ -18,9 +18,9 @@ public class Gala.Focusable : Clutter.Actor {
1818
has_visible_focus = has_key_focus () && get_root ().get_qdata<bool> (FocusController.focus_visible_quark);
1919
}
2020

21-
private Focusable get_root () {
21+
private Widget get_root () {
2222
var parent = get_parent ();
23-
if (parent is Focusable) {
23+
if (parent is Widget) {
2424
return parent.get_root ();
2525
}
2626

@@ -41,7 +41,7 @@ public class Gala.Focusable : Clutter.Actor {
4141

4242
// A child of us (or subchild) has focus, try to move it to the next one.
4343
// If that doesn't work and we are moving backwards focus us
44-
if (focus_actor != null && focus_actor is Focusable && focus_actor in this) {
44+
if (focus_actor != null && focus_actor is Widget && focus_actor in this) {
4545
if (move_focus (direction)) {
4646
return true;
4747
}
@@ -80,7 +80,7 @@ public class Gala.Focusable : Clutter.Actor {
8080
}
8181

8282
protected virtual bool move_focus (FocusDirection direction) {
83-
var children = get_focusable_children ();
83+
var children = get_widget_children ();
8484

8585
FocusUtils.filter_children_for_direction (children, get_stage ().key_focus, direction);
8686
FocusUtils.sort_children_for_direction (children, direction);
@@ -94,13 +94,13 @@ public class Gala.Focusable : Clutter.Actor {
9494
return false;
9595
}
9696

97-
private Gee.List<Focusable> get_focusable_children () {
98-
var focusable_children = new Gee.ArrayList<Focusable> ();
97+
private Gee.List<Widget> get_widget_children () {
98+
var widget_children = new Gee.ArrayList<Widget> ();
9999
for (var child = get_first_child (); child != null; child = child.get_next_sibling ()) {
100-
if (child is Focusable && child.visible) {
101-
focusable_children.add ((Focusable) child);
100+
if (child is Widget && child.visible) {
101+
widget_children.add ((Widget) child);
102102
}
103103
}
104-
return focusable_children;
104+
return widget_children;
105105
}
106106
}

lib/meson.build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ gala_lib_sources = files(
2626
'Utils.vala',
2727
'WindowIcon.vala',
2828
'WindowManager.vala',
29-
'Focusable/Focusable.vala',
30-
'Focusable/FocusController.vala',
31-
'Focusable/FocusUtils.vala',
3229
'Gestures/ActorTarget.vala',
3330
'Gestures/Gesture.vala',
3431
'Gestures/GestureBackend.vala',
@@ -41,7 +38,10 @@ gala_lib_sources = files(
4138
'Gestures/SpringTimeline.vala',
4239
'Gestures/ToucheggBackend.vala',
4340
'Gestures/TouchpadBackend.vala',
44-
'Gestures/WorkspaceHideTracker.vala'
41+
'Gestures/WorkspaceHideTracker.vala',
42+
'Widget/FocusController.vala',
43+
'Widget/FocusUtils.vala',
44+
'Widget/Widget.vala',
4545
) + gala_common_enums
4646

4747
gala_resources = gnome.compile_resources(

src/Widgets/MultitaskingView/MonitorClone.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* as the WindowGroup is hidden while the view is active. Only used when
1212
* workspaces-only-on-primary is set to true.
1313
*/
14-
public class Gala.MonitorClone : ActorTarget {
14+
public class Gala.MonitorClone : Widget {
1515
public signal void window_selected (Meta.Window window);
1616

1717
public WindowManager wm { get; construct; }

src/Widgets/MultitaskingView/MultitaskingView.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* preparing the wm, opening the components and holds containers for
2121
* the icon groups, the WorkspaceClones and the MonitorClones.
2222
*/
23-
public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableComponent {
23+
public class Gala.MultitaskingView : Widget, RootTarget, ActivatableComponent {
2424
public const int ANIMATION_DURATION = 250;
2525

2626
private GestureController workspaces_gesture_controller;
@@ -35,7 +35,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
3535

3636
private List<MonitorClone> window_containers_monitors;
3737

38-
private ActorTarget workspaces;
38+
private Widget workspaces;
3939
private Clutter.Actor primary_monitor_container;
4040
private Clutter.BrightnessContrastEffect brightness_effect;
4141
private BackgroundManager? blurred_bg = null;
@@ -81,7 +81,7 @@ public class Gala.MultitaskingView : ActorTarget, RootTarget, ActivatableCompone
8181
// Create a child container that will be sized to fit the primary monitor, to contain the "main"
8282
// multitasking view UI. The Clutter.Actor of this class has to be allowed to grow to the size of the
8383
// stage as it contains MonitorClones for each monitor.
84-
primary_monitor_container = new ActorTarget ();
84+
primary_monitor_container = new Widget ();
8585
primary_monitor_container.add_child (workspaces);
8686
add_child (primary_monitor_container);
8787

src/Widgets/MultitaskingView/StaticWindowClone.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* windows (e.g. on all workspaces or moving) and fades out while the multitasking view
1111
* is being opened.
1212
*/
13-
public class Gala.StaticWindowClone : ActorTarget {
13+
public class Gala.StaticWindowClone : Widget {
1414
public Meta.Window window { get; construct; }
1515

1616
public StaticWindowClone (Meta.Window window) {

src/Widgets/MultitaskingView/StaticWindowContainer.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* The window container use this to know whether a window became static (they shouldn't show it anymore)
1010
* or isn't static anymore (they have to show it now).
1111
*/
12-
public class Gala.StaticWindowContainer : ActorTarget {
12+
public class Gala.StaticWindowContainer : Widget {
1313
private static GLib.Once<StaticWindowContainer> instance;
1414
public static StaticWindowContainer get_instance (Meta.Display display) {
1515
return instance.once (() => new StaticWindowContainer (display));

src/Widgets/MultitaskingView/WindowClone.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* A container for a clone of the texture of a MetaWindow, a WindowIcon, a Tooltip with the title,
99
* a close button and a shadow. Used together with the WindowCloneContainer.
1010
*/
11-
public class Gala.WindowClone : ActorTarget, RootTarget {
11+
public class Gala.WindowClone : Widget, RootTarget {
1212
public enum Mode {
1313
MULTITASKING_VIEW,
1414
OVERVIEW,

0 commit comments

Comments
 (0)