2
* @OPENGROUP_COPYRIGHT@
4
* Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
5
* Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group
6
* ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
7
* the full copyright text.
9
* This software is subject to an open license. It may only be
10
* used on, with or for operating systems which are themselves open
11
* source systems. You must contact The Open Group for a license
12
* allowing distribution and sublicensing of this software on, with,
13
* or for operating systems which are not Open Source programs.
15
* See http://www.opengroup.org/openmotif/license for full
16
* details of the license agreement. Any use, reproduction, or
17
* distribution of the program constitutes recipient's acceptance of
20
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
21
* PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22
* KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
23
* WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
24
* OR FITNESS FOR A PARTICULAR PURPOSE
26
* EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
27
* NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
28
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
30
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32
* ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
33
* EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGES.
41
* (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
46
static char rcsid[] = "$XConsortium: DragIcon.c /main/17 1996/10/14 10:44:37 pascale $"
49
/* (c) Copyright 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
56
#include <Xm/Xm.h> /* To make cpp on Sun happy. CR 5943 */
57
#include <Xm/DisplayP.h>
58
#include <Xm/DragIconP.h>
59
#include "TextDIconI.h"
62
#include "DragIconI.h"
63
#include "ImageCachI.h"
64
#include "MessagesI.h"
69
#define MESSAGE1 _XmMMsgDragIcon_0000
70
#define MESSAGE2 _XmMMsgDragIcon_0001
72
#define PIXMAP_MAX_WIDTH 128
73
#define PIXMAP_MAX_HEIGHT 128
75
#define TheDisplay(dd) (XtDisplayOfObject(XtParent(dd)))
78
unsigned int width, height;
80
int offset_x, offset_y;
82
XmConst unsigned char *data;
84
XmConst unsigned char *maskData;
85
} XmCursorDataRec, *XmCursorData;
88
/******** Static Function Declarations ********/
90
static void DragIconInitialize(
95
static Boolean SetValues(
100
Cardinal *num_args) ;
104
static void ScreenObjectDestroy(
106
XtPointer client_data,
107
XtPointer call_data) ;
108
/******** End Static Function Declarations ********/
110
#define valid_width 16
111
#define valid_height 16
112
#define valid_x_hot 1
113
#define valid_y_hot 1
114
#define valid_x_offset 7
115
#define valid_y_offset 7
117
static XmConst unsigned char valid_bits[] = {
118
0x00, 0x00, 0xfe, 0x01, 0xfe, 0x00, 0x7e, 0x00, 0x3e, 0x00, 0x1e, 0x00,
119
0x0e, 0x00, 0x06, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
122
static XmConst unsigned char valid_m_bits[] = {
123
0xff, 0x07, 0xff, 0x03, 0xff, 0x01, 0xff, 0x00, 0x7f, 0x00, 0x3f, 0x00,
124
0x1f, 0x00, 0x0f, 0x00, 0x07, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00,
125
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
127
static XmConst XmCursorDataRec validCursorDataRec =
129
valid_width, valid_height,
130
valid_x_hot, valid_y_hot,
131
valid_x_offset, valid_y_offset,
139
#define invalid_width 16
140
#define invalid_height 16
141
#define invalid_x_hot 1
142
#define invalid_y_hot 1
143
#define invalid_x_offset 7
144
#define invalid_y_offset 7
147
static XmConst unsigned char invalid_bits[] = {
148
0x00, 0x00, 0xe0, 0x03, 0xf8, 0x0f, 0x1c, 0x1c, 0x0c, 0x1e, 0x06, 0x37,
149
0x86, 0x33, 0xc6, 0x31, 0xe6, 0x30, 0x76, 0x30, 0x3c, 0x18, 0x1c, 0x1c,
150
0xf8, 0x0f, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00};
152
static XmConst unsigned char invalid_m_bits[] = {
153
0xe0, 0x03, 0xf8, 0x0f, 0xfc, 0x1f, 0xfe, 0x3f, 0x1e, 0x3f, 0x8f, 0x7f,
154
0xcf, 0x7f, 0xef, 0x7b, 0xff, 0x79, 0xff, 0x78, 0x7e, 0x3c, 0xfe, 0x3f,
155
0xfc, 0x1f, 0xf8, 0x0f, 0xe0, 0x03, 0x00, 0x00};
157
static XmConst XmCursorDataRec invalidCursorDataRec =
159
invalid_width, invalid_height,
160
invalid_x_hot, invalid_y_hot,
161
invalid_x_offset, invalid_y_offset,
169
#define none_width 16
170
#define none_height 16
173
#define none_x_offset 7
174
#define none_y_offset 7
176
static XmConst unsigned char none_bits[] = {
177
0x00, 0x00, 0xe0, 0x03, 0xf8, 0x0f, 0x1c, 0x1c, 0x0c, 0x1e, 0x06, 0x37,
178
0x86, 0x33, 0xc6, 0x31, 0xe6, 0x30, 0x76, 0x30, 0x3c, 0x18, 0x1c, 0x1c,
179
0xf8, 0x0f, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00};
181
static XmConst unsigned char none_m_bits[] = {
182
0xe0, 0x03, 0xf8, 0x0f, 0xfc, 0x1f, 0xfe, 0x3f, 0x1e, 0x3f, 0x8f, 0x7f,
183
0xcf, 0x7f, 0xef, 0x7b, 0xff, 0x79, 0xff, 0x78, 0x7e, 0x3c, 0xfe, 0x3f,
184
0xfc, 0x1f, 0xf8, 0x0f, 0xe0, 0x03, 0x00, 0x00};
186
static XmConst XmCursorDataRec noneCursorDataRec =
188
none_width, none_height,
189
none_x_hot, none_y_hot,
190
none_x_offset, none_y_offset,
197
#define move_width 16
198
#define move_height 16
201
#define move_x_offset 14
202
#define move_y_offset 14
204
static XmConst unsigned char move_bits[] = {
205
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
206
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
207
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
210
static XmConst unsigned char move_m_bits[] = {
211
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
212
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
213
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
215
static XmConst XmCursorDataRec moveCursorDataRec =
217
move_width, move_height,
218
move_x_hot, move_y_hot,
219
move_x_offset, move_y_offset,
226
#define copy_width 16
227
#define copy_height 16
230
#define copy_x_offset 14
231
#define copy_y_offset 14
233
static XmConst unsigned char copy_bits[] = {
234
0x00, 0x00, 0xfe, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x1f, 0x02, 0x11,
235
0x02, 0x11, 0x02, 0x11, 0x02, 0x11, 0x02, 0x11, 0xfe, 0x11, 0x20, 0x10,
236
0x20, 0x10, 0xe0, 0x1f, 0x00, 0x00, 0x00, 0x00};
239
static XmConst unsigned char copy_m_bits[] = {
240
0xff, 0x03, 0xff, 0x03, 0xff, 0x03, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f,
241
0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f,
242
0xf0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x00, 0x00};
244
static XmConst XmCursorDataRec copyCursorDataRec =
246
copy_width, copy_height,
247
copy_x_hot, copy_y_hot,
248
copy_x_offset, copy_y_offset,
255
#define link_width 16
256
#define link_height 16
259
#define link_x_offset 14
260
#define link_y_offset 14
263
static XmConst unsigned char link_bits[] = {
264
0x00, 0x00, 0xfe, 0x03, 0x02, 0x02, 0x02, 0x02, 0x32, 0x02, 0x32, 0x3e,
265
0x42, 0x20, 0x82, 0x20, 0x02, 0x21, 0x3e, 0x26, 0x20, 0x26, 0x20, 0x20,
266
0x20, 0x20, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00};
269
static XmConst unsigned char link_m_bits[] = {
270
0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x07, 0xff, 0x7f, 0xff, 0x7f,
271
0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xf0, 0x7f,
272
0xf0, 0x7f, 0xf0, 0x7f, 0xf0, 0x7f, 0x00, 0x00};
274
static XmConst XmCursorDataRec linkCursorDataRec =
276
link_width, link_height,
277
link_x_hot, link_y_hot,
278
link_x_offset, link_y_offset,
285
#define Altsource16_width 16
286
#define Altsource16_height 16
287
#define Altsource16_x_hot 2
288
#define Altsource16_y_hot 2
290
static XmConst unsigned char Altsource16_bits[] = {
291
0xfc, 0x03, 0x04, 0x06, 0x04, 0x0a, 0x04, 0x12, 0x04, 0x3e, 0x04, 0x20,
292
0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20,
293
0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f};
295
static XmConst unsigned char Altsource16_m_bits[] = {
296
0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f,
297
0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f,
298
0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f};
300
static XmConst XmCursorDataRec Altsource16CursorDataRec =
302
Altsource16_width, Altsource16_height,
303
Altsource16_x_hot, Altsource16_y_hot,
312
#define Altsource_width 32
313
#define Altsource_height 32
314
#define Altsource_x_hot 3
315
#define Altsource_y_hot 3
317
static XmConst unsigned char Altsource_bits[] = {
318
0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0x10, 0x00, 0xc0, 0x00,
319
0x10, 0x00, 0x40, 0x01, 0x10, 0x00, 0x40, 0x02, 0x10, 0x00, 0x40, 0x04,
320
0x10, 0x00, 0xc0, 0x0f, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
321
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
322
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
323
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
324
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
325
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
326
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
327
0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x08,
328
0x10, 0x00, 0x00, 0x08, 0xf0, 0xff, 0xff, 0x0f};
330
static XmConst unsigned char Altsource_m_bits[] = {
331
0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x7f, 0x00, 0xf0, 0xff, 0xff, 0x00,
332
0xf0, 0xff, 0xff, 0x01, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x07,
333
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
334
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
335
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
336
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
337
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
338
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
339
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
340
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
341
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f};
343
static XmConst XmCursorDataRec AltsourceCursorDataRec =
345
Altsource_width, Altsource_height,
346
Altsource_x_hot, Altsource_y_hot,
355
* The 16x16 default icon data.
358
#define state16_width 16
359
#define state16_height 16
360
#define state16_x_hot 1
361
#define state16_y_hot 1
362
#define state16_x_offset -8
363
#define state16_y_offset -2
364
static XmConst unsigned char state16_bits[] =
366
0x00, 0x00, 0x3e, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x06, 0x00, 0x02, 0x00,
367
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
368
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
370
static XmConst unsigned char state16M_bits[] =
372
0x7f, 0x00, 0x7f, 0x00, 0x7f, 0x00, 0x3f, 0x00, 0x1f, 0x00, 0x0f, 0x00,
373
0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
374
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
376
static XmConst XmCursorDataRec state16CursorDataRec =
378
state16_width, state16_height,
379
state16_x_hot, state16_y_hot,
380
state16_x_offset, state16_y_offset,
387
#define move16_width 16
388
#define move16_height 16
389
#define move16_x_hot 1
390
#define move16_y_hot 1
391
#define move16_x_offset -8
392
#define move16_y_offset -2
393
static XmConst unsigned char move16_bits[] =
395
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x40, 0x0c,
396
0x40, 0x1c, 0x40, 0x3c, 0x40, 0x20, 0x40, 0x20, 0x40, 0x20, 0x40, 0x20,
397
0x40, 0x20, 0x40, 0x20, 0xc0, 0x3f, 0x00, 0x00
399
static XmConst unsigned char move16M_bits[] =
401
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0xe0, 0x1f, 0xe0, 0x3f,
402
0xe0, 0x7f, 0xe0, 0x7f, 0xe0, 0x7f, 0xe0, 0x7f, 0xe0, 0x7f, 0xe0, 0x7f,
403
0xe0, 0x7f, 0xe0, 0x7f, 0xe0, 0x7f, 0xe0, 0x7f
405
static XmConst XmCursorDataRec move16CursorDataRec =
407
move16_width, move16_height,
408
move16_x_hot, move16_y_hot,
409
move16_x_offset, move16_y_offset,
416
#define copy16_width 16
417
#define copy16_height 16
418
#define copy16_x_hot 1
419
#define copy16_y_hot 1
420
#define copy16_x_offset -8
421
#define copy16_y_offset -2
422
static XmConst unsigned char copy16_bits[] =
424
0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x80, 0x18, 0x80, 0x38, 0xb0, 0x78,
425
0x90, 0x40, 0x90, 0x40, 0x90, 0x40, 0x90, 0x40, 0x90, 0x40, 0x90, 0x7f,
426
0x10, 0x00, 0x10, 0x08, 0xf0, 0x0f, 0x00, 0x00
428
static XmConst unsigned char copy16M_bits[] =
430
0x00, 0x00, 0xc0, 0x1f, 0xc0, 0x3f, 0xc0, 0x7f, 0xf8, 0xff, 0xf8, 0xff,
431
0xf8, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf8, 0xff, 0xf8, 0xff,
432
0xf8, 0xff, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f
434
static XmConst XmCursorDataRec copy16CursorDataRec =
436
copy16_width, copy16_height,
437
copy16_x_hot, copy16_y_hot,
438
copy16_x_offset, copy16_y_offset,
445
#define link16_width 16
446
#define link16_height 16
447
#define link16_x_hot 1
448
#define link16_y_hot 1
449
#define link16_x_offset -8
450
#define link16_y_offset -2
451
static XmConst unsigned char link16_bits[] =
453
0x00, 0x00, 0x80, 0x0f, 0x80, 0x18, 0x80, 0x38, 0x80, 0x78, 0xb8, 0x40,
454
0x88, 0x4e, 0x88, 0x4c, 0x08, 0x4a, 0x08, 0x41, 0xa8, 0x7c, 0x68, 0x00,
455
0xe8, 0x04, 0x08, 0x04, 0xf8, 0x07, 0x00, 0x00
457
static XmConst unsigned char link16M_bits[] =
459
0xc0, 0x1f, 0xc0, 0x3f, 0xc0, 0x7f, 0xc0, 0xff, 0xfc, 0xff, 0xfc, 0xff,
460
0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff, 0xfc, 0xff,
461
0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x0f
463
static XmConst XmCursorDataRec link16CursorDataRec =
465
link16_width, link16_height,
466
link16_x_hot, link16_y_hot,
467
link16_x_offset, link16_y_offset,
474
#define source16_width 16
475
#define source16_height 16
476
#define source16_x_hot 0
477
#define source16_y_hot 0
478
static XmConst unsigned char source16_bits[] =
480
0x00, 0x00, 0xaa, 0xca, 0x54, 0x85, 0xaa, 0xca, 0x54, 0xe0, 0x2a, 0xe3,
481
0x94, 0x81, 0xea, 0xf8, 0x54, 0xd4, 0xaa, 0xac, 0x94, 0xd9, 0xca, 0xac,
482
0x64, 0xd6, 0x32, 0xab, 0xa4, 0xd6, 0xfe, 0xff
484
static XmConst XmCursorDataRec source16CursorDataRec =
486
source16_width, source16_height,
487
source16_x_hot, source16_y_hot,
497
* The 32x32 default icon data.
500
#define state32_width 32
501
#define state32_height 32
502
#define state32_x_hot 1
503
#define state32_y_hot 1
504
#define state32_x_offset -16
505
#define state32_y_offset -4
506
static XmConst unsigned char state32_bits[] =
508
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
509
0x1e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,
510
0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
511
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
512
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
513
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
514
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
515
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
516
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
517
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
518
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
520
static XmConst unsigned char state32M_bits[] =
522
0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
523
0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
524
0xff, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
525
0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
526
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
527
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
528
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
529
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
530
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
531
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
532
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
534
static XmConst XmCursorDataRec state32CursorDataRec =
536
state32_width, state32_height,
537
state32_x_hot, state32_y_hot,
538
state32_x_offset, state32_y_offset,
545
#define move32_width 32
546
#define move32_height 32
547
#define move32_x_hot 1
548
#define move32_y_hot 1
549
#define move32_x_offset -16
550
#define move32_y_offset -4
551
static XmConst unsigned char move32_bits[] =
553
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
554
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
555
0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00,
556
0x20, 0xe0, 0x00, 0x00, 0x20, 0xe0, 0x01, 0x00, 0x20, 0xe0, 0x03, 0x00,
557
0x20, 0xe0, 0x07, 0x00, 0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00,
558
0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00,
559
0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00,
560
0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00,
561
0xe0, 0xff, 0x0f, 0x00, 0xc0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00,
562
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
563
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
565
static XmConst unsigned char move32M_bits[] =
567
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
568
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
569
0xf0, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00,
570
0xf0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00,
571
0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00,
572
0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00,
573
0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00,
574
0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00,
575
0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xe0, 0xff, 0x1f, 0x00,
576
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
577
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
579
static XmConst XmCursorDataRec move32CursorDataRec =
581
move32_width, move32_height,
582
move32_x_hot, move32_y_hot,
583
move32_x_offset, move32_y_offset,
590
#define copy32_width 32
591
#define copy32_height 32
592
#define copy32_x_hot 1
593
#define copy32_y_hot 1
594
#define copy32_x_offset -16
595
#define copy32_y_offset -4
596
static XmConst unsigned char copy32_bits[] =
598
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
599
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
600
0x00, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x20, 0x60, 0x00, 0x00,
601
0x20, 0xe0, 0x00, 0x00, 0x20, 0xe0, 0x01, 0x00, 0x20, 0xe0, 0x03, 0x00,
602
0x20, 0xe0, 0x07, 0x00, 0x20, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x0c, 0x00,
603
0x20, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x6c, 0x00, 0x20, 0x00, 0xec, 0x00,
604
0x20, 0x00, 0x8c, 0x01, 0x20, 0x00, 0x8c, 0x01, 0x20, 0x00, 0x8c, 0x01,
605
0x20, 0x00, 0x8c, 0x01, 0x20, 0x00, 0x8c, 0x01, 0x20, 0x00, 0x8c, 0x01,
606
0xe0, 0xff, 0x8f, 0x01, 0xc0, 0xff, 0x8f, 0x01, 0x00, 0x00, 0x80, 0x01,
607
0x00, 0x04, 0x80, 0x01, 0x00, 0x04, 0x80, 0x01, 0x00, 0xfc, 0xff, 0x01,
608
0x00, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00
610
static XmConst unsigned char copy32M_bits[] =
612
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
613
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
614
0xf0, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0xf0, 0xff, 0x01, 0x00,
615
0xf0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00,
616
0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x1f, 0x00, 0xf0, 0xff, 0x7f, 0x00,
617
0xf0, 0xff, 0xff, 0x00, 0xf0, 0xff, 0xff, 0x01, 0xf0, 0xff, 0xff, 0x03,
618
0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03,
619
0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03,
620
0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x03,
621
0x00, 0xfe, 0xff, 0x03, 0x00, 0xfe, 0xff, 0x03, 0x00, 0xfe, 0xff, 0x03,
622
0x00, 0xfe, 0xff, 0x03, 0x00, 0xfc, 0xff, 0x03
624
static XmConst XmCursorDataRec copy32CursorDataRec =
626
copy32_width, copy32_height,
627
copy32_x_hot, copy32_y_hot,
628
copy32_x_offset, copy32_y_offset,
635
#define link32_width 32
636
#define link32_height 32
637
#define link32_x_hot 1
638
#define link32_y_hot 1
639
#define link32_x_offset -16
640
#define link32_y_offset -4
641
static XmConst unsigned char link32_bits[] =
643
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
644
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
645
0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0x20, 0x30, 0x00, 0x00,
646
0x20, 0x70, 0x00, 0x00, 0x20, 0xf0, 0x00, 0x00, 0x20, 0xf0, 0x01, 0x00,
647
0x20, 0x00, 0x7b, 0x00, 0x20, 0x00, 0xc3, 0x00, 0x20, 0x04, 0xc3, 0x01,
648
0x20, 0x06, 0xc3, 0x03, 0x20, 0x0f, 0xc2, 0x07, 0x20, 0x36, 0x00, 0x0c,
649
0x20, 0xc4, 0x00, 0x0c, 0x20, 0x00, 0x23, 0x0c, 0x20, 0x00, 0x6c, 0x0c,
650
0x20, 0x00, 0xf0, 0x0c, 0xe0, 0xff, 0x61, 0x0c, 0xc0, 0xff, 0x23, 0x0c,
651
0x00, 0x00, 0x00, 0x0c, 0x00, 0x80, 0x00, 0x0c, 0x00, 0x80, 0x00, 0x0c,
652
0x00, 0x80, 0xff, 0x0f, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00,
653
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
655
static XmConst unsigned char link32M_bits[] =
657
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
658
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
659
0xf0, 0x3f, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00,
660
0xf0, 0xff, 0x01, 0x00, 0xf0, 0xff, 0x03, 0x00, 0xf0, 0xff, 0xff, 0x00,
661
0xf0, 0xff, 0xff, 0x01, 0xf0, 0xff, 0xff, 0x03, 0xf0, 0xff, 0xff, 0x07,
662
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x1f,
663
0xf0, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x1f,
664
0xf0, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x1f,
665
0xe0, 0xff, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0x1f,
666
0x00, 0xc0, 0xff, 0x1f, 0x00, 0xc0, 0xff, 0x1f, 0x00, 0x80, 0xff, 0x1f,
667
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
669
static XmConst XmCursorDataRec link32CursorDataRec =
671
link32_width, link32_height,
672
link32_x_hot, link32_y_hot,
673
link32_x_offset, link32_y_offset,
680
#define source32_width 32
681
#define source32_height 32
682
#define source32_x_hot 0
683
#define source32_y_hot 0
684
static XmConst unsigned char source32_bits[] =
686
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x54, 0x55, 0x55, 0xd5,
687
0xa8, 0xaa, 0xaa, 0xea, 0x54, 0x55, 0x55, 0xd1, 0xa8, 0xaa, 0xaa, 0xe0,
688
0x54, 0x55, 0x55, 0xd0, 0xa8, 0xaa, 0xaa, 0xf0, 0x54, 0x55, 0x55, 0xd9,
689
0xa8, 0xaa, 0x00, 0xee, 0x54, 0x55, 0x00, 0xd6, 0xa8, 0x2a, 0x3f, 0xea,
690
0x54, 0x95, 0x05, 0xd7, 0xa8, 0xea, 0x82, 0xee, 0x54, 0x45, 0xc1, 0xd5,
691
0xa8, 0xaa, 0xf4, 0x81, 0x54, 0xd5, 0x78, 0xff, 0xa8, 0xaa, 0xa0, 0xea,
692
0x54, 0x95, 0x41, 0xd5, 0xa8, 0x4a, 0x87, 0xea, 0x54, 0x85, 0x0d, 0xd5,
693
0xa8, 0xc2, 0x9a, 0xea, 0x54, 0x61, 0x05, 0xd5, 0xa8, 0xb0, 0xc2, 0xea,
694
0x54, 0x58, 0x61, 0xd5, 0x28, 0xac, 0xb0, 0xea, 0x14, 0x56, 0x58, 0xd5,
695
0x08, 0xab, 0xa8, 0xea, 0x14, 0x55, 0x51, 0xd5, 0x28, 0xaa, 0xaa, 0xea,
696
0xfc, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff,
699
static XmConst XmCursorDataRec source32CursorDataRec =
701
source32_width, source32_height,
702
source32_x_hot, source32_y_hot,
711
typedef struct _XmQuarkToCursorEntryRec{
713
XmConst XmCursorDataRec *cursor;
714
} XmQuarkToCursorEntryRec, *XmQuarkToCursorEntry;
716
/* Used to be XmConst, but this was not linking on Solaris */
717
static XmQuarkToCursorEntryRec AltquarkToCursorTable[] = {
718
{ &_XmValidCursorIconQuark, &state32CursorDataRec},
719
{ &_XmInvalidCursorIconQuark,&state32CursorDataRec},
720
{ &_XmNoneCursorIconQuark, &state32CursorDataRec},
721
{ &_XmMoveCursorIconQuark, &move32CursorDataRec},
722
{ &_XmCopyCursorIconQuark, ©32CursorDataRec},
723
{ &_XmLinkCursorIconQuark, &link32CursorDataRec},
724
{ &_XmDefaultDragIconQuark, &AltsourceCursorDataRec},
727
/* Used to be XmConst, but this was not linking on Solaris */
728
static XmQuarkToCursorEntryRec AltquarkTo16CursorTable[] = {
729
{ &_XmValidCursorIconQuark, &validCursorDataRec},
730
{ &_XmInvalidCursorIconQuark,&invalidCursorDataRec},
731
{ &_XmNoneCursorIconQuark, &noneCursorDataRec},
732
{ &_XmMoveCursorIconQuark, &moveCursorDataRec},
733
{ &_XmCopyCursorIconQuark, ©CursorDataRec},
734
{ &_XmLinkCursorIconQuark, &linkCursorDataRec},
735
{ &_XmDefaultDragIconQuark, &Altsource16CursorDataRec},
738
/* Used to be XmConst, but this was not linking on Solaris */
739
static XmQuarkToCursorEntryRec quarkToCursorTable[] = {
740
{&_XmValidCursorIconQuark, &state32CursorDataRec},
741
{&_XmInvalidCursorIconQuark,&state32CursorDataRec},
742
{&_XmNoneCursorIconQuark, &state32CursorDataRec},
743
{&_XmMoveCursorIconQuark, &move32CursorDataRec},
744
{&_XmCopyCursorIconQuark, ©32CursorDataRec},
745
{&_XmLinkCursorIconQuark, &link32CursorDataRec},
746
{&_XmDefaultDragIconQuark, &source32CursorDataRec},
749
/* Used to be XmConst, but this was not linking on Solaris */
750
static XmQuarkToCursorEntryRec quarkTo16CursorTable[] = {
751
{&_XmValidCursorIconQuark, &state16CursorDataRec},
752
{&_XmInvalidCursorIconQuark,&state16CursorDataRec},
753
{&_XmNoneCursorIconQuark, &state16CursorDataRec},
754
{&_XmMoveCursorIconQuark, &move16CursorDataRec},
755
{&_XmCopyCursorIconQuark, ©16CursorDataRec},
756
{&_XmLinkCursorIconQuark, &link16CursorDataRec},
757
{&_XmDefaultDragIconQuark, &source16CursorDataRec},
761
#define Offset(x) (XtOffsetOf( struct _XmDragIconRec, drag.x))
763
static XContext _XmTextualDragIconContext = (XContext) NULL;
765
static XtResource resources[]=
768
XmNdepth, XmCDepth, XmRInt,
769
sizeof(int), Offset(depth),
770
XmRImmediate, (XtPointer)1,
773
XmNwidth, XmCWidth, XmRHorizontalDimension,
774
sizeof(Dimension), Offset(width),
775
XmRImmediate, (XtPointer) 0,
778
XmNheight, XmCHeight, XmRVerticalDimension,
779
sizeof(Dimension), Offset(height),
780
XmRImmediate, (XtPointer) 0,
783
XmNhotX, XmCHot, XmRPosition,
784
sizeof(Position), Offset(hot_x),
785
XmRImmediate, (XtPointer)0,
788
XmNhotY, XmCHot, XmRPosition,
789
sizeof(Position), Offset(hot_y),
790
XmRImmediate, (XtPointer)0,
793
XmNmask, XmCPixmap, XmRBitmap,
794
sizeof(Pixmap), Offset(mask),
795
XmRImmediate, (XtPointer)XmUNSPECIFIED_PIXMAP,
798
XmNpixmap, XmCPixmap, XmRDynamicPixmap,
799
sizeof(Pixmap), Offset(pixmap),
800
XmRImmediate, (XtPointer)XmUNSPECIFIED_PIXMAP,
803
XmNoffsetX, XmCOffset, XmRPosition,
804
sizeof(Position), Offset(offset_x),
805
XmRImmediate, (XtPointer)0,
808
XmNoffsetY, XmCOffset, XmRPosition,
809
sizeof(Position), Offset(offset_y),
810
XmRImmediate, (XtPointer)0,
813
XmNattachment, XmCAttachment, XmRIconAttachment,
814
sizeof(unsigned char), Offset(attachment),
815
XmRImmediate, (XtPointer) XmATTACH_NORTH_WEST
819
externaldef(xmdragiconclassrec)
820
XmDragIconClassRec xmDragIconClassRec = {
822
(WidgetClass) &objectClassRec, /* superclass */
823
"XmDragIcon", /* class_name */
824
sizeof(XmDragIconRec), /* size */
825
NULL, /* Class Initializer */
826
NULL, /* class_part_init */
827
FALSE, /* Class init'ed ? */
828
DragIconInitialize, /* initialize */
829
NULL, /* initialize_notify */
833
(XtResourceList)resources, /* resources */
834
XtNumber(resources), /* resource_count */
835
NULLQUARK, /* xrm_class */
836
FALSE, /* compress_motion */
837
XtExposeNoCompress, /* compress_exposure */
838
FALSE, /* compress_enterleave */
839
FALSE, /* visible_interest */
840
Destroy, /* destroy */
843
SetValues, /* set_values */
844
NULL, /* set_values_hook */
845
XtInheritSetValuesAlmost, /* set_values_almost */
846
NULL, /* get_values_hook */
847
NULL, /* accept_focus */
848
XtVersion, /* intrinsics version */
849
NULL, /* callback offsets */
851
NULL, /* query_geometry */
852
NULL, /* display_accelerator */
853
NULL, /* extension */
856
NULL, /* extension */
860
externaldef(dragIconobjectclass) WidgetClass
861
xmDragIconObjectClass = (WidgetClass) &xmDragIconClassRec;
864
/************************************************************************
868
************************************************************************/
873
Widget req, /* unused */
875
ArgList args, /* unused */
876
Cardinal *numArgs ) /* unused */
878
XmDragIconObject dragIcon = (XmDragIconObject)new_w;
879
Screen *screen = XtScreenOfObject(XtParent(dragIcon));
880
Display * display = XtDisplay(new_w);
881
XmDisplay xmdpy = (XmDisplay) XmGetXmDisplay(display);
882
Boolean use_alt = xmdpy -> display.enable_drag_icon;
884
dragIcon->drag.isDirty = False;
885
if (dragIcon->drag.pixmap == XmUNSPECIFIED_PIXMAP) {
887
XmCursorData cursorData = NULL;
889
XImage *image = NULL;
890
Dimension maxW, maxH;
893
* If this is one of the default cursors (recognized by name)
894
* then we use the built in images to generate the pixmap, its
895
* mask (as appropriate), and its dimensions and hot spot.
898
XmeQueryBestCursorSize (XtParent(dragIcon), &maxW, &maxH);
900
if (maxW < 32 || maxH < 32) {
905
for (i = 0; i < XtNumber(quarkTo16CursorTable); i++) {
906
if ((*(quarkTo16CursorTable[i].xrmName)) ==
907
dragIcon->object.xrm_name) {
908
cursorData = (XmCursorData) quarkTo16CursorTable[i].cursor;
913
for (i = 0; i < XtNumber(quarkTo16CursorTable); i++) {
914
if ((*(AltquarkTo16CursorTable[i].xrmName)) ==
915
dragIcon->object.xrm_name) {
916
cursorData = (XmCursorData) AltquarkTo16CursorTable[i].cursor;
927
for (i = 0; i < XtNumber(quarkToCursorTable); i++) {
928
if ((*(quarkToCursorTable[i].xrmName)) ==
929
dragIcon->object.xrm_name) {
930
cursorData = (XmCursorData) quarkToCursorTable[i].cursor;
935
for (i = 0; i < XtNumber(quarkToCursorTable); i++) {
936
if ((*(AltquarkToCursorTable[i].xrmName)) ==
937
dragIcon->object.xrm_name) {
938
cursorData = (XmCursorData) AltquarkToCursorTable[i].cursor;
946
dragIcon->drag.depth = 1;
947
dragIcon->drag.width = cursorData->width;
948
dragIcon->drag.height = cursorData->height;
949
dragIcon->drag.hot_x = cursorData->hot_x;
950
dragIcon->drag.hot_y = cursorData->hot_y;
951
dragIcon->drag.offset_x = cursorData->offset_x;
952
dragIcon->drag.offset_y = cursorData->offset_y;
954
_XmCreateImage(image, display, (char *)cursorData->data,
955
dragIcon->drag.width, dragIcon->drag.height,
958
_XmInstallImage(image, cursorData->dataName,
959
(int)dragIcon->drag.hot_x,
960
(int)dragIcon->drag.hot_y);
961
dragIcon->drag.pixmap =
962
XmGetPixmapByDepth (screen, cursorData->dataName, 1, 0, 1);
964
if (cursorData->maskData) {
965
_XmCreateImage(image, display, (char *)cursorData->maskData,
966
dragIcon->drag.width, dragIcon->drag.height,
969
_XmInstallImage (image, cursorData->maskDataName, 0, 0);
971
dragIcon->drag.mask =
972
XmGetPixmapByDepth(screen, cursorData->maskDataName,
976
dragIcon->drag.region = NULL;
978
else if (dragIcon->drag.pixmap != XmUNSPECIFIED_PIXMAP) {
980
unsigned int width, height;
983
Pixel foreground, background;
984
if ((dragIcon->drag.width == 0) || (dragIcon->drag.height == 0)) {
985
if (XmeGetPixmapData(screen,
986
dragIcon->drag.pixmap,
989
&foreground, &background,
992
dragIcon->drag.depth = depth;
993
dragIcon->drag.hot_x = hot_x;
994
dragIcon->drag.hot_y = hot_y;
995
dragIcon->drag.width = (Dimension)width;
996
dragIcon->drag.height = (Dimension)height;
999
dragIcon->drag.width =
1000
dragIcon->drag.height = 0;
1001
dragIcon->drag.pixmap = XmUNSPECIFIED_PIXMAP;
1002
XmeWarning ((Widget) new_w, MESSAGE1);
1005
if (dragIcon->drag.mask != XmUNSPECIFIED_PIXMAP) {
1008
if (dragIcon->drag.width > 0 && dragIcon->drag.height > 0) {
1009
image = XGetImage(display, (Drawable) dragIcon->drag.mask,
1010
0, 0, dragIcon->drag.width,
1011
dragIcon->drag.height, 1L, XYPixmap);
1013
dragIcon->drag.region = (Region) _XmRegionFromImage(image);
1015
XDestroyImage(image);
1017
dragIcon->drag.region = NULL;
1020
dragIcon->drag.region = NULL;
1023
dragIcon->drag.restore_region = NULL;
1024
dragIcon->drag.x_offset = 0;
1025
dragIcon->drag.y_offset = 0;
1027
if (dragIcon->drag.pixmap == XmUNSPECIFIED_PIXMAP) {
1028
XmeWarning ((Widget) new_w, MESSAGE2);
1032
/************************************************************************
1036
************************************************************************/
1045
return (XtCreateWidget (name, xmDragIconObjectClass, parent,
1046
argList, argCount));
1049
/************************************************************************
1051
* _XmDestroyDefaultDragIcon ()
1053
* A default XmDragIcon's pixmap and mask (if present) were installed in
1054
* the Xm pixmap cache from built-in images when the XmDragIcon was
1056
************************************************************************/
1059
_XmDestroyDefaultDragIcon(
1060
XmDragIconObject icon)
1062
Screen *screen = XtScreenOfObject(XtParent(icon));
1064
if (icon->drag.pixmap != XmUNSPECIFIED_PIXMAP) {
1065
XmDestroyPixmap (screen, icon->drag.pixmap);
1066
icon->drag.pixmap = XmUNSPECIFIED_PIXMAP;
1068
if (icon->drag.mask != XmUNSPECIFIED_PIXMAP) {
1069
XmDestroyPixmap (screen, icon->drag.mask);
1070
icon->drag.mask = XmUNSPECIFIED_PIXMAP;
1072
XtDestroyWidget ((Widget) icon);
1075
/************************************************************************
1077
* _XmDragIconIsDirty ()
1079
* Test the isDirty member of XmDragIconObject.
1080
************************************************************************/
1084
XmDragIconObject icon)
1086
return (icon->drag.isDirty);
1089
/************************************************************************
1091
* _XmDragIconClean ()
1093
* Clear the isDirty member of XmDragIconObjects.
1094
************************************************************************/
1098
XmDragIconObject icon1,
1099
XmDragIconObject icon2,
1100
XmDragIconObject icon3)
1103
icon1->drag.isDirty = False;
1105
icon2->drag.isDirty = False;
1107
icon3->drag.isDirty = False;
1110
/************************************************************************
1114
************************************************************************/
1120
Widget req, /* unused */
1122
ArgList args, /* unused */
1123
Cardinal *num_args) /* unused */
1125
XmDragIconObject newIcon = (XmDragIconObject) new_w;
1126
XmDragIconObject oldIcon = (XmDragIconObject) current;
1129
* Mark the icon as dirty if any of its resources have changed.
1132
if ((newIcon->drag.depth != oldIcon->drag.depth) ||
1133
(newIcon->drag.pixmap != oldIcon->drag.pixmap) ||
1134
(newIcon->drag.mask != oldIcon->drag.mask) ||
1135
(newIcon->drag.width != oldIcon->drag.width) ||
1136
(newIcon->drag.height != oldIcon->drag.height) ||
1137
(newIcon->drag.attachment != oldIcon->drag.attachment) ||
1138
(newIcon->drag.offset_x != oldIcon->drag.offset_x) ||
1139
(newIcon->drag.offset_y != oldIcon->drag.offset_y) ||
1140
(newIcon->drag.hot_x != oldIcon->drag.hot_x) ||
1141
(newIcon->drag.hot_y != oldIcon->drag.hot_y)) {
1143
newIcon->drag.isDirty = True;
1146
if (newIcon->drag.mask != oldIcon->drag.mask) {
1147
if (newIcon->drag.mask != XmUNSPECIFIED_PIXMAP) {
1150
if (newIcon->drag.width > 0 && newIcon->drag.height > 0) {
1151
image = XGetImage(XtDisplay(new_w),
1152
(Drawable) newIcon->drag.mask,
1153
0, 0, newIcon->drag.width,
1154
newIcon->drag.height, 1L, XYPixmap);
1156
newIcon->drag.region = (Region) _XmRegionFromImage(image);
1158
XDestroyImage(image);
1161
newIcon->drag.region = NULL;
1164
newIcon->drag.region = NULL;
1166
if (oldIcon->drag.region) {
1167
XDestroyRegion(oldIcon->drag.region);
1168
oldIcon->drag.region = NULL;
1175
/************************************************************************
1179
* Remove any cached cursors referencing this icon.
1180
************************************************************************/
1186
XmDragIconObject dragIcon = (XmDragIconObject) w;
1188
if (dragIcon->drag.region != NULL) {
1189
XDestroyRegion(dragIcon->drag.region);
1190
dragIcon->drag.region = NULL;
1193
if (dragIcon->drag.restore_region != NULL) {
1194
XDestroyRegion(dragIcon->drag.restore_region);
1195
dragIcon->drag.restore_region = NULL;
1198
_XmScreenRemoveFromCursorCache (dragIcon);
1205
ScreenObjectDestroy(
1207
XtPointer client_data,
1208
XtPointer call_data )
1210
Widget drag_icon = (Widget) client_data;
1212
XtDestroyWidget(drag_icon); /* destroy drag_icon */
1214
XDeleteContext(XtDisplay(w), RootWindowOfScreen(XtScreen(w)),
1215
_XmTextualDragIconContext);
1221
XmeGetTextualDragIcon(
1227
Pixmap icon, icon_mask;
1228
Screen *screen = XtScreen(w);
1229
XImage *image = NULL;
1231
Widget screen_object;
1234
XContext loc_context;
1235
_XmWidgetToAppContext(w);
1238
root = RootWindowOfScreen(XtScreen(w));
1239
dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(w));
1240
use_alt = dpy -> display.enable_drag_icon;
1243
if (_XmTextualDragIconContext == (XContext) NULL)
1244
_XmTextualDragIconContext = XUniqueContext();
1245
loc_context = _XmTextualDragIconContext;
1248
if (XFindContext(XtDisplay(w), root,
1249
loc_context, (char **) &drag_icon)) {
1250
Dimension height, width;
1252
XmConst unsigned char *icon_bits;
1253
XmConst unsigned char *icon_mask_bits;
1255
XmeQueryBestCursorSize(w, &width, &height);
1257
if (width < 64 && height < 64) {
1259
icon_bits = XmTEXTUAL_DRAG_ICON_BITS_Alt_16;
1260
icon_mask_bits = XmTEXTUAL_DRAG_ICON_MASK_BITS_Alt_16;
1261
height = XmTEXTUAL_DRAG_ICON_HEIGHT_Alt_16;
1262
width = XmTEXTUAL_DRAG_ICON_WIDTH_Alt_16;
1263
x_hot = XmTEXTUAL_DRAG_ICON_X_HOT_Alt_16;
1264
y_hot = XmTEXTUAL_DRAG_ICON_Y_HOT_Alt_16;
1266
icon_bits = XmTEXTUAL_DRAG_ICON_BITS_16;
1267
icon_mask_bits = XmTEXTUAL_DRAG_ICON_MASK_BITS_16;
1268
height = XmTEXTUAL_DRAG_ICON_HEIGHT_16;
1269
width = XmTEXTUAL_DRAG_ICON_WIDTH_16;
1270
x_hot = XmTEXTUAL_DRAG_ICON_X_HOT_16;
1271
y_hot = XmTEXTUAL_DRAG_ICON_Y_HOT_16;
1275
icon_bits = XmTEXTUAL_DRAG_ICON_BITS_Alt_32;
1276
icon_mask_bits = XmTEXTUAL_DRAG_ICON_MASK_BITS_Alt_32;
1277
height = XmTEXTUAL_DRAG_ICON_HEIGHT_Alt_32;
1278
width = XmTEXTUAL_DRAG_ICON_WIDTH_Alt_32;
1279
x_hot = XmTEXTUAL_DRAG_ICON_X_HOT_Alt_32;
1280
y_hot = XmTEXTUAL_DRAG_ICON_Y_HOT_Alt_32;
1282
icon_bits = XmTEXTUAL_DRAG_ICON_BITS_32;
1283
icon_mask_bits = XmTEXTUAL_DRAG_ICON_MASK_BITS_32;
1284
height = XmTEXTUAL_DRAG_ICON_HEIGHT_32;
1285
width = XmTEXTUAL_DRAG_ICON_WIDTH_32;
1286
x_hot = XmTEXTUAL_DRAG_ICON_X_HOT_32;
1287
y_hot = XmTEXTUAL_DRAG_ICON_Y_HOT_32;
1291
_XmCreateImage(image, XtDisplay(w), (char *)icon_bits,
1292
width, height, LSBFirst);
1293
_XmInstallImage(image, "XmTextualDragIcon", x_hot, y_hot);
1294
icon = XmGetPixmapByDepth(screen, "XmTextualDragIcon", 1, 0, 1);
1296
_XmCreateImage(image, XtDisplay(w), (char *)icon_mask_bits,
1297
width, height, LSBFirst);
1298
_XmInstallImage(image, "XmTextualDragIconMask", x_hot, y_hot);
1299
icon_mask = XmGetPixmapByDepth(screen, "XmTextualDragIconMask",
1301
screen_object = XmGetXmScreen(XtScreen(w));
1303
XtSetArg(args[n], XmNhotX, x_hot); n++;
1304
XtSetArg(args[n], XmNhotY, y_hot); n++;
1305
XtSetArg(args[n], XmNheight, height); n++;
1306
XtSetArg(args[n], XmNwidth, width); n++;
1307
XtSetArg(args[n], XmNmaxHeight, height); n++;
1308
XtSetArg(args[n], XmNmaxWidth, width); n++;
1309
XtSetArg(args[n], XmNmask, icon_mask); n++;
1310
XtSetArg(args[n], XmNpixmap, icon); n++;
1311
drag_icon = XtCreateWidget("drag_icon", xmDragIconObjectClass,
1312
screen_object, args, n);
1314
XSaveContext(XtDisplay(w), root,
1315
loc_context, (char *) drag_icon);
1317
XtAddCallback(screen_object, XmNdestroyCallback, ScreenObjectDestroy,
1318
(XtPointer) drag_icon);