2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these libraries and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: HourGlass.c /main/5 1996/06/21 17:22:09 ageorge $ */
25 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
26 * (c) Copyright 1993, 1994 International Business Machines Corp. *
27 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
28 * (c) Copyright 1993, 1994 Novell, Inc. *
30 /************************************<+>*************************************
31 ****************************************************************************
35 ** Project: dt Dt Utility function
37 ** Description: This module contains a simple function for
38 ** creating an hourglass cursor.
40 ** (c) Copyright 1987, 1988, 1989 by Hewlett-Packard Company
44 ****************************************************************************
45 ************************************<+>*************************************/
47 /*****************************************************************************
49 * (c) Copyright 1989,1990 OPEN SOFTWARE FOUNDATION, INC.
50 * (c) Copyright 1987, 1988, 1989, 1990 HEWLETT-PACKARD COMPANY
53 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED
54 * AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND
55 * WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR
56 * ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
57 * AVAILABLE TO ANY OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE
58 * SOFTWARE IS HEREBY TRANSFERRED.
60 * THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT
61 * NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY OPEN SOFTWARE
62 * FOUNDATION, INC. OR ITS THIRD PARTY SUPPLIERS
64 * OPEN SOFTWARE FOUNDATION, INC. AND ITS THIRD PARTY SUPPLIERS,
65 * ASSUME NO RESPONSIBILITY FOR THE USE OR INABILITY TO USE ANY OF ITS
66 * SOFTWARE . OSF SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
67 * KIND, AND OSF EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES, INCLUDING
68 * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
69 * FITNESS FOR A PARTICULAR PURPOSE.
71 * Notice: Notwithstanding any other lease or license that may pertain to,
72 * or accompany the delivery of, this computer software, the rights of the
73 * Government regarding its use, reproduction and disclosure are as set
74 * forth in Section 52.227-19 of the FARS Computer Software-Restricted
77 * (c) Copyright 1989,1990 Open Software Foundation, Inc. Unpublished - all
78 * rights reserved under the Copyright laws of the United States.
80 * RESTRICTED RIGHTS NOTICE: Use, duplication, or disclosure by the
81 * Government is subject to the restrictions as set forth in subparagraph
82 * (c)(1)(ii) of the Rights in Technical Data and Computer Software clause
83 * at DFARS 52.227-7013.
85 * Open Software Foundation, Inc.
90 * RESTRICTED RIGHTS LEGEND: This computer software is submitted with
91 * "restricted rights." Use, duplication or disclosure is subject to the
92 * restrictions as set forth in NASA FAR SUP 18-52.227-79 (April 1985)
93 * "Commercial Computer Software- Restricted Rights (April 1985)." Open
94 * Software Foundation, Inc., 11 Cambridge Center, Cambridge, MA 02142. If
95 * the contract contains the Clause at 18-52.227-74 "Rights in Data General"
96 * then the "Alternate III" clause applies.
98 * (c) Copyright 1989,1990 Open Software Foundation, Inc.
102 * Open Software Foundation is a trademark of The Open Software
105 * OSF is a trademark of Open Software Foundation, Inc.
106 * OSF/Motif is a trademark of Open Software Foundation, Inc.
107 * Motif is a trademark of Open Software Foundation, Inc.
108 * DEC is a registered trademark of Digital Equipment Corporation
109 * DIGITAL is a registered trademark of Digital Equipment Corporation
110 * X Window System is a trademark of the Massachusetts Institute of Technology
112 *****************************************************************************
113 *************************************<+>*************************************/
116 #include <X11/Xlib.h>
117 #include <X11/Intrinsic.h>
118 #include "DtSvcLock.h"
120 #define time32_width 32
121 #define time32_height 32
122 #define time32_x_hot 15
123 #define time32_y_hot 15
124 static unsigned char time32_bits[] = {
125 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0x7f,
126 0x8c, 0x00, 0x00, 0x31, 0x4c, 0x00, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x32,
127 0x4c, 0x00, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x32,
128 0x8c, 0x00, 0x00, 0x31, 0x0c, 0x7f, 0xfe, 0x30, 0x0c, 0xfe, 0x7f, 0x30,
129 0x0c, 0xfc, 0x3f, 0x30, 0x0c, 0xf8, 0x1f, 0x30, 0x0c, 0xe0, 0x07, 0x30,
130 0x0c, 0x80, 0x01, 0x30, 0x0c, 0x80, 0x01, 0x30, 0x0c, 0x60, 0x06, 0x30,
131 0x0c, 0x18, 0x18, 0x30, 0x0c, 0x04, 0x20, 0x30, 0x0c, 0x02, 0x40, 0x30,
132 0x0c, 0x01, 0x80, 0x30, 0x8c, 0x00, 0x00, 0x31, 0x4c, 0x80, 0x01, 0x32,
133 0x4c, 0xc0, 0x03, 0x32, 0x4c, 0xf0, 0x1f, 0x32, 0x4c, 0xff, 0xff, 0x32,
134 0xcc, 0xff, 0xff, 0x33, 0x8c, 0xff, 0xff, 0x31, 0xfe, 0xff, 0xff, 0x7f,
135 0xfe, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};
137 #define time32m_width 32
138 #define time32m_height 32
139 static unsigned char time32m_bits[] = {
140 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
141 0xcf, 0x00, 0x00, 0xf3, 0x6e, 0x00, 0x00, 0x76, 0x6e, 0x00, 0x00, 0x76,
142 0x6e, 0x00, 0x00, 0x76, 0x6e, 0x00, 0x00, 0x76, 0x6e, 0x00, 0x00, 0x76,
143 0xce, 0x00, 0x00, 0x73, 0x8e, 0x7f, 0xfe, 0x71, 0x0e, 0xff, 0xff, 0x70,
144 0x0e, 0xfe, 0x7f, 0x70, 0x0e, 0xfc, 0x3f, 0x70, 0x0e, 0xf8, 0x1f, 0x70,
145 0x0e, 0xe0, 0x07, 0x70, 0x0e, 0xe0, 0x07, 0x70, 0x0e, 0x78, 0x1e, 0x70,
146 0x0e, 0x1c, 0x38, 0x70, 0x0e, 0x06, 0x60, 0x70, 0x0e, 0x03, 0xc0, 0x70,
147 0x8e, 0x01, 0x80, 0x71, 0xce, 0x00, 0x00, 0x73, 0x6e, 0x80, 0x01, 0x76,
148 0x6e, 0xc0, 0x03, 0x76, 0x6e, 0xf0, 0x1f, 0x76, 0x6e, 0xff, 0xff, 0x76,
149 0xee, 0xff, 0xff, 0x77, 0xcf, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff,
150 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
153 #define time16_x_hot 7
154 #define time16_y_hot 7
155 #define time16_width 16
156 #define time16_height 16
157 static unsigned char time16_bits[] = {
158 0x00, 0x00, 0xfe, 0x7f, 0x14, 0x28, 0x14, 0x28, 0x14, 0x28, 0x24, 0x24,
159 0x44, 0x22, 0x84, 0x21, 0x84, 0x21, 0x44, 0x22, 0x24, 0x24, 0x14, 0x28,
160 0x94, 0x29, 0xd4, 0x2b, 0xfe, 0x7f, 0x00, 0x00};
162 #define time16m_width 16
163 #define time16m_height 16
164 static unsigned char time16m_bits[] = {
165 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
166 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f, 0xfe, 0x7f,
167 0xfe, 0x7f, 0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff};
170 /******** Public Function Declarations ********/
172 extern Cursor _DtGetHourGlassCursor(
174 extern void _DtTurnOnHourGlass(
176 extern void _DtTurnOffHourGlass(
179 /******** End Public Function Declarations ********/
181 /*************************************<->*************************************
183 * Cursor _DtGetHourGlassCursor ()
188 * Builds and returns the appropriate Hourglass cursor
201 * None. (None doesn't count as a comment)
203 *************************************<->***********************************/
205 _DtGetHourGlassCursor(
209 unsigned char *maskBits;
212 unsigned int xHotspot;
213 unsigned int yHotspot;
219 unsigned int cHeight;
220 int useLargeCursors = 0;
221 static Cursor waitCursor=0;
224 if (waitCursor != 0) {
225 _DtSvcProcessUnlock();
229 if (XQueryBestCursor (dpy, DefaultRootWindow(dpy),
230 32, 32, &cWidth, &cHeight))
232 if ((cWidth >= 32) && (cHeight >= 32))
240 width = time32_width;
241 height = time32_height;
243 maskBits = time32m_bits;
244 xHotspot = time32_x_hot;
245 yHotspot = time32_y_hot;
249 width = time16_width;
250 height = time16_height;
252 maskBits = time16m_bits;
253 xHotspot = time16_x_hot;
254 yHotspot = time16_y_hot;
257 pixmap = XCreateBitmapFromData (dpy,
258 DefaultRootWindow(dpy), (char*) bits,
262 maskPixmap = XCreateBitmapFromData (dpy,
263 DefaultRootWindow(dpy), (char*) maskBits,
266 xcolors[0].pixel = BlackPixelOfScreen(DefaultScreenOfDisplay(dpy));
267 xcolors[1].pixel = WhitePixelOfScreen(DefaultScreenOfDisplay(dpy));
270 DefaultColormapOfScreen(DefaultScreenOfDisplay
273 waitCursor = XCreatePixmapCursor (dpy, pixmap, maskPixmap,
274 &(xcolors[0]), &(xcolors[1]),
276 XFreePixmap (dpy, pixmap);
277 XFreePixmap (dpy, maskPixmap);
279 _DtSvcProcessUnlock();
284 /*************************************<->*************************************
286 * void DtSetHourGlass
291 * sets the window cursor to an hourglass
304 * None. (None doesn't count as a comment)
306 *************************************<->***********************************/
314 cursor = _DtGetHourGlassCursor(XtDisplay(w));
316 XDefineCursor(XtDisplay(w), XtWindow(w), cursor);
317 XFlush(XtDisplay(w));
321 /*************************************<->*************************************
323 * void _DtTurnOffHourGlass
328 * Removed the hourglass cursor from a window
341 * None. (None doesn't count as a comment)
343 *************************************<->***********************************/
350 XUndefineCursor(XtDisplay(w), XtWindow(w));
351 XFlush(XtDisplay(w));