1 /* Copyright (c) 1993, Oracle and/or its affiliates. All rights reserved.
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
25 ** pix_inquiry.c - state inquiry routines for pixmaps.
30 #endif /* SERVER_DGA */
31 #include "dga_incls.h"
35 dgai_pix_display(_Dga_pixmap dgapix
)
37 return (dgapix
->p_dpy
);
41 dgai_pix_devname(_Dga_pixmap dgapix
)
43 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
)
45 return((char *)(((SHARED_PIXMAP_INFO
*)(dgapix
->p_infop
))->scr_name
));
49 dgai_pix_devfd(_Dga_pixmap dgapix
)
51 return(dgapix
->p_infofd
);
55 dgai_pix_depth(_Dga_pixmap dgapix
)
57 return(dgapix
->depth
);
61 dgai_pix_set_client_infop(_Dga_pixmap dgapix
, void *client_info_ptr
)
63 dgapix
->p_client
= client_info_ptr
;
67 dgai_pix_get_client_infop(_Dga_pixmap dgapix
)
69 return(dgapix
->p_client
);
73 dgai_pix_devinfo(_Dga_pixmap dgapix
)
75 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
)
77 return(((char *)dgapix
->p_infop
) + PIX_INFOP(dgapix
)->device_offset
);
81 dgai_pix_devinfochg(_Dga_pixmap dgapix
)
83 if (dgapix
->changeMask
& DGA_CHANGE_DEVINFO
) {
84 dgapix
->changeMask
&= ~DGA_CHANGE_DEVINFO
;
92 dgai_pix_sitechg(_Dga_pixmap dgapix
, int *reason
)
94 if (dgapix
->changeMask
& DGA_CHANGE_SITE
) {
95 dgapix
->changeMask
&= ~DGA_CHANGE_SITE
;
96 *reason
= dgapix
->siteChgReason
;
99 *reason
= DGA_SITECHG_UNKNOWN
;
105 dgai_pix_sitesetnotify(_Dga_pixmap dgapix
,
106 DgaSiteNotifyFunc site_notify_func
, void *client_data
)
108 dgapix
->siteNotifyFunc
= site_notify_func
;
109 dgapix
->siteNotifyClientData
= client_data
;
113 dgai_pix_sitegetnotify(_Dga_pixmap dgapix
,
114 DgaSiteNotifyFunc
*site_notify_func
, void **client_data
)
116 *site_notify_func
= dgapix
->siteNotifyFunc
;
117 *client_data
= dgapix
->siteNotifyClientData
;
121 dgai_pix_site(_Dga_pixmap dgapix
)
123 SHARED_PIXMAP_INFO
*infop
;
125 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
) {
126 return (DGA_SITE_NULL
);
129 infop
= PIX_INFOP(dgapix
);
130 return (infop
->cached
? DGA_SITE_DEVICE
: DGA_SITE_SYSTEM
);
134 dgai_pix_address(_Dga_pixmap dgapix
)
136 SHARED_PIXMAP_INFO
*infop
;
138 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
)
141 infop
= PIX_INFOP(dgapix
);
142 return(infop
->cached
? NULL
: (void *)(infop
+ 1));
146 dgai_pix_linebytes(_Dga_pixmap dgapix
)
148 SHARED_PIXMAP_INFO
*infop
;
150 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
)
153 infop
= PIX_INFOP(dgapix
);
154 return(infop
->cached
? 0 : infop
->linebytes
);
158 dgai_pix_bitsperpixel(_Dga_pixmap dgapix
)
160 SHARED_PIXMAP_INFO
*infop
;
162 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
)
165 infop
= PIX_INFOP(dgapix
);
166 return(infop
->cached
? 0 : infop
->bitsperpixel
);
170 dgai_pix_clipchg(_Dga_pixmap dgapix
)
172 /* always force a clip change on a zombie to get the client
174 if ((dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
) ||
175 (dgapix
->pix_flags
& PIX_NOTICE_CLIPCHG
)){
176 dgapix
->pix_flags
&= ~PIX_NOTICE_CLIPCHG
;
185 dgai_pix_bbox(_Dga_pixmap dgapix
, int *xp
, int *yp
, int *widthp
, int *heightp
)
187 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
) {
193 SHARED_PIXMAP_INFO
*infop
;
195 infop
= PIX_INFOP(dgapix
);
198 *widthp
= infop
->width
;
199 *heightp
= infop
->height
;
204 dgai_pix_empty(_Dga_pixmap dgapix
)
206 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
) {
209 SHARED_PIXMAP_INFO
*infop
;
211 infop
= PIX_INFOP(dgapix
);
212 return (infop
->width
<= 0 || infop
->height
<= 0);
216 static short nonviewableShape
[] = {
218 0, /* ymax: fill in based on height */
220 0, /* xmax: fill in based on width */
229 dgai_pix_clipinfo(_Dga_pixmap dgapix
)
231 if (dgapix
->changeMask
& DGA_CHANGE_ZOMBIE
) {
234 SHARED_PIXMAP_INFO
*infop
;
236 infop
= PIX_INFOP(dgapix
);
237 if (infop
->width
<= 0 || infop
->height
<= 0) {
240 nonviewableShape
[YMAX_INDEX
] = infop
->height
- 1;
241 nonviewableShape
[XMAX_INDEX
] = infop
->width
- 1;
242 return (nonviewableShape
);