Ejemplo n.º 1
0
        public void init_server_info(Data reply)
        {
            connected     = true;
            release_no    = reply.read4(8);
            resource_base = reply.read4(12);
            resource_mask = reply.read4(16);
            int vendor_length = reply.read2(24);

            extended_maximum_request_length
                = maximum_request_length = reply.read2(26);
            int screen_count        = reply.read1(28);
            int pixmap_format_count = reply.read1(29);

            image_byte_order            = reply.read1(30);
            bitmap_format_bit_order     = reply.read1(31);
            bitmap_format_scanline_unit = reply.read1(32);
            bitmap_format_scanline_pad  = reply.read1(33);

            int min_keycode = reply.read1(34);
            int max_keycode = reply.read1(35);

            input = new Input(this, min_keycode, max_keycode);
            input.keyboard_mapping();

            vendor = reply.read_string(40, vendor_length);

            // pixmap formats
            pixmap_formats = new Pixmap.Format [pixmap_format_count];
            int pixmap_formats_offset = 40 + Data.len(vendor_length);

            for (int i = 0; i < pixmap_format_count; i++)
            {
                pixmap_formats [i] = new Pixmap.Format(
                    reply, pixmap_formats_offset + i * 8);
            }

            // screens

            if (default_screen_no < 0 || default_screen_no >= screen_count)
            {
                throw new Exception("Invalid screen number (screen-count "
                                    + screen_count + "): " + default_screen_no);
            }

            screens = new Screen [screen_count];
            int screen_offset = pixmap_formats_offset + 8 * pixmap_format_count;

            for (int i = 0; i < screen_count; i++)
            {
                screens [i]    = new Screen(this, reply, screen_offset);
                screen_offset += screens [i].Length;
            }
        }
Ejemplo n.º 2
0
        // opcode 23 - get selection owner

        /**
         * @see <a href="XGetSelectionOwner.html">XGetSelectionOwner</a>
         */
        public Window selection_owner(Atom selection)
        {
            Request request = new Request(this, 23, 2);

            request.write4(selection.id);

            Data reply = read_reply(request);

            return((Window)Window.intern(this, reply.read4(8)));
        }
Ejemplo n.º 3
0
        // opcode 84 - alloc color

        /**
         * @see <a href="XAllocColor.html">XAllocColor</a>
         */
        public Color alloc_color(int red, int green, int blue)
        {
            Request request = new Request(display, 84, 4);

            request.write4(id);
            request.write2(red);
            request.write2(green);
            request.write2(blue);

            Data  reply = display.read_reply(request);
            Color color = new Color(reply.read4(16));

            color.exact = new RGB(reply.read2(8), reply.read2(10), reply.read2(12));
            return(color);
        }
Ejemplo n.º 4
0
        // opcode 101 - get keyboard mapping

        /**
         * @see <a href="XGetKeyboardMapping.html">XGetKeyboardMapping</a>
         */
        public void keyboard_mapping()
        {
            int keysym_count = max_keycode - min_keycode + 1;

            Request request = new Request(display, 101, 2);

            request.write1(min_keycode);
            request.write1(keysym_count);
            Data reply = display.read_reply(request);

            keysyms_per_keycode = reply.read1(1);
            keysyms             = new int [keysym_count];

            for (int i = 0; i < keysym_count; i++)
            {
                keysyms [i] = reply.read4(32 + 4 * i * keysyms_per_keycode);
            }
        }
Ejemplo n.º 5
0
        // opcode 16 - intern atom

        /**
         * @see <a href="XInternAtom.html">XInternAtom</a>
         */
        public Atom(Display display, String name, bool only_if_exists)
        {
            this.display = display;
            this.name    = name;

            Request request = new Request(display, 16, only_if_exists, 2 + Data.unit(name));

            request.write2(name.Length);
            request.write2_unused();
            request.write1(name);

            Data reply = display.read_reply(request);

            id = reply.read4(8);

            display.atom_ids.Add(id, this);
            display.atom_names.Add(name, this);
        }
Ejemplo n.º 6
0
        // opcode 85 - alloc named color

        /**
         * @see <a href="XAllocNamedColor.html">XAllocNamedColor</a>
         */
        public Color alloc_named_color(String name)
        {
            Request request = new Request(display, 85, 3 + Data.unit(name));

            request.write4(id);
            request.write2(name.Length);
            request.write2_unused();
            request.write1(name);

            Data  reply = display.read_reply(request);
            Color color = new Color(reply.read4(8));

            color.name  = name;
            color.exact = new RGB(reply.read2(12), reply.read2(14),
                                  reply.read2(16));
            color.visual = new RGB(reply.read2(18), reply.read2(20),
                                   reply.read2(22));
            return(color);
        }
Ejemplo n.º 7
0
 public WMClassHint (Data data) { 
   int len = data.read4 (16)-1;
   res = data.read_string (32, len);
   middle = res.IndexOf ('\0');
 }
Ejemplo n.º 8
0
        public void init_server_info(Data reply)
        {
            connected = true;
            release_no = reply.read4 (8);
            resource_base = reply.read4 (12);
            resource_mask = reply.read4 (16);
            int vendor_length = reply.read2 (24);
            extended_maximum_request_length
              = maximum_request_length = reply.read2 (26);
            int screen_count = reply.read1 (28);
            int pixmap_format_count = reply.read1 (29);

            image_byte_order = reply.read1 (30);
            bitmap_format_bit_order = reply.read1 (31);
            bitmap_format_scanline_unit = reply.read1 (32);
            bitmap_format_scanline_pad = reply.read1 (33);

            int min_keycode = reply.read1 (34);
            int max_keycode = reply.read1 (35);
            input = new Input (this, min_keycode, max_keycode);
            input.keyboard_mapping ();

            vendor = reply.read_string (40, vendor_length);

            // pixmap formats
            pixmap_formats = new Pixmap.Format [pixmap_format_count];
            int pixmap_formats_offset = 40 + Data.len (vendor_length);
            for (int i=0; i<pixmap_format_count; i++)
              pixmap_formats [i] = new Pixmap.Format (
            reply, pixmap_formats_offset + i*8);

            // screens

            if (default_screen_no < 0 || default_screen_no >= screen_count)
              throw new Exception ("Invalid screen number (screen-count "
            + screen_count + "): " + default_screen_no);

            screens = new Screen [screen_count];
            int screen_offset = pixmap_formats_offset + 8*pixmap_format_count;
            for (int i=0; i<screen_count; i++) {
              screens [i] = new Screen (this, reply, screen_offset);
              screen_offset += screens [i].Length;
            }
        }
Ejemplo n.º 9
0
 public WMClassHint(Data data)
 {
     int len = data.read4 (16)-1;
       res = data.read_string (32, len);
       middle = res.IndexOf ('\0');
 }