home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / XKBSetGeom.c < prev    next >
C/C++ Source or Header  |  1999-11-02  |  16KB  |  579 lines

  1. /* $TOG: XKBSetGeom.c /main/8 1997/06/10 06:53:24 kaleb $ */
  2. /************************************************************
  3. Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
  4.  
  5. Permission to use, copy, modify, and distribute this
  6. software and its documentation for any purpose and without
  7. fee is hereby granted, provided that the above copyright
  8. notice appear in all copies and that both that copyright
  9. notice and this permission notice appear in supporting
  10. documentation, and that the name of Silicon Graphics not be 
  11. used in advertising or publicity pertaining to distribution 
  12. of the software without specific prior written permission.
  13. Silicon Graphics makes no representation about the suitability 
  14. of this software for any purpose. It is provided "as is"
  15. without any express or implied warranty.
  16.  
  17. SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 
  18. SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 
  19. AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
  20. GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
  21. DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
  22. DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 
  23. OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  24. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  25.  
  26. ********************************************************/
  27.  
  28. #ifdef DEBUG
  29. #include <stdio.h>
  30. #endif
  31.  
  32. #define NEED_EVENTS
  33. #define NEED_REPLIES
  34. #include "Xlib_private.h"
  35. #include "XKBlibint.h"
  36. #include <X11/extensions/XKBgeom.h>
  37. #include <X11/extensions/XKBproto.h>
  38.  
  39. #ifndef MINSHORT
  40. #define    MINSHORT    -32768
  41. #endif
  42. #ifndef MAXSHORT
  43. #define    MAXSHORT    32767
  44. #endif
  45.  
  46. /***====================================================================***/
  47.  
  48. #define    _SizeCountedString(s)  ((s)?XkbPaddedSize(2+strlen(s)):4)
  49.  
  50. static char *
  51. #if NeedFunctionPrototypes
  52. _WriteCountedString(char *wire,char *str)
  53. #else
  54. _WriteCountedString(wire,str)
  55.     char *    wire;
  56.     char *    str;
  57. #endif
  58. {
  59.     DBUG_ENTER("_WriteCountedString")
  60.     CARD16    len,*pLen;
  61.  
  62.     len= (str?strlen(str):0);
  63.     pLen= (CARD16 *)wire;
  64.     *pLen= len;
  65.     if (len && str)
  66.     memcpy(&wire[2],str,len);
  67.     wire+= XkbPaddedSize(len+2);
  68.     DBUG_RETURN(wire);
  69. }
  70.  
  71. static int
  72. #if NeedFunctionPrototypes
  73. _SizeGeomProperties(XkbGeometryPtr geom)
  74. #else
  75. _SizeGeomProperties(geom)
  76.     XkbGeometryPtr    geom;
  77. #endif
  78. {
  79.     DBUG_ENTER("_SizeGeomProperties")
  80.     register int     i,size;
  81.     XkbPropertyPtr    prop;
  82.     
  83.     for (size=i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
  84.     size+= _SizeCountedString(prop->name);
  85.     size+= _SizeCountedString(prop->value);
  86.     }
  87.     DBUG_RETURN(size);
  88. }
  89.  
  90. static int
  91. #if NeedFunctionPrototypes
  92. _SizeGeomColors(XkbGeometryPtr geom)
  93. #else
  94. _SizeGeomColors(geom)
  95.     XkbGeometryPtr    geom;
  96. #endif
  97. {
  98.     DBUG_ENTER("_SizeGeomColors")
  99.     register int         i,size;
  100.     register XkbColorPtr    color;
  101.  
  102.     for (i=size=0,color=geom->colors;i<geom->num_colors;i++,color++) {
  103.     size+= _SizeCountedString(color->spec);
  104.     }
  105.     DBUG_RETURN(size);
  106. }
  107.  
  108. static int
  109. #if NeedFunctionPrototypes
  110. _SizeGeomShapes(XkbGeometryPtr geom)
  111. #else
  112. _SizeGeomShapes(geom)
  113.     XkbGeometryPtr    geom;
  114. #endif
  115. {
  116.     DBUG_ENTER("_SizeGeomShapes")
  117.     register int        i,size;
  118.     register XkbShapePtr    shape;
  119.  
  120.     for (i=size=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) {
  121.     register int        n;
  122.     register XkbOutlinePtr    ol;
  123.     size+= SIZEOF(xkbShapeWireDesc);
  124.     for (n=0,ol=shape->outlines;n<shape->num_outlines;n++,ol++) {
  125.         size+= SIZEOF(xkbOutlineWireDesc);
  126.         size+= ol->num_points*SIZEOF(xkbPointWireDesc);
  127.     }
  128.     }
  129.     DBUG_RETURN(size);
  130. }
  131.  
  132. static int
  133. #if NeedFunctionPrototypes
  134. _SizeGeomDoodads(int num_doodads,XkbDoodadPtr doodad)
  135. #else
  136. _SizeGeomDoodads(num_doodads,doodad)
  137.     int            num_doodads;
  138.     XkbDoodadPtr    doodad;
  139. #endif
  140. {
  141.     DBUG_ENTER("_SizeGeomDoodads")
  142.     register int    i,size;
  143.  
  144.     for (i=size=0;i<num_doodads;i++,doodad++) {
  145.     size+= SIZEOF(xkbAnyDoodadWireDesc);
  146.     if (doodad->any.type==XkbTextDoodad) {
  147.         size+= _SizeCountedString(doodad->text.text);
  148.         size+= _SizeCountedString(doodad->text.font);
  149.     }
  150.     else if (doodad->any.type==XkbLogoDoodad) {
  151.         size+= _SizeCountedString(doodad->logo.logo_name);
  152.     }
  153.     }
  154.     DBUG_RETURN(size);
  155. }
  156.  
  157. static int
  158. #if NeedFunctionPrototypes
  159. _SizeGeomSections(XkbGeometryPtr geom)
  160. #else
  161. _SizeGeomSections(geom)
  162.     XkbGeometryPtr    geom;
  163. #endif
  164. {
  165.     DBUG_ENTER("_SizeGeomSections")
  166.     register int     i,size;
  167.     XkbSectionPtr    section;
  168.  
  169.     for (i=size=0,section=geom->sections;i<geom->num_sections;i++,section++) {
  170.     size+= SIZEOF(xkbSectionWireDesc);
  171.     if (section->rows) {
  172.         int        r;
  173.         XkbRowPtr    row;
  174.         for (r=0,row=section->rows;r<section->num_rows;row++,r++) {
  175.         size+= SIZEOF(xkbRowWireDesc);
  176.         size+= row->num_keys*SIZEOF(xkbKeyWireDesc);
  177.         }
  178.     }
  179.     if (section->doodads)
  180.         size+= _SizeGeomDoodads(section->num_doodads,section->doodads);
  181.     if (section->overlays) {
  182.         int            o;
  183.         XkbOverlayPtr    ol;
  184.         for (o=0,ol=section->overlays;o<section->num_overlays;o++,ol++) {
  185.         int            r;
  186.         XkbOverlayRowPtr    row;
  187.         size+= SIZEOF(xkbOverlayWireDesc);
  188.         for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
  189.            size+= SIZEOF(xkbOverlayRowWireDesc);
  190.            size+= row->num_keys*SIZEOF(xkbOverlayKeyWireDesc);
  191.         }
  192.         }
  193.     }
  194.     }
  195.     DBUG_RETURN(size);
  196. }
  197.  
  198. static int
  199. #if NeedFunctionPrototypes
  200. _SizeGeomKeyAliases(XkbGeometryPtr geom)
  201. #else
  202. _SizeGeomKeyAliases(geom)
  203.     XkbGeometryPtr    geom;
  204. #endif
  205. {
  206.     DBUG_ENTER("_SizeGeomKeyAliases")
  207.     int result = geom->num_key_aliases*(2*XkbKeyNameLength);
  208.     DBUG_RETURN(result);
  209. }
  210.  
  211. /***====================================================================***/
  212.  
  213. static char *
  214. #if NeedFunctionPrototypes
  215. _WriteGeomProperties(char *wire,XkbGeometryPtr geom)
  216. #else
  217. _WriteGeomProperties(wire,geom)
  218.     char *        wire;
  219.     XkbGeometryPtr     geom;
  220. #endif
  221. {
  222.     DBUG_ENTER("_WriteGeomProperties")
  223.     register int     i;
  224.     register XkbPropertyPtr    prop;
  225.     
  226.     for (i=0,prop=geom->properties;i<geom->num_properties;i++,prop++) {
  227.     wire= _WriteCountedString(wire,prop->name);
  228.     wire= _WriteCountedString(wire,prop->value);
  229.     }
  230.     DBUG_RETURN(wire);
  231. }
  232.  
  233. static char *
  234. #if NeedFunctionPrototypes
  235. _WriteGeomColors(char *wire,XkbGeometryPtr geom)
  236. #else
  237. _WriteGeomColors(wire,geom)
  238.     char *        wire;
  239.     XkbGeometryPtr     geom;
  240. #endif
  241. {
  242.     DBUG_ENTER("_WriteGeomColors")
  243.     register int        i;
  244.     register XkbColorPtr    color;
  245.  
  246.     for (i=0,color=geom->colors;i<geom->num_colors;i++,color++) {
  247.     wire= _WriteCountedString(wire,color->spec);
  248.     }
  249.     DBUG_RETURN(wire);
  250. }
  251.  
  252. static char *
  253. #if NeedFunctionPrototypes
  254. _WriteGeomShapes(char *wire,XkbGeometryPtr geom)
  255. #else
  256. _WriteGeomShapes(wire,geom)
  257.     char *        wire;
  258.     XkbGeometryPtr     geom;
  259. #endif
  260. {
  261.     DBUG_ENTER("_WriteGeomShapes")
  262.     int            i;
  263.     XkbShapePtr        shape;
  264.     xkbShapeWireDesc *    shapeWire;
  265.  
  266.     for (i=0,shape=geom->shapes;i<geom->num_shapes;i++,shape++) {
  267.     register int         o;
  268.     XkbOutlinePtr        ol;
  269.     xkbOutlineWireDesc *    olWire;
  270.     shapeWire= (xkbShapeWireDesc *)wire;
  271.     shapeWire->name= shape->name;
  272.     shapeWire->nOutlines= shape->num_outlines;
  273.     if (shape->primary!=NULL)
  274.          shapeWire->primaryNdx= XkbOutlineIndex(shape,shape->primary);
  275.     else shapeWire->primaryNdx= XkbNoShape;
  276.     if (shape->approx!=NULL)
  277.          shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx);
  278.     else shapeWire->approxNdx= XkbNoShape;
  279.     wire= (char *)&shapeWire[1];
  280.     for (o=0,ol=shape->outlines;o<shape->num_outlines;o++,ol++) {
  281.         register int    p;
  282.         XkbPointPtr        pt;
  283.         xkbPointWireDesc *    ptWire;
  284.         olWire= (xkbOutlineWireDesc *)wire;
  285.         olWire->nPoints= ol->num_points;
  286.         olWire->cornerRadius= ol->corner_radius;
  287.         wire= (char *)&olWire[1];
  288.         ptWire= (xkbPointWireDesc *)wire;
  289.         for (p=0,pt=ol->points;p<ol->num_points;p++,pt++) {
  290.         ptWire[p].x= pt->x;
  291.         ptWire[p].y= pt->y;
  292.         }
  293.         wire= (char *)&ptWire[ol->num_points];
  294.     }
  295.     }
  296.     DBUG_RETURN(wire);
  297. }
  298.  
  299. static char *
  300. #if NeedFunctionPrototypes
  301. _WriteGeomDoodads(char *wire,int num_doodads,XkbDoodadPtr doodad)
  302. #else
  303. _WriteGeomDoodads(wire,num_doodads,doodad)
  304.     char *        wire;
  305.     int            num_doodads;
  306.     XkbDoodadPtr    doodad;
  307. #endif
  308. {
  309.     DBUG_ENTER("_WriteGeomDoodads")
  310.     register int        i;
  311.     xkbDoodadWireDesc *    doodadWire;
  312.  
  313.     for (i=0;i<num_doodads;i++,doodad++) {
  314.     doodadWire= (xkbDoodadWireDesc *)wire;
  315.     wire= (char *)&doodadWire[1];
  316.     bzero(doodadWire,SIZEOF(xkbDoodadWireDesc));
  317.     doodadWire->any.name= doodad->any.name;
  318.     doodadWire->any.type= doodad->any.type;
  319.     doodadWire->any.priority= doodad->any.priority;
  320.     doodadWire->any.top= doodad->any.top;
  321.     doodadWire->any.left= doodad->any.left;
  322.     doodadWire->any.angle= doodad->any.angle;
  323.     switch (doodad->any.type) {
  324.         case XkbOutlineDoodad:
  325.         case XkbSolidDoodad:
  326.         doodadWire->shape.colorNdx= doodad->shape.color_ndx;
  327.         doodadWire->shape.shapeNdx= doodad->shape.shape_ndx;
  328.         break;
  329.         case XkbTextDoodad:
  330.         doodadWire->text.width= doodad->text.width;
  331.         doodadWire->text.height= doodad->text.height;
  332.         doodadWire->text.colorNdx= doodad->text.color_ndx;
  333.         wire= _WriteCountedString(wire,doodad->text.text);
  334.         wire= _WriteCountedString(wire,doodad->text.font);
  335.         break;
  336.         case XkbIndicatorDoodad:
  337.         doodadWire->indicator.shapeNdx= doodad->indicator.shape_ndx;
  338.         doodadWire->indicator.onColorNdx=doodad->indicator.on_color_ndx;
  339.         doodadWire->indicator.offColorNdx=
  340.                         doodad->indicator.off_color_ndx;
  341.         break;
  342.         case XkbLogoDoodad:
  343.         doodadWire->logo.colorNdx= doodad->logo.color_ndx;
  344.         doodadWire->logo.shapeNdx= doodad->logo.shape_ndx;
  345.         wire= _WriteCountedString(wire,doodad->logo.logo_name);
  346.         break;
  347.         default:
  348.         break;
  349.     }
  350.     }
  351.     DBUG_RETURN(wire);
  352. }
  353.  
  354. static char *
  355. #if NeedFunctionPrototypes
  356. _WriteGeomOverlay(char *wire,XkbOverlayPtr ol)
  357. #else
  358. _WriteGeomOverlay(wire,ol)
  359.     char *        wire;
  360.     XkbOverlayPtr    ol;
  361. #endif
  362. {
  363.     DBUG_ENTER("_WriteGeomOverlay")
  364.     register int        r;
  365.     XkbOverlayRowPtr    row;
  366.     xkbOverlayWireDesc *    olWire;
  367.  
  368.     olWire= (xkbOverlayWireDesc *)wire;
  369.     olWire->name= ol->name;
  370.     olWire->nRows= ol->num_rows;
  371.     wire= (char *)&olWire[1];
  372.     for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
  373.        unsigned int        k;
  374.     XkbOverlayKeyPtr    key;
  375.     xkbOverlayRowWireDesc *    rowWire;
  376.     rowWire= (xkbOverlayRowWireDesc *)wire;
  377.     rowWire->rowUnder= row->row_under;
  378.     rowWire->nKeys= row->num_keys;
  379.     wire= (char *)&rowWire[1];
  380.     for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
  381.         xkbOverlayKeyWireDesc *    keyWire;
  382.         keyWire= (xkbOverlayKeyWireDesc *)wire;
  383.         memcpy(keyWire->over,key->over.name,XkbKeyNameLength);
  384.         memcpy(keyWire->under,key->under.name,XkbKeyNameLength);
  385.         wire= (char *)&keyWire[1];
  386.     }
  387.    }
  388.    DBUG_RETURN(wire);
  389. }
  390.  
  391. static char *
  392. #if NeedFunctionPrototypes
  393. _WriteGeomSections(char *wire,XkbGeometryPtr geom)
  394. #else
  395. _WriteGeomSections(wire,geom)
  396.     char *        wire;
  397.     XkbGeometryPtr     geom;
  398. #endif
  399. {
  400.     DBUG_ENTER("_WriteGeomSections")
  401.     register int        i;
  402.     XkbSectionPtr        section;
  403.     xkbSectionWireDesc *    sectionWire;
  404.  
  405.     for (i=0,section=geom->sections;i<geom->num_sections;i++,section++) {
  406.     sectionWire= (xkbSectionWireDesc *)wire;
  407.     sectionWire->name= section->name;
  408.     sectionWire->top= section->top;
  409.     sectionWire->left= section->left;
  410.     sectionWire->width= section->width;
  411.     sectionWire->height= section->height;
  412.     sectionWire->angle= section->angle;
  413.     sectionWire->priority= section->priority;
  414.     sectionWire->nRows= section->num_rows;
  415.     sectionWire->nDoodads= section->num_doodads;
  416.     sectionWire->nOverlays= section->num_overlays;
  417.     sectionWire->pad= 0;
  418.     wire= (char *)§ionWire[1];
  419.     if (section->rows) {
  420.         int            r;
  421.         XkbRowPtr        row;
  422.         xkbRowWireDesc *    rowWire;
  423.         for (r=0,row=section->rows;r<section->num_rows;r++,row++) {
  424.         rowWire= (xkbRowWireDesc *)wire;
  425.         rowWire->top= row->top;
  426.         rowWire->left= row->left;
  427.         rowWire->nKeys= row->num_keys;
  428.         rowWire->vertical= row->vertical;
  429.         rowWire->pad= 0;
  430.         wire= (char *)&rowWire[1];
  431.         if (row->keys) {
  432.             int            k;
  433.             XkbKeyPtr        key;
  434.             xkbKeyWireDesc *    keyWire;
  435.             keyWire= (xkbKeyWireDesc *)wire;
  436.             for (k=0,key=row->keys;k<row->num_keys;k++,key++) {
  437.             memcpy(keyWire[k].name,key->name.name,XkbKeyNameLength);
  438.             keyWire[k].gap= key->gap;
  439.             keyWire[k].shapeNdx= key->shape_ndx;
  440.             keyWire[k].colorNdx= key->color_ndx;
  441.             }
  442.             wire= (char *)&keyWire[row->num_keys];
  443.         }
  444.         }
  445.     }
  446.     if (section->doodads) {
  447.         wire= _WriteGeomDoodads(wire,
  448.                           section->num_doodads,section->doodads);
  449.     }
  450.     if (section->overlays) {
  451.         register int o;
  452.         for (o=0;o<section->num_overlays;o++) {
  453.         wire= _WriteGeomOverlay(wire,§ion->overlays[o]);
  454.         }
  455.     }
  456.     }
  457.     DBUG_RETURN(wire);
  458. }
  459.  
  460. static char *
  461. #if NeedFunctionPrototypes
  462. _WriteGeomKeyAliases(char *wire,XkbGeometryPtr geom)
  463. #else
  464. _WriteGeomKeyAliases(wire,geom)
  465.     char *        wire;
  466.     XkbGeometryPtr     geom;
  467. #endif
  468. {
  469.     DBUG_ENTER("_WriteGeomKeyAliases")
  470.     register int sz;
  471.     
  472.     sz= geom->num_key_aliases*(XkbKeyNameLength*2);
  473.     if (sz>0) {
  474.     memcpy(wire,(char *)geom->key_aliases,sz);
  475.     wire+= sz;
  476.     }
  477.     DBUG_RETURN(wire);
  478. }
  479.  
  480. /***====================================================================***/
  481. #if 0
  482. static Status
  483. #if NeedFunctionPrototypes
  484. _SendSetGeometry(Display *dpy,XkbGeometryPtr geom,xkbSetGeometryReq *req)
  485. #else
  486. _SendSetGeometry(dpy,geom,req)
  487.     Display *        dpy;
  488.     XkbGeometryPtr    geom;
  489.     xkbSetGeometryReq *    req;
  490. #endif
  491. {
  492.     DBUG_ENTER("_SendSetGeometry")
  493.     xkbSetGeometryReq    tmp;
  494.     int            sz;
  495.     char *            wire,*tbuf;
  496.  
  497.     sz= 0;
  498.     sz+= _SizeCountedString(geom->label_font);
  499.     sz+= _SizeGeomProperties(geom);
  500.     sz+= _SizeGeomColors(geom);
  501.     sz+= _SizeGeomShapes(geom);
  502.     sz+= _SizeGeomSections(geom);
  503.     sz+= _SizeGeomDoodads(geom->num_doodads,geom->doodads);
  504.     sz+= _SizeGeomKeyAliases(geom);
  505.     req->length+= (sz/4);
  506.     tmp= *req;
  507.     if (sz<BUFSIZE) {
  508.     BufAlloc(char *,wire,sz);
  509.     tbuf= NULL;
  510.     }
  511.     else {
  512.     tbuf= _XAllocTemp(dpy,sz);
  513.     if (!tbuf)
  514.         return BadAlloc;
  515.     wire= tbuf;
  516.     }
  517.     wire= _WriteCountedString(wire,geom->label_font);
  518.     if (geom->num_properties>0)
  519.     wire= _WriteGeomProperties(wire,geom);
  520.     if (geom->num_colors>0)
  521.     wire= _WriteGeomColors(wire,geom);
  522.     if (geom->num_shapes>0)
  523.     wire= _WriteGeomShapes(wire,geom);
  524.     if (geom->num_sections>0)
  525.     wire= _WriteGeomSections(wire,geom);
  526.     if (geom->num_doodads>0)
  527.     wire= _WriteGeomDoodads(wire,geom->num_doodads,geom->doodads);
  528.     if (geom->num_key_aliases>0)
  529.     wire= _WriteGeomKeyAliases(wire,geom);
  530.     if (tbuf!=NULL) {
  531.     Data(dpy,tbuf,sz);
  532.     _XFreeTemp(dpy,tbuf,sz);
  533.     }
  534.     DBUG_RETURN(Success);
  535. }
  536.  
  537. /***====================================================================***/
  538.  
  539. Status
  540. #if NeedFunctionPrototypes
  541. XkbSetGeometry(Display *dpy,unsigned deviceSpec,XkbGeometryPtr geom)
  542. #else
  543. XkbSetGeometry(dpy,deviceSpec,geom)
  544.     Display *        dpy;
  545.     unsigned        deviceSpec;
  546.     XkbGeometryPtr    geom;
  547. #endif
  548. {
  549.     DBUG_ENTER("XkbSetGeometry")
  550.     xkbSetGeometryReq    *req;
  551.     Status ret;
  552.  
  553.     if ( (!geom) || (dpy->flags & XlibDisplayNoXkb) ||
  554.     (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
  555.     DBUG_RETURN(BadAccess);
  556.     
  557.     GetReq(kbSetGeometry, req);
  558.     req->reqType = dpy->xkb_info->codes->major_opcode;
  559.     req->xkbReqType = X_kbSetGeometry;
  560.     req->deviceSpec = deviceSpec;
  561.     req->nShapes= geom->num_shapes;
  562.     req->nSections= geom->num_sections;
  563.     req->name= geom->name;
  564.     req->widthMM= geom->width_mm;
  565.     req->heightMM= geom->height_mm;
  566.     req->nProperties= geom->num_properties;
  567.     req->nColors= geom->num_colors;
  568.     req->nDoodads= geom->num_doodads;
  569.     req->nKeyAliases= geom->num_key_aliases;
  570.     req->baseColorNdx= (geom->base_color-geom->colors);
  571.     req->labelColorNdx= (geom->label_color-geom->colors);
  572.  
  573.     ret = _SendSetGeometry(dpy,geom,req);
  574.     UnlockDisplay(dpy);
  575.     SyncHandle();
  576.     DBUG_RETURN(ret);
  577. }
  578. #endif
  579.