Home Up Questions?




XSCOPE and XPROG: Advantages of a Networked Window Server




James L. Peterson




Senior Programmer/Scientist
Advanced Workstations Division - IBM
Austin, Texas 78758




The following slides were presented at the XWorld Conference, 27-30 April 1992.

Abstract

The client/server nature of the X11 window system design allows clients to communicate with servers as separate processes communicating over well-defined network channels. This has allowed the development of two pseudo-servers for X11: Xscope and Xprog. Both pseudo-servers present themselves as servers to clients, but utilize a remote X11 window server for the actual work of the window server. Xscope and Xprog examine the information passed between the client and the real X11 server and provide useful debugging and performance information for the client developer.


















								16




 0.00:  Client 1 -->   12 bytes
 0.01: 					 160 bytes <-- X11  Server 1
 0.02:  Client 1 -->   40 bytes
 ............REQUEST: CreateGC
 ............REQUEST: GetProperty
 0.03: 					  32 bytes <-- X11  Server 1
				 ..............REPLY: GetProperty
 0.04:  Client 1 -->  196 bytes
 ............REQUEST: CreateWindow
 ............REQUEST: ChangeProperty
 ............REQUEST: ChangeProperty
 ............REQUEST: ChangeProperty
 ............REQUEST: CreateGC
 ............REQUEST: MapWindow
 ............REQUEST: ChangeWindowAttributes
 ............REQUEST: ClearArea
 ............REQUEST: GetWindowAttributes
 0.05: 					  44 bytes <-- X11  Server 1
				 ..............REPLY: GetWindowAttributes
 0.06:  Client 1 -->    8 bytes
 ............REQUEST: GetGeometry
 0.07: 					  32 bytes <-- X11  Server 1
				 ..............REPLY: GetGeometry
 0.08:  Client 1 -->  120 bytes
 ............REQUEST: ClearArea
 ............REQUEST: PolySegment
 ............REQUEST: PolySegment
 0.17: 					  32 bytes <-- X11  Server 1
				 ..............EVENT: Expose
 0.18:  Client 1 -->   24 bytes
 ............REQUEST: ClearArea
 ............REQUEST: GetWindowAttributes
 0.23: 					  44 bytes <-- X11  Server 1
				 ..............REPLY: GetWindowAttributes
 0.24:  Client 1 -->    8 bytes
 ............REQUEST: GetGeometry
 0.27: 					  32 bytes <-- X11  Server 1
				 ..............REPLY: GetGeometry
 0.28:  Client 1 -->  120 bytes
 ............REQUEST: ClearArea
 ............REQUEST: PolySegment
 ............REQUEST: PolySegment
 1.29: 					  32 bytes <-- X11  Server 1
				 ..............EVENT: KeyPress
 1.30:  Client 1 -->    8 bytes
 ............REQUEST: GetKeyboardMapping
 1.32: 					1104 bytes <-- X11  Server 1
				 ..............REPLY: GetKeyboardMapping
 1.33:  Client 1 -->    4 bytes
 ............REQUEST: GetModifierMapping
 1.34: 					  48 bytes <-- X11  Server 1
				 ..............REPLY: GetModifierMapping
 1.35:  Client 1 --> EOF



								17



 0.23:  Client 1 -->    8 bytes
 ............REQUEST: GetGeometry
            drawable: DWB 00900001
 0.26: 					  32 bytes <-- X11  Server 1
				 ..............REPLY: GetGeometry
				               depth: 08
				                root: WIN 0008006b
				                   x: 0
				                   y: 0
				               width: 0320
				              height: 0320
				        border-width: 0000
 0.27:  Client 1 -->  120 bytes
 ............REQUEST: ClearArea
           exposures: False
              window: WIN 00900001
                   x: 0
                   y: 0
               width: 0000
              height: 0000
 ............REQUEST: PolySegment
            drawable: DWB 00900001
                  gc: GXC 00900002
            segments: (8)
 ............REQUEST: PolySegment
            drawable: DWB 00900001
                  gc: GXC 00900002
            segments: (2)
 1.12: 					  32 bytes <-- X11  Server 1
				 ..............EVENT: KeyPress
				              detail: 25 (^Y)
				                time: TIM a4f62fd4
				                root: WIN 0008006b
				               event: WIN 00900001
				               child: None
				              root-x: 855
				              root-y: 700
				             event-x: 747
				             event-y: 646
				               state: 0
				         same-screen: True
 1.13:  Client 1 -->    8 bytes
 ............REQUEST: GetKeyboardMapping
       first-keycode: 8 (^H)
               count: 86
 1.14: 					1104 bytes <-- X11  Server 1
				 ..............REPLY: GetKeyboardMapping
				 keysyms-per-keycode: 02
				             keysyms: (268)
 1.16:  Client 1 -->    4 bytes
 ............REQUEST: GetModifierMapping
 1.17: 					  48 bytes <-- X11  Server 1
				 ..............REPLY: GetModifierMapping
				keycodes-per-modifier: 02
				            keycodes: (2)
 1.18:  Client 1 --> EOF


















								32
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>

Display *dpy;
Window W8006b;

Window W1;
GC GC2;

WaitForEvent(type, prompt)
int  type;
char *prompt;
{
  XFlush(dpy);
  fprintf(stderr, "Waiting for %s\n",prompt);
  while (TRUE)
    {
      XEvent xev;
      XNextEvent(dpy, &xev);
      if (xev.type == type) return;
    }
}

main()
{
  dpy = XOpenDisplay(getenv("DISPLAY"));
  W8006b = RootWindow(dpy, DefaultScreen(dpy));
  {
    XSetWindowAttributes temp;
    long mask = 0;
    mask = mask | CWBackPixel;
    temp.background_pixel = 1;
    W1 = XCreateWindow(dpy, W8006b, 0, 0, 800, 800,
		       1, 0, InputOutput, CopyFromParent, mask, &temp);
  }
  {
    XGCValues temp;
    long mask = 0;
    GC2 = XCreateGC(dpy, W1, mask, &temp);
  }
  XMapWindow(dpy, W1);
  XSelectInput(dpy, W1, KeyPressMask | ButtonPressMask | ExposureMask);
  WaitForEvent(Expose,"Expose") /* of window W1 */;
  XClearArea(dpy, W1, 0, 0, 0, 0, FALSE);
  {
    Window a;
    int b;
    int c;
    unsigned int d;
    unsigned int e;
    unsigned int f;
    unsigned int g;
    (void)XGetGeometry(dpy, W1, &a, &b, &c, &d, &e, &f, &g);
  }
  XClearArea(dpy, W1, 0, 0, 0, 0, FALSE);
  XDrawLine(dpy, W1, GC2, 10, 10, 790, 790);
  XDrawLine(dpy, W1, GC2, 10, 790, 790, 10);
  WaitForEvent(KeyPress,"KeyPress");
  exit(0);
}




Home   Comments?