mirror of
https://github.com/elementary/gala.git
synced 2024-12-19 23:32:02 +03:00
Improve focusing behavior
This commit is contained in:
parent
93c107a032
commit
13517837c7
@ -25,7 +25,7 @@ namespace Gala
|
|||||||
WindowSwitcher winswitcher;
|
WindowSwitcher winswitcher;
|
||||||
WorkspaceView workspace_view;
|
WorkspaceView workspace_view;
|
||||||
|
|
||||||
Window? moving; //place for the window that is being moved over
|
internal Window? moving; //place for the window that is being moved over
|
||||||
|
|
||||||
int modal_count = 0; //count of modal modes overlaying each other
|
int modal_count = 0; //count of modal modes overlaying each other
|
||||||
|
|
||||||
@ -149,17 +149,17 @@ namespace Gala
|
|||||||
var display = screen.get_display ();
|
var display = screen.get_display ();
|
||||||
|
|
||||||
var active = screen.get_active_workspace ();
|
var active = screen.get_active_workspace ();
|
||||||
var idx = active.index () + (reverse ? -1 : 1);
|
var next = active.get_neighbor (reverse ? MotionDirection.LEFT : MotionDirection.RIGHT);
|
||||||
|
|
||||||
if (idx < 0 || idx >= screen.n_workspaces ||
|
//dont allow empty workspaces to be created by moving
|
||||||
(active.n_windows == 1 && idx == screen.n_workspaces-1)) //dont allow empty workspaces to be created by moving
|
if (active.n_windows == 1 && next.index () == screen.n_workspaces - 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!window.is_on_all_workspaces ())
|
if (!window.is_on_all_workspaces ())
|
||||||
window.change_workspace_by_index (idx, true, display.get_current_time ());
|
window.change_workspace (next);
|
||||||
|
|
||||||
moving = window;
|
moving = window;
|
||||||
screen.get_workspace_by_index (idx).activate_with_focus (window, display.get_current_time ());
|
next.activate_with_focus (window, display.get_current_time ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void begin_modal ()
|
public new void begin_modal ()
|
||||||
@ -647,16 +647,19 @@ namespace Gala
|
|||||||
|
|
||||||
switch_workspace_completed ();
|
switch_workspace_completed ();
|
||||||
|
|
||||||
moving = null;
|
var focus = display.get_focus_window ();
|
||||||
|
if (focus != null && focus.window_type == WindowType.DOCK) {
|
||||||
var focus = display.get_tab_current (Meta.TabList.NORMAL, screen, screen.get_active_workspace ());
|
if (moving != null)
|
||||||
// Only switch focus to the next window if none has grabbed it already
|
moving.activate (display.get_current_time ());
|
||||||
if (focus == null) {
|
else {
|
||||||
focus = Utils.get_next_window (screen.get_active_workspace ());
|
focus = Utils.get_next_window (screen.get_active_workspace ());
|
||||||
if (focus != null)
|
if (focus != null)
|
||||||
focus.activate (display.get_current_time ());
|
focus.activate (display.get_current_time ());
|
||||||
}
|
}
|
||||||
|
} else if (moving != null)
|
||||||
|
moving.activate (display.get_current_time ());
|
||||||
|
|
||||||
|
moving = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void kill_switch_workspace ()
|
public override void kill_switch_workspace ()
|
||||||
|
@ -212,13 +212,13 @@ namespace Gala
|
|||||||
switch (event.keyval) {
|
switch (event.keyval) {
|
||||||
case Clutter.Key.Left:
|
case Clutter.Key.Left:
|
||||||
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) == 1)
|
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) == 1)
|
||||||
plugin.move_window (screen.get_display ().get_focus_window (), true);
|
plugin.move_window ((plugin.moving == null)?screen.get_display ().get_focus_window ():plugin.moving, true);
|
||||||
else
|
else
|
||||||
switch_to_next_workspace (true);
|
switch_to_next_workspace (true);
|
||||||
return false;
|
return false;
|
||||||
case Clutter.Key.Right:
|
case Clutter.Key.Right:
|
||||||
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) == 1)
|
if ((event.modifier_state & Clutter.ModifierType.SHIFT_MASK) == 1)
|
||||||
plugin.move_window (screen.get_display ().get_focus_window (), false);
|
plugin.move_window ((plugin.moving == null)?screen.get_display ().get_focus_window ():plugin.moving, false);
|
||||||
else
|
else
|
||||||
switch_to_next_workspace (false);
|
switch_to_next_workspace (false);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user