Skip to content

Commit

Permalink
Merge branch 'master' into fix-shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored Oct 27, 2023
2 parents 69a2c1e + e54f2bb commit 08864bd
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 44 deletions.
1 change: 1 addition & 0 deletions data/gala.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
<enum id="GestureSwipeHorizontal">
<value nick="none" value="0" />
<value nick="switch-to-workspace" value="1" />
<value nick="move-to-workspace" value="2" />
</enum>
<enum id="GestureSwipeUp">
<value nick="none" value="0" />
Expand Down
11 changes: 9 additions & 2 deletions data/gala.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,23 @@
<update_contact>contact_at_elementary.io</update_contact>

<releases>
<release version="7.1.3" date="2023-09-13" urgency="medium">
<release version="7.1.3" date="2023-09-29" urgency="medium">
<description>
<p>Improvements:</p>
<ul>
<li>Changing the wallpaper or going to sleep respects the "Reduce Motion" option</li>
<li>Use appropriate drag-and-drop pointers when moving windows</li>
<li>Updated translations</li>
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/gala/issues/1774">Scheduled switch to dark style does not dim the wallpaper after cold reboot on elementary OS 7.1</issue>
<issue url="https://github.com/elementary/gala/issues/506">After login there is always 2 unpopulated workspaces open.</issue>
<issue url="https://github.com/elementary/gala/issues/695">Wrong workspaces behavior</issue>
<issue url="https://github.com/elementary/gala/issues/1109">Use gestures for "move to workspace"</issue>
<issue url="https://github.com/elementary/gala/issues/1261">Alt + Shift unnecessarily blocked when there is only one keyboard layout</issue>
<issue url="https://github.com/elementary/gala/discussions/1764">Counter Strike 2 causes segfault in libmutter on exit</issue>
<issue url="https://github.com/elementary/gala/issues/1774">Scheduled switch to dark style does not dim the wallpaper after cold reboot on elementary OS 7.1</issue>
<issue url="https://github.com/elementary/gala/issues/1783">Notifications appear in the middle of the screen</issue>
</issues>
</release>

Expand Down
7 changes: 7 additions & 0 deletions plugins/pip/PopupWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,15 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
}

private Clutter.Actor on_move_begin () {
wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}

private void on_move_end () {
reactive = true;
update_screen_position ();
wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

#if HAS_MUTTER45
Expand All @@ -244,6 +247,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
grab = resize_button.get_stage ().grab (resize_button);
resize_button.event.connect (on_resize_event);

wm.get_display ().set_cursor (Meta.Cursor.SE_RESIZE);

return Clutter.EVENT_PROPAGATE;
}

