Skip to content
12 changes: 12 additions & 0 deletions lib/CloseButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ public class Gala.CloseButton : Clutter.Actor {
public float monitor_scale { get; construct set; }

private Icon icon;
#if HAS_MUTTER49
private Clutter.ClickGesture click_action;
#else
private Clutter.ClickAction click_action;
#endif

public CloseButton (float monitor_scale) {
Object (monitor_scale: monitor_scale);
Expand All @@ -28,9 +32,17 @@ public class Gala.CloseButton : Clutter.Actor {
};
add_child (icon);

#if HAS_MUTTER49
click_action = new Clutter.ClickGesture ();
#else
click_action = new Clutter.ClickAction ();
#endif
add_action (click_action);
#if HAS_MUTTER49
click_action.recognize.connect (on_clicked);
#else
click_action.clicked.connect (on_clicked);
#endif
click_action.notify["pressed"].connect (on_pressed_changed);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/DragDropAction.vala
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace Gala {
clicked = false;
dragging = true;

grab_actor (handle, event.get_device ());
grab_actor (handle, event.get_source_device ());

var source_list = sources.@get (drag_id);
if (source_list != null) {
Expand Down Expand Up @@ -316,7 +316,7 @@ namespace Gala {
}

private bool on_event (Clutter.Event event) requires (dragging) {
var device = event.get_device ();
var device = event.get_source_device ();

if (grabbed_device != null &&
device != grabbed_device &&
Expand Down
2 changes: 1 addition & 1 deletion lib/Gestures/TouchpadBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private class Gala.TouchpadBackend : Object, GestureBackend {

gesture.type = event.get_type ();
gesture.fingers = (int) event.get_touchpad_gesture_finger_count ();
gesture.performed_on_device_type = event.get_device ().get_device_type ();
gesture.performed_on_device_type = event.get_source_device ().get_device_type ();

if (!on_gesture_detected (gesture, event.get_time ())) {
if (state == NONE) {
Expand Down
4 changes: 4 additions & 0 deletions src/BackgroundBlurEffect.vala
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ public class Gala.BackgroundBlurEffect : Clutter.Effect {
Mtk.Rectangle stage_view_layout = {};

box_scale_factor = stage_view.get_scale ();
#if HAS_MUTTER49
stage_view.get_layout (stage_view_layout);
#else
stage_view.get_layout (ref stage_view_layout);
#endif

origin_x -= stage_view_layout.x;
origin_y -= stage_view_layout.y;
Expand Down
32 changes: 32 additions & 0 deletions src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public class Gala.HideTracker : Object {

private static GLib.Settings behavior_settings;

#if HAS_MUTTER49
private Clutter.PanGesture pan_action;
#else
private Clutter.PanAction pan_action;
#endif

private bool hovered = false;

Expand Down Expand Up @@ -61,12 +65,22 @@ public class Gala.HideTracker : Object {

display.window_created.connect (on_window_created);

#if HAS_MUTTER49
pan_action = new Clutter.PanGesture () {
min_n_points = 1,
max_n_points = 1,
pan_axis = Clutter.PanAxis.X
};
pan_action.may_recognize.connect (check_valid_gesture);
pan_action.pan_update.connect (on_pan);
#else
pan_action = new Clutter.PanAction () {
n_touch_points = 1,
pan_axis = X_AXIS
};
pan_action.gesture_begin.connect (check_valid_gesture);
pan_action.pan.connect (on_pan);
#endif

#if HAS_MUTTER48
display.get_compositor ().get_stage ().add_action_full ("panel-swipe-gesture", CAPTURE, pan_action);
Expand Down Expand Up @@ -136,7 +150,11 @@ public class Gala.HideTracker : Object {
}

float y;
#if HAS_MUTTER49
y = pan_action.get_point_begin_coords (0).y;
#else
pan_action.get_press_coords (0, null, out y);
#endif

var monitor_geom = display.get_monitor_geometry (panel.window.get_monitor ());
if ((y - monitor_geom.y - monitor_geom.height).abs () < 50) { // Only start if the gesture starts near the bottom of the monitor
Expand All @@ -146,16 +164,30 @@ public class Gala.HideTracker : Object {
return false;
}

#if HAS_MUTTER49
private void on_pan () {
#else
private bool on_pan () {
#endif
float delta_y;
#if HAS_MUTTER49
delta_y = pan_action.get_delta ().get_y ();
#else
pan_action.get_motion_delta (0, null, out delta_y);
#endif

if (delta_y < 0) { // Only allow swipes upwards
#if HAS_MUTTER49
panel.window.focus (pan_action.get_point_event (0).get_time ());
#else
panel.window.focus (pan_action.get_last_event (0).get_time ());
#endif
trigger_show ();
}

#if !HAS_MUTTER49
return false;
#endif
}

private void setup_barrier () {
Expand Down
6 changes: 6 additions & 0 deletions src/Widgets/MultitaskingView/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ public class Gala.WindowClone : ActorTarget, RootTarget {
window.size_changed.connect (() => request_reposition ());

if (mode != MULTITASKING_VIEW) {
#if HAS_MUTTER49
var click_action = new Clutter.ClickGesture ();
click_action.recognize.connect ((action) => {
actor_clicked (((Clutter.PressGesture)action).get_button ());
#else
var click_action = new Clutter.ClickAction ();
click_action.clicked.connect ((action, actor) => {
actor_clicked (action.get_button ());
#endif
});

add_action (click_action);
Expand Down
5 changes: 5 additions & 0 deletions src/Widgets/MultitaskingView/WorkspaceClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ public class Gala.WorkspaceClone : ActorTarget {
unowned var display = workspace.get_display ();
var monitor_geometry = display.get_monitor_geometry (display.get_primary_monitor ());

#if HAS_MUTTER49
var background_click_action = new Clutter.ClickGesture ();
background_click_action.recognize.connect (() => activate (true));
#else
var background_click_action = new Clutter.ClickAction ();
background_click_action.clicked.connect (() => activate (true));
#endif
background = new FramedBackground (display);
background.add_action (background_click_action);

Expand Down
4 changes: 3 additions & 1 deletion src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -754,8 +754,10 @@ namespace Gala {
event.get_type () == TOUCHPAD_HOLD || event.get_type () == TOUCH_BEGIN) {
window.begin_grab_op (
op,
event.get_device (),
null,
#if !HAS_MUTTER49
event.get_event_sequence (),
#endif
event.get_time ()
#if HAS_MUTTER46
, null
Expand Down
4 changes: 0 additions & 4 deletions vapi/Clutter-17.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ TouchpadHoldEvent struct=false base_type="Clutter.Event"
TouchpadPinchEvent struct=false base_type="Clutter.Event"
TouchpadSwipeEvent struct=false base_type="Clutter.Event"

Focus skip
KeyFocus skip
Sprite skip

// Keysyms used to be CLUTTER_X instead of CLUTTER_KEY_X
*#constant skip
CURRENT_TIME skip=false
Expand Down
28 changes: 26 additions & 2 deletions vapi/libmutter.vapi
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,16 @@ namespace Meta {
[CCode (has_construct_function = false)]
protected OrientationManager ();
public Meta.Orientation get_orientation ();
#if HAS_MUTTER49
public void inhibit_tracking ();
public void uninhibit_tracking ();
#endif
[NoAccessorMethod]
public bool has_accelerometer { get; }
public signal void orientation_changed ();
#if HAS_MUTTER49
public signal void sensor_active ();
#endif
}
#endif
[CCode (cheader_filename = "meta/meta-plugin.h", type_id = "meta_plugin_get_type ()")]
Expand Down Expand Up @@ -939,6 +946,11 @@ namespace Meta {
[CCode (has_construct_function = false)]
#if HAS_MUTTER49
protected WaylandClient ();
#if VALA_0_56_17
public pid_t get_pid ();
#else
public int get_pid ();
#endif
public unowned GLib.Subprocess get_subprocess ();
#else
public WaylandClient (Meta.Context context, GLib.SubprocessLauncher launcher) throws GLib.Error;
Expand Down Expand Up @@ -991,7 +1003,9 @@ namespace Meta {
public void activate_with_workspace (uint32 current_time, Meta.Workspace workspace);
public bool allows_move ();
public bool allows_resize ();
#if HAS_MUTTER46
#if HAS_MUTTER49
public bool begin_grab_op (Meta.GrabOp op, Clutter.Sprite? sprite, uint32 timestamp, Graphene.Point? pos_hint);
#elif HAS_MUTTER46
public bool begin_grab_op (Meta.GrabOp op, Clutter.InputDevice? device, Clutter.EventSequence? sequence, uint32 timestamp, Graphene.Point? pos_hint);
#else
public bool begin_grab_op (Meta.GrabOp op, Clutter.InputDevice? device, Clutter.EventSequence? sequence, uint32 timestamp);
Expand Down Expand Up @@ -1048,7 +1062,9 @@ namespace Meta {
public bool get_icon_geometry (out Mtk.Rectangle rect);
public uint64 get_id ();
public Meta.StackLayer get_layer ();
#if !HAS_MUTTER49
#if HAS_MUTTER49
public Meta.MaximizeFlags get_maximize_flags ();
#else
public Meta.MaximizeFlags get_maximized ();
#endif
public int get_monitor ();
Expand Down Expand Up @@ -1133,7 +1149,9 @@ namespace Meta {
public void set_demands_attention ();
public void set_icon_geometry (Mtk.Rectangle? rect);
#if HAS_MUTTER49
public void set_maximize_flags (Meta.MaximizeFlags directions);
public void set_type (Meta.WindowType type);
public void set_unmaximize_flags (Meta.MaximizeFlags directions);
public void show_in_window_list ();
#endif
#if !HAS_MUTTER47
Expand Down Expand Up @@ -1587,6 +1605,9 @@ namespace Meta {
#if HAS_MUTTER47
SYNC_CURSOR_PRIMARY,
DISABLE_DIRECT_SCANOUT,
#endif
#if HAS_MUTTER49
IGNORE_COLOR_STATE_FOR_DIRECT_SCANOUT,
#endif
OPAQUE_REGION
}
Expand Down Expand Up @@ -2076,6 +2097,9 @@ namespace Meta {
NORMAL,
DOCKS,
GROUP,
#if HAS_MUTTER49
NORMAL_ALL_MRU,
#endif
NORMAL_ALL
}
[CCode (cheader_filename = "meta/display.h", cprefix = "META_TAB_SHOW_", type_id = "meta_tab_show_type_get_type ()")]
Expand Down
Loading