home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v92.tgz / v92.tar / v92 / src / common / xwindow.c < prev    next >
C/C++ Source or Header  |  1996-03-22  |  5KB  |  182 lines

  1. /*
  2.  * xwindow.c - X Window System-specific routines
  3.  */
  4. #include "::h:define.h"
  5. #include "::h:config.h"
  6. #ifdef XWindows
  7.  
  8. typedef struct {
  9.   char *s;
  10.   int i;
  11. } stringint, *siptr;
  12.  
  13. #if !VMS
  14. #undef VMS
  15. #endif                    /* VMS */
  16.  
  17. #if VMS
  18. #undef UNIX
  19. #include <stdio.h>
  20. #ifdef XpmFormat
  21. #include "::xpm:xpm.h"
  22. #endif                    /* XpmFormat */
  23. #include "decw$include:Xlib.h"
  24. #include "decw$include:Xutil.h"
  25. #include "decw$include:Xos.h"
  26. #include "decw$include:Xatom.h"
  27. #include "decw$include:cursorfont.h"
  28. #include "decw$include:keysym.h"
  29. #define UNIX 0
  30. #else                    /* VMS */
  31. #include <stdio.h>
  32. #ifdef XpmFormat
  33. #include "::xpm:xpm.h"
  34. #else                    /* XpmFormat */
  35. #include <X11/Xlib.h>
  36. #include <X11/Xutil.h>
  37. #endif                    /* XpmFormat */
  38. #include <X11/Xos.h>
  39. #include <X11/Xatom.h>
  40. #include <X11/cursorfont.h>
  41. #include <X11/keysym.h>
  42. #endif                    /* VMS */
  43.  
  44. int GraphicsHome  = XK_Home;
  45. int GraphicsLeft  = XK_Left;
  46. int GraphicsUp    = XK_Up;
  47. int GraphicsRight = XK_Right;
  48. int GraphicsDown  = XK_Down;
  49. int GraphicsPrior = XK_Prior;
  50. int GraphicsNext  = XK_Next;
  51. int GraphicsEnd   = XK_End;
  52.  
  53. /*
  54.  * Translate a key event.  Put ascii result if any in s.
  55.  * Return number of ascii (>0) if the key was "normal" and s is filled in.
  56.  * Return 0 if the key was strange and keysym should be returned.
  57.  * Return -1 if the key was a modifier key and should be dropped.
  58.  */
  59. int translate_key_event(event, s, k)
  60. XKeyEvent *event;
  61. char *s;
  62. KeySym *k;
  63. {
  64.    int i = XLookupString(event, s, 10, k, NULL);
  65.  
  66.    if (i > 0)
  67.       return i;            /* "normal" key */
  68.    else if (IsModifierKey(*k))
  69.       return -1;        /* modifier key */
  70.    else
  71.       return 0;            /* other (e.g. function key) */
  72. }
  73.  
  74.  
  75. stringint drawops[] = {
  76.    { 0, 16},
  77.    {"and",        GXand},
  78.    {"andInverted",    GXandInverted},
  79.    {"andReverse",    GXandReverse},
  80.    {"clear",        GXclear},
  81.    {"copy",        GXcopy},
  82.    {"copyInverted",    GXcopyInverted},
  83.    {"equiv",        GXequiv},
  84.    {"invert",        GXinvert},
  85.    {"nand",        GXnand},
  86.    {"noop",        GXnoop},
  87.    {"nor",        GXnor},
  88.    {"or",        GXor},
  89.    {"orInverted",    GXorInverted},
  90.    {"orReverse",    GXorReverse},
  91.    {"set",        GXset},
  92.    {"xor",        GXxor},
  93. };
  94.  
  95. #define NUMCURSORSYMS    78
  96.  
  97. stringint cursorsyms[] = {
  98.   { 0, NUMCURSORSYMS},
  99.   {"X cursor",        XC_X_cursor},
  100.   {"arrow",        XC_arrow},
  101.   {"based arrow down",    XC_based_arrow_down},
  102.   {"based arrow up",    XC_based_arrow_up},
  103.   {"boat",        XC_boat},
  104.   {"bogosity",        XC_bogosity},
  105.   {"bottom left corner",XC_bottom_left_corner},
  106.   {"bottom right corner",XC_bottom_right_corner},
  107.   {"bottom side",    XC_bottom_side},
  108.   {"bottom tee",    XC_bottom_tee},
  109.   {"box spiral",    XC_box_spiral},
  110.   {"center ptr",    XC_center_ptr},
  111.   {"circle",        XC_circle},
  112.   {"clock",        XC_clock},
  113.   {"coffee mug",    XC_coffee_mug},
  114.   {"cross",        XC_cross},
  115.   {"cross reverse",    XC_cross_reverse},
  116.   {"crosshair",        XC_crosshair},
  117.   {"diamond cross",    XC_diamond_cross},
  118.   {"dot",        XC_dot},
  119.   {"dotbox",        XC_dotbox},
  120.   {"double arrow",    XC_double_arrow},
  121.   {"draft large",    XC_draft_large},
  122.   {"draft small",    XC_draft_small},
  123.   {"draped box",    XC_draped_box},
  124.   {"exchange",        XC_exchange},
  125.   {"fleur",        XC_fleur},
  126.   {"gobbler",        XC_gobbler},
  127.   {"gumby",        XC_gumby},
  128.   {"hand1",        XC_hand1},
  129.   {"hand2",        XC_hand2},
  130.   {"heart",        XC_heart},
  131.   {"icon",        XC_icon},
  132.   {"iron cross",    XC_iron_cross},
  133.   {"left ptr",        XC_left_ptr},
  134.   {"left side",        XC_left_side},
  135.   {"left tee",        XC_left_tee},
  136.   {"leftbutton",    XC_leftbutton},
  137.   {"ll angle",        XC_ll_angle},
  138.   {"lr angle",        XC_lr_angle},
  139.   {"man",        XC_man},
  140.   {"middlebutton",    XC_middlebutton},
  141.   {"mouse",        XC_mouse},
  142.   {"pencil",        XC_pencil},
  143.   {"pirate",        XC_pirate},
  144.   {"plus",        XC_plus},
  145.   {"question arrow",    XC_question_arrow},
  146.   {"right ptr",        XC_right_ptr},
  147.   {"right side",    XC_right_side},
  148.   {"right tee",        XC_right_tee},
  149.   {"rightbutton",    XC_rightbutton},
  150.   {"rtl logo",        XC_rtl_logo},
  151.   {"sailboat",        XC_sailboat},
  152.   {"sb down arrow",    XC_sb_down_arrow},
  153.   {"sb h double arrow",    XC_sb_h_double_arrow},
  154.   {"sb left arrow",    XC_sb_left_arrow},
  155.   {"sb right arrow",    XC_sb_right_arrow},
  156.   {"sb up arrow",    XC_sb_up_arrow},
  157.   {"sb v double arrow",    XC_sb_v_double_arrow},
  158.   {"shuttle",        XC_shuttle},
  159.   {"sizing",        XC_sizing},
  160.   {"spider",        XC_spider},
  161.   {"spraycan",        XC_spraycan},
  162.   {"star",        XC_star},
  163.   {"target",        XC_target},
  164.   {"tcross",        XC_tcross},
  165.   {"top left arrow",    XC_top_left_arrow},
  166.   {"top left corner",    XC_top_left_corner},
  167.   {"top right corner",    XC_top_right_corner},
  168.   {"top side",        XC_top_side},
  169.   {"top tee",        XC_top_tee},
  170.   {"trek",        XC_trek},
  171.   {"ul angle",        XC_ul_angle},
  172.   {"umbrella",        XC_umbrella},
  173.   {"ur angle",        XC_ur_angle},
  174.   {"watch",        XC_watch},
  175.   {"xterm",        XC_xterm},
  176.   {"num glyphs",    XC_num_glyphs},
  177. };
  178.  
  179. #else                    /* XWindows */
  180.   static char x;
  181. #endif                    /* XWindows */
  182.