Beispiel #1
0
        public override void PropertyChanged(XEvent xevent)
        {
            if (xevent.PropertyEvent.atom == Display.Atoms._NET_ACTIVE_WINDOW)
            {
                IntPtr actual_atom;
                int    actual_format;
                IntPtr nitems;
                IntPtr bytes_after;
                IntPtr prop = IntPtr.Zero;

                Xlib.XGetWindowProperty(Display.Handle, WholeWindow,
                                        Display.Atoms._NET_ACTIVE_WINDOW, IntPtr.Zero, new IntPtr(1), false,
                                        Display.Atoms.XA_WINDOW, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);

                if (((long)nitems > 0) && (prop != IntPtr.Zero))
                {
                    // FIXME - is this 64 bit clean?
                    Display.SetActiveWindow((X11Hwnd)Hwnd.ObjectFromHandle((IntPtr)Marshal.ReadInt32(prop)));
                    Xlib.XFree(prop);
                }
            }
            else if (xevent.PropertyEvent.atom == Display.Atoms._NET_SUPPORTED)
            {
                // we'll need to refetch the supported protocols list
                refetch_net_supported = true;
                _net_supported        = null;
            }
            else
            {
                base.PropertyChanged(xevent);
            }
        }
Beispiel #2
0
 internal override IntPtr InitializeDriver()
 {
     lock (this) {
         if (display == null)
         {
             display = new X11Display(Xlib.XOpenDisplay(IntPtr.Zero));
         }
     }
     return(IntPtr.Zero);
 }
Beispiel #3
0
        private XplatUIX11_new()
        {
            // Handle singleton stuff first
            RefCount = 0;

            // Now regular initialization
            MessageQueues = Hashtable.Synchronized(new Hashtable(7));
            if (Xlib.XInitThreads() == 0)
            {
                Console.WriteLine("Failed XInitThreads.  The X11 event loop will not function properly");
            }
        }
Beispiel #4
0
        public static string GetMessage(IntPtr Display, IntPtr ResourceID, IntPtr Serial, byte ErrorCode, XRequest RequestCode, byte MinorCode)
        {
            StringBuilder sb;
            string        x_error_text;
            string        error;
            string        hwnd_text;
            string        control_text;
            Hwnd          hwnd;
            Control       c;

            sb = new StringBuilder(160);
            Xlib.XGetErrorText(Display, ErrorCode, sb, sb.Capacity);
            x_error_text = sb.ToString();
            hwnd         = Hwnd.ObjectFromHandle(ResourceID);
            if (hwnd != null)
            {
                hwnd_text = hwnd.ToString();
                c         = Control.FromHandle(hwnd.Handle);
                if (c != null)
                {
                    control_text = c.ToString();
                }
                else
                {
                    control_text = String.Format("<handle {0:X} non-existant>", hwnd.Handle);
                }
            }
            else
            {
                hwnd_text    = "<null>";
                control_text = "<null>";
            }

            error = String.Format("\n  Error: {0}\n  Request:     {1:D} ({2})\n  Resource ID: 0x{3:X}\n  Serial:      {4}\n  Hwnd:        {5}\n  Control:     {6}", x_error_text, RequestCode, RequestCode, ResourceID.ToInt32(), Serial, hwnd_text, control_text);
            return(error);
        }
