Exemplo n.º 1
0
	// Constructor.
	private Display(IntPtr dpy, String displayName, Application app)
			{
				// Copy parameters in from the create process.
				this.dpy = dpy;
				this.displayName = displayName;
				this.app = app;

				// Create objects for each of the display screens.
				int nscreens = (int)(Xlib.XScreenCount(dpy));
				screens = new Screen [nscreens];
				for(int scr = 0; scr < nscreens; ++scr)
				{
					screens[scr] = new Screen
						(this, scr, Xlib.XScreenOfDisplay(dpy, scr));
				}

				// Get the index of the default screen.
				defaultScreen = (int)(Xlib.XDefaultScreen(dpy));

				// Create an array to hold the standard cursors.
				cursors = new XCursor [(int)(CursorType.XC_num_glyphs)];

				// Reset the time of the last known event.
				knownEventTime = XTime.CurrentTime;

				// Construct the window handle map if not already present.
				if(handleMap == null)
				{
					handleMap = new HandleMap();
				}

				// Initialize the standard window manager atoms that we use.
				wmProtocols = Xlib.XInternAtom
					(dpy, "WM_PROTOCOLS", XBool.False);
				wmDeleteWindow = Xlib.XInternAtom
					(dpy, "WM_DELETE_WINDOW", XBool.False);
				wmTakeFocus = Xlib.XInternAtom
					(dpy, "WM_TAKE_FOCUS", XBool.False);
				wmMwmHints = Xlib.XInternAtom
					(dpy, "_MOTIF_WM_HINTS", XBool.False);
				wmContextHelp = Xlib.XInternAtom
					(dpy, "_NET_WM_CONTEXT_HELP", XBool.False);
				wmState = Xlib.XInternAtom
					(dpy, "WM_STATE", XBool.False);
				wmNetState = Xlib.XInternAtom
					(dpy, "_NET_WM_STATE", XBool.False);
				wmPing = Xlib.XInternAtom
					(dpy, "_NET_WM_PING", XBool.False);
				internalBeginInvoke = Xlib.XInternAtom
					(dpy, "INTERNAL_BEGIN_INVOKE", XBool.False);

				// Which buttons should we use for "Select" and "Menu"?
				byte[] buttons = new byte [5];
				if(Xlib.XGetPointerMapping(dpy, buttons, 5) == 3)
				{
					menuButton = ButtonName.Button3;
				}
				else
				{
					menuButton = ButtonName.Button2;
				}
				selectButton = ButtonName.Button1;

				// Construct the font map.
				fonts = new Hashtable();

				// Load the builtin bitmaps.
				bitmaps = new BuiltinBitmaps(this);
			}
Exemplo n.º 2
0
        // Constructor.
        private Display(IntPtr dpy, String displayName, Application app)
        {
            // Copy parameters in from the create process.
            this.dpy         = dpy;
            this.displayName = displayName;
            this.app         = app;

            // Create objects for each of the display screens.
            int nscreens = (int)(Xlib.XScreenCount(dpy));

            screens = new Screen [nscreens];
            for (int scr = 0; scr < nscreens; ++scr)
            {
                screens[scr] = new Screen
                                   (this, scr, Xlib.XScreenOfDisplay(dpy, scr));
            }

            // Get the index of the default screen.
            defaultScreen = (int)(Xlib.XDefaultScreen(dpy));

            // Create an array to hold the standard cursors.
            cursors = new XCursor [(int)(CursorType.XC_num_glyphs)];

            // Reset the time of the last known event.
            knownEventTime = XTime.CurrentTime;

            // Construct the window handle map if not already present.
            if (handleMap == null)
            {
                handleMap = new HandleMap();
            }

            // Initialize the standard window manager atoms that we use.
            wmProtocols = Xlib.XInternAtom
                              (dpy, "WM_PROTOCOLS", XBool.False);
            wmDeleteWindow = Xlib.XInternAtom
                                 (dpy, "WM_DELETE_WINDOW", XBool.False);
            wmTakeFocus = Xlib.XInternAtom
                              (dpy, "WM_TAKE_FOCUS", XBool.False);
            wmMwmHints = Xlib.XInternAtom
                             (dpy, "_MOTIF_WM_HINTS", XBool.False);
            wmContextHelp = Xlib.XInternAtom
                                (dpy, "_NET_WM_CONTEXT_HELP", XBool.False);
            wmState = Xlib.XInternAtom
                          (dpy, "WM_STATE", XBool.False);
            wmNetState = Xlib.XInternAtom
                             (dpy, "_NET_WM_STATE", XBool.False);
            wmPing = Xlib.XInternAtom
                         (dpy, "_NET_WM_PING", XBool.False);
            internalBeginInvoke = Xlib.XInternAtom
                                      (dpy, "INTERNAL_BEGIN_INVOKE", XBool.False);

            // Which buttons should we use for "Select" and "Menu"?
            byte[] buttons = new byte [5];
            if (Xlib.XGetPointerMapping(dpy, buttons, 5) == 3)
            {
                menuButton = ButtonName.Button3;
            }
            else
            {
                menuButton = ButtonName.Button2;
            }
            selectButton = ButtonName.Button1;

            // Construct the font map.
            fonts = new Hashtable();

            // Load the builtin bitmaps.
            bitmaps = new BuiltinBitmaps(this);
        }