// opcode 119 - get modifier mapping /** * @return valid: {@link Enum#next1()} * @see <a href="XModifierKeymap.html">XModifierKeymap</a> */ public Enum modifier_mapping() { Request request = new Request(display, 119, 1); Data reply = display.read_reply(request); return(new Enum(reply, 32, reply.read1(1))); }
// opcode 99 - list extensions /** * @return valid: {@link Enum#next_string()} * @see <a href="XListExtensions.html">XListExtensions</a> */ public Enum extensions() { Request request = new Request(this, 99, 1); Data reply = read_reply(request); return(new Enum(reply, 32, reply.read1(1))); }
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; } }
public Event read_event(bool blocking, bool remove) { if (events.Count > 0) { lock (events) { Event evt = (Event)events[0]; events.Remove(0); return(evt); } } Data message = null; while (message == null) { /* ALWAYS yield, despite priorities of threads, to the thread running * `read_reply(Request)' to avoid dead-lock. * * Note that yielding once does not guarantee the thread running * `read_reply(Request)' will gain the control even when they have a * higher priority than this thread. We must repeatively yield until * it does so. The number of yields is unbounded. * * Reference: http://www.eng.uiowa.edu/~skaliann/books/jthreads/index.htm. */ while (reading_reply) { Thread.SpinWait(100); } lock (read_lock) { message = read_message(blocking); if (message.read1(0) == 1) // reply { saved_reply = message; message = null; } } } if (!remove) { events.Add(message); } return((Event)message); }
// 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); } }
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; } }