author | Claus Gittinger <cg@exept.de> |
Tue, 19 Oct 1999 19:58:44 +0200 | |
changeset 2977 | abdb7cf1635a |
parent 2974 | 1be15d407539 |
child 2984 | 6a278fd02e74 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
1344 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
DeviceWorkstation subclass:#XWorkstation |
|
1344 | 14 |
instanceVariableNames:'screen hasShapeExtension hasShmExtension hasDPSExtension |
15 |
hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
|
16 |
hasImageExtension hasInputExtension ignoreBackingStore blackpixel |
|
17 |
whitepixel protocolsAtom deleteWindowAtom saveYourselfAtom |
|
18 |
quitAppAtom primaryAtom secondaryAtom cutBuffer0Atom stringAtom |
|
1535 | 19 |
lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX |
20 |
eventRootY displayName eventTrace dispatchingExpose rgbVisual |
|
21 |
virtualRootId rootId eventBuffer altModifierMask metaModifierMask |
|
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
22 |
multiClickTime deviceIOTimeoutErrorSignal activateOnClick' |
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
23 |
classVariableNames:'RawKeysymTranslation ConservativeSync' |
1344 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Graphics' |
|
295 | 26 |
! |
0 | 27 |
|
78 | 28 |
!XWorkstation primitiveDefinitions! |
0 | 29 |
%{ |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
30 |
|
1062 | 31 |
#ifdef LINUX |
32 |
# define SHM |
|
33 |
#endif |
|
34 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
35 |
#define COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
36 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
37 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
38 |
static int __cnt_color = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
39 |
static int __cnt_bitmap = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
40 |
static int __cnt_view = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
41 |
static int __cnt_gc = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
42 |
static int __cnt_cursor = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
43 |
static int __cnt_font = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
44 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
45 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
46 |
|
46 | 47 |
/* |
48 |
* x does a typedef Time - I need Object Time ... |
|
49 |
*/ |
|
2791 | 50 |
#undef Time |
0 | 51 |
#define Time XTime |
52 |
||
391
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
53 |
/* |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
54 |
* x does a #define True / False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
55 |
* we are lucky - the ST/X True/False are not needed |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
56 |
*/ |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
57 |
#undef True |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
58 |
#undef False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
59 |
|
37 | 60 |
#ifdef memset |
61 |
# undef memset |
|
62 |
#endif |
|
63 |
||
1891 | 64 |
|
0 | 65 |
#include <stdio.h> |
66 |
#include <X11/Xlib.h> |
|
67 |
#include <X11/Xutil.h> |
|
68 |
#include <X11/Xatom.h> |
|
69 |
||
150 | 70 |
#define XK_MISCELLANY |
71 |
#include <X11/keysymdef.h> |
|
72 |
||
277
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
73 |
#include <X11/cursorfont.h> |
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
74 |
|
1974 | 75 |
#ifdef LINUX |
76 |
# include <sys/socket.h> |
|
77 |
#endif |
|
78 |
||
2422
6bffcb4c8360
changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents:
2386
diff
changeset
|
79 |
|
90 | 80 |
/* |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
81 |
* this define suppresses XAllocColor/XFreeColor on |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
82 |
* TrueColor systems - I am not certain, if this is |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
83 |
* always legal to do (it works with XFree servers). |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
84 |
*/ |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
85 |
#define QUICK_TRUE_COLORS |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
86 |
|
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
87 |
/* |
0 | 88 |
* shape support works; enabled by -DSHAPE in makefile |
89 |
* see RoundClock and RoundGlobe examples |
|
90 |
*/ |
|
91 |
#ifdef SHAPE |
|
92 |
# include <X11/extensions/shape.h> |
|
93 |
#endif |
|
94 |
||
95 |
/* |
|
150 | 96 |
* shared memory extension access is currently not supported |
0 | 97 |
* (only query is implemented) |
98 |
*/ |
|
99 |
#ifdef SHM |
|
100 |
# include <X11/extensions/XShm.h> |
|
101 |
#endif |
|
102 |
||
103 |
/* |
|
150 | 104 |
* multiBuffer extension access is currently not supported |
105 |
* (only query is implemented) |
|
106 |
*/ |
|
107 |
#ifdef MBUF |
|
108 |
# include <X11/extensions/multibuf.h> |
|
109 |
#endif |
|
110 |
||
111 |
/* |
|
112 |
* XVideo extension access is currently not supported |
|
113 |
* (only query is implemented) |
|
114 |
*/ |
|
115 |
#ifdef XVIDEO |
|
116 |
# include <X11/extensions/Xv.h> |
|
117 |
#endif |
|
118 |
||
119 |
/* |
|
186 | 120 |
* PEX extension - if available |
121 |
*/ |
|
122 |
#ifdef PEX5 |
|
123 |
# include <PEX5/PEX.h> |
|
124 |
#endif |
|
125 |
||
126 |
/* |
|
127 |
* XImage extension - if available |
|
128 |
*/ |
|
129 |
#ifdef XIE |
|
130 |
# include <X11/extensions/XIE.h> |
|
131 |
#endif |
|
132 |
||
133 |
/* |
|
90 | 134 |
* when I have more time to check it out, I will support display-PS |
0 | 135 |
*/ |
136 |
#ifdef DPS |
|
137 |
# ifdef sgi |
|
138 |
# include <X11/extensions/XDPS.h> |
|
139 |
# include <X11/extensions/XDPSlib.h> |
|
140 |
# include <X11/extensions/dpsXclient.h> |
|
141 |
# else |
|
142 |
# include <DPS/XDPS.h> |
|
143 |
# include <DPS/XDPSlib.h> |
|
144 |
# include <DPS/dpsXclient.h> |
|
145 |
# endif |
|
146 |
#endif |
|
147 |
||
1898 | 148 |
#if defined(someMachine) |
149 |
/* |
|
150 |
* if nformats cannot be found in the Display structure ... |
|
151 |
*/ |
|
152 |
# define NO_PRIVATE_DISPLAY_ACCESS |
|
153 |
#endif |
|
154 |
||
155 |
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6) |
|
90 | 156 |
/* |
157 |
* accessing private data in Display ... sorry |
|
158 |
*/ |
|
159 |
# define DISPLAYACCESS(d) ((_XPrivDisplay)d) |
|
160 |
#else |
|
161 |
# define DISPLAYACCESS(d) d |
|
162 |
#endif |
|
163 |
||
78 | 164 |
/* |
165 |
* some defines - tired of typing ... |
|
166 |
*/ |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
167 |
#define _DisplayVal(o) (Display *)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
168 |
#define _WindowVal(o) (Window)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
169 |
#define _PixmapVal(o) (Pixmap)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
170 |
#define _GCVal(o) (GC)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
171 |
#define _CursorVal(o) (Cursor)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
172 |
#define _FontVal(o) (XFontStruct *)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
173 |
#define _DPSContextVal(o) (DPSContext)(__externalAddressVal(o)) |
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
174 |
|
211 | 175 |
#define __MKATOMOBJ(a) __MKSMALLINT(a) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
176 |
#define _AtomVal(o) __intVal(o) |
211 | 177 |
#define __isAtomID(o) __isSmallInteger(o) |
178 |
||
555 | 179 |
#define myDpy _DisplayVal(__INST(displayId)) |
180 |
#define ISCONNECTED (__INST(displayId) != nil) |
|
78 | 181 |
|
182 |
#ifndef THISCONTEXT_IN_REGISTER |
|
1098 | 183 |
|
78 | 184 |
# define BEGIN_INTERRUPTSBLOCKED /* */ |
185 |
# define END_INTERRUPTSBLOCKED /* */ |
|
1098 | 186 |
|
78 | 187 |
#else |
1098 | 188 |
|
78 | 189 |
# define BEGIN_INTERRUPTSBLOCKED \ |
190 |
{ \ |
|
1344 | 191 |
int needUnblock = 0; \ |
192 |
\ |
|
193 |
__BEGIN_PROTECT_REGISTERS__ \ |
|
194 |
if (!__interruptsBlocked) { \ |
|
195 |
__BLOCKINTERRUPTS(); \ |
|
196 |
needUnblock = 1; \ |
|
197 |
} |
|
78 | 198 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
199 |
# define END_INTERRUPTSBLOCKED_NOW \ |
1344 | 200 |
__END_PROTECT_REGISTERS__ \ |
201 |
if (needUnblock) { \ |
|
202 |
__UNBLOCKINTERRUPTS(); \ |
|
203 |
} \ |
|
78 | 204 |
} |
205 |
||
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
206 |
# define END_INTERRUPTSBLOCKED \ |
1344 | 207 |
__END_PROTECT_REGISTERS__ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
208 |
|
78 | 209 |
#endif |
1891 | 210 |
|
211 |
#ifdef __VMS__ |
|
1899 | 212 |
# include "vms_Xnames.h" |
1891 | 213 |
#endif |
214 |
||
1974 | 215 |
#ifdef LINUX |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
216 |
# define DEFAULT_XLIB_TIMEOUT 600 /* in 50ms ticks (30 seconds) */ |
1974 | 217 |
static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT; |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
218 |
# define ENTER_XLIB() \ |
1974 | 219 |
{ \ |
220 |
__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ |
|
221 |
__blockingPrimitiveTimeoutArg__ = (INT)self; \ |
|
222 |
__blockingPrimitiveTimeout__ = __xlibTimeout__; \ |
|
223 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
224 |
# define LEAVE_XLIB() \ |
1974 | 225 |
{ \ |
226 |
__blockingPrimitiveTimeout__ = 0; \ |
|
227 |
} |
|
228 |
#else |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
229 |
# define ENTER_XLIB() /* as nothing */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
230 |
# define LEAVE_XLIB() /* as nothing */ |
1974 | 231 |
#endif |
232 |
||
78 | 233 |
%} |
234 |
! ! |
|
235 |
||
236 |
!XWorkstation primitiveVariables! |
|
237 |
%{ |
|
0 | 238 |
/* |
146 | 239 |
* remembered info from private error handler |
0 | 240 |
*/ |
1974 | 241 |
static char lastErrorMsg[128] = ""; |
1888 | 242 |
static unsigned INT lastRequestCode = 0; |
243 |
static unsigned INT lastMinorCode = 0; |
|
244 |
static unsigned INT lastResource = 0; |
|
129 | 245 |
|
246 |
static int __debug__ = 0; |
|
247 |
#define DPRINTF(x) if (__debug__) { printf x; } |
|
78 | 248 |
%} |
249 |
! ! |
|
250 |
||
251 |
!XWorkstation primitiveFunctions! |
|
252 |
%{ |
|
1062 | 253 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
254 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
255 |
* some systems need a dummy reference to force the linker |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
256 |
* to include that stuff. Should be #ifdef'd ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
257 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
258 |
#ifndef ELF |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
259 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
260 |
# ifdef __GNUC__ |
1081 | 261 |
VOLATILE |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
262 |
# endif |
1081 | 263 |
static |
1062 | 264 |
dummyToForceLoading() { |
1344 | 265 |
XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
266 |
XCloseDisplay(0); |
|
267 |
XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
|
268 |
XSetWindowColormap(0, 0, 0); |
|
269 |
XQueryColors(0,0,0,0); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
270 |
# ifdef SHM |
1344 | 271 |
XShmAttach(0, 0); |
272 |
XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
|
273 |
XShmDetach(0, 0); |
|
274 |
XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
|
275 |
shmctl(0,0,0); |
|
276 |
fgetc(0); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
277 |
# endif |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
278 |
} |
1062 | 279 |
#endif |
280 |
||
18 | 281 |
/* |
144 | 282 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
283 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 284 |
* the implementation below is somewhat wrong: it will |
78 | 285 |
* report all errors for Display, even though there could be |
162 | 286 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
287 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 288 |
*/ |
1974 | 289 |
int |
12 | 290 |
__XErrorHandler__(dpy, event) |
0 | 291 |
Display *dpy; |
292 |
XErrorEvent *event; |
|
293 |
{ |
|
1974 | 294 |
XGetErrorText(dpy, event->error_code, lastErrorMsg, 127); |
295 |
lastErrorMsg[127] = '\0'; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
296 |
|
0 | 297 |
if (lastErrorMsg[0] == '\0') { |
1344 | 298 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 299 |
} |
2 | 300 |
lastRequestCode = event->request_code; |
301 |
lastMinorCode = event->minor_code; |
|
302 |
lastResource = event->resourceid; |
|
911 | 303 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
1344 | 304 |
/* |
305 |
* this is a BadWindow error for X_DestroyWindow. |
|
306 |
* ignore it here, since it results from the GC freeing windows |
|
307 |
* in non bottom-up window order. |
|
308 |
*/ |
|
309 |
return 0; |
|
911 | 310 |
} |
2 | 311 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
312 |
if (@global(ErrorPrinting) == true) { |
1753 | 313 |
fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n", |
1344 | 314 |
event->request_code, event->request_code, |
315 |
event->minor_code, event->minor_code, event->resourceid); |
|
1974 | 316 |
fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", |
317 |
event->error_code, lastErrorMsg); |
|
318 |
} |
|
319 |
||
1990 | 320 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy)); |
0 | 321 |
return 0; |
322 |
} |
|
323 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
324 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
325 |
* much like the above, but for IO Errors; |
1974 | 326 |
* forwarded as errorInterrupt:#DisplayIOError, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
327 |
* In single display apps, handling those here does not |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
328 |
* really make sense (except, for a controlled cleanup). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
329 |
* However, in multiDisplay apps, a single broken |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
330 |
* connection should not affect the other users. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
331 |
*/ |
1974 | 332 |
int |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
333 |
__XIOErrorHandler__(dpy) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
334 |
Display *dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
335 |
{ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
336 |
if (@global(ErrorPrinting) == true) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
337 |
fprintf(stderr, "XWorkstation [error]: I/O error\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
338 |
} |
1974 | 339 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError), |
340 |
__MKEXTERNALADDRESS(dpy)); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
341 |
__internalError("unhandled display I/O error"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
342 |
__terminateProcess(0); /* soft terminate */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
343 |
__terminateProcess(1); /* hard terminate */ |
1974 | 344 |
/* never reached */ |
345 |
return 0; |
|
346 |
} |
|
347 |
||
348 |
/* |
|
349 |
* timeout error in case of Xlib request timeout. |
|
350 |
* forwarded as errorInterrupt:#DisplayIOTimeoutError, |
|
351 |
* This is generated synthetically by the VM if the |
|
352 |
* timeoutHandler has been set. |
|
353 |
*/ |
|
354 |
void |
|
355 |
__XTimeoutErrorHandler(displayDeviceInst) |
|
356 |
OBJ displayDeviceInst; |
|
357 |
{ |
|
358 |
if (@global(ErrorPrinting) == true) { |
|
359 |
fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst); |
|
360 |
} |
|
2057
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
361 |
if (displayDeviceInst == @global(MainDisplay)) { |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
362 |
fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n"); |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
363 |
return; |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
364 |
} |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
365 |
|
1974 | 366 |
/* |
367 |
* must immediately flush that displays deviceID - otherwise, |
|
368 |
* the scheduler may try to ask for pending events without a watchdog |
|
369 |
* timer ... |
|
370 |
*/ |
|
1990 | 371 |
__OINST(displayDeviceInst, displayId) = nil; |
372 |
||
373 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst); |
|
1974 | 374 |
__internalError("unhandled display Timeout error"); |
1990 | 375 |
|
1974 | 376 |
__terminateProcess(0); /* soft terminate */ |
377 |
__terminateProcess(1); /* hard terminate */ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
378 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
379 |
|
90 | 380 |
#ifdef VIRTUAL_ROOT |
0 | 381 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
382 |
* added since RootWindow-macro is not sufficient |
18 | 383 |
* when virtual root-windows are involved (i.e. tvtwm) |
384 |
*/ |
|
385 |
static Window |
|
386 |
getRootWindow(dpy, screen) |
|
387 |
Display *dpy; |
|
388 |
{ |
|
389 |
Window root; |
|
390 |
Atom vRootAtom = None; |
|
391 |
int i; |
|
392 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
393 |
Window* children = (Window *)0; |
18 | 394 |
unsigned int numChildren; |
395 |
||
396 |
root = RootWindow(dpy, screen); |
|
397 |
/* |
|
398 |
* on IRIS, this creates a badwindow error - why ? |
|
399 |
* children contains a funny window (000034) |
|
400 |
*/ |
|
90 | 401 |
# if !defined(IRIS) || defined(IRIX5) |
1887 | 402 |
if (root) { |
1906 | 403 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
1887 | 404 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
405 |
if (vRootAtom != None) { |
|
1906 | 406 |
for (i=0; i < numChildren; i++) { |
1887 | 407 |
Atom actual_type; |
408 |
int actual_format; |
|
409 |
unsigned long nitems, bytesafter; |
|
410 |
Window* newRoot = (Window*) 0; |
|
411 |
||
412 |
if (children[i]) { |
|
1906 | 413 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
1887 | 414 |
0L, 1L, False, XA_WINDOW, |
415 |
&actual_type, &actual_format, &nitems, &bytesafter, |
|
416 |
(unsigned char**) &newRoot) == Success && newRoot) { |
|
417 |
root = *newRoot; |
|
418 |
XFree(newRoot); /* XXX */ |
|
419 |
break; |
|
1906 | 420 |
} |
1344 | 421 |
} |
1906 | 422 |
} |
1344 | 423 |
} |
1887 | 424 |
if (children) XFree( children ); |
425 |
} |
|
18 | 426 |
} |
90 | 427 |
# endif |
18 | 428 |
return root; |
429 |
} |
|
90 | 430 |
#endif |
0 | 431 |
%} |
78 | 432 |
! ! |
0 | 433 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
434 |
!XWorkstation class methodsFor:'documentation'! |
295 | 435 |
|
436 |
copyright |
|
437 |
" |
|
438 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1344 | 439 |
All Rights Reserved |
295 | 440 |
|
441 |
This software is furnished under a license and may be used |
|
442 |
only in accordance with the terms of that license and with the |
|
443 |
inclusion of the above copyright notice. This software may not |
|
444 |
be provided or otherwise made available to, or used by, any |
|
445 |
other person. No title to or ownership of the software is |
|
446 |
hereby transferred. |
|
447 |
" |
|
448 |
! |
|
449 |
||
450 |
documentation |
|
451 |
" |
|
452 |
this class provides the interface to X11. It redefines all required methods |
|
453 |
from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically |
|
454 |
limited to one display - in theory, you can create Views on many displays |
|
455 |
simultanously. However, the default setup is for one display only. |
|
456 |
To support multiple displays, you will have to start another event dispatcher |
|
457 |
process for the other display(s) and create the other views with a slightly |
|
458 |
different protocol. However, 'normal' applications do not have to care for |
|
459 |
all of this ... |
|
460 |
||
461 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 462 |
|
463 |
[author:] |
|
1344 | 464 |
Claus Gittinger |
295 | 465 |
" |
466 |
! ! |
|
467 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
468 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
469 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
470 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
471 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
472 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
473 |
super initialize. |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
474 |
|
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
475 |
ConservativeSync := OperatingSystem platformName == #win32. |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
476 |
|
386 | 477 |
RawKeysymTranslation isNil ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
478 |
"/ the following table maps X-keyevents to ST/X |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
479 |
"/ device independed events. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
480 |
"/ It is NOT meant as a keyboardMap replacement. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
481 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
482 |
RawKeysymTranslation := d := Dictionary new. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
483 |
d at:'Delete_line' put:#DeleteLine. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
484 |
d at:'Delete_word' put:#DeleteWord. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
485 |
d at:'Down' put:#CursorDown. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
486 |
d at:'Up' put:#CursorUp. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
487 |
d at:'Left' put:#CursorLeft. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
488 |
d at:'Right' put:#CursorRight. |
386 | 489 |
] |
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
490 |
|
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
491 |
"Modified: / 27.4.1999 / 17:21:30 / cg" |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
492 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
493 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
494 |
!XWorkstation class methodsFor:'error handling'! |
2 | 495 |
|
129 | 496 |
debug:aBoolean |
497 |
%{ /* NOCONTEXT */ |
|
498 |
||
499 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
500 |
%} |
|
501 |
! |
|
502 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
503 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
504 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
505 |
#ifdef COUNT_RESOURCES |
1404 | 506 |
printf("colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n", |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
507 |
__cnt_color, __cnt_bitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
508 |
__cnt_view, __cnt_gc, __cnt_cursor, __cnt_font); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
509 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
510 |
%} |
1404 | 511 |
|
512 |
" |
|
513 |
XWorkstation debugResources |
|
514 |
" |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
515 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
516 |
|
78 | 517 |
errorStringOfLastError |
518 |
%{ |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
519 |
RETURN ( __MKSTRING(lastErrorMsg) ); |
78 | 520 |
%} |
521 |
! |
|
522 |
||
135 | 523 |
lastErrorString |
2 | 524 |
"return the last X-error string - |
525 |
when buffering is on, this may be |
|
526 |
an error for a long-ago operation" |
|
78 | 527 |
|
528 |
|string requestCode s match line| |
|
529 |
||
530 |
string := self errorStringOfLastError. |
|
531 |
requestCode := self requestCodeOfLastError. |
|
532 |
" |
|
533 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
534 |
and append the name of the corresponding X-request |
|
535 |
" |
|
536 |
s := '/usr/lib/X11/XErrorDB' asFilename readStream. |
|
537 |
s notNil ifTrue:[ |
|
1344 | 538 |
match := 'XRequest.' , requestCode printString. |
539 |
line := s peekForLineStartingWith:match. |
|
540 |
line notNil ifTrue:[ |
|
541 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
542 |
]. |
|
543 |
s close. |
|
78 | 544 |
]. |
545 |
^ string |
|
295 | 546 |
! |
547 |
||
548 |
minorCodeOfLastError |
|
549 |
%{ /* NOCONTEXT */ |
|
550 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
551 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 552 |
%} |
553 |
! |
|
554 |
||
555 |
requestCodeOfLastError |
|
152 | 556 |
%{ /* NOCONTEXT */ |
557 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
558 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 559 |
%} |
135 | 560 |
! |
561 |
||
295 | 562 |
resourceIdOfLastError |
0 | 563 |
%{ /* NOCONTEXT */ |
295 | 564 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
565 |
RETURN ( __MKEXTERNALADDRESS(lastResource) ); |
0 | 566 |
%} |
567 |
! ! |
|
568 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
569 |
!XWorkstation class methodsFor:'queries'! |
104 | 570 |
|
571 |
platformName |
|
133 | 572 |
"ST-80 compatibility. |
2777 | 573 |
Return a string describing the display systems platform. |
574 |
WinWorkstation always returns 'X11'." |
|
133 | 575 |
|
715 | 576 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
577 |
||
578 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 579 |
! ! |
580 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
581 |
!XWorkstation methodsFor:'Signal constants'! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
582 |
|
1974 | 583 |
deviceIOTimeoutErrorSignal |
584 |
"return the per-device signal, which is raised when a timeout |
|
585 |
IO error (i.e. broken connection) occurs." |
|
586 |
||
587 |
^ deviceIOTimeoutErrorSignal |
|
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
588 |
! ! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
589 |
|
0 | 590 |
!XWorkstation methodsFor:'accessing & queries'! |
591 |
||
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
592 |
activateOnClick:aBoolean |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
593 |
"set/clear the activateOnClick behavior. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
594 |
If on, a click into a window raises and activates |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
595 |
the (top) window. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
596 |
Windows users typically enable this; |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
597 |
in contrast, those used to the X-Window system typically prefer |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
598 |
it disabled. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
599 |
Returns the previous setting." |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
600 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
601 |
|prev| |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
602 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
603 |
prev := activateOnClick. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
604 |
activateOnClick := aBoolean. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
605 |
^ prev |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
606 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
607 |
" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
608 |
Display class activateOnClick:true |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
609 |
Display class activateOnClick:false |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
610 |
" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
611 |
! |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
612 |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
613 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
614 |
"return the state-mask for any button in motion events' state-field. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
615 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
616 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
617 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
618 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
619 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
620 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
621 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
622 |
|
295 | 623 |
blackpixel |
624 |
"return the colornumber of black" |
|
625 |
||
626 |
^ blackpixel |
|
627 |
! |
|
628 |
||
629 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
630 |
"return the state-mask for button1 in motion events' state-field. |
295 | 631 |
For backward compatibility." |
632 |
||
633 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
634 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
295 | 635 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
636 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
637 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
638 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
639 |
" |
295 | 640 |
! |
641 |
||
642 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
643 |
"return the state-mask for button2 in motion events' state-field |
295 | 644 |
For backward compatibility." |
645 |
||
646 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
647 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 648 |
%} |
649 |
! |
|
650 |
||
651 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
652 |
"return the state-mask for button3 in motion events' state-field |
295 | 653 |
For backward compatibility." |
654 |
||
655 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
656 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 657 |
%} |
658 |
! |
|
659 |
||
660 |
buttonMotionMask:aButton |
|
661 |
"return the state-mask for button1 in motion events state-field. |
|
662 |
This is the devices mask." |
|
663 |
||
664 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
665 |
if (aButton == __MKSMALLINT(1)) { |
1344 | 666 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
667 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
668 |
if (aButton == __MKSMALLINT(2)) { |
1344 | 669 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
670 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
671 |
if (aButton == __MKSMALLINT(3)) { |
1344 | 672 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 673 |
} |
674 |
%}. |
|
675 |
^ nil |
|
676 |
! |
|
677 |
||
382 | 678 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
679 |
"return the state-mask for the CTRL modified in motion events' state-field." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
680 |
|
382 | 681 |
%{ /* NOCONTEXT */ |
682 |
RETURN (__MKSMALLINT(ControlMask)); |
|
683 |
%} |
|
684 |
! |
|
685 |
||
0 | 686 |
displayFileDescriptor |
687 |
"return the displays fileNumber - for select" |
|
688 |
||
689 |
%{ /* NOCONTEXT */ |
|
2231 | 690 |
#ifndef WIN32 |
150 | 691 |
if (ISCONNECTED) { |
1344 | 692 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 693 |
} |
2231 | 694 |
#endif |
150 | 695 |
RETURN (nil); |
0 | 696 |
%} |
697 |
! |
|
698 |
||
133 | 699 |
displayName |
700 |
"return the X-connections display name. |
|
701 |
This is (currently) nil for the default display, |
|
702 |
something like foo:0 for any other remote display. |
|
703 |
Future versions may return non-nil strings for the default display as well." |
|
704 |
||
705 |
^ displayName |
|
706 |
! |
|
707 |
||
341 | 708 |
protocolVersion |
709 |
"return the X-servers protocol version - should normally not be of |
|
710 |
any interest" |
|
711 |
||
712 |
%{ /* NOCONTEXT */ |
|
713 |
if (ISCONNECTED) { |
|
1344 | 714 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
341 | 715 |
} |
716 |
RETURN (nil); |
|
717 |
%} |
|
718 |
||
719 |
" |
|
720 |
Display protocolVersion |
|
721 |
" |
|
722 |
! |
|
723 |
||
724 |
serverVendor |
|
725 |
"return the X-server vendor string - this should normally not be of |
|
726 |
any interest, but can be for special cases |
|
727 |
(to avoid bugs in certain implementations)" |
|
728 |
%{ |
|
729 |
if (ISCONNECTED) { |
|
1344 | 730 |
RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
341 | 731 |
} |
732 |
RETURN (nil); |
|
733 |
%} |
|
734 |
||
735 |
" |
|
736 |
Display serverVendor |
|
737 |
" |
|
738 |
! |
|
739 |
||
382 | 740 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
741 |
"return the state-mask for the SHIFT modified in motion events' state-field." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
742 |
|
382 | 743 |
%{ /* NOCONTEXT */ |
744 |
RETURN (__MKSMALLINT(ShiftMask)); |
|
745 |
%} |
|
746 |
! |
|
747 |
||
341 | 748 |
translatePoint:aPoint from:windowId1 to:windowId2 |
749 |
"given a point in window1, return the coordinate in window2. |
|
750 |
This expects a device coordinate (relative to the first views origin) |
|
751 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
752 |
- use to xlate points from a window to rootwindow" |
|
753 |
||
754 |
|x1 y1 x2 y2| |
|
755 |
||
756 |
x1 := x2 := aPoint x truncated. |
|
757 |
y1 := y2 := aPoint y truncated. |
|
758 |
%{ |
|
759 |
int xpos, ypos; |
|
760 |
Window w1, w2, child_return; |
|
555 | 761 |
int screen = __intVal(__INST(screen)); |
1209 | 762 |
|
763 |
if (ISCONNECTED |
|
764 |
&& __isExternalAddress(windowId1) |
|
341 | 765 |
&& __isExternalAddress(windowId2) |
766 |
&& __bothSmallInteger(x1, y1)) { |
|
1344 | 767 |
Display *dpy = myDpy; |
1974 | 768 |
Window rootWin; |
1344 | 769 |
|
770 |
w1 = _WindowVal(windowId1); |
|
771 |
w2 = _WindowVal(windowId2); |
|
1974 | 772 |
|
341 | 773 |
#ifdef VIRTUAL_ROOT |
1974 | 774 |
rootWin = RootWindow(dpy, screen); |
775 |
if ((w1 == rootWin) || (w2 == rootWin)) { |
|
776 |
if (w1 == rootWin) { |
|
1344 | 777 |
w1 = getRootWindow(dpy, screen); |
778 |
} |
|
1974 | 779 |
if (w2 == rootWin) { |
1344 | 780 |
w2 = getRootWindow(dpy, screen); |
781 |
} |
|
782 |
} |
|
341 | 783 |
#endif |
1344 | 784 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 785 |
ENTER_XLIB(); |
1344 | 786 |
XTranslateCoordinates(dpy, w1, w2, |
787 |
__intVal(x1), __intVal(y1), |
|
788 |
&xpos, &ypos, &child_return); |
|
1974 | 789 |
LEAVE_XLIB(); |
1344 | 790 |
END_INTERRUPTSBLOCKED |
791 |
x2 = __MKSMALLINT(xpos); |
|
792 |
y2 = __MKSMALLINT(ypos); |
|
341 | 793 |
} |
794 |
%}. |
|
795 |
||
796 |
^ (x2 @ y2) |
|
797 |
! |
|
798 |
||
799 |
vendorRelease |
|
800 |
"return the X-servers vendor release - should normally not be of |
|
801 |
any interest, but can be for special cases. |
|
802 |
(to avoid bugs in certain implementations)" |
|
803 |
||
804 |
%{ /* NOCONTEXT */ |
|
805 |
if (ISCONNECTED) { |
|
1344 | 806 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
341 | 807 |
} |
808 |
RETURN (nil); |
|
809 |
%} |
|
810 |
||
811 |
" |
|
812 |
Display vendorRelease |
|
813 |
" |
|
814 |
! |
|
815 |
||
816 |
viewIdFromPoint:aPoint in:windowId |
|
817 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
818 |
hit by this coordinate. Return nil if no view was hit. |
|
819 |
The returned id may be the id of a non ST view. |
|
820 |
- used to find the window to drop objects after a cross-view drag." |
|
821 |
||
822 |
%{ /* NOCONTEXT */ |
|
823 |
||
555 | 824 |
int screen = __intVal(__INST(screen)); |
341 | 825 |
OBJ xp, yp; |
826 |
int xpos, ypos; |
|
827 |
Window child_return; |
|
828 |
||
1209 | 829 |
if (ISCONNECTED |
830 |
&& __isExternalAddress(windowId) |
|
341 | 831 |
&& __isPoint(aPoint)) { |
1344 | 832 |
Display *dpy = myDpy; |
833 |
||
834 |
xp = _point_X(aPoint); |
|
835 |
yp = _point_Y(aPoint); |
|
836 |
if (__bothSmallInteger(xp, yp)) { |
|
837 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 838 |
ENTER_XLIB(); |
1344 | 839 |
XTranslateCoordinates(dpy, |
840 |
RootWindow(dpy, screen), |
|
841 |
_WindowVal(windowId), |
|
842 |
__intVal(xp), __intVal(yp), |
|
843 |
&xpos, &ypos, &child_return); |
|
1974 | 844 |
LEAVE_XLIB(); |
1344 | 845 |
END_INTERRUPTSBLOCKED |
846 |
if (child_return) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
847 |
RETURN ( __MKEXTERNALADDRESS(child_return) ); |
1344 | 848 |
} |
849 |
RETURN ( nil ); |
|
850 |
} |
|
341 | 851 |
} |
852 |
%}. |
|
853 |
windowId notNil ifTrue:[ |
|
1344 | 854 |
aPoint isPoint ifTrue:[ |
855 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
856 |
] |
|
341 | 857 |
]. |
858 |
||
859 |
^ nil |
|
860 |
! |
|
861 |
||
862 |
virtualExtent |
|
863 |
"return the virtual extent of the display (in pixels). |
|
864 |
On most systems, this is the same as the physical width; |
|
865 |
except, if a window manager with a virtual desktop like olvwm |
|
866 |
(simulating a bigger screen) is running." |
|
867 |
||
868 |
%{ |
|
1209 | 869 |
if (ISCONNECTED |
870 |
&& (__INST(rootId) != __INST(virtualRootId)) |
|
555 | 871 |
&& __isExternalAddress(__INST(virtualRootId))) { |
1344 | 872 |
Window vRootWin; |
873 |
Window root; |
|
874 |
int x, y; |
|
875 |
unsigned int width, height; |
|
876 |
unsigned int dummy; |
|
1974 | 877 |
int ret; |
1344 | 878 |
|
879 |
vRootWin = _WindowVal(__INST(virtualRootId)); |
|
1974 | 880 |
ENTER_XLIB(); |
881 |
ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
|
882 |
&dummy, &dummy); |
|
883 |
LEAVE_XLIB(); |
|
884 |
if (ret) { |
|
1344 | 885 |
RETURN ( __MKPOINT_INT(width, height) ); |
886 |
} |
|
341 | 887 |
} |
888 |
%}. |
|
889 |
^ width @ height |
|
890 |
! |
|
891 |
||
892 |
whitepixel |
|
893 |
"return the colornumber of white" |
|
894 |
||
895 |
^ whitepixel |
|
896 |
! ! |
|
897 |
||
898 |
!XWorkstation methodsFor:'accessing display capabilities'! |
|
899 |
||
0 | 900 |
hasDPS |
186 | 901 |
"return true, if this workstation supports display postscript. |
902 |
Both the server must support it, and the feature must have been |
|
903 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 904 |
|
905 |
^ hasDPSExtension |
|
186 | 906 |
|
907 |
" |
|
908 |
Display hasDPS |
|
909 |
" |
|
910 |
! |
|
911 |
||
150 | 912 |
hasExtension:extensionString |
913 |
"query for an X extension. The argument, extensionString |
|
914 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 915 |
Return true, if that extension is available in the server. |
916 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 917 |
|
918 |
%{ |
|
919 |
int dummy; |
|
1974 | 920 |
OBJ rslt = false; |
150 | 921 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
922 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
923 |
&& __isNonNilObject(extensionString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
924 |
&& (__qIsString(extensionString) || __qIsSymbol(extensionString))) { |
1974 | 925 |
ENTER_XLIB(); |
1344 | 926 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
1974 | 927 |
rslt = true; |
928 |
} |
|
929 |
LEAVE_XLIB(); |
|
930 |
} |
|
931 |
RETURN (rslt); |
|
932 |
%} |
|
186 | 933 |
|
934 |
" |
|
935 |
Display hasExtension:'XVideo' |
|
936 |
Display hasExtension:'Input' |
|
937 |
Display hasExtension:'GLX' |
|
938 |
Display hasExtension:'X3D-PEX' |
|
939 |
Display hasExtension:'XInputExtension' |
|
940 |
Display hasExtension:'SHAPE' |
|
941 |
Display hasExtension:'MIT-SHM' |
|
942 |
Display hasExtension:'SGIFullScreenStereo' |
|
943 |
" |
|
150 | 944 |
! |
945 |
||
295 | 946 |
hasImageExtension |
947 |
"return true, if this workstation supports the X image extension. |
|
948 |
Both the server must support it, and the feature must have been |
|
949 |
enabled in the smalltalk system, for true to be returned." |
|
950 |
||
951 |
^ hasImageExtension |
|
952 |
||
953 |
" |
|
954 |
Display hasImageExtension |
|
955 |
" |
|
956 |
! |
|
957 |
||
958 |
hasInputExtension |
|
959 |
"return true, if this workstation supports the X input extension. |
|
960 |
Both the server must support it, and the feature must have been |
|
961 |
enabled in the smalltalk system, for true to be returned." |
|
962 |
||
963 |
^ hasInputExtension |
|
964 |
||
965 |
" |
|
966 |
Display hasInputExtension |
|
967 |
" |
|
968 |
! |
|
969 |
||
970 |
hasMultibuffer |
|
971 |
"return true, if this workstation supports the multibuffer extension. |
|
972 |
Both the server must support it, and the feature must have been |
|
973 |
enabled in the smalltalk system, for true to be returned." |
|
974 |
||
975 |
^ hasMbufExtension |
|
976 |
||
977 |
" |
|
978 |
Display hasMultibuffer |
|
979 |
" |
|
980 |
! |
|
981 |
||
982 |
hasPEX |
|
983 |
"return true, if this workstation supports PEX 3D graphics. |
|
984 |
Both the server must support it, and the feature must have been |
|
985 |
enabled in the smalltalk system, for true to be returned." |
|
986 |
||
987 |
^ hasPEXExtension |
|
988 |
||
989 |
" |
|
990 |
Display hasPEX |
|
991 |
" |
|
992 |
! |
|
993 |
||
994 |
hasShm |
|
995 |
"return true, if this workstation supports the shared pixmap extension. |
|
996 |
Both the server must support it, and the feature must have been |
|
997 |
enabled in the smalltalk system, for true to be returned." |
|
998 |
||
999 |
^ hasShmExtension |
|
1000 |
||
1001 |
" |
|
1002 |
Display hasShm |
|
1003 |
" |
|
1004 |
! |
|
1005 |
||
1006 |
hasXVideo |
|
1007 |
"return true, if this workstation supports the XVideo extension. |
|
1008 |
Both the server must support it, and the feature must have been |
|
1009 |
enabled in the smalltalk system, for true to be returned." |
|
1010 |
||
1011 |
^ hasXVideoExtension |
|
1012 |
||
1013 |
" |
|
1014 |
Display hasXVideo |
|
1015 |
" |
|
1016 |
! |
|
1017 |
||
1018 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
1019 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 1020 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 1021 |
|
1022 |
|xIconSizes count ret| |
|
1023 |
||
1024 |
%{ |
|
555 | 1025 |
int screen = __intVal(__INST(screen)); |
295 | 1026 |
XIconSize *sizeList; |
1027 |
int cnt; |
|
1028 |
||
1029 |
if (ISCONNECTED) { |
|
1344 | 1030 |
Display *dpy = myDpy; |
1974 | 1031 |
int status; |
1032 |
||
1033 |
ENTER_XLIB(); |
|
2541 | 1034 |
status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt); |
1974 | 1035 |
LEAVE_XLIB(); |
1036 |
if (status > 0) { |
|
1344 | 1037 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
1038 |
count = __MKSMALLINT(cnt); |
|
1039 |
} |
|
295 | 1040 |
} |
1041 |
%}. |
|
1042 |
xIconSizes isNil ifTrue:[^ nil]. |
|
1043 |
||
1044 |
ret := OrderedCollection new:count. |
|
1045 |
1 to:count do:[ :i | |
|
1344 | 1046 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 1047 |
|
1048 |
%{ |
|
1344 | 1049 |
XIconSize *slp; |
1050 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1051 |
slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1]; |
1344 | 1052 |
minWidth = __MKSMALLINT(slp->min_width); |
1053 |
minHeight = __MKSMALLINT(slp->min_height); |
|
1054 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
1055 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
1056 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
1057 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 1058 |
%}. |
1344 | 1059 |
d := IdentityDictionary new. |
1060 |
d at:#minWidth put:minWidth. |
|
1061 |
d at:#maxWidth put:maxWidth. |
|
1062 |
d at:#widthStep put:widthStep. |
|
1063 |
d at:#minHeight put:minHeight. |
|
1064 |
d at:#maxHeight put:maxHeight. |
|
1065 |
d at:#heightStep put:heightStep. |
|
1066 |
||
1067 |
ret add:d |
|
295 | 1068 |
]. |
1069 |
||
1070 |
xIconSizes free. |
|
1071 |
^ ret |
|
1072 |
||
1073 |
" |
|
819 | 1074 |
Display iconSizes |
295 | 1075 |
" |
1076 |
! |
|
1077 |
||
341 | 1078 |
ignoreBackingStore:aBoolean |
1079 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
1080 |
no backing store used - this can be used on servers where backing store is |
|
1081 |
very slow or is broken (can be put into display-rc-file)" |
|
1082 |
||
1083 |
ignoreBackingStore := aBoolean |
|
295 | 1084 |
! |
1085 |
||
823 | 1086 |
preferredIconSize |
1087 |
"return the displays preferred size for icons. |
|
1088 |
Redefined to return a special value on SGI servers." |
|
1089 |
||
1090 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
1344 | 1091 |
^ 86@68 |
823 | 1092 |
]. |
1093 |
^ super preferredIconSize |
|
1094 |
||
1095 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
1096 |
! |
|
1097 |
||
1025 | 1098 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1099 |
"return true, if this display asynchronously sends expose events after a |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1100 |
scroll operation. False otherwise. Asynchronous expose events are an X |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1101 |
speciality, which affects a few methods outside of the display class (sorry)" |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1102 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1103 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1104 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1105 |
|
43 | 1106 |
supportedImageFormats |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1107 |
"return an array with supported image formats; |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1108 |
each array entry is an attribute dictionary, consisting of |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1109 |
depth, bitsPerPixel and padding values." |
43 | 1110 |
|
150 | 1111 |
|nFormats "{ Class: SmallInteger }" |
1112 |
formatArray| |
|
43 | 1113 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1114 |
Display *dpy; |
150 | 1115 |
|
1116 |
if (! ISCONNECTED) { |
|
1344 | 1117 |
RETURN (nil); |
150 | 1118 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1119 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1120 |
dpy = myDpy; |
1898 | 1121 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1122 |
nFormats = __MKSMALLINT(1); |
1123 |
#else |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1124 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
1891 | 1125 |
#endif |
43 | 1126 |
%}. |
1127 |
formatArray := Array new:nFormats. |
|
150 | 1128 |
1 to:nFormats do:[:index | |
1344 | 1129 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
1130 |
||
1131 |
i := index. |
|
43 | 1132 |
%{ |
1344 | 1133 |
ScreenFormat *format; |
1134 |
Display *dpy = myDpy; |
|
1135 |
||
1898 | 1136 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1137 |
depthInfo = __MKSMALLINT(1); |
1138 |
bitsPerPixelInfo = __MKSMALLINT(1); |
|
1139 |
paddingInfo = __MKSMALLINT(8); |
|
1140 |
#else |
|
1344 | 1141 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
1142 |
format += (__intVal(i)-1); |
|
1143 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
|
1144 |
depthInfo = __MKSMALLINT(format->depth); |
|
1145 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
|
1891 | 1146 |
#endif |
43 | 1147 |
%}. |
1344 | 1148 |
info := IdentityDictionary new. |
1149 |
info at:#depth put:depthInfo. |
|
1150 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
|
1151 |
info at:#padding put:paddingInfo. |
|
1152 |
formatArray at:index put:info. |
|
43 | 1153 |
]. |
1154 |
^ formatArray |
|
1155 |
||
1156 |
" |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1157 |
Display supportedImageFormats |
43 | 1158 |
" |
1159 |
! |
|
1160 |
||
2635 | 1161 |
supportsAnyViewBackgroundPixmaps |
1162 |
"return true, if the device allows pixmaps as |
|
1163 |
viewBackground." |
|
1164 |
||
1165 |
^ true |
|
1166 |
||
1167 |
"Created: / 4.5.1999 / 18:41:07 / cg" |
|
1168 |
! |
|
1169 |
||
2745
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1170 |
supportsArbitraryShapedViews |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1171 |
"return true, if this workstation supports arbitrary shaped windows. |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1172 |
Both the server must support it (the shape-extension), |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1173 |
and the feature must have been enabled in the smalltalk system, |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1174 |
for true to be returned." |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1175 |
|
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1176 |
^ hasShapeExtension |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1177 |
|
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1178 |
" |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1179 |
Display supportsArbitraryShapedViews |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1180 |
" |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1181 |
! |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1182 |
|
2385 | 1183 |
supportsIconViews |
1184 |
"return true, if this device supports views as icons. |
|
1185 |
Only Xservers (currently) support this." |
|
1186 |
||
1187 |
^ true |
|
1188 |
||
1189 |
" |
|
1190 |
Display supportsIconViews |
|
1191 |
" |
|
1192 |
||
1193 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1194 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
1195 |
! |
|
1196 |
||
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1197 |
supportsMaskedDrawingWith:aForm |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1198 |
"return true, if the device allows the given form pixmap |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1199 |
to be used as paint color. |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1200 |
True returned here - X has no trouble with any mask." |
2330 | 1201 |
|
1202 |
^ true |
|
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1203 |
|
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1204 |
"Created: / 4.5.1999 / 12:16:43 / cg" |
2330 | 1205 |
! |
1206 |
||
2635 | 1207 |
supportsViewBackgroundPixmap:aForm |
1208 |
"return true, if the device allows the given pixmap as |
|
1209 |
viewBackground. |
|
1210 |
True returned here - X support any size." |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1211 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1212 |
^ true |
2635 | 1213 |
|
1214 |
"Created: / 4.5.1999 / 18:40:42 / cg" |
|
1215 |
"Modified: / 4.5.1999 / 18:44:25 / cg" |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1216 |
! |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1217 |
|
81 | 1218 |
supportsViewGravity |
1219 |
"return true, if this device supports gravity attributes. |
|
82 | 1220 |
We do not depend on it being implemented, but some resizing operations |
81 | 1221 |
are faster, it is is." |
1222 |
||
1223 |
^ true |
|
0 | 1224 |
! ! |
1225 |
||
1226 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1227 |
||
295 | 1228 |
createBitmapFromArray:anArray width:w height:h |
2896 | 1229 |
"create a monochrome, depth1 bitmap from a given (byte-)array. |
1230 |
The rows are aligned to a multiple of 8" |
|
1231 |
||
295 | 1232 |
|bitmapId| |
1233 |
||
1234 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1235 |
bitmapId isNil ifTrue:[ |
|
2896 | 1236 |
self primitiveFailed |
295 | 1237 |
]. |
1238 |
^ bitmapId |
|
1239 |
! |
|
1240 |
||
1241 |
createBitmapFromFile:aString for:aForm |
|
1242 |
|id w h| |
|
1243 |
||
1244 |
%{ |
|
555 | 1245 |
int screen = __intVal(__INST(screen)); |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1246 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1247 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1248 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1249 |
&& (__qIsString(aString) || __qIsSymbol(aString))) { |
1344 | 1250 |
Display *dpy = myDpy; |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1251 |
char *filename; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1252 |
int status; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1253 |
Pixmap newBitmap; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1254 |
unsigned b_width, b_height; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1255 |
int b_x_hot, b_y_hot; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1256 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1257 |
filename = (char *) __stringVal(aString); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1258 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1259 |
BEGIN_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1260 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1261 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1262 |
filename, &b_width, &b_height, &newBitmap, |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1263 |
&b_x_hot, &b_y_hot); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1264 |
LEAVE_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1265 |
END_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1266 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1267 |
if ((status == BitmapSuccess) && newBitmap) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1268 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1269 |
__cnt_bitmap++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1270 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1271 |
w = __MKSMALLINT(b_width); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1272 |
h = __MKSMALLINT(b_height); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1273 |
id = __MKEXTERNALADDRESS(newBitmap); |
1344 | 1274 |
} |
295 | 1275 |
} |
1276 |
%}. |
|
1277 |
id notNil ifTrue:[ |
|
1344 | 1278 |
aForm setWidth:w height:h |
295 | 1279 |
]. |
1280 |
^ id |
|
1281 |
! |
|
1282 |
||
1283 |
createBitmapWidth:w height:h |
|
1284 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1285 |
(i.e. random). Return a bitmap id or nil" |
|
1286 |
||
1287 |
%{ /* NOCONTEXT */ |
|
1288 |
||
555 | 1289 |
int screen = __intVal(__INST(screen)); |
295 | 1290 |
Pixmap newBitmap; |
1291 |
||
1292 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1344 | 1293 |
Display *dpy = myDpy; |
1294 |
||
1295 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1296 |
ENTER_XLIB(); |
1344 | 1297 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1298 |
__intVal(w), __intVal(h), 1); |
|
1974 | 1299 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1300 |
#ifdef COUNT_RESOURCES |
1344 | 1301 |
if (newBitmap) |
1302 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1303 |
#endif |
1344 | 1304 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1305 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
295 | 1306 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1307 |
%}. |
295 | 1308 |
self primitiveFailed. |
1309 |
^ nil |
|
1310 |
! |
|
1311 |
||
0 | 1312 |
createPixmapWidth:w height:h depth:d |
1313 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1314 |
(i.e. random). Return a bitmap id or nil" |
|
1315 |
||
1316 |
%{ /* NOCONTEXT */ |
|
1317 |
||
555 | 1318 |
int screen = __intVal(__INST(screen)); |
0 | 1319 |
Pixmap newBitmap; |
1320 |
||
150 | 1321 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1344 | 1322 |
Display *dpy = myDpy; |
1323 |
||
1324 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1325 |
ENTER_XLIB(); |
1344 | 1326 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1327 |
__intVal(w), __intVal(h), __intVal(d)); |
|
1974 | 1328 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1329 |
#ifdef COUNT_RESOURCES |
1344 | 1330 |
if (newBitmap) |
1331 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1332 |
#endif |
1344 | 1333 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1334 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1335 |
} |
1424 | 1336 |
%}. |
43 | 1337 |
self primitiveFailed. |
1338 |
^ nil |
|
0 | 1339 |
! |
1340 |
||
1468
9832c4017a70
added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
1341 |
createWindowFor:aView type:typeSymbol |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1342 |
origin:origin |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1343 |
extent:extent |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1344 |
minExtent:minExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1345 |
maxExtent:maxExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1346 |
borderWidth:bWidth |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1347 |
subViewOf:wsuperView |
1695
46d9101e4bee
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
1348 |
style:wStyle |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1349 |
inputOnly:winputOnly |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1350 |
label:wlabel |
1960 | 1351 |
owner:wowner |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1352 |
icon:wicon iconMask:wiconMask |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1353 |
iconView:wiconView |
46 | 1354 |
|
1355 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
|
1960 | 1356 |
bColorId wsuperViewId wiconId wiconMaskId windowId |
46 | 1357 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
150 | 1358 |
vBgForm deepForm preferredVisual preferredDepth| |
1359 |
||
1360 |
displayId isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1361 |
self primitiveFailed. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1362 |
^ nil |
150 | 1363 |
]. |
0 | 1364 |
|
46 | 1365 |
origin notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1366 |
xpos := origin x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1367 |
ypos := origin y. |
46 | 1368 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1369 |
xpos := ypos := 0. |
0 | 1370 |
]. |
46 | 1371 |
extent notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1372 |
wwidth := extent x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1373 |
wheight := extent y. |
46 | 1374 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1375 |
wwidth := wheight := 100. |
46 | 1376 |
]. |
1377 |
minExt notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1378 |
minWidth := minExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1379 |
minHeight := minExt y |
0 | 1380 |
]. |
46 | 1381 |
maxExt notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1382 |
maxWidth := maxExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1383 |
maxHeight := maxExt y |
46 | 1384 |
]. |
1385 |
||
0 | 1386 |
wsuperView notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1387 |
wsuperViewId := wsuperView id |
0 | 1388 |
]. |
1389 |
||
1390 |
wicon notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1391 |
wiconId := wicon id. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1392 |
wiconMask notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1393 |
wiconMaskId := wiconMask id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1394 |
] |
0 | 1395 |
]. |
1396 |
wiconView notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1397 |
wiconViewId := wiconView id |
0 | 1398 |
]. |
1399 |
weventMask := aView eventMask. |
|
1400 |
||
150 | 1401 |
preferredVisual := aView preferredVisual. |
1402 |
preferredDepth := aView preferredDepth. |
|
23 | 1403 |
|
1898 | 1404 |
%{ /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */ |
0 | 1405 |
Display *dpy = myDpy; |
555 | 1406 |
int screen = __intVal(__INST(screen)); |
0 | 1407 |
Visual visual; |
1408 |
XGCValues xgcv; |
|
1409 |
XSetWindowAttributes xswa; |
|
1410 |
XSizeHints sizehints; |
|
1411 |
XWMHints wmhints; |
|
46 | 1412 |
int bw, bd, bg; |
0 | 1413 |
Window newWindow, parentWindow; |
1414 |
char *windowName; |
|
1415 |
XFontStruct *f; |
|
1537 | 1416 |
Pixmap backPixmap = (Pixmap)0, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1417 |
iconBitmap = (Pixmap)0, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1418 |
iconMask = (Pixmap)0; |
0 | 1419 |
int flags = 0, depth, ioClass; |
1420 |
Window iconWindow; |
|
1421 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
1422 |
Atom WmQuitAppAtom; |
|
1423 |
Atom atoms[3]; |
|
1424 |
int atomCount = 0, isTopWindow = 0; |
|
1425 |
||
1426 |
sizehints.flags = 0; |
|
1427 |
sizehints.width = 100; |
|
1428 |
sizehints.height = 100; |
|
1429 |
sizehints.x = 0; |
|
1430 |
sizehints.y = 0; |
|
1431 |
||
97 | 1432 |
if (__bothSmallInteger(wwidth, wheight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1433 |
sizehints.flags |= PSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1434 |
sizehints.width = __intVal(wwidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1435 |
sizehints.height = __intVal(wheight); |
0 | 1436 |
} |
97 | 1437 |
if (__bothSmallInteger(xpos, ypos)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1438 |
sizehints.flags |= PPosition; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1439 |
sizehints.x = __intVal(xpos); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1440 |
sizehints.y = __intVal(ypos); |
0 | 1441 |
} |
97 | 1442 |
if (__bothSmallInteger(minWidth, minHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1443 |
sizehints.flags |= PMinSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1444 |
sizehints.min_width = __intVal(minWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1445 |
sizehints.min_height = __intVal(minHeight); |
0 | 1446 |
} |
97 | 1447 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1448 |
sizehints.flags |= PMaxSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1449 |
sizehints.max_width = __intVal(maxWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1450 |
sizehints.max_height = __intVal(maxHeight); |
0 | 1451 |
} |
1452 |
||
37 | 1453 |
bg = WhitePixel(dpy, screen); |
0 | 1454 |
|
97 | 1455 |
if (__isSmallInteger(bWidth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1456 |
bw = __intVal(bWidth); |
46 | 1457 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1458 |
bw = 0; |
0 | 1459 |
} |
1460 |
||
72 | 1461 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1462 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1463 |
if (__isExternalAddress(wsuperViewId)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1464 |
parentWindow = _WindowVal(wsuperViewId); |
0 | 1465 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1466 |
parentWindow = RootWindow(dpy, screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1467 |
isTopWindow = 1; |
0 | 1468 |
} |
1469 |
||
1695
46d9101e4bee
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
1470 |
if (wStyle == @symbol(popUp)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1471 |
xswa.override_redirect = 1; |
0 | 1472 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1473 |
xswa.override_redirect = 0; |
0 | 1474 |
|
1475 |
if (winputOnly == true) |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1476 |
ioClass = InputOnly; |
0 | 1477 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1478 |
ioClass = InputOutput; |
0 | 1479 |
|
97 | 1480 |
if (__isSmallInteger(weventMask)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1481 |
xswa.event_mask = __intVal(weventMask); |
0 | 1482 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1483 |
xswa.event_mask = 0; |
0 | 1484 |
} |
1485 |
||
1486 |
if (ioClass == InputOnly) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1487 |
bw = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1488 |
depth = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1489 |
flags |= CWEventMask; |
0 | 1490 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1491 |
depth = DefaultDepth(dpy,screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1492 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1493 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1494 |
if (backPixmap != (Pixmap)0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1495 |
xswa.background_pixmap = backPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1496 |
flags |= CWBackPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1497 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1498 |
xswa.background_pixel = bg; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1499 |
flags |= CWBackPixel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1500 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1501 |
xswa.border_pixel = bd; |
0 | 1502 |
} |
23 | 1503 |
|
0 | 1504 |
visual.visualid = CopyFromParent; |
150 | 1505 |
if (__isSmallInteger(preferredDepth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1506 |
depth = __intVal(preferredDepth); |
23 | 1507 |
} |
54 | 1508 |
|
1509 |
BEGIN_INTERRUPTSBLOCKED |
|
150 | 1510 |
if (preferredVisual != nil) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1511 |
XVisualInfo vi; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1512 |
int cls; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1513 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1514 |
if (preferredVisual == @symbol(StaticGray)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1515 |
cls = StaticGray; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1516 |
else if (preferredVisual == @symbol(GrayScale)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1517 |
cls = GrayScale; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1518 |
else if (preferredVisual == @symbol(StaticColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1519 |
cls = StaticColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1520 |
else if (preferredVisual == @symbol(PseudoColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1521 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1522 |
else if (preferredVisual == @symbol(TrueColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1523 |
cls = TrueColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1524 |
else if (preferredVisual == @symbol(DirectColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1525 |
cls = DirectColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1526 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1527 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1528 |
|
1974 | 1529 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1530 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1531 |
visual.visualid = vi.visualid; |
163 | 1532 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1533 |
printf("visualId=%x\n", vi.visualid); |
163 | 1534 |
*/ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1535 |
} |
1974 | 1536 |
LEAVE_XLIB(); |
1537 |
} |
|
1538 |
||
1539 |
ENTER_XLIB(); |
|
0 | 1540 |
newWindow = XCreateWindow(dpy, parentWindow, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1541 |
sizehints.x, sizehints.y, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1542 |
sizehints.width, sizehints.height, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1543 |
bw, depth, ioClass, &visual, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1544 |
flags, &xswa); |
1974 | 1545 |
LEAVE_XLIB(); |
54 | 1546 |
END_INTERRUPTSBLOCKED |
0 | 1547 |
|
1548 |
if (! newWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1549 |
RETURN ( nil ); |
0 | 1550 |
} |
1551 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1552 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1553 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1554 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1555 |
|
54 | 1556 |
BEGIN_INTERRUPTSBLOCKED |
0 | 1557 |
|
1558 |
/* |
|
1559 |
* define its icon and name |
|
1560 |
* (only makes sense for topWindows) |
|
1561 |
*/ |
|
1562 |
if (isTopWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1563 |
if (__isExternalAddress(wiconId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1564 |
iconBitmap = _PixmapVal(wiconId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1565 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1566 |
iconBitmap = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1567 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1568 |
if (__isExternalAddress(wiconMaskId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1569 |
iconMask = _PixmapVal(wiconMaskId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1570 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1571 |
iconMask = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1572 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1573 |
if (__isExternalAddress(wiconViewId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1574 |
iconWindow = _WindowVal(wiconViewId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1575 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1576 |
iconWindow = (Window)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1577 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1578 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
1831 | 1579 |
windowName = (char *) __stringVal(wlabel); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1580 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1581 |
windowName = ""; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1582 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1583 |
if (iconBitmap || windowName) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1584 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1585 |
XSetStandardProperties(dpy, newWindow, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1586 |
windowName, windowName, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1587 |
iconBitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1588 |
0, 0, &sizehints); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1589 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1590 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1591 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1592 |
wmhints.flags = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1593 |
if (iconBitmap) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1594 |
wmhints.flags |= IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1595 |
wmhints.icon_pixmap = iconBitmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1596 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1597 |
if (iconMask) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1598 |
wmhints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1599 |
wmhints.icon_mask = iconMask; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1600 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1601 |
if (iconWindow) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1602 |
wmhints.flags |= IconWindowHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1603 |
wmhints.icon_window = iconWindow; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1604 |
} |
0 | 1605 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1606 |
wmhints.flags |= InputHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1607 |
wmhints.input = True; |
0 | 1608 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1609 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1610 |
XSetWMHints(dpy, newWindow, &wmhints); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1611 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1612 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1613 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1614 |
* tell window manager to not kill us but send an event instead |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1615 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1616 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1617 |
* get atoms first (if not already known) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1618 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1619 |
if (__INST(protocolsAtom) == nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1620 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1621 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1622 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
0 | 1623 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1624 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1625 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
0 | 1626 |
#endif |
1627 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1628 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1629 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
0 | 1630 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1631 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1632 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1633 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1634 |
} else { |
0 | 1635 |
#ifdef USE_QUIT_APP_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1636 |
WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); |
0 | 1637 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1638 |
WmQuitAppAtom = 0; |
0 | 1639 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1640 |
WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1641 |
WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); |
0 | 1642 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1643 |
WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); |
0 | 1644 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1645 |
WmSaveYourselfAtom = 0; |
0 | 1646 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1647 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1648 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1649 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
0 | 1650 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1651 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1652 |
#endif |
1653 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1654 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1655 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1656 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1657 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1658 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1659 |
LEAVE_XLIB(); |
0 | 1660 |
} |
1661 |
||
54 | 1662 |
END_INTERRUPTSBLOCKED |
1663 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1664 |
windowId = __MKEXTERNALADDRESS(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1665 |
%}. |
0 | 1666 |
self addKnownView:aView withId:windowId. |
1667 |
^ windowId |
|
1668 |
! |
|
1669 |
||
1670 |
destroyGC:aGCId |
|
1671 |
||
1672 |
%{ /* NOCONTEXT */ |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1673 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1674 |
if (! ISCONNECTED) { |
1344 | 1675 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1676 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1677 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1678 |
if (__isExternalAddress(aGCId)) { |
1344 | 1679 |
GC gc = _GCVal(aGCId); |
1680 |
||
1681 |
if (gc) { |
|
1682 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1683 |
ENTER_XLIB(); |
1344 | 1684 |
XFreeGC(myDpy, gc); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1685 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1686 |
#ifdef COUNT_RESOURCES |
1344 | 1687 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1688 |
#endif |
1344 | 1689 |
END_INTERRUPTSBLOCKED |
1690 |
} |
|
1691 |
RETURN ( self ); |
|
0 | 1692 |
} |
118 | 1693 |
%}. |
0 | 1694 |
self primitiveFailed |
1695 |
! |
|
1696 |
||
295 | 1697 |
destroyPixmap:aDrawableId |
0 | 1698 |
|
1699 |
%{ /* NOCONTEXT */ |
|
1700 |
||
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1701 |
if (! ISCONNECTED) { |
1344 | 1702 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1703 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1704 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1705 |
if (__isExternalAddress(aDrawableId)) { |
1344 | 1706 |
Pixmap pix = _PixmapVal(aDrawableId); |
1707 |
||
1708 |
if (pix) { |
|
1709 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1710 |
ENTER_XLIB(); |
1344 | 1711 |
XFreePixmap(myDpy, pix); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1712 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1713 |
#ifdef COUNT_RESOURCES |
1344 | 1714 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1715 |
#endif |
1344 | 1716 |
END_INTERRUPTSBLOCKED |
1717 |
} |
|
1718 |
RETURN ( self ); |
|
0 | 1719 |
} |
118 | 1720 |
%}. |
295 | 1721 |
self primitiveFailed |
1722 |
! |
|
1723 |
||
1724 |
destroyView:aView withId:aWindowId |
|
1725 |
%{ |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1726 |
if (! ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1727 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1728 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1729 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1730 |
if (__isExternalAddress(aWindowId)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1731 |
Window win = _WindowVal(aWindowId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1732 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1733 |
if (win) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1734 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1735 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1736 |
XDestroyWindow(myDpy, win); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1737 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1738 |
#ifdef COUNT_RESOURCES |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1739 |
__cnt_view--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1740 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1741 |
END_INTERRUPTSBLOCKED |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1742 |
} |
295 | 1743 |
} |
1744 |
%}. |
|
1480
7fd8dff4cfc3
pass view + id to removeKnownView
Claus Gittinger <cg@exept.de>
parents:
1468
diff
changeset
|
1745 |
self removeKnownView:aView withId:aWindowId |
0 | 1746 |
! |
1747 |
||
1748 |
dpsContextFor:aDrawableId and:aGCId |
|
1749 |
||
1750 |
%{ /* NOCONTEXT */ |
|
1751 |
#ifdef XXDPS |
|
555 | 1752 |
int screen = __intVal(__INST(screen)); |
0 | 1753 |
DPSContext dps; |
1754 |
int height; |
|
1755 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1756 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1757 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1758 |
&& ISCONNECTED) { |
1344 | 1759 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1760 |
ENTER_XLIB(); |
1344 | 1761 |
dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
1762 |
_GCVal(aGCId), |
|
1763 |
0, height, 0, colormap, NULL, 0, |
|
1764 |
XDPSDefaultTextBackstop, |
|
1765 |
XDPSDefaultErrorProc, |
|
1766 |
NULL); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1767 |
LEAVE_XLIB(); |
1344 | 1768 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1769 |
RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); |
0 | 1770 |
} |
1771 |
#endif |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1772 |
%}. |
43 | 1773 |
self primitiveFailed. |
1774 |
^ nil |
|
295 | 1775 |
! |
1776 |
||
1777 |
gcFor:aDrawableId |
|
132 | 1778 |
|
1779 |
%{ /* NOCONTEXT */ |
|
555 | 1780 |
int screen = __intVal(__INST(screen)); |
295 | 1781 |
GC gc; |
1782 |
||
1783 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
1344 | 1784 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1785 |
ENTER_XLIB(); |
1344 | 1786 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1787 |
0L, (XGCValues *)0); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1788 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1789 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1790 |
#ifdef COUNT_RESOURCES |
1344 | 1791 |
if (gc) |
1792 |
__cnt_gc++; |
|
1089 | 1793 |
#endif |
1794 |
||
1344 | 1795 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1796 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1797 |
} |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1798 |
%}. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1799 |
self primitiveFailed. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1800 |
^ nil |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1801 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1802 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1803 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1804 |
"with X, this is the same as a normal gc" |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1805 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1806 |
%{ /* NOCONTEXT */ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1807 |
int screen = __intVal(__INST(screen)); |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1808 |
GC gc; |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1809 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1810 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
1344 | 1811 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1812 |
ENTER_XLIB(); |
1344 | 1813 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1814 |
0L, (XGCValues *)0); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1815 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1816 |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1817 |
#ifdef COUNT_RESOURCES |
1344 | 1818 |
if (gc) |
1819 |
__cnt_gc++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1820 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1821 |
|
1344 | 1822 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1823 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
200 | 1824 |
} |
1825 |
%}. |
|
1826 |
^ nil |
|
295 | 1827 |
! |
1828 |
||
1829 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 1830 |
|
1831 |
%{ /* UNLIMITEDSTACK */ |
|
1832 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1833 |
Display *dpy; |
555 | 1834 |
int screen = __intVal(__INST(screen)); |
295 | 1835 |
Pixmap newBitmap; |
1836 |
unsigned int b_width, b_height; |
|
1837 |
REGISTER unsigned char *cp; |
|
1838 |
REGISTER unsigned char *pBits; |
|
1839 |
unsigned char *b_bits, *allocatedBits; |
|
1840 |
int index, row; |
|
1841 |
REGISTER int col; |
|
1842 |
unsigned bits; |
|
1843 |
static char reverseBitTable[256]; |
|
1844 |
static firstCall = 1; |
|
1845 |
int nBytes; |
|
1846 |
unsigned char fastBits[10000]; |
|
1847 |
OBJ num, *op; |
|
1848 |
int bytesPerRow; |
|
1849 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1850 |
if (! ISCONNECTED) { |
1344 | 1851 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1852 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1853 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1854 |
dpy = myDpy; |
295 | 1855 |
if (firstCall) { |
1344 | 1856 |
for (index=0; index < 256; index++) { |
1857 |
reverseBitTable[index] = 0; |
|
1858 |
if (index & 128) reverseBitTable[index] |= 1; |
|
1859 |
if (index & 64) reverseBitTable[index] |= 2; |
|
1860 |
if (index & 32) reverseBitTable[index] |= 4; |
|
1861 |
if (index & 16) reverseBitTable[index] |= 8; |
|
1862 |
if (index & 8) reverseBitTable[index] |= 16; |
|
1863 |
if (index & 4) reverseBitTable[index] |= 32; |
|
1864 |
if (index & 2) reverseBitTable[index] |= 64; |
|
1865 |
if (index & 1) reverseBitTable[index] |= 128; |
|
1866 |
} |
|
1867 |
firstCall = 0; |
|
295 | 1868 |
} |
1869 |
||
1870 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
1344 | 1871 |
newBitmap = (Pixmap)0; |
1872 |
b_width = __intVal(w); |
|
1873 |
b_height = __intVal(h); |
|
1874 |
bytesPerRow = (b_width + 7) / 8; |
|
1875 |
nBytes = b_height * bytesPerRow; |
|
1876 |
if (nBytes < sizeof(fastBits)) { |
|
1877 |
cp = b_bits = fastBits; |
|
1878 |
allocatedBits = 0; |
|
1879 |
} else { |
|
1880 |
cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
|
1881 |
if (! cp) goto fail; |
|
1882 |
} |
|
1883 |
||
1884 |
if (__qClass(anArray) == @global(Array)) { |
|
1885 |
index = 1; |
|
1886 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
|
1887 |
for (row = b_height; row; row--) { |
|
1888 |
for (col = bytesPerRow; col; col--) { |
|
1889 |
num = *op++; |
|
2791 | 1890 |
if (__isSmallInteger(num)) { |
1891 |
bits = __intVal(num); |
|
1892 |
} else { |
|
1893 |
bits = __longIntVal(num); |
|
1894 |
if (bits == 0) { |
|
1895 |
goto fail; |
|
1896 |
} |
|
1897 |
} |
|
1898 |
*cp++ = reverseBitTable[bits & 0xFF]; |
|
1344 | 1899 |
} |
1900 |
} |
|
1901 |
} else { |
|
1902 |
if (__qClass(anArray) == @global(ByteArray)) { |
|
1903 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
|
1904 |
for (col = b_height*bytesPerRow; col; col--) { |
|
1905 |
*cp++ = reverseBitTable[*pBits++]; |
|
1906 |
} |
|
1907 |
} else { |
|
1908 |
goto fail; |
|
1909 |
} |
|
1910 |
} |
|
1911 |
||
1912 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1913 |
ENTER_XLIB(); |
1344 | 1914 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
1915 |
(char *)b_bits, |
|
1916 |
b_width, b_height); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1917 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1918 |
#ifdef COUNT_RESOURCES |
1344 | 1919 |
if (newBitmap) |
1920 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1921 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1922 |
|
1344 | 1923 |
END_INTERRUPTSBLOCKED |
295 | 1924 |
fail: ; |
1344 | 1925 |
if (allocatedBits) |
1926 |
free(allocatedBits); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1927 |
RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1928 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1929 |
%}. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1930 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1931 |
^ nil |
295 | 1932 |
! |
1933 |
||
1934 |
realRootWindowId |
|
1935 |
"return the id of the real root window. |
|
1936 |
This may not be the window you see as background, |
|
1937 |
since some window managers install a virtual root window on top |
|
1938 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
1939 |
care of any virtual root." |
|
0 | 1940 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
1941 |
%{ |
555 | 1942 |
int screen = __intVal(__INST(screen)); |
295 | 1943 |
Window root; |
1944 |
OBJ id; |
|
1945 |
||
555 | 1946 |
if (__INST(rootId) != nil) { |
1344 | 1947 |
RETURN (__INST(rootId)); |
295 | 1948 |
} |
0 | 1949 |
|
150 | 1950 |
if (ISCONNECTED) { |
1344 | 1951 |
root = RootWindow(myDpy, screen); |
1952 |
if (! root) { |
|
1953 |
id = nil; |
|
1954 |
} else { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1955 |
__INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id); |
1344 | 1956 |
} |
1957 |
RETURN (id); |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1958 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1959 |
%}. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1960 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1961 |
^ nil |
295 | 1962 |
! |
1963 |
||
1964 |
rootWindowId |
|
1965 |
"return the id of the root window. |
|
1966 |
This is the window you see as background, |
|
1967 |
however, it may or may not be the real physical root window, |
|
1968 |
since some window managers install a virtual root window on top |
|
1969 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 1970 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
1971 |
%{ |
555 | 1972 |
int screen = __intVal(__INST(screen)); |
295 | 1973 |
Window rootWin, vRootWin; |
1974 |
OBJ id; |
|
1975 |
||
555 | 1976 |
if (__INST(virtualRootId) != nil) { |
1344 | 1977 |
RETURN (__INST(virtualRootId)); |
295 | 1978 |
} |
0 | 1979 |
|
169 | 1980 |
if (ISCONNECTED) { |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
1981 |
Display *dpy = myDpy; |
2541 | 1982 |
|
1983 |
vRootWin = rootWin = RootWindow(dpy, screen); |
|
295 | 1984 |
#ifndef IRIS |
1344 | 1985 |
BEGIN_INTERRUPTSBLOCKED |
1986 |
/* |
|
1987 |
* on IRIS, this creates a badwindow error - why ? |
|
1988 |
* children contains a funny window (000034) |
|
1989 |
*/ |
|
1990 |
||
1991 |
/* |
|
1992 |
* care for virtual root windows (tvtwm & friends) |
|
1993 |
*/ |
|
1994 |
{ |
|
1995 |
Atom vRootAtom = None; |
|
1996 |
int i; |
|
1997 |
Window rootReturn, parentReturn; |
|
1998 |
Window* children = (Window *)0; |
|
1999 |
unsigned int numChildren; |
|
2000 |
||
2541 | 2001 |
if (XQueryTree(dpy, rootWin, |
1344 | 2002 |
&rootReturn, &parentReturn, |
2003 |
&children, &numChildren)) { |
|
2541 | 2004 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
1344 | 2005 |
if (vRootAtom != None) { |
2006 |
for (i=0; i < numChildren; i++) { |
|
2007 |
Atom actual_type; |
|
2008 |
int actual_format; |
|
2009 |
unsigned long nitems, bytesafter; |
|
2010 |
Window* newRoot = (Window*) 0; |
|
2011 |
||
2012 |
if (children[i]) { |
|
2541 | 2013 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
2014 |
0L, 1L, False, XA_WINDOW, |
|
2015 |
&actual_type, &actual_format, |
|
2016 |
&nitems, &bytesafter, |
|
2017 |
(unsigned char**) &newRoot |
|
2018 |
) == Success && newRoot) { |
|
1344 | 2019 |
vRootWin = *newRoot; |
2020 |
XFree(newRoot); /* XXX */ |
|
2021 |
break; |
|
2022 |
} |
|
2023 |
} |
|
2024 |
} |
|
2025 |
} |
|
2026 |
if (children) XFree( children ); |
|
2027 |
} |
|
2028 |
} |
|
2029 |
END_INTERRUPTSBLOCKED |
|
295 | 2030 |
#endif |
2031 |
} |
|
2032 |
||
2033 |
/* cannot happen */ |
|
2034 |
if (! vRootWin) { |
|
1344 | 2035 |
vRootWin = rootWin; |
2036 |
if (! rootWin) { |
|
2037 |
RETURN ( nil ); |
|
2038 |
} |
|
295 | 2039 |
} |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2040 |
__INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2041 |
__INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id); |
295 | 2042 |
RETURN ( id ); |
63 | 2043 |
%} |
0 | 2044 |
! ! |
2045 |
||
2046 |
!XWorkstation methodsFor:'color stuff'! |
|
2047 |
||
295 | 2048 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2049 |
"allocate a color cell - return the color index (i.e. colorID). |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2050 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2051 |
|
2052 |
%{ /* NOCONTEXT */ |
|
2053 |
||
555 | 2054 |
int screen = __intVal(__INST(screen)); |
295 | 2055 |
XColor color; |
2056 |
unsigned long dummy; |
|
2057 |
Status ok; |
|
2058 |
||
1209 | 2059 |
if (ISCONNECTED) { |
1344 | 2060 |
Display *dpy = myDpy; |
2061 |
||
2062 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2063 |
ENTER_XLIB(); |
1344 | 2064 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
2065 |
&dummy, 0, &color.pixel, 1); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2066 |
LEAVE_XLIB(); |
1344 | 2067 |
END_INTERRUPTSBLOCKED |
2068 |
if (ok) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2069 |
#ifdef COUNT_RESOURCES |
1344 | 2070 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2071 |
#endif |
1344 | 2072 |
RETURN ( __MKSMALLINT(color.pixel) ); |
2073 |
} |
|
0 | 2074 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2075 |
%}. |
43 | 2076 |
^ nil |
0 | 2077 |
! |
2078 |
||
2079 |
colorNamed:aString |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2080 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 2081 |
Dont use this method, colornames are mostly X specific" |
2082 |
||
2083 |
%{ /* NOCONTEXT */ |
|
2084 |
||
2085 |
char *colorname; |
|
2086 |
XColor scolor, ecolor; |
|
555 | 2087 |
int screen = __intVal(__INST(screen)); |
850 | 2088 |
int id; |
54 | 2089 |
Status ok; |
0 | 2090 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2091 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2092 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2093 |
&& (__qIsString(aString) || __qIsSymbol(aString))) { |
1344 | 2094 |
Display *dpy = myDpy; |
2095 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2096 |
colorname = (char *) __stringVal(aString); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2097 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2098 |
BEGIN_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2099 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2100 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2101 |
LEAVE_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2102 |
if (ok) { |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
2103 |
#ifdef QUICK_TRUE_COLORS |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2104 |
if (__INST(visualType) == @symbol(TrueColor)) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2105 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2106 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2107 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2108 |
RETURN ( __MKSMALLINT(id) ); |
1344 | 2109 |
} |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2110 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2111 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2112 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2113 |
LEAVE_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2114 |
} |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2115 |
END_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2116 |
if (! ok) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2117 |
RETURN ( nil ); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2118 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2119 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2120 |
__cnt_color++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2121 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2122 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
0 | 2123 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2124 |
%}. |
43 | 2125 |
self primitiveFailed. |
2126 |
^ nil |
|
0 | 2127 |
! |
2128 |
||
295 | 2129 |
colorRed:redVal green:greenVal blue:blueVal |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2130 |
"allocate a color with rgb values (0..100) - return the color index (i.e. colorID). |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2131 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
295 | 2132 |
|
2133 |
|r g b| |
|
2134 |
||
2135 |
r := self percentToXColorValue:redVal. |
|
2136 |
g := self percentToXColorValue:greenVal. |
|
2137 |
b := self percentToXColorValue:blueVal. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2138 |
^ self colorScaledRed:r scaledGreen:g scaledBlue:b |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2139 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2140 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2141 |
colorScaledRed:r scaledGreen:g scaledBlue:b |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2142 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
295 | 2143 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2144 |
Display *dpy; |
295 | 2145 |
XColor ecolor; |
555 | 2146 |
int screen = __intVal(__INST(screen)); |
295 | 2147 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2148 |
int id; |
295 | 2149 |
|
2150 |
if (__bothSmallInteger(r, g) |
|
2151 |
&& __isSmallInteger(b) |
|
2152 |
&& ISCONNECTED) { |
|
1344 | 2153 |
ecolor.red = __intVal(r); |
2154 |
ecolor.green= __intVal(g); |
|
2155 |
ecolor.blue = __intVal(b); |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2156 |
#ifdef QUICK_TRUE_COLORS |
1344 | 2157 |
if (__INST(visualType) == @symbol(TrueColor)) { |
2158 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
2159 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
2160 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
2161 |
RETURN ( __MKSMALLINT(id) ); |
|
2162 |
} |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2163 |
#endif |
1344 | 2164 |
dpy = myDpy; |
2165 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2166 |
ENTER_XLIB(); |
1344 | 2167 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2168 |
LEAVE_XLIB(); |
1344 | 2169 |
END_INTERRUPTSBLOCKED |
2170 |
if (! ok) { |
|
2171 |
RETURN ( nil ); |
|
2172 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2173 |
#ifdef COUNT_RESOURCES |
1344 | 2174 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2175 |
#endif |
1344 | 2176 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
295 | 2177 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2178 |
%}. |
295 | 2179 |
self primitiveFailed. |
2180 |
^ nil |
|
2181 |
! |
|
2182 |
||
2183 |
freeColor:colorIndex |
|
2184 |
"free a display color when its no longer needed" |
|
0 | 2185 |
|
2186 |
%{ /* NOCONTEXT */ |
|
2187 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2188 |
Display *dpy; |
295 | 2189 |
unsigned long color; |
555 | 2190 |
int screen = __intVal(__INST(screen)); |
295 | 2191 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2192 |
#ifdef QUICK_TRUE_COLORS |
555 | 2193 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1344 | 2194 |
/* no need to do anything on TrueColor displays ... */ |
2195 |
RETURN (self); |
|
295 | 2196 |
} |
2197 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2198 |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2199 |
if (! ISCONNECTED) { |
1344 | 2200 |
RETURN (self); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2201 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2202 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2203 |
if (__isSmallInteger(colorIndex)) { |
1344 | 2204 |
dpy = myDpy; |
2205 |
color = (long) __intVal(colorIndex); |
|
2206 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2207 |
ENTER_XLIB(); |
1344 | 2208 |
XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2209 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2210 |
#ifdef COUNT_RESOURCES |
1344 | 2211 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2212 |
#endif |
1344 | 2213 |
END_INTERRUPTSBLOCKED |
2214 |
RETURN ( self ); |
|
0 | 2215 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2216 |
%}. |
295 | 2217 |
self primitiveFailed |
2218 |
! |
|
2219 |
||
2220 |
getRGBFrom:index into:aBlock |
|
2221 |
"get rgb components (0..100) of color in map at:index, |
|
2222 |
and evaluate the 3-arg block, aBlock with them" |
|
2223 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2224 |
|val| |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2225 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2226 |
self getScaledRGBFrom:index into:[:r :g :b | |
1344 | 2227 |
val := aBlock |
2228 |
value:(r * 100.0 / 16rFFFF) |
|
2229 |
value:(g * 100.0 / 16rFFFF) |
|
2230 |
value:(b * 100.0 / 16rFFFF) |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2231 |
]. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2232 |
^ val |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2233 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2234 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2235 |
getRGBFromName:colorName into:aBlock |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2236 |
"get rgb components (0..100) of color named colorName, |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2237 |
and evaluate the 3-arg block, aBlock with them" |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2238 |
|val| |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2239 |
|
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2240 |
self getScaledRGBFromName:colorName into:[:r :g :b | |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2241 |
r isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2242 |
^ nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2243 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2244 |
val := aBlock |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2245 |
value:(r * 100.0 / 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2246 |
value:(g * 100.0 / 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2247 |
value:(b * 100.0 / 16rFFFF) |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2248 |
]. |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2249 |
^ val |
1056 | 2250 |
|
1430 | 2251 |
"Modified: 6.3.1997 / 02:36:43 / cg" |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2252 |
! |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2253 |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2254 |
getScaledRGBFrom:index into:aBlock |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2255 |
"get rgb components (0 .. 16rFFFF) of color in map at:index, |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2256 |
and evaluate the 3-arg block, aBlock with them" |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2257 |
|
295 | 2258 |
|r g b| |
2259 |
%{ |
|
555 | 2260 |
int screen = __intVal(__INST(screen)); |
295 | 2261 |
XColor color; |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2262 |
int sr, sg, sb; |
295 | 2263 |
int bits, scale, shift; |
2264 |
||
1209 | 2265 |
if (ISCONNECTED |
2266 |
&& __isSmallInteger(index)) { |
|
1344 | 2267 |
Display *dpy = myDpy; |
2268 |
||
2269 |
color.pixel = __intVal(index); |
|
2270 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2271 |
ENTER_XLIB(); |
1344 | 2272 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2273 |
LEAVE_XLIB(); |
1344 | 2274 |
END_INTERRUPTSBLOCKED |
2275 |
||
2276 |
/* |
|
2277 |
* have to compensate for an error in X ?, which does not scale |
|
2278 |
* colors correctly if lesser than 16bits are valid in a color, |
|
2748 | 2279 |
* (for example, color white on a 4bitsPerRGB server will Return |
1344 | 2280 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
2281 |
*/ |
|
2282 |
bits = __intVal(__INST(bitsPerRGB)); |
|
2283 |
scale = (1<<bits) - 1; |
|
2284 |
shift = 16 - bits; |
|
2285 |
||
2286 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
|
2287 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
|
2288 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
|
2289 |
r = __MKSMALLINT(sr); |
|
2290 |
g = __MKSMALLINT(sg); |
|
2291 |
b = __MKSMALLINT(sb); |
|
295 | 2292 |
} |
2293 |
%}. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2294 |
^ aBlock value:r value:g value:b |
295 | 2295 |
! |
2296 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2297 |
getScaledRGBFromName:colorName into:aBlock |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2298 |
"get rgb components (0..16rFFFF) of color named colorName, |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2299 |
and evaluate the 3-arg block, aBlock with them" |
295 | 2300 |
|
2301 |
|r g b| |
|
2302 |
||
2303 |
displayId isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2304 |
self pimitiveFailed. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2305 |
^ nil |
295 | 2306 |
]. |
2307 |
%{ |
|
555 | 2308 |
int screen = __intVal(__INST(screen)); |
295 | 2309 |
XColor color; |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2310 |
int sr, sg, sb; |
295 | 2311 |
double floor(); |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2312 |
int bits, scale, shift; |
295 | 2313 |
|
1209 | 2314 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2315 |
&& __isNonNilObject(colorName) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2316 |
&& (__qIsString(colorName) || __qIsSymbol(colorName))) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2317 |
Display *dpy = myDpy; |
1209 | 2318 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2319 |
BEGIN_INTERRUPTSBLOCKED |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2320 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
1831 | 2321 |
(char *) __stringVal(colorName), &color)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2322 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2323 |
* have to compensate for an error in X ?, which does not scale |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2324 |
* colors correctly if lesser than 16bits are valid in a color, |
2748 | 2325 |
* (for example, color white on a 4bitsPerRGB server will Return |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2326 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2327 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2328 |
bits = __intVal(__INST(bitsPerRGB)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2329 |
scale = (1<<bits) - 1; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2330 |
shift = 16 - bits; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2331 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2332 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2333 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2334 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2335 |
r = __MKSMALLINT(sr); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2336 |
g = __MKSMALLINT(sg); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2337 |
b = __MKSMALLINT(sb); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2338 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2339 |
END_INTERRUPTSBLOCKED |
295 | 2340 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2341 |
%}. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2342 |
^ aBlock value:r value:g value:b |
295 | 2343 |
! |
2344 |
||
2345 |
listOfAvailableColors |
|
2346 |
"return a list of all available colornames. |
|
2347 |
This should not be used, since colornames are very |
|
2348 |
display-specific (here X-specific)." |
|
2349 |
||
2350 |
|aStream list line index colorName| |
|
2351 |
||
2352 |
aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'. |
|
2353 |
aStream isNil ifTrue:[^ nil]. |
|
2354 |
list := OrderedCollection new. |
|
2355 |
[aStream atEnd] whileFalse:[ |
|
1344 | 2356 |
line := aStream nextLine. |
2357 |
line notNil ifTrue:[ |
|
2358 |
"skip the r/g/b numbers" |
|
2359 |
index := 1. |
|
2360 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2361 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2362 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2363 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2364 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2365 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2366 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2367 |
colorName := line copyFrom:index. |
|
2368 |
((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
|
2369 |
list add:colorName |
|
2370 |
] |
|
2371 |
] |
|
295 | 2372 |
]. |
2373 |
aStream close. |
|
2374 |
^ list sort |
|
1047 | 2375 |
|
2376 |
" |
|
2377 |
Screen current listOfAvailableColors |
|
2378 |
" |
|
2379 |
||
2380 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2381 |
! |
2382 |
||
2383 |
percentToXColorValue:aPercentage |
|
2384 |
"given a color-component value in percent (0..100), return the corresponding |
|
2385 |
x-component value (0..65k) as an integer" |
|
2386 |
||
2387 |
%{ /* NOCONTEXT */ |
|
2388 |
||
2389 |
if (__isSmallInteger(aPercentage)) { |
|
1344 | 2390 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2391 |
} |
2392 |
if (__isFloat(aPercentage)) { |
|
1344 | 2393 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2394 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2395 |
%}. |
295 | 2396 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2397 |
! |
2398 |
||
892 | 2399 |
setColor:index scaledRed:sred scaledGreen:sgreen scaledBlue:sblue |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2400 |
"change color in map at:index to rgb (0..16rFFFF). |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2401 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2402 |
|
2403 |
%{ /* NOCONTEXT */ |
|
2404 |
||
2405 |
char *colorname; |
|
2406 |
XColor color; |
|
555 | 2407 |
int screen = __intVal(__INST(screen)); |
0 | 2408 |
int r, g, b; |
2409 |
int ok = 1; |
|
2410 |
||
892 | 2411 |
if (__isSmallInteger(sred)) |
1344 | 2412 |
r = __intVal(sred); |
0 | 2413 |
else ok = 0; |
2414 |
||
892 | 2415 |
if (__isSmallInteger(sgreen)) |
1344 | 2416 |
g = __intVal(sgreen); |
0 | 2417 |
else ok = 0; |
2418 |
||
892 | 2419 |
if (__isSmallInteger(sblue)) |
1344 | 2420 |
b = __intVal(sblue); |
0 | 2421 |
else ok = 0; |
2422 |
||
1209 | 2423 |
if (ISCONNECTED |
2424 |
&& __isSmallInteger(index) && ok) { |
|
1344 | 2425 |
Display *dpy = myDpy; |
2426 |
||
2427 |
color.pixel = __intVal(index); |
|
2428 |
color.red = r; |
|
2429 |
color.green = g; |
|
2430 |
color.blue = b; |
|
2431 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2432 |
||
2433 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2434 |
ENTER_XLIB(); |
1344 | 2435 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2436 |
LEAVE_XLIB(); |
1344 | 2437 |
END_INTERRUPTSBLOCKED |
2438 |
RETURN ( self ); |
|
0 | 2439 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2440 |
%}. |
0 | 2441 |
self primitiveFailed |
295 | 2442 |
! ! |
2443 |
||
2444 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2445 |
||
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2446 |
builtInCursorShapes |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2447 |
"return a collection of standard cursor names. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2448 |
Those are built into the XServer and need not be created as |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2449 |
user cursors. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2450 |
(actually, there are more than those below ...)" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2451 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2452 |
"/ if you add something here, also add to #shapeNumberFromCursor ... |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2453 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2454 |
^ #( |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2455 |
#upLeftArrow "/ XC_top_left_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2456 |
#upRightHand "/ XC_hand1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2457 |
#upDownArrow "/ XC_sb_v_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2458 |
#leftRightArrow "/ XC_sb_h_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2459 |
#upLimitArrow "/ XC_top_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2460 |
#downLimitArrow "/ XC_bottom_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2461 |
#leftLimitArrow "/ XC_left_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2462 |
#rightLimitArrow "/ XC_right_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2463 |
#text "/ XC_xterm |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2464 |
#upRightArrow "/ XC_draft_large |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2465 |
#leftHand "/ XC_hand2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2466 |
#questionMark "/ XC_question_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2467 |
#cross "/ XC_X_cursor |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2468 |
#wait "/ XC_watch |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2469 |
#crossHair "/ XC_tcross |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2470 |
#origin "/ XC_ul_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2471 |
#topLeft "/ XC_ul_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2472 |
#corner "/ XC_lr_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2473 |
#bottomRight "/ XC_lr_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2474 |
#topRight "/ XC_ur_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2475 |
#bottomLeft "/ XC_ll_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2476 |
#square "/ XC_dotbox |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2477 |
#fourWay "/ XC_fleur |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2478 |
#crossCursor "/ XC_X_cursor |
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2479 |
) |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2480 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2481 |
"Created: 8.4.1997 / 10:12:30 / cg" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2482 |
"Modified: 8.4.1997 / 10:31:46 / cg" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2483 |
! |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2484 |
|
295 | 2485 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
2486 |
"change a cursors colors" |
|
2487 |
||
2488 |
|fgR fgG fgB bgR bgG bgB| |
|
2489 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2490 |
fgR := fgColor scaledRed. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2491 |
fgG := fgColor scaledGreen. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2492 |
fgB := fgColor scaledBlue. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2493 |
bgR := bgColor scaledRed. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2494 |
bgG := bgColor scaledGreen. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2495 |
bgB := bgColor scaledBlue. |
0 | 2496 |
%{ |
295 | 2497 |
XColor fgcolor, bgcolor; |
2498 |
||
1209 | 2499 |
if (ISCONNECTED |
2500 |
&& __isExternalAddress(aCursorId) |
|
295 | 2501 |
&& __bothSmallInteger(fgG, fgB) |
2502 |
&& __bothSmallInteger(bgR, bgG) |
|
2503 |
&& __bothSmallInteger(bgB, fgR)) { |
|
2504 |
||
1344 | 2505 |
fgcolor.red = __intVal(fgR); |
2506 |
fgcolor.green= __intVal(fgG); |
|
2507 |
fgcolor.blue = __intVal(fgB); |
|
2508 |
bgcolor.red = __intVal(bgR); |
|
2509 |
bgcolor.green= __intVal(bgG); |
|
2510 |
bgcolor.blue = __intVal(bgB); |
|
2511 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2512 |
ENTER_XLIB(); |
1344 | 2513 |
XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2514 |
LEAVE_XLIB(); |
1344 | 2515 |
END_INTERRUPTSBLOCKED |
2516 |
RETURN ( self ); |
|
72 | 2517 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2518 |
%}. |
0 | 2519 |
self primitiveFailed |
70 | 2520 |
! |
2521 |
||
295 | 2522 |
createCursorShape:aShape |
974 | 2523 |
"create a cursor given a shape-symbol. This only works |
2524 |
for a few standard cursors, and returns nil if no such cursor exists. |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2525 |
Senders must always care for a fallBack, in case of a nil return." |
295 | 2526 |
|
2527 |
|number id| |
|
2528 |
||
2529 |
number := self shapeNumberFromSymbol:aShape. |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2530 |
number isNil ifTrue:[^ nil]. |
295 | 2531 |
%{ |
2532 |
Cursor newCursor; |
|
2533 |
||
1209 | 2534 |
if (ISCONNECTED |
2535 |
&& __isSmallInteger(number)) { |
|
1344 | 2536 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2537 |
ENTER_XLIB(); |
1344 | 2538 |
newCursor = XCreateFontCursor(myDpy, __intVal(number)); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2539 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2540 |
#ifdef COUNT_RESOURCES |
1344 | 2541 |
if (newCursor) |
2542 |
__cnt_cursor++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2543 |
#endif |
1344 | 2544 |
END_INTERRUPTSBLOCKED |
2545 |
if (newCursor != (Cursor)0) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2546 |
id = __MKEXTERNALADDRESS(newCursor); |
1344 | 2547 |
} |
0 | 2548 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2549 |
%}. |
295 | 2550 |
^ id |
2551 |
! |
|
2552 |
||
974 | 2553 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2554 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2555 |
||
2556 |
|id sourceId maskId| |
|
2557 |
||
2558 |
sourceId := sourceForm id. |
|
2559 |
maskId := maskForm id. |
|
2560 |
%{ |
|
2561 |
Cursor newCursor; |
|
2562 |
XColor fgColor, bgColor; |
|
2563 |
||
1209 | 2564 |
if (ISCONNECTED |
2565 |
&& __isExternalAddress(sourceId) |
|
295 | 2566 |
&& __isExternalAddress(maskId) |
2567 |
&& __bothSmallInteger(hx, hy)) { |
|
1344 | 2568 |
fgColor.red = 0; /* fg is black */ |
2569 |
fgColor.green = 0; |
|
2570 |
fgColor.blue = 0; |
|
2571 |
bgColor.red = 0xFFFF; /* bg is white */ |
|
2572 |
bgColor.green = 0xFFFF; |
|
2573 |
bgColor.blue = 0xFFFF; |
|
2574 |
||
2575 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2576 |
ENTER_XLIB(); |
1344 | 2577 |
newCursor = XCreatePixmapCursor(myDpy, |
2578 |
_PixmapVal(sourceId), |
|
2579 |
_PixmapVal(maskId), |
|
2580 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2581 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2582 |
#ifdef COUNT_RESOURCES |
1344 | 2583 |
if (newCursor) |
2584 |
__cnt_cursor++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2585 |
#endif |
1344 | 2586 |
END_INTERRUPTSBLOCKED |
2587 |
if (newCursor != (Cursor)0) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2588 |
id = __MKEXTERNALADDRESS(newCursor); |
1344 | 2589 |
} |
0 | 2590 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2591 |
%}. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2592 |
id isNil ifTrue:[ |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2593 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2594 |
]. |
295 | 2595 |
^ id |
2596 |
! |
|
2597 |
||
2598 |
destroyCursor:aCursorId |
|
974 | 2599 |
"release a cursor - frees any device resources" |
0 | 2600 |
|
2601 |
%{ /* NOCONTEXT */ |
|
2602 |
||
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2603 |
if (! ISCONNECTED) { |
1344 | 2604 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2605 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2606 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2607 |
if (__isExternalAddress(aCursorId)) { |
1344 | 2608 |
Cursor curs = _CursorVal(aCursorId); |
2609 |
||
2610 |
if (curs) { |
|
2611 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2612 |
ENTER_XLIB(); |
1344 | 2613 |
XFreeCursor(myDpy, curs); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2614 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2615 |
#ifdef COUNT_RESOURCES |
1344 | 2616 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2617 |
#endif |
1344 | 2618 |
END_INTERRUPTSBLOCKED |
2619 |
} |
|
2620 |
RETURN ( self ); |
|
0 | 2621 |
} |
974 | 2622 |
%}. |
0 | 2623 |
self primitiveFailed |
295 | 2624 |
! |
2625 |
||
974 | 2626 |
needDeviceFormsForCursor |
2627 |
^ true |
|
2628 |
! |
|
2629 |
||
295 | 2630 |
shapeNumberFromSymbol:shape |
974 | 2631 |
"given a shape-symbol, return the corresponding cursor-number, |
2632 |
or nil if no such standard cursor exists." |
|
295 | 2633 |
|
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2634 |
"/this is pure X-knowlegde - but you may easily add more |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2635 |
"/ if you add something here, also add to #builtInCursorShapes ... |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2636 |
|
295 | 2637 |
|
2638 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2639 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2640 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2641 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2642 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2643 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2644 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2645 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2646 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2647 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2648 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2649 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2650 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2651 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2652 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2653 |
((shape == #origin) |
|
2654 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2655 |
((shape == #corner) |
|
2656 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2657 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2658 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2659 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2660 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2661 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
1183 | 2662 |
|
2663 |
"/ ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL. |
|
974 | 2664 |
^ nil |
0 | 2665 |
! ! |
2666 |
||
1543 | 2667 |
!XWorkstation methodsFor:'drag & drop'! |
2668 |
||
1556 | 2669 |
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
2670 |
"drop something in some alien view, using the DND protocol. |
|
2671 |
Returns false, if the drop could not be performed." |
|
2672 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2673 |
|msgType dropColl dropCollSize anyFile anyDir anyText anyOther |
1556 | 2674 |
dropType dropTypeCode strings sz idx val| |
2675 |
||
2676 |
(msgType := self atomIDOf:'DndProtocol') notNil ifTrue:[ |
|
2677 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2678 |
"/ DND can drop files, file, dir, links, dirLink and text |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2679 |
"/ check for this. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2680 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2681 |
dropObjects isCollection ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2682 |
dropColl := Array with:dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2683 |
] ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2684 |
dropColl := dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2685 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2686 |
anyFile := anyDir := anyText := anyOther := false. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2687 |
dropColl do:[:aDropObject | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2688 |
aDropObject isFileObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2689 |
aDropObject theObject isDirectory ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2690 |
anyDir := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2691 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2692 |
anyFile := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2693 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2694 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2695 |
aDropObject isTextObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2696 |
anyText := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2697 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2698 |
anyOther := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2699 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2700 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2701 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2702 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2703 |
anyOther ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2704 |
"/ DND does not support this ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2705 |
'XWorkstation [info]: DND can only drop files or text' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2706 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2707 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2708 |
anyText ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2709 |
(anyFile or:[anyDir]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2710 |
"/ DND does not support mixed types |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2711 |
'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2712 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2713 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2714 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2715 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2716 |
dropCollSize := dropColl size. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2717 |
anyFile ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2718 |
dropType := #DndFiles. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2719 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2720 |
dropType := #DndFile |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2721 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2722 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2723 |
anyDir ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2724 |
dropType := #DndFiles. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2725 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2726 |
dropType := #DndDir |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2727 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2728 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2729 |
anyText ifTrue:[ |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2730 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2731 |
dropType := #DndText |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2732 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2733 |
"/ can only drop a single text object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2734 |
'XWorkstation [info]: DND can only drop a single text' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2735 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2736 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2737 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2738 |
"/ mhmh ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2739 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2740 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2741 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2742 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2743 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2744 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2745 |
dropTypeCode := self dndDropTypes indexOf:dropType. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2746 |
dropTypeCode == 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2747 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2748 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2749 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2750 |
dropTypeCode := dropTypeCode - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2751 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2752 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2753 |
"/ place the selection inTo the DndSelection property |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2754 |
"/ of the rootView ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2755 |
"/ ... need a single string, with 0-terminated parts. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2756 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2757 |
strings := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2758 |
sz := 0. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2759 |
dropColl do:[:anObject | |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2760 |
|s o| |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2761 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2762 |
o := anObject theObject. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2763 |
anObject isFileObject ifTrue:[ |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2764 |
o := o pathName |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2765 |
]. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2766 |
s := o asString. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2767 |
strings add:s. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2768 |
sz := sz + (s size) + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2769 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2770 |
val := String new:sz. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2771 |
idx := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2772 |
strings do:[:aString | |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2773 |
|sz| |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2774 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2775 |
sz := aString size. |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2776 |
val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1. |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2777 |
idx := idx + sz. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2778 |
val at:idx put:(Character value:0). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2779 |
idx := idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2780 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2781 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2782 |
self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2783 |
setProperty:(self atomIDOf:'DndSelection') |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2784 |
type:(stringAtom) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2785 |
value:val |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2786 |
for:rootId. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2787 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2788 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2789 |
sendClientEvent:msgType |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2790 |
format:32 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2791 |
to:destinationId |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2792 |
data1:dropTypeCode |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2793 |
data2:0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2794 |
data3:(destinationId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2795 |
data4:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2796 |
data5:nil. |
1556 | 2797 |
]. |
2798 |
||
2799 |
^ false |
|
2800 |
||
2801 |
"Created: 6.4.1997 / 13:39:37 / cg" |
|
1558 | 2802 |
"Modified: 6.4.1997 / 14:30:43 / cg" |
1556 | 2803 |
! |
2804 |
||
2805 |
dndDropTypes |
|
2806 |
"return the dropTypes as supported by DND" |
|
2807 |
||
2808 |
^ #( |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2809 |
DndUnknown "/ 0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2810 |
DndRawData "/ 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2811 |
DndFile "/ 2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2812 |
DndFiles "/ 3 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2813 |
DndText "/ 4 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2814 |
DndDir "/ 5 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2815 |
DndLink "/ 6 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2816 |
DndExe "/ 7 |
1556 | 2817 |
) |
2818 |
||
2819 |
"Created: 6.4.1997 / 12:57:56 / cg" |
|
2820 |
"Modified: 6.4.1997 / 13:38:52 / cg" |
|
2821 |
! |
|
2822 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
2823 |
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
1556 | 2824 |
"drop something in some alien view. |
2825 |
Returns false, if the drop could not be performed." |
|
2826 |
||
2827 |
"/ |
|
1543 | 2828 |
"/ see, if the display supports the DND protocol ... |
1556 | 2829 |
"/ |
1543 | 2830 |
(self atomIDOf:'DndProtocol') notNil ifTrue:[ |
1694 | 2831 |
^ self |
2832 |
dndDrop:aCollectionOfDropObjects |
|
2833 |
inWindowID:destinationId |
|
2834 |
position:destinationPoint |
|
2835 |
rootPosition:rootPoint |
|
1543 | 2836 |
]. |
2837 |
||
1556 | 2838 |
"/ add more drag&drop protocols here. |
2839 |
||
2840 |
^ false |
|
2841 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
2842 |
"Modified: 11.4.1997 / 12:44:50 / cg" |
1543 | 2843 |
! ! |
2844 |
||
0 | 2845 |
!XWorkstation methodsFor:'drawing'! |
2846 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2847 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2848 |
"do a bit-blt; copy bits from the rectangle defined by |
2849 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2850 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2851 |
argument is not integer." |
|
0 | 2852 |
|
2853 |
%{ /* NOCONTEXT */ |
|
2854 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2855 |
GC gc; |
0 | 2856 |
Drawable source, dest; |
2857 |
||
1209 | 2858 |
if (ISCONNECTED |
2859 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2860 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2861 |
&& __isExternalAddress(destId) |
97 | 2862 |
&& __bothSmallInteger(w, h) |
2863 |
&& __bothSmallInteger(srcX, srcY) |
|
2864 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1848 | 2865 |
int _sX, _sY, _w, _h, _dX, _dY; |
2866 |
||
2867 |
_sX = __intVal(srcX); |
|
2868 |
_sY = __intVal(srcY); |
|
2869 |
_w = __intVal(w); |
|
2870 |
_h = __intVal(h); |
|
2871 |
_dX = __intVal(dstX); |
|
2872 |
_dY = __intVal(dstY); |
|
2873 |
||
1344 | 2874 |
gc = _GCVal(dstGCId); |
2875 |
source = (Drawable) _WindowVal(sourceId); |
|
2876 |
dest = (Drawable) _WindowVal(destId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2877 |
ENTER_XLIB(); |
1848 | 2878 |
XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2879 |
LEAVE_XLIB(); |
1344 | 2880 |
RETURN ( self ); |
0 | 2881 |
} |
118 | 2882 |
%}. |
2883 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2884 |
or any non integer coordinate" |
|
2885 |
||
0 | 2886 |
self primitiveFailed |
2887 |
! |
|
2888 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2889 |
copyFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2890 |
"do a bit-blt from a pix- or bitmap; copy bits from the rectangle defined by |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2891 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2892 |
below dstX/dstY in the destId drawable. Trigger an error if any |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2893 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2894 |
This is basically the same as copyFromId:..., but does not generate expose events." |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2895 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2896 |
%{ /* NOCONTEXT */ |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2897 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2898 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2899 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2900 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2901 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2902 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2903 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2904 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2905 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2906 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2907 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 2908 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2909 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2910 |
gc = _GCVal(dstGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2911 |
source = (Drawable) _WindowVal(sourceId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2912 |
dest = (Drawable) _WindowVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2913 |
ENTER_XLIB(); |
1344 | 2914 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2915 |
XCopyArea(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2916 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2917 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2918 |
__intVal(dstX), __intVal(dstY)); |
1344 | 2919 |
XSetGraphicsExposures(dpy, gc, 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2920 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2921 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2922 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2923 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2924 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2925 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2926 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2927 |
self primitiveFailed |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2928 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2929 |
|
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2930 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2931 |
"do a bit-blt, but only copy the low-bit plane; |
2932 |
copy bits from the rectangle defined by |
|
2933 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2934 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2935 |
argument is not integer." |
|
0 | 2936 |
|
2937 |
%{ /* NOCONTEXT */ |
|
2938 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2939 |
GC gc; |
0 | 2940 |
Drawable source, dest; |
2941 |
||
1209 | 2942 |
if (ISCONNECTED |
2943 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2944 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2945 |
&& __isExternalAddress(destId) |
97 | 2946 |
&& __bothSmallInteger(w, h) |
2947 |
&& __bothSmallInteger(srcX, srcY) |
|
2948 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1344 | 2949 |
gc = _GCVal(dstGCId); |
2950 |
source = (Drawable) _WindowVal(sourceId); |
|
2951 |
dest = (Drawable) _WindowVal(destId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2952 |
ENTER_XLIB(); |
1344 | 2953 |
XCopyPlane(myDpy, source, dest, gc, |
2954 |
__intVal(srcX), __intVal(srcY), |
|
2955 |
__intVal(w), __intVal(h), |
|
2956 |
__intVal(dstX), __intVal(dstY), 1); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2957 |
LEAVE_XLIB(); |
1344 | 2958 |
RETURN ( self ); |
0 | 2959 |
} |
118 | 2960 |
%}. |
2961 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2962 |
or any non integer coordinate" |
|
2963 |
||
0 | 2964 |
self primitiveFailed |
2965 |
! |
|
2966 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2967 |
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2968 |
"do a bit-blt from a pix- or bitmap, but only copy the low-bit plane; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2969 |
copy bits from the rectangle defined by |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2970 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2971 |
below dstX/dstY in the destId drawable. Trigger an error if any |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2972 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2973 |
This is the same as copyPlaneFromId:..., but does not generate graphics exposes" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2974 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2975 |
%{ /* NOCONTEXT */ |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2976 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2977 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2978 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2979 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2980 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2981 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2982 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2983 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2984 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2985 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2986 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 2987 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2988 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2989 |
gc = _GCVal(dstGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2990 |
source = (Drawable) _WindowVal(sourceId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2991 |
dest = (Drawable) _WindowVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2992 |
ENTER_XLIB(); |
1344 | 2993 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2994 |
XCopyPlane(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2995 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2996 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2997 |
__intVal(dstX), __intVal(dstY), 1); |
1344 | 2998 |
XSetGraphicsExposures(dpy, gc, 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2999 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3000 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3001 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3002 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3003 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3004 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3005 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3006 |
self primitiveFailed |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3007 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3008 |
|
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
3009 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 3010 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
3011 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 3012 |
|
3013 |
%{ /* NOCONTEXT */ |
|
3014 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3015 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3016 |
Window win; |
0 | 3017 |
int w, h, angle1, angle2; |
3018 |
double f; |
|
3019 |
||
97 | 3020 |
if (__isSmallInteger(startAngle)) |
1344 | 3021 |
angle1 = __intVal(startAngle) * 64; |
36 | 3022 |
else if (__isFloat(startAngle)) { |
1344 | 3023 |
f = __floatVal(startAngle); |
3024 |
angle1 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3025 |
} else if (__isShortFloat(startAngle)) { |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3026 |
f = __shortFloatVal(startAngle); |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3027 |
angle1 = f * 64; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3028 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3029 |
|
97 | 3030 |
if (__isSmallInteger(angle)) |
1344 | 3031 |
angle2 = __intVal(angle) * 64; |
36 | 3032 |
else if (__isFloat(angle)) { |
1344 | 3033 |
f = __floatVal(angle); |
3034 |
angle2 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3035 |
} else if (__isShortFloat(angle)) { |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3036 |
f = __shortFloatVal(angle); |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3037 |
angle2 = f * 64; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3038 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3039 |
|
1209 | 3040 |
if (ISCONNECTED |
3041 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3042 |
&& __isExternalAddress(aDrawableId) |
97 | 3043 |
&& __bothSmallInteger(x, y) |
3044 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3045 |
win = _WindowVal(aDrawableId); |
3046 |
gc = _GCVal(aGCId); |
|
3047 |
w = __intVal(width); |
|
3048 |
h = __intVal(height); |
|
3049 |
/* |
|
3050 |
* need this check here: some servers simply dump core with bad args |
|
3051 |
*/ |
|
3052 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3053 |
ENTER_XLIB(); |
1344 | 3054 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3055 |
w, h, angle1, angle2); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3056 |
LEAVE_XLIB(); |
1344 | 3057 |
} |
3058 |
RETURN ( self ); |
|
0 | 3059 |
} |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3060 |
bad: ; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3061 |
%}. |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3062 |
"badGC, badDrawable or coordinates not integer |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3063 |
or angle(s) not integer or float." |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3064 |
|
0 | 3065 |
self primitiveFailed |
3066 |
! |
|
3067 |
||
295 | 3068 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
3069 |
"draw a line. If the coordinates are not integers, an error is triggered." |
|
3070 |
||
3071 |
%{ /* NOCONTEXT */ |
|
3072 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3073 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3074 |
Window win; |
295 | 3075 |
|
1209 | 3076 |
if (ISCONNECTED |
3077 |
&& __isExternalAddress(aGCId) |
|
295 | 3078 |
&& __isExternalAddress(aDrawableId) |
3079 |
&& __bothSmallInteger(x0, y0) |
|
3080 |
&& __bothSmallInteger(x1, y1)) { |
|
2541 | 3081 |
Display *dpy = myDpy; |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3082 |
gc = _GCVal(aGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3083 |
win = _WindowVal(aDrawableId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3084 |
|
1974 | 3085 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3086 |
if ((x0 == x1) && (y0 == y1)) { |
2541 | 3087 |
XDrawPoint(dpy, win, gc, __intVal(x0), __intVal(y0)); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3088 |
} else { |
2541 | 3089 |
XDrawLine(dpy, win, gc, __intVal(x0), __intVal(y0), |
3090 |
__intVal(x1), __intVal(y1)); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3091 |
} |
1974 | 3092 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3093 |
RETURN ( self ); |
295 | 3094 |
} |
3095 |
%}. |
|
3096 |
"badGC, badDrawable or coordinates not integer" |
|
3097 |
self primitiveFailed |
|
3098 |
! |
|
3099 |
||
1978 | 3100 |
displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
3101 |
"draw a polygon starting at x; the y values derives from the collection yValues. |
|
3102 |
The associated x is a multiple of step. Each y value will be scaled and translated |
|
3103 |
" |
|
3104 |
||
3105 |
|noY| |
|
3106 |
||
3107 |
(noY := yValues size) < 2 ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3108 |
^ self |
1978 | 3109 |
]. |
3110 |
||
3111 |
%{ |
|
3112 |
OBJ yA, t; |
|
3113 |
int i, num; |
|
3114 |
float y, x, sY, tY, step; |
|
3115 |
GC gc; |
|
3116 |
XPoint * points; |
|
3117 |
XPoint qPoints[200]; |
|
3118 |
int mustFree = 0; |
|
3119 |
||
3120 |
Window win; |
|
3121 |
||
3122 |
if (ISCONNECTED |
|
3123 |
&& __isExternalAddress(aGCId) |
|
3124 |
&& __isExternalAddress(aDrawableId) ) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3125 |
gc = _GCVal(aGCId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3126 |
win = _WindowVal(aDrawableId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3127 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3128 |
if( __isSmallInteger(scaleY) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3129 |
sY = (float) __intVal( scaleY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3130 |
else if (__isFloat(scaleY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3131 |
sY = __floatVal( scaleY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3132 |
else if (__isShortFloat(scaleY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3133 |
sY = __shortFloatVal( scaleY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3134 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3135 |
t = __SSEND0(scaleY, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3136 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3137 |
sY = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3138 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3139 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3140 |
if( __isSmallInteger(transY) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3141 |
tY = (float) __intVal( transY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3142 |
else if (__isFloat(transY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3143 |
tY = __floatVal( transY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3144 |
else if (__isShortFloat(transY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3145 |
tY = __shortFloatVal( transY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3146 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3147 |
t = __SSEND0(transY, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3148 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3149 |
tY = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3150 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3151 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3152 |
if( __isSmallInteger(startX) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3153 |
x = (float) __intVal( startX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3154 |
else if (__isFloat(startX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3155 |
x = __floatVal( startX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3156 |
else if (__isShortFloat(startX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3157 |
x = __shortFloatVal( startX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3158 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3159 |
t = __SSEND0(startX, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3160 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3161 |
x = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3162 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3163 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3164 |
if( __isSmallInteger(stepX) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3165 |
step = (float) __intVal( stepX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3166 |
else if (__isFloat(stepX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3167 |
step = __floatVal( stepX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3168 |
else if (__isShortFloat(stepX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3169 |
step = __shortFloatVal( stepX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3170 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3171 |
t = __SSEND0(stepX, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3172 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3173 |
step = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3174 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3175 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3176 |
num = __intVal( noY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3177 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3178 |
if( num > 200 ) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3179 |
if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3180 |
goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3181 |
mustFree = 1; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3182 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3183 |
points = qPoints; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3184 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3185 |
for( i = 0; i < num; ++i ) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3186 |
yA = __AT_(yValues, __MKSMALLINT(i+1) ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3187 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3188 |
if( __isFloat(yA) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3189 |
y = __floatVal( yA ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3190 |
else if( __isSmallInteger(yA) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3191 |
y = (float) __intVal( yA ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3192 |
else if( __isShortFloat( yA) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3193 |
y = __shortFloatVal( yA ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3194 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3195 |
t = __SSEND0(yA, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3196 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3197 |
y = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3198 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3199 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3200 |
points[i].x = (int) (x + 0.5); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3201 |
points[i].y = (int) ((y * sY) + tY + 0.5); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3202 |
x = x + step; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3203 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3204 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3205 |
ENTER_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3206 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3207 |
LEAVE_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3208 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3209 |
if( mustFree ) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3210 |
free( points ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3211 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3212 |
RETURN ( self ); |
1978 | 3213 |
} |
3214 |
||
3215 |
fail: |
|
3216 |
if( mustFree ) |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3217 |
free( points ); |
1978 | 3218 |
%}. |
3219 |
self primitiveFailed |
|
3220 |
||
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3221 |
"Modified: / 13.6.1998 / 13:51:39 / cg" |
1978 | 3222 |
! |
3223 |
||
295 | 3224 |
displayPointX:x y:y in:aDrawableId with:aGCId |
3225 |
"draw a point. If x/y are not integers, an error is triggered." |
|
3226 |
||
3227 |
%{ /* NOCONTEXT */ |
|
3228 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3229 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3230 |
Window win; |
295 | 3231 |
|
1209 | 3232 |
if (ISCONNECTED |
3233 |
&& __isExternalAddress(aGCId) |
|
295 | 3234 |
&& __isExternalAddress(aDrawableId) |
3235 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 3236 |
gc = _GCVal(aGCId); |
3237 |
win = _WindowVal(aDrawableId); |
|
1974 | 3238 |
|
3239 |
ENTER_XLIB(); |
|
1344 | 3240 |
XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); |
1974 | 3241 |
LEAVE_XLIB(); |
3242 |
||
1344 | 3243 |
RETURN ( self ); |
295 | 3244 |
} |
3245 |
%}. |
|
3246 |
"badGC, badDrawable or x/y not integer" |
|
3247 |
self primitiveFailed |
|
3248 |
! |
|
3249 |
||
3250 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
3251 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
3252 |
define the polygon. |
|
3253 |
If any coordinate is not integer, an error is triggered." |
|
3254 |
||
3255 |
|numberOfPoints newPoints| |
|
3256 |
||
3257 |
numberOfPoints := aPolygon size. |
|
3258 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3259 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3260 |
Window win; |
295 | 3261 |
OBJ point, x, y; |
3262 |
int i, num; |
|
3263 |
XPoint *points; |
|
3264 |
XPoint qPoints[100]; |
|
377 | 3265 |
int mustFree = 0; |
295 | 3266 |
|
1209 | 3267 |
if (ISCONNECTED |
3268 |
&& __isExternalAddress(aGCId) |
|
295 | 3269 |
&& __isExternalAddress(aDrawableId) |
3270 |
&& __isSmallInteger(numberOfPoints)) { |
|
1344 | 3271 |
gc = _GCVal(aGCId); |
3272 |
win = _WindowVal(aDrawableId); |
|
3273 |
num = __intVal(numberOfPoints); |
|
3274 |
/* |
|
3275 |
* avoid a (slow) malloc, if the number of points is small |
|
3276 |
*/ |
|
3277 |
if (num > 100) { |
|
3278 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
|
3279 |
if (! points) goto fail; |
|
3280 |
mustFree = 1; |
|
3281 |
} else |
|
3282 |
points = qPoints; |
|
3283 |
||
3284 |
for (i=0; i<num; i++) { |
|
3285 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
3286 |
if (! __isPoint(point)) goto fail; |
|
3287 |
x = _point_X(point); |
|
3288 |
y = _point_Y(point); |
|
3289 |
if (! __bothSmallInteger(x, y)) |
|
3290 |
goto fail; |
|
3291 |
points[i].x = __intVal(x); |
|
3292 |
points[i].y = __intVal(y); |
|
3293 |
} |
|
1974 | 3294 |
|
3295 |
ENTER_XLIB(); |
|
1344 | 3296 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
1974 | 3297 |
LEAVE_XLIB(); |
3298 |
||
1344 | 3299 |
if (mustFree) |
3300 |
free(points); |
|
3301 |
RETURN ( self ); |
|
295 | 3302 |
} |
3303 |
fail: ; |
|
377 | 3304 |
if (mustFree) |
1344 | 3305 |
free(points); |
295 | 3306 |
%}. |
3307 |
"badGC, badDrawable or coordinates not integer" |
|
3308 |
self primitiveFailed |
|
3309 |
! |
|
3310 |
||
3311 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
3312 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
|
3313 |
||
3314 |
%{ /* NOCONTEXT */ |
|
3315 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3316 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3317 |
Window win; |
295 | 3318 |
int w, h; |
3319 |
||
1209 | 3320 |
if (ISCONNECTED |
3321 |
&& __isExternalAddress(aGCId) |
|
295 | 3322 |
&& __isExternalAddress(aDrawableId) |
3323 |
&& __bothSmallInteger(x, y) |
|
3324 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3325 |
gc = _GCVal(aGCId); |
3326 |
win = _WindowVal(aDrawableId); |
|
3327 |
w = __intVal(width); |
|
3328 |
h = __intVal(height); |
|
3329 |
/* |
|
3330 |
* need this check here: some servers simply dump core with bad args |
|
3331 |
*/ |
|
3332 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 3333 |
ENTER_XLIB(); |
1344 | 3334 |
XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h); |
1974 | 3335 |
LEAVE_XLIB(); |
1344 | 3336 |
} |
3337 |
RETURN ( self ); |
|
295 | 3338 |
} |
3339 |
%}. |
|
3340 |
"badGC, badDrawable or coordinates not integer" |
|
3341 |
self primitiveFailed |
|
3342 |
! |
|
3343 |
||
3344 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3345 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
|
3346 |
foreground and background characters. |
|
3347 |
If the coordinates are not integers, an error is triggered." |
|
3348 |
||
3349 |
%{ /* NOCONTEXT */ |
|
3350 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3351 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3352 |
Window win; |
1831 | 3353 |
char *cp; |
295 | 3354 |
OBJ cls; |
3355 |
int i1, i2, l, n; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3356 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3357 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3358 |
int nInstBytes; |
295 | 3359 |
|
1209 | 3360 |
if (ISCONNECTED |
3361 |
&& __isExternalAddress(aGCId) |
|
295 | 3362 |
&& __isExternalAddress(aDrawableId) |
3363 |
&& __isNonNilObject(aString) |
|
3364 |
&& __bothSmallInteger(index1, index2) |
|
3365 |
&& __bothSmallInteger(x, y)) { |
|
2541 | 3366 |
Display *dpy = myDpy; |
1344 | 3367 |
gc = _GCVal(aGCId); |
3368 |
win = _WindowVal(aDrawableId); |
|
3369 |
cls = __qClass(aString); |
|
3370 |
||
3371 |
i1 = __intVal(index1) - 1; |
|
3372 |
if (i1 >= 0) { |
|
3373 |
i2 = __intVal(index2) - 1; |
|
3374 |
if (i2 < i1) { |
|
3375 |
RETURN (self); |
|
3376 |
} |
|
3377 |
||
1831 | 3378 |
cp = (char *) __stringVal(aString); |
1344 | 3379 |
l = i2 - i1 + 1; |
3380 |
||
3381 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
3382 |
n = __stringSize(aString); |
1344 | 3383 |
if (i2 < n) { |
3384 |
cp += i1; |
|
3385 |
if (l > 1000) l = 1000; |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3386 |
ENTER_XLIB(); |
1344 | 3387 |
if (opaque == true) |
2541 | 3388 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1344 | 3389 |
else |
2541 | 3390 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3391 |
LEAVE_XLIB(); |
1344 | 3392 |
RETURN ( self ); |
3393 |
} |
|
3394 |
} |
|
3395 |
||
3396 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3397 |
cp += nInstBytes; |
|
3398 |
||
3399 |
if (__isBytes(aString)) { |
|
3400 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3401 |
||
3402 |
if (i2 < n) { |
|
3403 |
cp += i1; |
|
3404 |
if (l > 1000) l = 1000; |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3405 |
ENTER_XLIB(); |
1344 | 3406 |
if (opaque == true) |
2541 | 3407 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1344 | 3408 |
else |
2541 | 3409 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3410 |
LEAVE_XLIB(); |
1344 | 3411 |
RETURN ( self ); |
3412 |
} |
|
3413 |
} |
|
3414 |
||
3415 |
/* TWOBYTESTRINGS */ |
|
3416 |
if (__isWords(aString)) { |
|
3417 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3418 |
||
3419 |
if (i2 < n) { |
|
3420 |
union { |
|
3421 |
char b[2]; |
|
3422 |
unsigned short s; |
|
3423 |
} u; |
|
3424 |
int i; |
|
3425 |
XChar2b *cp2 = (XChar2b *)0; |
|
3426 |
int mustFree = 0; |
|
3427 |
||
3428 |
cp += (i1 * 2); |
|
3429 |
if (l > 1000) l = 1000; |
|
3430 |
||
3431 |
/* |
|
3432 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3433 |
* X expects them MSB first |
|
3434 |
* convert as required |
|
3435 |
*/ |
|
3436 |
||
3437 |
u.s = 0x1234; |
|
3438 |
if (u.b[0] != 0x12) { |
|
3439 |
if (l <= NLOCALBUFFER) { |
|
3440 |
cp2 = xlatebuffer; |
|
3441 |
} else { |
|
3442 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
3443 |
mustFree = 1; |
|
3444 |
} |
|
3445 |
for (i=0; i<l; i++) { |
|
3446 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3447 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3448 |
} |
|
3449 |
cp = (char *) cp2; |
|
3450 |
} |
|
3451 |
||
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3452 |
ENTER_XLIB(); |
1344 | 3453 |
if (opaque == true) |
2541 | 3454 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
1344 | 3455 |
else |
2541 | 3456 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3457 |
LEAVE_XLIB(); |
1344 | 3458 |
|
3459 |
if (mustFree) { |
|
3460 |
free(cp2); |
|
3461 |
} |
|
3462 |
||
3463 |
RETURN ( self ); |
|
3464 |
} |
|
3465 |
} |
|
3466 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3467 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3468 |
#undef NLOCALBUFFER |
295 | 3469 |
%}. |
3470 |
"x/y not integer, badGC or drawable, or not a string" |
|
3471 |
self primitiveFailed |
|
3472 |
! |
|
3473 |
||
3474 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3475 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
|
3476 |
foreground and background characters. |
|
3477 |
If the coordinates are not integers, an error is triggered." |
|
3478 |
||
3479 |
%{ /* NOCONTEXT */ |
|
3480 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3481 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3482 |
Window win; |
1831 | 3483 |
char *cp; |
295 | 3484 |
int n; |
3485 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3486 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3487 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3488 |
int nInstBytes; |
295 | 3489 |
|
1209 | 3490 |
if (ISCONNECTED |
3491 |
&& __isExternalAddress(aGCId) |
|
295 | 3492 |
&& __isExternalAddress(aDrawableId) |
3493 |
&& __isNonNilObject(aString) |
|
3494 |
&& __bothSmallInteger(x, y)) { |
|
2541 | 3495 |
Display *dpy = myDpy; |
1344 | 3496 |
gc = _GCVal(aGCId); |
3497 |
win = _WindowVal(aDrawableId); |
|
3498 |
cls = __qClass(aString); |
|
3499 |
||
1831 | 3500 |
cp = (char *) __stringVal(aString); |
1344 | 3501 |
|
3502 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
3503 |
n = __stringSize(aString); |
1344 | 3504 |
if (n > 1000) n = 1000; |
1974 | 3505 |
ENTER_XLIB(); |
1344 | 3506 |
if (opaque == true) |
2541 | 3507 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1344 | 3508 |
else |
2541 | 3509 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1974 | 3510 |
LEAVE_XLIB(); |
1344 | 3511 |
RETURN ( self ); |
3512 |
} |
|
3513 |
||
3514 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3515 |
cp += nInstBytes; |
|
3516 |
||
3517 |
if (__isBytes(aString)) { |
|
3518 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3519 |
||
3520 |
if (n > 1000) n = 1000; |
|
1974 | 3521 |
ENTER_XLIB(); |
1344 | 3522 |
if (opaque == true) |
2541 | 3523 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1344 | 3524 |
else |
2541 | 3525 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1974 | 3526 |
LEAVE_XLIB(); |
1344 | 3527 |
RETURN ( self ); |
3528 |
} |
|
3529 |
||
3530 |
/* TWOBYTESTRINGS */ |
|
3531 |
if (__isWords(aString)) { |
|
3532 |
union { |
|
3533 |
char b[2]; |
|
3534 |
unsigned short s; |
|
3535 |
} u; |
|
3536 |
int i; |
|
3537 |
XChar2b *cp2; |
|
3538 |
int mustFree = 0; |
|
3539 |
||
3540 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3541 |
if (n > 1000) n = 1000; |
|
3542 |
||
3543 |
/* |
|
3544 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3545 |
* X expects them MSB first |
|
3546 |
* convert as required |
|
3547 |
*/ |
|
3548 |
||
3549 |
u.s = 0x1234; |
|
3550 |
if (u.b[0] != 0x12) { |
|
3551 |
if (n <= NLOCALBUFFER) { |
|
3552 |
cp2 = xlatebuffer; |
|
3553 |
} else { |
|
3554 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
3555 |
mustFree = 1; |
|
3556 |
} |
|
3557 |
||
3558 |
for (i=0; i<n; i++) { |
|
3559 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3560 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3561 |
} |
|
3562 |
cp = (char *) cp2; |
|
3563 |
} |
|
3564 |
||
1974 | 3565 |
ENTER_XLIB(); |
1344 | 3566 |
if (opaque == true) |
2541 | 3567 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
1344 | 3568 |
else |
2541 | 3569 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
1974 | 3570 |
LEAVE_XLIB(); |
1344 | 3571 |
|
3572 |
||
3573 |
if (mustFree) { |
|
3574 |
free(cp2); |
|
3575 |
} |
|
3576 |
||
3577 |
RETURN ( self ); |
|
3578 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3579 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3580 |
#undef NLOCALBUFFER |
295 | 3581 |
%}. |
3582 |
"x/y not integer, badGC or drawable, or not a string" |
|
3583 |
self primitiveFailed |
|
3584 |
! |
|
3585 |
||
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3586 |
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3587 |
width:imageWidth height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3588 |
x:srcx y:srcy |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3589 |
into:aDrawableId |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3590 |
x:dstx y:dsty |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3591 |
width:w height:h |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3592 |
with:aGCId |
295 | 3593 |
|
3594 |
"draw a bitImage which has depth id, width iw and height ih into |
|
3595 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3596 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
3597 |
depth and pixel-units to be different. |
|
3598 |
It has to be checked elsewhere, that the server can do it with the given |
|
3599 |
depth - otherwise, primitive failure will be signalled. |
|
3600 |
Also it is assumed, that the colormap is setup correctly and the |
|
3601 |
colors are allocated - otherwise the colors may be wrong." |
|
3602 |
||
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3603 |
|fmt padding bits wantedPadding| |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3604 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3605 |
padding := givenPadding. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3606 |
bits := givenBits. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3607 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3608 |
"/ the XF86_VGA16 server seems to report an error when we pass it an |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3609 |
"/ 8-bit padded image. (it wants it 32bit padded). |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3610 |
"/ as a workaround, repad it here (although, the server and/or Xlib should |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3611 |
"/ care for that. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3612 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3613 |
((imageDepth == 4) and:[depth == 4]) ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3614 |
fmt := self supportedImageFormatForDepth:4. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3615 |
fmt isNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3616 |
self primitiveFailed. "/ cannot represent this image |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3617 |
^ nil |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3618 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3619 |
wantedPadding := fmt at:#padding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3620 |
wantedPadding > givenPadding ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3621 |
bits := self |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3622 |
repadBits:givenBits |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3623 |
width:imageWidth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3624 |
height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3625 |
depth:imageDepth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3626 |
from:givenPadding |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3627 |
to:wantedPadding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3628 |
padding := wantedPadding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3629 |
] |
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3630 |
]. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3631 |
|
295 | 3632 |
" |
3633 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
3634 |
an unlimited stack, and thus cannot send primitiveFailed |
|
3635 |
" |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3636 |
(self |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3637 |
primDrawBits:bits |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3638 |
bitsPerPixel:bitsPerPixel |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3639 |
depth:imageDepth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3640 |
padding:padding |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3641 |
width:imageWidth height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3642 |
x:srcx y:srcy |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3643 |
into:aDrawableId |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3644 |
x:dstx y:dsty |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3645 |
width:w height:h |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3646 |
with:aGCId) |
295 | 3647 |
ifFalse:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3648 |
" |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3649 |
also happens, if a segmentation violation occurs in the |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3650 |
XPutImage ... |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3651 |
" |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3652 |
self primitiveFailed |
295 | 3653 |
]. |
3654 |
! |
|
3655 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
3656 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
1344 | 3657 |
in:aDrawableId with:aGCId |
90 | 3658 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
3659 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 3660 |
|
3661 |
%{ /* NOCONTEXT */ |
|
3662 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3663 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3664 |
Window win; |
0 | 3665 |
int w, h, angle1, angle2; |
3666 |
double f; |
|
3667 |
||
97 | 3668 |
if (__isSmallInteger(startAngle)) |
1344 | 3669 |
angle1 = __intVal(startAngle) * 64; |
36 | 3670 |
else if (__isFloat(startAngle)) { |
1344 | 3671 |
f = __floatVal(startAngle); |
3672 |
angle1 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3673 |
} else if (__isShortFloat(startAngle)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3674 |
f = __shortFloatVal(startAngle); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3675 |
angle1 = f * 64; |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3676 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3677 |
|
97 | 3678 |
if (__isSmallInteger(angle)) |
1344 | 3679 |
angle2 = __intVal(angle) * 64; |
36 | 3680 |
else if (__isFloat(angle)) { |
1344 | 3681 |
f = __floatVal(angle); |
3682 |
angle2 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3683 |
} else if (__isShortFloat(angle)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3684 |
f = __shortFloatVal(angle); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3685 |
angle2 = f * 64; |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3686 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3687 |
|
1209 | 3688 |
if (ISCONNECTED |
3689 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3690 |
&& __isExternalAddress(aDrawableId) |
97 | 3691 |
&& __bothSmallInteger(x, y) |
3692 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3693 |
gc = _GCVal(aGCId); |
3694 |
win = _WindowVal(aDrawableId); |
|
3695 |
w = __intVal(width); |
|
3696 |
h = __intVal(height); |
|
3697 |
/* |
|
3698 |
* need this check here: some servers simply dump core with bad args |
|
3699 |
*/ |
|
3700 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
1974 | 3701 |
ENTER_XLIB(); |
1344 | 3702 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3703 |
w, h, angle1, angle2); |
|
1974 | 3704 |
LEAVE_XLIB(); |
1344 | 3705 |
} |
3706 |
RETURN ( self ); |
|
0 | 3707 |
} |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3708 |
bad: ; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3709 |
%}. |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3710 |
"badGC, badDrawable or coordinates not integer |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3711 |
or non float angle(s)" |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3712 |
|
0 | 3713 |
self primitiveFailed |
3714 |
! |
|
3715 |
||
3716 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
118 | 3717 |
"fill a polygon given by its points. |
3718 |
If any coordinate is not integer, an error is triggered." |
|
73 | 3719 |
|
3720 |
|numberOfPoints| |
|
0 | 3721 |
|
3722 |
numberOfPoints := aPolygon size. |
|
3723 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3724 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3725 |
Window win; |
73 | 3726 |
OBJ point, x, y; |
3727 |
int i, num; |
|
3728 |
XPoint *points; |
|
3729 |
XPoint qPoints[100]; |
|
377 | 3730 |
int mustFree = 0; |
73 | 3731 |
|
1209 | 3732 |
if (ISCONNECTED |
3733 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3734 |
&& __isExternalAddress(aDrawableId) |
97 | 3735 |
&& __isSmallInteger(numberOfPoints)) { |
1344 | 3736 |
gc = _GCVal(aGCId); |
3737 |
win = _WindowVal(aDrawableId); |
|
3738 |
num = __intVal(numberOfPoints); |
|
3739 |
if (num < 3) { |
|
3740 |
RETURN ( self ); |
|
3741 |
} |
|
3742 |
/* |
|
3743 |
* avoid (slow) malloc, if not many points |
|
3744 |
*/ |
|
3745 |
if (num > 100) { |
|
3746 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
|
3747 |
if (! points) goto fail; |
|
3748 |
mustFree = 1; |
|
3749 |
} else |
|
3750 |
points = qPoints; |
|
3751 |
for (i=0; i<num; i++) { |
|
3752 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
3753 |
if (! __isPoint(point)) goto fail; |
|
3754 |
x = _point_X(point); |
|
3755 |
y = _point_Y(point); |
|
3756 |
if (! __bothSmallInteger(x, y)) |
|
3757 |
goto fail; |
|
3758 |
points[i].x = __intVal(x); |
|
3759 |
points[i].y = __intVal(y); |
|
3760 |
} |
|
1974 | 3761 |
ENTER_XLIB(); |
1344 | 3762 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
1974 | 3763 |
LEAVE_XLIB(); |
1344 | 3764 |
if (mustFree) |
3765 |
free(points); |
|
3766 |
RETURN ( self ); |
|
377 | 3767 |
|
0 | 3768 |
fail: ; |
1344 | 3769 |
if (mustFree) |
3770 |
free(points); |
|
0 | 3771 |
} |
73 | 3772 |
%}. |
3773 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 3774 |
self primitiveFailed |
3775 |
! |
|
3776 |
||
295 | 3777 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
3778 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
3779 |
||
3780 |
%{ /* NOCONTEXT */ |
|
3781 |
||
3782 |
int w, h; |
|
3783 |
||
1209 | 3784 |
if (ISCONNECTED |
3785 |
&& __isExternalAddress(aGCId) |
|
295 | 3786 |
&& __isExternalAddress(aDrawableId) |
3787 |
&& __bothSmallInteger(x, y) |
|
3788 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3789 |
w = __intVal(width); |
3790 |
h = __intVal(height); |
|
3791 |
/* |
|
3792 |
* need this check here: some servers simply dump core with bad args |
|
3793 |
*/ |
|
3794 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 3795 |
ENTER_XLIB(); |
1344 | 3796 |
XFillRectangle(myDpy, |
3797 |
(Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), |
|
3798 |
__intVal(x), __intVal(y), w, h); |
|
1974 | 3799 |
LEAVE_XLIB(); |
1344 | 3800 |
} |
3801 |
RETURN ( self ); |
|
295 | 3802 |
} |
3803 |
%}. |
|
3804 |
"badGC, badDrawable or coordinates not integer" |
|
3805 |
self primitiveFailed |
|
43 | 3806 |
! |
3807 |
||
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3808 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3809 |
width:imageWidth height:imageHeight |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3810 |
x:srcx y:srcy |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3811 |
into:aDrawableId |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3812 |
x:dstx y:dsty |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3813 |
width:w height:h |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3814 |
with:aGCId |
0 | 3815 |
|
132 | 3816 |
"since XPutImage may allocate huge amount of stack space |
3817 |
(some implementations use alloca), this must run with unlimited stack." |
|
3818 |
||
12 | 3819 |
%{ /* UNLIMITEDSTACK */ |
0 | 3820 |
|
43 | 3821 |
/* |
3822 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
3823 |
* XPutImage |
|
3824 |
*/ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3825 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3826 |
Window win; |
43 | 3827 |
XImage image; |
377 | 3828 |
int imgWdth; |
43 | 3829 |
|
1209 | 3830 |
if (ISCONNECTED |
3831 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3832 |
&& __isExternalAddress(aDrawableId) |
97 | 3833 |
&& __bothSmallInteger(srcx, srcy) |
3834 |
&& __bothSmallInteger(dstx, dsty) |
|
3835 |
&& __bothSmallInteger(w, h) |
|
3836 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
3837 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3838 |
&& __isSmallInteger(bitPadding) |
43 | 3839 |
&& __isByteArray(imageBits)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3840 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3841 |
int pad = __intVal(bitPadding); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3842 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3843 |
gc = _GCVal(aGCId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3844 |
win = _WindowVal(aDrawableId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3845 |
if (! gc || !win) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3846 |
goto fail; |
46 | 3847 |
#ifdef ARGDEBUG |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3848 |
printf("args ok\n"); |
46 | 3849 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3850 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3851 |
image.width = imgWdth = __intVal(imageWidth); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3852 |
image.height = __intVal(imageHeight); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3853 |
image.xoffset = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3854 |
image.format = ZPixmap; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3855 |
image.byte_order = MSBFirst; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3856 |
image.bitmap_unit = 8; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3857 |
image.bitmap_bit_order = MSBFirst; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3858 |
image.bitmap_pad = pad; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3859 |
image.depth = __intVal(imageDepth); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3860 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3861 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3862 |
/* |
2021 | 3863 |
image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; |
3864 |
*/ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3865 |
image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3866 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3867 |
switch (image.bits_per_pixel) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3868 |
case 1: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3869 |
case 2: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3870 |
case 4: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3871 |
case 8: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3872 |
case 16: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3873 |
case 24: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3874 |
case 32: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3875 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3876 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3877 |
default: |
46 | 3878 |
#ifdef ARGDEBUG |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3879 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 3880 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3881 |
goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3882 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3883 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3884 |
image.red_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3885 |
image.green_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3886 |
image.blue_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3887 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3888 |
/* ENTER_XLIB(); */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3889 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3890 |
__intVal(dstx), __intVal(dsty), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3891 |
__intVal(w), __intVal(h)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3892 |
/* LEAVE_XLIB(); */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3893 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3894 |
RETURN ( true ); |
43 | 3895 |
} |
46 | 3896 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3897 |
if (!! __isExternalAddress(aGCId)) printf("GC\n"); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3898 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 3899 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
3900 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
3901 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
3902 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
3903 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
3904 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
3905 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
3906 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
3907 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
3908 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
3909 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 3910 |
#endif |
3911 |
||
0 | 3912 |
fail: ; |
3913 |
%} |
|
3914 |
. |
|
12 | 3915 |
^ false |
0 | 3916 |
! ! |
3917 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3918 |
!XWorkstation methodsFor:'event forwarding'! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3919 |
|
2385 | 3920 |
buttonPress:button x:x y:y view:aView |
3921 |
"forward a button-press event for some view" |
|
3922 |
||
3923 |
button == 1 ifTrue:[ |
|
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
3924 |
activateOnClick == true ifTrue:[ |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3925 |
"/ dont raise above an active popup view. |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3926 |
(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3927 |
aView topView raise. |
2386 | 3928 |
"/ ] ifFalse:[ |
3929 |
"/ activeKeyboardGrab printCR. |
|
3930 |
"/ activePointerGrab printCR. |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3931 |
] |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3932 |
]. |
2385 | 3933 |
]. |
3934 |
super buttonPress:button x:x y:y view:aView |
|
3935 |
||
3936 |
||
3937 |
||
3938 |
! |
|
3939 |
||
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3940 |
circulateNotifyView:aView |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3941 |
"sent, when the stacking order changes. |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3942 |
ignored for now." |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3943 |
|
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3944 |
! |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3945 |
|
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3946 |
circulateRequestView:aView |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3947 |
"sent, when the stacking order is about to change. |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3948 |
ignored for now." |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3949 |
! |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3950 |
|
1540 | 3951 |
clientMessage:event dataOffset:offs view:targetView |
1757 | 3952 |
self halt:'debug halt: unimplemented client message'. |
1540 | 3953 |
|
3954 |
"Created: 4.4.1997 / 17:23:12 / cg" |
|
1757 | 3955 |
"Modified: 17.6.1997 / 18:04:24 / cg" |
1540 | 3956 |
! |
3957 |
||
1543 | 3958 |
clientMessage:event type:type format:format dataOffset:offs view:targetView |
3959 |
|sensor data| |
|
3960 |
||
3961 |
data := event copyFrom:offs + 1. |
|
3962 |
||
3963 |
"/ DND drag&drop protocol |
|
3964 |
type == (self atomIDOf:'DndProtocol') ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3965 |
format == 32 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3966 |
self dndMessage:event data:data view:targetView. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3967 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3968 |
] |
1543 | 3969 |
]. |
3970 |
||
3971 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3972 |
sensor clientMessage:type format:format eventData:data view:targetView |
1543 | 3973 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3974 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3975 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3976 |
" |
1543 | 3977 |
] |
3978 |
||
3979 |
"Created: 4.4.1997 / 17:49:26 / cg" |
|
3980 |
"Modified: 4.4.1997 / 18:00:18 / cg" |
|
3981 |
! |
|
3982 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3983 |
colorMapChangeView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3984 |
"sent, when another colormap is installed. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3985 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3986 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3987 |
aView colorMapChange |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3988 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3989 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3990 |
configureRequestView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3991 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3992 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3993 |
"/ aView configureRequest |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3994 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3995 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3996 |
createdView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3997 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3998 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3999 |
"/ aView created |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4000 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4001 |
|
1543 | 4002 |
dndMessage:event data:data view:targetView |
4003 |
"handle a DND drag&drop protocol message" |
|
4004 |
||
1553 | 4005 |
|sensor dropType dropValue names i1 i2 t| |
1543 | 4006 |
|
4007 |
dropType := data doubleWordAt:1. |
|
4008 |
||
4009 |
"/ see def's in DragAndDropTypes.h |
|
1556 | 4010 |
dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. |
1543 | 4011 |
|
4012 |
self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4013 |
getProperty:(self atomIDOf:'DndSelection') |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4014 |
from:rootId |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4015 |
into:[:type :value | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4016 |
t := type. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4017 |
dropValue := value |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4018 |
]. |
1543 | 4019 |
|
1558 | 4020 |
"/ preconvert into a collection |
4021 |
"/ of fileNames, string or byteArray |
|
4022 |
"/ Notice: we do not yet convert into dropObjects |
|
4023 |
"/ here, to allow arbitrary data to be handled by |
|
4024 |
"/ redefined dropMessage methods in applications. |
|
4025 |
"/ Conversion is done for some well known types |
|
4026 |
"/ in the default dropMessage handling of SimpleView. |
|
4027 |
||
1543 | 4028 |
dropType == #DndFiles ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4029 |
"/ actually, a list of fileNames |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4030 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4031 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4032 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4033 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4034 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4035 |
names := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4036 |
i1 := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4037 |
[i1 ~~ 0] whileTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4038 |
i2 := dropValue indexOf:(Character value:0) startingAt:i1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4039 |
i2 ~~ 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4040 |
names add:(dropValue copyFrom:i1 to:(i2-1)). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4041 |
i1 := i2 + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4042 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4043 |
i1 := i2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4044 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4045 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4046 |
dropValue := names. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4047 |
dropValue := dropValue collect:[:nm | nm asFilename]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4048 |
dropType := #files. |
1558 | 4049 |
] ifFalse:[ (dropType == #DndFile) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4050 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4051 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4052 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4053 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4054 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4055 |
dropValue := dropValue asFilename. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4056 |
dropType := #file. |
1558 | 4057 |
] ifFalse:[ (dropType == #DndDir) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4058 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4059 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4060 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4061 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4062 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4063 |
dropValue := dropValue asFilename. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4064 |
dropType := #directory. |
1558 | 4065 |
] ifFalse:[ (dropType == #DndText) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4066 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4067 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4068 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4069 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4070 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4071 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4072 |
dropType := #text. |
1558 | 4073 |
] ifFalse:[ (dropType == #DndExe) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4074 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4075 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4076 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4077 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4078 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4079 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4080 |
dropType := #executable. |
1558 | 4081 |
] ifFalse:[ (dropType == #DndLink) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4082 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4083 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4084 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4085 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4086 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4087 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4088 |
dropType := #link. |
1558 | 4089 |
] ifFalse:[ (dropType == #DndRawData) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4090 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4091 |
dropType := #rawData. |
1552 | 4092 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4093 |
'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4094 |
'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4095 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4096 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4097 |
dropType := #unknown. |
1558 | 4098 |
]]]]]]]. |
1543 | 4099 |
|
4100 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4101 |
sensor dropMessage:dropType data:dropValue view:targetView |
1543 | 4102 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4103 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4104 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4105 |
" |
1543 | 4106 |
] |
4107 |
||
4108 |
"Created: 4.4.1997 / 17:59:37 / cg" |
|
1558 | 4109 |
"Modified: 6.4.1997 / 14:50:44 / cg" |
1543 | 4110 |
! |
4111 |
||
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4112 |
gravityNotifyView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4113 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4114 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4115 |
"/ aView gravityNotify |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4116 |
! |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4117 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4118 |
mapRequestView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4119 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4120 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4121 |
"/ aView mapRequest |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4122 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4123 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4124 |
propertyChangeView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4125 |
"sent when an X property changes. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4126 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4127 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4128 |
aView propertyChange |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4129 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4130 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4131 |
reparentedView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4132 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4133 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4134 |
"/ aView reparented |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4135 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4136 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4137 |
resizeRequestView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4138 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4139 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4140 |
"/ aView resizeRequest |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4141 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4142 |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4143 |
selectionClear:selectionID view:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4144 |
"sent when another X-client has created a selection. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4145 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4146 |
|
1344 | 4147 |
"/ |
4148 |
"/ workaround a bug in olvwm: it clears selections |
|
4149 |
"/ on window raise. |
|
4150 |
"/ In this case, keep my last own selection. |
|
4151 |
"/ |
|
4152 |
||
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4153 |
self setLastCopyBuffer:(self getCopyBuffer). |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4154 |
self setCopyBuffer:nil |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4155 |
|
1795 | 4156 |
"/ noone is interested in that ... |
1344 | 4157 |
"/ aView selectionClear:selectionID |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4158 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4159 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4160 |
selectionNotify:propertyID target:targetID selection:selectionID from:requestorID view:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4161 |
"sent when the server returns an answer from a request for a selection. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4162 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4163 |
|
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4164 |
|s sensor| |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4165 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4166 |
propertyID == 0 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4167 |
"invalid olvwm behavior" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4168 |
s := self getLastCopyBuffer |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4169 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4170 |
targetID == self atomIDOfSTRING ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4171 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4172 |
a returned string |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4173 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4174 |
s := self getTextProperty:propertyID from:requestorID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4175 |
s notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4176 |
(s endsWith:Character cr) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4177 |
s := s asStringCollection copyWith:'' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4178 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4179 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4180 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4181 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4182 |
a returned object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4183 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4184 |
s := self getObjectProperty:propertyID from:requestorID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4185 |
]. |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4186 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4187 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4188 |
s notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4189 |
(sensor := aView sensor) notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4190 |
sensor pasteFromClipBoard:s view:aView |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4191 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4192 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4193 |
if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4194 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4195 |
aView pasteFromClipBoard:s |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4196 |
] |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4197 |
] |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4198 |
! |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4199 |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4200 |
selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4201 |
"sent by some other X-client to ask for the selection. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4202 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4203 |
|
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4204 |
|o s stream| |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4205 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4206 |
targetID == (self atomIDOfLENGTH) ifTrue:[ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4207 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4208 |
"/ the other one wants to know the size of our selection ... |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4209 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4210 |
s := self selectionAsString. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4211 |
self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4212 |
setLengthProperty:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4213 |
value:s size |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4214 |
for:windowID. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4215 |
self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4216 |
sendSelectionNotifySelection:selectionID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4217 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4218 |
target:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4219 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4220 |
from:aView id |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4221 |
to:windowID. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4222 |
^ self |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4223 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4224 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4225 |
(targetID == self atomIDOfSTRING or:[ |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4226 |
targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4227 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4228 |
"/ the other view wants the selection as string |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4229 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4230 |
s := self selectionAsString. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4231 |
self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4232 |
sendSelection:s |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4233 |
selection:primaryAtom |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4234 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4235 |
target:self atomIDOfSTRING "/ targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4236 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4237 |
from:windowID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4238 |
to:windowID. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4239 |
^ self |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4240 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4241 |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4242 |
"/ (targetID == (self atomIDOf:'TARGETS')) ifTrue:[ |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4243 |
"/"/ TODO: implement this to avoid netscape paste-delay. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4244 |
"/"/ |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4245 |
"/ ^ self |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4246 |
"/ ]. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4247 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4248 |
(targetID == (self atomIDOf:'ST_OBJECT')) ifTrue:[ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4249 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4250 |
"/ send the selection in binaryStore format |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4251 |
"/ (assuming, that the other view knows how to handle it) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4252 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4253 |
o := self getCopyBuffer. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4254 |
stream := WriteStream on:(ByteArray new:200). |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4255 |
o storeBinaryOn:stream. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4256 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4257 |
^ self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4258 |
sendSelection:(stream contents) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4259 |
selection:primaryAtom |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4260 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4261 |
target:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4262 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4263 |
from:windowID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4264 |
to:windowID |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4265 |
]. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4266 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4267 |
"Created: / 17.6.1998 / 19:33:10 / cg" |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4268 |
"Modified: / 17.6.1998 / 20:24:40 / cg" |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4269 |
! ! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4270 |
|
86 | 4271 |
!XWorkstation methodsFor:'event handling'! |
0 | 4272 |
|
2977
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4273 |
defaultEventMask |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4274 |
"return a mask to enable some events by default." |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4275 |
|
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4276 |
%{ /* NOCONTEXT */ |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4277 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4278 |
KeyPressMask | KeyReleaseMask | |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4279 |
PointerMotionMask | |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4280 |
EnterWindowMask | LeaveWindowMask | |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4281 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4282 |
%} |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4283 |
! |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4284 |
|
0 | 4285 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
4286 |
"central event handling method: |
|
54 | 4287 |
get next event and send appropriate message to the sensor or view. |
0 | 4288 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
12 | 4289 |
otherwise only events for the view with given id are processed. |
4290 |
If the argument aMask is nonNil, only events for this eventMask are |
|
1871 | 4291 |
handled. |
4292 |
WARNING: this may block to wait for an event - you better check for a |
|
1906 | 4293 |
pending event before calling this." |
12 | 4294 |
|
54 | 4295 |
(self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[ |
1906 | 4296 |
AbortSignal handle:[:ex | |
4297 |
ex return |
|
4298 |
] do:[ |
|
4299 |
self dispatchLastEvent. |
|
4300 |
] |
|
54 | 4301 |
]. |
1489
f264f7852a8d
avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents:
1486
diff
changeset
|
4302 |
|
1871 | 4303 |
"Modified: 19.8.1997 / 17:10:42 / cg" |
12 | 4304 |
! |
4305 |
||
295 | 4306 |
dispatchExposeEventFor:aViewIdOrNil |
4307 |
"get next expose event and send appropriate message to the sensor or view. |
|
4308 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
1871 | 4309 |
otherwise only events for the view with given id are processed. |
4310 |
WARNING: this may block to wait for an event - you better check for a |
|
1906 | 4311 |
pending event before calling this." |
295 | 4312 |
|
4313 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
|
1871 | 4314 |
|
4315 |
"Modified: 19.8.1997 / 17:10:26 / cg" |
|
12 | 4316 |
! |
4317 |
||
4318 |
dispatchLastEvent |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4319 |
|theView symS arg butt sibling |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4320 |
windowID siblingID propertyID selectionID targetID requestorID |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4321 |
evTime |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4322 |
eventType| |
12 | 4323 |
|
4324 |
%{ /* STACK: 8000 */ |
|
4325 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
|
0 | 4326 |
|
1209 | 4327 |
Display *dpy; |
135 | 4328 |
OBJ eB; |
4329 |
XEvent *ev; |
|
1521
23aacd62bbac
care for GC before reaccessing the eventBuffer
Claus Gittinger <cg@exept.de>
parents:
1511
diff
changeset
|
4330 |
int ev_x, ev_y; |
135 | 4331 |
|
4332 |
# define ae ((XAnyEvent *)ev) |
|
4333 |
# define ee ((XExposeEvent *)ev) |
|
4334 |
# define ke ((XKeyPressedEvent *)ev) |
|
4335 |
# define be ((XButtonPressedEvent *)ev) |
|
4336 |
# define ce ((XConfigureEvent *)ev) |
|
4337 |
# define me ((XMotionEvent *)ev) |
|
4338 |
# define ewe ((XEnterWindowEvent *)ev) |
|
4339 |
# define lwe ((XLeaveWindowEvent *)ev) |
|
4340 |
# define de ((XDestroyWindowEvent *)ev) |
|
4341 |
# define ve ((XVisibilityEvent *)ev) |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4342 |
# define mape ((XMappingEvent *)ev) |
135 | 4343 |
|
0 | 4344 |
KeySym keySym; |
4345 |
unsigned char buffer[10]; |
|
4346 |
int i, nchars; |
|
4347 |
char *keySymString; |
|
4348 |
char keySymStringBuffer[32]; |
|
1832 | 4349 |
unsigned INT nextMultiClickTime; |
1223
09d8118c8031
keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
4350 |
OBJ upDown, t; |
115 | 4351 |
|
4352 |
struct inlineCache *ipS; |
|
0 | 4353 |
static struct inlineCache vid = _ILC1; |
12 | 4354 |
|
4355 |
static struct inlineCache expS = _ILC5; |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
4356 |
static struct inlineCache gexpS = _ILC6; |
12 | 4357 |
static struct inlineCache nexpS = _ILC1; |
4358 |
static struct inlineCache motS = _ILC4; |
|
4359 |
static struct inlineCache bpS = _ILC4; |
|
4360 |
static struct inlineCache bmpS = _ILC4; |
|
4361 |
static struct inlineCache bspS = _ILC4; |
|
4362 |
static struct inlineCache brS = _ILC4; |
|
4363 |
static struct inlineCache focInS = _ILC1; |
|
4364 |
static struct inlineCache focOutS = _ILC1; |
|
4365 |
static struct inlineCache peS = _ILC4; |
|
4366 |
static struct inlineCache plS = _ILC2; |
|
54 | 4367 |
static struct inlineCache termS = _ILC1; |
4368 |
static struct inlineCache savtermS = _ILC1; |
|
4369 |
static struct inlineCache destrS = _ILC1; |
|
4370 |
static struct inlineCache unmapS = _ILC1; |
|
4371 |
static struct inlineCache mapS = _ILC1; |
|
4372 |
static struct inlineCache confS = _ILC5; |
|
70 | 4373 |
static struct inlineCache coveredS = _ILC2; |
1543 | 4374 |
static struct inlineCache clientMsg = _ILC5; |
12 | 4375 |
|
4376 |
static struct inlineCache keymap = _ILC0; |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4377 |
static struct inlineCache created = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4378 |
static struct inlineCache mapReq = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4379 |
static struct inlineCache repar = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4380 |
static struct inlineCache confReq = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4381 |
static struct inlineCache resReq = _ILC1; |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
4382 |
static struct inlineCache circReq = _ILC1; |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
4383 |
static struct inlineCache circNotify = _ILC1; |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4384 |
static struct inlineCache gravNotify = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4385 |
static struct inlineCache prop = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4386 |
static struct inlineCache selClear = _ILC2; |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4387 |
static struct inlineCache selReq = _ILC6; |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4388 |
static struct inlineCache selNotify = _ILC5; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4389 |
static struct inlineCache colormap = _ILC1; |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4390 |
static struct inlineCache mapping = _ILC2; |
70 | 4391 |
static struct inlineCache vis = _ILC1; |
12 | 4392 |
|
4393 |
static struct inlineCache skpS = _ILC4; |
|
63 | 4394 |
static struct inlineCache skrS = _ILC4; |
12 | 4395 |
|
1209 | 4396 |
if (! ISCONNECTED) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4397 |
RETURN (false); |
1209 | 4398 |
} |
4399 |
||
4400 |
dpy = myDpy; |
|
4401 |
||
1210 | 4402 |
eB = __INST(eventBuffer); |
4403 |
||
135 | 4404 |
if (__isByteArray(eB)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4405 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
135 | 4406 |
} else { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4407 |
printf("DISPLAY: no eventBuffer\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4408 |
RETURN (false); |
135 | 4409 |
} |
4410 |
||
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4411 |
/* |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4412 |
* very often, its another event for the same view ... |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4413 |
* avoid creation & lookup then. |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4414 |
*/ |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4415 |
if ((t = __INST(lastId)) != nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4416 |
if (__isExternalAddress(t)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4417 |
if (_WindowVal(t) == ae->window) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4418 |
theView = __INST(lastView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4419 |
if (__isNonNilObject(theView)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4420 |
if (__qClass(theView) == nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4421 |
theView = nil; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4422 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4423 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4424 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4425 |
} |
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4426 |
} |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4427 |
|
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4428 |
if (theView == nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4429 |
windowID = __MKEXTERNALADDRESS(ae->window); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4430 |
theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4431 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4432 |
* MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4433 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4434 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4435 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4436 |
} |
12 | 4437 |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4438 |
if ((theView == nil) && (ev->type != MappingNotify)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4439 |
RETURN (nil); |
12 | 4440 |
} |
4441 |
||
4442 |
/* |
|
4443 |
* key, button and pointer events are sent to the sensor, |
|
4444 |
* or (if there is none) to the delegate. |
|
4445 |
* or (if there is none) to the view. |
|
26 | 4446 |
* |
4447 |
* expose events are sent to the sensor, |
|
4448 |
* or (if there is none) to the view |
|
4449 |
* |
|
12 | 4450 |
* sensor and delegate get view as additional argument |
115 | 4451 |
* all of this has been taken out of here to corresponding methods |
4452 |
* in DeviceWorkstation. |
|
12 | 4453 |
*/ |
90 | 4454 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4455 |
#ifdef DEBUG |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4456 |
eventType = __MKSMALLINT(ev->type); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4457 |
#endif |
135 | 4458 |
switch (ev->type) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4459 |
case KeyRelease: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4460 |
symS = @symbol(keyRelease:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4461 |
ipS = &skrS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4462 |
upDown = false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4463 |
goto keyPressAndRelease; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4464 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4465 |
case KeyPress: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4466 |
symS = @symbol(keyPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4467 |
ipS = &skpS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4468 |
upDown = true; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4469 |
/* FALL INTO */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4470 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4471 |
keyPressAndRelease: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4472 |
__INST(eventRootX) = __MKSMALLINT(ke->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4473 |
__INST(eventRootY) = __MKSMALLINT(ke->y_root); |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4474 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4475 |
__INST(altDown) = (ke->state & Mod2Mask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4476 |
__INST(metaDown) = (ke->state & Mod1Mask) ? true : false; |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4477 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4478 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4479 |
__INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4480 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4481 |
__INST(shiftDown) = (ke->state & ShiftMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4482 |
__INST(ctrlDown) = (ke->state & ControlMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4483 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4484 |
ev_x = ke->x; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4485 |
ev_y = ke->y; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4486 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4487 |
arg = nil; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4488 |
nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4489 |
if (nchars |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4490 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4491 |
|| (buffer[0] >= 0x80))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4492 |
arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4493 |
keySymString = NULL; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4494 |
} else { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4495 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4496 |
switch (keySym) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4497 |
case XK_Control_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4498 |
case XK_Control_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4499 |
__INST(ctrlDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4500 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4501 |
case XK_Shift_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4502 |
case XK_Shift_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4503 |
__INST(shiftDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4504 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4505 |
case XK_Meta_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4506 |
case XK_Meta_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4507 |
__INST(metaDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4508 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4509 |
case XK_Alt_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4510 |
case XK_Alt_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4511 |
__INST(altDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4512 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4513 |
} |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4514 |
#endif |
150 | 4515 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4516 |
keySymString = XKeysymToString(keySym); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4517 |
if (keySymString) { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4518 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4519 |
if (keySymString[0] == 'D') { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4520 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4521 |
* remove underscore, dont want it in symbols |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4522 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4523 |
if (strcmp(keySymString, "Delete_line") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4524 |
keySymString = "DeleteLine"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4525 |
} else if (strcmp(keySymString, "Delete_word") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4526 |
keySymString = "DeleteWord"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4527 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4528 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4529 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4530 |
* make names compatible |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4531 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4532 |
if (strcmp(keySymString, "Down") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4533 |
keySymString = "CursorDown"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4534 |
} else if (strcmp(keySymString, "Up") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4535 |
keySymString = "CursorUp"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4536 |
} else if (strcmp(keySymString, "Left") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4537 |
keySymString = "CursorLeft"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4538 |
} else if (strcmp(keySymString, "Right") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4539 |
keySymString = "CursorRight"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4540 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4541 |
arg = __MKSYMBOL(keySymString, (OBJ *)0); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4542 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4543 |
arg = __MKSTRING(keySymString); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4544 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4545 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4546 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4547 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4548 |
if (arg == nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4549 |
/* happens sometimes (alt-graph on sun has no keysym) */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4550 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4551 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4552 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4553 |
(*(*ipS).ilc_func)(self, symS, nil, ipS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4554 |
arg, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4555 |
__MKSMALLINT(ev_x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4556 |
__MKSMALLINT(ev_y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4557 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4558 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4559 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4560 |
case ButtonPress: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4561 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4562 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4563 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4564 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4565 |
if (__isSmallInteger(__INST(multiClickTimeDelta))) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4566 |
nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4567 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4568 |
nextMultiClickTime = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4569 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4570 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4571 |
if ((t = __INST(multiClickTime)) != nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4572 |
INT _multiClickTime; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4573 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4574 |
_multiClickTime = __longIntVal(t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4575 |
if (be->time < _multiClickTime) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4576 |
__INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4577 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4578 |
* MKUINT could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4579 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4580 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4581 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4582 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4583 |
ipS = &bmpS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4584 |
symS = @symbol(buttonMultiPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4585 |
goto sendButtonEvent; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4586 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4587 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4588 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4589 |
__INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4590 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4591 |
* MKUINT could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4592 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4593 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4594 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1223
09d8118c8031
keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
4595 |
|
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
4596 |
#ifdef NO_LONGER |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4597 |
if (be->state & ShiftMask) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4598 |
ipS = &bspS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4599 |
symS = @symbol(buttonShiftPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4600 |
goto sendButtonEvent; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4601 |
} |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
4602 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4603 |
ipS = &bpS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4604 |
symS = @symbol(buttonPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4605 |
goto sendButtonEvent; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4606 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4607 |
/* NOT REACHED */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4608 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4609 |
case ButtonRelease: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4610 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4611 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4612 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4613 |
ipS = &brS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4614 |
symS = @symbol(buttonRelease:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4615 |
/* fall into */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4616 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4617 |
sendButtonEvent: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4618 |
butt = __MKSMALLINT(be->button); |
12 | 4619 |
#ifdef NOTDEF |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4620 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4621 |
* this allows operation with single button mouses: meta-click is always Button 2 |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4622 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4623 |
if (__INST(metaDown) == true) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4624 |
butt = __MKSMALLINT(2); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4625 |
else |
0 | 4626 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4627 |
butt = __AT_(__INST(buttonTranslation), butt); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4628 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4629 |
* #at: could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4630 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4631 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4632 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4633 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4634 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4635 |
(*(*ipS).ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4636 |
symS, nil, ipS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4637 |
butt, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4638 |
__MKSMALLINT(ke->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4639 |
__MKSMALLINT(ke->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4640 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4641 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4642 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4643 |
case MotionNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4644 |
if (__INST(motionEventCompression) != false) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4645 |
while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4646 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4647 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4648 |
__INST(eventRootX) = __MKSMALLINT(me->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4649 |
__INST(eventRootY) = __MKSMALLINT(me->y_root); |
70 | 4650 |
|
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4651 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4652 |
__INST(altDown) = (me->state & Mod2Mask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4653 |
__INST(metaDown) = (me->state & Mod1Mask) ? true : false; |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4654 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4655 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4656 |
__INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4657 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4658 |
__INST(shiftDown) = (me->state & ShiftMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4659 |
__INST(ctrlDown) = (me->state & ControlMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4660 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4661 |
(*motS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4662 |
@symbol(buttonMotion:x:y:view:), nil, &motS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4663 |
__MKSMALLINT(me->state), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4664 |
__MKSMALLINT(me->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4665 |
__MKSMALLINT(me->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4666 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4667 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4668 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4669 |
case FocusIn: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4670 |
(*focInS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4671 |
@symbol(focusInView:), nil, &focInS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4672 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4673 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4674 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4675 |
case FocusOut: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4676 |
(*focOutS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4677 |
@symbol(focusOutView:), nil, &focOutS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4678 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4679 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4680 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4681 |
case EnterNotify: |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4682 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4683 |
__INST(altDown) = (ewe->state & Mod2Mask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4684 |
__INST(metaDown) = (ewe->state & Mod1Mask) ? true : false; |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4685 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4686 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4687 |
__INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false; |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4688 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4689 |
__INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4690 |
__INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4691 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4692 |
(*peS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4693 |
@symbol(pointerEnter:x:y:view:), nil, &peS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4694 |
__MKSMALLINT(ewe->state), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4695 |
__MKSMALLINT(ewe->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4696 |
__MKSMALLINT(ewe->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4697 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4698 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4699 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4700 |
case LeaveNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4701 |
(*plS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4702 |
@symbol(pointerLeave:view:), nil, &plS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4703 |
__MKSMALLINT(lwe->state), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4704 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4705 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4706 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4707 |
case GraphicsExpose: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4708 |
(*gexpS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4709 |
@symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4710 |
__MKSMALLINT(ee->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4711 |
__MKSMALLINT(ee->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4712 |
__MKSMALLINT(ee->width), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4713 |
__MKSMALLINT(ee->height), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4714 |
ee->count == 0 ? true : false, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4715 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4716 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4717 |
if (ee->count != 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4718 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4719 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4720 |
/* fall into */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4721 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4722 |
case NoExpose: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4723 |
(*nexpS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4724 |
@symbol(noExposeView:), nil, &nexpS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4725 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4726 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4727 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4728 |
case Expose: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4729 |
(*expS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4730 |
@symbol(exposeX:y:width:height:view:), nil, &expS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4731 |
__MKSMALLINT(ee->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4732 |
__MKSMALLINT(ee->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4733 |
__MKSMALLINT(ee->width), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4734 |
__MKSMALLINT(ee->height), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4735 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4736 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4737 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4738 |
case ConfigureNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4739 |
if (ce->above != None) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4740 |
siblingID = __MKEXTERNALADDRESS(ce->above); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4741 |
sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4742 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4743 |
* MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4744 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4745 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4746 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4747 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4748 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4749 |
(*confS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4750 |
@symbol(configureX:y:width:height:view:), nil, &confS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4751 |
__MKSMALLINT(ce->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4752 |
__MKSMALLINT(ce->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4753 |
__MKSMALLINT(ce->width), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4754 |
__MKSMALLINT(ce->height), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4755 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4756 |
if (sibling != nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4757 |
(*coveredS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4758 |
@symbol(coveredBy:view:), nil, &coveredS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4759 |
theView, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4760 |
sibling); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4761 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4762 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4763 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4764 |
case ClientMessage: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4765 |
if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4766 |
if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom))) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4767 |
|| (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4768 |
(*termS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4769 |
@symbol(terminateView:), nil, &termS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4770 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4771 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4772 |
if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4773 |
(*savtermS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4774 |
@symbol(saveAndTerminateView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4775 |
, nil, &savtermS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4776 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4777 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4778 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4779 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4780 |
* any other client message |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4781 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4782 |
i = (char *)(&(ev->xclient.data)) - (char *)ev; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4783 |
(*clientMsg.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4784 |
@symbol(clientMessage:type:format:dataOffset:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4785 |
, nil, &clientMsg |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4786 |
, __INST(eventBuffer) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4787 |
,__MKSMALLINT(ev->xclient.message_type) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4788 |
,__MKSMALLINT(ev->xclient.format) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4789 |
,__MKSMALLINT(i), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4790 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4791 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4792 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4793 |
case DestroyNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4794 |
(*destrS.ilc_func)(self, @symbol(destroyedView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4795 |
, nil, &destrS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4796 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4797 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4798 |
case UnmapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4799 |
(*unmapS.ilc_func)(self, @symbol(unmappedView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4800 |
, nil, &unmapS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4801 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4802 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4803 |
case MapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4804 |
(*mapS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4805 |
@symbol(mappedView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4806 |
, nil, &mapS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4807 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4808 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4809 |
case KeymapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4810 |
(*keymap.ilc_func)(theView, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4811 |
@symbol(keyMapChange) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4812 |
, nil, &keymap); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4813 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4814 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4815 |
case VisibilityNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4816 |
switch (ve->state) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4817 |
case VisibilityUnobscured: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4818 |
arg = @symbol(unobscured); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4819 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4820 |
case VisibilityPartiallyObscured: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4821 |
arg = @symbol(partiallyObscured); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4822 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4823 |
case VisibilityFullyObscured: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4824 |
arg = @symbol(fullyObscured); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4825 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4826 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4827 |
(*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4828 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4829 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4830 |
case CreateNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4831 |
(*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4832 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4833 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4834 |
case MapRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4835 |
(*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4836 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4837 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4838 |
case ReparentNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4839 |
(*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4840 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4841 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4842 |
case ConfigureRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4843 |
(*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4844 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4845 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4846 |
case GravityNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4847 |
(*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4848 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4849 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4850 |
case ResizeRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4851 |
(*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4852 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4853 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4854 |
case CirculateNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4855 |
(*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4856 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4857 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4858 |
case CirculateRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4859 |
(*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4860 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4861 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4862 |
case PropertyNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4863 |
(*prop.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4864 |
@symbol(propertyChangeView) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4865 |
, nil, &prop, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4866 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4867 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4868 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4869 |
case SelectionClear: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4870 |
selectionID = __MKATOMOBJ(ev->xselectionclear.selection); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4871 |
(*selClear.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4872 |
@symbol(selectionClear:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4873 |
, nil, &selClear, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4874 |
selectionID, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4875 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4876 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4877 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4878 |
case SelectionNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4879 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4880 |
* returned selection value (answer from SelectionRequest) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4881 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4882 |
DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4883 |
ev->xselection.property, ev->xselection.target, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4884 |
ev->xselection.selection, ev->xselection.requestor)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4885 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4886 |
{ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4887 |
INT _property = ev->xselection.property; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4888 |
INT _target = ev->xselection.target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4889 |
INT _selection = ev->xselection.selection; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4890 |
INT _requestor = ev->xselection.requestor; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4891 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4892 |
propertyID = __MKATOMOBJ(_property); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4893 |
targetID = __MKATOMOBJ(_target); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4894 |
selectionID = __MKATOMOBJ(_selection); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4895 |
requestorID = __MKEXTERNALADDRESS(_requestor); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4896 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4897 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4898 |
* MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4899 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4900 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4901 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4902 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4903 |
(*selNotify.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4904 |
@symbol(selectionNotify:target:selection:from:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4905 |
, nil, &selNotify, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4906 |
propertyID, targetID, selectionID, requestorID, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4907 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4908 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4909 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4910 |
case SelectionRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4911 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4912 |
* someone wants the selection |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4913 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4914 |
DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4915 |
ev->xselectionrequest.property, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4916 |
ev->xselectionrequest.target, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4917 |
ev->xselectionrequest.selection, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4918 |
ev->xselectionrequest.requestor)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4919 |
{ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4920 |
INT _property = ev->xselectionrequest.property; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4921 |
INT _target = ev->xselectionrequest.target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4922 |
INT _selection = ev->xselectionrequest.selection; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4923 |
INT _requestor = ev->xselectionrequest.requestor; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4924 |
INT _t = ev->xselectionrequest.time; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4925 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4926 |
propertyID = __MKATOMOBJ(_property); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4927 |
targetID = __MKATOMOBJ(_target); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4928 |
selectionID = __MKATOMOBJ(_selection); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4929 |
requestorID = __MKEXTERNALADDRESS(_requestor); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4930 |
evTime = __MKEXTERNALADDRESS(_t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4931 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4932 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4933 |
* MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4934 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4935 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4936 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4937 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4938 |
(*selReq.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4939 |
@symbol(selectionRequest:target:selection:time:from:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4940 |
, nil, &selReq, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4941 |
propertyID, targetID, selectionID, evTime, requestorID, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4942 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4943 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4944 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4945 |
case ColormapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4946 |
(*colormap.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4947 |
@symbol(colorMapChangeView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4948 |
, nil, &colormap, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4949 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4950 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4951 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4952 |
case MappingNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4953 |
switch(mape->request) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4954 |
case MappingModifier: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4955 |
arg = @symbol(mappingModifier); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4956 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4957 |
case MappingKeyboard: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4958 |
arg = @symbol(mappingKeyboard); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4959 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4960 |
case MappingPointer: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4961 |
arg = @symbol(mappingPointer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4962 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4963 |
default: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4964 |
arg = nil; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4965 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4966 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4967 |
(*mapping.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4968 |
@symbol(mappingChanged:event:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4969 |
, nil, &mapping, arg, eB); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4970 |
break; |
0 | 4971 |
} |
135 | 4972 |
#undef ae |
0 | 4973 |
#undef ee |
4974 |
#undef ke |
|
4975 |
#undef be |
|
4976 |
#undef ce |
|
4977 |
#undef me |
|
4978 |
#undef ewe |
|
4979 |
#undef lwe |
|
4980 |
#undef de |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4981 |
#undef mape |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4982 |
%}. |
0 | 4983 |
^ true |
4984 |
! |
|
4985 |
||
1344 | 4986 |
dispatchPendingEvents |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4987 |
"central event handling method for modal operation. |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4988 |
(i.e. this is now only used in the modal debugger) |
1871 | 4989 |
Dispatch any pending events; return when no more are pending. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4990 |
This code is somewhat special, since X has a concept of graphic |
295 | 4991 |
expose events (which are sent after a bitblt). After such a bitblt, |
4992 |
we only handle exposes until the graphicsExpose arrives. |
|
4993 |
Other systems may not need such a kludge" |
|
4994 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
4995 |
"interested in exposes only ?" |
295 | 4996 |
dispatchingExpose notNil ifTrue:[ |
1906 | 4997 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
4998 |
self dispatchExposeEventFor:dispatchingExpose |
|
4999 |
]. |
|
5000 |
^ self |
|
295 | 5001 |
]. |
5002 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5003 |
[self eventPendingWithSync:false] whileTrue:[ |
1906 | 5004 |
(self getEventFor:nil withMask:nil) ifTrue:[ |
5005 |
AbortSignal handle:[:ex | |
|
5006 |
ex return |
|
5007 |
] do:[ |
|
5008 |
self dispatchLastEvent |
|
5009 |
] |
|
5010 |
]. |
|
295 | 5011 |
] |
1489
f264f7852a8d
avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents:
1486
diff
changeset
|
5012 |
|
1871 | 5013 |
"Modified: 19.8.1997 / 17:11:18 / cg" |
295 | 5014 |
! |
5015 |
||
1344 | 5016 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
81 | 5017 |
"dispose (throw away) specific events. If aWindowId is nil, |
5018 |
events matching the mask are thrown away regardless of which |
|
5019 |
view they are for. Otherwise, only matching events for that |
|
5020 |
view are flushed." |
|
0 | 5021 |
|
5022 |
%{ /* NOCONTEXT */ |
|
5023 |
||
5024 |
XEvent ev; |
|
5025 |
Window win; |
|
5026 |
||
1209 | 5027 |
if (ISCONNECTED |
5028 |
&& __isSmallInteger(aMask)) { |
|
1344 | 5029 |
Display *dpy = myDpy; |
5030 |
||
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5031 |
ENTER_XLIB(); |
1344 | 5032 |
if (__isExternalAddress(aWindowIdOrNil)) { |
5033 |
win = _WindowVal(aWindowIdOrNil); |
|
5034 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
|
5035 |
} else { |
|
5036 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
|
5037 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5038 |
LEAVE_XLIB(); |
1344 | 5039 |
RETURN ( self ); |
0 | 5040 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
5041 |
%}. |
0 | 5042 |
self primitiveFailed |
5043 |
! |
|
5044 |
||
1344 | 5045 |
eventMaskFor:anEventSymbol |
295 | 5046 |
"return the eventMask bit-constant corresponding to an event symbol" |
5047 |
||
5048 |
%{ /* NOCONTEXT */ |
|
5049 |
||
5050 |
int m = 0; |
|
5051 |
||
5052 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
|
5053 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
|
5054 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
|
5055 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
|
5056 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
|
5057 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
|
5058 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
|
5059 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
|
5060 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
|
5061 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
|
5062 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
|
5063 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
|
5064 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
|
5065 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
|
5066 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
|
5067 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5068 |
RETURN (__MKSMALLINT(m)); |
295 | 5069 |
%} |
5070 |
! |
|
5071 |
||
1344 | 5072 |
eventPending |
310 | 5073 |
"return true, if any event is pending. |
5074 |
This looks for both the internal queue and the display connection." |
|
12 | 5075 |
|
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5076 |
"/ ConservativeSync is required for some Xlib implementation, |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5077 |
"/ where eventPending returns wrong if we do not flush the buffer. |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5078 |
"/ (especially Win32 & Xlib) |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5079 |
|
2594
0b1a2d11b658
oops - win32 ConservativeSync
Claus Gittinger <cg@exept.de>
parents:
2592
diff
changeset
|
5080 |
ConservativeSync == true ifTrue:[self sync]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5081 |
|
12 | 5082 |
dispatchingExpose notNil ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
5083 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
12 | 5084 |
]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5085 |
^ self eventPendingWithSync:false |
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5086 |
|
2594
0b1a2d11b658
oops - win32 ConservativeSync
Claus Gittinger <cg@exept.de>
parents:
2592
diff
changeset
|
5087 |
"Modified: / 28.4.1999 / 11:08:12 / cg" |
0 | 5088 |
! |
5089 |
||
1344 | 5090 |
eventPending:anEventSymbol for:aWindowIdOrNil |
295 | 5091 |
"return true, if a specific event is pending" |
5092 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5093 |
^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5094 |
! |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5095 |
|
1344 | 5096 |
eventPendingWithSync:doSync |
7 | 5097 |
"return true, if any event is pending. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5098 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
310 | 5099 |
before checking." |
0 | 5100 |
|
12 | 5101 |
%{ /* UNLIMITEDSTACK */ |
1974 | 5102 |
OBJ rslt = false; |
0 | 5103 |
|
150 | 5104 |
if (ISCONNECTED) { |
1344 | 5105 |
Display *dpy = myDpy; |
5106 |
||
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5107 |
if (XEventsQueued(dpy, QueuedAlready)) { |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5108 |
RETURN (true); |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5109 |
} |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5110 |
|
1974 | 5111 |
ENTER_XLIB(); |
1344 | 5112 |
if (doSync == true) { |
5113 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5114 |
} |
|
5115 |
if (XPending(dpy)) { |
|
1974 | 5116 |
rslt = true; |
5117 |
} |
|
5118 |
LEAVE_XLIB(); |
|
5119 |
} |
|
5120 |
RETURN ( rslt ); |
|
0 | 5121 |
%} |
5122 |
! |
|
5123 |
||
1344 | 5124 |
eventQueued |
341 | 5125 |
"return true, if any event is queued" |
5126 |
||
5127 |
dispatchingExpose notNil ifTrue:[ |
|
1344 | 5128 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
341 | 5129 |
]. |
5130 |
^ self eventQueuedAlready |
|
5131 |
||
5132 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
|
5133 |
! |
|
5134 |
||
1344 | 5135 |
eventQueuedAlready |
341 | 5136 |
"return true, if any event is queued internally. |
5137 |
(i.e. in X's internal event queue, which is both filled by explicit |
|
5138 |
nextEvent calls AND whenever drawing is done and events are pending on |
|
5139 |
the display connection)." |
|
5140 |
||
5141 |
%{ /* UNLIMITEDSTACK */ |
|
1974 | 5142 |
OBJ rslt = false; |
341 | 5143 |
|
5144 |
if (ISCONNECTED) { |
|
2952
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5145 |
/* ENTER ... LEAVE not needed; XEventsQueued will not block */ |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5146 |
/* ENTER_XLIB(); */ |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5147 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5148 |
rslt = true; |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5149 |
} |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5150 |
/* LEAVE_XLIB(); */ |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5151 |
} |
b86deefe21c9
Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents:
2905
diff
changeset
|
5152 |
RETURN ( rslt ); |
341 | 5153 |
%} |
5154 |
! |
|
5155 |
||
1344 | 5156 |
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync |
295 | 5157 |
"return true, if any of the masked events is pending" |
5158 |
||
5159 |
%{ /* UNLIMITEDSTACK */ |
|
5160 |
||
5161 |
XEvent ev; |
|
5162 |
Window win; |
|
5163 |
int thereIsOne; |
|
1974 | 5164 |
OBJ rslt = false; |
295 | 5165 |
|
5166 |
if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
|
1344 | 5167 |
Display *dpy = myDpy; |
5168 |
||
1974 | 5169 |
ENTER_XLIB(); |
1344 | 5170 |
if (doSync == true) { |
5171 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5172 |
} |
|
5173 |
if (__isExternalAddress(aWindowIdOrNil)) { |
|
5174 |
win = _WindowVal(aWindowIdOrNil); |
|
5175 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
|
5176 |
} else { |
|
5177 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
|
5178 |
} |
|
5179 |
if (thereIsOne) { |
|
5180 |
XPutBackEvent(dpy, &ev); |
|
1974 | 5181 |
rslt = true; |
5182 |
} |
|
5183 |
LEAVE_XLIB(); |
|
5184 |
} |
|
5185 |
RETURN ( rslt ); |
|
295 | 5186 |
%} |
5187 |
! |
|
5188 |
||
1344 | 5189 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
310 | 5190 |
"return true, if any expose event is pending for a specific view, |
5191 |
or any view (if the arg is nil). |
|
5192 |
This is an X specific, only required after a scroll operation." |
|
7 | 5193 |
|
12 | 5194 |
%{ /* UNLIMITEDSTACK */ |
7 | 5195 |
|
5196 |
XEvent ev; |
|
5197 |
Window win; |
|
81 | 5198 |
int thereIsOne; |
1974 | 5199 |
OBJ rslt = false; |
81 | 5200 |
|
150 | 5201 |
if (ISCONNECTED) { |
1344 | 5202 |
Display *dpy = myDpy; |
5203 |
||
1974 | 5204 |
ENTER_XLIB(); |
1344 | 5205 |
if (doSync == true) { |
5206 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5207 |
} |
|
5208 |
if (__isExternalAddress(aWindowIdOrNil)) { |
|
5209 |
win = _WindowVal(aWindowIdOrNil); |
|
5210 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
|
5211 |
} else { |
|
5212 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
|
5213 |
} |
|
5214 |
if (thereIsOne) { |
|
5215 |
XPutBackEvent(dpy, &ev); |
|
1974 | 5216 |
rslt = true; |
5217 |
} |
|
5218 |
LEAVE_XLIB(); |
|
5219 |
} |
|
5220 |
RETURN ( rslt ); |
|
81 | 5221 |
%} |
5222 |
! |
|
5223 |
||
1344 | 5224 |
getEventFor:aViewIdOrNil withMask:eventMask |
295 | 5225 |
"read next event - put into local eventBuffer. |
5226 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
5227 |
otherwise only events for that specific view will be fetched. |
|
5228 |
Returns true, if there was an event, false otherwise. |
|
5229 |
This method may block - so you better check for pending events |
|
5230 |
before calling for it. |
|
5231 |
||
5232 |
Sorry I had to split dispatch into this fetch method and an extra |
|
5233 |
handle method to allow unlimitedstack here. |
|
5234 |
(some Xlibs do a big alloca there ...) which cannot be done in |
|
5235 |
dispatchLastEvent, since it dispatches out into ST-methods. |
|
5236 |
" |
|
81 | 5237 |
|
5238 |
%{ /* UNLIMITEDSTACK */ |
|
5239 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5240 |
Display *dpy; |
295 | 5241 |
Window win, wWanted; |
5242 |
int evMask; |
|
5243 |
OBJ eB; |
|
5244 |
XEvent *ev; |
|
5245 |
||
5246 |
if (! ISCONNECTED) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5247 |
RETURN (false); |
295 | 5248 |
} |
5249 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5250 |
dpy = myDpy; |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5251 |
|
555 | 5252 |
eB = __INST(eventBuffer); |
295 | 5253 |
if (__isByteArray(eB)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5254 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 5255 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5256 |
printf("DISPLAY: no eventBuffer\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5257 |
RETURN (false); |
295 | 5258 |
} |
5259 |
ev->type = 0; |
|
5260 |
||
5261 |
if (__isSmallInteger(eventMask)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5262 |
evMask = __intVal(eventMask); |
295 | 5263 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5264 |
evMask = ~0; |
295 | 5265 |
} |
5266 |
||
5267 |
if (__isExternalAddress(aViewIdOrNil)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5268 |
wWanted = _WindowVal(aViewIdOrNil); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5269 |
if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5270 |
RETURN ( true ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5271 |
} |
295 | 5272 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5273 |
if (evMask == ~0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5274 |
XNextEvent(dpy, ev); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5275 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5276 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5277 |
if (XCheckMaskEvent(dpy, evMask, ev)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5278 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5279 |
} |
295 | 5280 |
} |
5281 |
%}. |
|
5282 |
^ false |
|
5283 |
! |
|
5284 |
||
1344 | 5285 |
handleAllEvents |
295 | 5286 |
"from now on, handle any kind of event" |
5287 |
||
5288 |
dispatchingExpose := nil |
|
5289 |
! |
|
5290 |
||
1344 | 5291 |
handleExposeOnlyFor:aView |
295 | 5292 |
"from now on, handle expose events only" |
5293 |
||
5294 |
dispatchingExpose := aView id |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5295 |
! |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5296 |
|
1344 | 5297 |
mappingChanged:what event:eB |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5298 |
"One of Keyboard-, Modifier- or PointerMap has change, probably by xmodmap. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5299 |
Tell xlib about the fact." |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5300 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5301 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
1344 | 5302 |
self refreshKeyboardMapping:eB. |
5303 |
"Maybe some of our modifiers have been changed" |
|
5304 |
self initializeModifierMappings. |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5305 |
]. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5306 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5307 |
"Created: 1.12.1995 / 16:28:23 / stefan" |
295 | 5308 |
! |
5309 |
||
1344 | 5310 |
setEventMask:aMask in:aWindowId |
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
5311 |
"tell X that we are only interested in events from aMask, which |
295 | 5312 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
5313 |
||
5314 |
%{ /* NOCONTEXT */ |
|
5315 |
||
5316 |
int mask; |
|
5317 |
||
1209 | 5318 |
if (ISCONNECTED |
5319 |
&& __isExternalAddress(aWindowId) |
|
295 | 5320 |
&& __isSmallInteger(aMask)) { |
1344 | 5321 |
mask = __intVal(aMask); |
295 | 5322 |
|
5323 |
#ifdef OLD |
|
1344 | 5324 |
/* these may not be disabled */ |
5325 |
mask |= ExposureMask | StructureNotifyMask | |
|
5326 |
KeyPressMask | KeyReleaseMask | |
|
5327 |
EnterWindowMask | LeaveWindowMask | |
|
5328 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
|
295 | 5329 |
#endif |
5330 |
||
1974 | 5331 |
ENTER_XLIB(); |
1344 | 5332 |
XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
1974 | 5333 |
LEAVE_XLIB(); |
1344 | 5334 |
RETURN ( self ); |
295 | 5335 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
5336 |
%}. |
295 | 5337 |
self primitiveFailed |
5338 |
! |
|
5339 |
||
1344 | 5340 |
startDispatch |
295 | 5341 |
"redefined to clear dispatchingExpose, which is a special X feature" |
5342 |
||
5343 |
dispatching ifTrue:[^ self]. |
|
5344 |
dispatchingExpose := nil. |
|
5345 |
super startDispatch |
|
0 | 5346 |
! ! |
295 | 5347 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5348 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5349 |
|
1567 | 5350 |
sendClientEvent:msgType format:msgFormat to:targetWindowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5 |
1556 | 5351 |
"send a ClientMessage to some other (possibly: non-ST/X) view. |
1567 | 5352 |
The client message gets message_type and msgFormat as specified by |
1556 | 5353 |
the arguments. The additional data arguments specify up to |
5354 |
5 longWords of user data; each may be an integer or nil. |
|
5355 |
It is passed transparently in the events data field. |
|
5356 |
See XProtocol specification for more details." |
|
5357 |
||
5358 |
"/ Event.xclient.type = ClientMessage; |
|
5359 |
"/ Event.xclient.display = dpy; |
|
5360 |
"/ Event.xclient.message_type = msgType; |
|
1567 | 5361 |
"/ Event.xclient.format = msgFormat; |
1556 | 5362 |
"/ Event.xclient.window = targetWindowID; |
5363 |
"/ Event.xclient.data.l[0] = d1 |
|
5364 |
"/ Event.xclient.data.l[1] = d2 |
|
5365 |
"/ Event.xclient.data.l[2] = d3 |
|
5366 |
"/ Event.xclient.data.l[3] = d4 |
|
5367 |
"/ Event.xclient.data.l[4] = d5 |
|
5368 |
"/ |
|
5369 |
"/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event); |
|
5370 |
||
5371 |
%{ /* NOCONTEXT */ |
|
5372 |
int type; |
|
5373 |
int state; |
|
5374 |
||
5375 |
if (ISCONNECTED |
|
5376 |
&& __isInteger(msgType) |
|
1567 | 5377 |
&& __isInteger(msgFormat) |
1556 | 5378 |
&& (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5379 |
Display *dpy = myDpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5380 |
XEvent ev; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5381 |
Status result; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5382 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5383 |
if (__isInteger(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5384 |
ev.xclient.data.l[0] = __longIntVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5385 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5386 |
if (__isExternalAddress(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5387 |
ev.xclient.data.l[0] = (int)__externalAddressVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5388 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5389 |
ev.xclient.data.l[0] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5390 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5391 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5392 |
if (__isInteger(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5393 |
ev.xclient.data.l[1] = __longIntVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5394 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5395 |
if (__isExternalAddress(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5396 |
ev.xclient.data.l[1] = (int)__externalAddressVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5397 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5398 |
ev.xclient.data.l[1] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5399 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5400 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5401 |
if (__isInteger(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5402 |
ev.xclient.data.l[2] = __longIntVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5403 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5404 |
if (__isExternalAddress(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5405 |
ev.xclient.data.l[2] = (int)__externalAddressVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5406 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5407 |
ev.xclient.data.l[2] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5408 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5409 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5410 |
if (__isInteger(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5411 |
ev.xclient.data.l[3] = __longIntVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5412 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5413 |
if (__isExternalAddress(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5414 |
ev.xclient.data.l[3] = (int)__externalAddressVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5415 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5416 |
ev.xclient.data.l[3] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5417 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5418 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5419 |
if (__isInteger(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5420 |
ev.xclient.data.l[4] = __longIntVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5421 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5422 |
if (__isExternalAddress(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5423 |
ev.xclient.data.l[4] = (int)__externalAddressVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5424 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5425 |
ev.xclient.data.l[4] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5426 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5427 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5428 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5429 |
if (__isExternalAddress(targetWindowID)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5430 |
ev.xclient.window = _WindowVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5431 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5432 |
ev.xclient.window = (Window)__longIntVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5433 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5434 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5435 |
ev.xclient.type = ClientMessage; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5436 |
ev.xclient.display = dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5437 |
ev.xclient.message_type = __longIntVal(msgType); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5438 |
ev.xclient.format = __longIntVal(msgFormat); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5439 |
|
1974 | 5440 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5441 |
result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev); |
1974 | 5442 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5443 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5444 |
if ((result == BadValue) || (result == BadWindow)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5445 |
DPRINTF(("bad status in sendClientEvent\n")); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5446 |
RETURN ( false ) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5447 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5448 |
RETURN (true) |
1556 | 5449 |
} |
5450 |
%}. |
|
5451 |
self primitiveFailed. |
|
5452 |
^ false |
|
5453 |
! |
|
5454 |
||
1344 | 5455 |
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5456 |
"send a keyPress/Release or buttonPress/Release event to some (possibly alien) view. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5457 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5458 |
For buttonEvents, the keySymCodeOrButtonNr must be the buttons number (1, 2 ...); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5459 |
for key events, it can be either a symbol (as listen in X's keySyms) |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5460 |
or a numeric keysym code. If state is nil, the modifier bits (shift & control) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5461 |
are computed from the keyboardMap - if non-nil, these are passed as modifierbits. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5462 |
The non-nil case is the lowlevel entry, where state must include any shift/ctrl information |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5463 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5464 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5465 |
%{ /* NOCONTEXT */ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5466 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5467 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5468 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5469 |
if (__isSmallInteger(stateMask)) { |
1344 | 5470 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5471 |
} else { |
1344 | 5472 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5473 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5474 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5475 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5476 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5477 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5478 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
1344 | 5479 |
Display *dpy = myDpy; |
5480 |
||
5481 |
XEvent ev; |
|
5482 |
Window target; |
|
5483 |
Status result; |
|
5484 |
KeySym keySym, *syms; |
|
5485 |
int screen = __intVal(__INST(screen)); |
|
5486 |
char s[2]; |
|
5487 |
int nSyms; |
|
5488 |
||
5489 |
if ((typeSymbol == @symbol(keyPress)) |
|
5490 |
|| (typeSymbol == @symbol(keyRelease))) { |
|
5491 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
|
5492 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
|
5493 |
} else { |
|
5494 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
|
5495 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
|
5496 |
s[1] = '\0'; |
|
5497 |
keySym = XStringToKeysym(s); |
|
5498 |
} else { |
|
5499 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
|
5500 |
} |
|
5501 |
} |
|
5502 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
|
5503 |
||
5504 |
if (stateMask == nil) { |
|
5505 |
/* |
|
5506 |
* get the modifier from the keySym |
|
5507 |
*/ |
|
5508 |
nSyms = 0; |
|
5509 |
syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
|
5510 |
if (syms) { |
|
5511 |
int i; |
|
5512 |
||
5513 |
for (i=0; i<nSyms; i++) { |
|
5514 |
if (syms[i] == keySym) { |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5515 |
#ifdef MODIFIERDEBUG |
1344 | 5516 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5517 |
#endif |
1344 | 5518 |
if (i) state = (1 << (i-1)); |
5519 |
break; |
|
5520 |
} |
|
5521 |
} |
|
5522 |
XFree(syms); |
|
5523 |
} |
|
5524 |
} |
|
5525 |
} else { |
|
5526 |
if ((typeSymbol == @symbol(buttonPress)) |
|
5527 |
|| (typeSymbol == @symbol(buttonRelease))) { |
|
5528 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
|
5529 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
|
5530 |
} else { |
|
5531 |
ev.xbutton.button = 1; |
|
5532 |
} |
|
5533 |
} else { |
|
5534 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
|
5535 |
RETURN (false); |
|
5536 |
} |
|
5537 |
} |
|
5538 |
||
5539 |
if (typeSymbol == @symbol(keyPress)) |
|
5540 |
ev.xany.type = KeyPress; |
|
5541 |
else if (typeSymbol == @symbol(keyRelease)) |
|
5542 |
ev.xany.type = KeyRelease; |
|
5543 |
else if (typeSymbol == @symbol(buttonPress)) |
|
5544 |
ev.xany.type = ButtonPress; |
|
5545 |
else if (typeSymbol == @symbol(buttonRelease)) |
|
5546 |
ev.xany.type = ButtonRelease; |
|
5547 |
||
5548 |
if (__isExternalAddress(targetId)) { |
|
5549 |
target = _WindowVal(targetId); |
|
5550 |
} else { |
|
5551 |
target = (Window) __longIntVal(targetId); |
|
5552 |
} |
|
5553 |
ev.xkey.window = target; |
|
5554 |
ev.xkey.same_screen = 1; |
|
5555 |
ev.xkey.subwindow = 0; |
|
2541 | 5556 |
ev.xkey.root = RootWindow(dpy, screen); |
1344 | 5557 |
ev.xkey.x = __intVal(xPos); |
5558 |
ev.xkey.y = __intVal(yPos); |
|
5559 |
ev.xkey.state = state; |
|
5560 |
ev.xkey.time = CurrentTime; |
|
5561 |
||
1974 | 5562 |
ENTER_XLIB(); |
1344 | 5563 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
1974 | 5564 |
LEAVE_XLIB(); |
1344 | 5565 |
if ((result == BadValue) || (result == BadWindow)) { |
5566 |
DPRINTF(("bad status\n")); |
|
5567 |
RETURN ( false ) |
|
5568 |
} |
|
5569 |
RETURN (true) |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5570 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5571 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5572 |
self primitiveFailed. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5573 |
^ false |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5574 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5575 |
|
295 | 5576 |
!XWorkstation methodsFor:'font stuff'! |
5577 |
||
1344 | 5578 |
createFontFor:aFontName |
295 | 5579 |
"a basic method for X-font allocation; this method allows |
5580 |
any font to be aquired (even those not conforming to |
|
5581 |
standard naming conventions, such as cursor, fixed or k14)" |
|
5582 |
||
5583 |
%{ /* UNLIMITEDSTACK */ |
|
5584 |
/* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */ |
|
5585 |
||
5586 |
XFontStruct *newFont; |
|
5587 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5588 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5589 |
&& __isNonNilObject(aFontName) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5590 |
&& (__qIsString(aFontName) || __qIsSymbol(aFontName))) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5591 |
BEGIN_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5592 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5593 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5594 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5595 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5596 |
if (newFont) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5597 |
__cnt_font++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5598 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5599 |
END_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5600 |
RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil ); |
295 | 5601 |
} |
5602 |
%}. |
|
5603 |
^ nil |
|
5604 |
! |
|
5605 |
||
1344 | 5606 |
decomposeXFontName:aString into:aBlock |
295 | 5607 |
"extract family, face, style and size from an |
5608 |
X-font name |
|
5609 |
(-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); |
|
5610 |
evaluate aBlock with these" |
|
5611 |
||
5612 |
|origin family face style moreStyle skip fheight size |
|
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5613 |
resX resY x1 x2 registry encoding coding start end | |
295 | 5614 |
|
5615 |
aString isNil ifTrue:[^ false]. |
|
5616 |
(aString startsWith:'-') ifFalse:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5617 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5618 |
take care for ill-named fonts (i.e. pre Rel4 fonts) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5619 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5620 |
('*-*-[0-9]*' match:aString) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5621 |
end := aString indexOf:$- startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5622 |
family := aString copyFrom:1 to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5623 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5624 |
end := aString indexOf:$- startingAt:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5625 |
style := aString copyFrom:start to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5626 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5627 |
size := aString copyFrom:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5628 |
size := (Number readFromString:size onError:[^false]). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5629 |
aBlock value:family value:nil value:style value:size value:nil. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5630 |
^ true. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5631 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5632 |
('*-[0-9]*' match:aString) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5633 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5634 |
something like lucidasans-24 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5635 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5636 |
end := aString indexOf:$- startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5637 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5638 |
family := aString copyFrom:1 to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5639 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5640 |
size := aString copyFrom:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5641 |
size := (Number readFromString:size onError:[^false]). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5642 |
aBlock value:family value:nil value:nil value:size value:nil. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5643 |
^ true. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5644 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5645 |
aBlock value:aString value:nil value:nil value:nil value:nil. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5646 |
^ true. |
295 | 5647 |
]. |
5648 |
||
5649 |
end := aString indexOf:$- startingAt:2. |
|
5650 |
(end == 0) ifTrue:[^ false]. |
|
5651 |
origin := aString copyFrom:2 to:(end - 1). |
|
5652 |
||
5653 |
start := end + 1. |
|
5654 |
end := aString indexOf:$- startingAt:start. |
|
5655 |
(end == 0) ifTrue:[^ false]. |
|
5656 |
family := aString copyFrom:start to:(end - 1). |
|
5657 |
||
5658 |
start := end + 1. |
|
5659 |
end := aString indexOf:$- startingAt:start. |
|
5660 |
(end == 0) ifTrue:[^ false]. |
|
5661 |
face := aString copyFrom:start to:(end - 1). |
|
5662 |
||
5663 |
start := end + 1. |
|
5664 |
end := aString indexOf:$- startingAt:start. |
|
5665 |
(end == 0) ifTrue:[^ false]. |
|
5666 |
style := aString copyFrom:start to:(end - 1). |
|
5667 |
(style = 'o') ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5668 |
style := 'oblique' |
295 | 5669 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5670 |
(style = 'i') ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5671 |
style := 'italic' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5672 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5673 |
(style = 'r') ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5674 |
style := 'roman' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5675 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5676 |
] |
295 | 5677 |
]. |
5678 |
||
5679 |
start := end + 1. |
|
5680 |
end := aString indexOf:$- startingAt:start. |
|
5681 |
(end == 0) ifTrue:[^ false]. |
|
5682 |
moreStyle := aString copyFrom:start to:(end - 1). |
|
5683 |
||
5684 |
start := end + 1. |
|
5685 |
end := aString indexOf:$- startingAt:start. |
|
5686 |
(end == 0) ifTrue:[^ false]. |
|
5687 |
skip := aString copyFrom:start to:(end - 1). |
|
5688 |
||
5689 |
start := end + 1. |
|
5690 |
end := aString indexOf:$- startingAt:start. |
|
5691 |
(end == 0) ifTrue:[^ false]. |
|
5692 |
fheight := aString copyFrom:start to:(end - 1). |
|
5693 |
||
5694 |
start := end + 1. |
|
5695 |
end := aString indexOf:$- startingAt:start. |
|
5696 |
(end == 0) ifTrue:[^ false]. |
|
5697 |
size := aString copyFrom:start to:(end - 1). |
|
5698 |
size := (Number readFromString:size) / 10. |
|
5699 |
||
5700 |
start := end + 1. |
|
5701 |
end := aString indexOf:$- startingAt:start. |
|
5702 |
(end == 0) ifTrue:[^ false]. |
|
5703 |
resX := aString copyFrom:start to:(end - 1). |
|
5704 |
||
5705 |
start := end + 1. |
|
5706 |
end := aString indexOf:$- startingAt:start. |
|
5707 |
(end == 0) ifTrue:[^ false]. |
|
5708 |
resY := aString copyFrom:start to:(end - 1). |
|
5709 |
||
5710 |
start := end + 1. |
|
5711 |
end := aString indexOf:$- startingAt:start. |
|
5712 |
(end == 0) ifTrue:[^ false]. |
|
5713 |
x1 := aString copyFrom:start to:(end - 1). |
|
5714 |
||
5715 |
start := end + 1. |
|
5716 |
end := aString indexOf:$- startingAt:start. |
|
5717 |
(end == 0) ifTrue:[^ false]. |
|
5718 |
x2 := aString copyFrom:start to:(end - 1). |
|
5719 |
||
5720 |
start := end + 1. |
|
5721 |
end := aString indexOf:$- startingAt:start. |
|
5722 |
(end == 0) ifTrue:[^ false]. |
|
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5723 |
registry := aString copyFrom:start to:(end - 1). |
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5724 |
|
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5725 |
encoding := aString copyFrom:end + 1. |
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5726 |
|
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5727 |
coding := registry , '-' , encoding. |
295 | 5728 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5729 |
(moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5730 |
style := style, '-', moreStyle. |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5731 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5732 |
|
295 | 5733 |
aBlock value:family value:face value:style value:size value:coding. |
5734 |
^ true |
|
5735 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5736 |
"Modified: 4.7.1996 / 11:12:25 / stefan" |
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5737 |
"Modified: 10.4.1997 / 09:45:36 / cg" |
295 | 5738 |
! |
5739 |
||
1344 | 5740 |
encodingOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5741 |
"the fonts encoding - if the font does not provide that info, |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
5742 |
return nil (and assume #ascii, which is a subset of #iso8859)." |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5743 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5744 |
|enc fullName fontName registry encoding charSetCollections| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5745 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5746 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5747 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5748 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5749 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5750 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5751 |
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5752 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5753 |
if (ISCONNECTED) { |
1344 | 5754 |
Display *dpy = myDpy; |
5755 |
||
5756 |
registryAtom = XInternAtom(dpy, "CHARSET_REGISTRY", True); |
|
5757 |
encodingAtom = XInternAtom(dpy, "CHARSET_ENCODING", True); |
|
5758 |
charSetCollAtom = XInternAtom(dpy, "CHARSET_COLLECTIONS", True); |
|
5759 |
fontAtom = XInternAtom(dpy, "FONT", True); |
|
5760 |
||
5761 |
if (__isExternalAddress(aFontId)) { |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5762 |
|
1344 | 5763 |
f = _FontVal(aFontId); |
5764 |
if (f) { |
|
5765 |
n = f->n_properties; |
|
5766 |
prop = f->properties; |
|
5767 |
if (prop) { |
|
5768 |
while (n--) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5769 |
#ifdef SUPERDEBUG |
1344 | 5770 |
cp = XGetAtomName(dpy, prop->name); |
5771 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
5772 |
XFree(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5773 |
#endif |
1344 | 5774 |
if (prop->name == XA_FULL_NAME) { |
5775 |
cp = XGetAtomName(dpy, prop->card32); |
|
5776 |
if (cp) { |
|
5777 |
fullName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5778 |
#ifdef SUPERDEBUG |
1344 | 5779 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5780 |
#endif |
1344 | 5781 |
XFree(cp); |
5782 |
} |
|
5783 |
} else if (prop->name == fontAtom) { |
|
5784 |
cp = XGetAtomName(dpy, prop->card32); |
|
5785 |
if (cp) { |
|
5786 |
fontName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5787 |
#ifdef SUPERDEBUG |
1344 | 5788 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5789 |
#endif |
1344 | 5790 |
XFree(cp); |
5791 |
} |
|
5792 |
} else if (prop->name == encodingAtom) { |
|
5793 |
cp = XGetAtomName(dpy, prop->card32); |
|
5794 |
if (cp) { |
|
5795 |
encoding = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5796 |
#ifdef SUPERDEBUG |
1344 | 5797 |
printf(" ENCODING -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5798 |
#endif |
1344 | 5799 |
XFree(cp); |
5800 |
} |
|
5801 |
} else if (prop->name == registryAtom) { |
|
5802 |
cp = XGetAtomName(dpy, prop->card32); |
|
5803 |
if (cp) { |
|
5804 |
registry = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5805 |
#ifdef SUPERDEBUG |
1344 | 5806 |
printf(" REGISTRY -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5807 |
#endif |
1344 | 5808 |
XFree(cp); |
5809 |
} |
|
5810 |
} else if (prop->name == charSetCollAtom) { |
|
5811 |
cp = XGetAtomName(dpy, prop->card32); |
|
5812 |
if (cp) { |
|
5813 |
charSetCollections = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5814 |
#ifdef SUPERDEBUG |
1344 | 5815 |
printf(" CHARSET_COLLECTIONS -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5816 |
#endif |
1344 | 5817 |
XFree(cp); |
5818 |
} |
|
5819 |
} |
|
5820 |
prop++; |
|
5821 |
} |
|
5822 |
} |
|
5823 |
} |
|
5824 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5825 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5826 |
%}. |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5827 |
^ self |
1344 | 5828 |
extractEncodingFromRegistry:registry |
5829 |
encoding:encoding |
|
5830 |
charSetCollections:charSetCollections |
|
5831 |
! |
|
5832 |
||
5833 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
|
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5834 |
"this is pure magic ..." |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5835 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5836 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5837 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5838 |
(registry notNil and:[registry notEmpty]) ifTrue:[ |
1344 | 5839 |
enc := registry asLowercase asSymbol. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5840 |
] ifFalse:[ |
1344 | 5841 |
(encoding notNil and:[encoding notEmpty]) ifTrue:[ |
5842 |
enc := encoding asLowercase asSymbol |
|
5843 |
] ifFalse:[ |
|
5844 |
charSets := charSetCollections. |
|
5845 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
|
5846 |
charSets := charSets asUppercase asCollectionOfWords. |
|
5847 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
5848 |
enc := #iso8859 |
|
5849 |
] ifFalse:[ |
|
5850 |
(charSets includes:'ISO8859') ifTrue:[ |
|
5851 |
enc := #iso8859 |
|
5852 |
] ifFalse:[ |
|
5853 |
(charSets includes:'ASCII') ifTrue:[ |
|
5854 |
enc := #ascii |
|
5855 |
] ifFalse:[ |
|
5856 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
5857 |
enc := #iso8859 |
|
5858 |
] |
|
5859 |
] |
|
5860 |
] |
|
5861 |
] |
|
5862 |
] |
|
5863 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5864 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5865 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5866 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5867 |
"Created: 17.4.1996 / 14:57:06 / cg" |
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5868 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5869 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5870 |
|
1344 | 5871 |
flushListOfAvailableFonts |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5872 |
"flush the cached list of all available fonts on this display. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5873 |
Required if new fonts have been added on the display server." |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5874 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5875 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5876 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5877 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5878 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5879 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5880 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5881 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5882 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5883 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5884 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5885 |
|
1344 | 5886 |
fontMetricsOf:fontId into:aBlock |
991 | 5887 |
"evaluate aBlock, passing a fonts metrics as arguments" |
5888 |
||
5889 |
|encoding avgAscent avgDescent |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5890 |
maxAscent maxDescent minWidth maxWidth avgWidth |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5891 |
res resX resY| |
991 | 5892 |
|
994 | 5893 |
%{ |
991 | 5894 |
XFontStruct *f; |
5895 |
int len; |
|
5896 |
||
5897 |
if (ISCONNECTED) { |
|
1344 | 5898 |
if (__isExternalAddress(fontId)) { |
5899 |
f = _FontVal(fontId); |
|
5900 |
if (f) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5901 |
#ifdef NOTDEF |
1344 | 5902 |
char *cp; |
5903 |
XFontProp *prop; |
|
5904 |
||
5905 |
n = f->n_properties; |
|
5906 |
prop = f->properties; |
|
5907 |
||
5908 |
if (prop) { |
|
5909 |
while (n--) { |
|
5910 |
if (prop->name == RESOLUTION_X) { |
|
5911 |
resX = __MKSMALLINT(prop->card32); |
|
5912 |
} else if (prop->name == RESOLUTION_Y) { |
|
5913 |
resY = __MKSMALLINT(prop->card32); |
|
5914 |
} else if (prop->name == RESOLUTION) { |
|
5915 |
res = __MKSMALLINT(prop->card32); |
|
5916 |
} |
|
5917 |
prop++; |
|
5918 |
} |
|
5919 |
} |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5920 |
#endif |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5921 |
|
1344 | 5922 |
avgAscent = __MKSMALLINT(f->ascent); |
5923 |
avgDescent = __MKSMALLINT(f->descent); |
|
5924 |
maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
|
5925 |
maxDescent = __MKSMALLINT(f->max_bounds.descent); |
|
5926 |
minWidth = __MKSMALLINT(f->min_bounds.width); |
|
5927 |
maxWidth = __MKSMALLINT(f->max_bounds.width); |
|
5928 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5929 |
ENTER_XLIB(); |
1344 | 5930 |
len = XTextWidth(f, " ", 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5931 |
LEAVE_XLIB(); |
1344 | 5932 |
END_INTERRUPTSBLOCKED |
5933 |
avgWidth = __MKSMALLINT( len ); |
|
5934 |
} |
|
5935 |
} |
|
991 | 5936 |
} |
5937 |
%}. |
|
5938 |
encoding := self encodingOf:fontId. |
|
5939 |
aBlock value:encoding |
|
1344 | 5940 |
value:avgAscent |
5941 |
value:avgDescent |
|
5942 |
value:maxAscent |
|
5943 |
value:maxDescent |
|
5944 |
value:minWidth |
|
5945 |
value:maxWidth |
|
5946 |
value:avgWidth |
|
5947 |
! |
|
5948 |
||
5949 |
fontResolutionOf:fontId |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5950 |
"return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution, |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5951 |
but due to errors in some XServer installations, some use 75dpi fonts on higher |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5952 |
resolution displays and vice/versa." |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5953 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5954 |
|res resX resY| |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5955 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5956 |
%{ |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5957 |
XFontStruct *f; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5958 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5959 |
if (ISCONNECTED) { |
1344 | 5960 |
Display *dpy = myDpy; |
5961 |
||
5962 |
if (__isExternalAddress(fontId)) { |
|
5963 |
f = _FontVal(fontId); |
|
5964 |
if (f) { |
|
5965 |
char *cp; |
|
5966 |
XFontProp *prop; |
|
5967 |
Atom resolutionXAtom, resolutionYAtom; |
|
5968 |
int n; |
|
5969 |
||
5970 |
n = f->n_properties; |
|
5971 |
prop = f->properties; |
|
5972 |
||
5973 |
if (prop) { |
|
5974 |
resolutionXAtom = XInternAtom(dpy, "RESOLUTION_X", True); |
|
5975 |
resolutionYAtom = XInternAtom(dpy, "RESOLUTION_Y", True); |
|
5976 |
||
5977 |
while (n--) { |
|
5978 |
if (prop->name == resolutionXAtom) { |
|
5979 |
resX = __MKSMALLINT(prop->card32); |
|
5980 |
} else if (prop->name == resolutionYAtom) { |
|
5981 |
resY = __MKSMALLINT(prop->card32); |
|
5982 |
} else if (prop->name == XA_RESOLUTION) { |
|
5983 |
res = __MKSMALLINT(prop->card32); |
|
5984 |
} |
|
5985 |
prop++; |
|
5986 |
} |
|
5987 |
} |
|
5988 |
} |
|
5989 |
} |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5990 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5991 |
%}. |
1046 | 5992 |
(resX notNil and:[resY notNil]) ifTrue:[ |
1344 | 5993 |
^ resX @ resY |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5994 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5995 |
res notNil ifTrue:[ |
1344 | 5996 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5997 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5998 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5999 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6000 |
|
1344 | 6001 |
fullNameOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6002 |
"the fonts fullName - this is very device specific and should only be |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6003 |
used for user feed-back (for example: in the fontPanel). |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6004 |
If the display/font do not provide that info, return nil." |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6005 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6006 |
|fullName fontName| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6007 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6008 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6009 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6010 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6011 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6012 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6013 |
Atom fontAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6014 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6015 |
if (ISCONNECTED) { |
1344 | 6016 |
Display *dpy = myDpy; |
6017 |
||
6018 |
fontAtom = XInternAtom(dpy, "FONT", True); |
|
6019 |
||
6020 |
if (__isExternalAddress(aFontId)) { |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6021 |
|
1344 | 6022 |
f = _FontVal(aFontId); |
6023 |
if (f) { |
|
6024 |
n = f->n_properties; |
|
6025 |
prop = f->properties; |
|
6026 |
if (prop) { |
|
6027 |
while (n--) { |
|
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
6028 |
#ifdef SUPERDEBUG |
1344 | 6029 |
cp = XGetAtomName(dpy, prop->name); |
6030 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
6031 |
XFree(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6032 |
#endif |
1344 | 6033 |
if (prop->name == XA_FULL_NAME) { |
6034 |
cp = XGetAtomName(dpy, prop->card32); |
|
6035 |
if (cp) { |
|
6036 |
fullName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6037 |
#ifdef SUPERDEBUG |
1344 | 6038 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6039 |
#endif |
1344 | 6040 |
XFree(cp); |
6041 |
} |
|
6042 |
} |
|
6043 |
if (prop->name == fontAtom) { |
|
6044 |
cp = XGetAtomName(dpy, prop->card32); |
|
6045 |
if (cp) { |
|
6046 |
fontName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6047 |
#ifdef SUPERDEBUG |
1344 | 6048 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6049 |
#endif |
1344 | 6050 |
XFree(cp); |
6051 |
} |
|
6052 |
} |
|
6053 |
prop++; |
|
6054 |
} |
|
6055 |
} |
|
6056 |
} |
|
6057 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6058 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6059 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6060 |
(fullName notNil and:[fullName notEmpty]) ifTrue:[ |
1344 | 6061 |
^ fullName |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6062 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6063 |
^ fontName |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6064 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6065 |
|
1344 | 6066 |
getAvailableFontsMatching:pattern |
295 | 6067 |
"return an Array filled with font names matching aPattern" |
6068 |
||
6069 |
%{ /* UNLIMITEDSTACK */ |
|
6070 |
||
6071 |
int nnames = 1500; |
|
6072 |
int available = nnames + 1; |
|
6073 |
char **fonts; |
|
6074 |
OBJ arr, str; |
|
6075 |
int i; |
|
6076 |
||
6077 |
if (ISCONNECTED) { |
|
1344 | 6078 |
if (__isString(pattern)) { |
6079 |
for (;;) { |
|
6080 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
6081 |
if ((fonts == NULL) || (available < nnames)) break; |
|
6082 |
XFreeFontNames(fonts); |
|
6083 |
nnames = available * 2; |
|
6084 |
} |
|
6085 |
if (fonts == NULL) { |
|
6086 |
RETURN ( nil ); |
|
6087 |
} |
|
6088 |
/* |
|
6089 |
* now, that we know the number of font names, |
|
6090 |
* create the array ... |
|
6091 |
*/ |
|
6092 |
arr = __ARRAY_NEW_INT(available); |
|
6093 |
if (! arr) { |
|
6094 |
RETURN (nil); |
|
6095 |
} |
|
6096 |
/* |
|
6097 |
* ... and fill it |
|
6098 |
*/ |
|
6099 |
for (i=0; i<available; i++) { |
|
6100 |
__PROTECT__(arr); |
|
6101 |
str = __MKSTRING(fonts[i]); |
|
6102 |
__UNPROTECT__(arr); |
|
6103 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
|
6104 |
} |
|
6105 |
RETURN (arr); |
|
6106 |
} |
|
295 | 6107 |
} |
6108 |
%}. |
|
6109 |
^ nil |
|
6110 |
! |
|
6111 |
||
1344 | 6112 |
getDefaultFont |
295 | 6113 |
"return a default font id - used when class Font cannot |
6114 |
find anything usable" |
|
6115 |
||
6116 |
^ self createFontFor:'fixed' |
|
6117 |
! |
|
6118 |
||
1344 | 6119 |
getFontWithFamily:familyString face:faceString |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6120 |
style:styleArgString size:sizeArg encoding:encoding |
295 | 6121 |
|
6122 |
"try to get the specified font, if not available, try next smaller |
|
6123 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
6124 |
as family and the other parameters as nil. For example, the cursor font |
|
6125 |
can be aquired that way." |
|
6126 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6127 |
|styleString theName theId xlatedStyle |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6128 |
id spacing encodingMatch registryMatch idx| |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6129 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6130 |
styleString := styleArgString. |
295 | 6131 |
|
6132 |
"special: if face is nil, allow access to X-fonts" |
|
6133 |
faceString isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6134 |
sizeArg notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6135 |
theName := familyString , '-' , sizeArg printString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6136 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6137 |
theName := familyString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6138 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6139 |
theName isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6140 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6141 |
mhmh - fall back to the default font |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6142 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6143 |
theName := 'fixed' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6144 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6145 |
theId := self createFontFor:theName. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6146 |
theId isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6147 |
theId := self getDefaultFont |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6148 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6149 |
^ theId |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6150 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6151 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6152 |
"/ spacing other than 'normal' is contained as last component |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6153 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6154 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6155 |
(styleString notNil |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6156 |
and:[(styleString endsWith:'-narrow') |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6157 |
or:[styleString endsWith:'-semicondensed']]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6158 |
|i| |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6159 |
i := styleString lastIndexOf:$-. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6160 |
spacing := styleString copyFrom:(i+1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6161 |
styleString := styleString copyTo:(i-1). |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6162 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6163 |
spacing := 'normal'. |
295 | 6164 |
]. |
6165 |
||
6166 |
xlatedStyle := styleString. |
|
6167 |
xlatedStyle notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6168 |
xlatedStyle := xlatedStyle first asString |
295 | 6169 |
]. |
6170 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6171 |
encodingMatch := encoding. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6172 |
registryMatch := '*'. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6173 |
encoding isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6174 |
encodingMatch := '*'. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6175 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6176 |
idx := encoding indexOf:$-. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6177 |
idx ~~ 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6178 |
encodingMatch := encoding copyTo:idx - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6179 |
registryMatch := encoding copyFrom:idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6180 |
]. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6181 |
]. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6182 |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6183 |
id := self |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6184 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6185 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6186 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6187 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6188 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6189 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6190 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6191 |
registry:encodingMatch |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6192 |
encoding:registryMatch. |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6193 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6194 |
id isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6195 |
(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6196 |
"/ too stupid: encodings come in both cases |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6197 |
"/ and X does not ignore case |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6198 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6199 |
id := self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6200 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6201 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6202 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6203 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6204 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6205 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6206 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6207 |
registry:encodingMatch asUppercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6208 |
encoding:registryMatch. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6209 |
id isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6210 |
id := self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6211 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6212 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6213 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6214 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6215 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6216 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6217 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6218 |
registry:encodingMatch asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6219 |
encoding:registryMatch. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6220 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6221 |
] |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6222 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6223 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6224 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6225 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6226 |
"Modified: 10.4.1997 / 19:20:06 / cg" |
295 | 6227 |
! |
6228 |
||
1344 | 6229 |
getFontWithFoundry:foundry family:family weight:weight |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6230 |
slant:slant spacing:spc pixelSize:pSize size:size |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6231 |
registry:registry encoding:encoding |
295 | 6232 |
|
6233 |
"get the specified font, if not available, return nil. |
|
6234 |
This is the new font creation method - all others will be changed to |
|
6235 |
use this entry. |
|
6236 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
6237 |
||
6238 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
6239 |
family: 'helvetica' 'courier' 'times' ... |
|
6240 |
weight: 'bold' 'medium' 'demi' ... |
|
6241 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
6242 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
6243 |
pixelSize: 16,18 ... usually left empty |
|
6244 |
size: size in point (1/72th of an inch) |
|
6245 |
registry: iso8859, sgi ... '*' |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6246 |
encoding: registry specific encoding (usually '*') |
295 | 6247 |
" |
6248 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6249 |
|theName sizeMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6250 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
1099 | 6251 |
pSizeMatch registryMatch encodingMatch| |
295 | 6252 |
|
6253 |
"this works only on 'Release >= 3' - X-servers" |
|
6254 |
"name is: |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6255 |
-foundry-family -weight -slant- |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6256 |
sony helvetica bold r |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6257 |
adobe courier medium i |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6258 |
msic fixed o |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6259 |
... ... |
295 | 6260 |
" |
6261 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6262 |
size isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6263 |
sizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6264 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6265 |
sizeMatch := size printString , '0' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6266 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6267 |
foundry isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6268 |
foundryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6269 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6270 |
foundryMatch := foundry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6271 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6272 |
family isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6273 |
familyMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6274 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6275 |
familyMatch := family |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6276 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6277 |
weight isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6278 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6279 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6280 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6281 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6282 |
slant isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6283 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6284 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6285 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6286 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6287 |
spc isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6288 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6289 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6290 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6291 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6292 |
pSize isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6293 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6294 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6295 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6296 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6297 |
registry isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6298 |
registryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6299 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6300 |
registryMatch := registry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6301 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6302 |
encoding isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6303 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6304 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6305 |
encodingMatch := encoding |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6306 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6307 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6308 |
theName := ('-' , foundryMatch, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6309 |
'-' , familyMatch, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6310 |
'-' , weightMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6311 |
'-' , slantMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6312 |
'-' , spcMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6313 |
'-*' , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6314 |
'-' , pSizeMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6315 |
'-' , sizeMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6316 |
'-*-*-*-*' , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6317 |
'-' , registryMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6318 |
'-' , encodingMatch). |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6319 |
|
697 | 6320 |
"/ Transcript showCR:theName; endEntry. |
295 | 6321 |
|
6322 |
^ self createFontFor:theName. |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6323 |
|
295 | 6324 |
|
6325 |
" |
|
6326 |
Display getFontWithFoundry:'*' |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6327 |
family:'courier' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6328 |
weight:'medium' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6329 |
slant:'r' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6330 |
spacing:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6331 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6332 |
size:13 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6333 |
registry:'iso8859' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6334 |
encoding:'*' |
295 | 6335 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6336 |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6337 |
"Modified: 10.4.1997 / 19:15:44 / cg" |
295 | 6338 |
! |
6339 |
||
1344 | 6340 |
listOfAvailableFonts |
295 | 6341 |
"return a list with all available fonts on this display. |
6342 |
Since this takes a long time, keep the result of the query for the |
|
6343 |
next time. The elements of the returned collection are instances of |
|
6344 |
FontDescription." |
|
6345 |
||
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
6346 |
|"stream aName fntDescr" names| |
295 | 6347 |
|
6348 |
listOfXFonts isNil ifTrue:[ |
|
6349 |
"/ |
|
6350 |
"/ old code; using a pipe to xlsfonts |
|
6351 |
"/ |
|
6352 |
"/ stream := PipeStream readingFrom:'xlsfonts ''*'''. |
|
6353 |
"/ stream isNil ifTrue:[^ nil]. |
|
6354 |
"/ listOfXFonts := OrderedCollection new. |
|
6355 |
"/ [stream atEnd] whileFalse:[ |
|
6356 |
"/ aName := stream nextLine. |
|
6357 |
"/ aName notNil ifTrue:[ |
|
6358 |
"/ self decomposeXFontName:aName into: |
|
6359 |
"/ [:family :face :style :size :coding | |
|
6360 |
"/ family notNil ifTrue:[ |
|
6361 |
"/ fntDescr := FontDescription |
|
6362 |
"/ family:family |
|
6363 |
"/ face:face |
|
6364 |
"/ style:style |
|
6365 |
"/ size:size |
|
6366 |
"/ encoding:coding. |
|
6367 |
"/ listOfXFonts add:fntDescr |
|
6368 |
"/ ] |
|
6369 |
"/ ] |
|
6370 |
"/ ] |
|
6371 |
"/ ]. |
|
6372 |
"/ stream close. |
|
6373 |
"/ "if xlsfont is broken ... (hey sco)" |
|
6374 |
"/ (listOfXFonts size == 0) ifTrue:[ |
|
6375 |
"/ listOfXFonts := nil |
|
6376 |
"/ ] ifFalse:[ |
|
6377 |
"/ listOfXFonts sort:[:a :b | a family < b family]. |
|
6378 |
"/ ]. |
|
6379 |
||
1344 | 6380 |
"/ |
6381 |
"/ new code: |
|
6382 |
"/ use new primitive to get font names; |
|
6383 |
"/ this is much faster, and also works on systems where |
|
6384 |
"/ a) xlsfonts is broken (sco) |
|
6385 |
"/ b) xlsfonts is not available (aix) |
|
6386 |
"/ |
|
6387 |
names := self getAvailableFontsMatching:'*'. |
|
6388 |
names isNil ifTrue:[ |
|
6389 |
"no names returned ..." |
|
6390 |
^ nil |
|
6391 |
]. |
|
6392 |
listOfXFonts := names collect:[:aName | |
|
6393 |
|fntDescr| |
|
6394 |
||
6395 |
(self decomposeXFontName:aName into: |
|
6396 |
[:family :face :style :size :coding | |
|
6397 |
family notNil ifTrue:[ |
|
6398 |
fntDescr := FontDescription |
|
6399 |
family:family |
|
6400 |
face:face |
|
6401 |
style:style |
|
6402 |
size:size |
|
6403 |
encoding:coding. |
|
6404 |
] ifFalse:[ |
|
6405 |
fntDescr := FontDescription |
|
6406 |
name:aName |
|
6407 |
] |
|
6408 |
] |
|
6409 |
) ifFalse:[ |
|
6410 |
fntDescr := FontDescription name:aName. |
|
6411 |
]. |
|
6412 |
fntDescr |
|
6413 |
]. |
|
295 | 6414 |
|
6415 |
]. |
|
6416 |
^ listOfXFonts |
|
6417 |
||
6418 |
" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6419 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6420 |
|
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6421 |
Display getAvailableFontsMatching:'*'. |
295 | 6422 |
" |
6423 |
||
6424 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6425 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 6426 |
! |
6427 |
||
1344 | 6428 |
releaseFont:aFontId |
295 | 6429 |
|
6430 |
%{ /* NOCONTEXT */ |
|
6431 |
||
6432 |
XFontStruct *f; |
|
6433 |
||
1212 | 6434 |
if (! ISCONNECTED) { |
1344 | 6435 |
RETURN ( self ); |
1212 | 6436 |
} |
6437 |
||
6438 |
if (__isExternalAddress(aFontId)) { |
|
1344 | 6439 |
f = _FontVal(aFontId); |
6440 |
if (f) { |
|
6441 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6442 |
ENTER_XLIB(); |
1344 | 6443 |
XFreeFont(myDpy, f); |
1974 | 6444 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6445 |
#ifdef COUNT_RESOURCES |
1344 | 6446 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6447 |
#endif |
1344 | 6448 |
END_INTERRUPTSBLOCKED |
6449 |
RETURN ( self ); |
|
6450 |
} |
|
295 | 6451 |
} |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6452 |
%}. |
295 | 6453 |
self primitiveFailed |
6454 |
! |
|
6455 |
||
1344 | 6456 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 6457 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
6458 |
on this display. |
|
6459 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
6460 |
||
6461 |
|sizes| |
|
6462 |
||
466 | 6463 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 6464 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
2974 | 6465 |
"special: in X11R5 and above, size 0 means: |
6466 |
there are scaled versions in all sizes available" |
|
6467 |
||
6468 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96) |
|
295 | 6469 |
]. |
6470 |
^ sizes |
|
6471 |
||
6472 |
" |
|
6473 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
6474 |
" |
|
466 | 6475 |
|
6476 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 6477 |
! |
6478 |
||
1344 | 6479 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
295 | 6480 |
|
6481 |
%{ /* NOCONTEXT */ |
|
6482 |
||
6483 |
XFontStruct *f; |
|
6484 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6485 |
int len, n, i1, i2, l; |
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
6486 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6487 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6488 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6489 |
int nInstBytes; |
295 | 6490 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6491 |
if (ISCONNECTED) { |
1344 | 6492 |
if (__bothSmallInteger(index1, index2) |
6493 |
&& __isExternalAddress(aFontId) |
|
6494 |
&& __isNonNilObject(aString)) { |
|
6495 |
f = _FontVal(aFontId); |
|
6496 |
if (! f) goto fail; |
|
6497 |
||
6498 |
i1 = __intVal(index1) - 1; |
|
6499 |
cls = __qClass(aString); |
|
6500 |
||
6501 |
if (i1 >= 0) { |
|
6502 |
i2 = __intVal(index2) - 1; |
|
6503 |
if (i2 < i1) { |
|
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6504 |
RETURN ( __MKSMALLINT(0) ); |
1344 | 6505 |
} |
6506 |
||
1831 | 6507 |
cp = (char *) __stringVal(aString); |
1344 | 6508 |
l = i2 - i1 + 1; |
6509 |
||
6510 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
6511 |
n = __stringSize(aString); |
1344 | 6512 |
if (i2 < n) { |
6513 |
cp += i1; |
|
6514 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6515 |
ENTER_XLIB(); |
1344 | 6516 |
len = XTextWidth(f, cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6517 |
LEAVE_XLIB(); |
1344 | 6518 |
END_INTERRUPTSBLOCKED |
6519 |
RETURN ( __MKSMALLINT(len) ); |
|
6520 |
} |
|
6521 |
} |
|
6522 |
||
6523 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6524 |
cp += nInstBytes; |
|
6525 |
||
6526 |
if (__isBytes(aString)) { |
|
6527 |
n = __byteArraySize(aString) - nInstBytes; |
|
6528 |
if (i2 < n) { |
|
6529 |
cp += i1; |
|
6530 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6531 |
ENTER_XLIB(); |
1344 | 6532 |
len = XTextWidth(f, cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6533 |
LEAVE_XLIB(); |
1344 | 6534 |
END_INTERRUPTSBLOCKED |
6535 |
RETURN ( __MKSMALLINT(len) ); |
|
6536 |
} |
|
6537 |
} |
|
6538 |
||
6539 |
/* TWOBYTESTRINGS */ |
|
6540 |
if (__isWords(aString)) { |
|
6541 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6542 |
||
6543 |
if (i2 < n) { |
|
6544 |
union { |
|
6545 |
char b[2]; |
|
6546 |
unsigned short s; |
|
6547 |
} u; |
|
6548 |
int i; |
|
6549 |
XChar2b *cp2 = (XChar2b *)0; |
|
6550 |
int mustFree = 0; |
|
6551 |
||
6552 |
cp += (i1 * 2); |
|
6553 |
if (l > 1000) l = 1000; |
|
6554 |
||
6555 |
/* |
|
6556 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6557 |
* X expects them MSB first |
|
6558 |
* convert as required |
|
6559 |
*/ |
|
6560 |
||
6561 |
u.s = 0x1234; |
|
6562 |
if (u.b[0] != 0x12) { |
|
6563 |
if (l <= NLOCALBUFFER) { |
|
6564 |
cp2 = xlatebuffer; |
|
6565 |
} else { |
|
6566 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
6567 |
mustFree = 1; |
|
6568 |
} |
|
6569 |
for (i=0; i<l; i++) { |
|
6570 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6571 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6572 |
} |
|
6573 |
cp = (char *) cp2; |
|
6574 |
} |
|
6575 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6576 |
ENTER_XLIB(); |
1344 | 6577 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6578 |
LEAVE_XLIB(); |
1344 | 6579 |
END_INTERRUPTSBLOCKED |
6580 |
||
6581 |
if (mustFree) { |
|
6582 |
free(cp2); |
|
6583 |
} |
|
6584 |
||
6585 |
RETURN ( __MKSMALLINT(len) ); |
|
6586 |
} |
|
6587 |
} |
|
6588 |
} |
|
6589 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6590 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6591 |
#undef NLOCALBUFFER |
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
6592 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6593 |
%}. |
295 | 6594 |
self primitiveFailed. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6595 |
^ 0 |
295 | 6596 |
! |
6597 |
||
1344 | 6598 |
widthOf:aString inFont:aFontId |
295 | 6599 |
|
6600 |
%{ /* NOCONTEXT */ |
|
6601 |
||
6602 |
XFontStruct *f; |
|
6603 |
char *cp; |
|
6604 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
6605 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6606 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6607 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6608 |
int nInstBytes; |
295 | 6609 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6610 |
if (ISCONNECTED) { |
1344 | 6611 |
if (__isExternalAddress(aFontId) |
6612 |
&& __isNonNilObject(aString)) { |
|
6613 |
f = _FontVal(aFontId); |
|
6614 |
if (! f) goto fail; |
|
6615 |
||
6616 |
cls = __qClass(aString); |
|
6617 |
||
1831 | 6618 |
cp = (char *) __stringVal(aString); |
1344 | 6619 |
|
6620 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
6621 |
n = __stringSize(aString); |
1344 | 6622 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6623 |
ENTER_XLIB(); |
1344 | 6624 |
len = XTextWidth(f, cp, n); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6625 |
LEAVE_XLIB(); |
1344 | 6626 |
END_INTERRUPTSBLOCKED |
6627 |
RETURN ( __MKSMALLINT(len) ); |
|
6628 |
} |
|
6629 |
||
6630 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6631 |
cp += nInstBytes; |
|
6632 |
||
6633 |
if (__isBytes(aString)) { |
|
6634 |
n = __byteArraySize(aString) - nInstBytes; |
|
6635 |
||
6636 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6637 |
ENTER_XLIB(); |
1344 | 6638 |
len = XTextWidth(f, cp, n); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6639 |
LEAVE_XLIB(); |
1344 | 6640 |
END_INTERRUPTSBLOCKED |
6641 |
RETURN ( __MKSMALLINT(len) ); |
|
6642 |
} |
|
6643 |
||
6644 |
/* TWOBYTESTRINGS */ |
|
6645 |
if (__isWords(aString)) { |
|
6646 |
union { |
|
6647 |
char b[2]; |
|
6648 |
unsigned short s; |
|
6649 |
} u; |
|
6650 |
int i; |
|
6651 |
XChar2b *cp2; |
|
6652 |
int mustFree = 0; |
|
6653 |
||
6654 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6655 |
if (n > 1000) n = 1000; |
|
6656 |
||
6657 |
/* |
|
6658 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6659 |
* X expects them MSB first |
|
6660 |
* convert as required |
|
6661 |
*/ |
|
6662 |
||
6663 |
u.s = 0x1234; |
|
6664 |
if (u.b[0] != 0x12) { |
|
6665 |
if (n <= NLOCALBUFFER) { |
|
6666 |
cp2 = xlatebuffer; |
|
6667 |
} else { |
|
6668 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
6669 |
mustFree = 1; |
|
6670 |
} |
|
6671 |
||
6672 |
for (i=0; i<n; i++) { |
|
6673 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6674 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6675 |
} |
|
6676 |
cp = (char *) cp2; |
|
6677 |
} |
|
6678 |
||
6679 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6680 |
ENTER_XLIB(); |
1344 | 6681 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6682 |
LEAVE_XLIB(); |
1344 | 6683 |
END_INTERRUPTSBLOCKED |
6684 |
||
6685 |
if (mustFree) { |
|
6686 |
free(cp2); |
|
6687 |
} |
|
6688 |
||
6689 |
RETURN ( __MKSMALLINT(len) ); |
|
6690 |
} |
|
6691 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6692 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6693 |
#undef NLOCALBUFFER |
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
6694 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6695 |
%}. |
295 | 6696 |
self primitiveFailed. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6697 |
^ 0 |
295 | 6698 |
! ! |
6699 |
||
6700 |
!XWorkstation methodsFor:'grabbing '! |
|
6701 |
||
1344 | 6702 |
allowEvents:mode |
295 | 6703 |
%{ /* NOCONTEXT */ |
6704 |
||
6705 |
int _mode, ok = 1; |
|
6706 |
||
6707 |
if (mode == @symbol(asyncPointer)) |
|
1344 | 6708 |
_mode = AsyncPointer; |
295 | 6709 |
else if (mode == @symbol(syncPointer)) |
1344 | 6710 |
_mode = SyncPointer; |
295 | 6711 |
else if (mode == @symbol(asyncKeyboard)) |
1344 | 6712 |
_mode = AsyncKeyboard; |
295 | 6713 |
else if (mode == @symbol(syncKeyboard)) |
1344 | 6714 |
_mode = SyncKeyboard; |
295 | 6715 |
else if (mode == @symbol(syncBoth)) |
1344 | 6716 |
_mode = SyncBoth; |
295 | 6717 |
else if (mode == @symbol(asyncBoth)) |
1344 | 6718 |
_mode = AsyncBoth; |
295 | 6719 |
else if (mode == @symbol(replayPointer)) |
1344 | 6720 |
_mode = ReplayPointer; |
295 | 6721 |
else if (mode == @symbol(replayKeyboard)) |
1344 | 6722 |
_mode = ReplayKeyboard; |
295 | 6723 |
else |
1344 | 6724 |
ok = 0; |
295 | 6725 |
|
6726 |
if (ok) { |
|
1344 | 6727 |
if (ISCONNECTED) { |
6728 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6729 |
ENTER_XLIB(); |
1344 | 6730 |
XAllowEvents(myDpy, _mode, CurrentTime); |
1974 | 6731 |
LEAVE_XLIB(); |
1344 | 6732 |
END_INTERRUPTSBLOCKED |
6733 |
RETURN (self); |
|
6734 |
} |
|
295 | 6735 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6736 |
%}. |
295 | 6737 |
self primitiveFailed |
6738 |
! |
|
6739 |
||
1344 | 6740 |
grabKeyboardIn:aWindowId |
295 | 6741 |
"grab the keyboard" |
6742 |
||
6743 |
%{ /* NOCONTEXT */ |
|
6744 |
int result, ok; |
|
6745 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6746 |
if (ISCONNECTED) { |
1344 | 6747 |
if (__isExternalAddress(aWindowId)) { |
6748 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6749 |
ENTER_XLIB(); |
1344 | 6750 |
result = XGrabKeyboard(myDpy, |
6751 |
_WindowVal(aWindowId), |
|
6752 |
True /* False */, |
|
6753 |
GrabModeAsync, |
|
6754 |
GrabModeAsync, |
|
6755 |
CurrentTime); |
|
1974 | 6756 |
LEAVE_XLIB(); |
1344 | 6757 |
END_INTERRUPTSBLOCKED |
6758 |
ok = 0; |
|
6759 |
switch(result) { |
|
6760 |
case AlreadyGrabbed: |
|
6761 |
if (@global(ErrorPrinting) == true) { |
|
6762 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
|
6763 |
} |
|
6764 |
break; |
|
6765 |
case GrabNotViewable: |
|
6766 |
if (@global(ErrorPrinting) == true) { |
|
6767 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
|
6768 |
} |
|
6769 |
break; |
|
6770 |
case GrabInvalidTime: |
|
6771 |
if (@global(ErrorPrinting) == true) { |
|
6772 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
|
6773 |
} |
|
6774 |
break; |
|
6775 |
case GrabFrozen: |
|
6776 |
if (@global(ErrorPrinting) == true) { |
|
6777 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
|
6778 |
} |
|
6779 |
break; |
|
6780 |
default: |
|
6781 |
ok = 1; |
|
6782 |
break; |
|
6783 |
} |
|
6784 |
if (! ok) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6785 |
ENTER_XLIB(); |
1344 | 6786 |
XUngrabKeyboard(myDpy, CurrentTime); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6787 |
LEAVE_XLIB(); |
1344 | 6788 |
RETURN (false); |
6789 |
} |
|
6790 |
||
6791 |
RETURN ( true ); |
|
6792 |
} |
|
295 | 6793 |
} |
1183 | 6794 |
%}. |
295 | 6795 |
self primitiveFailed |
6796 |
! |
|
6797 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6798 |
grabPointerIn:aWindowId withCursor:aCursorId eventMask:eventMask pointerMode:pMode keyboardMode:kMode confineTo:confineId |
295 | 6799 |
"grap the pointer - return true if ok" |
6800 |
||
6801 |
%{ /* NOCONTEXT */ |
|
6802 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6803 |
int result, ok, evMask; |
295 | 6804 |
Window confineWin; |
6805 |
Cursor curs; |
|
6806 |
int pointer_mode, keyboard_mode; |
|
6807 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6808 |
if (ISCONNECTED) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6809 |
if (__isExternalAddress(aWindowId)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6810 |
if (__isExternalAddress(confineId)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6811 |
confineWin = _WindowVal(confineId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6812 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6813 |
confineWin = (Window) None; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6814 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6815 |
if (__isExternalAddress(aCursorId)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6816 |
curs = _CursorVal(aCursorId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6817 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6818 |
curs = (Cursor) None; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6819 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6820 |
if (pMode == @symbol(sync)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6821 |
pointer_mode = GrabModeSync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6822 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6823 |
pointer_mode = GrabModeAsync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6824 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6825 |
if (kMode == @symbol(sync)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6826 |
keyboard_mode = GrabModeSync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6827 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6828 |
keyboard_mode = GrabModeAsync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6829 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6830 |
if (__isSmallInteger(eventMask)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6831 |
evMask = __intVal(eventMask); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6832 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6833 |
evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6834 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6835 |
BEGIN_INTERRUPTSBLOCKED |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6836 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6837 |
ENTER_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6838 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6839 |
result = XGrabPointer(myDpy, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6840 |
_WindowVal(aWindowId), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6841 |
False, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6842 |
evMask, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6843 |
pointer_mode, keyboard_mode, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6844 |
confineWin, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6845 |
curs, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6846 |
CurrentTime); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6847 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6848 |
LEAVE_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6849 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6850 |
END_INTERRUPTSBLOCKED |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6851 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6852 |
ok = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6853 |
switch (result) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6854 |
case AlreadyGrabbed: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6855 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6856 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6857 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6858 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6859 |
case GrabNotViewable: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6860 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6861 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6862 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6863 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6864 |
case GrabInvalidTime: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6865 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6866 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6867 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6868 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6869 |
case GrabFrozen: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6870 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6871 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6872 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6873 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6874 |
default: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6875 |
ok = 1; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6876 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6877 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6878 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6879 |
if (! ok) { |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6880 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6881 |
ENTER_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6882 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6883 |
XUngrabPointer(myDpy, CurrentTime); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6884 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6885 |
LEAVE_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6886 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6887 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6888 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6889 |
RETURN ( true ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6890 |
} |
295 | 6891 |
} |
1183 | 6892 |
%}. |
295 | 6893 |
self primitiveFailed |
6894 |
! |
|
6895 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6896 |
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6897 |
"grap the pointer - return true if ok" |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6898 |
|
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6899 |
^ self |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6900 |
grabPointerIn:aWindowId |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6901 |
withCursor:aCursorId |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6902 |
eventMask:nil |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6903 |
pointerMode:pMode |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6904 |
keyboardMode:kMode |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6905 |
confineTo:confineId |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6906 |
|
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6907 |
"Modified: / 28.7.1998 / 02:47:51 / cg" |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6908 |
! |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6909 |
|
1344 | 6910 |
ungrabKeyboard |
295 | 6911 |
"release the keyboard" |
6912 |
||
6913 |
%{ /* NOCONTEXT */ |
|
6914 |
||
6915 |
if (ISCONNECTED) { |
|
2541 | 6916 |
Display *dpy = myDpy; |
6917 |
||
1344 | 6918 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6919 |
ENTER_XLIB(); |
2541 | 6920 |
XUngrabKeyboard(dpy, CurrentTime); |
6921 |
XSync(dpy, 0); |
|
1974 | 6922 |
LEAVE_XLIB(); |
1344 | 6923 |
END_INTERRUPTSBLOCKED |
295 | 6924 |
} |
6925 |
%}. |
|
6926 |
activeKeyboardGrab := nil |
|
6927 |
! |
|
6928 |
||
1344 | 6929 |
ungrabPointer |
295 | 6930 |
"release the pointer" |
6931 |
||
6932 |
%{ /* NOCONTEXT */ |
|
6933 |
||
6934 |
if (ISCONNECTED) { |
|
2541 | 6935 |
Display *dpy = myDpy; |
6936 |
||
1344 | 6937 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6938 |
ENTER_XLIB(); |
2541 | 6939 |
XUngrabPointer(dpy, CurrentTime); |
6940 |
XSync(dpy, 0); |
|
1974 | 6941 |
LEAVE_XLIB(); |
1344 | 6942 |
END_INTERRUPTSBLOCKED |
295 | 6943 |
} |
6944 |
%}. |
|
6945 |
activePointerGrab := nil |
|
6946 |
! ! |
|
6947 |
||
6948 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
6949 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
6950 |
noClipIn:aDrawableId gc:aGCId |
295 | 6951 |
"disable clipping rectangle" |
6952 |
||
6953 |
%{ /* NOCONTEXT */ |
|
6954 |
||
6955 |
XGCValues gcv; |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6956 |
GC gc; |
295 | 6957 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6958 |
if (ISCONNECTED) { |
1344 | 6959 |
if (__isExternalAddress(aGCId)) { |
6960 |
gc = _GCVal(aGCId); |
|
6961 |
gcv.clip_mask = None; |
|
1974 | 6962 |
ENTER_XLIB(); |
1344 | 6963 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
1974 | 6964 |
LEAVE_XLIB(); |
1344 | 6965 |
RETURN ( self ); |
6966 |
} |
|
295 | 6967 |
} |
6968 |
%}. |
|
6969 |
self primitiveFailed |
|
6970 |
! |
|
6971 |
||
1344 | 6972 |
setBackground:bgColorIndex in:aGCId |
295 | 6973 |
"set background color to be drawn with" |
6974 |
||
6975 |
%{ /* NOCONTEXT */ |
|
6976 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6977 |
if (ISCONNECTED) { |
1344 | 6978 |
if (__isExternalAddress(aGCId) |
6979 |
&& __isSmallInteger(bgColorIndex)) { |
|
1974 | 6980 |
ENTER_XLIB(); |
1344 | 6981 |
XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); |
1974 | 6982 |
LEAVE_XLIB(); |
1344 | 6983 |
RETURN ( self ); |
6984 |
} |
|
295 | 6985 |
} |
6986 |
%}. |
|
6987 |
self primitiveFailed |
|
6988 |
! |
|
6989 |
||
1344 | 6990 |
setBitmapMask:aBitmapId in:aGCId |
295 | 6991 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
6992 |
||
6993 |
%{ /* NOCONTEXT */ |
|
6994 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6995 |
GC gc; |
295 | 6996 |
Pixmap bitmap; |
6997 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6998 |
if (ISCONNECTED) { |
1344 | 6999 |
Display *dpy = myDpy; |
7000 |
||
7001 |
if (__isExternalAddress(aGCId)) { |
|
7002 |
gc = _GCVal(aGCId); |
|
7003 |
if (__isExternalAddress(aBitmapId)) { |
|
7004 |
bitmap = _PixmapVal(aBitmapId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7005 |
ENTER_XLIB(); |
1344 | 7006 |
XSetStipple(dpy, gc, bitmap); |
7007 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7008 |
LEAVE_XLIB(); |
1344 | 7009 |
RETURN ( self ); |
7010 |
} |
|
7011 |
if (aBitmapId == nil) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7012 |
ENTER_XLIB(); |
1344 | 7013 |
XSetFillStyle(dpy, gc, FillSolid); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7014 |
LEAVE_XLIB(); |
1344 | 7015 |
RETURN ( self ); |
7016 |
} |
|
7017 |
} |
|
295 | 7018 |
} |
7019 |
%}. |
|
7020 |
self primitiveFailed |
|
7021 |
! |
|
7022 |
||
1681
069ede63fb19
pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
7023 |
setClipByChildren:aBool in:aDrawableId gc:aGCId |
295 | 7024 |
"enable/disable drawing into child views" |
7025 |
||
7026 |
%{ /* NOCONTEXT */ |
|
7027 |
||
7028 |
XGCValues gcv; |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7029 |
GC gc; |
295 | 7030 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7031 |
if (ISCONNECTED) { |
1694 | 7032 |
if (__isExternalAddress(aGCId)) { |
7033 |
gc = _GCVal(aGCId); |
|
7034 |
if (aBool == true) |
|
7035 |
gcv.subwindow_mode = ClipByChildren; |
|
7036 |
else |
|
7037 |
gcv.subwindow_mode = IncludeInferiors; |
|
7038 |
||
1974 | 7039 |
ENTER_XLIB(); |
1694 | 7040 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
1974 | 7041 |
LEAVE_XLIB(); |
1694 | 7042 |
RETURN ( self ); |
7043 |
} |
|
295 | 7044 |
} |
7045 |
%}. |
|
7046 |
self primitiveFailed |
|
7047 |
! |
|
7048 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
7049 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId |
295 | 7050 |
"clip to a rectangle" |
7051 |
||
7052 |
%{ /* NOCONTEXT */ |
|
7053 |
||
7054 |
XRectangle r; |
|
7055 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7056 |
if (ISCONNECTED) { |
1344 | 7057 |
if (__isExternalAddress(aGCId) |
7058 |
&& __bothSmallInteger(clipX, clipY) |
|
7059 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
7060 |
r.x = __intVal(clipX); |
|
7061 |
r.y = __intVal(clipY); |
|
7062 |
r.width = __intVal(clipWidth); |
|
7063 |
r.height = __intVal(clipHeight); |
|
1974 | 7064 |
ENTER_XLIB(); |
1344 | 7065 |
XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
1974 | 7066 |
LEAVE_XLIB(); |
1344 | 7067 |
RETURN ( self ); |
7068 |
} |
|
295 | 7069 |
} |
7070 |
%}. |
|
7071 |
self primitiveFailed |
|
7072 |
! |
|
7073 |
||
1344 | 7074 |
setDashes:dashList dashOffset:offset in:aGCId |
788 | 7075 |
"set line attributes" |
7076 |
||
7077 |
%{ /* NOCONTEXT */ |
|
7078 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7079 |
if (ISCONNECTED) { |
1344 | 7080 |
if (__isExternalAddress(aGCId) |
7081 |
&& __isSmallInteger(offset) |
|
7082 |
&& __isByteArray(dashList)) { |
|
1974 | 7083 |
ENTER_XLIB(); |
1344 | 7084 |
XSetDashes(myDpy, _GCVal(aGCId), |
7085 |
__intVal(offset), |
|
7086 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
7087 |
__byteArraySize(dashList)); |
|
1974 | 7088 |
LEAVE_XLIB(); |
1344 | 7089 |
RETURN ( self ); |
7090 |
} |
|
788 | 7091 |
} |
7092 |
bad: ; |
|
7093 |
%}. |
|
7094 |
" |
|
7095 |
either aGCId is invalid, |
|
7096 |
and/or dashList is not a byteArray |
|
7097 |
and/or offset is not a smallInteger |
|
7098 |
" |
|
7099 |
self primitiveFailed |
|
7100 |
! |
|
7101 |
||
1344 | 7102 |
setFont:aFontId in:aGCId |
295 | 7103 |
"set font to be drawn in" |
7104 |
||
7105 |
%{ /* NOCONTEXT */ |
|
7106 |
||
7107 |
XFontStruct *f; |
|
7108 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7109 |
if (ISCONNECTED) { |
1344 | 7110 |
if (__isExternalAddress(aFontId) |
7111 |
&& __isExternalAddress(aGCId)) { |
|
7112 |
f = (XFontStruct *) _FontVal(aFontId); |
|
1974 | 7113 |
ENTER_XLIB(); |
1344 | 7114 |
XSetFont(myDpy, _GCVal(aGCId), f->fid); |
1974 | 7115 |
LEAVE_XLIB(); |
1344 | 7116 |
RETURN ( self ); |
7117 |
} |
|
295 | 7118 |
} |
7119 |
%}. |
|
7120 |
" |
|
7121 |
aGCId and/or aFontId are invalid |
|
7122 |
" |
|
7123 |
self primitiveFailed |
|
7124 |
! |
|
7125 |
||
1344 | 7126 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
295 | 7127 |
"set foreground and background colors to be drawn with" |
7128 |
||
7129 |
%{ /* NOCONTEXT */ |
|
7130 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7131 |
GC gc; |
295 | 7132 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7133 |
if (ISCONNECTED) { |
1344 | 7134 |
Display *dpy = myDpy; |
7135 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
7136 |
&& __isExternalAddress(aGCId)) { |
|
7137 |
gc = _GCVal(aGCId); |
|
7138 |
||
1974 | 7139 |
ENTER_XLIB(); |
1344 | 7140 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
7141 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
1974 | 7142 |
LEAVE_XLIB(); |
1344 | 7143 |
RETURN ( self ); |
7144 |
} |
|
295 | 7145 |
} |
7146 |
%}. |
|
7147 |
self primitiveFailed |
|
7148 |
! |
|
7149 |
||
1344 | 7150 |
setForeground:fgColorIndex in:aGCId |
295 | 7151 |
"set foreground color to be drawn with" |
7152 |
||
7153 |
%{ /* NOCONTEXT */ |
|
7154 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7155 |
if (ISCONNECTED) { |
1344 | 7156 |
if (__isExternalAddress(aGCId) |
7157 |
&& __isSmallInteger(fgColorIndex)) { |
|
1974 | 7158 |
ENTER_XLIB(); |
1344 | 7159 |
XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); |
1974 | 7160 |
LEAVE_XLIB(); |
1344 | 7161 |
RETURN ( self ); |
7162 |
} |
|
295 | 7163 |
} |
7164 |
%}. |
|
7165 |
self primitiveFailed |
|
7166 |
! |
|
7167 |
||
1344 | 7168 |
setFunction:aFunctionSymbol in:aGCId |
295 | 7169 |
"set alu function to be drawn with" |
7170 |
||
7171 |
%{ /* NOCONTEXT */ |
|
7172 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7173 |
GC gc; |
295 | 7174 |
int fun = -1; |
7175 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7176 |
if (ISCONNECTED) { |
1344 | 7177 |
if (__isExternalAddress(aGCId)) { |
7178 |
gc = _GCVal(aGCId); |
|
7179 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
|
7180 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
|
7181 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
|
7182 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
|
7183 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
|
7184 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
|
7185 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
|
7186 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
|
7187 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
|
7188 |
if (fun != -1) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7189 |
ENTER_XLIB(); |
1344 | 7190 |
XSetFunction(myDpy, gc, fun); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7191 |
LEAVE_XLIB(); |
1344 | 7192 |
RETURN ( self ); |
7193 |
} |
|
7194 |
} |
|
295 | 7195 |
} |
7196 |
%}. |
|
7197 |
" |
|
7198 |
either aGCId is not an integer, or an invalid symbol |
|
7199 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
7200 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
7201 |
" |
|
7202 |
self primitiveFailed |
|
7203 |
! |
|
7204 |
||
1344 | 7205 |
setGraphicsExposures:aBoolean in:aGCId |
295 | 7206 |
"set or clear the graphics exposures flag" |
7207 |
||
7208 |
%{ /* NOCONTEXT */ |
|
7209 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7210 |
if (ISCONNECTED) { |
1344 | 7211 |
if (__isExternalAddress(aGCId)) { |
1974 | 7212 |
ENTER_XLIB(); |
1344 | 7213 |
XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); |
1974 | 7214 |
LEAVE_XLIB(); |
1344 | 7215 |
RETURN ( self ); |
7216 |
} |
|
295 | 7217 |
} |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7218 |
%}. |
295 | 7219 |
self primitiveFailed |
7220 |
! |
|
7221 |
||
1344 | 7222 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
1455 | 7223 |
"set line attributes; |
7224 |
lineStyle must be one of #solid, #dashed or #doubleDashed; |
|
7225 |
capStyle one of: #notLast, #butt, #round or #projecting; |
|
7226 |
joinStyle one of: #miter, #bevel or #round." |
|
295 | 7227 |
|
7228 |
%{ /* NOCONTEXT */ |
|
7229 |
||
7230 |
int x_style, x_cap, x_join; |
|
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7231 |
static char dashList[2] = { 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7232 |
static char dotList[2] = { 4,4 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7233 |
static char dashDotList[4] = { 4,1 , 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7234 |
static char dashDotDotList[6] = { 4,1 , 1,1 , 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7235 |
char *x_dashes = 0; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7236 |
int x_nDash; |
295 | 7237 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7238 |
if (ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7239 |
if (__isExternalAddress(aGCId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7240 |
&& __isSmallInteger(aNumber)) { |
2541 | 7241 |
Display *dpy = myDpy; |
7242 |
||
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7243 |
if (lineStyle == @symbol(solid)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7244 |
x_dashes = (char *)0; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7245 |
x_style = LineSolid; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7246 |
} else if (lineStyle == @symbol(dashed)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7247 |
x_dashes = dashList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7248 |
x_nDash = sizeof(dashList); |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
7249 |
x_style = LineOnOffDash; |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7250 |
} else if (lineStyle == @symbol(doubleDashed)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7251 |
x_dashes = dashList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7252 |
x_nDash = sizeof(dashList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7253 |
x_style = LineDoubleDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7254 |
} else if (lineStyle == @symbol(dotted)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7255 |
x_dashes = dotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7256 |
x_nDash = sizeof(dotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7257 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7258 |
} else if (lineStyle == @symbol(dashDot)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7259 |
x_dashes = dashDotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7260 |
x_nDash = sizeof(dashDotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7261 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7262 |
} else if (lineStyle == @symbol(dashDotDot)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7263 |
x_dashes = dashDotDotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7264 |
x_nDash = sizeof(dashDotDotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7265 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7266 |
} else goto bad; |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7267 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7268 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7269 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7270 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7271 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7272 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7273 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7274 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7275 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7276 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7277 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7278 |
|
1974 | 7279 |
ENTER_XLIB(); |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7280 |
if (x_dashes) { |
2541 | 7281 |
XSetDashes(dpy, _GCVal(aGCId), 0, x_dashes, x_nDash); |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7282 |
} |
2541 | 7283 |
XSetLineAttributes(dpy, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7284 |
_GCVal(aGCId), __intVal(aNumber), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7285 |
x_style, x_cap, x_join); |
1974 | 7286 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7287 |
RETURN ( self ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7288 |
} |
295 | 7289 |
} |
7290 |
bad: ; |
|
7291 |
%}. |
|
7292 |
" |
|
7293 |
either aGCId is invalid, |
|
1455 | 7294 |
and/or lineWidth is not a smallInteger, |
295 | 7295 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
7296 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
7297 |
and/or joinStyle is none of #miter, #bevel, #round |
|
7298 |
" |
|
7299 |
self primitiveFailed |
|
7300 |
! |
|
7301 |
||
1344 | 7302 |
setMaskOriginX:orgX y:orgY in:aGCid |
295 | 7303 |
"set the mask origin" |
7304 |
||
7305 |
%{ /* NOCONTEXT */ |
|
7306 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7307 |
if (ISCONNECTED) { |
1344 | 7308 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
1974 | 7309 |
ENTER_XLIB(); |
1344 | 7310 |
XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
1974 | 7311 |
LEAVE_XLIB(); |
1344 | 7312 |
RETURN ( self ); |
7313 |
} |
|
295 | 7314 |
} |
7315 |
%}. |
|
7316 |
self primitiveFailed |
|
7317 |
! |
|
7318 |
||
1344 | 7319 |
setPixmapMask:aPixmapId in:aGCId |
295 | 7320 |
"set or clear the drawing mask - a pixmap mask providing full color" |
7321 |
||
7322 |
%{ /* NOCONTEXT */ |
|
7323 |
||
7324 |
Display *dpy = myDpy; |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7325 |
GC gc; |
295 | 7326 |
Pixmap pixmap; |
7327 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7328 |
if (ISCONNECTED) { |
1344 | 7329 |
if (__isExternalAddress(aGCId)) { |
7330 |
gc = _GCVal(aGCId); |
|
7331 |
if (__isExternalAddress(aPixmapId)) { |
|
7332 |
pixmap = _PixmapVal(aPixmapId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7333 |
ENTER_XLIB(); |
1344 | 7334 |
XSetTile(dpy, gc, pixmap); |
7335 |
XSetFillStyle(dpy, gc, FillTiled); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7336 |
LEAVE_XLIB(); |
1344 | 7337 |
RETURN ( self ); |
7338 |
} |
|
7339 |
if (aPixmapId == nil) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7340 |
ENTER_XLIB(); |
1344 | 7341 |
XSetFillStyle(dpy, gc, FillSolid); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7342 |
LEAVE_XLIB(); |
1344 | 7343 |
RETURN ( self ); |
7344 |
} |
|
7345 |
} |
|
295 | 7346 |
} |
7347 |
%}. |
|
7348 |
self primitiveFailed |
|
7349 |
! ! |
|
7350 |
||
7351 |
!XWorkstation methodsFor:'initialize / release'! |
|
7352 |
||
1344 | 7353 |
closeConnection |
295 | 7354 |
"close down the connection to the X-server" |
7355 |
||
7356 |
%{ /* NOCONTEXT */ |
|
7357 |
||
7358 |
if (ISCONNECTED) { |
|
1344 | 7359 |
Display *dpy = myDpy; |
7360 |
||
7361 |
BEGIN_INTERRUPTSBLOCKED |
|
7362 |
__INST(displayId) = nil; |
|
1974 | 7363 |
ENTER_XLIB(); |
1344 | 7364 |
XCloseDisplay(dpy); |
1974 | 7365 |
LEAVE_XLIB(); |
1344 | 7366 |
END_INTERRUPTSBLOCKED |
295 | 7367 |
} |
7368 |
%} |
|
7369 |
! |
|
7370 |
||
1344 | 7371 |
initializeDefaultValues |
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
7372 |
activateOnClick := false. |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7373 |
super initializeDefaultValues. |
295 | 7374 |
! |
7375 |
||
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7376 |
initializeDeviceSignals |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7377 |
super initializeDeviceSignals. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7378 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7379 |
deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignalMayProceed:false. |
2856 | 7380 |
deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7381 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7382 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7383 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7384 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7385 |
! |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7386 |
|
1344 | 7387 |
initializeEventBuffer |
295 | 7388 |
|sz| |
7389 |
||
7390 |
%{ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
7391 |
sz = __MKSMALLINT(sizeof(XEvent) + 100); |
295 | 7392 |
%}. |
7393 |
eventBuffer isNil ifTrue:[ |
|
1344 | 7394 |
eventBuffer := ByteArray new:sz. |
295 | 7395 |
]. |
7396 |
! |
|
7397 |
||
1344 | 7398 |
initializeFor:aDisplayName |
295 | 7399 |
"initialize the receiver for a connection to an X-Server; |
7400 |
the argument, aDisplayName may be nil (for the default server from |
|
7401 |
DISPLAY-variable or command line argument) or the name of the server |
|
7402 |
as hostname:number" |
|
7403 |
||
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
7404 |
|dpyName index arguments| |
295 | 7405 |
|
2286 | 7406 |
displayId notNil ifTrue:[ |
2904
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7407 |
"/ already connected - you bad guy try to trick me manually ? |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7408 |
^ self |
2286 | 7409 |
]. |
7410 |
||
295 | 7411 |
dpyName := aDisplayName. |
7412 |
dpyName isNil ifTrue:[ |
|
2904
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7413 |
"look for a '-display xxx' argument" |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7414 |
(arguments := Smalltalk commandLineArguments) notNil ifTrue:[ |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7415 |
index := arguments indexOf:'-display'. |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7416 |
(index between:1 and:(arguments size - 1)) ifTrue:[ |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7417 |
dpyName := arguments at:index+1 |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7418 |
] |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7419 |
] |
295 | 7420 |
]. |
2286 | 7421 |
|
7422 |
self openConnectionTo:dpyName. |
|
7423 |
||
295 | 7424 |
displayId isNil ifTrue:[ |
2904
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7425 |
"/ could not connect. |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7426 |
"/ only output a message, if running under X |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7427 |
|
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7428 |
((OperatingSystem isMSWINDOWSlike not) or:[WinWorkstation isNil]) ifTrue:[ |
2905 | 7429 |
'XWorkstation [warning]: cannot connect to Display (' errorPrint. |
7430 |
(dpyName ? ((OperatingSystem getEnvironment:'Display') ? 'default')) print. |
|
7431 |
')' errorPrintCR. |
|
2904
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7432 |
]. |
9a2c6cef065f
better error message, if connect is not possible.
Claus Gittinger <cg@exept.de>
parents:
2896
diff
changeset
|
7433 |
^ nil |
295 | 7434 |
]. |
7435 |
||
7436 |
dispatching := false. |
|
7437 |
dispatchingExpose := false. |
|
7438 |
isSlow := false. |
|
7439 |
shiftDown := false. |
|
7440 |
ctrlDown := false. |
|
7441 |
metaDown := false. |
|
7442 |
altDown := false. |
|
7443 |
motionEventCompression := true. |
|
7444 |
buttonsPressed := 0. |
|
7445 |
displayName := dpyName. |
|
7446 |
||
7447 |
protocolsAtom := nil. |
|
7448 |
deleteWindowAtom := nil. |
|
7449 |
saveYourselfAtom := nil. |
|
7450 |
quitAppAtom := nil. |
|
7451 |
||
7452 |
self initializeScreenProperties. |
|
1366 | 7453 |
self initializeDeviceResourceTables. |
295 | 7454 |
|
7455 |
self initializeDefaultValues. |
|
7456 |
self initializeEventBuffer. |
|
7457 |
self initializeSpecialFlags. |
|
7458 |
self initializeKeyboardMap. |
|
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7459 |
self initializeDeviceSignals. |
295 | 7460 |
! |
7461 |
||
1344 | 7462 |
initializeModifierMappings |
295 | 7463 |
|map mod| |
7464 |
||
7465 |
"/ altModifiers := #(Alt_L Alt_R). |
|
7466 |
"/ metaModifiers := #(Meta_L Meta_R). |
|
7467 |
"/ ctrlModifiers := #(Control_L Control_R). |
|
7468 |
"/ shiftModifiers := #(Shift_L Shift_R). |
|
7469 |
||
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7470 |
super initializeModifierMappings. |
295 | 7471 |
altModifierMask := metaModifierMask := nil. |
7472 |
||
7473 |
map := self modifierMapping. |
|
342 | 7474 |
map isNil ifTrue:[ |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7475 |
"/ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7476 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7477 |
"/ setup some reasonable default. If that is not sufficient, |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7478 |
"/ you have to change things from your display.rc file. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7479 |
"/ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7480 |
altModifierMask := self modifier1Mask. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7481 |
metaModifierMask := self modifier2Mask. |
342 | 7482 |
] ifFalse:[ |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7483 |
altModifierMask := 0. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7484 |
metaModifierMask := 0. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7485 |
|
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7486 |
mod := map at:1. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7487 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7488 |
shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7489 |
]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7490 |
mod := map at:3. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7491 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7492 |
ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7493 |
]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7494 |
mod := map at:4. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7495 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7496 |
metaModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7497 |
metaModifierMask := 1 bitShift:(4-1). |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7498 |
]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7499 |
mod := map at:5. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7500 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7501 |
altModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7502 |
altModifierMask := 1 bitShift:(5-1). |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7503 |
] |
295 | 7504 |
]. |
7505 |
||
7506 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
7507 |
! |
|
7508 |
||
1344 | 7509 |
initializeScreenProperties |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7510 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7511 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
7512 |
%{ |
295 | 7513 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7514 |
Display *dpy; |
295 | 7515 |
int scr; |
7516 |
Visual *visual; |
|
7517 |
XVisualInfo viproto; |
|
7518 |
XVisualInfo *vip; /* retured info */ |
|
7519 |
int maxRGBDepth; |
|
7520 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
7521 |
int rgbVisualID; |
|
7522 |
int nvi, i; |
|
7523 |
int shapeEventBase, shapeErrorBase; |
|
7524 |
int shmEventBase, shmErrorBase; |
|
7525 |
char *type, *nm; |
|
7526 |
int dummy; |
|
7527 |
int mask, shift, nBits; |
|
7528 |
||
7529 |
if (ISCONNECTED) { |
|
1344 | 7530 |
dpy = myDpy; |
7531 |
||
7532 |
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask); |
|
7533 |
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask); |
|
7534 |
||
7535 |
BEGIN_INTERRUPTSBLOCKED |
|
7536 |
||
7537 |
__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy)); |
|
7538 |
__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr)); |
|
7539 |
__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr)); |
|
7540 |
__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr)); |
|
7541 |
__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr)); |
|
7542 |
__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr)); |
|
7543 |
__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr)); |
|
7544 |
__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr)); |
|
7545 |
__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr)); |
|
295 | 7546 |
|
7547 |
#ifdef SHAPE |
|
1344 | 7548 |
if (XShapeQueryExtension(dpy, &dummy, &dummy)) |
7549 |
__INST(hasShapeExtension) = true; |
|
7550 |
else |
|
295 | 7551 |
#endif |
1344 | 7552 |
__INST(hasShapeExtension) = false; |
295 | 7553 |
|
7554 |
#ifdef SHM |
|
1344 | 7555 |
if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) |
7556 |
__INST(hasShmExtension) = true; |
|
7557 |
else |
|
295 | 7558 |
#endif |
1344 | 7559 |
__INST(hasShmExtension) = false; |
295 | 7560 |
|
7561 |
#ifdef DPS |
|
1344 | 7562 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
7563 |
__INST(hasDPSExtension) = true; |
|
7564 |
else |
|
295 | 7565 |
#endif |
1344 | 7566 |
__INST(hasDPSExtension) = false; |
295 | 7567 |
|
7568 |
#ifdef XVIDEO |
|
1344 | 7569 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
7570 |
__INST(hasXVideoExtension) = true; |
|
7571 |
else |
|
295 | 7572 |
#endif |
1344 | 7573 |
__INST(hasXVideoExtension) = false; |
295 | 7574 |
|
7575 |
#ifdef MBUF |
|
1344 | 7576 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
7577 |
__INST(hasMbufExtension) = true; |
|
7578 |
else |
|
295 | 7579 |
#endif |
1344 | 7580 |
__INST(hasMbufExtension) = false; |
295 | 7581 |
|
7582 |
#ifdef PEX5 |
|
1344 | 7583 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) |
7584 |
__INST(hasPEXExtension) = true; |
|
7585 |
else |
|
295 | 7586 |
#endif |
1344 | 7587 |
__INST(hasPEXExtension) = false; |
295 | 7588 |
|
7589 |
#ifdef XIE |
|
1344 | 7590 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) |
7591 |
__INST(hasImageExtension) = true; |
|
7592 |
else |
|
295 | 7593 |
#endif |
1344 | 7594 |
__INST(hasImageExtension) = false; |
295 | 7595 |
|
7596 |
#ifdef XI |
|
1344 | 7597 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) |
7598 |
__INST(hasInputExtension) = true; |
|
7599 |
else |
|
295 | 7600 |
#endif |
1344 | 7601 |
__INST(hasInputExtension) = false; |
7602 |
||
7603 |
/* |
|
7604 |
* look for RGB visual |
|
7605 |
*/ |
|
7606 |
nvi = 0; |
|
7607 |
viproto.screen = scr; |
|
7608 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
|
7609 |
maxRGBDepth = 0; |
|
7610 |
for (i = 0; i < nvi; i++) { |
|
7611 |
switch (vip[i].class) { |
|
7612 |
case TrueColor: |
|
7613 |
if (vip[i].depth > maxRGBDepth) { |
|
7614 |
maxRGBDepth = vip[i].depth; |
|
7615 |
rgbRedMask = vip[i].red_mask; |
|
7616 |
rgbGreenMask = vip[i].green_mask; |
|
7617 |
rgbBlueMask = vip[i].blue_mask; |
|
7618 |
rgbVisualID = vip[i].visualid; |
|
7619 |
} |
|
7620 |
break; |
|
7621 |
} |
|
7622 |
} |
|
7623 |
if (vip) XFree ((char *) vip); |
|
7624 |
||
7625 |
if (maxRGBDepth) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
7626 |
__INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual); |
1344 | 7627 |
} |
7628 |
||
7629 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
7630 |
__INST(monitorType) = @symbol(unknown); |
|
7631 |
__INST(hasColors) = true; |
|
7632 |
__INST(hasGreyscales) = true; |
|
7633 |
switch (visual->class) { |
|
7634 |
case StaticGray: |
|
7635 |
__INST(visualType) = @symbol(StaticGray); |
|
7636 |
__INST(hasColors) = false; |
|
7637 |
__INST(monitorType) = @symbol(monochrome); |
|
7638 |
break; |
|
7639 |
case GrayScale: |
|
7640 |
__INST(visualType) = @symbol(GrayScale); |
|
7641 |
__INST(hasColors) = false; |
|
7642 |
__INST(monitorType) = @symbol(monochrome); |
|
7643 |
break; |
|
7644 |
case StaticColor: |
|
7645 |
__INST(visualType) = @symbol(StaticColor); |
|
7646 |
break; |
|
7647 |
case PseudoColor: |
|
7648 |
__INST(visualType) = @symbol(PseudoColor); |
|
7649 |
break; |
|
7650 |
case TrueColor: |
|
7651 |
__INST(visualType) = @symbol(TrueColor); |
|
7652 |
break; |
|
7653 |
case DirectColor: |
|
7654 |
__INST(visualType) = @symbol(DirectColor); |
|
7655 |
break; |
|
7656 |
} |
|
7657 |
if (DisplayCells(dpy, scr) == 2) { |
|
7658 |
__INST(hasColors) = false; |
|
7659 |
__INST(hasGreyscales) = false; |
|
7660 |
__INST(monitorType) = @symbol(monochrome); |
|
7661 |
} |
|
7662 |
__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb); |
|
7663 |
__INST(redMask) = __MKSMALLINT(visual->red_mask); |
|
7664 |
__INST(greenMask) = __MKSMALLINT(visual->green_mask); |
|
7665 |
__INST(blueMask) = __MKSMALLINT(visual->blue_mask); |
|
7666 |
switch (visual->class) { |
|
7667 |
case TrueColor: |
|
7668 |
/* extract number of bits and shift counts */ |
|
7669 |
mask = visual->red_mask; |
|
7670 |
shift = 0; |
|
7671 |
while (mask && ((mask & 1) == 0)) { |
|
7672 |
mask >>= 1; |
|
7673 |
shift++; |
|
7674 |
} |
|
7675 |
__INST(redShift) = __MKSMALLINT(shift); |
|
7676 |
nBits = 0; |
|
7677 |
while (mask) { |
|
7678 |
mask >>= 1; |
|
7679 |
nBits++; |
|
7680 |
} |
|
7681 |
__INST(bitsRed) = __MKSMALLINT(nBits); |
|
7682 |
||
7683 |
mask = visual->green_mask; |
|
7684 |
shift = 0; |
|
7685 |
while (mask && ((mask & 1) == 0)) { |
|
7686 |
mask >>= 1; |
|
7687 |
shift++; |
|
7688 |
} |
|
7689 |
__INST(greenShift) = __MKSMALLINT(shift); |
|
7690 |
nBits = 0; |
|
7691 |
while (mask) { |
|
7692 |
mask >>= 1; |
|
7693 |
nBits++; |
|
7694 |
} |
|
7695 |
__INST(bitsGreen) = __MKSMALLINT(nBits); |
|
7696 |
||
7697 |
mask = visual->blue_mask; |
|
7698 |
shift = 0; |
|
7699 |
while (mask && ((mask & 1) == 0)) { |
|
7700 |
mask >>= 1; |
|
7701 |
shift++; |
|
7702 |
} |
|
7703 |
__INST(blueShift) = __MKSMALLINT(shift); |
|
7704 |
nBits = 0; |
|
7705 |
while (mask) { |
|
7706 |
mask >>= 1; |
|
7707 |
nBits++; |
|
7708 |
} |
|
7709 |
__INST(bitsBlue) = __MKSMALLINT(nBits); |
|
7710 |
break; |
|
7711 |
} |
|
295 | 7712 |
|
7713 |
#ifndef XA_PRIMARY |
|
1344 | 7714 |
__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) ); |
295 | 7715 |
#else |
1344 | 7716 |
__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY ); |
295 | 7717 |
#endif |
7718 |
#ifndef XA_SECONDARY |
|
1344 | 7719 |
__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) ); |
295 | 7720 |
#else |
1344 | 7721 |
__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY ); |
295 | 7722 |
#endif |
7723 |
#ifndef XA_CUT_BUFFER0 |
|
1344 | 7724 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) ); |
295 | 7725 |
#else |
1344 | 7726 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 ); |
295 | 7727 |
#endif |
7728 |
#ifndef XA_STRING |
|
1344 | 7729 |
__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) ); |
295 | 7730 |
#else |
1344 | 7731 |
__INST(stringAtom) = __MKATOMOBJ( XA_STRING ); |
295 | 7732 |
#endif |
7733 |
#ifndef XA_LENGTH |
|
1344 | 7734 |
__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) ); |
295 | 7735 |
#else |
1344 | 7736 |
__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH ); |
295 | 7737 |
#endif |
1533 | 7738 |
#ifndef WM_STATE |
7739 |
__INST(wmStateAtom) = __MKATOMOBJ( XInternAtom(dpy, "WM_STATE", True) ); |
|
7740 |
#else |
|
7741 |
__INST(wmStateAtom) = __MKATOMOBJ( WM_STATE ); |
|
7742 |
#endif |
|
295 | 7743 |
|
1344 | 7744 |
END_INTERRUPTSBLOCKED |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7745 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7746 |
%}. |
295 | 7747 |
! |
7748 |
||
1344 | 7749 |
initializeSpecialFlags |
295 | 7750 |
"perform additional special server implementation flags" |
7751 |
||
7752 |
"/ |
|
7753 |
"/ assume we have it ... (should check) |
|
7754 |
"/ |
|
7755 |
hasSaveUnder := true. |
|
7756 |
ignoreBackingStore := false. |
|
7757 |
||
7758 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
1344 | 7759 |
"/ |
7760 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
7761 |
"/ which does not correctly handle saveUnder |
|
7762 |
"/ |
|
7763 |
hasSaveUnder := false. |
|
295 | 7764 |
]. |
7765 |
! |
|
7766 |
||
2286 | 7767 |
openConnectionTo:dpyName |
7768 |
"open a connection to some display; |
|
7769 |
set my displayId if ok; leaves it as nil of not ok" |
|
7770 |
||
7771 |
%{ |
|
7772 |
Display *dpy; |
|
7773 |
int i; |
|
7774 |
char *nm; |
|
7775 |
||
7776 |
if (__INST(displayId) != nil) { |
|
7777 |
/* |
|
7778 |
* already connected - you bad guy try to |
|
7779 |
* trick me manually ? |
|
7780 |
*/ |
|
7781 |
RETURN ( self ); |
|
7782 |
} |
|
7783 |
||
7784 |
BEGIN_INTERRUPTSBLOCKED |
|
7785 |
||
7786 |
if (__isString(dpyName)) |
|
7787 |
nm = (char *) __stringVal(dpyName); |
|
7788 |
else { |
|
7789 |
dpyName = __MKSTRING((char *)getenv("DISPLAY")); |
|
7790 |
nm = NULL; |
|
7791 |
} |
|
7792 |
dpy = XOpenDisplay(nm); |
|
7793 |
||
7794 |
if (dpy) { |
|
7795 |
static int firstCall = 1; |
|
7796 |
OBJ dpyID; |
|
7797 |
||
7798 |
__INST(displayId) = dpyID = __MKEXTERNALADDRESS(dpy); __STORE(self, dpyID); |
|
7799 |
||
7800 |
if (firstCall) { |
|
7801 |
firstCall = 0; |
|
7802 |
XSetErrorHandler(__XErrorHandler__); |
|
7803 |
XSetIOErrorHandler(__XIOErrorHandler__); |
|
7804 |
} |
|
7805 |
} |
|
7806 |
||
7807 |
END_INTERRUPTSBLOCKED |
|
7808 |
%} |
|
7809 |
! |
|
7810 |
||
1344 | 7811 |
reinitialize |
295 | 7812 |
virtualRootId := rootId := nil. |
7813 |
super reinitialize. |
|
7814 |
dispatchingExpose := nil |
|
7815 |
! ! |
|
7816 |
||
7817 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
7818 |
||
1344 | 7819 |
altModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7820 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7821 |
Notice: ST/X may use the left ALT key as CMD/Meta key, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7822 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7823 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7824 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7825 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7826 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7827 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7828 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7829 |
|
1344 | 7830 |
altModifierMask:aSmallInteger |
341 | 7831 |
"define which key takes the role of an alt-key. |
7832 |
By default, this is X's modifier1, which is the ALT key on |
|
7833 |
most keyboards. However, there may be exceptions to this, |
|
7834 |
and the setting can be changed with: |
|
1344 | 7835 |
Display altModifierMask:(Display modifier2Mask) |
341 | 7836 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
7837 |
" |
|
7838 |
||
7839 |
altModifierMask := aSmallInteger |
|
7840 |
! |
|
7841 |
||
1344 | 7842 |
metaModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7843 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7844 |
Notice: ST/X may use the left ALT key as CMD/Meta key, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7845 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7846 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7847 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7848 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7849 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7850 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7851 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7852 |
|
1344 | 7853 |
metaModifierMask:aSmallInteger |
341 | 7854 |
"define which key takes the role of a meta key. |
7855 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
7856 |
most keyboards (if present at all). |
|
7857 |
However, there may be exceptions to this, and the setting can |
|
7858 |
be changed with: |
|
1344 | 7859 |
Display metaModifierMask:(Display modifier1Mask) |
341 | 7860 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
7861 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
7862 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
7863 |
all the time. On those, you should disable the meta key by setting |
|
7864 |
the mask to 0. |
|
7865 |
" |
|
7866 |
||
7867 |
metaModifierMask := aSmallInteger |
|
7868 |
! |
|
7869 |
||
1344 | 7870 |
modifier1Mask |
341 | 7871 |
"return the Xlib mask bit for the 1st modifier key. |
7872 |
See comment in altModifierMask: / metaModifierMask: for what |
|
7873 |
this could be used." |
|
7874 |
||
7875 |
%{ /* NOCONTEXT */ |
|
7876 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
7877 |
%} |
|
7878 |
! |
|
7879 |
||
1344 | 7880 |
modifier2Mask |
341 | 7881 |
"return the Xlib mask bit for the 2nd modifier key. |
7882 |
See comment in altModifierMask: / metaModifierMask: for what |
|
7883 |
this could be used." |
|
7884 |
||
7885 |
%{ /* NOCONTEXT */ |
|
7886 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
7887 |
%} |
|
7888 |
! |
|
7889 |
||
1344 | 7890 |
modifierMapping |
341 | 7891 |
"Get the Modifier Mapping. |
7892 |
We return an array of arrays of keycodes" |
|
7893 |
||
7894 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
7895 |
||
7896 |
%{ |
|
7897 |
XModifierKeymap *modmap; |
|
7898 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
7899 |
||
7900 |
if (ISCONNECTED) { |
|
1344 | 7901 |
Display *dpy = myDpy; |
7902 |
||
2541 | 7903 |
if ((modmap = XGetModifierMapping(dpy)) != 0) { |
1344 | 7904 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
7905 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
|
7906 |
if (modifierKeyMap != nil) { |
|
7907 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
7908 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
|
7909 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
|
7910 |
} |
|
7911 |
XFreeModifiermap(modmap); |
|
7912 |
} |
|
341 | 7913 |
} |
7914 |
%}. |
|
7915 |
||
7916 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
7917 |
||
7918 |
ret := Array new:8. |
|
7919 |
nextKey := 1. |
|
7920 |
1 to:8 do:[ :i | |
|
1344 | 7921 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
7922 |
|mod| |
|
7923 |
||
7924 |
mod := OrderedCollection new:maxKeyPerMod. |
|
7925 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
7926 |
key ~= 0 ifTrue:[ |
|
7927 |
mod add:key |
|
7928 |
]. |
|
7929 |
]. |
|
7930 |
ret at:i put:mod. |
|
7931 |
]. |
|
7932 |
nextKey := nextKey+maxKeyPerMod. |
|
341 | 7933 |
]. |
7934 |
||
7935 |
^ ret |
|
7936 |
||
7937 |
" |
|
1344 | 7938 |
Display modifierMapping |
341 | 7939 |
" |
7940 |
! |
|
7941 |
||
1344 | 7942 |
stringFromKeycode:code |
341 | 7943 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
7944 |
||
7945 |
|str| |
|
7946 |
||
7947 |
%{ |
|
7948 |
KeySym keysym; |
|
7949 |
char *keystring; |
|
7950 |
||
7951 |
if (ISCONNECTED && __isSmallInteger(code)) { |
|
1344 | 7952 |
Display *dpy = myDpy; |
7953 |
||
2541 | 7954 |
if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol && |
1344 | 7955 |
(keystring = XKeysymToString(keysym)) != 0) |
7956 |
str = __MKSTRING(keystring); |
|
341 | 7957 |
} |
7958 |
%}. |
|
7959 |
^ str |
|
7960 |
||
7961 |
" |
|
1344 | 7962 |
Display stringFromKeycode:28 |
341 | 7963 |
" |
7964 |
! |
|
7965 |
||
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7966 |
translateKey:untranslatedKey forView:aView |
295 | 7967 |
"Return the key translated via the translation table. |
7968 |
Here, we preTranslate the key into a common ST/X symbolic name, |
|
7969 |
which gets further processed in the superclasses translation method." |
|
7970 |
||
7971 |
|key| |
|
7972 |
||
7973 |
(key := untranslatedKey) isString ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7974 |
key := RawKeysymTranslation at:key ifAbsent:key. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7975 |
key := key asSymbol. |
295 | 7976 |
]. |
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7977 |
^ super translateKey:key forView:aView |
295 | 7978 |
! ! |
7979 |
||
7980 |
!XWorkstation methodsFor:'misc'! |
|
7981 |
||
1344 | 7982 |
beep |
295 | 7983 |
"output an audible beep or bell" |
7984 |
||
1906 | 7985 |
NoBeep ~~ true ifTrue:[ |
7986 |
self beep:50 |
|
7987 |
] |
|
295 | 7988 |
! |
7989 |
||
1344 | 7990 |
beep:volumeInPercent |
295 | 7991 |
"output an audible beep" |
7992 |
%{ |
|
7993 |
int volume; |
|
7994 |
||
7995 |
if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
|
1344 | 7996 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
7997 |
volume = __intVal(volumeInPercent) * 2 - 100; |
|
7998 |
if (volume < -100) volume = -100; |
|
7999 |
else if (volume > 100) volume = 100; |
|
8000 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8001 |
ENTER_XLIB(); |
1344 | 8002 |
XBell(myDpy, volume); |
1974 | 8003 |
LEAVE_XLIB(); |
1344 | 8004 |
END_INTERRUPTSBLOCKED |
295 | 8005 |
} |
8006 |
%} |
|
8007 |
! |
|
8008 |
||
1344 | 8009 |
buffered |
295 | 8010 |
"buffer drawing - do not send it immediately to the display. |
374 | 8011 |
This is the default anyway. |
8012 |
See #unBuffered for additional info." |
|
295 | 8013 |
|
8014 |
%{ /* NOCONTEXT */ |
|
8015 |
||
8016 |
if (ISCONNECTED) { |
|
1344 | 8017 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8018 |
ENTER_XLIB(); |
1344 | 8019 |
XSynchronize(myDpy, 0); |
1974 | 8020 |
LEAVE_XLIB(); |
1344 | 8021 |
END_INTERRUPTSBLOCKED |
295 | 8022 |
} |
8023 |
%} |
|
374 | 8024 |
" |
8025 |
Display buffered |
|
8026 |
" |
|
295 | 8027 |
! |
8028 |
||
1344 | 8029 |
flush |
295 | 8030 |
"send all buffered drawing to the display. |
8031 |
This may be required to make certain, that all previous operations |
|
8032 |
are really sent to the display before continuing. For example, |
|
8033 |
after a cursor-change with a followup long computation. |
|
374 | 8034 |
(otherwise, the cursor change request may still be in the output buffer) |
8035 |
See also #sync, which even waits until the request has been processed." |
|
295 | 8036 |
|
8037 |
%{ /* NOCONTEXT */ |
|
8038 |
||
8039 |
if (ISCONNECTED) { |
|
1344 | 8040 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8041 |
ENTER_XLIB(); |
1344 | 8042 |
XFlush(myDpy); |
1974 | 8043 |
LEAVE_XLIB(); |
1344 | 8044 |
END_INTERRUPTSBLOCKED |
310 | 8045 |
} |
8046 |
%} |
|
8047 |
! |
|
8048 |
||
1344 | 8049 |
flushDpsContext:aDPSContext |
295 | 8050 |
|
8051 |
%{ /* NOCONTEXT */ |
|
8052 |
#ifdef DPS |
|
8053 |
if (__isExternalAddress(aDPSContext)) { |
|
1344 | 8054 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8055 |
ENTER_XLIB(); |
1344 | 8056 |
DPSFlushContext(MKDPSCONTEXT(aDPSContext)); |
1974 | 8057 |
LEAVE_XLIB(); |
1344 | 8058 |
END_INTERRUPTSBLOCKED |
8059 |
RETURN ( self ); |
|
295 | 8060 |
} |
8061 |
#endif |
|
374 | 8062 |
%}. |
295 | 8063 |
self primitiveFailed |
8064 |
! |
|
8065 |
||
1344 | 8066 |
refreshKeyboardMapping:eB |
295 | 8067 |
%{ |
8068 |
XMappingEvent *ev; |
|
8069 |
||
8070 |
if (__isByteArray(eB)) { |
|
1344 | 8071 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1974 | 8072 |
ENTER_XLIB(); |
1344 | 8073 |
XRefreshKeyboardMapping(ev); |
1974 | 8074 |
LEAVE_XLIB(); |
295 | 8075 |
} |
8076 |
%} |
|
8077 |
! |
|
8078 |
||
1344 | 8079 |
setInputFocusTo:aWindowId |
2871 | 8080 |
"set the focus to the view as defined by aWindowId. |
8081 |
When released, return the focus to the root window" |
|
8082 |
||
295 | 8083 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
8084 |
self setInputFocusTo:aWindowId revertTo:#root |
|
8085 |
! |
|
8086 |
||
1344 | 8087 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
295 | 8088 |
"set the focus to the view as defined by aWindowId. |
8089 |
Passing nil set the focus to no window and lets the display discard all |
|
8090 |
input until a new focus is set. |
|
8091 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
8092 |
passing one of #parent, #root or nil specifies that the focus should be |
|
8093 |
given to the parent view, the root view or no view." |
|
8094 |
||
8095 |
%{ /* NOCONTEXT */ |
|
8096 |
int arg; |
|
8097 |
Window focusWindow; |
|
8098 |
||
8099 |
if (ISCONNECTED) { |
|
1344 | 8100 |
if (__isExternalAddress(aWindowId)) { |
8101 |
focusWindow = _WindowVal(aWindowId); |
|
8102 |
} else { |
|
8103 |
focusWindow = None; |
|
8104 |
} |
|
8105 |
if (revertSymbol == @symbol(parent)) |
|
8106 |
arg = RevertToParent; |
|
8107 |
else if (revertSymbol == @symbol(root)) |
|
8108 |
arg = RevertToPointerRoot; |
|
8109 |
else |
|
8110 |
arg = RevertToNone; |
|
8111 |
||
8112 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8113 |
ENTER_XLIB(); |
1344 | 8114 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
1974 | 8115 |
LEAVE_XLIB(); |
1344 | 8116 |
END_INTERRUPTSBLOCKED |
8117 |
RETURN ( self ); |
|
295 | 8118 |
} |
8119 |
%}. |
|
8120 |
self primitiveFailed |
|
8121 |
! |
|
8122 |
||
1344 | 8123 |
sync |
341 | 8124 |
"send all buffered drawing to the display AND wait until the display |
8125 |
has finished drawing it. |
|
8126 |
This is almost never needed, except if you are about to read previously |
|
374 | 8127 |
drawn pixels back from the display screen, or you want to wait for a beep |
8128 |
to be finished. See also #flush." |
|
341 | 8129 |
|
8130 |
%{ /* NOCONTEXT */ |
|
8131 |
||
8132 |
if (ISCONNECTED) { |
|
1344 | 8133 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8134 |
ENTER_XLIB(); |
1344 | 8135 |
XSync(myDpy, 0); |
1974 | 8136 |
LEAVE_XLIB(); |
1344 | 8137 |
END_INTERRUPTSBLOCKED |
341 | 8138 |
} |
8139 |
%} |
|
8140 |
! |
|
8141 |
||
1344 | 8142 |
unBuffered |
374 | 8143 |
"make all drawing be sent immediately to the display. |
8144 |
This makes all graphics synchronous and turns off any buffering |
|
8145 |
(i.e. each individual draw-request is sent immediately without |
|
8146 |
packing multiple requests into a larger message buffer). |
|
8147 |
Be prepared, that this slows down graphics considerably. |
|
8148 |
However, it allows display errors to be handled immediately and |
|
8149 |
may be useful if you get Xdisplay errors and want to find the request |
|
1813 | 8150 |
which was responsible for it. See also #buffered." |
295 | 8151 |
|
8152 |
%{ /* NOCONTEXT */ |
|
8153 |
||
8154 |
if (ISCONNECTED) { |
|
1344 | 8155 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8156 |
ENTER_XLIB(); |
1344 | 8157 |
XSynchronize(myDpy, 1); |
1974 | 8158 |
LEAVE_XLIB(); |
1344 | 8159 |
END_INTERRUPTSBLOCKED |
295 | 8160 |
} |
8161 |
%} |
|
1813 | 8162 |
" |
8163 |
Display unBuffered |
|
8164 |
" |
|
295 | 8165 |
! ! |
8166 |
||
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8167 |
!XWorkstation methodsFor:'pointer stuff'! |
295 | 8168 |
|
1344 | 8169 |
anyButtonStateMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8170 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8171 |
buttonStates value." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8172 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8173 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8174 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8175 |
^ 256 + 512 + 1024 |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8176 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8177 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8178 |
"Created: 23.3.1996 / 12:46:35 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8179 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8180 |
|
1344 | 8181 |
buttonStates |
295 | 8182 |
"return an integer representing the state of the pointer buttons; |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8183 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8184 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8185 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 8186 |
|
8187 |
%{ /* NOCONTEXT*/ |
|
8188 |
Window w; |
|
555 | 8189 |
int screen = __intVal(__INST(screen)); |
295 | 8190 |
Window rootRet, childRet; |
8191 |
int rootX, rootY, winX, winY; |
|
8192 |
unsigned int mask; |
|
8193 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8194 |
if (ISCONNECTED) { |
1906 | 8195 |
Display *dpy = myDpy; |
8196 |
||
8197 |
BEGIN_INTERRUPTSBLOCKED |
|
295 | 8198 |
#ifdef VIRTUAL_ROOT |
2541 | 8199 |
w = getRootWindow(dpy, screen); |
295 | 8200 |
#else |
1906 | 8201 |
w = RootWindow(dpy, screen); |
295 | 8202 |
#endif |
1906 | 8203 |
END_INTERRUPTSBLOCKED |
8204 |
if (w) { |
|
8205 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8206 |
ENTER_XLIB(); |
1906 | 8207 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
8208 |
&rootX, &rootY, |
|
8209 |
&winX, &winY, |
|
8210 |
&mask); |
|
1974 | 8211 |
LEAVE_XLIB(); |
1906 | 8212 |
END_INTERRUPTSBLOCKED |
8213 |
RETURN (__MKSMALLINT(mask)); |
|
8214 |
} |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8215 |
} |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8216 |
%}. |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8217 |
self primitiveFailed |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8218 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8219 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8220 |
Display buttonStates |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8221 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8222 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8223 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8224 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8225 |
Display buttonStates bitTest:(Display controlMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8226 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8227 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8228 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8229 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8230 |
Display buttonStates bitTest:(Display altModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8231 |
Display buttonStates bitTest:(Display metaModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8232 |
" |
295 | 8233 |
! |
8234 |
||
1344 | 8235 |
leftButtonStateMask |
295 | 8236 |
"return an integer for masking out the left button from a |
8237 |
buttonStates value" |
|
8238 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8239 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8240 |
|
295 | 8241 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8242 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8243 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 8244 |
! |
8245 |
||
1344 | 8246 |
middleButtonStateMask |
295 | 8247 |
"return an integer for masking out the middle button from a |
8248 |
buttonStates value" |
|
8249 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8250 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8251 |
|
295 | 8252 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8253 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8254 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 8255 |
! |
8256 |
||
1344 | 8257 |
pointerPosition |
295 | 8258 |
"return the current pointer position in root-window coordinates" |
8259 |
||
8260 |
|xpos ypos| |
|
8261 |
||
8262 |
%{ |
|
8263 |
Window w; |
|
555 | 8264 |
int screen = __intVal(__INST(screen)); |
295 | 8265 |
Window rootRet, childRet; |
8266 |
int rootX, rootY, winX, winY; |
|
8267 |
unsigned int mask; |
|
8268 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8269 |
if (ISCONNECTED) { |
1344 | 8270 |
Display *dpy = myDpy; |
8271 |
||
8272 |
BEGIN_INTERRUPTSBLOCKED |
|
295 | 8273 |
#ifdef VIRTUAL_ROOT |
2541 | 8274 |
w = getRootWindow(dpy, screen); |
295 | 8275 |
#else |
1344 | 8276 |
w = RootWindow(dpy, screen); |
295 | 8277 |
#endif |
1974 | 8278 |
ENTER_XLIB(); |
1344 | 8279 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
8280 |
&rootX, &rootY, |
|
8281 |
&winX, &winY, |
|
8282 |
&mask); |
|
1974 | 8283 |
LEAVE_XLIB(); |
1344 | 8284 |
xpos = __MKSMALLINT(rootX); |
8285 |
ypos = __MKSMALLINT(rootY); |
|
8286 |
END_INTERRUPTSBLOCKED |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8287 |
} |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8288 |
%}. |
295 | 8289 |
^ xpos @ ypos |
8290 |
! |
|
8291 |
||
1344 | 8292 |
rightButtonStateMask |
295 | 8293 |
"return an integer for masking out the right button from a |
8294 |
buttonStates value" |
|
8295 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8296 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8297 |
|
295 | 8298 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8299 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8300 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 8301 |
! |
8302 |
||
1344 | 8303 |
rootPositionOfLastEvent |
295 | 8304 |
"return the position in root-window coordinates |
8305 |
of the last button, key or pointer event" |
|
8306 |
||
8307 |
^ eventRootX @ eventRootY |
|
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8308 |
! |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8309 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8310 |
setPointerPosition:newPosition in:aWindowId |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8311 |
"change the pointer position to a new position relative to the |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8312 |
given windows origin (which may be the rootWindow). |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8313 |
Be careful with this - its usually not very ergonimically |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8314 |
to change the mousePointer position. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8315 |
This interface is provided for special applications (presentation |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8316 |
playback) and should not be used in normal applications." |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8317 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8318 |
|xpos ypos| |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8319 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8320 |
xpos := newPosition x. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8321 |
ypos := newPosition y. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8322 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8323 |
%{ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8324 |
if (ISCONNECTED |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8325 |
&& __isExternalAddress(aWindowId) |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8326 |
&& __bothSmallInteger(xpos, ypos)) { |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8327 |
Display *dpy = myDpy; |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8328 |
Window w = _WindowVal(aWindowId); |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8329 |
|
1974 | 8330 |
ENTER_XLIB(); |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8331 |
XWarpPointer(dpy, |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8332 |
None, /* src window */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8333 |
w, /* dst window */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8334 |
0, /* src_x */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8335 |
0, /* src_y */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8336 |
0, /* src_w */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8337 |
0, /* src_h */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8338 |
__intVal(xpos), /* dst_x */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8339 |
__intVal(ypos) /* dst_y */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8340 |
); |
1974 | 8341 |
LEAVE_XLIB(); |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8342 |
} |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8343 |
%}. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8344 |
^ self |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8345 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8346 |
" |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8347 |
Display setPointerPosition:1000@1000 |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8348 |
" |
295 | 8349 |
! ! |
8350 |
||
1556 | 8351 |
!XWorkstation methodsFor:'properties'! |
8352 |
||
8353 |
getObjectProperty:propertyID from:aWindowID |
|
8354 |
"get an object property from the server; return object or nil" |
|
8355 |
||
8356 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8357 |
type == stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8358 |
^ value |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8359 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8360 |
(value isMemberOf:ByteArray) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8361 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8362 |
] |
1556 | 8363 |
]. |
8364 |
^ nil |
|
8365 |
||
8366 |
"Modified: 6.4.1997 / 13:27:07 / cg" |
|
8367 |
! |
|
8368 |
||
8369 |
getProperty:propertyID from:aWindowID into:aTwoArgBlock |
|
8370 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
|
8371 |
||
8372 |
|val typeID cls| |
|
8373 |
||
8374 |
cls := ByteArray. |
|
8375 |
%{ |
|
8376 |
Window window; |
|
8377 |
Atom property; |
|
8378 |
char *cp, *cp2; |
|
8379 |
Atom actual_type; |
|
8380 |
int actual_format,i; |
|
8381 |
unsigned long nitems, bytes_after, nread; |
|
8382 |
unsigned char *data; |
|
8383 |
int ok = 1; |
|
8384 |
# define PROP_SIZE 2048 |
|
8385 |
||
8386 |
if (ISCONNECTED) { |
|
8387 |
Display *dpy = myDpy; |
|
8388 |
||
8389 |
if (__isAtomID(propertyID)) { |
|
8390 |
property = _AtomVal(propertyID); |
|
8391 |
if (__isExternalAddress(aWindowID)) { |
|
8392 |
window = _WindowVal(aWindowID); |
|
8393 |
} else { |
|
8394 |
window = DefaultRootWindow(dpy); |
|
8395 |
} |
|
8396 |
||
8397 |
nread = 0; |
|
8398 |
cp = 0; |
|
8399 |
/* |
|
8400 |
fprintf(stderr, "getProperty: "); |
|
8401 |
*/ |
|
8402 |
do { |
|
8403 |
if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False, |
|
8404 |
AnyPropertyType,&actual_type,&actual_format, |
|
8405 |
&nitems,&bytes_after,(unsigned char **)&data) |
|
8406 |
!= Success) { |
|
8407 |
ok = 0; |
|
8408 |
break; |
|
8409 |
} |
|
8410 |
typeID = __MKATOMOBJ(actual_type); |
|
8411 |
if (! cp) { |
|
8412 |
cp = cp2 = (char *)malloc(nitems+1); |
|
8413 |
} else { |
|
8414 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
8415 |
cp2 = cp + nread; |
|
8416 |
} |
|
8417 |
if (! cp) { |
|
8418 |
XFree(data); |
|
8419 |
goto fail; |
|
8420 |
} |
|
8421 |
||
8422 |
nread += nitems; |
|
8423 |
bcopy(data, cp2, nitems); |
|
8424 |
XFree(data); |
|
8425 |
/* |
|
8426 |
fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after); |
|
8427 |
*/ |
|
8428 |
} while (bytes_after > 0); |
|
8429 |
/* |
|
8430 |
fprintf(stderr, "\n"); |
|
8431 |
*/ |
|
8432 |
||
8433 |
if (ok) { |
|
8434 |
if (actual_type == XA_STRING) { |
|
8435 |
cp[nread] = '\0'; |
|
8436 |
val = __MKSTRING_L(cp, nread); |
|
8437 |
} else { |
|
2449
5fdfb68d0bcc
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
2428
diff
changeset
|
8438 |
val = __STX___new(nread + OHDR_SIZE); |
1556 | 8439 |
val->o_class = cls; |
8440 |
bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread); |
|
8441 |
} |
|
8442 |
} |
|
8443 |
if (cp) |
|
8444 |
free(cp); |
|
8445 |
} |
|
8446 |
} |
|
8447 |
fail: ; |
|
8448 |
%}. |
|
8449 |
typeID isNil ifTrue:[ |
|
8450 |
^ false |
|
8451 |
]. |
|
8452 |
aTwoArgBlock value:typeID value:val. |
|
8453 |
^ true |
|
8454 |
! |
|
8455 |
||
8456 |
getTextProperty:propertyID from:aWindowID |
|
8457 |
"get a text property; return string or nil" |
|
8458 |
||
1798 | 8459 |
|stringClass| |
8460 |
||
1556 | 8461 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
1906 | 8462 |
type == stringAtom ifTrue:[ |
8463 |
clipBoardEncoding notNil ifTrue:[ |
|
8464 |
stringClass := (CharacterArray classForEncoding:clipBoardEncoding). |
|
8465 |
stringClass ~~ String ifTrue:[ |
|
8466 |
^ stringClass fromBytes:(value asByteArray) |
|
8467 |
]. |
|
8468 |
^ value decodeFrom:clipBoardEncoding |
|
8469 |
]. |
|
8470 |
^ value |
|
8471 |
] |
|
1556 | 8472 |
]. |
8473 |
^ nil |
|
1793 | 8474 |
|
1798 | 8475 |
"Modified: 30.6.1997 / 20:54:59 / cg" |
1556 | 8476 |
! |
8477 |
||
8478 |
setLengthProperty:propertyID value:aNumber for:aWindowID |
|
8479 |
"set a size property" |
|
8480 |
||
8481 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8482 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8483 |
type:(self atomIDOfLENGTH) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8484 |
value:aNumber |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8485 |
for:aWindowID |
1556 | 8486 |
|
8487 |
"Modified: 6.4.1997 / 13:27:26 / cg" |
|
8488 |
! |
|
8489 |
||
8490 |
setObjectProperty:propertyID value:anObject for:aWindowID |
|
8491 |
"set a property to a smalltalk object in the XServer. |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8492 |
Non-strings can only be retrieved by another ST/X smalltalk" |
1556 | 8493 |
|
8494 |
|s| |
|
8495 |
||
8496 |
(anObject isMemberOf:String) ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8497 |
^ self setTextProperty:propertyID value:anObject for:aWindowID |
1556 | 8498 |
]. |
8499 |
s := WriteStream on:(ByteArray new:200). |
|
8500 |
anObject storeBinaryOn:s. |
|
8501 |
^ self |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8502 |
setProperty:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8503 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8504 |
value:(s contents) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8505 |
for:aWindowID |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8506 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8507 |
"Modified: / 17.6.1998 / 17:23:49 / cg" |
1556 | 8508 |
! |
8509 |
||
8510 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
|
8511 |
"set a property in the XServer" |
|
8512 |
||
8513 |
%{ /* UNLIMITEDSTACK */ |
|
8514 |
if (__isAtomID(propertyID) |
|
8515 |
&& __isAtomID(typeID) |
|
8516 |
&& ISCONNECTED |
|
8517 |
&& (__isString(anObject) |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8518 |
|| __isSmallInteger(anObject) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8519 |
|| __isSymbol(anObject) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8520 |
|| __isByteArray(anObject) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8521 |
|| __isWords(anObject))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8522 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8523 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8524 |
Atom prop, type; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8525 |
Window window; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8526 |
unsigned INT value; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8527 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8528 |
prop = _AtomVal(propertyID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8529 |
type = _AtomVal(typeID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8530 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8531 |
if (__isExternalAddress(aWindowID)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8532 |
window = _WindowVal(aWindowID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8533 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8534 |
window = DefaultRootWindow(dpy); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8535 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8536 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8537 |
if (__isSmallInteger(anObject)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8538 |
value = __intVal(anObject); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8539 |
XChangeProperty(dpy, window, prop, type, 32, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8540 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8541 |
(unsigned char *)(&value), sizeof(unsigned int)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8542 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8543 |
if (__isByteArray(anObject)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8544 |
XChangeProperty(dpy, window, prop, type, 8, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8545 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8546 |
__ByteArrayInstPtr(anObject)->ba_element, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8547 |
__byteArraySize(anObject)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8548 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8549 |
/* string or symbol or wordArray-like (16bit-string) object */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8550 |
if (__isWords(__qClass(anObject))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8551 |
XChangeProperty(dpy, window, prop, type, 16, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8552 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8553 |
__stringVal(anObject), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8554 |
__wordArraySize(anObject)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8555 |
} else { |
2176 | 8556 |
/* must be string or symbol */ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8557 |
XChangeProperty(dpy, window, prop, type, 8, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8558 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8559 |
__stringVal(anObject), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8560 |
__stringSize(anObject)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8561 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8562 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8563 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8564 |
DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8565 |
RETURN (true); |
1556 | 8566 |
} |
8567 |
%}. |
|
8568 |
^ false |
|
8569 |
! |
|
8570 |
||
8571 |
setTextProperty:propertyID value:aString for:aWindowID |
|
8572 |
"set a property to a stringValue in the XServer" |
|
8573 |
||
8574 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8575 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8576 |
type:(self atomIDOfSTRING) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8577 |
value:aString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8578 |
for:aWindowID |
1556 | 8579 |
|
8580 |
"Modified: 6.4.1997 / 13:26:32 / cg" |
|
8581 |
! ! |
|
8582 |
||
295 | 8583 |
!XWorkstation methodsFor:'resources'! |
8584 |
||
1344 | 8585 |
atomIDOf:aStringOrSymbol |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8586 |
"return an Atoms ID; dont create if not already present. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8587 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8588 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8589 |
^ self atomIDOf:aStringOrSymbol create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8590 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8591 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8592 |
Display atomIDOf:'FACE_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8593 |
Display atomIDOf:'FULL_NAME' |
1535 | 8594 |
Display atomIDOf:'DndProtocol' |
8595 |
Display atomIDOf:'DndSelection' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8596 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8597 |
|
1535 | 8598 |
"Modified: 4.4.1997 / 13:38:48 / cg" |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8599 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8600 |
|
1344 | 8601 |
atomIDOf:aStringOrSymbol create:create |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8602 |
"return an Atoms ID; if create is true, create it if not already present. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8603 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8604 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8605 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8606 |
Atom prop; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8607 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8608 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8609 |
&& __isNonNilObject(aStringOrSymbol) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8610 |
&& (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8611 |
prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8612 |
(create == true) ? False : True); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8613 |
if (prop == None) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8614 |
RETURN (nil); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8615 |
} |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8616 |
RETURN ( __MKATOMOBJ(prop) ); |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8617 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8618 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8619 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8620 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8621 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8622 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8623 |
Display atomIDOf:'VT_SELECTION' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8624 |
Display atomIDOf:'CUT_BUFFER0' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8625 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8626 |
Display atomIDOf:'PRIMARY' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8627 |
Display atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8628 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8629 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8630 |
|
1344 | 8631 |
atomIDOfCUTBUFFER0 |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8632 |
"return the CUTBUFFER0 AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8633 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8634 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8635 |
^ cutBuffer0Atom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8636 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8637 |
"Modified: 2.3.1996 / 15:10:36 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8638 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8639 |
|
1344 | 8640 |
atomIDOfLENGTH |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8641 |
"return the LENGTH AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8642 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8643 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8644 |
^ lengthAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8645 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8646 |
"Modified: 2.3.1996 / 15:10:41 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8647 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8648 |
|
1344 | 8649 |
atomIDOfPRIMARY |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8650 |
"return the PRIMARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8651 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8652 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8653 |
^ primaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8654 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8655 |
"Modified: 2.3.1996 / 15:10:49 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8656 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8657 |
|
1344 | 8658 |
atomIDOfSECONDARY |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8659 |
"return the SECONDARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8660 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8661 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8662 |
^ secondaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8663 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8664 |
"Modified: 2.3.1996 / 15:10:59 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8665 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8666 |
|
1344 | 8667 |
atomIDOfSTRING |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8668 |
"return the STRING AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8669 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8670 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8671 |
^ stringAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8672 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8673 |
"Modified: 2.3.1996 / 15:11:08 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8674 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8675 |
|
1344 | 8676 |
atomName:anAtomID |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8677 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8678 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8679 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8680 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8681 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8682 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8683 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8684 |
if (ISCONNECTED) { |
1344 | 8685 |
if (__isAtomID(anAtomID)) { |
8686 |
name = XGetAtomName(myDpy, _AtomVal(anAtomID)); |
|
8687 |
if (name == 0) { |
|
8688 |
RETURN (nil); |
|
8689 |
} |
|
8690 |
str = __MKSTRING(name); |
|
8691 |
XFree(name); |
|
8692 |
RETURN ( str ); |
|
8693 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8694 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8695 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8696 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8697 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8698 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8699 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8700 |
Display atomName:1 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8701 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8702 |
Display atomName:132 'FONTNAME_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8703 |
Display atomName:135 'FOUNDRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8704 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8705 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8706 |
Display atomName:152 'CHARSET_ENCODING' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8707 |
Display atomName:154 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8708 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8709 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8710 |
|
1344 | 8711 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8712 |
"access the displays resource database for a default value |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8713 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8714 |
This is highly X specific and currently not used. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8715 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8716 |
Notice: |
1344 | 8717 |
we do not plan to use X's resources for ST/X's defaults, |
8718 |
styles or resources. This would make porting of applications |
|
8719 |
to different platforms much more difficult (Windows has no resource |
|
8720 |
database). If you stay within ST/X's resource files, these can be |
|
8721 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8722 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8723 |
This method is provided for special applications which want to access |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8724 |
existing X resources and are not planned to be ever ported to other |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8725 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8726 |
|
295 | 8727 |
%{ |
8728 |
char *rslt; |
|
8729 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8730 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8731 |
&& __isNonNilObject(name) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8732 |
&& (__qIsString(name) || __qIsSymbol(name)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8733 |
&& __isNonNilObject(cls) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8734 |
&& (__qIsString(cls) || __qIsSymbol(cls))) { |
1344 | 8735 |
BEGIN_INTERRUPTSBLOCKED |
1831 | 8736 |
rslt = XGetDefault(myDpy, (char *) __stringVal(cls), |
8737 |
(char *) __stringVal(name)); |
|
1344 | 8738 |
END_INTERRUPTSBLOCKED |
8739 |
RETURN (rslt ? __MKSTRING(rslt) : nil ); |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8740 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8741 |
%}. |
295 | 8742 |
self primitiveFailed. |
8743 |
^ nil |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8744 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8745 |
"if your ~/.Xdefaults contains an entry such as: |
1344 | 8746 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8747 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8748 |
|
1344 | 8749 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8750 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8751 |
if your ~/.Xdefaults contains an entry such as: |
1344 | 8752 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8753 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8754 |
|
1344 | 8755 |
Display getResource:'beNiceToColormap' class:'any' |
8756 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8757 |
" |
295 | 8758 |
! ! |
8759 |
||
8760 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
8761 |
||
1462
f8b2909deb3c
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1455
diff
changeset
|
8762 |
getBitsFromId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
295 | 8763 |
"get bits from a drawable into the imageBits. The storage for the bits |
8764 |
must be big enough for the data to fit. If ok, returns an array with some |
|
8765 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
8766 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
8767 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
8768 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8769 |
|rawInfo info| |
295 | 8770 |
|
8771 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
1344 | 8772 |
self primitiveFailed. |
8773 |
^ nil |
|
295 | 8774 |
]. |
8775 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8776 |
rawInfo := Array new:8. |
1344 | 8777 |
"1 -> bit order" |
8778 |
"2 -> depth" |
|
8779 |
"3 -> bytes_per_line" |
|
8780 |
"4 -> byte_order" |
|
8781 |
"5 -> format" |
|
8782 |
"6 -> bitmap_unit" |
|
8783 |
"7 -> bitmap_pad" |
|
8784 |
"8 -> bits_per_pixel" |
|
295 | 8785 |
|
8786 |
"/ had to extract the getPixel call into a separate method, to specify |
|
8787 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
8788 |
"/ of temporary stack space |
|
8789 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8790 |
(self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
1344 | 8791 |
info := IdentityDictionary new. |
8792 |
info at:#bitOrder put:(rawInfo at:1). |
|
8793 |
info at:#depth put:(rawInfo at:2). |
|
8794 |
info at:#bytesPerLine put:(rawInfo at:3). |
|
8795 |
info at:#byteOrder put:(rawInfo at:4). |
|
8796 |
info at:#format put:(rawInfo at:5). |
|
8797 |
info at:#bitmapUnit put:(rawInfo at:6). |
|
8798 |
info at:#bitmapPad put:(rawInfo at:7). |
|
8799 |
info at:#bitsPerPixel put:(rawInfo at:8). |
|
8800 |
^ info |
|
295 | 8801 |
]. |
8802 |
" |
|
8803 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
8804 |
or is too small to hold the bits |
|
8805 |
" |
|
8806 |
^ self primitiveFailed |
|
8807 |
! |
|
8808 |
||
2713
1aef3acb4e04
need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents:
2685
diff
changeset
|
8809 |
getPixelX:x y:y from:aDrawableId with:dummyGCId |
790
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
8810 |
"return the pixel value at x/y; coordinates start at 0/0 for the upper left. |
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
8811 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 8812 |
|
8813 |
%{ /* UNLIMITEDSTACK NOCONTEXT */ |
|
8814 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
8815 |
Window win; |
295 | 8816 |
XImage *img; |
8817 |
int ret; |
|
8818 |
int xpos, ypos; |
|
8819 |
||
1209 | 8820 |
if (ISCONNECTED |
8821 |
&& __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
1344 | 8822 |
win = _WindowVal(aDrawableId); |
8823 |
xpos = __intVal(x); |
|
8824 |
ypos = __intVal(y); |
|
8825 |
if ((xpos < 0) || (ypos < 0)) { |
|
8826 |
RETURN ( __MKSMALLINT(0) ); |
|
8827 |
} |
|
1974 | 8828 |
ENTER_XLIB(); |
1344 | 8829 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
1974 | 8830 |
LEAVE_XLIB(); |
1344 | 8831 |
if (img != 0) { |
8832 |
ret = XGetPixel(img, 0, 0); |
|
8833 |
XDestroyImage(img); |
|
8834 |
RETURN ( __MKSMALLINT(ret) ); |
|
8835 |
} |
|
295 | 8836 |
} |
8837 |
%}. |
|
8838 |
^ nil |
|
8839 |
! |
|
8840 |
||
1344 | 8841 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
295 | 8842 |
"since XGetImage may allocate huge amount of stack space |
8843 |
(some implementations use alloca), this must run with unlimited stack." |
|
8844 |
||
8845 |
%{ /* UNLIMITEDSTACK */ |
|
8846 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
8847 |
Window win; |
295 | 8848 |
XImage *image = (XImage *)0; |
8849 |
int pad, bytes_per_line, numBytes; |
|
8850 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8851 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8852 |
&& __isExternalAddress(aDrawableId) |
295 | 8853 |
&& __bothSmallInteger(srcx, srcy) |
8854 |
&& __bothSmallInteger(w, h) |
|
8855 |
&& __isArray(info) |
|
8856 |
&& __isByteArray(imageBits)) { |
|
1344 | 8857 |
Display *dpy = myDpy; |
8858 |
||
8859 |
win = _WindowVal(aDrawableId); |
|
1974 | 8860 |
ENTER_XLIB(); |
1344 | 8861 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
8862 |
__intVal(w), __intVal(h), |
|
8863 |
(unsigned)AllPlanes, ZPixmap); |
|
1974 | 8864 |
LEAVE_XLIB(); |
1344 | 8865 |
|
8866 |
if (! image) { |
|
8867 |
RETURN ( false ); |
|
8868 |
} |
|
8869 |
||
8870 |
pad = image->bitmap_pad; |
|
295 | 8871 |
#ifdef SUPERDEBUG |
1344 | 8872 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
295 | 8873 |
#endif |
1344 | 8874 |
switch (image->depth) { |
8875 |
case 1: |
|
8876 |
case 2: |
|
8877 |
case 4: |
|
8878 |
case 8: |
|
8879 |
case 16: |
|
8880 |
case 24: |
|
8881 |
case 32: |
|
8882 |
numBytes = image->bytes_per_line * image->height; |
|
8883 |
break; |
|
1728 | 8884 |
|
1344 | 8885 |
default: |
8886 |
/* unsupported depth ? */ |
|
8887 |
printf("possibly unsupported depth:%d in primGetBits\n", image->depth); |
|
8888 |
numBytes = image->bytes_per_line * image->height; |
|
8889 |
break; |
|
8890 |
} |
|
295 | 8891 |
|
8892 |
#ifdef SUPERDEBUG |
|
1344 | 8893 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 8894 |
#endif |
8895 |
||
1344 | 8896 |
if (numBytes > __byteArraySize(imageBits)) { |
8897 |
/* imageBits too small */ |
|
1728 | 8898 |
fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n"); |
8899 |
fprintf(stderr, " bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits)); |
|
8900 |
fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n", |
|
8901 |
image->bitmap_pad, image->depth, image->bytes_per_line); |
|
1344 | 8902 |
goto fail; |
8903 |
} |
|
8904 |
if (image->bitmap_bit_order == MSBFirst) |
|
8905 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
|
8906 |
else |
|
8907 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
|
8908 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
8909 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
8910 |
if (image->byte_order == MSBFirst) |
|
8911 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
|
8912 |
else |
|
8913 |
__ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
|
8914 |
if (image->format == XYBitmap) |
|
8915 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
|
8916 |
else if (image->format == XYPixmap) |
|
8917 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
|
8918 |
else if (image->format == ZPixmap) |
|
8919 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
8920 |
|
1344 | 8921 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
8922 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
8923 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
8924 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
8925 |
XDestroyImage(image); |
|
8926 |
RETURN ( true ); |
|
295 | 8927 |
} |
8928 |
fail: |
|
8929 |
if (image) { |
|
1344 | 8930 |
XDestroyImage(image); |
295 | 8931 |
} |
8932 |
%}. |
|
8933 |
^ false |
|
8934 |
! ! |
|
8935 |
||
8936 |
!XWorkstation methodsFor:'selections'! |
|
8937 |
||
1344 | 8938 |
getSelectionFor:drawableId |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8939 |
"get the object selection - either immediate, or asynchronous. |
295 | 8940 |
Returns nil, if async request is on its way" |
8941 |
||
8942 |
|selProp sel| |
|
8943 |
||
8944 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8945 |
"no primary selection - use cut buffer" |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8946 |
sel := self getObjectProperty:cutBuffer0Atom from:nil. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8947 |
^ sel |
295 | 8948 |
]. |
8949 |
selProp := self atomIDOf:'ST_SELECTION' create:true. |
|
8950 |
self requestObjectSelection:primaryAtom property:selProp for:drawableId. |
|
8951 |
^ nil |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8952 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8953 |
"Modified: / 17.6.1998 / 17:11:15 / cg" |
295 | 8954 |
! |
8955 |
||
1344 | 8956 |
getSelectionOwnerOf:selectionAtomID |
295 | 8957 |
"get the owner of a selection" |
8958 |
||
8959 |
%{ /* NOCONTEXT */ |
|
8960 |
Atom selection; |
|
8961 |
Window window; |
|
8962 |
||
8963 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
|
1344 | 8964 |
Display *dpy = myDpy; |
8965 |
||
8966 |
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
8967 |
RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); |
295 | 8968 |
} |
8969 |
%}. |
|
8970 |
self primitiveFailed. |
|
8971 |
^ nil |
|
8972 |
! |
|
8973 |
||
1344 | 8974 |
getTextSelectionFor:drawableId |
295 | 8975 |
"get the text selection - either immediate, or asynchronous. |
8976 |
Returns nil, if async request is on its way" |
|
8977 |
||
8978 |
|selProp sel| |
|
8979 |
||
8980 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8981 |
"no primary selection - use cut buffer" |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8982 |
sel := self getTextProperty:cutBuffer0Atom from:nil. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8983 |
^ sel |
295 | 8984 |
]. |
8985 |
selProp := self atomIDOf:'VT_SELECTION' create:true. |
|
8986 |
self requestTextSelection:primaryAtom property:selProp for:drawableId. |
|
8987 |
^ nil |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8988 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8989 |
"Modified: / 17.6.1998 / 17:12:05 / cg" |
295 | 8990 |
! |
8991 |
||
1344 | 8992 |
requestObjectSelection:selectionID property:propertyID for:aWindowId |
295 | 8993 |
"ask the server to send us the selection - the view with ID aWindowID |
8994 |
will later receive a SelectionNotify event for it." |
|
8995 |
||
8996 |
^ self requestSelection:selectionID |
|
1344 | 8997 |
property:propertyID |
8998 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
8999 |
for:aWindowId |
|
9000 |
! |
|
9001 |
||
9002 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
|
295 | 9003 |
"ask the server to send us the selection - the view with id aWindowID |
9004 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
9005 |
with the selections value)." |
|
9006 |
||
9007 |
%{ /* NOCONTEXT */ |
|
9008 |
Atom sel_prop; |
|
9009 |
char *cp; |
|
9010 |
||
9011 |
if (__isExternalAddress(aWindowId) |
|
9012 |
&& ISCONNECTED |
|
9013 |
&& __isSmallInteger(typeID) |
|
9014 |
&& __isAtomID(selectionID)) { |
|
1344 | 9015 |
Display *dpy = myDpy; |
9016 |
||
9017 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
|
9018 |
/* |
|
9019 |
* no owner of primary selection |
|
9020 |
*/ |
|
9021 |
RETURN (false); |
|
9022 |
} |
|
9023 |
/* |
|
9024 |
* PRIMARY selection |
|
9025 |
*/ |
|
9026 |
XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), |
|
9027 |
_AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); |
|
9028 |
RETURN (true); |
|
295 | 9029 |
} |
9030 |
%}. |
|
9031 |
self primitiveFailed. |
|
9032 |
^ false |
|
9033 |
||
9034 |
" |
|
9035 |
Display requestSelection:(Display atomIDOf:'PRIMARY') |
|
1344 | 9036 |
property:(Display atomIDOf:'VT_SELECTION') |
9037 |
for:0 |
|
295 | 9038 |
" |
9039 |
! |
|
9040 |
||
1344 | 9041 |
requestTextSelection:selectionID property:propertyID for:aWindowId |
295 | 9042 |
"ask the server to send us the selection - the view with ID aWindowID |
9043 |
will later receive a SelectionNotify event for it." |
|
9044 |
||
9045 |
^ self requestSelection:selectionID |
|
1344 | 9046 |
property:propertyID |
9047 |
type:stringAtom |
|
9048 |
for:aWindowId |
|
9049 |
! |
|
9050 |
||
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9051 |
sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID |
295 | 9052 |
"send aString back from a SelectionRequest" |
9053 |
||
9054 |
self |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9055 |
setProperty:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9056 |
type:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9057 |
value:something |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9058 |
for:requestorID. |
295 | 9059 |
self |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9060 |
sendSelectionNotifySelection:selectionID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9061 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9062 |
target:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9063 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9064 |
from:windowID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9065 |
to:requestorID. |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9066 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9067 |
"Modified: / 17.6.1998 / 17:03:20 / cg" |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9068 |
"Created: / 17.6.1998 / 19:44:03 / cg" |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9069 |
! |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9070 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9071 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID |
295 | 9072 |
"send a selectionNotify back from a SelectionRequest" |
9073 |
||
9074 |
%{ /* NOCONTEXT */ |
|
9075 |
if (__isAtomID(propertyID) |
|
9076 |
&& __isExternalAddress(requestorID) |
|
9077 |
&& ISCONNECTED |
|
9078 |
&& __isAtomID(targetID) |
|
9079 |
&& __isAtomID(selectionID)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9080 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9081 |
XEvent ev; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9082 |
Window requestor = _WindowVal(requestorID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9083 |
Atom property = _AtomVal(propertyID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9084 |
Atom target = _AtomVal(targetID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9085 |
Atom selection = _AtomVal(selectionID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9086 |
Status result; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9087 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9088 |
ev.xselection.type = SelectionNotify; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9089 |
ev.xselection.display = dpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9090 |
ev.xselection.selection = selection; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9091 |
ev.xselection.target = target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9092 |
if (__isExternalAddress(windowID)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9093 |
ev.xselection.requestor = _WindowVal(windowID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9094 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9095 |
ev.xselection.requestor = DefaultRootWindow(dpy); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9096 |
if (__isExternalAddress(t)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9097 |
ev.xselection.time = (INT)(__externalAddressVal(t)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9098 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9099 |
ev.xselection.time = CurrentTime; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9100 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9101 |
if (property == None) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9102 |
ev.xselection.property = target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9103 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9104 |
ev.xselection.property = property; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9105 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9106 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9107 |
ev.xselection.selection, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9108 |
ev.xselection.property, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9109 |
ev.xselection.target, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9110 |
ev.xselection.requestor, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9111 |
requestor)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9112 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9113 |
ENTER_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9114 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9115 |
LEAVE_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9116 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9117 |
if ((result == BadValue) || (result == BadWindow)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9118 |
DPRINTF(("bad status\n")); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9119 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9120 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9121 |
ENTER_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9122 |
XFlush(dpy); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9123 |
LEAVE_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9124 |
RETURN (true) |
382 | 9125 |
} |
9126 |
%}. |
|
9127 |
self primitiveFailed. |
|
9128 |
^ false |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9129 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9130 |
"Modified: / 17.6.1998 / 20:23:20 / cg" |
295 | 9131 |
! |
9132 |
||
1344 | 9133 |
setSelection:anObject owner:aWindowId |
295 | 9134 |
"set the object selection, and make aWindowId be the owner. |
9135 |
This can be used by other Smalltalk(X) applications only." |
|
9136 |
||
9137 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
1344 | 9138 |
^ false |
295 | 9139 |
]. |
9140 |
"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil |
|
9141 |
^ true |
|
9142 |
! |
|
9143 |
||
1344 | 9144 |
setSelectionOwner:aWindowId of:selectionID |
295 | 9145 |
"set the owner of a selection; return false if failed" |
9146 |
||
9147 |
%{ /* NOCONTEXT */ |
|
9148 |
Window win; |
|
9149 |
||
9150 |
if (__isExternalAddress(aWindowId) |
|
9151 |
&& __isAtomID(selectionID) |
|
9152 |
&& ISCONNECTED) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9153 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9154 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9155 |
win = _WindowVal(aWindowId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9156 |
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9157 |
DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9158 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9159 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9160 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9161 |
RETURN (true); |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9162 |
} |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9163 |
%}. |
295 | 9164 |
self primitiveFailed. |
9165 |
^ nil |
|
9166 |
! |
|
9167 |
||
1344 | 9168 |
setTextSelection:aString owner:aWindowId |
295 | 9169 |
"set the text selection, and make aWindowId be the owner. |
9170 |
This can be used by any other X application." |
|
9171 |
||
9172 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9173 |
'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. |
295 | 9174 |
]. |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9175 |
^ self setTextProperty:cutBuffer0Atom value:aString for:rootId. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9176 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9177 |
"Modified: / 17.6.1998 / 19:48:54 / cg" |
295 | 9178 |
! ! |
9179 |
||
9180 |
!XWorkstation methodsFor:'window stuff'! |
|
9181 |
||
1344 | 9182 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
295 | 9183 |
"clear a rectangular area to viewbackground" |
9184 |
||
9185 |
%{ /* NOCONTEXT */ |
|
9186 |
||
9187 |
int w, h; |
|
9188 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9189 |
if (ISCONNECTED) { |
1344 | 9190 |
if (__isExternalAddress(aWindowId) |
9191 |
&& __bothSmallInteger(x, y) |
|
9192 |
&& __bothSmallInteger(width, height)) { |
|
9193 |
w = __intVal(width); |
|
9194 |
h = __intVal(height); |
|
9195 |
/* |
|
9196 |
* need this check here: some servers simply dump core with bad args |
|
9197 |
*/ |
|
9198 |
if ((w >= 0) && (h >= 0)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9199 |
ENTER_XLIB(); |
1344 | 9200 |
XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9201 |
LEAVE_XLIB(); |
1344 | 9202 |
} |
9203 |
RETURN ( self ); |
|
9204 |
} |
|
295 | 9205 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9206 |
%}. |
295 | 9207 |
self primitiveFailed |
9208 |
! |
|
9209 |
||
1344 | 9210 |
clearWindow:aWindowId |
295 | 9211 |
"clear a window to viewbackground" |
9212 |
||
9213 |
%{ /* NOCONTEXT */ |
|
9214 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9215 |
if (ISCONNECTED) { |
1344 | 9216 |
if (__isExternalAddress(aWindowId)) { |
1974 | 9217 |
ENTER_XLIB(); |
1344 | 9218 |
XClearWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9219 |
LEAVE_XLIB(); |
1344 | 9220 |
RETURN ( self ); |
9221 |
} |
|
295 | 9222 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9223 |
%}. |
295 | 9224 |
self primitiveFailed |
9225 |
! |
|
9226 |
||
1344 | 9227 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
295 | 9228 |
"configure stacking operation of aWindowId w.r.t siblingId" |
9229 |
||
9230 |
%{ /* NOCONTEXT */ |
|
9231 |
||
9232 |
XWindowChanges chg; |
|
9233 |
int mask = CWSibling | CWStackMode; |
|
9234 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9235 |
if (ISCONNECTED) { |
1344 | 9236 |
if (__isExternalAddress(aWindowId) |
9237 |
&& __isExternalAddress(siblingId)) { |
|
9238 |
if (modeSymbol == @symbol(above)) { |
|
9239 |
chg.stack_mode = Above; |
|
9240 |
} else if (modeSymbol == @symbol(below)) { |
|
9241 |
chg.stack_mode = Below; |
|
9242 |
} else if (modeSymbol == @symbol(topIf)) { |
|
9243 |
chg.stack_mode = TopIf; |
|
9244 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
9245 |
chg.stack_mode = BottomIf; |
|
9246 |
} else if (modeSymbol == @symbol(opposite)) { |
|
9247 |
chg.stack_mode = Opposite; |
|
9248 |
} else { |
|
9249 |
mask = CWSibling; |
|
9250 |
} |
|
9251 |
||
9252 |
chg.sibling = _WindowVal(siblingId); |
|
1974 | 9253 |
ENTER_XLIB(); |
1344 | 9254 |
XConfigureWindow(myDpy, _WindowVal(aWindowId), |
9255 |
mask, &chg); |
|
1974 | 9256 |
LEAVE_XLIB(); |
1344 | 9257 |
RETURN ( self ); |
9258 |
} |
|
295 | 9259 |
} |
9260 |
bad: ; |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9261 |
%}. |
295 | 9262 |
self primitiveFailed |
9263 |
! |
|
9264 |
||
2457 | 9265 |
isValidWindowId:aWindowId |
9266 |
"return true, if the given window ID is (still) valid. |
|
9267 |
Especially useful, if the passed windowID is |
|
9268 |
an alien (external) windows id." |
|
9269 |
||
9270 |
|ret| |
|
9271 |
||
9272 |
%{ |
|
9273 |
||
9274 |
if (ISCONNECTED |
|
9275 |
&& __isExternalAddress(aWindowId)) { |
|
9276 |
char *name = NULL; |
|
9277 |
Status ok; |
|
9278 |
Window root, parent, *children = NULL; |
|
9279 |
int nChildren; |
|
9280 |
||
9281 |
/* ENTER_XLIB(); */ |
|
9282 |
ok = XQueryTree(myDpy, _WindowVal(aWindowId), |
|
9283 |
&root, &parent, &children, &nChildren); |
|
9284 |
if (children) { |
|
9285 |
XFree(children); |
|
9286 |
} |
|
9287 |
/* LEAVE_XLIB(); */ |
|
9288 |
if (ok) { |
|
9289 |
RETURN (true); |
|
9290 |
} |
|
9291 |
RETURN (false); |
|
9292 |
} |
|
9293 |
%}. |
|
9294 |
self primitiveFailed |
|
9295 |
||
9296 |
" |
|
9297 |
|v aWindowId ok| |
|
9298 |
||
9299 |
v := StandardSystemView new. |
|
9300 |
v label:'hello'. |
|
9301 |
v openAndWait. |
|
9302 |
aWindowId := v id. |
|
9303 |
ok := Display isValidWindowId:aWindowId. |
|
9304 |
Transcript showCR:'ok is: ' , ok printString. |
|
9305 |
Delay waitForSeconds:1. |
|
9306 |
v destroy. |
|
9307 |
ok := Display isValidWindowId:aWindowId. |
|
9308 |
Transcript showCR:'ok is: ' , ok printString. |
|
9309 |
" |
|
9310 |
! |
|
9311 |
||
1344 | 9312 |
lowerWindow:aWindowId |
295 | 9313 |
"bring a window to back" |
9314 |
||
9315 |
%{ /* NOCONTEXT */ |
|
9316 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9317 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9318 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9319 |
ENTER_XLIB(); |
1344 | 9320 |
XLowerWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9321 |
LEAVE_XLIB(); |
1344 | 9322 |
RETURN ( self ); |
295 | 9323 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9324 |
%}. |
295 | 9325 |
self primitiveFailed |
9326 |
! |
|
9327 |
||
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9328 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9329 |
width:w height:h minExtent:minExt maxExtent:maxExt |
2650 | 9330 |
|
9331 |
"make a window visible - either as icon or as a real view |
|
9332 |
in addition, allow change of extend, position, minExtend and maxExtent. |
|
9333 |
Needed for restart, to allow recreating a view as iconified, |
|
9334 |
and to collaps/expand windows." |
|
295 | 9335 |
|
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9336 |
|wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH| |
295 | 9337 |
|
9338 |
aBoolean ifTrue:[ |
|
1344 | 9339 |
wicon := aView icon. |
9340 |
wicon notNil ifTrue:[ |
|
9341 |
wiconId := wicon id |
|
9342 |
]. |
|
9343 |
wiconView := aView iconView. |
|
9344 |
wiconView notNil ifTrue:[ |
|
9345 |
wiconViewId := wiconView id |
|
9346 |
]. |
|
9347 |
wlabel := aView label. |
|
295 | 9348 |
]. |
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9349 |
minExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9350 |
minW := minExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9351 |
minH := minExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9352 |
]. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9353 |
maxExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9354 |
maxW := maxExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9355 |
maxH := maxExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9356 |
]. |
295 | 9357 |
%{ |
9358 |
||
9359 |
XWMHints wmhints; |
|
9360 |
XSizeHints szhints; |
|
9361 |
Window win; |
|
9362 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9363 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9364 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9365 |
Display *dpy = myDpy; |
9366 |
||
9367 |
win = _WindowVal(aWindowId); |
|
9368 |
||
9369 |
szhints.flags = 0; |
|
9370 |
if (__bothSmallInteger(xPos, yPos)) { |
|
9371 |
szhints.x = __intVal(xPos); |
|
9372 |
szhints.y = __intVal(yPos); |
|
9373 |
szhints.flags |= USPosition; |
|
9374 |
} |
|
9375 |
if (__bothSmallInteger(w, h)) { |
|
9376 |
szhints.width = __intVal(w); |
|
9377 |
szhints.height = __intVal(h); |
|
9378 |
szhints.flags |= USSize; |
|
9379 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9380 |
if (__bothSmallInteger(minW, minH)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9381 |
szhints.flags |= PMinSize; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9382 |
szhints.min_width = __intVal(minW); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9383 |
szhints.min_height = __intVal(minH); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9384 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9385 |
if (__bothSmallInteger(maxW, maxH)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9386 |
szhints.flags |= PMaxSize; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9387 |
szhints.max_width = __intVal(maxW); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9388 |
szhints.max_height = __intVal(maxH); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9389 |
} |
1344 | 9390 |
|
9391 |
if (aBoolean == true) { |
|
9392 |
char *windowName; |
|
9393 |
Pixmap iconBitmap = (Pixmap)0; |
|
9394 |
Window iconWindow; |
|
9395 |
||
9396 |
if (__isExternalAddress(wiconId)) |
|
9397 |
iconBitmap = _PixmapVal(wiconId); |
|
9398 |
else |
|
9399 |
iconBitmap = (Pixmap)0; |
|
9400 |
||
9401 |
if (__isExternalAddress(wiconViewId)) |
|
9402 |
iconWindow = _WindowVal(wiconViewId); |
|
9403 |
else |
|
9404 |
iconWindow = (Window)0; |
|
9405 |
||
9406 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1831 | 9407 |
windowName = (char *) __stringVal(wlabel); |
1344 | 9408 |
else |
9409 |
windowName = ""; |
|
9410 |
||
9411 |
if (iconBitmap || windowName) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9412 |
ENTER_XLIB(); |
1344 | 9413 |
XSetStandardProperties(dpy, win, |
9414 |
windowName, windowName, |
|
9415 |
iconBitmap, |
|
9416 |
0, 0, &szhints); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9417 |
LEAVE_XLIB(); |
1344 | 9418 |
} |
9419 |
||
9420 |
wmhints.flags = 0; |
|
9421 |
if (iconBitmap) { |
|
9422 |
wmhints.flags |= IconPixmapHint; |
|
9423 |
wmhints.icon_pixmap = iconBitmap; |
|
9424 |
} |
|
9425 |
if (iconWindow) { |
|
9426 |
wmhints.flags |= IconWindowHint; |
|
9427 |
wmhints.icon_window = iconWindow; |
|
9428 |
} |
|
9429 |
||
9430 |
wmhints.initial_state = IconicState; |
|
9431 |
wmhints.flags |= StateHint; |
|
1974 | 9432 |
ENTER_XLIB(); |
1344 | 9433 |
XSetWMHints(dpy, win, &wmhints); |
1974 | 9434 |
LEAVE_XLIB(); |
1344 | 9435 |
} |
9436 |
||
9437 |
if (szhints.flags) { |
|
1974 | 9438 |
ENTER_XLIB(); |
1344 | 9439 |
XSetNormalHints(dpy, win, &szhints); |
1974 | 9440 |
LEAVE_XLIB(); |
9441 |
} |
|
9442 |
||
9443 |
ENTER_XLIB(); |
|
1344 | 9444 |
XMapWindow(dpy, win); |
1974 | 9445 |
LEAVE_XLIB(); |
1344 | 9446 |
RETURN ( self ); |
295 | 9447 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9448 |
%}. |
295 | 9449 |
self primitiveFailed |
9450 |
! |
|
9451 |
||
1344 | 9452 |
mapWindow:aWindowId |
295 | 9453 |
"make a window visible" |
9454 |
||
9455 |
%{ /* NOCONTEXT */ |
|
9456 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9457 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9458 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9459 |
ENTER_XLIB(); |
1344 | 9460 |
XMapWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9461 |
LEAVE_XLIB(); |
1344 | 9462 |
RETURN ( self ); |
295 | 9463 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9464 |
%}. |
295 | 9465 |
self primitiveFailed |
9466 |
! |
|
9467 |
||
1344 | 9468 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
295 | 9469 |
"move and resize a window" |
9470 |
||
9471 |
%{ /* NOCONTEXT */ |
|
9472 |
||
9473 |
int newWidth, newHeight; |
|
9474 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9475 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9476 |
&& __isExternalAddress(aWindowId) |
295 | 9477 |
&& __bothSmallInteger(w, h) |
9478 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 9479 |
newWidth = __intVal(w); |
9480 |
newHeight = __intVal(h); |
|
9481 |
if (newWidth < 1) newWidth = 1; |
|
9482 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 9483 |
ENTER_XLIB(); |
1344 | 9484 |
XMoveResizeWindow(myDpy, _WindowVal(aWindowId), |
9485 |
__intVal(x), __intVal(y), |
|
9486 |
newWidth, newHeight); |
|
1974 | 9487 |
LEAVE_XLIB(); |
1344 | 9488 |
RETURN ( self ); |
295 | 9489 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9490 |
%}. |
295 | 9491 |
self primitiveFailed |
9492 |
! |
|
9493 |
||
1344 | 9494 |
moveWindow:aWindowId x:x y:y |
295 | 9495 |
"move a window" |
9496 |
||
9497 |
%{ /* NOCONTEXT */ |
|
9498 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9499 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9500 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
1974 | 9501 |
ENTER_XLIB(); |
1344 | 9502 |
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); |
1974 | 9503 |
LEAVE_XLIB(); |
1344 | 9504 |
RETURN ( self ); |
295 | 9505 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9506 |
%}. |
295 | 9507 |
self primitiveFailed |
9508 |
! |
|
9509 |
||
1344 | 9510 |
raiseWindow:aWindowId |
295 | 9511 |
"bring a window to front" |
9512 |
||
9513 |
%{ /* NOCONTEXT */ |
|
9514 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9515 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9516 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9517 |
ENTER_XLIB(); |
1344 | 9518 |
XRaiseWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9519 |
LEAVE_XLIB(); |
1344 | 9520 |
RETURN ( self ); |
295 | 9521 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9522 |
%}. |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9523 |
self primitiveFailed |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9524 |
! |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9525 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9526 |
reparentWindow:windowId to:newParentWindowId |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9527 |
"change a windows parent (an optional interface)" |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9528 |
%{ |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9529 |
Display *dpy = myDpy; |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9530 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9531 |
if (ISCONNECTED |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9532 |
&& __isExternalAddress(windowId) |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9533 |
&& __isExternalAddress(newParentWindowId)) { |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9534 |
Window _child, _newParent; |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9535 |
int i; |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9536 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9537 |
_child = _WindowVal(windowId); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9538 |
_newParent = _WindowVal(newParentWindowId); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9539 |
ENTER_XLIB(); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9540 |
|
2428 | 9541 |
#if 0 |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9542 |
XWithdrawWindow (dpy, _child, DefaultScreen(dpy)); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9543 |
XSync (dpy, 0); |
2428 | 9544 |
#endif |
9545 |
/* |
|
9546 |
* Code 'stolen' from xswallow source ... |
|
9547 |
* ... mhmh - what is this loop for ? |
|
9548 |
*/ |
|
9549 |
for (i=0; i<5; i++) { |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9550 |
XReparentWindow (dpy, _child, _newParent, 0, 0); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9551 |
XSync (dpy, 0); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9552 |
} |
2428 | 9553 |
#if 0 |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9554 |
XMapWindow (dpy, _child); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9555 |
XSync (dpy, 0); |
2428 | 9556 |
#endif |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9557 |
LEAVE_XLIB(); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9558 |
RETURN ( true ); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9559 |
} |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9560 |
%}. |
295 | 9561 |
self primitiveFailed |
9562 |
! |
|
9563 |
||
1344 | 9564 |
resizeWindow:aWindowId width:w height:h |
295 | 9565 |
"resize a window" |
9566 |
||
9567 |
%{ /* NOCONTEXT */ |
|
9568 |
||
9569 |
int newWidth, newHeight; |
|
9570 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9571 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9572 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
1344 | 9573 |
newWidth = __intVal(w); |
9574 |
newHeight = __intVal(h); |
|
9575 |
if (newWidth < 1) newWidth = 1; |
|
9576 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 9577 |
ENTER_XLIB(); |
1344 | 9578 |
XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); |
1974 | 9579 |
LEAVE_XLIB(); |
1344 | 9580 |
RETURN ( self ); |
295 | 9581 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9582 |
%}. |
295 | 9583 |
self primitiveFailed |
9584 |
! |
|
9585 |
||
1344 | 9586 |
setBackingStore:how in:aWindowId |
295 | 9587 |
"turn on/off backing-store for a window" |
9588 |
||
9589 |
%{ /* NOCONTEXT */ |
|
9590 |
||
9591 |
XSetWindowAttributes wa; |
|
9592 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9593 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9594 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9595 |
if (__INST(ignoreBackingStore) != true) { |
9596 |
if (how == @symbol(always)) wa.backing_store = Always; |
|
9597 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
9598 |
else if (how == true) wa.backing_store = Always; |
|
9599 |
else wa.backing_store = 0; |
|
9600 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9601 |
ENTER_XLIB(); |
1344 | 9602 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); |
1974 | 9603 |
LEAVE_XLIB(); |
1344 | 9604 |
END_INTERRUPTSBLOCKED |
9605 |
} |
|
9606 |
RETURN ( self ); |
|
295 | 9607 |
} |
9608 |
%}. |
|
9609 |
self primitiveFailed |
|
9610 |
! |
|
9611 |
||
1344 | 9612 |
setBitGravity:how in:aWindowId |
295 | 9613 |
"set bit gravity for a window" |
9614 |
||
9615 |
%{ /* NOCONTEXT */ |
|
9616 |
||
9617 |
XSetWindowAttributes wa; |
|
9618 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9619 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9620 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9621 |
if (how == @symbol(NorthWest)) { |
9622 |
wa.bit_gravity = NorthWestGravity; |
|
9623 |
} else if (how == @symbol(NorthEast)) { |
|
9624 |
wa.bit_gravity = NorthEastGravity; |
|
9625 |
} else if (how == @symbol(SouthWest)) { |
|
9626 |
wa.bit_gravity = SouthWestGravity; |
|
9627 |
} else if (how == @symbol(SouthEast)) { |
|
9628 |
wa.bit_gravity = SouthEastGravity; |
|
9629 |
} else if (how == @symbol(Center)) { |
|
9630 |
wa.bit_gravity = CenterGravity; |
|
9631 |
} else if (how == @symbol(North)) { |
|
9632 |
wa.bit_gravity = NorthGravity; |
|
9633 |
} else if (how == @symbol(South)) { |
|
9634 |
wa.bit_gravity = SouthGravity; |
|
9635 |
} else if (how == @symbol(West)) { |
|
9636 |
wa.bit_gravity = WestGravity; |
|
9637 |
} else if (how == @symbol(East)) { |
|
9638 |
wa.bit_gravity = EastGravity; |
|
9639 |
} else { |
|
9640 |
wa.bit_gravity = NorthWestGravity; |
|
9641 |
} |
|
9642 |
||
9643 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9644 |
ENTER_XLIB(); |
1344 | 9645 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); |
1974 | 9646 |
LEAVE_XLIB(); |
1344 | 9647 |
END_INTERRUPTSBLOCKED |
9648 |
RETURN ( self ); |
|
295 | 9649 |
} |
9650 |
%}. |
|
9651 |
self primitiveFailed |
|
9652 |
! |
|
9653 |
||
1344 | 9654 |
setCursor:aCursorId in:aWindowId |
295 | 9655 |
"define a windows cursor" |
9656 |
||
9657 |
%{ /* NOCONTEXT */ |
|
9658 |
||
9659 |
Display *dpy = myDpy; |
|
9660 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9661 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9662 |
&& __isExternalAddress(aWindowId) |
295 | 9663 |
&& __isExternalAddress(aCursorId)) { |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9664 |
Window w = _WindowVal(aWindowId); |
2501 | 9665 |
Cursor c = _CursorVal(aCursorId); |
9666 |
||
9667 |
if (w && c) { |
|
9668 |
ENTER_XLIB(); |
|
9669 |
XDefineCursor(dpy, w, c); |
|
9670 |
LEAVE_XLIB(); |
|
9671 |
} |
|
1344 | 9672 |
RETURN ( self ); |
295 | 9673 |
} |
9674 |
%}. |
|
9675 |
self primitiveFailed |
|
9676 |
! |
|
9677 |
||
1344 | 9678 |
setIconName:aString in:aWindowId |
295 | 9679 |
"define a windows iconname" |
9680 |
||
9681 |
%{ /* NOCONTEXT */ |
|
9682 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9683 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9684 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9685 |
&& (__qIsString(aString) || __qIsSymbol(aString)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9686 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9687 |
ENTER_XLIB(); |
1831 | 9688 |
XSetIconName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 9689 |
LEAVE_XLIB(); |
1344 | 9690 |
RETURN ( self ); |
295 | 9691 |
} |
9692 |
%}. |
|
9693 |
self primitiveFailed |
|
9694 |
! |
|
9695 |
||
1344 | 9696 |
setSaveUnder:yesOrNo in:aWindowId |
295 | 9697 |
"turn on/off save-under for a window" |
9698 |
||
9699 |
%{ /* NOCONTEXT */ |
|
9700 |
||
9701 |
XSetWindowAttributes wa; |
|
9702 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9703 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9704 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9705 |
if (__INST(hasSaveUnder) == true) { |
9706 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
|
1974 | 9707 |
ENTER_XLIB(); |
1344 | 9708 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); |
1974 | 9709 |
LEAVE_XLIB(); |
1344 | 9710 |
} |
9711 |
RETURN ( self ); |
|
295 | 9712 |
} |
9713 |
%}. |
|
9714 |
self primitiveFailed |
|
9715 |
! |
|
9716 |
||
1344 | 9717 |
setTransient:aWindowId for:aMainWindowId |
295 | 9718 |
"set aWindowId to be a transient of aMainWindow" |
9719 |
||
9720 |
%{ /* NOCONTEXT */ |
|
9721 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9722 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9723 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9724 |
Window w; |
9725 |
||
9726 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
|
9727 |
w = (Window) 0; |
|
9728 |
} else { |
|
9729 |
if (__isExternalAddress(aMainWindowId)) { |
|
9730 |
w = _WindowVal(aMainWindowId); |
|
9731 |
} else { |
|
9732 |
goto getOutOfHere; |
|
9733 |
} |
|
9734 |
} |
|
1974 | 9735 |
ENTER_XLIB(); |
1344 | 9736 |
XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); |
1974 | 9737 |
LEAVE_XLIB(); |
1344 | 9738 |
RETURN ( self ); |
295 | 9739 |
} |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
9740 |
getOutOfHere: ; |
295 | 9741 |
%}. |
9742 |
self primitiveFailed |
|
9743 |
! |
|
9744 |
||
1344 | 9745 |
setWindowBackground:aColorIndex in:aWindowId |
295 | 9746 |
"set the windows background color. This is the color with which |
9747 |
the view is filled whenever exposed. Do not confuse this with |
|
9748 |
the background drawing color, which is used with opaque drawing." |
|
9749 |
||
9750 |
%{ /* NOCONTEXT */ |
|
9751 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9752 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9753 |
&& __isExternalAddress(aWindowId) |
295 | 9754 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 9755 |
ENTER_XLIB(); |
1344 | 9756 |
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 9757 |
LEAVE_XLIB(); |
1344 | 9758 |
RETURN ( self ); |
295 | 9759 |
} |
9760 |
%}. |
|
9761 |
self primitiveFailed |
|
9762 |
! |
|
9763 |
||
1344 | 9764 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
295 | 9765 |
"set the windows background pattern to be a form. |
9766 |
This is the pattern with which the view is filled whenever exposed. |
|
9767 |
Do not confuse this with the background drawing color, which is used |
|
9768 |
with opaque drawing." |
|
9769 |
||
9770 |
%{ /* NOCONTEXT */ |
|
9771 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9772 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9773 |
&& __isExternalAddress(aWindowId) |
295 | 9774 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9775 |
ENTER_XLIB(); |
1344 | 9776 |
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
1974 | 9777 |
LEAVE_XLIB(); |
1344 | 9778 |
RETURN ( self ); |
295 | 9779 |
} |
9780 |
%}. |
|
9781 |
self primitiveFailed |
|
9782 |
! |
|
9783 |
||
1344 | 9784 |
setWindowBorderColor:aColorIndex in:aWindowId |
295 | 9785 |
"set the windows border color" |
9786 |
||
9787 |
%{ /* NOCONTEXT */ |
|
9788 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9789 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9790 |
&& __isExternalAddress(aWindowId) |
295 | 9791 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 9792 |
ENTER_XLIB(); |
1344 | 9793 |
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 9794 |
LEAVE_XLIB(); |
1344 | 9795 |
RETURN ( self ); |
295 | 9796 |
} |
9797 |
%}. |
|
9798 |
self primitiveFailed |
|
9799 |
! |
|
9800 |
||
1344 | 9801 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
295 | 9802 |
"set the windows border pattern" |
9803 |
||
9804 |
%{ /* NOCONTEXT */ |
|
9805 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9806 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9807 |
&& __isExternalAddress(aWindowId) |
295 | 9808 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9809 |
ENTER_XLIB(); |
1344 | 9810 |
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
1974 | 9811 |
LEAVE_XLIB(); |
1344 | 9812 |
RETURN ( self ); |
295 | 9813 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9814 |
%}. |
295 | 9815 |
self primitiveFailed |
9816 |
! |
|
9817 |
||
1344 | 9818 |
setWindowBorderShape:aPixmapId in:aWindowId |
295 | 9819 |
"set the windows border shape" |
9820 |
||
9821 |
hasShapeExtension ifFalse:[^ self]. |
|
9822 |
||
9823 |
%{ /* NOCONTEXT */ |
|
9824 |
||
9825 |
#ifdef SHAPE |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9826 |
Pixmap shapeBitmap; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9827 |
|
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9828 |
if (__isExternalAddress(aPixmapId)) |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9829 |
shapeBitmap = _PixmapVal(aPixmapId); |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9830 |
else |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9831 |
shapeBitmap = (Pixmap)0; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9832 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9833 |
if (ISCONNECTED |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9834 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9835 |
ENTER_XLIB(); |
1344 | 9836 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9837 |
0, 0, shapeBitmap, ShapeSet); |
1974 | 9838 |
LEAVE_XLIB(); |
1344 | 9839 |
RETURN ( self ); |
295 | 9840 |
} |
9841 |
#endif |
|
9842 |
%}. |
|
9843 |
self primitiveFailed |
|
9844 |
! |
|
9845 |
||
1344 | 9846 |
setWindowBorderWidth:aNumber in:aWindowId |
295 | 9847 |
"set the windows border width" |
9848 |
||
9849 |
%{ /* NOCONTEXT */ |
|
9850 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9851 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9852 |
&& __isExternalAddress(aWindowId) |
295 | 9853 |
&& __isSmallInteger(aNumber)) { |
1974 | 9854 |
ENTER_XLIB(); |
1344 | 9855 |
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); |
1974 | 9856 |
LEAVE_XLIB(); |
1344 | 9857 |
RETURN ( self ); |
295 | 9858 |
} |
9859 |
%}. |
|
9860 |
self primitiveFailed |
|
9861 |
! |
|
9862 |
||
1344 | 9863 |
setWindowClass:wClass name:wName in:aWindowId |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9864 |
"define class and name of a window. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9865 |
This may be used by the window manager to |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9866 |
select client specific resources." |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9867 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9868 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9869 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9870 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9871 |
XClassHint classhint; |
9872 |
||
9873 |
classhint.res_class = classhint.res_name = 0; |
|
9874 |
||
9875 |
if (__isString(wClass) || __isSymbol(wClass)) { |
|
1831 | 9876 |
classhint.res_class = (char *) __stringVal(wClass); |
1344 | 9877 |
} else if (wClass != nil) |
9878 |
goto error; |
|
9879 |
||
9880 |
if (__isString(wName) || __isSymbol(wName)) { |
|
1831 | 9881 |
classhint.res_name = (char *) __stringVal(wName); |
1344 | 9882 |
} else if (wName != nil) |
9883 |
goto error; |
|
9884 |
||
1974 | 9885 |
ENTER_XLIB(); |
1344 | 9886 |
XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); |
1974 | 9887 |
LEAVE_XLIB(); |
1344 | 9888 |
RETURN ( self ); |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9889 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9890 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9891 |
%}. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9892 |
self primitiveFailed |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9893 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9894 |
|
1344 | 9895 |
setWindowGravity:how in:aWindowId |
295 | 9896 |
"set window gravity for a window" |
9897 |
||
9898 |
%{ /* NOCONTEXT */ |
|
9899 |
||
9900 |
XSetWindowAttributes wa; |
|
9901 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9902 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9903 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9904 |
if (how == @symbol(NorthWest)) { |
9905 |
wa.win_gravity = NorthWestGravity; |
|
9906 |
} else if (how == @symbol(NorthEast)) { |
|
9907 |
wa.win_gravity = NorthEastGravity; |
|
9908 |
} else if (how == @symbol(SouthWest)) { |
|
9909 |
wa.win_gravity = SouthWestGravity; |
|
9910 |
} else if (how == @symbol(SouthEast)) { |
|
9911 |
wa.win_gravity = SouthEastGravity; |
|
9912 |
} else if (how == @symbol(Center)) { |
|
9913 |
wa.win_gravity = CenterGravity; |
|
9914 |
} else if (how == @symbol(North)) { |
|
9915 |
wa.win_gravity = NorthGravity; |
|
9916 |
} else if (how == @symbol(South)) { |
|
9917 |
wa.win_gravity = SouthGravity; |
|
9918 |
} else if (how == @symbol(West)) { |
|
9919 |
wa.win_gravity = WestGravity; |
|
9920 |
} else if (how == @symbol(East)) { |
|
9921 |
wa.win_gravity = EastGravity; |
|
9922 |
} else { |
|
9923 |
wa.win_gravity = NorthWestGravity; |
|
9924 |
} |
|
9925 |
||
9926 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9927 |
ENTER_XLIB(); |
1344 | 9928 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); |
1974 | 9929 |
LEAVE_XLIB(); |
1344 | 9930 |
END_INTERRUPTSBLOCKED |
9931 |
RETURN ( self ); |
|
295 | 9932 |
} |
9933 |
%}. |
|
9934 |
self primitiveFailed |
|
9935 |
! |
|
9936 |
||
1344 | 9937 |
setWindowIcon:aForm in:aWindowId |
295 | 9938 |
"define a bitmap to be used as icon" |
9939 |
||
9940 |
|iconId| |
|
9941 |
||
9942 |
aForm notNil ifTrue:[ |
|
1344 | 9943 |
iconId := aForm id |
295 | 9944 |
]. |
9945 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9946 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9947 |
&& __isExternalAddress(iconId) |
295 | 9948 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9949 |
XWMHints hints; |
9950 |
||
9951 |
hints.icon_pixmap = _PixmapVal(iconId); |
|
9952 |
hints.flags = IconPixmapHint; |
|
1974 | 9953 |
ENTER_XLIB(); |
1344 | 9954 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
1974 | 9955 |
LEAVE_XLIB(); |
1344 | 9956 |
RETURN ( self ); |
295 | 9957 |
} |
9958 |
%}. |
|
9959 |
self primitiveFailed |
|
9960 |
! |
|
9961 |
||
1376 | 9962 |
setWindowIcon:aForm mask:aMaskForm in:aWindowId |
1535 | 9963 |
"define a windows icon and (optional) iconMask." |
9964 |
||
9965 |
|iconId maskId| |
|
9966 |
||
9967 |
aForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9968 |
iconId := aForm id |
1535 | 9969 |
]. |
9970 |
aMaskForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9971 |
maskId := aMaskForm id. |
1535 | 9972 |
]. |
9973 |
%{ |
|
9974 |
if (ISCONNECTED |
|
9975 |
&& __isExternalAddress(iconId) |
|
9976 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9977 |
XWMHints hints; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9978 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9979 |
hints.icon_pixmap = _PixmapVal(iconId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9980 |
hints.flags = IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9981 |
if ((maskId != nil) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9982 |
&& __isExternalAddress(maskId)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9983 |
hints.icon_mask = _PixmapVal(maskId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9984 |
hints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9985 |
} |
1974 | 9986 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9987 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
1974 | 9988 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9989 |
RETURN ( self ); |
1535 | 9990 |
} |
9991 |
%}. |
|
9992 |
self primitiveFailed |
|
9993 |
||
1376 | 9994 |
! |
9995 |
||
1344 | 9996 |
setWindowIconWindow:aView in:aWindowId |
295 | 9997 |
"define a window to be used as icon" |
9998 |
||
9999 |
|iconWindowId| |
|
10000 |
||
10001 |
aView notNil ifTrue:[ |
|
1344 | 10002 |
iconWindowId := aView id |
295 | 10003 |
]. |
10004 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10005 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10006 |
&& __isExternalAddress(iconWindowId) |
295 | 10007 |
&& __isExternalAddress(aWindowId)) { |
1344 | 10008 |
XWMHints wmhints; |
10009 |
||
10010 |
wmhints.icon_window = _WindowVal(iconWindowId); |
|
10011 |
wmhints.flags = IconWindowHint; |
|
1974 | 10012 |
ENTER_XLIB(); |
1344 | 10013 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); |
1974 | 10014 |
LEAVE_XLIB(); |
1344 | 10015 |
RETURN ( self ); |
295 | 10016 |
} |
10017 |
%}. |
|
10018 |
self primitiveFailed |
|
10019 |
! |
|
10020 |
||
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10021 |
setWindowMinExtent:minExt maxExtent:maxExt in:aWindowId |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10022 |
"set a windows minimum & max extents. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10023 |
nil arguments are ignored." |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10024 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10025 |
|minW minH maxW maxH| |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10026 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10027 |
minExt notNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10028 |
minW := minExt x. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10029 |
minH := minExt y. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10030 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10031 |
maxExt notNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10032 |
maxW := maxExt x. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10033 |
maxH := maxExt y. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10034 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10035 |
%{ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10036 |
if (ISCONNECTED |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10037 |
&& __isExternalAddress(aWindowId)) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10038 |
Display *dpy = myDpy; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10039 |
XSizeHints szhints; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10040 |
Window win; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10041 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10042 |
win = _WindowVal(aWindowId); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10043 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10044 |
szhints.flags = 0; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10045 |
if (__bothSmallInteger(minW, minH)) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10046 |
szhints.flags |= PMinSize; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10047 |
szhints.min_width = __intVal(minW); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10048 |
szhints.min_height = __intVal(minH); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10049 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10050 |
if (__bothSmallInteger(maxW, maxH)) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10051 |
szhints.flags |= PMaxSize; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10052 |
szhints.max_width = __intVal(maxW); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10053 |
szhints.max_height = __intVal(maxH); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10054 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10055 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10056 |
if (szhints.flags) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10057 |
ENTER_XLIB(); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10058 |
XSetNormalHints(dpy, win, &szhints); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10059 |
LEAVE_XLIB(); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10060 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10061 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10062 |
%}. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10063 |
! |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10064 |
|
1344 | 10065 |
setWindowName:aString in:aWindowId |
295 | 10066 |
"define a windows name" |
10067 |
||
10068 |
%{ /* NOCONTEXT */ |
|
10069 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10070 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
10071 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
10072 |
&& (__qIsString(aString) || __qIsSymbol(aString)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
10073 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10074 |
ENTER_XLIB(); |
1831 | 10075 |
XStoreName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 10076 |
LEAVE_XLIB(); |
1344 | 10077 |
RETURN ( self ); |
295 | 10078 |
} |
10079 |
%}. |
|
10080 |
self primitiveFailed |
|
10081 |
! |
|
10082 |
||
1344 | 10083 |
setWindowShape:aPixmapId in:aWindowId |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10084 |
"set the windows shape. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10085 |
Returns false, if the display does not support the |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10086 |
X shape extension." |
295 | 10087 |
|
10088 |
hasShapeExtension ifFalse:[^ self]. |
|
10089 |
||
10090 |
%{ /* NOCONTEXT */ |
|
10091 |
||
10092 |
#ifdef SHAPE |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10093 |
Pixmap shapeBitmap; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10094 |
|
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10095 |
if (__isExternalAddress(aPixmapId)) |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10096 |
shapeBitmap = _PixmapVal(aPixmapId); |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10097 |
else |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10098 |
shapeBitmap = (Pixmap)0; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10099 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10100 |
if (ISCONNECTED |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10101 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10102 |
ENTER_XLIB(); |
1344 | 10103 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, |
10104 |
0, 0, |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10105 |
shapeBitmap, ShapeSet); |
1974 | 10106 |
LEAVE_XLIB(); |
1344 | 10107 |
RETURN ( self ); |
295 | 10108 |
} |
10109 |
#endif |
|
10110 |
%}. |
|
10111 |
self primitiveFailed |
|
10112 |
! |
|
10113 |
||
1344 | 10114 |
unmapWindow:aWindowId |
295 | 10115 |
"make a window invisible" |
10116 |
||
10117 |
%{ /* NOCONTEXT */ |
|
10118 |
||
1214 | 10119 |
if (!ISCONNECTED) { |
1344 | 10120 |
RETURN ( self ); |
1214 | 10121 |
} |
10122 |
||
10123 |
if (__isExternalAddress(aWindowId)) { |
|
1974 | 10124 |
ENTER_XLIB(); |
1344 | 10125 |
XUnmapWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 10126 |
LEAVE_XLIB(); |
1344 | 10127 |
RETURN ( self ); |
10128 |
} |
|
10129 |
%}. |
|
295 | 10130 |
self primitiveFailed |
1535 | 10131 |
! |
10132 |
||
10133 |
windowIsIconified:aWindowId |
|
10134 |
"return true, if some window is iconified. |
|
10135 |
The passed windowID may be an alien windows id." |
|
10136 |
||
10137 |
%{ /* NOCONTEXT */ |
|
10138 |
||
10139 |
if (ISCONNECTED |
|
10140 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10141 |
Atom JunkAtom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10142 |
int JunkInt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10143 |
unsigned long WinState,JunkLong; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10144 |
unsigned char *Property; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10145 |
Atom WM_STATE_Atom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10146 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10147 |
if (__INST(wmStateAtom) != nil) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10148 |
WM_STATE_Atom = _AtomVal(__INST(wmStateAtom)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10149 |
|
1974 | 10150 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10151 |
XGetWindowProperty(myDpy, _WindowVal(aWindowId), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10152 |
WM_STATE_Atom, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10153 |
0L, 2L, False, AnyPropertyType, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10154 |
&JunkAtom,&JunkInt,&WinState,&JunkLong, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10155 |
&Property); |
1974 | 10156 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10157 |
WinState=(unsigned long)(*((long*)Property)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10158 |
if (WinState==3) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10159 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10160 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10161 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10162 |
RETURN (false); |
1535 | 10163 |
} |
10164 |
%}. |
|
10165 |
self primitiveFailed |
|
295 | 10166 |
! ! |
10167 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
10168 |
!XWorkstation class methodsFor:'documentation'! |
295 | 10169 |
|
10170 |
version |
|
2977
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
10171 |
^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.331 1999-10-19 17:58:44 cg Exp $' |
295 | 10172 |
! ! |
10173 |
XWorkstation initialize! |