示例#1
0
        //throws NotFoundException
        protected Extension(Display display, String name, 
    String [] minor_opcode_strings, int error_count, int event_count)
        {
            this.display = display;
            this.name = name;

            Display.ExtensionReply er = display.extension (name);
            if (!er.present ()) throw new NotFoundException (name);

            first_event = er.first_event ();
            first_error = er.first_error ();
            major_opcode = er.major_opcode ();

            // register opcode strings
            display.extension_opcode_strings [major_opcode - 128] = name;
            display.extension_minor_opcode_strings [major_opcode - 128]
              = minor_opcode_strings;

            // register error factory
            for (int i=0; i<error_count; i++)
              display.extension_error_factories [first_error - 128 + i]
            = (ErrorFactory) this;

            // register event factory
            for (int i=0; i<event_count; i++)
              display.extension_event_factories [first_event - 64 + i]
            = (EventFactory) this;
        }