Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
feat(tile): optimize windows filter
Browse files Browse the repository at this point in the history
Change-Id: I6240d5eabed2f046f1457ffb96ca4d3ae01c9eb2
  • Loading branch information
sonald committed Apr 17, 2018
1 parent d1c077b commit 0d8a614
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
26 changes: 16 additions & 10 deletions src/Deepin/DeepinTileSelector.vala
Expand Up @@ -140,14 +140,17 @@ namespace Gala
return;
}

//TODO: what if tile_target is not the active workspace and the same monitor
if (tile_target == null)
return;

var target_window = (tile_target as WindowActor).get_meta_window ();
var target_rect = target_window.get_frame_rect ();

var used_windows = new SList<Window> ();
foreach (var window in screen.get_active_workspace ().list_windows ()) {
var actor = window.get_compositor_private () as WindowActor;

//TODO: check tilable window
if (window.window_type != WindowType.NORMAL &&
window.window_type != WindowType.DOCK) {
if (actor != null) {
Expand All @@ -159,11 +162,19 @@ namespace Gala
if (actor == tile_target)
continue;

if (window.window_type == WindowType.DOCK)
if (window.window_type == WindowType.DOCK || window.is_on_all_workspaces ())
continue;

if (window.is_on_all_workspaces ())
if (!window.can_tile_side_by_side () ||
window.is_shaded () ||
window.is_fullscreen () ||
window.get_maximized () == Meta.MaximizeFlags.BOTH ||
window.get_monitor () != target_window.get_monitor ()) {
if (actor != null) {
actor.hide ();
}
continue;
}

used_windows.append (window);
}
Expand All @@ -189,15 +200,10 @@ namespace Gala
target_workspace = screen.get_active_workspace ();
target_workspace.window_removed.connect (remove_window);

var target_window = (tile_target as WindowActor).get_meta_window ();
var target_rect = target_window.get_frame_rect ();

var geometry = target_window.get_work_area_current_monitor ();

target_side = TileSide.LEFT;
if (target_rect.x - geometry.x >= geometry.width/2) {
target_side = TileSide.RIGHT;
}
target_side = target_window.get_tile_mode ();
assert (target_side == TileSide.LEFT || target_side == TileSide.RIGHT);

container = new DeepinWindowFlowContainer (target_workspace);
container.padding_top = TOP_GAP;
Expand Down
6 changes: 5 additions & 1 deletion vapi/libdeepin-mutter.vapi
Expand Up @@ -655,6 +655,7 @@ namespace Meta {
public bool can_maximize ();
public bool can_minimize ();
public bool can_shade ();
public bool can_tile_side_by_side ();
public void change_workspace (Meta.Workspace workspace);
public void change_workspace_by_index (int space_index, bool append);
public void check_alive (uint32 timestamp);
Expand Down Expand Up @@ -730,6 +731,7 @@ namespace Meta {
public bool is_skip_taskbar ();
public void kill ();
public void tile_by_side (TileSide side);
public TileSide get_tile_mode ();
public void begin_to_move ();
public bool located_on_workspace (Meta.Workspace workspace);
public void lower ();
Expand Down Expand Up @@ -1065,7 +1067,9 @@ namespace Meta {
IS_FLASHING,
ABOVE,
TILED_LEFT,
TILED_RIGHT
TILED_RIGHT,
ALLOWS_TILED_RESIZE_LEFT,
ALLOWS_TILED_RESIZE_RIGHT,
}
[CCode (cheader_filename = "meta/common.h", cprefix = "META_FRAME_TYPE_", type_id = "meta_frame_type_get_type ()")]
public enum FrameType {
Expand Down

0 comments on commit 0d8a614

Please sign in to comment.