Exemplo n.º 1
0
        /**
         * @see <a href="XOpenDisplay.html">XOpenDisplay</a>
         */
        public Display(String hostname, int display_no, int screen_no)
        {
            default_screen_no = screen_no;
            connection        = new Connection(this, hostname, display_no);

            // authorization protocol
            String auth_name = "";
            String auth_data = "";
            int    n         = Data.len(auth_name);
            int    d         = Data.len(auth_data);

            Request request = new Request(this, 'B', // java = MSB
                                          3 + Data.unit(auth_name) + Data.unit(auth_data));

            request.index = 2;  // connection setup request hack
            request.write2(11); // major version
            request.write2(0);  // minor version
            request.write2(auth_name.Length);
            request.write2(auth_data.Length);
            request.write1(auth_name);
            request.write1(auth_data);

            init_server_info(read_reply(request));
            init_defaults();
            init_big_request_extension();
        }
Exemplo n.º 2
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;
            }
        }
Exemplo n.º 3
0
 public void write2(String s)
 {
     write2(index, s);
     index += Data.len(s);
 }