Expand Down Expand Up @@ -302,6 +307,8 @@ public class Gala.Plugins.PIP.PopupWindow : Clutter.Actor {
resizing = false;

update_screen_position ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void on_allocation_changed () {
Expand Down
14 changes: 7 additions & 7 deletions src/Background/BackgroundContainer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace Gala {
public signal void changed ();
public signal void show_background_menu (int x, int y);

public Meta.Display display { get; construct; }
public WindowManager wm { get; construct; }

public BackgroundContainer (Meta.Display display) {
Object (display: display);
public BackgroundContainer (WindowManager wm) {
Object (wm: wm);
}

construct {
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.connect (update);

reactive = true;
Expand All @@ -43,7 +43,7 @@ namespace Gala {
}

~BackgroundContainer () {
unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager ();
monitor_manager.monitors_changed.disconnect (update);
}

Expand All @@ -54,8 +54,8 @@ namespace Gala {

destroy_all_children ();

for (var i = 0; i < display.get_n_monitors (); i++) {
var background = new BackgroundManager (display, i);
for (var i = 0; i < wm.get_display ().get_n_monitors (); i++) {
var background = new BackgroundManager (wm, i);

add_child (background);

Expand Down
12 changes: 7 additions & 5 deletions src/Background/BackgroundManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ namespace Gala {

public signal void changed ();

public Meta.Display display { get; construct; }
public WindowManager wm { get; construct; }
public int monitor_index { get; construct; }
public bool control_position { get; construct; }

private BackgroundSource background_source;
private Meta.BackgroundActor background_actor;
private Meta.BackgroundActor? new_background_actor = null;

public BackgroundManager (Meta.Display display, int monitor_index, bool control_position = true) {
Object (display: display, monitor_index: monitor_index, control_position: control_position);
public BackgroundManager (WindowManager wm, int monitor_index, bool control_position = true) {
Object (wm: wm, monitor_index: monitor_index, control_position: control_position);
}

construct {
background_source = BackgroundCache.get_default ().get_background_source (display);
background_source = BackgroundCache.get_default ().get_background_source (wm.get_display ());
background_actor = create_background_actor ();

destroy.connect (on_destroy);
Expand Down Expand Up @@ -66,7 +66,7 @@ namespace Gala {
if (old_background_actor == null)
return;

if (animate) {
if (animate && wm.enable_animations) {
var transition = new Clutter.PropertyTransition ("opacity");
transition.set_from_value (255);
transition.set_to_value (0);
Expand Down Expand Up @@ -125,6 +125,8 @@ namespace Gala {
}

private Meta.BackgroundActor create_background_actor () {
unowned var display = wm.get_display ();

var background = background_source.get_background (monitor_index);
var background_actor = new Meta.BackgroundActor (display, monitor_index);

Expand Down
2 changes: 1 addition & 1 deletion src/NotificationStack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class Gala.NotificationStack : Object {
update_stack_allocation ();
}

public void show_notification (Meta.WindowActor notification, bool animate) {
public void show_notification (Meta.WindowActor notification, bool animate) requires (!notifications.contains (notification)) {
notification.set_pivot_point (0.5f, 0.5f);

unowned Meta.Window window = notification.get_meta_window ();
Expand Down
6 changes: 6 additions & 0 deletions src/Widgets/IconGroup.vala
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ namespace Gala {
// disable reactivity so that workspace thumbs can get events
reactive = false;

wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}

Expand All @@ -534,11 +536,15 @@ namespace Gala {
} else {
drag_canceled ();
}

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void drag_canceled () {
get_parent ().remove_child (this);
restore_group ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void restore_group () {
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/MonitorClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace Gala {
construct {
reactive = true;

background = new BackgroundManager (display, monitor, false);
background = new BackgroundManager (wm, monitor, false);

var scale = display.get_monitor_scale (monitor);

Expand Down
8 changes: 8 additions & 0 deletions src/Widgets/WindowClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,8 @@ public class Gala.WindowClone : Clutter.Actor {
close_button.opacity = 0;
window_title.opacity = 0;

wm.get_display ().set_cursor (Meta.Cursor.DND_IN_DRAG);

return this;
}

Expand Down Expand Up @@ -726,6 +728,8 @@ public class Gala.WindowClone : Clutter.Actor {
icon_group.remove_window (window, false);
}
}

wm.get_display ().set_cursor (hovered ? Meta.Cursor.DND_MOVE: Meta.Cursor.DND_IN_DRAG);
}

/**
Expand Down Expand Up @@ -799,6 +803,8 @@ public class Gala.WindowClone : Clutter.Actor {
// if we're dropped at the place where we came from interpret as cancel
drag_canceled ();
}

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

/**
Expand Down Expand Up @@ -826,6 +832,8 @@ public class Gala.WindowClone : Clutter.Actor {

set_window_icon_position (slot.width, slot.height, monitor_scale_factor);
window_icon.restore_easing_state ();

wm.get_display ().set_cursor (Meta.Cursor.DEFAULT);
}

private void set_window_icon_position (float window_width, float window_height, float scale_factor, bool aligned = true) {
Expand Down
14 changes: 9 additions & 5 deletions src/Widgets/WorkspaceClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ namespace Gala {
private int last_width;
private int last_height;

public FramedBackground (Meta.Display display) {
Object (display: display, monitor_index: display.get_primary_monitor (), control_position: false);
public FramedBackground (WindowManager wm) {
Object (
wm: wm,
monitor_index: wm.get_display ().get_primary_monitor (),
control_position: false
);
}

construct {
pipeline = new Cogl.Pipeline (Clutter.get_default_backend ().get_cogl_context ());
var primary = display.get_primary_monitor ();
var monitor_geom = display.get_monitor_geometry (primary);
var primary = wm.get_display ().get_primary_monitor ();
var monitor_geom = wm.get_display ().get_monitor_geometry (primary);

var effect = new ShadowEffect (40) {
css_class = "workspace"
Expand Down Expand Up @@ -175,7 +179,7 @@ namespace Gala {
background_click_action.clicked.connect (() => {
selected (true);
});
background = new FramedBackground (display);
background = new FramedBackground (wm);
background.add_action (background_click_action);

window_container = new WindowCloneContainer (wm, gesture_tracker, scale_factor);
Expand Down
41 changes: 35 additions & 6 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ namespace Gala {
stage.remove_child (window_group);
ui_group.add_child (window_group);

background_group = new BackgroundContainer (display);
background_group = new BackgroundContainer (this);
((BackgroundContainer)background_group).show_background_menu.connect (on_show_background_menu);
window_group.add_child (background_group);
window_group.set_child_below_sibling (background_group, null);
Expand Down Expand Up @@ -531,16 +531,45 @@ namespace Gala {
return;
}

var can_handle_swipe = gesture.type == Clutter.EventType.TOUCHPAD_SWIPE &&
(gesture.direction == GestureDirection.LEFT || gesture.direction == GestureDirection.RIGHT);
var can_handle_swipe = (
gesture.type == Clutter.EventType.TOUCHPAD_SWIPE &&
(gesture.direction == GestureDirection.LEFT || gesture.direction == GestureDirection.RIGHT)
);

if (!can_handle_swipe) {
return;
}

var fingers = gesture.fingers;

var fingers = (gesture.fingers == 3 && GestureSettings.get_string ("three-finger-swipe-horizontal") == "switch-to-workspace") ||
(gesture.fingers == 4 && GestureSettings.get_string ("four-finger-swipe-horizontal") == "switch-to-workspace");
var three_finger_swipe_horizontal = GestureSettings.get_string ("three-finger-swipe-horizontal");
var four_finger_swipe_horizontal = GestureSettings.get_string ("four-finger-swipe-horizontal");

switch_workspace_with_gesture = can_handle_swipe && fingers;
var three_fingers_switch_to_workspace = fingers == 3 && three_finger_swipe_horizontal == "switch-to-workspace";
var four_fingers_switch_to_workspace = fingers == 4 && four_finger_swipe_horizontal == "switch-to-workspace";

var three_fingers_move_to_workspace = fingers == 3 && three_finger_swipe_horizontal == "move-to-workspace";
var four_fingers_move_to_workspace = fingers == 4 && four_finger_swipe_horizontal == "move-to-workspace";

switch_workspace_with_gesture = three_fingers_switch_to_workspace || four_fingers_switch_to_workspace;
if (switch_workspace_with_gesture) {
var direction = gesture_tracker.settings.get_natural_scroll_direction (gesture);
switch_to_next_workspace (direction);
return;
}

switch_workspace_with_gesture = three_fingers_move_to_workspace || four_fingers_move_to_workspace;
if (switch_workspace_with_gesture) {
unowned var display = get_display ();
unowned var manager = display.get_workspace_manager ();

var direction = gesture_tracker.settings.get_natural_scroll_direction (gesture);

moving = display.focus_window;
moving.change_workspace (manager.get_active_workspace ().get_neighbor (direction));

switch_to_next_workspace (direction);
return;
}
}

Expand Down
Loading

0 comments on commit 08864bd

Please sign in to comment.