1 /*
   2  * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * Motif-specific data structures for AWT Java objects.
  28  *
  29  */
  30 #ifndef _AWT_P_H_
  31 #define _AWT_P_H_
  32 
  33 #include <stdarg.h>
  34 #include <stdio.h>
  35 #include <stdlib.h>
  36 #include <string.h>
  37 #include <unistd.h>
  38 #ifndef HEADLESS
  39 #include <X11/extensions/Xrender.h>
  40 #endif /* !HEADLESS */
  41 #include "awt.h"
  42 #include "awt_util.h"
  43 #include "color.h"
  44 #include "colordata.h"
  45 #include "gdefs.h"
  46 
  47 #ifndef HEADLESS
  48 #ifndef min
  49 #define min(a,b) ((a) <= (b)? (a):(b))
  50 #endif
  51 #ifndef max
  52 #define max(a,b) ((a) >= (b)? (a):(b))
  53 #endif
  54 #endif /* !HEADLESS */
  55 
  56 #define LOOKUPSIZE 32
  57 
  58 #ifndef HEADLESS
  59 
  60 typedef XRenderPictFormat *
  61 XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
  62 
  63 typedef struct _AwtGraphicsConfigData  {
  64     int         awt_depth;
  65     Colormap    awt_cmap;
  66     XVisualInfo awt_visInfo;
  67     int         awt_num_colors;
  68     awtImageData *awtImage;
  69     int         (*AwtColorMatch)(int, int, int,
  70                                  struct _AwtGraphicsConfigData *);
  71     XImage      *monoImage;
  72     Pixmap      monoPixmap;      /* Used in X11TextRenderer_md.c */
  73     int         monoPixmapWidth; /* Used in X11TextRenderer_md.c */
  74     int         monoPixmapHeight;/* Used in X11TextRenderer_md.c */
  75     GC          monoPixmapGC;    /* Used in X11TextRenderer_md.c */
  76     int         pixelStride;     /* Used in X11SurfaceData.c */
  77     ColorData      *color_data;
  78     struct _GLXGraphicsConfigInfo *glxInfo;
  79     int         isTranslucencySupported; /* Uses Xrender to find this out. */
  80     XRenderPictFormat renderPictFormat; /*Used only if translucency supported*/
  81 } AwtGraphicsConfigData;
  82 
  83 typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;
  84 
  85 typedef struct _AwtScreenData {
  86     int numConfigs;
  87     Window root;
  88     unsigned long whitepixel;
  89     unsigned long blackpixel;
  90     AwtGraphicsConfigDataPtr defaultConfig;
  91     AwtGraphicsConfigDataPtr *configs;
  92 } AwtScreenData;
  93 
  94 typedef AwtScreenData* AwtScreenDataPtr;
  95 
  96 extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen);
  97 extern AwtScreenDataPtr getScreenData(int screen);
  98 #endif /* !HEADLESS */
  99 
 100 /* allocated and initialize a structure */
 101 #define ZALLOC(T)       ((struct T *)calloc(1, sizeof(struct T)))
 102 
 103 #ifndef HEADLESS
 104 
 105 extern int awt_allocate_colors(AwtGraphicsConfigDataPtr);
 106 extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr);
 107 
 108 extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr);
 109 extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr);
 110 extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock);
 111 
 112 #endif /* !HEADLESS */
 113 #endif           /* _AWT_P_H_ */
--- EOF ---