Пример #1
0
        /// <summary> Handle the Motion event. </summary>
        /// <param name="source"> The widget, the Motion event is assigned to. <see cref="XrwRectObj"/> </param>
        /// <param name="e"> The event data. <see cref="XMotionEvent"/> </param>
        /// <remarks> Set XrwMotionEvent. Set result to nonzero to stop further event processing. </remarks>
        void HandleMotionDefault(XrwRectObj source, XrwMotionEvent e)
        {
            // Determine pranslated position.
            TPoint translatedPosition = new TPoint(0, 0);

            // Anywhere on the way from GNOME 2.3.0 to 3.6.2 the values x_root and y_root habe been fixed.
            if (e.Event.x_root > e.Event.x && e.Event.y_root > e.Event.y)
            {
                translatedPosition.X = e.Event.x_root;
                translatedPosition.Y = e.Event.y_root;
            }
            else
            {
                translatedPosition.X = e.Event.x;
                translatedPosition.Y = e.Event.y;
            }

            translatedPosition.X -= _assignedPosition.X;
            translatedPosition.Y -= _assignedPosition.Y;

            X11lib.XWindowAttributes menuShellAttributes = new X11lib.XWindowAttributes();
            if (this.GetWindowAttributes(ref menuShellAttributes) == true)
            {
                translatedPosition.X -= (int)menuShellAttributes.x;
                translatedPosition.Y -= (int)menuShellAttributes.y;
            }
            else
            {
                Console.WriteLine(CLASS_NAME + "::HandleButtonPress () ERROR: Unable to determine window attributes.");
            }

            for (int countChildren = 0; countChildren < _children.Count; countChildren++)
            {
                XrwSme sme = _children[countChildren] as XrwSme;
                if (sme != null)
                {
                    if (translatedPosition.X > sme._assignedPosition.X && translatedPosition.Y > sme._assignedPosition.Y &&
                        translatedPosition.X < sme._assignedPosition.X + sme._assignedSize.Width && translatedPosition.Y < sme._assignedPosition.Y + sme._assignedSize.Height)
                    {
                        if (sme.Focused != true)
                        {
                            sme.Focused = true;
                            XrwObject.SendExposeEvent(_display, sme.Window, Parent.Window);
                        }
                    }
                    else
                    {
                        if (sme.Focused != false)
                        {
                            sme.Focused = false;
                            XrwObject.SendExposeEvent(_display, sme.Window, Parent.Window);
                        }
                    }
                }
            }
            e.Result = 1;
        }
Пример #2
0
        /// <summary> Hide the widget and unmap the window (if any). </summary>
        public override void Hide()
        {
            for (int countChildren = 0; countChildren < _children.Count; countChildren++)
            {
                XrwSme sme = _children[countChildren] as XrwSme;
                if (sme != null)
                {
                    sme.Hide();
                }
            }

            base.Hide();
        }
Пример #3
0
        /// <summary> Show the widget and map the window (if any). </summary>
        public override void Show()
        {
            for (int countChildren = 0; countChildren < _children.Count; countChildren++)
            {
                XrwSme sme = _children[countChildren] as XrwSme;
                if (sme != null)
                {
                    sme.Show();
                    sme.Focused = false;
                }
            }

            base.Show();
        }