Beispiel #5
0
        public X11Atoms(X11Display display)
        {
            // make sure this array stays in sync with the statements below
            string [] atom_names = new string[] {
                "WM_PROTOCOLS",
                "WM_DELETE_WINDOW",
                "WM_TAKE_FOCUS",
                "_NET_SUPPORTED",
                "_NET_CLIENT_LIST",
                "_NET_NUMBER_OF_DESKTOPS",
                "_NET_DESKTOP_GEOMETRY",
                "_NET_DESKTOP_VIEWPORT",
                "_NET_CURRENT_DESKTOP",
                "_NET_DESKTOP_NAMES",
                "_NET_ACTIVE_WINDOW",
                "_NET_WORKAREA",
                "_NET_SUPPORTING_WM_CHECK",
                "_NET_VIRTUAL_ROOTS",
                "_NET_DESKTOP_LAYOUT",
                "_NET_SHOWING_DESKTOP",
                "_NET_CLOSE_WINDOW",
                "_NET_MOVERESIZE_WINDOW",
                "_NET_WM_MOVERESIZE",
                "_NET_RESTACK_WINDOW",
                "_NET_REQUEST_FRAME_EXTENTS",
                "_NET_WM_NAME",
                "_NET_WM_VISIBLE_NAME",
                "_NET_WM_ICON_NAME",
                "_NET_WM_VISIBLE_ICON_NAME",
                "_NET_WM_DESKTOP",
                "_NET_WM_WINDOW_TYPE",
                "_NET_WM_STATE",
                "_NET_WM_ALLOWED_ACTIONS",
                "_NET_WM_STRUT",
                "_NET_WM_STRUT_PARTIAL",
                "_NET_WM_ICON_GEOMETRY",
                "_NET_WM_ICON",
                "_NET_WM_PID",
                "_NET_WM_HANDLED_ICONS",
                "_NET_WM_USER_TIME",
                "_NET_FRAME_EXTENTS",
                "_NET_WM_PING",
                "_NET_WM_SYNC_REQUEST",
                "_NET_SYSTEM_TRAY_OPCODE",
                "_NET_SYSTEM_TRAY_ORIENTATION",
                "_NET_WM_STATE_MAXIMIZED_HORZ",
                "_NET_WM_STATE_MAXIMIZED_VERT",
                "_NET_WM_STATE_HIDDEN",
                "_XEMBED",
                "_XEMBED_INFO",
                "_MOTIF_WM_HINTS",
                "_NET_WM_STATE_SKIP_TASKBAR",
                "_NET_WM_STATE_ABOVE",
                "_NET_WM_STATE_MODAL",
                "_NET_WM_CONTEXT_HELP",
                "_NET_WM_WINDOW_OPACITY",
                "_NET_WM_WINDOW_TYPE_DESKTOP",
                "_NET_WM_WINDOW_TYPE_DOCK",
                "_NET_WM_WINDOW_TYPE_TOOLBAR",
                "_NET_WM_WINDOW_TYPE_MENU",
                "_NET_WM_WINDOW_TYPE_UTILITY",
                "_NET_WM_WINDOW_TYPE_DIALOG",
                "_NET_WM_WINDOW_TYPE_SPLASH",
                "_NET_WM_WINDOW_TYPE_NORMAL",
                "CLIPBOARD",
                "PRIMARY",
                "COMPOUND_TEXT",
                "UTF8_STRING",
                "TARGETS",
                "_SWF_AsyncAtom",
                "_SWF_PostMessageAtom",
                "_SWF_HoverAtom"
            };

            IntPtr[] atoms = new IntPtr [atom_names.Length];;

            Xlib.XInternAtoms(display.Handle, atom_names, atom_names.Length, false, atoms);

            int off = 0;

            WM_PROTOCOLS               = atoms [off++];
            WM_DELETE_WINDOW           = atoms [off++];
            WM_TAKE_FOCUS              = atoms [off++];
            _NET_SUPPORTED             = atoms [off++];
            _NET_CLIENT_LIST           = atoms [off++];
            _NET_NUMBER_OF_DESKTOPS    = atoms [off++];
            _NET_DESKTOP_GEOMETRY      = atoms [off++];
            _NET_DESKTOP_VIEWPORT      = atoms [off++];
            _NET_CURRENT_DESKTOP       = atoms [off++];
            _NET_DESKTOP_NAMES         = atoms [off++];
            _NET_ACTIVE_WINDOW         = atoms [off++];
            _NET_WORKAREA              = atoms [off++];
            _NET_SUPPORTING_WM_CHECK   = atoms [off++];
            _NET_VIRTUAL_ROOTS         = atoms [off++];
            _NET_DESKTOP_LAYOUT        = atoms [off++];
            _NET_SHOWING_DESKTOP       = atoms [off++];
            _NET_CLOSE_WINDOW          = atoms [off++];
            _NET_MOVERESIZE_WINDOW     = atoms [off++];
            _NET_WM_MOVERESIZE         = atoms [off++];
            _NET_RESTACK_WINDOW        = atoms [off++];
            _NET_REQUEST_FRAME_EXTENTS = atoms [off++];
            _NET_WM_NAME               = atoms [off++];
            _NET_WM_VISIBLE_NAME       = atoms [off++];
            _NET_WM_ICON_NAME          = atoms [off++];
            _NET_WM_VISIBLE_ICON_NAME  = atoms [off++];
            _NET_WM_DESKTOP            = atoms [off++];
            _NET_WM_WINDOW_TYPE        = atoms [off++];
            _NET_WM_STATE              = atoms [off++];
            _NET_WM_ALLOWED_ACTIONS    = atoms [off++];
            _NET_WM_STRUT              = atoms [off++];
            _NET_WM_STRUT_PARTIAL      = atoms [off++];
            _NET_WM_ICON_GEOMETRY      = atoms [off++];
            _NET_WM_ICON               = atoms [off++];
            _NET_WM_PID                  = atoms [off++];
            _NET_WM_HANDLED_ICONS        = atoms [off++];
            _NET_WM_USER_TIME            = atoms [off++];
            _NET_FRAME_EXTENTS           = atoms [off++];
            _NET_WM_PING                 = atoms [off++];
            _NET_WM_SYNC_REQUEST         = atoms [off++];
            _NET_SYSTEM_TRAY_OPCODE      = atoms [off++];
            _NET_SYSTEM_TRAY_ORIENTATION = atoms [off++];
            _NET_WM_STATE_MAXIMIZED_HORZ = atoms [off++];
            _NET_WM_STATE_MAXIMIZED_VERT = atoms [off++];
            _NET_WM_STATE_HIDDEN         = atoms [off++];
            _XEMBED                     = atoms [off++];
            _XEMBED_INFO                = atoms [off++];
            _MOTIF_WM_HINTS             = atoms [off++];
            _NET_WM_STATE_SKIP_TASKBAR  = atoms [off++];
            _NET_WM_STATE_ABOVE         = atoms [off++];
            _NET_WM_STATE_MODAL         = atoms [off++];
            _NET_WM_CONTEXT_HELP        = atoms [off++];
            _NET_WM_WINDOW_OPACITY      = atoms [off++];
            _NET_WM_WINDOW_TYPE_DESKTOP = atoms [off++];
            _NET_WM_WINDOW_TYPE_DOCK    = atoms [off++];
            _NET_WM_WINDOW_TYPE_TOOLBAR = atoms [off++];
            _NET_WM_WINDOW_TYPE_MENU    = atoms [off++];
            _NET_WM_WINDOW_TYPE_UTILITY = atoms [off++];
            _NET_WM_WINDOW_TYPE_DIALOG  = atoms [off++];
            _NET_WM_WINDOW_TYPE_SPLASH  = atoms [off++];
            _NET_WM_WINDOW_TYPE_NORMAL  = atoms [off++];
            CLIPBOARD                   = atoms [off++];
            PRIMARY                     = atoms [off++];
            OEMTEXT                     = atoms [off++];
            UNICODETEXT                 = atoms [off++];
            TARGETS                     = atoms [off++];
            AsyncAtom                   = atoms [off++];
            PostAtom                    = atoms [off++];
            display.HoverState.Atom     = atoms [off++];

            DIB = XA_PIXMAP;

            // XXX multi screen stuff here
            _NET_SYSTEM_TRAY_S = Xlib.XInternAtom(display.Handle, "_NET_SYSTEM_TRAY_S" + display.DefaultScreen.ToString(), false);
        }
Beispiel #6
0
        private void InitializeDisplay()
        {
            display = new X11Display(Xlib.XOpenDisplay(IntPtr.Zero));

            Graphics.FromHdcInternal(display.Handle);
        }
Beispiel #7
0
        public X11RootHwnd(X11Display display, IntPtr window_handle) : base(display)
        {
            WholeWindow = ClientWindow = window_handle;

            Xlib.XSelectInput(display.Handle, WholeWindow, new IntPtr((int)EventMask.PropertyChangeMask));
        }