提交 394e7d7a 编写于 作者: P prr

8210776: Upgrade X Window System 6.8.2 to the latest XWD 1.0.7

Reviewed-by: serb
上级 6ec642c4
...@@ -2898,23 +2898,21 @@ to do so,subject to the following conditions: ...@@ -2898,23 +2898,21 @@ to do so,subject to the following conditions:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
%% This notice is provided with respect to X Window System 6.8.2, which may be %% This notice is provided with respect to xwd v1.0.7, which may be
included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris. included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris.
xwd utility
--- begin of LICENSE --- --- begin of LICENSE ---
This is the copyright for the files in src/solaris/native/sun/awt: list.h, Copyright 1994 Hewlett-Packard Co.
multiVis.h, wsutils.h, list.c, multiVis.c Copyright 1996, 1998 The Open Group
Copyright (c) 1994 Hewlett-Packard Co.
Copyright (c) 1996 X Consortium
Permission is hereby granted, free of charge, to any person obtaining Permission to use, copy, modify, distribute, and sell this software and its
a copy of this software and associated documentation files (the documentation for any purpose is hereby granted without fee, provided that
"Software"), to deal in the Software without restriction, including the above copyright notice appear in all copies and that both that
without limitation the rights to use, copy, modify, merge, publish, copyright notice and this permission notice appear in supporting
distribute, sublicense, and sell copies of the Software, and to documentation.
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
...@@ -2922,15 +2920,15 @@ in all copies or substantial portions of the Software. ...@@ -2922,15 +2920,15 @@ in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the X Consortium. from The Open Group.
--- end of LICENSE --- --- end of LICENSE ---
_____________________________ _____________________________
......
...@@ -43,11 +43,13 @@ ...@@ -43,11 +43,13 @@
#include <X11/extensions/XI.h> #include <X11/extensions/XI.h>
#include <jni.h> #include <jni.h>
#include <sizecalc.h> #include <sizecalc.h>
#include "robot_common.h"
#include "canvas.h" #include "canvas.h"
#include "wsutils.h" #include "wsutils.h"
#include "list.h" #include "list.h"
#include "multiVis.h" #include "multiVis.h"
#include "java_awt_event_InputEvent.h"
#if defined(__linux__) || defined(MACOSX) #if defined(__linux__) || defined(MACOSX)
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
......
/* /*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
/* $XConsortium: list.c /main/4 1996/10/14 15:03:56 swick $ */
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
This file contains routines for manipulating generic lists. This file contains routines for manipulating generic lists.
Lists are implemented with a "harness". In other words, each Lists are implemented with a "harness". In other words, each
...@@ -36,16 +36,14 @@ ...@@ -36,16 +36,14 @@
However, the following notice accompanied the original version of this However, the following notice accompanied the original version of this
file: file:
Copyright (c) 1994 Hewlett-Packard Co. Copyright 1994 Hewlett-Packard Co.
Copyright (c) 1996 X Consortium Copyright 1996, 1998 The Open Group
Permission is hereby granted, free of charge, to any person obtaining Permission to use, copy, modify, distribute, and sell this software and its
a copy of this software and associated documentation files (the documentation for any purpose is hereby granted without fee, provided that
"Software"), to deal in the Software without restriction, including the above copyright notice appear in all copies and that both that
without limitation the rights to use, copy, modify, merge, publish, copyright notice and this permission notice appear in supporting
distribute, sublicense, and sell copies of the Software, and to documentation.
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
...@@ -53,32 +51,28 @@ in all copies or substantial portions of the Software. ...@@ -53,32 +51,28 @@ in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the X Consortium. from The Open Group.
----------------------------------------------------------------------- **/ ----------------------------------------------------------------------- **/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "list.h" #include "list.h"
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Sets the pointers of the specified list to NULL. Sets the pointers of the specified list to NULL.
--------------------------------------------------------------------- **/ --------------------------------------------------------------------- **/
#if NeedFunctionPrototypes
void zero_list(list_ptr lp) void zero_list(list_ptr lp)
#else
void zero_list(lp)
list_ptr lp;
#endif
{ {
lp->next = NULL; lp->next = NULL;
lp->ptr.item = NULL; lp->ptr.item = NULL;
...@@ -92,13 +86,7 @@ void zero_list(lp) ...@@ -92,13 +86,7 @@ void zero_list(lp)
and the next pointer in the new node is set to NULL. and the next pointer in the new node is set to NULL.
Returns 1 if successful, 0 if the malloc failed. Returns 1 if successful, 0 if the malloc failed.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes int add_to_list(list_ptr lp, void *item)
int32_t add_to_list(list_ptr lp, void *item)
#else
int32_t add_to_list(lp, item)
list_ptr lp;
void *item;
#endif
{ {
while (lp->next) { while (lp->next) {
lp = lp->next; lp = lp->next;
...@@ -118,11 +106,11 @@ int32_t add_to_list(lp, item) ...@@ -118,11 +106,11 @@ int32_t add_to_list(lp, item)
Creates a new list and sets its pointers to NULL. Creates a new list and sets its pointers to NULL.
Returns a pointer to the new list. Returns a pointer to the new list.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
list_ptr new_list () list_ptr new_list (void)
{ {
list_ptr lp; list_ptr lp;
if (lp = (list_ptr) malloc( sizeof( list_item))) { if ((lp = (list_ptr) malloc( sizeof( list_item)))) {
lp->next = NULL; lp->next = NULL;
lp->ptr.item = NULL; lp->ptr.item = NULL;
} }
...@@ -140,38 +128,27 @@ list_ptr new_list () ...@@ -140,38 +128,27 @@ list_ptr new_list ()
curr pointer in the new list is the same as in the old list. curr pointer in the new list is the same as in the old list.
Returns a pointer to the new list head. Returns a pointer to the new list head.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes list_ptr dup_list_head(list_ptr lp, int start_at_curr)
list_ptr dup_list_head(list_ptr lp, int32_t start_at_curr)
#else
list_ptr dup_list_head(lp, start_at_curr)
list_ptr lp;
int32_t start_at_curr;
#endif
{ {
list_ptr new_list; list_ptr new_listp;
if ((new_list = (list_ptr) malloc( sizeof( list_item))) == NULL) { if ((new_listp = (list_ptr) malloc( sizeof( list_item))) == NULL) {
return (list_ptr)NULL; return (list_ptr)NULL;
} }
new_list->next = start_at_curr ? lp->ptr.curr : lp->next; new_listp->next = start_at_curr ? lp->ptr.curr : lp->next;
new_list->ptr.curr = lp->ptr.curr; new_listp->ptr.curr = lp->ptr.curr;
return new_list; return new_listp;
} }
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Returns the number of items in the list. Returns the number of items in the list.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes unsigned int list_length(list_ptr lp)
uint32_t list_length(list_ptr lp)
#else
uint32_t list_length(lp)
list_ptr lp;
#endif
{ {
uint32_t count = 0; unsigned int count = 0;
while (lp->next) { while (lp->next) {
count++; count++;
...@@ -191,13 +168,7 @@ uint32_t list_length(lp) ...@@ -191,13 +168,7 @@ uint32_t list_length(lp)
Returns a pointer to the item, so the caller can free it if it Returns a pointer to the item, so the caller can free it if it
so desires. If a match is not found, returns NULL. so desires. If a match is not found, returns NULL.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes
void *delete_from_list(list_ptr lp, void *item) void *delete_from_list(list_ptr lp, void *item)
#else
void *delete_from_list(lp, item)
list_ptr lp;
void *item;
#endif
{ {
list_ptr new_next; list_ptr new_next;
...@@ -222,13 +193,7 @@ void *delete_from_list(lp, item) ...@@ -222,13 +193,7 @@ void *delete_from_list(lp, item)
with new_list(). If free_items is true, each item pointed to with new_list(). If free_items is true, each item pointed to
from the node is freed, in addition to the node itself. from the node is freed, in addition to the node itself.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes void delete_list(list_ptr lp, int free_items)
void delete_list(list_ptr lp, int32_t free_items)
#else
void delete_list(lp, free_items)
list_ptr lp;
int32_t free_items;
#endif
{ {
list_ptr del_node; list_ptr del_node;
void *item; void *item;
...@@ -244,13 +209,7 @@ void delete_list(lp, free_items) ...@@ -244,13 +209,7 @@ void delete_list(lp, free_items)
} }
} }
#if NeedFunctionPrototypes
void delete_list_destroying(list_ptr lp, void destructor(void *item)) void delete_list_destroying(list_ptr lp, void destructor(void *item))
#else
void delete_list_destroying(lp, destructor)
list_ptr lp;
void (*destructor)();
#endif
{ {
list_ptr del_node; list_ptr del_node;
void *item; void *item;
...@@ -272,12 +231,7 @@ void delete_list_destroying(lp, destructor) ...@@ -272,12 +231,7 @@ void delete_list_destroying(lp, destructor)
Sets the list head node's curr ptr to the first node in the list. Sets the list head node's curr ptr to the first node in the list.
Returns NULL if the list is empty. Returns NULL if the list is empty.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes
void * first_in_list(list_ptr lp) void * first_in_list(list_ptr lp)
#else
void * first_in_list(lp)
list_ptr lp;
#endif
{ {
if (! lp) { if (! lp) {
...@@ -294,12 +248,7 @@ void * first_in_list(lp) ...@@ -294,12 +248,7 @@ void * first_in_list(lp)
first_in_list must have been called prior. first_in_list must have been called prior.
Returns NULL if no next item. Returns NULL if no next item.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#if NeedFunctionPrototypes
void * next_in_list(list_ptr lp) void * next_in_list(list_ptr lp)
#else
void * next_in_list(lp)
list_ptr lp;
#endif
{ {
if (! lp) { if (! lp) {
...@@ -312,12 +261,8 @@ void * next_in_list(lp) ...@@ -312,12 +261,8 @@ void * next_in_list(lp)
return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL; return lp->ptr.curr ? lp->ptr.curr->ptr.item : NULL;
} }
#if NeedFunctionPrototypes int list_is_empty(list_ptr lp)
int32_t list_is_empty(list_ptr lp)
#else
int32_t list_is_empty(lp)
list_ptr lp;
#endif
{ {
return (lp == NULL || lp->next == NULL); return (lp == NULL || lp->next == NULL);
} }
/* /*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
/* $XConsortium: list.h /main/4 1996/10/14 15:04:04 swick $ */
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
This file contains routines for manipulating generic lists. This file contains routines for manipulating generic lists.
Lists are implemented with a "harness". In other words, each Lists are implemented with a "harness". In other words, each
...@@ -36,16 +36,14 @@ ...@@ -36,16 +36,14 @@
However, the following notice accompanied the original version of this However, the following notice accompanied the original version of this
file: file:
Copyright (c) 1994 Hewlett-Packard Co. Copyright 1994 Hewlett-Packard Co.
Copyright (c) 1996 X Consortium Copyright 1996, 1998 The Open Group
Permission is hereby granted, free of charge, to any person obtaining Permission to use, copy, modify, distribute, and sell this software and its
a copy of this software and associated documentation files (the documentation for any purpose is hereby granted without fee, provided that
"Software"), to deal in the Software without restriction, including the above copyright notice appear in all copies and that both that
without limitation the rights to use, copy, modify, merge, publish, copyright notice and this permission notice appear in supporting
distribute, sublicense, and sell copies of the Software, and to documentation.
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
...@@ -53,23 +51,22 @@ in all copies or substantial portions of the Software. ...@@ -53,23 +51,22 @@ in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the X Consortium. from The Open Group.
-------------------------------------------------------------------- **/ -------------------------------------------------------------------- **/
#include "gdefs.h"
#ifndef LIST_DEF #ifndef LIST_DEF
#define LIST_DEF #define LIST_DEF
#include <X11/Xfuncproto.h>
#define LESS -1 #define LESS -1
#define EQUAL 0 #define EQUAL 0
#define GREATER 1 #define GREATER 1
...@@ -85,65 +82,41 @@ typedef struct _list_item { ...@@ -85,65 +82,41 @@ typedef struct _list_item {
} list, list_item, *list_ptr; } list, list_item, *list_ptr;
typedef void (*DESTRUCT_FUNC_PTR)( typedef void (*DESTRUCT_FUNC_PTR)(
#if NeedFunctionPrototypes
void * void *
#endif
); );
void zero_list( void zero_list(
#if NeedFunctionPrototypes
list_ptr list_ptr
#endif
); );
int32_t add_to_list ( int add_to_list (
#if NeedFunctionPrototypes
list_ptr , void * list_ptr , void *
#endif
); );
list_ptr new_list ( list_ptr new_list (
#if NeedFunctionPrototypes
void void
#endif
); );
list_ptr dup_list_head ( list_ptr dup_list_head (
#if NeedFunctionPrototypes list_ptr , int
list_ptr , int32_t
#endif
); );
uint32_t list_length( unsigned int list_length(
#if NeedFunctionPrototypes
list_ptr list_ptr
#endif
); );
void *delete_from_list ( void *delete_from_list (
#if NeedFunctionPrototypes
list_ptr , void * list_ptr , void *
#endif
); );
void delete_list( void delete_list(
#if NeedFunctionPrototypes list_ptr , int
list_ptr , int32_t
#endif
); );
void delete_list_destroying ( void delete_list_destroying (
#if NeedFunctionPrototypes
list_ptr , DESTRUCT_FUNC_PTR list_ptr , DESTRUCT_FUNC_PTR
#endif
); );
void *first_in_list ( void *first_in_list (
#if NeedFunctionPrototypes
list_ptr list_ptr
#endif
); );
void *next_in_list ( void *next_in_list (
#if NeedFunctionPrototypes
list_ptr list_ptr
#endif
); );
int32_t list_is_empty ( int list_is_empty (
#if NeedFunctionPrototypes
list_ptr list_ptr
#endif
); );
#endif #endif
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
/* $XConsortium: multiVis.c /main/4 1996/10/14 15:04:08 swick $ */
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
This file contains functions to create a list of regions which This file contains functions to create a list of regions which
tile a specified window. Each region contains all visible tile a specified window. Each region contains all visible
...@@ -37,16 +36,14 @@ ...@@ -37,16 +36,14 @@
However, the following notice accompanied the original version of this However, the following notice accompanied the original version of this
file: file:
Copyright (c) 1994 Hewlett-Packard Co. Copyright 1994 Hewlett-Packard Co.
Copyright (c) 1996 X Consortium Copyright 1996, 1998 The Open Group
Permission is hereby granted, free of charge, to any person obtaining Permission to use, copy, modify, distribute, and sell this software and its
a copy of this software and associated documentation files (the documentation for any purpose is hereby granted without fee, provided that
"Software"), to deal in the Software without restriction, including the above copyright notice appear in all copies and that both that
without limitation the rights to use, copy, modify, merge, publish, copyright notice and this permission notice appear in supporting
distribute, sublicense, and sell copies of the Software, and to documentation.
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
...@@ -54,17 +51,18 @@ in all copies or substantial portions of the Software. ...@@ -54,17 +51,18 @@ in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the X Consortium. from The Open Group.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
#include <stdlib.h> #include <stdlib.h>
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
...@@ -73,20 +71,16 @@ from the X Consortium. ...@@ -73,20 +71,16 @@ from the X Consortium.
#include "list.h" #include "list.h"
#include "wsutils.h" #include "wsutils.h"
#include "multiVis.h" #include "multiVis.h"
#include "robot_common.h"
static char *vis_class_str[] = { "StaticGray" , "GrayScale" , "StaticColor",
"PseudoColor","TrueColor","DirectColor" } ;
/* These structures are copied from X11/region.h. For some reason /* These structures are copied from X11/region.h. For some reason
* they're invisible from the outside.*/ * they're invisible from the outside.
*/
typedef struct { typedef struct {
short x1, x2, y1, y2; short x1, x2, y1, y2;
} myBox, myBOX, myBoxRec, *myBoxPtr; } myBox, myBOX, myBoxRec, *myBoxPtr;
typedef struct my_XRegion { /* 64-bit: Region is supposed to be opaque */ typedef struct my_XRegion {
long size; /* but it is defined here anyway. I'm going */ long size;
long numRects; /* to leave those longs alone. */ long numRects;
myBOX *rects; myBOX *rects;
myBOX extents; myBOX extents;
} myREGION; } myREGION;
...@@ -96,10 +90,10 @@ typedef struct { ...@@ -96,10 +90,10 @@ typedef struct {
Window win; Window win;
Visual *vis; Visual *vis;
Colormap cmap; Colormap cmap;
int32_t x_rootrel, y_rootrel; /* root relative location of window */ int x_rootrel, y_rootrel; /* root relative location of window */
int32_t x_vis, y_vis; /* rt rel x,y of vis part, not parent clipped */ int x_vis, y_vis; /* rt rel x,y of vis part, not parent clipped */
int32_t width, height; /* width and height of visible part */ int width, height; /* width and height of visible part */
int32_t border_width; /* border width of the window */ int border_width; /* border width of the window */
Window parent; /* id of parent (for debugging) */ Window parent; /* id of parent (for debugging) */
} image_win_type; } image_win_type;
...@@ -110,10 +104,10 @@ typedef struct { ...@@ -110,10 +104,10 @@ typedef struct {
Window win; /* lowest window of this visual */ Window win; /* lowest window of this visual */
Visual *vis; Visual *vis;
Colormap cmap; Colormap cmap;
int32_t x_rootrel, y_rootrel; /* root relative location of bottom window */ int x_rootrel, y_rootrel; /* root relative location of bottom window */
int32_t x_vis, y_vis; /* rt rel x,y of vis part, not parent clipped */ int x_vis, y_vis; /* rt rel x,y of vis part, not parent clipped */
int32_t width, height; /* w & h of visible rect of bottom window */ int width, height; /* w & h of visible rect of bottom window */
int32_t border; /* border width of the window */ int border; /* border width of the window */
Region visible_region; Region visible_region;
} image_region_type; } image_region_type;
...@@ -143,77 +137,67 @@ extern list_ptr new_list(); ...@@ -143,77 +137,67 @@ extern list_ptr new_list();
extern list_ptr dup_list_head(); extern list_ptr dup_list_head();
extern void * first_in_list(); extern void * first_in_list();
extern void * next_in_list(); extern void * next_in_list();
extern int32_t add_to_list(); extern int add_to_list();
extern void zero_list(); extern void zero_list();
extern void delete_list(); extern void delete_list();
extern void delete_list_destroying(); extern void delete_list_destroying();
extern uint32_t list_length(); extern unsigned int list_length();
*/ */
/* Prototype Declarations for Static Functions */ /* Prototype Declarations for Static Functions */
static void QueryColorMap(
Display *, Colormap , Visual *,
XColor **, int *, int *, int *
);
static void TransferImage( static void TransferImage(
#if NeedFunctionPrototypes Display *, XImage *,int, int , image_region_type*,
Display *, XImage *,int32_t, int32_t , image_region_type*, XImage *,int ,int
XImage *,int32_t ,int32_t
#endif
); );
static XImage * ReadRegionsInList( static XImage * ReadRegionsInList(
#if NeedFunctionPrototypes Display *, Visual *, int, int, unsigned int,
Display *, Visual *, int32_t ,int32_t ,int32_t , unsigned int, XRectangle, list_ptr
int32_t , XRectangle, list_ptr
#endif
); );
static list_ptr make_region_list( static list_ptr make_region_list(
#if NeedFunctionPrototypes
Display*, Window, XRectangle*, Display*, Window, XRectangle*,
int32_t*, int32_t, XVisualInfo**, int32_t * int*, int, XVisualInfo**, int *
#endif
); );
static void destroy_region_list( static void destroy_region_list(
#if NeedFunctionPrototypes
list_ptr list_ptr
#endif
) ; ) ;
static void subtr_rect_from_image_region( static void subtr_rect_from_image_region(
#if NeedFunctionPrototypes image_region_type *, int , int , int , int
image_region_type *, int32_t , int32_t , int32_t , int32_t
#endif
); );
static void add_rect_to_image_region( static void add_rect_to_image_region(
#if NeedFunctionPrototypes
image_region_type *, image_region_type *,
int32_t , int32_t , int32_t , int32_t int , int , int , int
#endif
); );
static int32_t src_in_region_list( static int src_in_region_list(
#if NeedFunctionPrototypes
image_win_type *, list_ptr image_win_type *, list_ptr
#endif
); );
static void add_window_to_list( static void add_window_to_list(
#if NeedFunctionPrototypes list_ptr, Window, int, int ,
list_ptr, Window, int32_t, int32_t , int , int , int , int, int,
int32_t , int32_t , int32_t , int32_t, int32_t,
Visual*, Colormap, Window Visual*, Colormap, Window
#endif
); );
static int32_t src_in_image( static int src_in_image(
#if NeedFunctionPrototypes image_win_type *, int , XVisualInfo**
image_win_type *, int32_t , XVisualInfo**
#endif
); );
static int32_t src_in_overlay( static int src_in_overlay(
#if NeedFunctionPrototypes image_region_type *, int, OverlayInfo *, int*, int*
image_region_type *, int32_t, OverlayInfo *, int32_t*, int32_t*
#endif
); );
static void make_src_list(
Display *, list_ptr, XRectangle *, Window,
int, int, XWindowAttributes *, XRectangle *
);
static void destroy_image_region(
image_region_type *
);
/* End of Prototype Declarations */ /* End of Prototype Declarations */
void initFakeVisual(Vis) void initFakeVisual(Visual *Vis)
Visual *Vis ;
{ {
Vis->ext_data=NULL; Vis->ext_data=NULL;
Vis->class = DirectColor ; Vis->class = DirectColor ;
...@@ -224,42 +208,87 @@ Visual *Vis ; ...@@ -224,42 +208,87 @@ Visual *Vis ;
Vis->bits_per_rgb = 8 ; Vis->bits_per_rgb = 8 ;
} }
/* QueryColorMap has been moved into robot_common.c so it can be used by static void
* awt_DataTransferer.c as well. QueryColorMap(Display *disp, Colormap src_cmap, Visual *src_vis,
*/ XColor **src_colors, int *rShift, int *gShift, int *bShift)
{
unsigned int ncolors,i ;
unsigned long redMask, greenMask, blueMask;
int redShift, greenShift, blueShift;
XColor *colors ;
ncolors = (unsigned) src_vis->map_entries ;
*src_colors = colors = (XColor *)malloc(ncolors * sizeof(XColor) ) ;
if(src_vis->class != TrueColor && src_vis->class != DirectColor)
{
for(i=0 ; i < ncolors ; i++)
{
colors[i].pixel = i ;
colors[i].pad = 0;
colors[i].flags = DoRed|DoGreen|DoBlue;
}
}
else /** src is decomposed rgb ***/
{
/* Get the X colormap */
redMask = src_vis->red_mask;
greenMask = src_vis->green_mask;
blueMask = src_vis->blue_mask;
redShift = 0; while (!(redMask&0x1)) {
redShift++;
redMask = redMask>>1;
}
greenShift = 0; while (!(greenMask&0x1)) {
greenShift++;
greenMask = greenMask>>1;
}
blueShift = 0; while (!(blueMask&0x1)) {
blueShift++;
blueMask = blueMask>>1;
}
*rShift = redShift ;
*gShift = greenShift ;
*bShift = blueShift ;
for (i=0; i<ncolors; i++) {
if( i <= redMask)colors[i].pixel = (i<<redShift) ;
if( i <= greenMask)colors[i].pixel |= (i<<greenShift) ;
if( i <= blueMask)colors[i].pixel |= (i<<blueShift) ;
/***** example :for gecko's 3-3-2 map, blue index should be <= 3.
colors[i].pixel = (i<<redShift)|(i<<greenShift)|(i<<blueShift);
*****/
colors[i].pad = 0;
colors[i].flags = DoRed|DoGreen|DoBlue;
}
}
int32_t XQueryColors(disp, src_cmap, colors, (int) ncolors);
GetMultiVisualRegions(disp,srcRootWinid, x, y, width, height, }
transparentOverlays,numVisuals, pVisuals,numOverlayVisuals, pOverlayVisuals,
numImageVisuals, pImageVisuals,vis_regions,vis_image_regions,allImage) int
Display *disp; GetMultiVisualRegions(Display *disp,
Window srcRootWinid; /* root win on which grab was done */ /* root win on which grab was done */
int32_t x; /* root rel UL corner of bounding box of grab */ Window srcRootWinid,
int32_t y; /* root rel UL corner of bounding box of grab */
uint32_t width; /* size of bounding box of grab */ int x, int y,
uint32_t height; /* size of bounding box of grab */
int32_t *transparentOverlays ; unsigned int width, unsigned int height,
int32_t *numVisuals; int *transparentOverlays, int *numVisuals,
XVisualInfo **pVisuals; XVisualInfo **pVisuals, int *numOverlayVisuals,
int32_t *numOverlayVisuals; OverlayInfo **pOverlayVisuals,
OverlayInfo **pOverlayVisuals; int *numImageVisuals, XVisualInfo ***pImageVisuals,
int32_t *numImageVisuals; /* list of regions to read from */
XVisualInfo ***pImageVisuals; list_ptr *vis_regions,
list_ptr *vis_regions; /* list of regions to read from */ list_ptr *vis_image_regions, int *allImage)
list_ptr *vis_image_regions ;
int32_t *allImage ;
{ {
int32_t hasNonDefault; int hasNonDefault;
XRectangle bbox; /* bounding box of grabbed area */ XRectangle bbox; /* bounding box of grabbed area */
/* Java uses 32-bit ints for coordinates, but XRectangles use 16-bit shorts. bbox.x = x; /* init X rect for bounding box */
* Hope nobody passes in too big a coordinate */ bbox.y = y;
bbox.width = width;
bbox.x = (short) x; /* init X rect for bounding box */ bbox.height = height;
bbox.y = (short) y;
bbox.width = (unsigned short) width;
bbox.height = (unsigned short) height;
GetXVisualInfo(disp,DefaultScreen(disp), GetXVisualInfo(disp,DefaultScreen(disp),
transparentOverlays, transparentOverlays,
...@@ -290,49 +319,48 @@ GetMultiVisualRegions(disp,srcRootWinid, x, y, width, height, ...@@ -290,49 +319,48 @@ GetMultiVisualRegions(disp,srcRootWinid, x, y, width, height,
} }
static void TransferImage(disp,reg_image,srcw,srch,reg, static void TransferImage(Display *disp, XImage *reg_image,
target_image,dst_x,dst_y) int srcw, int srch,
Display *disp; image_region_type *reg, XImage *target_image,
XImage *reg_image,*target_image ; int dst_x, int dst_y)
image_region_type *reg;
int32_t srcw,srch,dst_x , dst_y ;
{ {
int32_t ncolors; int i,j,old_pixel,new_pixel,red_ind,green_ind,blue_ind ;
int32_t i,j,old_pixel,new_pixel,red_ind,green_ind,blue_ind ;
XColor *colors; XColor *colors;
int32_t rShift,gShift,bShift; int rShift = 0, gShift = 0, bShift = 0;
int32_t targetBytesPerLine ;
ncolors = QueryColorMap(disp,reg->cmap,reg->vis,&colors, QueryColorMap(disp,reg->cmap,reg->vis,&colors,
&rShift,&gShift,&bShift) ; &rShift,&gShift,&bShift) ;
targetBytesPerLine = target_image->bytes_per_line;
switch (reg->vis->class) { switch (reg->vis->class) {
case TrueColor : case TrueColor :
for(i=0 ; i < srch ; i++) for(i=0 ; i < srch ; i++)
{ {
for(j=0 ; j < srcw ; j++) for(j=0 ; j < srcw ; j++)
{ {
old_pixel = (int32_t) XGetPixel(reg_image,j,i) ; old_pixel = XGetPixel(reg_image,j,i) ;
/* commented out since not using server RGB masks in all true color modes /*
* JDK modification.
* commented out since not using server RGB masks in all true color modes
* causes the R and B values to be swapped around on some X servers * causes the R and B values to be swapped around on some X servers
* - robi.khan@eng 9/7/1999 * - robi.khan@eng 9/7/1999
* if( reg->vis->map_entries == 16) { * if( reg->vis->map_entries == 16) {
*/ */
red_ind = (old_pixel & reg->vis->red_mask) >> rShift ; red_ind = (old_pixel & reg->vis->red_mask) >> rShift ;
green_ind = (old_pixel & reg->vis->green_mask) >> gShift ; green_ind = (old_pixel & reg->vis->green_mask) >> gShift ;
blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ; blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ;
new_pixel = ( new_pixel = (
((colors[red_ind].red >> 8) << RED_SHIFT) ((colors[red_ind].red >> 8) << RED_SHIFT)
|((colors[green_ind].green >> 8) << GREEN_SHIFT) |((colors[green_ind].green >> 8) << GREEN_SHIFT)
|((colors[blue_ind].blue >> 8) << BLUE_SHIFT) |((colors[blue_ind].blue >> 8) << BLUE_SHIFT)
); );
/* } /* JDK modification.
* else * else part of above modification
* new_pixel = old_pixel; *
* }
* else
* new_pixel = old_pixel;
*/ */
XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel); XPutPixel(target_image,dst_x+j, dst_y+i,new_pixel);
...@@ -343,14 +371,15 @@ int32_t srcw,srch,dst_x , dst_y ; ...@@ -343,14 +371,15 @@ int32_t srcw,srch,dst_x , dst_y ;
case DirectColor : case DirectColor :
for(i=0 ; i < srch ; i++) for(i=0 ; i < srch ; i++)
{ {
for(j=0 ; j < srcw ; j++) for(j=0 ; j < srcw ; j++)
{ {
old_pixel = (int32_t) XGetPixel(reg_image,j,i) ; old_pixel = XGetPixel(reg_image,j,i) ;
red_ind = (old_pixel & reg->vis->red_mask) >> rShift ; red_ind = (old_pixel & reg->vis->red_mask) >> rShift ;
green_ind = (old_pixel & reg->vis->green_mask) >> gShift ; green_ind = (old_pixel & reg->vis->green_mask) >> gShift ;
blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ; blue_ind = (old_pixel & reg->vis->blue_mask) >> bShift ;
new_pixel = ( new_pixel = (
((colors[red_ind].red >> 8) << RED_SHIFT) ((colors[red_ind].red >> 8) << RED_SHIFT)
|((colors[green_ind].green >> 8) << GREEN_SHIFT) |((colors[green_ind].green >> 8) << GREEN_SHIFT)
|((colors[blue_ind].blue >> 8) << BLUE_SHIFT) |((colors[blue_ind].blue >> 8) << BLUE_SHIFT)
...@@ -365,9 +394,9 @@ int32_t srcw,srch,dst_x , dst_y ; ...@@ -365,9 +394,9 @@ int32_t srcw,srch,dst_x , dst_y ;
{ {
for(j=0 ; j < srcw ; j++) for(j=0 ; j < srcw ; j++)
{ {
old_pixel = (int32_t) XGetPixel(reg_image,j,i) ; old_pixel = XGetPixel(reg_image,j,i) ;
new_pixel = ( new_pixel = (
((colors[old_pixel].red >> 8) << RED_SHIFT) ((colors[old_pixel].red >> 8) << RED_SHIFT)
|((colors[old_pixel].green >> 8) << GREEN_SHIFT) |((colors[old_pixel].green >> 8) << GREEN_SHIFT)
|((colors[old_pixel].blue >> 8) << BLUE_SHIFT) |((colors[old_pixel].blue >> 8) << BLUE_SHIFT)
...@@ -378,66 +407,76 @@ int32_t srcw,srch,dst_x , dst_y ; ...@@ -378,66 +407,76 @@ int32_t srcw,srch,dst_x , dst_y ;
} }
break; break;
} }
/* JDK modification
/* Fix memory leak by freeing colors * Fix memory leak by freeing colors
* - robi.khan@eng 9/22/1999 * - robi.khan@eng 9/22/1999
*/ */
free(colors); free(colors);
} }
static XImage * static XImage *
ReadRegionsInList(disp,fakeVis,depth,format,width,height,bbox,regions) ReadRegionsInList(Display *disp, Visual *fakeVis, int depth, int format,
Display *disp ; unsigned int width, unsigned int height,
Visual *fakeVis ; XRectangle bbox, /* bounding box of grabbed area */
int32_t depth , width , height ; list_ptr regions) /* list of regions to read from */
int32_t format ;
XRectangle bbox; /* bounding box of grabbed area */
list_ptr regions;/* list of regions to read from */
{ {
XImage *ximage ; image_region_type *reg;
image_region_type* reg; int dst_x, dst_y; /* where in pixmap to write (UL) */
int32_t rect; int diff;
XImage *reg_image,*ximage ;
int srcRect_x,srcRect_y,srcRect_width,srcRect_height ;
int bytes_per_line;
ximage = XCreateImage(disp,fakeVis,(uint32_t) depth,format,0,NULL, ximage = XCreateImage(disp,fakeVis,depth,format,0,NULL,width,height,
(uint32_t)width,(uint32_t)height,8,0); 8,0) ;
bytes_per_line = ximage->bytes_per_line;
if (format == ZPixmap)
ximage->data = malloc(height*bytes_per_line);
else
ximage->data = malloc(height*bytes_per_line*depth);
ximage->data = calloc(ximage->bytes_per_line*height*((format==ZPixmap)? 1 : depth), sizeof(char));
ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/ ximage->bits_per_pixel = depth; /** Valid only if format is ZPixmap ***/
for (reg = (image_region_type *) first_in_list( regions); reg; for (reg = (image_region_type *) first_in_list( regions); reg;
reg = (image_region_type *) next_in_list( regions)) reg = (image_region_type *) next_in_list( regions))
{ {
struct my_XRegion *vis_reg = (struct my_XRegion *)(reg->visible_region); int rect;
for (rect = 0; rect < vis_reg->numRects; rect++) struct my_XRegion *vis_reg;
vis_reg = (struct my_XRegion *)(reg->visible_region);
for (rect = 0;
rect < vis_reg->numRects;
rect++)
{ {
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Intersect bbox with visible part of region giving src rect & output Intersect bbox with visible part of region giving src rect & output
location. Width is the min right side minus the max left side. location. Width is the min right side minus the max left side.
Similar for height. Offset src rect so x,y are relative to Similar for height. Offset src rect so x,y are relative to
origin of win, not the root-relative visible rect of win. origin of win, not the root-relative visible rect of win.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
int32_t srcRect_width = MIN( vis_reg->rects[rect].x2, bbox.width + bbox.x) srcRect_width = MIN( vis_reg->rects[rect].x2, bbox.width + bbox.x) -
- MAX( vis_reg->rects[rect].x1, bbox.x); MAX( vis_reg->rects[rect].x1, bbox.x);
srcRect_height = MIN( vis_reg->rects[rect].y2, bbox.height + bbox.y) -
int32_t srcRect_height = MIN( vis_reg->rects[rect].y2, bbox.height + bbox.y) MAX( vis_reg->rects[rect].y1, bbox.y);
- MAX( vis_reg->rects[rect].y1, bbox.y); diff = bbox.x - vis_reg->rects[rect].x1;
srcRect_x = MAX( 0, diff) + (vis_reg->rects[rect].x1 - reg->x_rootrel - reg->border);
int32_t diff = bbox.x - vis_reg->rects[rect].x1; dst_x = MAX( 0, -diff) ;
int32_t srcRect_x = MAX( 0, diff) + (vis_reg->rects[rect].x1 - reg->x_rootrel - reg->border); diff = bbox.y - vis_reg->rects[rect].y1;
int32_t dst_x = MAX( 0, -diff) ; srcRect_y = MAX( 0, diff) + (vis_reg->rects[rect].y1 - reg->y_rootrel - reg->border);
dst_y = MAX( 0, -diff) ;
diff = bbox.y - vis_reg->rects[rect].y1; reg_image = XGetImage(disp,reg->win,srcRect_x,srcRect_y,
int32_t srcRect_y = MAX( 0, diff) + (vis_reg->rects[rect].y1 - reg->y_rootrel - reg->border); srcRect_width,srcRect_height,AllPlanes,format) ;
int32_t dst_y = MAX( 0, -diff) ;
XImage* reg_image = XGetImage(disp,reg->win,srcRect_x,srcRect_y, /* JDK Modification
(uint32_t) srcRect_width, (uint32_t) srcRect_height,AllPlanes,format) ; * Enclose in if test and also call XDestroyImage
*/
if (reg_image) { if (reg_image) {
TransferImage(disp,reg_image,srcRect_width, TransferImage(disp,reg_image,srcRect_width,
srcRect_height,reg,ximage,dst_x,dst_y) ; srcRect_height,reg,ximage,dst_x,dst_y) ;
XDestroyImage(reg_image); XDestroyImage(reg_image);
} }
} }
} }
return ximage ; return ximage ;
} }
...@@ -446,62 +485,61 @@ list_ptr regions;/* list of regions to read from */ ...@@ -446,62 +485,61 @@ list_ptr regions;/* list of regions to read from */
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, XImage *ReadAreaToImage(Display *disp,
numVisuals,pVisuals,numOverlayVisuals,pOverlayVisuals,numImageVisuals, /* root win on which grab was done */
pImageVisuals,vis_regions,vis_image_regions,format,allImage) Window srcRootWinid,
Display *disp; /* root rel UL corner of bounding box of grab */
Window srcRootWinid; /* root win on which grab was done */ int x, int y,
int32_t x; /* root rel UL corner of bounding box of grab */ /* size of bounding box of grab */
int32_t y; unsigned int width, unsigned int height,
uint32_t width; /* size of bounding box of grab */ int numVisuals, XVisualInfo *pVisuals,
uint32_t height; int numOverlayVisuals, OverlayInfo *pOverlayVisuals,
/** int32_t transparentOverlays; ***/ int numImageVisuals, XVisualInfo **pImageVisuals,
int32_t numVisuals; /* list of regions to read from */
XVisualInfo *pVisuals; list_ptr vis_regions,
int32_t numOverlayVisuals; /* list of regions to read from */
OverlayInfo *pOverlayVisuals; list_ptr vis_image_regions,
int32_t numImageVisuals; int format, int allImage)
XVisualInfo **pImageVisuals;
list_ptr vis_regions; /* list of regions to read from */
list_ptr vis_image_regions ;/* list of regions to read from */
int32_t format;
int32_t allImage ;
{ {
image_region_type *reg; image_region_type *reg;
XRectangle bbox; /* bounding box of grabbed area */ XRectangle bbox; /* bounding box of grabbed area */
int32_t depth ; int depth ;
XImage *ximage, *ximage_ipm ; XImage *ximage, *ximage_ipm = NULL;
Visual fakeVis ; Visual fakeVis ;
int32_t x1, y1; int x1, y1;
XImage *image; XImage *image;
#if 0
unsigned char *pmData , *ipmData ; unsigned char *pmData , *ipmData ;
int32_t transparentColor, transparentType; #endif
int32_t srcRect_x,srcRect_y,srcRect_width,srcRect_height ; int transparentColor, transparentType;
int32_t diff ; int srcRect_x,srcRect_y,srcRect_width,srcRect_height ;
int32_t dst_x, dst_y; /* where in pixmap to write (UL) */ int diff ;
int32_t pixel; int dst_x, dst_y; /* where in pixmap to write (UL) */
int pixel;
bbox.x = (short) x; /* init X rect for bounding box */ bbox.x = x; /* init X rect for bounding box */
bbox.y = (short) y; bbox.y = y;
bbox.width = (unsigned short) width; bbox.width = width;
bbox.height = (unsigned short) height; bbox.height = height;
ximage_ipm = NULL;
initFakeVisual(&fakeVis) ; initFakeVisual(&fakeVis) ;
depth = 24 ; depth = 24 ;
ximage = ReadRegionsInList(disp,&fakeVis,depth,format, ximage = ReadRegionsInList(disp,&fakeVis,depth,format,width,height,
(int32_t) width, (int32_t) height, bbox,vis_regions) ; bbox,vis_regions) ;
#if 0
pmData = (unsigned char *)ximage -> data ; pmData = (unsigned char *)ximage -> data ;
#endif
/* if transparency possible do it again, but this time for image planes only */ /* if transparency possible do it again, but this time for image planes only */
if (vis_image_regions && (vis_image_regions->next) && !allImage) if (vis_image_regions && (vis_image_regions->next) && !allImage)
{ {
ximage_ipm = ReadRegionsInList(disp,&fakeVis,depth,format, ximage_ipm = ReadRegionsInList(disp,&fakeVis,depth,format,width,height,
(int32_t) width, (int32_t) height,bbox,vis_image_regions) ; bbox,vis_image_regions) ;
#if 0
ipmData = (unsigned char *)ximage_ipm -> data ; ipmData = (unsigned char *)ximage_ipm -> data ;
#endif
} }
/* Now tranverse the overlay visual windows and test for transparency index. */ /* Now tranverse the overlay visual windows and test for transparency index. */
/* If you find one, subsitute the value from the matching image plane pixmap. */ /* If you find one, subsitute the value from the matching image plane pixmap. */
...@@ -513,21 +551,20 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, ...@@ -513,21 +551,20 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
if (src_in_overlay( reg, numOverlayVisuals, pOverlayVisuals, if (src_in_overlay( reg, numOverlayVisuals, pOverlayVisuals,
&transparentColor, &transparentType)) &transparentColor, &transparentType))
{ {
int32_t test = 0 ; int test = 0 ;
srcRect_width = MIN( reg->width + reg->x_vis, bbox.width + bbox.x) srcRect_width = MIN( reg->width + reg->x_vis, bbox.width + bbox.x)
- MAX( reg->x_vis, bbox.x); - MAX( reg->x_vis, bbox.x);
srcRect_height = MIN( reg->height + reg->y_vis, bbox.height srcRect_height = MIN( reg->height + reg->y_vis, bbox.height
+ bbox.y) - MAX( reg->y_vis, bbox.y); + bbox.y) - MAX( reg->y_vis, bbox.y);
diff = bbox.x - reg->x_vis; diff = bbox.x - reg->x_vis;
srcRect_x = MAX( 0, diff) + (reg->x_vis - reg->x_rootrel - reg->border); srcRect_x = MAX( 0, diff) + (reg->x_vis - reg->x_rootrel - reg->border);
dst_x = MAX( 0, -diff) ; dst_x = MAX( 0, -diff) ;
diff = bbox.y - reg->y_vis; diff = bbox.y - reg->y_vis;
srcRect_y = MAX( 0, diff) + (reg->y_vis - reg->y_rootrel - reg->border); srcRect_y = MAX( 0, diff) + (reg->y_vis - reg->y_rootrel - reg->border);
dst_y = MAX( 0, -diff) ; dst_y = MAX( 0, -diff) ;
/* let's test some pixels for transparency */ /* let's test some pixels for transparency */
image = XGetImage(disp, reg->win, srcRect_x, srcRect_y, image = XGetImage(disp, reg->win, srcRect_x, srcRect_y,
(uint32_t) srcRect_width, (uint32_t) srcRect_height, srcRect_width, srcRect_height, 0xffffffff, ZPixmap);
0xffffffff, ZPixmap);
/* let's assume byte per pixel for overlay image for now */ /* let's assume byte per pixel for overlay image for now */
if ((image->depth == 8) && (transparentType == TransparentPixel)) if ((image->depth == 8) && (transparentType == TransparentPixel))
...@@ -541,24 +578,24 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, ...@@ -541,24 +578,24 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
{ {
if (*pixel_ptr++ == transparentColor) if (*pixel_ptr++ == transparentColor)
{ {
/* #if 0
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*/ #endif
pixel = (int32_t) XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ; pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ;
XPutPixel(ximage,dst_x+x1, dst_y+y1,(unsigned long)pixel); XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel);
if(!test){ if(!test){
test = 1 ; test = 1 ;
} }
} }
/* #if 0
else { else {
pmData +=3; pmData +=3;
ipmData +=3; ipmData +=3;
} }
*/ #endif
} }
start_of_line += image->bytes_per_line; start_of_line += image->bytes_per_line;
} }
...@@ -567,53 +604,52 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, ...@@ -567,53 +604,52 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
for (y1 = 0; y1 < srcRect_height; y1++) { for (y1 = 0; y1 < srcRect_height; y1++) {
for (x1 = 0; x1 < srcRect_width; x1++) for (x1 = 0; x1 < srcRect_width; x1++)
{ {
int32_t pixel_value = (int32_t) XGetPixel(image, x1, y1); int pixel_value = XGetPixel(image, x1, y1);
if (pixel_value == transparentColor) if (pixel_value == transparentColor)
{ {
/* #if 0
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*/ #endif
pixel = (int32_t) XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ; pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ;
XPutPixel(ximage,dst_x+x1, dst_y+y1,(unsigned long)pixel); XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel);
if(!test){ if(!test){
test = 1 ; test = 1 ;
} }
} }
/* #if 0
else { else {
pmData +=3; pmData +=3;
ipmData +=3; ipmData +=3;
} }
*/ #endif
} }
} }
} else { } else {
for (y1 = 0; y1 < srcRect_height; y1++) { for (y1 = 0; y1 < srcRect_height; y1++) {
for (x1 = 0; x1 < srcRect_width; x1++) for (x1 = 0; x1 < srcRect_width; x1++)
{ {
int32_t pixel_value = (int32_t) XGetPixel(image, x1, y1); int pixel_value = XGetPixel(image, x1, y1);
if (pixel_value & transparentColor) if (pixel_value & transparentColor)
{ {
/* #if 0
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*pmData++ = *ipmData++; *pmData++ = *ipmData++;
*/ #endif
pixel = (int32_t) XGetPixel(ximage_ipm,dst_x+x1, pixel = XGetPixel(ximage_ipm,dst_x+x1,dst_y+y1) ;
dst_y+y1) ; XPutPixel(ximage,dst_x+x1, dst_y+y1,pixel);
XPutPixel(ximage,dst_x+x1, dst_y+y1,(unsigned long)pixel);
if(!test){ if(!test){
test = 1 ; test = 1 ;
} }
} }
/* #if 0
else { else {
pmData +=3; pmData +=3;
ipmData +=3; ipmData +=3;
} }
*/ #endif
} }
} }
} }
...@@ -621,6 +657,7 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, ...@@ -621,6 +657,7 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
XDestroyImage (image); XDestroyImage (image);
} /* end of src_in_overlay */ } /* end of src_in_overlay */
} /** end transparency **/ } /** end transparency **/
/* JDK modification - call XDestroyImage if non-null */
if (ximage_ipm != NULL) { if (ximage_ipm != NULL) {
XDestroyImage(ximage_ipm); XDestroyImage(ximage_ipm);
} }
...@@ -640,38 +677,36 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, ...@@ -640,38 +677,36 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height,
image_wins must point to an existing list struct that's already image_wins must point to an existing list struct that's already
been zeroed (zero_list()). been zeroed (zero_list()).
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel, static void make_src_list(Display *disp, list_ptr image_wins,
curr_attrs, pclip) /* bnding box of area we want */
Display *disp; XRectangle *bbox,
list_ptr image_wins; Window curr,
XRectangle *bbox; /* bnding box of area we want */ /* pos of curr WRT root */
Window curr; int x_rootrel, int y_rootrel,
int32_t x_rootrel; /* pos of curr WRT root */ XWindowAttributes *curr_attrs,
int32_t y_rootrel; /* visible part of curr, not obscurred by ancestors */
XWindowAttributes *curr_attrs; XRectangle *pclip)
XRectangle *pclip; /* visible part of curr, not */
/* obscurred by ancestors */
{ {
XWindowAttributes child_attrs; XWindowAttributes child_attrs;
Window root, parent, *child; /* variables for XQueryTree() */ Window root, parent, *child; /* variables for XQueryTree() */
Window *save_child_list; /* variables for XQueryTree() */ Window *save_child_list; /* variables for XQueryTree() */
uint32_t nchild; /* variables for XQueryTree() */ unsigned int nchild; /* variables for XQueryTree() */
XRectangle child_clip; /* vis part of child */ XRectangle child_clip; /* vis part of child */
int32_t curr_clipX, curr_clipY, curr_clipRt, curr_clipBt; int curr_clipX, curr_clipY, curr_clipRt, curr_clipBt;
/* check that win is mapped & not outside bounding box */ /* check that win is mapped & not outside bounding box */
if (curr_attrs->map_state == IsViewable && if (curr_attrs->map_state == IsViewable &&
curr_attrs->class == InputOutput && curr_attrs->class == InputOutput &&
!( pclip->x >= (bbox->x + bbox->width) || !( pclip->x >= (int) (bbox->x + bbox->width) ||
pclip->y >= (bbox->y + bbox->height) || pclip->y >= (int) (bbox->y + bbox->height) ||
(pclip->x + pclip->width) <= bbox->x || (int) (pclip->x + pclip->width) <= bbox->x ||
(pclip->y + pclip->height) <= bbox->y)) { (int) (pclip->y + pclip->height) <= bbox->y)) {
XQueryTree( disp, curr, &root, &parent, &child, &nchild ); XQueryTree( disp, curr, &root, &parent, &child, &nchild );
save_child_list = child; /* so we can free list when we're done */ save_child_list = child; /* so we can free list when we're done */
add_window_to_list( image_wins, curr, x_rootrel, y_rootrel, add_window_to_list( image_wins, curr, x_rootrel, y_rootrel,
(int32_t) pclip->x, (int32_t) pclip->y, pclip->x, pclip->y,
(int32_t) pclip->width, (int32_t) pclip->height, pclip->width, pclip->height,
curr_attrs->border_width,curr_attrs->visual, curr_attrs->border_width,curr_attrs->visual,
curr_attrs->colormap, parent); curr_attrs->colormap, parent);
...@@ -683,40 +718,39 @@ static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel, ...@@ -683,40 +718,39 @@ static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel,
child loop, we figure the clip rect for each child by adding in child loop, we figure the clip rect for each child by adding in
it's rectangle (not taking into account the child's borders). it's rectangle (not taking into account the child's borders).
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
curr_clipX = MAX( pclip->x, x_rootrel + curr_attrs->border_width); curr_clipX = MAX( pclip->x, x_rootrel + (int) curr_attrs->border_width);
curr_clipY = MAX( pclip->y, y_rootrel + curr_attrs->border_width); curr_clipY = MAX( pclip->y, y_rootrel + (int) curr_attrs->border_width);
curr_clipRt = MIN(pclip->x + pclip->width, curr_clipRt = MIN( pclip->x + (int) pclip->width,
x_rootrel + curr_attrs->width + 2 * curr_attrs->border_width); x_rootrel + (int) curr_attrs->width +
2 * (int) curr_attrs->border_width);
curr_clipBt = MIN(pclip->y + pclip->height, curr_clipBt = MIN( pclip->y + (int) pclip->height,
y_rootrel + curr_attrs->height + 2 * curr_attrs->border_width); y_rootrel + (int) curr_attrs->height +
2 * (int) curr_attrs->border_width);
while (nchild--) { while (nchild--) {
int32_t new_width, new_height; int new_width, new_height;
int32_t child_xrr, child_yrr; /* root relative x & y of child */ int child_xrr, child_yrr; /* root relative x & y of child */
XGetWindowAttributes( disp, *child, &child_attrs); XGetWindowAttributes( disp, *child, &child_attrs);
/* intersect parent & child clip rects */ /* intersect parent & child clip rects */
child_xrr = x_rootrel + child_attrs.x + curr_attrs->border_width; child_xrr = x_rootrel + child_attrs.x + curr_attrs->border_width;
child_clip.x = (short) MAX( curr_clipX, child_xrr); child_clip.x = MAX( curr_clipX, child_xrr);
new_width = MIN(curr_clipRt, new_width = MIN( curr_clipRt, child_xrr + (int) child_attrs.width
child_xrr + child_attrs.width + + 2 * child_attrs.border_width)
2 * child_attrs.border_width) - child_clip.x; - child_clip.x;
if (new_width >= 0) { if (new_width >= 0) {
child_clip.width = (unsigned short) new_width; child_clip.width = new_width;
child_yrr = y_rootrel + child_attrs.y + child_yrr = y_rootrel + child_attrs.y +
curr_attrs->border_width; curr_attrs->border_width;
child_clip.y = (short) MAX( curr_clipY, child_yrr); child_clip.y = MAX( curr_clipY, child_yrr);
new_height = MIN(curr_clipBt, new_height = MIN( curr_clipBt,
child_yrr + (int32_t) child_attrs.height + child_yrr + (int) child_attrs.height +
2 * child_attrs.border_width) - child_clip.y; 2 * child_attrs.border_width)
- child_clip.y;
if (new_height >= 0) { if (new_height >= 0) {
child_clip.height = (unsigned short) new_height; child_clip.height = new_height;
make_src_list( disp, image_wins, bbox, *child, make_src_list( disp, image_wins, bbox, *child,
child_xrr, child_yrr, child_xrr, child_yrr,
&child_attrs, &child_clip); &child_attrs, &child_clip);
...@@ -737,15 +771,9 @@ static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel, ...@@ -737,15 +771,9 @@ static void make_src_list( disp, image_wins, bbox, curr, x_rootrel, y_rootrel,
there will be two regions in the list. there will be two regions in the list.
Returns a pointer to the list. Returns a pointer to the list.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static list_ptr make_region_list( disp, win, bbox, hasNonDefault, static list_ptr make_region_list(Display *disp, Window win, XRectangle *bbox,
numImageVisuals, pImageVisuals, allImage) int *hasNonDefault, int numImageVisuals,
Display *disp; XVisualInfo **pImageVisuals, int *allImage)
Window win;
XRectangle *bbox;
int32_t *hasNonDefault;
int32_t numImageVisuals;
XVisualInfo **pImageVisuals;
int32_t *allImage;
{ {
XWindowAttributes win_attrs; XWindowAttributes win_attrs;
list image_wins; list image_wins;
...@@ -755,9 +783,9 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault, ...@@ -755,9 +783,9 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault,
image_win_type *base_src, *src; image_win_type *base_src, *src;
Region bbox_region = XCreateRegion(); Region bbox_region = XCreateRegion();
XRectangle clip; XRectangle clip;
int32_t image_only; int image_only;
int32_t count=0 ; int count=0 ;
*hasNonDefault = False; *hasNonDefault = False;
XUnionRectWithRegion( bbox, bbox_region, bbox_region); XUnionRectWithRegion( bbox, bbox_region, bbox_region);
...@@ -766,8 +794,8 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault, ...@@ -766,8 +794,8 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault,
zero_list( &image_wins); zero_list( &image_wins);
clip.x = 0; clip.x = 0;
clip.y = 0; clip.y = 0;
clip.width = (unsigned short) win_attrs.width; clip.width = win_attrs.width;
clip.height = (unsigned short) win_attrs.height; clip.height = win_attrs.height;
make_src_list( disp, &image_wins, bbox, win, make_src_list( disp, &image_wins, bbox, win,
0 /* x_rootrel */, 0 /* y_rootrel */, &win_attrs, &clip); 0 /* x_rootrel */, 0 /* y_rootrel */, &win_attrs, &clip);
...@@ -840,8 +868,7 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault, ...@@ -840,8 +868,7 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault,
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Destructor called from destroy_region_list(). Destructor called from destroy_region_list().
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
void destroy_image_region( image_region) static void destroy_image_region(image_region_type *image_region)
image_region_type *image_region;
{ {
XDestroyRegion( image_region->visible_region); XDestroyRegion( image_region->visible_region);
free( (void *) image_region); free( (void *) image_region);
...@@ -850,8 +877,7 @@ void destroy_image_region( image_region) ...@@ -850,8 +877,7 @@ void destroy_image_region( image_region)
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Destroys the region list, destroying all the regions contained in it. Destroys the region list, destroying all the regions contained in it.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static void destroy_region_list( rlist) static void destroy_region_list(list_ptr rlist)
list_ptr rlist;
{ {
delete_list_destroying( rlist, (DESTRUCT_FUNC_PTR)destroy_image_region); delete_list_destroying( rlist, (DESTRUCT_FUNC_PTR)destroy_image_region);
} }
...@@ -863,21 +889,17 @@ static void destroy_region_list( rlist) ...@@ -863,21 +889,17 @@ static void destroy_region_list( rlist)
only provides a way to subtract one region from another, not a only provides a way to subtract one region from another, not a
rectangle from a region. rectangle from a region.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static void subtr_rect_from_image_region( image_region, x, y, width, height) static void subtr_rect_from_image_region(image_region_type *image_region,
image_region_type *image_region; int x, int y, int width, int height)
int32_t x;
int32_t y;
int32_t width;
int32_t height;
{ {
XRectangle rect; XRectangle rect;
Region rect_region; Region rect_region;
rect_region = XCreateRegion(); rect_region = XCreateRegion();
rect.x = (short)x; rect.x = x;
rect.y = (short)y; rect.y = y;
rect.width = (unsigned short)width; rect.width = width;
rect.height = (unsigned short)height; rect.height = height;
XUnionRectWithRegion( &rect, rect_region, rect_region); XUnionRectWithRegion( &rect, rect_region, rect_region);
XSubtractRegion( image_region->visible_region, rect_region, XSubtractRegion( image_region->visible_region, rect_region,
image_region->visible_region); image_region->visible_region);
...@@ -888,19 +910,15 @@ static void subtr_rect_from_image_region( image_region, x, y, width, height) ...@@ -888,19 +910,15 @@ static void subtr_rect_from_image_region( image_region, x, y, width, height)
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Adds the specified rectangle to the region in image_region. Adds the specified rectangle to the region in image_region.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static void add_rect_to_image_region( image_region, x, y, width, height) static void add_rect_to_image_region(image_region_type *image_region,
image_region_type *image_region; int x, int y, int width, int height)
int32_t x;
int32_t y;
int32_t width;
int32_t height;
{ {
XRectangle rect; XRectangle rect;
rect.x = (short) x; rect.x = x;
rect.y = (short) y; rect.y = y;
rect.width = (unsigned short) width; rect.width = width;
rect.height = (unsigned short) height; rect.height = height;
XUnionRectWithRegion( &rect, image_region->visible_region, XUnionRectWithRegion( &rect, image_region->visible_region,
image_region->visible_region); image_region->visible_region);
} }
...@@ -910,9 +928,7 @@ static void add_rect_to_image_region( image_region, x, y, width, height) ...@@ -910,9 +928,7 @@ static void add_rect_to_image_region( image_region, x, y, width, height)
Returns TRUE if the given src's visual is already represented in Returns TRUE if the given src's visual is already represented in
the image_regions list, FALSE otherwise. the image_regions list, FALSE otherwise.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static int32_t src_in_region_list( src, image_regions) static int src_in_region_list(image_win_type *src, list_ptr image_regions)
image_win_type *src;
list_ptr image_regions;
{ {
image_region_type *ir; image_region_type *ir;
...@@ -931,20 +947,10 @@ static int32_t src_in_region_list( src, image_regions) ...@@ -931,20 +947,10 @@ static int32_t src_in_region_list( src, image_regions)
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
Makes a new entry in image_wins with the given fields filled in. Makes a new entry in image_wins with the given fields filled in.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static void add_window_to_list( image_wins, w, xrr, yrr, x_vis, y_vis, static void add_window_to_list(list_ptr image_wins, Window w,
width, height, border_width,vis, cmap, parent) int xrr, int yrr, int x_vis, int y_vis,
list_ptr image_wins; int width, int height, int border_width,
Window w; Visual *vis, Colormap cmap, Window parent)
int32_t xrr;
int32_t yrr;
int32_t x_vis;
int32_t y_vis;
int32_t width;
int32_t height;
int32_t border_width;
Visual *vis;
Colormap cmap;
Window parent;
{ {
image_win_type *new_src; image_win_type *new_src;
...@@ -970,12 +976,10 @@ static void add_window_to_list( image_wins, w, xrr, yrr, x_vis, y_vis, ...@@ -970,12 +976,10 @@ static void add_window_to_list( image_wins, w, xrr, yrr, x_vis, y_vis,
Returns TRUE if the given src's visual is in the image planes, Returns TRUE if the given src's visual is in the image planes,
FALSE otherwise. FALSE otherwise.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static int32_t src_in_image( src, numImageVisuals, pImageVisuals) static int src_in_image(image_win_type *src, int numImageVisuals,
image_win_type *src; XVisualInfo **pImageVisuals)
int32_t numImageVisuals;
XVisualInfo **pImageVisuals;
{ {
int32_t i; int i;
for (i = 0 ; i < numImageVisuals ; i++) for (i = 0 ; i < numImageVisuals ; i++)
{ {
...@@ -990,15 +994,11 @@ static int32_t src_in_image( src, numImageVisuals, pImageVisuals) ...@@ -990,15 +994,11 @@ static int32_t src_in_image( src, numImageVisuals, pImageVisuals)
Returns TRUE if the given src's visual is in the overlay planes Returns TRUE if the given src's visual is in the overlay planes
and transparency is possible, FALSE otherwise. and transparency is possible, FALSE otherwise.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
static int32_t src_in_overlay( src, numOverlayVisuals, pOverlayVisuals, static int src_in_overlay(image_region_type *src, int numOverlayVisuals,
transparentColor, transparentType) OverlayInfo *pOverlayVisuals,
image_region_type *src; int *transparentColor, int *transparentType)
int32_t numOverlayVisuals;
OverlayInfo *pOverlayVisuals;
int32_t *transparentColor;
int32_t *transparentType;
{ {
int32_t i; int i;
for (i = 0 ; i < numOverlayVisuals ; i++) for (i = 0 ; i < numOverlayVisuals ; i++)
{ {
...@@ -1039,7 +1039,7 @@ static int32_t src_in_overlay( src, numOverlayVisuals, pOverlayVisuals, ...@@ -1039,7 +1039,7 @@ static int32_t src_in_overlay( src, numOverlayVisuals, pOverlayVisuals,
#define DIRECT_COLOR 0x11 #define DIRECT_COLOR 0x11
static int32_t weCreateServerOverlayVisualsProperty = False; static int weCreateServerOverlayVisualsProperty = False;
/****************************************************************************** /******************************************************************************
...@@ -1064,42 +1064,40 @@ static int32_t weCreateServerOverlayVisualsProperty = False; ...@@ -1064,42 +1064,40 @@ static int32_t weCreateServerOverlayVisualsProperty = False;
* *
******************************************************************************/ ******************************************************************************/
int32_t GetXVisualInfo(display, screen, transparentOverlays, int GetXVisualInfo(/* Which X server (aka "display"). */
numVisuals, pVisuals, Display *display,
numOverlayVisuals, pOverlayVisuals, /* Which screen of the "display". */
numImageVisuals, pImageVisuals) int screen,
/* Non-zero if there's at least one overlay visual and
Display *display; /* Which X server (aka "display"). */ * if at least one of those supports a transparent pixel. */
int32_t screen; /* Which screen of the "display". */ int *transparentOverlays,
int32_t *transparentOverlays; /* Non-zero if there's at least one /* Number of XVisualInfo struct's pointed to by pVisuals. */
* overlay visual and if at least one int *numVisuals,
* of those supports a transparent /* All of the device's visuals. */
* pixel. */ XVisualInfo **pVisuals,
int32_t *numVisuals; /* Number of XVisualInfo struct's /* Number of OverlayInfo's pointed to by pOverlayVisuals.
* pointed to to by pVisuals. */ * If this number is zero, the device does not have
XVisualInfo **pVisuals; /* All of the device's visuals. */ * overlay planes. */
int32_t *numOverlayVisuals; /* Number of OverlayInfo's pointed int *numOverlayVisuals,
* to by pOverlayVisuals. If this /* The device's overlay plane visual information. */
* number is zero, the device does OverlayInfo **pOverlayVisuals,
* not have overlay planes. */ /* Number of XVisualInfo's pointed to by pImageVisuals. */
OverlayInfo **pOverlayVisuals; /* The device's overlay plane visual int *numImageVisuals,
* information. */ /* The device's image visuals. */
int32_t *numImageVisuals; /* Number of XVisualInfo's pointed XVisualInfo ***pImageVisuals)
* to by pImageVisuals. */
XVisualInfo ***pImageVisuals; /* The device's image visuals. */
{ {
XVisualInfo getVisInfo; /* Parameters of XGetVisualInfo */ XVisualInfo getVisInfo; /* Paramters of XGetVisualInfo */
int32_t mask; int mask;
XVisualInfo *pVis, **pIVis; /* Faster, local copies */ XVisualInfo *pVis, **pIVis; /* Faster, local copies */
OverlayInfo *pOVis; OverlayInfo *pOVis;
OverlayVisualPropertyRec *pOOldVis; OverlayVisualPropertyRec *pOOldVis;
int32_t nVisuals, nOVisuals; int nVisuals, nOVisuals;
Atom overlayVisualsAtom; /* Parameters for XGetWindowProperty */ Atom overlayVisualsAtom; /* Parameters for XGetWindowProperty */
Atom actualType; Atom actualType;
unsigned long numLongs, bytesAfter; unsigned long numLongs, bytesAfter;
int32_t actualFormat; int actualFormat;
int32_t nImageVisualsAlloced; /* Values to process the XVisualInfo */ int nImageVisualsAlloced; /* Values to process the XVisualInfo */
int32_t imageVisual; /* array */ int imageVisual; /* array */
/* First, get the list of visuals for this screen. */ /* First, get the list of visuals for this screen. */
...@@ -1125,10 +1123,10 @@ int32_t GetXVisualInfo(display, screen, transparentOverlays, ...@@ -1125,10 +1123,10 @@ int32_t GetXVisualInfo(display, screen, transparentOverlays,
* do-while loop makes sure we get the entire list from the X server. * do-while loop makes sure we get the entire list from the X server.
*/ */
bytesAfter = 0; bytesAfter = 0;
numLongs = sizeof(OverlayVisualPropertyRec) / 4; numLongs = sizeof(OverlayVisualPropertyRec) / sizeof(long);
do do
{ {
numLongs += bytesAfter * 4; numLongs += bytesAfter * sizeof(long);
XGetWindowProperty(display, RootWindow(display, screen), XGetWindowProperty(display, RootWindow(display, screen),
overlayVisualsAtom, 0, numLongs, False, overlayVisualsAtom, 0, numLongs, False,
overlayVisualsAtom, &actualType, &actualFormat, overlayVisualsAtom, &actualType, &actualFormat,
...@@ -1137,7 +1135,6 @@ int32_t GetXVisualInfo(display, screen, transparentOverlays, ...@@ -1137,7 +1135,6 @@ int32_t GetXVisualInfo(display, screen, transparentOverlays,
/* Calculate the number of overlay visuals in the list. */ /* Calculate the number of overlay visuals in the list. */
/* *numOverlayVisuals = numLongs / (sizeof(OverlayVisualPropertyRec) / 4); */
*numOverlayVisuals = numLongs / (sizeof(OverlayVisualPropertyRec) / sizeof(long)); *numOverlayVisuals = numLongs / (sizeof(OverlayVisualPropertyRec) / sizeof(long));
} }
else else
...@@ -1199,11 +1196,8 @@ int32_t GetXVisualInfo(display, screen, transparentOverlays, ...@@ -1199,11 +1196,8 @@ int32_t GetXVisualInfo(display, screen, transparentOverlays,
* *
******************************************************************************/ ******************************************************************************/
void FreeXVisualInfo(pVisuals, pOverlayVisuals, pImageVisuals) void FreeXVisualInfo(XVisualInfo *pVisuals, OverlayInfo *pOverlayVisuals,
XVisualInfo **pImageVisuals)
XVisualInfo *pVisuals;
OverlayInfo *pOverlayVisuals;
XVisualInfo **pImageVisuals;
{ {
XFree(pVisuals); XFree(pVisuals);
if (weCreateServerOverlayVisualsProperty) if (weCreateServerOverlayVisualsProperty)
......
/* /*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
/* $XConsortium: multiVis.h /main/4 1996/10/14 15:04:12 swick $ */
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
This file contains routines for manipulating generic lists. This file contains routines for manipulating generic lists.
Lists are implemented with a "harness". In other words, each Lists are implemented with a "harness". In other words, each
...@@ -36,16 +36,14 @@ ...@@ -36,16 +36,14 @@
However, the following notice accompanied the original version of this However, the following notice accompanied the original version of this
file: file:
Copyright (c) 1994 Hewlett-Packard Co. Copyright 1994 Hewlett-Packard Co.
Copyright (c) 1996 X Consortium Copyright 1996, 1998 The Open Group
Permission is hereby granted, free of charge, to any person obtaining Permission to use, copy, modify, distribute, and sell this software and its
a copy of this software and associated documentation files (the documentation for any purpose is hereby granted without fee, provided that
"Software"), to deal in the Software without restriction, including the above copyright notice appear in all copies and that both that
without limitation the rights to use, copy, modify, merge, publish, copyright notice and this permission notice appear in supporting
distribute, sublicense, and sell copies of the Software, and to documentation.
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
...@@ -53,38 +51,32 @@ in all copies or substantial portions of the Software. ...@@ -53,38 +51,32 @@ in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the X Consortium. from The Open Group.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
extern int32_t GetMultiVisualRegions( extern int GetMultiVisualRegions(
#if NeedFunctionPrototypes Display *, Window, int, int, unsigned int,
Display *, Window, int32_t, int32_t, uint32_t, unsigned int, int *, int *, XVisualInfo **, int *,
uint32_t, int32_t *, int32_t *, XVisualInfo **, int32_t *, OverlayInfo **, int *, XVisualInfo ***, list_ptr *,
OverlayInfo **, int32_t *, XVisualInfo ***, list_ptr *, list_ptr *, int *
list_ptr *, int32_t *
#endif
); );
extern XImage *ReadAreaToImage( extern XImage *ReadAreaToImage(
#if NeedFunctionPrototypes Display *, Window, int, int, unsigned int,
Display *, Window, int32_t, int32_t, uint32_t, unsigned int, int, XVisualInfo *, int,
uint32_t, int32_t, XVisualInfo *, int32_t, OverlayInfo *, int, XVisualInfo **, list_ptr,
OverlayInfo *, int32_t, XVisualInfo **, list_ptr, list_ptr, int, int
list_ptr, int32_t, int32_t
#endif
); );
extern void initFakeVisual( extern void initFakeVisual(
#if NeedFunctionPrototypes
Visual * Visual *
#endif
); );
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifdef HEADLESS
#error This file should not be included in headless library
#endif
#ifdef MACOSX
#include <stdlib.h>
#endif
#include "robot_common.h"
/*
* QueryColorMap is taken from multiVis.c, part of the xwd distribution from
* X.org. It was moved here so it can be shared with awt_DataTransferer.c
*/
int32_t
QueryColorMap(Display *disp,
Colormap src_cmap,
Visual *src_vis,
XColor **src_colors,
int32_t *rShift, int32_t *gShift, int32_t *bShift)
{
int32_t ncolors, i;
unsigned long redMask, greenMask, blueMask;
int32_t redShift, greenShift, blueShift;
XColor *colors ;
ncolors = src_vis->map_entries ;
*src_colors = colors = (XColor *)calloc(ncolors,sizeof(XColor) ) ;
if(src_vis->class != TrueColor && src_vis->class != DirectColor)
{
for(i=0 ; i < ncolors ; i++)
{
colors[i].pixel = i ;
colors[i].pad = 0;
colors[i].flags = DoRed|DoGreen|DoBlue;
}
}
else /** src is decomposed rgb ***/
{
/* Get the X colormap */
redMask = src_vis->red_mask;
greenMask = src_vis->green_mask;
blueMask = src_vis->blue_mask;
redShift = 0; while (!(redMask&0x1)) {
redShift++;
redMask = redMask>>1;
}
greenShift = 0; while (!(greenMask&0x1)) {
greenShift++;
greenMask = greenMask>>1;
}
blueShift = 0; while (!(blueMask&0x1)) {
blueShift++;
blueMask = blueMask>>1;
}
*rShift = redShift ;
*gShift = greenShift ;
*bShift = blueShift ;
for (i=0; i<ncolors; i++) {
if( (uint32_t)i <= redMask) colors[i].pixel = (i<<redShift) ;
if( (uint32_t)i <= greenMask) colors[i].pixel |= (i<<greenShift) ;
if( (uint32_t)i <= blueMask) colors[i].pixel |= (i<<blueShift) ;
/***** example :for gecko's 3-3-2 map, blue index should be <= 3
.
colors[i].pixel = (i<<redShift)|(i<<greenShift)|(i<<blueShift);
*****/
colors[i].pad = 0;
colors[i].flags = DoRed|DoGreen|DoBlue;
}
}
XQueryColors(disp, src_cmap, colors, ncolors);
return ncolors ;
}
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef _ROBOT_COMMON_H
#define _ROBOT_COMMON_H
#include "java_awt_event_InputEvent.h"
#include <X11/Xlib.h>
#include "gdefs.h"
int QueryColorMap(Display *disp,
Colormap src_cmap,
Visual *src_vis,
XColor **src_colors,
int *rShift, int *gShift, int *bShift);
#endif /* _ROBOT_COMMON_H */
/* /*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -21,7 +22,6 @@ ...@@ -21,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any * or visit www.oracle.com if you need additional information or have any
* questions. * questions.
*/ */
/* $XConsortium: wsutils.h /main/3 1996/10/14 15:04:17 swick $ */
/** ------------------------------------------------------------------------ /** ------------------------------------------------------------------------
This file contains routines for manipulating generic lists. This file contains routines for manipulating generic lists.
Lists are implemented with a "harness". In other words, each Lists are implemented with a "harness". In other words, each
...@@ -36,16 +36,14 @@ ...@@ -36,16 +36,14 @@
However, the following notice accompanied the original version of this However, the following notice accompanied the original version of this
file: file:
Copyright (c) 1994 Hewlett-Packard Co. Copyright 1994 Hewlett-Packard Co.
Copyright (c) 1996 X Consortium Copyright 1996, 1998 The Open Group
Permission is hereby granted, free of charge, to any person obtaining Permission to use, copy, modify, distribute, and sell this software and its
a copy of this software and associated documentation files (the documentation for any purpose is hereby granted without fee, provided that
"Software"), to deal in the Software without restriction, including the above copyright notice appear in all copies and that both that
without limitation the rights to use, copy, modify, merge, publish, copyright notice and this permission notice appear in supporting
distribute, sublicense, and sell copies of the Software, and to documentation.
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. in all copies or substantial portions of the Software.
...@@ -53,17 +51,18 @@ in all copies or substantial portions of the Software. ...@@ -53,17 +51,18 @@ in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Consortium shall Except as contained in this notice, the name of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization other dealings in this Software without prior written authorization
from the X Consortium. from The Open Group.
------------------------------------------------------------------------ **/ ------------------------------------------------------------------------ **/
/****************************************************************************** /******************************************************************************
* *
* This file contains various typedef's, macros and procedure declarations for * This file contains various typedef's, macros and procedure declarations for
...@@ -71,16 +70,18 @@ from the X Consortium. ...@@ -71,16 +70,18 @@ from the X Consortium.
* *
******************************************************************************/ ******************************************************************************/
typedef unsigned long Pixel;
/* This is the actual structure returned by the X server describing the /* This is the actual structure returned by the X server describing the
* SERVER_OVERLAY_VISUAL property. * SERVER_OVERLAY_VISUAL property.
*/ */
typedef struct typedef struct
{ {
VisualID visualID; /* The VisualID of the overlay visual */ VisualID visualID; /* The VisualID of the overlay visual */
long transparentType; /* Can be None, TransparentPixel or int transparentType; /* Can be None, TransparentPixel or
* TransparentMask */ * TransparentMask */
long value; /* Pixel value */ Pixel value; /* Pixel value */
long layer; /* Overlay planes will always be in int layer; /* Overlay planes will always be in
* layer 1 */ * layer 1 */
} OverlayVisualPropertyRec; } OverlayVisualPropertyRec;
...@@ -93,10 +94,10 @@ typedef struct ...@@ -93,10 +94,10 @@ typedef struct
typedef struct typedef struct
{ {
XVisualInfo *pOverlayVisualInfo; /* Pointer to the XVisualInfo struct */ XVisualInfo *pOverlayVisualInfo; /* Pointer to the XVisualInfo struct */
long transparentType; /* Can be None, TransparentPixel or int transparentType; /* Can be None, TransparentPixel or
* TransparentMask */ * TransparentMask */
long value; /* Pixel value */ Pixel value; /* Pixel value */
long layer; /* Overlay planes will always be in int layer; /* Overlay planes will always be in
* layer 1 */ * layer 1 */
} OverlayInfo; } OverlayInfo;
...@@ -158,27 +159,25 @@ typedef struct ...@@ -158,27 +159,25 @@ typedef struct
* *
******************************************************************************/ ******************************************************************************/
extern int32_t GetXVisualInfo( extern int GetXVisualInfo(
#if NeedFunctionPrototypes
Display *display, /* Which X server (aka "display"). */ Display *display, /* Which X server (aka "display"). */
int32_t screen, /* Which screen of the "display". */ int screen, /* Which screen of the "display". */
int32_t *transparentOverlays, /* Non-zero if there's at least one int *transparentOverlays, /* Non-zero if there's at least one
* overlay visual and if at least one * overlay visual and if at least one
* of those supports a transparent * of those supports a transparent
* pixel. */ * pixel. */
int32_t *numVisuals, /* Number of XVisualInfo struct's int *numVisuals, /* Number of XVisualInfo struct's
* pointed to to by pVisuals. */ * pointed to to by pVisuals. */
XVisualInfo **pVisuals, /* All of the device's visuals. */ XVisualInfo **pVisuals, /* All of the device's visuals. */
int32_t *numOverlayVisuals, /* Number of OverlayInfo's pointed int *numOverlayVisuals, /* Number of OverlayInfo's pointed
* to by pOverlayVisuals. If this * to by pOverlayVisuals. If this
* number is zero, the device does * number is zero, the device does
* not have overlay planes. */ * not have overlay planes. */
OverlayInfo **pOverlayVisuals, /* The device's overlay plane visual OverlayInfo **pOverlayVisuals, /* The device's overlay plane visual
* information. */ * information. */
int32_t *numImageVisuals, /* Number of XVisualInfo's pointed int *numImageVisuals, /* Number of XVisualInfo's pointed
* to by pImageVisuals. */ * to by pImageVisuals. */
XVisualInfo ***pImageVisuals /* The device's image visuals. */ XVisualInfo ***pImageVisuals /* The device's image visuals. */
#endif
); );
...@@ -191,11 +190,9 @@ extern int32_t GetXVisualInfo( ...@@ -191,11 +190,9 @@ extern int32_t GetXVisualInfo(
******************************************************************************/ ******************************************************************************/
extern void FreeXVisualInfo( extern void FreeXVisualInfo(
#if NeedFunctionPrototypes
XVisualInfo *pVisuals, XVisualInfo *pVisuals,
OverlayInfo *pOverlayVisuals, OverlayInfo *pOverlayVisuals,
XVisualInfo **pImageVisuals XVisualInfo **pImageVisuals
#endif
); );
...@@ -219,22 +216,20 @@ extern void FreeXVisualInfo( ...@@ -219,22 +216,20 @@ extern void FreeXVisualInfo(
* *
******************************************************************************/ ******************************************************************************/
extern int32_t FindImagePlanesVisual( extern int FindImagePlanesVisual(
#if NeedFunctionPrototypes
Display *display, /* Which X server (aka "display"). */ Display *display, /* Which X server (aka "display"). */
int32_t screen, /* Which screen of the "display". */ int screen, /* Which screen of the "display". */
int32_t numImageVisuals, /* Number of XVisualInfo's pointed int numImageVisuals, /* Number of XVisualInfo's pointed
* to by pImageVisuals. */ * to by pImageVisuals. */
XVisualInfo **pImageVisuals, /* The device's image visuals. */ XVisualInfo **pImageVisuals, /* The device's image visuals. */
int32_t sbCmapHint, /* What Starbase cmap modes will be int sbCmapHint, /* What Starbase cmap modes will be
* used with the visual. NOTE: This * used with the visual. NOTE: This
* is a mask of the possible values. */ * is a mask of the possible values. */
int32_t depthHint, /* Desired depth. */ int depthHint, /* Desired depth. */
int32_t depthFlexibility, /* How much the actual value in int depthFlexibility, /* How much the actual value in
* "depthHint" is desired. */ * "depthHint" is desired. */
Visual **pImageVisualToUse, /* The screen's image visual to use. */ Visual **pImageVisualToUse, /* The screen's image visual to use. */
int32_t *depthObtained /* Actual depth of the visual. */ int *depthObtained /* Actual depth of the visual. */
#endif
); );
...@@ -267,25 +262,23 @@ extern int32_t FindImagePlanesVisual( ...@@ -267,25 +262,23 @@ extern int32_t FindImagePlanesVisual(
* *
******************************************************************************/ ******************************************************************************/
extern int32_t FindOverlayPlanesVisual( extern int FindOverlayPlanesVisual(
#if NeedFunctionPrototypes
Display *display, /* Which X server (aka "display"). */ Display *display, /* Which X server (aka "display"). */
int32_t screen, /* Which screen of the "display". */ int screen, /* Which screen of the "display". */
int32_t numOverlayVisuals, /* Number of OverlayInfo's pointed int numOverlayVisuals, /* Number of OverlayInfo's pointed
* to by pOverlayVisuals. */ * to by pOverlayVisuals. */
OverlayInfo *pOverlayVisuals, /* The device's overlay plane visual OverlayInfo *pOverlayVisuals, /* The device's overlay plane visual
* information. */ * information. */
int32_t depthHint, /* Desired depth. */ int depthHint, /* Desired depth. */
int32_t depthFlexibility, /* How much the actual value in int depthFlexibility, /* How much the actual value in
* "depthHint" is desired. */ * "depthHint" is desired. */
int32_t transparentBackground, /* Non-zero if the visual must have int transparentBackground, /* Non-zero if the visual must have
* a transparent color. */ * a transparent color. */
Visual **pOverlayVisualToUse, /* The screen's overlay visual to Visual **pOverlayVisualToUse, /* The screen's overlay visual to
* use. */ * use. */
int32_t *depthObtained, /* Actual depth of the visual. */ int *depthObtained, /* Actual depth of the visual. */
int32_t *transparentColor /* The transparent color the program int *transparentColor /* The transparent color the program
* can use with the visual. */ * can use with the visual. */
#endif
); );
...@@ -308,27 +301,25 @@ extern int32_t FindOverlayPlanesVisual( ...@@ -308,27 +301,25 @@ extern int32_t FindOverlayPlanesVisual(
* *
******************************************************************************/ ******************************************************************************/
extern int32_t CreateImagePlanesWindow( extern int CreateImagePlanesWindow(
#if NeedFunctionPrototypes
Display *display, /* Which X server (aka "display"). */ Display *display, /* Which X server (aka "display"). */
int32_t screen, /* Which screen of the "display". */ int screen, /* Which screen of the "display". */
Window parentWindow, /* Window ID of the parent window for Window parentWindow, /* Window ID of the parent window for
* the created window. */ * the created window. */
int32_t windowX, /* Desired X coord. of the window. */ int windowX, /* Desired X coord. of the window. */
int32_t windowY, /* Desired Y coord of the window. */ int windowY, /* Desired Y coord of the window. */
int32_t windowWidth, /* Desired width of the window. */ int windowWidth, /* Desired width of the window. */
int32_t windowHeight, /* Desired height of the window. */ int windowHeight, /* Desired height of the window. */
int32_t windowDepth, /* Desired depth of the window. */ int windowDepth, /* Desired depth of the window. */
Visual *pImageVisualToUse, /* The window's image planes visual. */ Visual *pImageVisualToUse, /* The window's image planes visual. */
int32_t argc, /* Program's argc parameter. */ int argc, /* Program's argc parameter. */
char *argv[], /* Program's argv parameter. */ char *argv[], /* Program's argv parameter. */
char *windowName, /* Name to put on window's border. */ char *windowName, /* Name to put on window's border. */
char *iconName, /* Name to put on window's icon. */ char *iconName, /* Name to put on window's icon. */
Window *imageWindow, /* Window ID of the created window. */ Window *imageWindow, /* Window ID of the created window. */
Colormap *imageColormap, /* The window's colormap. */ Colormap *imageColormap, /* The window's colormap. */
int32_t *mustFreeImageColormap /* Non-zero if the program must call int *mustFreeImageColormap /* Non-zero if the program must call
* XFreeColormap() for imageColormap. */ * XFreeColormap() for imageColormap. */
#endif
); );
...@@ -351,30 +342,28 @@ extern int32_t CreateImagePlanesWindow( ...@@ -351,30 +342,28 @@ extern int32_t CreateImagePlanesWindow(
* *
******************************************************************************/ ******************************************************************************/
int32_t CreateOverlayPlanesWindow( int CreateOverlayPlanesWindow(
#if NeedFunctionPrototypes
Display *display, /* Which X server (aka "display"). */ Display *display, /* Which X server (aka "display"). */
int32_t screen, /* Which screen of the "display". */ int screen, /* Which screen of the "display". */
Window parentWindow, /* Window ID of the parent window for Window parentWindow, /* Window ID of the parent window for
* the created window. */ * the created window. */
int32_t windowX, /* Desired X coord. of the window. */ int windowX, /* Desired X coord. of the window. */
int32_t windowY, /* Desired Y coord of the window. */ int windowY, /* Desired Y coord of the window. */
int32_t windowWidth, /* Desired width of the window. */ int windowWidth, /* Desired width of the window. */
int32_t windowHeight, /* Desired height of the window. */ int windowHeight, /* Desired height of the window. */
int32_t windowDepth, /* Desired depth of the window. */ int windowDepth, /* Desired depth of the window. */
Visual *pOverlayVisualToUse, /* The window's overlay planes visual.*/ Visual *pOverlayVisualToUse, /* The window's overlay planes visual.*/
int32_t argc, /* Program's argc parameter. */ int argc, /* Program's argc parameter. */
char *argv[], /* Program's argv parameter. */ char *argv[], /* Program's argv parameter. */
char *windowName, /* Name to put on window's border. */ char *windowName, /* Name to put on window's border. */
char *iconName, /* Name to put on window's icon. */ char *iconName, /* Name to put on window's icon. */
int32_t transparentBackground, /* Non-zero if the window's background int transparentBackground, /* Non-zero if the window's background
* should be a transparent color. */ * should be a transparent color. */
int32_t *transparentColor, /* The transparent color to use as the int *transparentColor, /* The transparent color to use as the
* window's background. */ * window's background. */
Window *overlayWindow, /* Window ID of the created window. */ Window *overlayWindow, /* Window ID of the created window. */
Colormap *overlayColormap, /* The window's colormap. */ Colormap *overlayColormap, /* The window's colormap. */
int32_t *mustFreeOverlayColormap/* Non-zero if the program must call int *mustFreeOverlayColormap/* Non-zero if the program must call
* XFreeColormap() for * XFreeColormap() for
* overlayColormap. */ * overlayColormap. */
#endif
); );
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册