HOOPS/3dGS I.M. Interface

     << Back      Full Index      Forward >>


x11data.h

00001 /*
00002  * Copyright (c) 1998 by Tech Soft 3D, LLC.
00003  * The information contained herein is confidential and proprietary to
00004  * Tech Soft 3D, LLC., and considered a trade secret as defined under
00005  * civil and criminal statutes.  Tech Soft 3D shall pursue its civil
00006  * and criminal remedies in the event of unauthorized use or misappropriation
00007  * of its trade secrets.  Use of this information by anyone other than
00008  * authorized employees of Tech Soft 3D, LLC. is granted only under a
00009  * written non-disclosure agreement, expressly prescribing the scope and
00010  * manner of such use.
00011  *
00012  * $Id: x11data_8h-source.html,v 1.29 2008-03-10 07:09:28 stage Exp $
00013  */
00014 
00015 #ifndef X11DATA_DEFINED
00016 
00017 /*      Moved multibuffering headers from x11_driver.c to x11data.h.
00018  *
00019  *      Multibuffering is causing the X11 server to crash if the
00020  *      HOOPS program is interrupted or aborted on some systems.
00021  *      The problem has been reproduced in an stand alone pure X
00022  *      program and has been reported to appropriate vendors.
00023  *      Until we receive a patch for the server crash we will use
00024  *      Pixmap double buffering (where appropriate).
00025  *      To enable Pixmap double buffering just define
00026  *                        #       define                DUMMY_MBUF
00027  *      for the system below (if not already present).
00028  */
00029 
00030 
00031 #ifdef NUTCRACKER
00032 # define XK_MISCELLANY
00033 # define XK_LATIN1
00034 # include <keysymdef.h>
00035 # include <multibuf.h>
00036 #endif
00037 
00038 #ifdef SPACEBALL
00039 #include <X11/extensions/XInput.h>
00040 #endif
00041 
00042 
00043 
00044 #ifdef PEX_DRIVER
00045 #       ifdef HPUX_SYSTEM
00046 #               include <X11/PEX5/PEXlib.h>
00047 #       else
00048 #               include <PEX5/PEXlib.h>
00049 #       endif /* HPUX_SYSTEM */
00050 #endif /* PEX_DRIVER */
00051 
00052 #ifdef FAMOTIK
00053 #       include <X11/XJplib.h>
00054 #endif /* FAMOTIK */
00055 
00056 /*      No Multibuffering support is available on this platform */
00057 #ifdef AIX_SYSTEM
00058 #       define X11R5
00059 #       ifndef NeedFunctionPrototypes
00060 #               define NeedFunctionPrototypes 1
00061 #       endif /* NeedFunctionPrototypes */
00062 #       include <X11/Xlib.h>
00063 #       include <X11/X.h>
00064 #       include <X11/keysym.h>
00065 #       include <X11/Xutil.h>
00066 #       define Multibuffer int
00067 #       define DUMMY_MBUF
00068 #       define MultibufferUpdateActionUntouched 1
00069 #       define MultibufferUpdateHintFrequent 2
00070 #       define XmbufBufferInfo int*
00071 #endif /* AIX_SYSTEM */
00072 
00073 #ifdef HPUX_SYSTEM
00074 #       define          X11R5
00075 #       define NeedFunctionPrototypes 1
00076 #       include <X11/Xlib.h>
00077 #       include <X11/X.h>
00078 #       include <X11/keysym.h>
00079 #       include <X11/Xutil.h>
00080 #ifdef __LP64__
00081 #       define DUMMY_MBUF
00082 #               define XmbufGetScreenInfo trashit
00083 #               define XmbufQueryExtension trashit2
00084 #               define XmbufCreateBuffers trashit3
00085 #               define XmbufDisplayBuffers trashit4
00086 #               define XmbufDestroyBuffers trashit5
00087 #       include <X11/extensions/multibuf.h>
00088 #               undef XmbufGetScreenInfo
00089 #               undef XmbufQueryExtension
00090 #               undef XmbufCreateBuffers
00091 #               undef XmbufDisplayBuffers
00092 #               undef XmbufDestroyBuffers
00093 #               define XmbufGetScreenInfo XmbufGetScreenInfo
00094 #               define XmbufQueryExtension XmbufQueryExtension
00095 #               define XmbufCreateBuffers XmbufCreateBuffers
00096 #               define XmbufDisplayBuffers XmbufDisplayBuffers
00097 #               define XmbufDestroyBuffers XmbufDestroyBuffers
00098 #else
00099 #       include <X11/extensions/multibuf.h>
00100 #endif
00101 #endif /* HPUX_SYSTEM */
00102 
00103 #ifdef OSF1_SYSTEM
00104 #       define          X11R5
00105 #       ifndef NeedFunctionPrototypes
00106 #               define NeedFunctionPrototypes 1
00107 #       endif /* NeedFunctionPrototypes */
00108 #       include <X11/Xlib.h>
00109 #       include <X11/X.h>
00110 #       include <X11/keysym.h>
00111 #       include <X11/Xutil.h>
00112 #       include <X11/extensions/multibuf.h>
00113 #endif /* OSF1_SYSTEM */
00114 
00115 #ifdef IRIX_SYSTEM
00116 #       define          X11R4
00117 #       define NeedFunctionPrototypes 1
00118 #       include <X11/Xlib.h>
00119 #       include <X11/X.h>
00120 #       include <X11/keysym.h>
00121 #       include <X11/Xutil.h>
00122 #ifdef MISSING_MBUF
00123                 /*sgi removed multibuf.h in IRIX 6.5 for some reason*/
00124 
00125 #               define Multibuffer int
00126 #               define DUMMY_MBUF
00127 #               define MultibufferUpdateActionUntouched 1
00128 #               define MultibufferUpdateHintFrequent 2
00129 #               define XmbufBufferInfo int* 
00130 #else
00131 #               include <X11/extensions/multibuf.h>
00132 #endif /*MISSING_MBUF*/
00133 #endif /* IRIX_SYSTEM */
00134 
00135 #ifdef SOLARIS_SYSTEM
00136 #       define          X11R4
00137 #       ifndef NeedFunctionPrototypes
00138 #               define NeedFunctionPrototypes 1
00139 #       endif /* NeedFunctionPrototypes */
00140 #       include <X11/Xlib.h>
00141 #       include <X11/X.h>
00142 #       include <X11/keysym.h>
00143 #       include <X11/Xutil.h>
00144 #ifdef MISSING_MBUF
00145 #               define Multibuffer int
00146 #               define DUMMY_MBUF
00147 #               define MultibufferUpdateActionUntouched 1
00148 #               define MultibufferUpdateHintFrequent 2
00149 #               define XmbufBufferInfo int*
00150 #else
00151 #       include <X11/extensions/multibuf.h>
00152 #endif /*MISSING_MBUF*/
00153 #endif /* SOLARIS_SYSTEM */
00154 
00155 #ifdef ULTRIX_SYSTEM
00156 #       define          X11R4
00157 #       define NeedFunctionPrototypes 1
00158 #       include <X11/Xlib.h>
00159 #       include <X11/X.h>
00160 #       include <X11/keysym.h>
00161 #       include <X11/Xutil.h>
00162 #       include <X11/extensions/multibuf.h>
00163 #endif /* ULTRIX_SYSTEM */
00164 
00165 #ifdef LINUX_SYSTEM
00166 #       define  X11R5
00167 #       define NeedFunctionPrototypes 1
00168 #       include <X11/Xlib.h>
00169 #       include <X11/X.h>
00170 #       include <X11/keysym.h>
00171 #       include <X11/Xutil.h>
00172 #       include <X11/extensions/multibuf.h>
00173 #endif /* LINUX_SYSTEM */
00174 
00175 #ifdef OSX_SYSTEM
00176 #       define  X11R5
00177 #       define NeedFunctionPrototypes 1
00178 #       include <X11/Xlib.h>
00179 #       include <X11/X.h>
00180 #       include <X11/keysym.h>
00181 #       include <X11/Xutil.h>
00182 #       include <X11/extensions/multibuf.h>
00183 #endif /* LINUX_SYSTEM */
00184 
00185 #ifdef VMS_SYSTEM
00186 #       include <decw$include:X.h>
00187 #       include <decw$include:Xlib.h>
00188 #       include <decw$include:keysym.h>
00189 #       include <decw$include:Xutil.h>
00190 #       include <decw$include:Xresource.h>
00191 #       ifdef VAX
00192 #               define DUMMY_MBUF
00193 #               include <sys$sysroot:[decw$include.extensions]multibuf.h>
00194 #       else
00195 #               include <decw$include:multibuf.h>
00196 #       endif
00197 #endif /* VMS_SYSTEM */
00198 
00199 #ifdef NUTCRACKER
00200 # include <Xlib.h>
00201 # include <driver.h>
00202 # include <Xutil.h>
00203 #ifdef EXCEED_BUILD
00204 # include <multibuf.h>
00205 #else
00206 #define Multibuffer int
00207 #endif
00208 #endif /* NUTCRACKER */
00209 
00210 
00211 /*
00212  *      Defines used to tell us which X11 Server we are using.
00213  */
00214 #define NOT_X11                 0
00215 
00216 #define UNKNOWN_X11             1
00217 
00218 #define SONY_X11                9
00219 #define SONY_X11R6              10
00220 #define SONY_X11R5              11
00221 #define SONY_X11R4              12
00222 #define SONY_X11R3              13
00223 
00224 #define SUN_OW                  20
00225 #define SUN_OW301               21
00226 #define SUN_OW3                 22
00227 #define SUN_OW2                 23
00228 
00229 #define DEC_X11                 29
00230 #define DEC_X11R6               30
00231 #define DEC_X11R5               31
00232 #define DEC_X11R4               32
00233 #define DEC_X11R3               33
00234 #define DEC_X11R2               34
00235 #define DEC_X11R1               35
00236 
00237 #define SGI_X11                 39
00238 #define SGI_X11R6               40
00239 #define SGI_X11R5               41
00240 #define SGI_X11R4               42
00241 
00242 #define HP_X11                  49
00243 #define HP_X11R6                50
00244 #define HP_X11R506              51
00245 #define HP_X11R5                52
00246 #define HP_X11R4                53
00247 #define HP_X11R3                54
00248 
00249 #define IBM_X11                 59
00250 #define IBM_X11R6               60
00251 #define IBM_X11R5               61
00252 #define IBM_X11R4               62
00253 #define IBM_X11R3               63
00254 
00255 #define SOL_OW                  64
00256 #define SOL_OW1                 65
00257 
00258 /*
00259  *      Defines used to tell us which Hoops Driver we are using.
00260  */
00261 #define X11_ONLY                0
00262 #define PEX_ON_X11              1
00263 #define XGL_ON_X11              2
00264 #define GL_ON_X11               3
00265 #define STARBASE_ON_X11 4
00266 #define OPENGL_ON_X11   5
00267 
00268 
00269 #ifdef FAMOTIK
00270         typedef struct xftab {
00271                 struct xftab    *next;
00272                 long                    id;
00273                 char                    *name;
00274         } Xftab;
00275 #endif
00276 
00277 #define RENDERER_STRING_LENGTH 200
00278 
00279 typedef struct {
00280         /* Hoops Driver in use */
00281         int                                     driver_type;
00282 
00283         /* X11 Server communication */
00284         Display alter           *display;
00285         Screen alter            *screen;
00286         Visual alter            *visual;
00287                                                 /* X11 Server vendor */
00288         int                                     server_type;
00289 
00290                                                 /* needed to find out hardware capability */
00291         char                            renderer[RENDERER_STRING_LENGTH];
00292 
00293         bool                        can_overlay;
00294         Window                          overlay_window;
00295 
00296 #       ifdef AIX_SYSTEM
00297                                                 /* needed to find out if we are on GXT1000 */
00298                 char                    vers[32];
00299 #       endif
00300 
00301         /* back link for error handling */
00302         HT_Display_Context      *dc;
00303 
00304         /* windows and sizes */
00305         Window                          window,
00306                                                 parent_window,
00307                                                 root_window;
00308         char                            title[256];
00309         int                                     window_x,
00310                                                 window_y,
00311                                                 window_border_bias_x,
00312                                                 window_border_bias_y;
00313         unsigned int            window_width,
00314                                                 window_height;
00315 
00316         /* graphics contexts and incarnations */
00317         GC                                      line_gc,
00318                                                 face_gc,
00319                                                 text_gc,
00320                                                 image_gc,
00321                                                 area_gc,
00322                                                 bitmap_gc,
00323                                                 blit_gc,
00324                                                 colorized_face_gc;
00325 
00326         HT_Incarnation          last_line_rendition,
00327                                                 last_face_rendition,
00328                                                 last_text_rendition,
00329                                                 last_blit_rendition;
00330 
00331         HT_Incarnation          last_line_xform_rendition,
00332                                                 last_face_xform_rendition,
00333                                                 last_text_xform_rendition,
00334                                                 last_image_xform_rendition,
00335                                                 last_blit_xform_rendition,
00336                                                 last_colorized_face_xform_rendition;
00337 
00338         /* physical function pointers */
00339         void                            (*get_x11_physical_info)(HT_Display_Context alter *dc),
00340                                                 (*create_x11_test_window)(HT_Display_Context const *dc),
00341                                                 (*destroy_x11_test_window)(HT_Display_Context const *dc),
00342                                                 (*hide_x11_test_window)(HT_Display_Context const *dc);
00343 
00344         /* font function pointers */
00345         void                            (*record_x11_fonts)(HT_Display_Context alter *dc),
00346                                                 (*record_basic_fonts)(HT_Display_Context alter *dc);
00347 
00348         bool                        (*record_one_font)(HT_Display_Context alter *dc,char const *name);
00349         char                            x11_font_resolution[5];
00350 
00351         /* new rendition function pointers, set based on visual type */
00352         bool                        (*new_face_rendition)(HT_Net_Rendition const *nr,
00353                                                                                           HT_Driver_Color const *face_color);
00354         bool                        (*colorized_face_rendition)(HT_Net_Rendition const *nr,
00355                                                                                                         HT_Driver_Color const *face_color);
00356 
00357         /* We PROTO the next routine because Ultrix cannot handle the typedef */
00358         void                            (*set_color)(HT_Net_Rendition const *nr,
00359                                                                                            XGCValues alter *xgcv,
00360                                                                                            HT_Driver_Color const *fg,
00361                                                                                            HT_Driver_Color const *bg);
00362 
00363         /* double-buffering variables */
00364         Drawable                        drawable;
00365         bool                        can_multi_buffer,
00366                                                 multi_buffering,
00367                                                 generic,
00368                                                 pixmap_double_buffering;
00369         Multibuffer                     multi_buffers[2];
00370         Pixmap                          double_buffer;
00371         int                                     mbuf_num,
00372                                                 db_left_clip,
00373                                                 db_right_clip,
00374                                                 db_bottom_clip,
00375                                                 db_top_clip;
00376         long                            poly_count;
00377         XPoint            alter *poly_points;
00378 
00379         /* color allocation variables */
00380         unsigned long alter *colormap_map;
00381         Colormap                        cmap,
00382                                                 default_cmap;
00383                                                 /* # of planes (per color, if direct) */
00384         int                                     bits_per_color;
00385         bool                        mapped_colors;
00386         int                                     num_mapped_colors;
00387                                                 /* # bitplanes of this window */
00388         int                                     depth;
00389 
00390         /* stipples */
00391         Pixmap                          stipples[TOTAL_BIT_PATTERNS];
00392 
00393         /* transformed text */
00394         Pixmap                          bitmap;
00395         int                                     bitmap_size;
00396         char alter                      *xformed;
00397 
00398         /* image array data */
00399 #       define BIT_RASTER_SWAPPED                       0x01
00400 #       define BIT_RASTER_COMPLEMENT            0x02
00401         int                                     bit_raster_type;
00402 
00403 #       define RGBA_RASTER_RGBA         0
00404 #       define RGBA_RASTER_BGRA         1
00405 #       define RGBA_RASTER_ABGR         2
00406 #       define RGBA_RASTER_GRAB         3
00407 #       define RGBA_RASTER_ARGB         4
00408 #       define RGBA_RASTER_GBAR         5
00409         int                                     rgb32_raster_type;
00410                                                 /* n x 1 image */
00411         XImage alter            *raster_image;
00412                                                 /* n x m image */
00413         XImage alter            *block_image;
00414         HT_RGBAS32      alter   *block;
00415         int                                     block_size;
00416                                                 /* for DirectColor rgb's */
00417         bool                        blue_first;
00418         unsigned char           mapped8_raster[NOMINAL_RASTER_LENGTH];
00419         unsigned char alter *mapped8_block;
00420         int                                     mapped8_block_size;
00421         unsigned short          mapped16_raster[NOMINAL_RASTER_LENGTH],
00422                                                 *mapped16_block;
00423         int                                     mapped16_block_size;
00424 
00425                 /*image caching can be tuned here but don't bother*/
00426                 /*it's fine*/
00427 #               define MAX_HEIGHT_CACHE 2
00428 #               define MAX_WIDTH_CACHE 512
00429                 XImage alter    *block_image_cache[MAX_HEIGHT_CACHE][MAX_WIDTH_CACHE];
00430 
00431         /* mouse handling */
00432         int                                     yfudge;
00433         int                                     mouse_x,
00434                                                 mouse_y,
00435                                                 mouse_buttons;
00436         bool                        mouse_was_queued;
00437         int                                     mouse_modifier;
00438 
00439         /* resizing hints */
00440         bool                        stretching_was_on,
00441                                                 resizing_was_on;
00442 
00443         /*
00444          *      Variables to prevent excess calls to install-color-map in X11R3
00445          *      or lower - not used or needed in X11R4 or higher.
00446          */
00447         bool                        cmap_installed,
00448                                                 focus_on_us;
00449 
00450         /* allow init_update to resize things */
00451         bool                        first_update;
00452 
00453         /* flag for resize event confusion */
00454         bool                        resize_in_progress;
00455 
00456         /* flag to indicate when free_outer_window() was called for a window */
00457         bool                        marked_for_delete;
00458 
00459         /* flag to trim debug output */
00460         bool                        check_since_finish;
00461 
00462         /* data for us to use to figure out compose sequences. */
00463 #       define NO_KEY                                           (0)
00464 #       define COMPOSING_KEY                            (-1)
00465         int                                     first_key;
00466         bool                        num_lock;
00467 
00468 #       ifdef FAMOTIK
00469                 Xftab                   *start;
00470                 bool                henkan;
00471                 unsigned long   j_id;
00472                 unsigned long   values;
00473 #       endif /* FAMOTIK */
00474 
00475 #       ifdef AIX_SYSTEM
00476                 /* AIX kludge flag for GL on X11.  See notes in X11 Driver. */
00477                 bool                expose_in_progress;
00478 #       endif /* AIX_SYSTEM */
00479 
00480 
00481                 /*OPENGL STUFF*/
00482         /* use generic holder for context (avoids many includes) */
00483         void alter                      *context;
00484 
00485         /* needed for glXCreateContext */
00486         XVisualInfo alter       *visualinfo;
00487 
00488                 /* on SoftOpenGL, we need this to set this to DOUBLEBUFFER */
00489                 bool                                  first;
00490 
00491                  /* OpenGL driver will figure out the list but X11 driver*/
00492                  /* will use it to find the best visual.*/
00493                 int alter                               *attribute_list;
00494                 /*this is here to move glx calls out of the x11 driver*/
00495                 void (*opengl_get_best_visual)(HT_Display_Context const *dc);
00496 
00497         /* avoid recursing through selections/check_events */
00498         bool                        checking_events;
00499 
00500                 /*END OPENGL STUFF*/
00501 
00502         /* info needed to convert between our color and TrueColor visual color */
00503         unsigned int red_left_shift;
00504         int red_right_shift;
00505         unsigned int green_left_shift;
00506         int green_right_shift;
00507         unsigned int blue_left_shift;
00508         int blue_right_shift;
00509 } X11Data;
00510 
00511 
00512 /*
00513  *      This structure stands between core Hoops and X11 fonts, so that
00514  *      the composite drivers on top of X11 can store more info about fonts.
00515  */
00516 typedef struct  composite_font_struct {
00517         XFontStruct *xfont;                     /* pointer to X11 font  */
00518 
00519         /* Font character bounding box parameters */
00520         int                     lbearing,               /* left-most extent from origin */
00521                                 rbearing,               /* right-most extent from origin */
00522                                 ascent,                 /* highest extent above origin */
00523                                 descent;                /* lowest extent below origin */
00524 
00525         void alter      *composite;             /* if NOT null, the font is not an X11 font */
00526                                                                 /* the data is driver dependent */
00527         int alter       *xgl_widths;
00528 } Composite_Font;
00529 
00530 /*
00531  * to keep track of events on a per-window basis
00532  */
00533 
00534 typedef struct event_info {
00535         struct event_info         *next;
00536         HT_Display_Context        *dc;
00537         X11Data                           *x11data;
00538         bool                          move_pending;
00539         bool                          move_back_pending;
00540         bool                          resize_pending;
00541         bool                          expose_pending;
00542         HT_Int_Rectangle          expose;
00543         int                                       resize_x;
00544         int                                       resize_y;
00545         int                                       resize_width;
00546         int                                       resize_height;
00547 } X11_Event_Info;
00548 
00549 
00550 #define X11DATA_DEFINED
00551 
00552 #endif /* ifndef X11DATA_DEFINED */
Main Index
HOOPS/3dGS I.M. Interface

     << Back      Full Index      Forward >>