Exemple #1
0
        /// <summary>
        /// Sends Clipboard's ClipboardChanged event to tray plugins.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="args">Event arguments.</param>
        private void OnClipboardChanged(object sender, ClipboardChangedArgs args)
        {
            if (Settings.Instance[Settings.Keys.Hotkeys.CopyMouse].AsBoolean())
            {
                this.StoreTemporaryMouseItem(args);
            }

            foreach (ITray tray in this.Trays)
            {
                tray.OnClipboardChanged(sender, args);
            }
        }
Exemple #2
0
        /// <summary>
        /// Stores temporary mouse item.
        /// </summary>
        /// <param name="args">Event arguments.</param>
        private void StoreTemporaryMouseItem(ClipboardChangedArgs args)
        {
            lock (this.mouseContentRestorationTimerLock)
            {
                if (args == null || args.Clipboard != Gdk.Selection.Primary)
                {
                    return;
                }

                if (!Clipboard.Instance.LockMouseClipboard)
                {
                    Clipboard.Instance.LockMouseClipboard = true;
                }

                if (this.ignoreTemporaryItem)
                {
                    this.ignoreTemporaryItem = false;
                    return;
                }

                if (args.OldValue == null || args.NewValue == null || args.OldValue.Text == args.NewValue.Text)
                {
                    return;
                }

                if (this.temporaryMouseItem != null && this.temporaryMouseItem.Text == args.OldValue.Text)
                {
                    return;
                }

                if (this.mouseContentRestorationTimer != null)
                {
                    this.mouseContentRestorationTimer = new Timer((o) =>
                    {
                        lock (this.mouseContentRestorationTimerLock)
                        {
                            Gtk.Application.Invoke((s, e) => Clipboard.Instance.SetAsMouseContent((Item)o));
                            this.mouseContentRestorationTimer.Dispose();
                            this.mouseContentRestorationTimer = null;
                        }
                    }, args.OldValue, 1000, Timeout.Infinite);
                }

                this.temporaryMouseItem = args.NewValue;
            }
        }
Exemple #3
0
 /// <summary>
 /// Handles Clipboard's ClipboardChanged event.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="args">Event arguments.</param>
 public void OnClipboardChanged(object sender, ClipboardChangedArgs args)
 {
     this.RefreshMenu();
 }
Exemple #4
0
 /// <summary>
 /// Handles Clipboard's ClipboardChanged event.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="args">Event arguments.</param>
 public void OnClipboardChanged(object sender, ClipboardChangedArgs args)
 {
 }