コード例 #1
0
        public void UpdateWindow(IWindow window, WindowUpdateType type)
        {
            if (_windowsToWorkspaces.ContainsKey(window))
            {
                Logger.Trace("UpdateWindow({0})", window);
                var workspace = _windowsToWorkspaces[window];
                if (window.IsFocused)
                {
                    var monitor = _context.WorkspaceContainer.GetCurrentMonitorForWorkspace(workspace);
                    if (monitor != null)
                    {
                        _context.MonitorContainer.FocusedMonitor = monitor;
                    }
                    else
                    {
                        if (type == WindowUpdateType.Foreground)
                        {
                            // TODO: show flash for workspace (in bar?)
                            Logger.Trace("workspace.IsIndicating = true for workspace {0}", workspace);
                            workspace.IsIndicating = true;
                            WorkspaceUpdated?.Invoke();
                        }
                    }

                    if (type == WindowUpdateType.Move)
                    {
                        TrySwapWindowToMouse(window);
                    }
                    _windowsToWorkspaces[window].UpdateWindow(window, type);
                    WindowUpdated?.Invoke(window, workspace);
                }
            }
        }
コード例 #2
0
        public void SwitchToWorkspace(IWorkspace targetWorkspace)
        {
            Logger.Debug("SwitchToWorkspace({0})", targetWorkspace);
            if (targetWorkspace != null)
            {
                var focusedMonitor   = _context.MonitorContainer.FocusedMonitor;
                var destMonitor      = _context.WorkspaceContainer.GetDesiredMonitorForWorkspace(targetWorkspace) ?? focusedMonitor;
                var currentWorkspace = _context.WorkspaceContainer.GetWorkspaceForMonitor(destMonitor);
                var sourceMonitor    = _context.WorkspaceContainer.GetCurrentMonitorForWorkspace(targetWorkspace);

                if (targetWorkspace != currentWorkspace)
                {
                    _lastWorkspace = currentWorkspace;
                    _context.WorkspaceContainer.AssignWorkspaceToMonitor(currentWorkspace, sourceMonitor);
                    _context.WorkspaceContainer.AssignWorkspaceToMonitor(targetWorkspace, destMonitor);

                    currentWorkspace.DoLayout();
                    targetWorkspace.DoLayout();

                    WorkspaceUpdated?.Invoke();

                    targetWorkspace.FocusLastFocusedWindow();
                }
            }
        }
コード例 #3
0
        public void SwitchToPreviousWorkspace()
        {
            Logger.Debug("SwitchToPreviousWorkspace");
            var destMonitor      = _context.MonitorContainer.FocusedMonitor;
            var currentWorkspace = _context.WorkspaceContainer.GetWorkspaceForMonitor(destMonitor);
            var targetWorkspace  = _context.WorkspaceContainer.GetPreviousWorkspace(currentWorkspace);
            var sourceMonitor    = _context.WorkspaceContainer.GetCurrentMonitorForWorkspace(targetWorkspace);

            _context.WorkspaceContainer.AssignWorkspaceToMonitor(currentWorkspace, sourceMonitor);
            _context.WorkspaceContainer.AssignWorkspaceToMonitor(targetWorkspace, destMonitor);

            currentWorkspace.DoLayout();
            targetWorkspace.DoLayout();

            WorkspaceUpdated?.Invoke();

            targetWorkspace.FocusLastFocusedWindow();
        }
コード例 #4
0
        public static INotification ToEvent(this EntityEntry entry)
        {
            Type          type = entry.Entity.GetType();
            INotification evt  = null;

            if (type == typeof(Directory))
            {
                evt = new DirectoryUpdated(((Directory)entry.Entity).Id);
            }
            else if (type == typeof(Workspace))
            {
                evt = new WorkspaceUpdated(((Workspace)entry.Entity).Id);
            }
            else if (type == typeof(File))
            {
                evt = new FileUpdated(((File)entry.Entity).Id, true);
            }

            return(evt);
        }
コード例 #5
0
        public void SwitchMonitorToWorkspace(int monitorIndex, int workspaceIndex)
        {
            Logger.Debug("SwitchMonitorToWorkspace(monitorIndex: {0}, workspaceIndex: {1})", monitorIndex, workspaceIndex);
            if (monitorIndex >= _context.MonitorContainer.NumMonitors)
            {
                return;
            }

            var destMonitor      = _context.MonitorContainer.GetMonitorAtIndex(monitorIndex);
            var currentWorkspace = _context.WorkspaceContainer.GetWorkspaceForMonitor(destMonitor);
            var targetWorkspace  = _context.WorkspaceContainer.GetWorkspaceAtIndex(currentWorkspace, workspaceIndex);
            var sourceMonitor    = _context.WorkspaceContainer.GetCurrentMonitorForWorkspace(targetWorkspace);

            _context.WorkspaceContainer.AssignWorkspaceToMonitor(currentWorkspace, sourceMonitor);
            _context.WorkspaceContainer.AssignWorkspaceToMonitor(targetWorkspace, destMonitor);

            currentWorkspace.DoLayout();
            targetWorkspace.DoLayout();

            WorkspaceUpdated?.Invoke();

            targetWorkspace.FocusLastFocusedWindow();
        }
コード例 #6
0
 public void ForceWorkspaceUpdate()
 {
     WorkspaceUpdated?.Invoke();
 }
 public override void Start()
 {
     WorkspaceUpdated?.Invoke(Client, Request.Updates);
 }
コード例 #8
0
 private void SendWorkspaceUpdatedRequestAction_WorkspaceUpdated(IClient pClient, List <WorkspaceUpdatedEventArgs> pUpdates)
 {
     WorkspaceUpdated?.Invoke(pClient, pUpdates);
 }
コード例 #9
0
 private void Workspace_WorkspaceUpdated(object sender, List <WorkspaceUpdatedEventArgs> e)
 {
     WorkspaceUpdated?.Invoke(this, e);
 }