author | Claus Gittinger <cg@exept.de> |
Wed, 18 Sep 1996 12:30:16 +0200 | |
changeset 1060 | bc581886fe8f |
parent 1056 | b645c4bea8a7 |
child 1062 | 2a5d50022c96 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
70 | 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 |
|
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
14 |
instanceVariableNames:'screen hasShapeExtension hasShmExtension hasDPSExtension |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
15 |
hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
16 |
hasImageExtension hasInputExtension ignoreBackingStore blackpixel |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
17 |
whitepixel protocolsAtom deleteWindowAtom saveYourselfAtom |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
18 |
quitAppAtom primaryAtom secondaryAtom cutBuffer0Atom stringAtom |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
19 |
lengthAtom listOfXFonts buttonsPressed eventRootX eventRootY |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
20 |
displayName eventTrace dispatchingExpose rgbVisual virtualRootId |
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
21 |
rootId eventBuffer altModifierMask metaModifierMask' |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
22 |
classVariableNames:'RawKeysymTranslation ConservativeSync' |
341 | 23 |
poolDictionaries:'' |
24 |
category:'Interface-Graphics' |
|
295 | 25 |
! |
0 | 26 |
|
78 | 27 |
!XWorkstation primitiveDefinitions! |
0 | 28 |
%{ |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
29 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
30 |
#define COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
31 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
32 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
33 |
static int __cnt_color = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
34 |
static int __cnt_bitmap = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
35 |
static int __cnt_view = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
36 |
static int __cnt_gc = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
37 |
static int __cnt_cursor = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
38 |
static int __cnt_font = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
39 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
40 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
41 |
|
46 | 42 |
/* |
43 |
* x does a typedef Time - I need Object Time ... |
|
44 |
*/ |
|
0 | 45 |
#define Time XTime |
46 |
||
391
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
47 |
/* |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
48 |
* x does a #define True / False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
49 |
* 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
|
50 |
*/ |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
51 |
#undef True |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
52 |
#undef False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
53 |
|
37 | 54 |
#ifdef memset |
55 |
# undef memset |
|
56 |
#endif |
|
57 |
||
0 | 58 |
#include <stdio.h> |
59 |
#include <X11/Xlib.h> |
|
60 |
#include <X11/Xutil.h> |
|
61 |
#include <X11/Xatom.h> |
|
62 |
||
150 | 63 |
#define XK_MISCELLANY |
64 |
#include <X11/keysymdef.h> |
|
65 |
||
277
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
66 |
#include <X11/cursorfont.h> |
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
67 |
|
90 | 68 |
/* |
69 |
* this define adds support for two-byte-strings. |
|
70 |
* leaving it undefined does not really save you much |
|
71 |
* (the define will vanish) |
|
72 |
*/ |
|
36 | 73 |
#define TWOBYTESTRINGS |
74 |
||
0 | 75 |
/* |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
76 |
* this define suppresses XAllocColor/XFreeColor on |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
77 |
* 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
|
78 |
* 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
|
79 |
*/ |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
80 |
#define QUICK_TRUE_COLORS |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
81 |
|
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
82 |
/* |
0 | 83 |
* shape support works; enabled by -DSHAPE in makefile |
84 |
* see RoundClock and RoundGlobe examples |
|
85 |
*/ |
|
86 |
#ifdef SHAPE |
|
87 |
# include <X11/extensions/shape.h> |
|
88 |
#endif |
|
89 |
||
90 |
/* |
|
150 | 91 |
* shared memory extension access is currently not supported |
0 | 92 |
* (only query is implemented) |
93 |
*/ |
|
94 |
#ifdef SHM |
|
95 |
# include <X11/extensions/XShm.h> |
|
96 |
#endif |
|
97 |
||
98 |
/* |
|
150 | 99 |
* multiBuffer extension access is currently not supported |
100 |
* (only query is implemented) |
|
101 |
*/ |
|
102 |
#ifdef MBUF |
|
103 |
# include <X11/extensions/multibuf.h> |
|
104 |
#endif |
|
105 |
||
106 |
/* |
|
107 |
* XVideo extension access is currently not supported |
|
108 |
* (only query is implemented) |
|
109 |
*/ |
|
110 |
#ifdef XVIDEO |
|
111 |
# include <X11/extensions/Xv.h> |
|
112 |
#endif |
|
113 |
||
114 |
/* |
|
186 | 115 |
* PEX extension - if available |
116 |
*/ |
|
117 |
#ifdef PEX5 |
|
118 |
# include <PEX5/PEX.h> |
|
119 |
#endif |
|
120 |
||
121 |
/* |
|
122 |
* XImage extension - if available |
|
123 |
*/ |
|
124 |
#ifdef XIE |
|
125 |
# include <X11/extensions/XIE.h> |
|
126 |
#endif |
|
127 |
||
128 |
/* |
|
90 | 129 |
* when I have more time to check it out, I will support display-PS |
0 | 130 |
*/ |
131 |
#ifdef DPS |
|
132 |
# ifdef sgi |
|
133 |
# include <X11/extensions/XDPS.h> |
|
134 |
# include <X11/extensions/XDPSlib.h> |
|
135 |
# include <X11/extensions/dpsXclient.h> |
|
136 |
# else |
|
137 |
# include <DPS/XDPS.h> |
|
138 |
# include <DPS/XDPSlib.h> |
|
139 |
# include <DPS/dpsXclient.h> |
|
140 |
# endif |
|
141 |
#endif |
|
142 |
||
90 | 143 |
#if defined(IRIX5) || (XlibSpecificationRelease == 6) |
144 |
/* |
|
145 |
* accessing private data in Display ... sorry |
|
146 |
*/ |
|
147 |
# define DISPLAYACCESS(d) ((_XPrivDisplay)d) |
|
148 |
#else |
|
149 |
# define DISPLAYACCESS(d) d |
|
150 |
#endif |
|
151 |
||
78 | 152 |
/* |
153 |
* some defines - tired of typing ... |
|
154 |
*/ |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
155 |
#define _DisplayVal(o) (Display *)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
156 |
#define _WindowVal(o) (Window)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
157 |
#define _PixmapVal(o) (Pixmap)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
158 |
#define _GCVal(o) (GC)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
159 |
#define _CursorVal(o) (Cursor)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
160 |
#define _FontVal(o) (XFontStruct *)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
161 |
#define _DPSContextVal(o) (DPSContext)(__MKCP(o)) |
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
162 |
|
211 | 163 |
#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
|
164 |
#define _AtomVal(o) __intVal(o) |
211 | 165 |
#define __isAtomID(o) __isSmallInteger(o) |
166 |
||
555 | 167 |
#define myDpy _DisplayVal(__INST(displayId)) |
168 |
#define ISCONNECTED (__INST(displayId) != nil) |
|
78 | 169 |
|
170 |
#ifndef THISCONTEXT_IN_REGISTER |
|
171 |
# define BEGIN_INTERRUPTSBLOCKED /* */ |
|
172 |
# define END_INTERRUPTSBLOCKED /* */ |
|
173 |
#else |
|
174 |
# define BEGIN_INTERRUPTSBLOCKED \ |
|
175 |
{ \ |
|
850 | 176 |
int needUnblock = 0; \ |
177 |
extern OBJ __thisContext__; \ |
|
178 |
\ |
|
179 |
__thisContext__ = __thisContext;\ |
|
180 |
if (!__interruptsBlocked) { \ |
|
181 |
__BLOCKINTERRUPTS(); \ |
|
182 |
needUnblock = 1; \ |
|
183 |
} |
|
78 | 184 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
185 |
# define END_INTERRUPTSBLOCKED_NOW \ |
850 | 186 |
__thisContext = __thisContext; \ |
187 |
__thisContext__ = 0; \ |
|
188 |
if (needUnblock) { \ |
|
189 |
__UNBLOCKINTERRUPTS(); \ |
|
190 |
} \ |
|
78 | 191 |
} |
192 |
||
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
193 |
# define END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
194 |
__thisContext = __thisContext; \ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
195 |
__thisContext__ = 0; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
196 |
|
78 | 197 |
#endif |
198 |
%} |
|
199 |
! ! |
|
200 |
||
201 |
!XWorkstation primitiveVariables! |
|
202 |
%{ |
|
0 | 203 |
/* |
146 | 204 |
* remembered info from private error handler |
0 | 205 |
*/ |
2 | 206 |
static char lastErrorMsg[80] = ""; |
207 |
static unsigned lastRequestCode = 0; |
|
208 |
static unsigned lastMinorCode = 0; |
|
209 |
static unsigned lastResource = 0; |
|
129 | 210 |
|
211 |
static int __debug__ = 0; |
|
212 |
#define DPRINTF(x) if (__debug__) { printf x; } |
|
78 | 213 |
%} |
214 |
! ! |
|
215 |
||
216 |
!XWorkstation primitiveFunctions! |
|
217 |
%{ |
|
18 | 218 |
/* |
144 | 219 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
220 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 221 |
* the implementation below is somewhat wrong: it will |
78 | 222 |
* report all errors for Display, even though there could be |
162 | 223 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
224 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 225 |
*/ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
226 |
|
12 | 227 |
__XErrorHandler__(dpy, event) |
0 | 228 |
Display *dpy; |
229 |
XErrorEvent *event; |
|
230 |
{ |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
231 |
XGetErrorText(dpy, event->error_code, lastErrorMsg, 79); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
232 |
lastErrorMsg[79] = '\0'; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
233 |
|
0 | 234 |
if (lastErrorMsg[0] == '\0') { |
70 | 235 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 236 |
} |
2 | 237 |
lastRequestCode = event->request_code; |
238 |
lastMinorCode = event->minor_code; |
|
239 |
lastResource = event->resourceid; |
|
911 | 240 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
241 |
/* |
|
242 |
* this is a BadWindow error for X_DestroyWindow. |
|
243 |
* ignore it here, since it results from the GC freeing windows |
|
244 |
* in non bottom-up window order. |
|
245 |
*/ |
|
246 |
return 0; |
|
247 |
} |
|
2 | 248 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
249 |
if (@global(ErrorPrinting) == true) { |
219
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
250 |
fprintf(stderr, "XWORKSTAT: x-error cought maj=%d (0x%x) min=%d (0x%x) resource=%x\n", |
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
251 |
event->request_code, event->request_code, |
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
252 |
event->minor_code, event->minor_code, event->resourceid); |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
253 |
fprintf(stderr, "XWORKSTAT: x-error message is [%d] '%s'\n", event->error_code, lastErrorMsg); |
218
10072d9beba5
can now turn off Xlib error messages from the errorHandler
Claus Gittinger <cg@exept.de>
parents:
217
diff
changeset
|
254 |
} |
43 | 255 |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
256 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKOBJ(dpy)); |
0 | 257 |
return 0; |
258 |
} |
|
259 |
||
90 | 260 |
#ifdef VIRTUAL_ROOT |
0 | 261 |
/* |
18 | 262 |
* added since RootWindow-macro is not suficient |
263 |
* when virtual root-windows are involved (i.e. tvtwm) |
|
264 |
*/ |
|
265 |
static Window |
|
266 |
getRootWindow(dpy, screen) |
|
267 |
Display *dpy; |
|
268 |
{ |
|
269 |
Window root; |
|
270 |
Atom vRootAtom = None; |
|
271 |
int i; |
|
272 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
273 |
Window* children = (Window *)0; |
18 | 274 |
unsigned int numChildren; |
275 |
||
276 |
root = RootWindow(dpy, screen); |
|
277 |
/* |
|
278 |
* on IRIS, this creates a badwindow error - why ? |
|
279 |
* children contains a funny window (000034) |
|
280 |
*/ |
|
90 | 281 |
# if !defined(IRIS) || defined(IRIX5) |
18 | 282 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
70 | 283 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
284 |
if (vRootAtom != None) { |
|
285 |
for (i=0; i < numChildren; i++) { |
|
286 |
Atom actual_type; |
|
287 |
int actual_format; |
|
288 |
unsigned long nitems, bytesafter; |
|
289 |
Window* newRoot = (Window*) 0; |
|
290 |
||
291 |
if (children[i]) { |
|
292 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
|
293 |
0L, 1L, False, XA_WINDOW, |
|
294 |
&actual_type, &actual_format, &nitems, &bytesafter, |
|
295 |
(unsigned char**) &newRoot) == Success && newRoot) { |
|
296 |
root = *newRoot; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
297 |
XFree(newRoot); /* XXX */ |
70 | 298 |
break; |
299 |
} |
|
300 |
} |
|
301 |
} |
|
302 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
303 |
if (children) XFree( children ); |
18 | 304 |
} |
90 | 305 |
# endif |
18 | 306 |
return root; |
307 |
} |
|
90 | 308 |
#endif |
0 | 309 |
%} |
78 | 310 |
! ! |
0 | 311 |
|
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
312 |
!XWorkstation class methodsFor:'documentation'! |
295 | 313 |
|
314 |
copyright |
|
315 |
" |
|
316 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
317 |
All Rights Reserved |
|
318 |
||
319 |
This software is furnished under a license and may be used |
|
320 |
only in accordance with the terms of that license and with the |
|
321 |
inclusion of the above copyright notice. This software may not |
|
322 |
be provided or otherwise made available to, or used by, any |
|
323 |
other person. No title to or ownership of the software is |
|
324 |
hereby transferred. |
|
325 |
" |
|
326 |
! |
|
327 |
||
328 |
documentation |
|
329 |
" |
|
330 |
this class provides the interface to X11. It redefines all required methods |
|
331 |
from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically |
|
332 |
limited to one display - in theory, you can create Views on many displays |
|
333 |
simultanously. However, the default setup is for one display only. |
|
334 |
To support multiple displays, you will have to start another event dispatcher |
|
335 |
process for the other display(s) and create the other views with a slightly |
|
336 |
different protocol. However, 'normal' applications do not have to care for |
|
337 |
all of this ... |
|
338 |
||
339 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 340 |
|
341 |
[author:] |
|
850 | 342 |
Claus Gittinger |
295 | 343 |
" |
344 |
! ! |
|
345 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
346 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
347 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
348 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
349 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
350 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
351 |
super initialize. |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
352 |
|
386 | 353 |
RawKeysymTranslation isNil ifTrue:[ |
354 |
"/ the following table maps X-keyevents to ST/X |
|
355 |
"/ device independed events. |
|
356 |
"/ It is NOT meant as a keyboardMap replacement. |
|
357 |
||
358 |
RawKeysymTranslation := d := Dictionary new. |
|
359 |
d at:'Delete_line' put:#DeleteLine. |
|
360 |
d at:'Delete_word' put:#DeleteWord. |
|
361 |
d at:'Down' put:#CursorDown. |
|
362 |
d at:'Up' put:#CursorUp. |
|
363 |
d at:'Left' put:#CursorLeft. |
|
364 |
d at:'Right' put:#CursorRight. |
|
365 |
] |
|
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
366 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
367 |
|
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
368 |
!XWorkstation class methodsFor:'error handling'! |
2 | 369 |
|
129 | 370 |
debug:aBoolean |
371 |
%{ /* NOCONTEXT */ |
|
372 |
||
373 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
374 |
%} |
|
375 |
! |
|
376 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
377 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
378 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
379 |
#ifdef COUNT_RESOURCES |
928 | 380 |
printf("colors %d bitmaps %d view %d gc %d cursor %d font %d\n", |
381 |
__cnt_color, __cnt_bitmap, |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
382 |
__cnt_view, __cnt_gc, __cnt_cursor, __cnt_font); |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
383 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
384 |
%} |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
385 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
386 |
|
78 | 387 |
errorStringOfLastError |
388 |
%{ |
|
216 | 389 |
RETURN ( __MKSTRING(lastErrorMsg COMMA_CON) ); |
78 | 390 |
%} |
391 |
! |
|
392 |
||
135 | 393 |
lastErrorString |
2 | 394 |
"return the last X-error string - |
395 |
when buffering is on, this may be |
|
396 |
an error for a long-ago operation" |
|
78 | 397 |
|
398 |
|string requestCode s match line| |
|
399 |
||
400 |
string := self errorStringOfLastError. |
|
401 |
requestCode := self requestCodeOfLastError. |
|
402 |
" |
|
403 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
404 |
and append the name of the corresponding X-request |
|
405 |
" |
|
406 |
s := '/usr/lib/X11/XErrorDB' asFilename readStream. |
|
407 |
s notNil ifTrue:[ |
|
408 |
match := 'XRequest.' , requestCode printString. |
|
409 |
line := s peekForLineStartingWith:match. |
|
410 |
line notNil ifTrue:[ |
|
411 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
412 |
]. |
|
413 |
s close. |
|
414 |
]. |
|
415 |
^ string |
|
295 | 416 |
! |
417 |
||
418 |
minorCodeOfLastError |
|
419 |
%{ /* NOCONTEXT */ |
|
420 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
421 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 422 |
%} |
423 |
! |
|
424 |
||
425 |
requestCodeOfLastError |
|
152 | 426 |
%{ /* NOCONTEXT */ |
427 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
428 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 429 |
%} |
135 | 430 |
! |
431 |
||
295 | 432 |
resourceIdOfLastError |
0 | 433 |
%{ /* NOCONTEXT */ |
295 | 434 |
|
435 |
RETURN ( __MKOBJ(lastResource) ); |
|
0 | 436 |
%} |
437 |
! ! |
|
438 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
439 |
!XWorkstation class methodsFor:'queries'! |
104 | 440 |
|
441 |
platformName |
|
133 | 442 |
"ST-80 compatibility. |
443 |
Return a string describing the display systems platform." |
|
444 |
||
715 | 445 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
446 |
||
447 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 448 |
! ! |
449 |
||
0 | 450 |
!XWorkstation methodsFor:'accessing & queries'! |
451 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
452 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
453 |
"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
|
454 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
455 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
456 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
457 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
458 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
459 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
460 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
461 |
|
295 | 462 |
blackpixel |
463 |
"return the colornumber of black" |
|
464 |
||
465 |
^ blackpixel |
|
466 |
! |
|
467 |
||
468 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
469 |
"return the state-mask for button1 in motion events' state-field. |
295 | 470 |
For backward compatibility." |
471 |
||
472 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
473 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
295 | 474 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
475 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
476 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
477 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
478 |
" |
295 | 479 |
! |
480 |
||
481 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
482 |
"return the state-mask for button2 in motion events' state-field |
295 | 483 |
For backward compatibility." |
484 |
||
485 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
486 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 487 |
%} |
488 |
! |
|
489 |
||
490 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
491 |
"return the state-mask for button3 in motion events' state-field |
295 | 492 |
For backward compatibility." |
493 |
||
494 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
495 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 496 |
%} |
497 |
! |
|
498 |
||
499 |
buttonMotionMask:aButton |
|
500 |
"return the state-mask for button1 in motion events state-field. |
|
501 |
This is the devices mask." |
|
502 |
||
503 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
504 |
if (aButton == __MKSMALLINT(1)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
505 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
506 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
507 |
if (aButton == __MKSMALLINT(2)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
508 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
509 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
510 |
if (aButton == __MKSMALLINT(3)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
511 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 512 |
} |
513 |
%}. |
|
514 |
^ nil |
|
515 |
! |
|
516 |
||
382 | 517 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
518 |
"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
|
519 |
|
382 | 520 |
%{ /* NOCONTEXT */ |
521 |
RETURN (__MKSMALLINT(ControlMask)); |
|
522 |
%} |
|
523 |
! |
|
524 |
||
295 | 525 |
defaultEventMask |
526 |
"return a mask to enable some events by default." |
|
527 |
||
528 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
529 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
295 | 530 |
KeyPressMask | KeyReleaseMask | |
531 |
EnterWindowMask | LeaveWindowMask | |
|
532 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
|
533 |
%} |
|
534 |
! |
|
535 |
||
0 | 536 |
displayFileDescriptor |
537 |
"return the displays fileNumber - for select" |
|
538 |
||
539 |
%{ /* NOCONTEXT */ |
|
540 |
||
150 | 541 |
if (ISCONNECTED) { |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
542 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 543 |
} |
544 |
RETURN (nil); |
|
0 | 545 |
%} |
546 |
! |
|
547 |
||
133 | 548 |
displayName |
549 |
"return the X-connections display name. |
|
550 |
This is (currently) nil for the default display, |
|
551 |
something like foo:0 for any other remote display. |
|
552 |
Future versions may return non-nil strings for the default display as well." |
|
553 |
||
554 |
^ displayName |
|
555 |
! |
|
556 |
||
341 | 557 |
protocolVersion |
558 |
"return the X-servers protocol version - should normally not be of |
|
559 |
any interest" |
|
560 |
||
561 |
%{ /* NOCONTEXT */ |
|
562 |
if (ISCONNECTED) { |
|
563 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
|
564 |
} |
|
565 |
RETURN (nil); |
|
566 |
%} |
|
567 |
||
568 |
" |
|
569 |
Display protocolVersion |
|
570 |
" |
|
571 |
! |
|
572 |
||
573 |
serverVendor |
|
574 |
"return the X-server vendor string - this should normally not be of |
|
575 |
any interest, but can be for special cases |
|
576 |
(to avoid bugs in certain implementations)" |
|
577 |
%{ |
|
578 |
if (ISCONNECTED) { |
|
579 |
RETURN ( __MKSTRING(XServerVendor(myDpy) COMMA_CON) ); |
|
580 |
} |
|
581 |
RETURN (nil); |
|
582 |
%} |
|
583 |
||
584 |
" |
|
585 |
Display serverVendor |
|
586 |
" |
|
587 |
! |
|
588 |
||
382 | 589 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
590 |
"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
|
591 |
|
382 | 592 |
%{ /* NOCONTEXT */ |
593 |
RETURN (__MKSMALLINT(ShiftMask)); |
|
594 |
%} |
|
595 |
! |
|
596 |
||
341 | 597 |
translatePoint:aPoint from:windowId1 to:windowId2 |
598 |
"given a point in window1, return the coordinate in window2. |
|
599 |
This expects a device coordinate (relative to the first views origin) |
|
600 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
601 |
- use to xlate points from a window to rootwindow" |
|
602 |
||
603 |
|x1 y1 x2 y2| |
|
604 |
||
605 |
x1 := x2 := aPoint x truncated. |
|
606 |
y1 := y2 := aPoint y truncated. |
|
607 |
%{ |
|
608 |
int xpos, ypos; |
|
609 |
Window w1, w2, child_return; |
|
555 | 610 |
int screen = __intVal(__INST(screen)); |
341 | 611 |
Display *dpy = myDpy; |
612 |
||
613 |
if (__isExternalAddress(windowId1) |
|
614 |
&& __isExternalAddress(windowId2) |
|
615 |
&& __bothSmallInteger(x1, y1)) { |
|
616 |
w1 = _WindowVal(windowId1); |
|
617 |
w2 = _WindowVal(windowId2); |
|
618 |
#ifdef VIRTUAL_ROOT |
|
619 |
if ((w1 == RootWindow(dpy, screen)) |
|
620 |
|| (w2 == RootWindow(dpy, screen))) { |
|
621 |
if (w1 == RootWindow(dpy, screen)) { |
|
622 |
w1 = getRootWindow(dpy, screen); |
|
623 |
} |
|
624 |
if (w2 == RootWindow(dpy, screen)) { |
|
625 |
w2 = getRootWindow(dpy, screen); |
|
626 |
} |
|
627 |
} |
|
628 |
#endif |
|
629 |
BEGIN_INTERRUPTSBLOCKED |
|
630 |
XTranslateCoordinates(dpy, w1, w2, |
|
555 | 631 |
__intVal(x1), __intVal(y1), |
341 | 632 |
&xpos, &ypos, &child_return); |
633 |
END_INTERRUPTSBLOCKED |
|
634 |
x2 = __MKSMALLINT(xpos); |
|
635 |
y2 = __MKSMALLINT(ypos); |
|
636 |
} |
|
637 |
%}. |
|
638 |
||
639 |
^ (x2 @ y2) |
|
640 |
! |
|
641 |
||
642 |
vendorRelease |
|
643 |
"return the X-servers vendor release - should normally not be of |
|
644 |
any interest, but can be for special cases. |
|
645 |
(to avoid bugs in certain implementations)" |
|
646 |
||
647 |
%{ /* NOCONTEXT */ |
|
648 |
if (ISCONNECTED) { |
|
649 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
|
650 |
} |
|
651 |
RETURN (nil); |
|
652 |
%} |
|
653 |
||
654 |
" |
|
655 |
Display vendorRelease |
|
656 |
" |
|
657 |
! |
|
658 |
||
659 |
viewIdFromPoint:aPoint in:windowId |
|
660 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
661 |
hit by this coordinate. Return nil if no view was hit. |
|
662 |
The returned id may be the id of a non ST view. |
|
663 |
- used to find the window to drop objects after a cross-view drag." |
|
664 |
||
665 |
%{ /* NOCONTEXT */ |
|
666 |
||
667 |
Display *dpy = myDpy; |
|
555 | 668 |
int screen = __intVal(__INST(screen)); |
341 | 669 |
OBJ xp, yp; |
670 |
int xpos, ypos; |
|
671 |
Window child_return; |
|
672 |
||
673 |
if (__isExternalAddress(windowId) |
|
674 |
&& __isPoint(aPoint)) { |
|
675 |
xp = _point_X(aPoint); |
|
676 |
yp = _point_Y(aPoint); |
|
677 |
if (__bothSmallInteger(xp, yp)) { |
|
678 |
BEGIN_INTERRUPTSBLOCKED |
|
679 |
XTranslateCoordinates(dpy, |
|
680 |
RootWindow(dpy, screen), |
|
681 |
_WindowVal(windowId), |
|
555 | 682 |
__intVal(xp), __intVal(yp), |
341 | 683 |
&xpos, &ypos, &child_return); |
684 |
END_INTERRUPTSBLOCKED |
|
685 |
if (child_return) { |
|
686 |
RETURN ( __MKOBJ(child_return) ); |
|
687 |
} |
|
688 |
RETURN ( nil ); |
|
689 |
} |
|
690 |
} |
|
691 |
%}. |
|
692 |
windowId notNil ifTrue:[ |
|
693 |
aPoint isPoint ifTrue:[ |
|
694 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
695 |
] |
|
696 |
]. |
|
697 |
||
698 |
^ nil |
|
699 |
! |
|
700 |
||
701 |
virtualExtent |
|
702 |
"return the virtual extent of the display (in pixels). |
|
703 |
On most systems, this is the same as the physical width; |
|
704 |
except, if a window manager with a virtual desktop like olvwm |
|
705 |
(simulating a bigger screen) is running." |
|
706 |
||
707 |
%{ |
|
555 | 708 |
if ((__INST(rootId) != __INST(virtualRootId)) |
709 |
&& __isExternalAddress(__INST(virtualRootId))) { |
|
341 | 710 |
Window vRootWin; |
711 |
Window root; |
|
712 |
int x, y; |
|
713 |
unsigned int width, height; |
|
714 |
unsigned int dummy; |
|
715 |
||
555 | 716 |
vRootWin = _WindowVal(__INST(virtualRootId)); |
341 | 717 |
if (XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
718 |
&dummy, &dummy)) { |
|
719 |
RETURN ( __MKPOINT_INT(width, height) ); |
|
720 |
} |
|
721 |
} |
|
722 |
%}. |
|
723 |
^ width @ height |
|
724 |
! |
|
725 |
||
726 |
whitepixel |
|
727 |
"return the colornumber of white" |
|
728 |
||
729 |
^ whitepixel |
|
730 |
! ! |
|
731 |
||
732 |
!XWorkstation methodsFor:'accessing display capabilities'! |
|
733 |
||
0 | 734 |
hasDPS |
186 | 735 |
"return true, if this workstation supports display postscript. |
736 |
Both the server must support it, and the feature must have been |
|
737 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 738 |
|
739 |
^ hasDPSExtension |
|
186 | 740 |
|
741 |
" |
|
742 |
Display hasDPS |
|
743 |
" |
|
744 |
! |
|
745 |
||
150 | 746 |
hasExtension:extensionString |
747 |
"query for an X extension. The argument, extensionString |
|
748 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 749 |
Return true, if that extension is available in the server. |
750 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 751 |
|
752 |
%{ |
|
753 |
int dummy; |
|
754 |
||
755 |
if (__isString(extensionString) && ISCONNECTED) { |
|
756 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
|
757 |
RETURN ( true ); |
|
758 |
} |
|
759 |
} |
|
760 |
%}. |
|
761 |
^ false |
|
186 | 762 |
|
763 |
" |
|
764 |
Display hasExtension:'XVideo' |
|
765 |
Display hasExtension:'Input' |
|
766 |
Display hasExtension:'GLX' |
|
767 |
Display hasExtension:'X3D-PEX' |
|
768 |
Display hasExtension:'XInputExtension' |
|
769 |
Display hasExtension:'SHAPE' |
|
770 |
Display hasExtension:'MIT-SHM' |
|
771 |
Display hasExtension:'SGIFullScreenStereo' |
|
772 |
" |
|
150 | 773 |
! |
774 |
||
295 | 775 |
hasImageExtension |
776 |
"return true, if this workstation supports the X image extension. |
|
777 |
Both the server must support it, and the feature must have been |
|
778 |
enabled in the smalltalk system, for true to be returned." |
|
779 |
||
780 |
^ hasImageExtension |
|
781 |
||
782 |
" |
|
783 |
Display hasImageExtension |
|
784 |
" |
|
785 |
! |
|
786 |
||
787 |
hasInputExtension |
|
788 |
"return true, if this workstation supports the X input extension. |
|
789 |
Both the server must support it, and the feature must have been |
|
790 |
enabled in the smalltalk system, for true to be returned." |
|
791 |
||
792 |
^ hasInputExtension |
|
793 |
||
794 |
" |
|
795 |
Display hasInputExtension |
|
796 |
" |
|
797 |
! |
|
798 |
||
799 |
hasMultibuffer |
|
800 |
"return true, if this workstation supports the multibuffer extension. |
|
801 |
Both the server must support it, and the feature must have been |
|
802 |
enabled in the smalltalk system, for true to be returned." |
|
803 |
||
804 |
^ hasMbufExtension |
|
805 |
||
806 |
" |
|
807 |
Display hasMultibuffer |
|
808 |
" |
|
809 |
! |
|
810 |
||
811 |
hasPEX |
|
812 |
"return true, if this workstation supports PEX 3D graphics. |
|
813 |
Both the server must support it, and the feature must have been |
|
814 |
enabled in the smalltalk system, for true to be returned." |
|
815 |
||
816 |
^ hasPEXExtension |
|
817 |
||
818 |
" |
|
819 |
Display hasPEX |
|
820 |
" |
|
821 |
! |
|
822 |
||
823 |
hasShape |
|
824 |
"return true, if this workstation supports non-rectangular windows. |
|
825 |
Both the server must support it, and the feature must have been |
|
826 |
enabled in the smalltalk system, for true to be returned." |
|
827 |
||
828 |
^ hasShapeExtension |
|
829 |
||
830 |
" |
|
831 |
Display hasShape |
|
832 |
" |
|
833 |
! |
|
834 |
||
835 |
hasShm |
|
836 |
"return true, if this workstation supports the shared pixmap extension. |
|
837 |
Both the server must support it, and the feature must have been |
|
838 |
enabled in the smalltalk system, for true to be returned." |
|
839 |
||
840 |
^ hasShmExtension |
|
841 |
||
842 |
" |
|
843 |
Display hasShm |
|
844 |
" |
|
845 |
! |
|
846 |
||
847 |
hasXVideo |
|
848 |
"return true, if this workstation supports the XVideo extension. |
|
849 |
Both the server must support it, and the feature must have been |
|
850 |
enabled in the smalltalk system, for true to be returned." |
|
851 |
||
852 |
^ hasXVideoExtension |
|
853 |
||
854 |
" |
|
855 |
Display hasXVideo |
|
856 |
" |
|
857 |
! |
|
858 |
||
859 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
860 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 861 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 862 |
|
863 |
|xIconSizes count ret| |
|
864 |
||
865 |
%{ |
|
866 |
Display *dpy = myDpy; |
|
555 | 867 |
int screen = __intVal(__INST(screen)); |
295 | 868 |
XIconSize *sizeList; |
869 |
int cnt; |
|
870 |
||
871 |
if (ISCONNECTED) { |
|
850 | 872 |
if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) { |
873 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
|
874 |
count = __MKSMALLINT(cnt); |
|
875 |
} |
|
295 | 876 |
} |
877 |
%}. |
|
878 |
xIconSizes isNil ifTrue:[^ nil]. |
|
879 |
||
880 |
ret := OrderedCollection new:count. |
|
881 |
1 to:count do:[ :i | |
|
850 | 882 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 883 |
|
884 |
%{ |
|
850 | 885 |
XIconSize *slp; |
886 |
||
887 |
slp = &((XIconSize *)__externalBytesAddress(xIconSizes))[__intVal(i)-1]; |
|
888 |
minWidth = __MKSMALLINT(slp->min_width); |
|
889 |
minHeight = __MKSMALLINT(slp->min_height); |
|
890 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
891 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
892 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
893 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 894 |
%}. |
850 | 895 |
d := IdentityDictionary new. |
896 |
d at:#minWidth put:minWidth. |
|
897 |
d at:#maxWidth put:maxWidth. |
|
898 |
d at:#widthStep put:widthStep. |
|
899 |
d at:#minHeight put:minHeight. |
|
900 |
d at:#maxHeight put:maxHeight. |
|
901 |
d at:#heightStep put:heightStep. |
|
902 |
||
903 |
ret add:d |
|
295 | 904 |
]. |
905 |
||
906 |
xIconSizes free. |
|
907 |
^ ret |
|
908 |
||
909 |
" |
|
819 | 910 |
Display iconSizes |
295 | 911 |
" |
912 |
! |
|
913 |
||
341 | 914 |
ignoreBackingStore:aBoolean |
915 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
916 |
no backing store used - this can be used on servers where backing store is |
|
917 |
very slow or is broken (can be put into display-rc-file)" |
|
918 |
||
919 |
ignoreBackingStore := aBoolean |
|
295 | 920 |
! |
921 |
||
823 | 922 |
preferredIconSize |
923 |
"return the displays preferred size for icons. |
|
924 |
Redefined to return a special value on SGI servers." |
|
925 |
||
926 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
850 | 927 |
^ 86@68 |
823 | 928 |
]. |
929 |
^ super preferredIconSize |
|
930 |
||
931 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
932 |
! |
|
933 |
||
1025 | 934 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
935 |
"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
|
936 |
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
|
937 |
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
|
938 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
939 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
940 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
941 |
|
43 | 942 |
supportedImageFormats |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
943 |
"return an array with supported image formats; |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
944 |
each array entry is an attribute dictionary, consisting of |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
945 |
depth, bitsPerPixel and padding values." |
43 | 946 |
|
150 | 947 |
|nFormats "{ Class: SmallInteger }" |
948 |
formatArray| |
|
43 | 949 |
%{ |
950 |
Display *dpy = myDpy; |
|
150 | 951 |
|
952 |
if (! ISCONNECTED) { |
|
953 |
RETURN (nil); |
|
954 |
} |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
955 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
43 | 956 |
%}. |
957 |
formatArray := Array new:nFormats. |
|
150 | 958 |
1 to:nFormats do:[:index | |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
959 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
150 | 960 |
|
961 |
i := index. |
|
43 | 962 |
%{ |
70 | 963 |
ScreenFormat *format; |
964 |
Display *dpy = myDpy; |
|
965 |
||
90 | 966 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
555 | 967 |
format += (__intVal(i)-1); |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
968 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
969 |
depthInfo = __MKSMALLINT(format->depth); |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
970 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
43 | 971 |
%}. |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
972 |
info := IdentityDictionary new. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
973 |
info at:#depth put:depthInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
974 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
975 |
info at:#padding put:paddingInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
976 |
formatArray at:index put:info. |
43 | 977 |
]. |
978 |
^ formatArray |
|
979 |
||
980 |
" |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
981 |
Display supportedImageFormats |
43 | 982 |
" |
983 |
! |
|
984 |
||
823 | 985 |
supportsIconViews |
986 |
"return true, if this device supports views as icons. |
|
987 |
Only Xservers (currently) support this." |
|
988 |
||
989 |
^ true |
|
990 |
||
991 |
" |
|
992 |
Display supportsIconViews |
|
993 |
" |
|
994 |
||
995 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
996 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
997 |
! |
|
998 |
||
81 | 999 |
supportsViewGravity |
1000 |
"return true, if this device supports gravity attributes. |
|
82 | 1001 |
We do not depend on it being implemented, but some resizing operations |
81 | 1002 |
are faster, it is is." |
1003 |
||
1004 |
^ true |
|
0 | 1005 |
! ! |
1006 |
||
1007 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1008 |
||
295 | 1009 |
createBitmapFromArray:anArray width:w height:h |
1010 |
|bitmapId| |
|
1011 |
||
1012 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1013 |
bitmapId isNil ifTrue:[ |
|
1014 |
self primitiveFailed |
|
1015 |
]. |
|
1016 |
^ bitmapId |
|
1017 |
! |
|
1018 |
||
1019 |
createBitmapFromFile:aString for:aForm |
|
1020 |
|id w h| |
|
1021 |
||
1022 |
%{ |
|
1023 |
Display *dpy = myDpy; |
|
555 | 1024 |
int screen = __intVal(__INST(screen)); |
295 | 1025 |
Pixmap newBitmap; |
1026 |
char *filename; |
|
1027 |
unsigned b_width, b_height; |
|
1028 |
int b_x_hot, b_y_hot; |
|
1029 |
int status; |
|
1030 |
||
1031 |
if (ISCONNECTED) { |
|
1032 |
if (__isString(aString) || __isSymbol(aString)) { |
|
1033 |
filename = (char *)_stringVal(aString); |
|
1034 |
||
1035 |
BEGIN_INTERRUPTSBLOCKED |
|
1036 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
|
1037 |
filename, &b_width, &b_height, &newBitmap, |
|
1038 |
&b_x_hot, &b_y_hot); |
|
1039 |
END_INTERRUPTSBLOCKED |
|
1040 |
||
892 | 1041 |
if ((status == BitmapSuccess) && newBitmap) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1042 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1043 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1044 |
#endif |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1045 |
w = __MKSMALLINT(b_width); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1046 |
h = __MKSMALLINT(b_height); |
295 | 1047 |
id = __MKOBJ(newBitmap); |
1048 |
} |
|
1049 |
} |
|
1050 |
} |
|
1051 |
%}. |
|
1052 |
id notNil ifTrue:[ |
|
1053 |
aForm setWidth:w height:h |
|
1054 |
]. |
|
1055 |
^ id |
|
1056 |
! |
|
1057 |
||
1058 |
createBitmapWidth:w height:h |
|
1059 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1060 |
(i.e. random). Return a bitmap id or nil" |
|
1061 |
||
1062 |
%{ /* NOCONTEXT */ |
|
1063 |
||
1064 |
Display *dpy = myDpy; |
|
555 | 1065 |
int screen = __intVal(__INST(screen)); |
295 | 1066 |
Pixmap newBitmap; |
1067 |
||
1068 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1069 |
BEGIN_INTERRUPTSBLOCKED |
|
1070 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
|
555 | 1071 |
__intVal(w), __intVal(h), 1); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1072 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1073 |
if (newBitmap) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1074 |
__cnt_bitmap++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1075 |
#endif |
295 | 1076 |
END_INTERRUPTSBLOCKED |
1077 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil ); |
|
1078 |
} |
|
1079 |
%} |
|
1080 |
. |
|
1081 |
self primitiveFailed. |
|
1082 |
^ nil |
|
1083 |
! |
|
1084 |
||
0 | 1085 |
createPixmapWidth:w height:h depth:d |
1086 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1087 |
(i.e. random). Return a bitmap id or nil" |
|
1088 |
||
1089 |
%{ /* NOCONTEXT */ |
|
1090 |
||
1091 |
Display *dpy = myDpy; |
|
555 | 1092 |
int screen = __intVal(__INST(screen)); |
0 | 1093 |
Pixmap newBitmap; |
1094 |
||
150 | 1095 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
70 | 1096 |
BEGIN_INTERRUPTSBLOCKED |
1097 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
|
555 | 1098 |
__intVal(w), __intVal(h), __intVal(d)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1099 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1100 |
if (newBitmap) |
928 | 1101 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1102 |
#endif |
70 | 1103 |
END_INTERRUPTSBLOCKED |
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1104 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil ); |
0 | 1105 |
} |
1106 |
%} |
|
1107 |
. |
|
43 | 1108 |
self primitiveFailed. |
1109 |
^ nil |
|
0 | 1110 |
! |
1111 |
||
1112 |
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
|
46 | 1113 |
"will vanish - for compatibility with previous versions" |
1114 |
||
1115 |
^ self |
|
850 | 1116 |
createWindowFor:aView |
1117 |
origin:(xpos @ ypos) |
|
1118 |
extent:(wwidth @ wheight) |
|
1119 |
minExtent:(aView minExtent) |
|
1120 |
maxExtent:(aView maxExtent) |
|
1121 |
borderWidth:(aView borderWidth) |
|
1122 |
subViewOf:(aView superView) |
|
1123 |
onTop:(aView isPopUpView) |
|
1124 |
inputOnly:(aView isInputOnly) |
|
1125 |
label:(aView label) |
|
1126 |
cursor:(aView cursor) |
|
1127 |
icon:(aView icon) |
|
1128 |
iconView:(aView iconView) |
|
780
b2f13d436188
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
729
diff
changeset
|
1129 |
|
b2f13d436188
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
729
diff
changeset
|
1130 |
"Modified: 1.6.1996 / 13:22:48 / cg" |
46 | 1131 |
! |
1132 |
||
1133 |
createWindowFor:aView |
|
70 | 1134 |
origin:origin |
1135 |
extent:extent |
|
1136 |
minExtent:minExt |
|
1137 |
maxExtent:maxExt |
|
1138 |
borderWidth:bWidth |
|
1139 |
subViewOf:wsuperView |
|
157 | 1140 |
onTop:wisPopUpView |
70 | 1141 |
inputOnly:winputOnly |
1142 |
label:wlabel |
|
1143 |
cursor:wcursor |
|
1144 |
icon:wicon |
|
1145 |
iconView:wiconView |
|
46 | 1146 |
|
1147 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
|
1148 |
bColorId wsuperViewId wcursorId wiconId windowId |
|
1149 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
|
150 | 1150 |
vBgForm deepForm preferredVisual preferredDepth| |
1151 |
||
1152 |
displayId isNil ifTrue:[ |
|
1153 |
self primitiveFailed. |
|
1154 |
^ nil |
|
1155 |
]. |
|
0 | 1156 |
|
46 | 1157 |
origin notNil ifTrue:[ |
70 | 1158 |
xpos := origin x. |
1159 |
ypos := origin y. |
|
46 | 1160 |
] ifFalse:[ |
70 | 1161 |
xpos := ypos := 0. |
0 | 1162 |
]. |
46 | 1163 |
extent notNil ifTrue:[ |
70 | 1164 |
wwidth := extent x. |
1165 |
wheight := extent y. |
|
46 | 1166 |
] ifFalse:[ |
70 | 1167 |
wwidth := wheight := 100. |
46 | 1168 |
]. |
1169 |
minExt notNil ifTrue:[ |
|
70 | 1170 |
minWidth := minExt x. |
1171 |
minHeight := minExt y |
|
0 | 1172 |
]. |
46 | 1173 |
maxExt notNil ifTrue:[ |
70 | 1174 |
maxWidth := maxExt x. |
1175 |
maxHeight := maxExt y |
|
46 | 1176 |
]. |
1177 |
||
0 | 1178 |
wsuperView notNil ifTrue:[ |
70 | 1179 |
wsuperViewId := wsuperView id |
0 | 1180 |
]. |
1181 |
wcursor isNil ifTrue:[ |
|
145 | 1182 |
'XWORKSTATION: cursor nil - defaulted' errorPrintNL |
0 | 1183 |
] ifFalse:[ |
70 | 1184 |
wcursorId := wcursor id |
0 | 1185 |
]. |
1186 |
||
1187 |
wicon notNil ifTrue:[ |
|
70 | 1188 |
wiconId := wicon id |
0 | 1189 |
]. |
1190 |
wiconView notNil ifTrue:[ |
|
70 | 1191 |
wiconViewId := wiconView id |
0 | 1192 |
]. |
1193 |
weventMask := aView eventMask. |
|
1194 |
||
150 | 1195 |
preferredVisual := aView preferredVisual. |
1196 |
preferredDepth := aView preferredDepth. |
|
23 | 1197 |
|
72 | 1198 |
%{ /* STACK:16000 */ |
0 | 1199 |
Display *dpy = myDpy; |
555 | 1200 |
int screen = __intVal(__INST(screen)); |
0 | 1201 |
Visual visual; |
1202 |
XGCValues xgcv; |
|
1203 |
XSetWindowAttributes xswa; |
|
1204 |
XSizeHints sizehints; |
|
1205 |
XWMHints wmhints; |
|
46 | 1206 |
int bw, bd, bg; |
0 | 1207 |
Window newWindow, parentWindow; |
1208 |
char *windowName; |
|
1209 |
XFontStruct *f; |
|
1210 |
Pixmap backPixmap = (Pixmap)0, iconBitmap = (Pixmap)0; |
|
1211 |
int flags = 0, depth, ioClass; |
|
1212 |
Window iconWindow; |
|
1213 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
1214 |
Atom WmQuitAppAtom; |
|
1215 |
Atom atoms[3]; |
|
1216 |
int atomCount = 0, isTopWindow = 0; |
|
1217 |
||
1218 |
sizehints.flags = 0; |
|
1219 |
sizehints.width = 100; |
|
1220 |
sizehints.height = 100; |
|
1221 |
sizehints.x = 0; |
|
1222 |
sizehints.y = 0; |
|
1223 |
||
97 | 1224 |
if (__bothSmallInteger(wwidth, wheight)) { |
70 | 1225 |
sizehints.flags |= PSize; |
555 | 1226 |
sizehints.width = __intVal(wwidth); |
1227 |
sizehints.height = __intVal(wheight); |
|
0 | 1228 |
} |
97 | 1229 |
if (__bothSmallInteger(xpos, ypos)) { |
70 | 1230 |
sizehints.flags |= PPosition; |
555 | 1231 |
sizehints.x = __intVal(xpos); |
1232 |
sizehints.y = __intVal(ypos); |
|
0 | 1233 |
} |
97 | 1234 |
if (__bothSmallInteger(minWidth, minHeight)) { |
70 | 1235 |
sizehints.flags |= PMinSize; |
555 | 1236 |
sizehints.min_width = __intVal(minWidth); |
1237 |
sizehints.min_height = __intVal(minHeight); |
|
0 | 1238 |
} |
97 | 1239 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
70 | 1240 |
sizehints.flags |= PMaxSize; |
555 | 1241 |
sizehints.max_width = __intVal(maxWidth); |
1242 |
sizehints.max_height = __intVal(maxHeight); |
|
0 | 1243 |
} |
1244 |
||
37 | 1245 |
bg = WhitePixel(dpy, screen); |
0 | 1246 |
|
97 | 1247 |
if (__isSmallInteger(bWidth)) { |
555 | 1248 |
bw = __intVal(bWidth); |
46 | 1249 |
} else { |
70 | 1250 |
bw = 0; |
0 | 1251 |
} |
1252 |
||
72 | 1253 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1254 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1255 |
if (__isExternalAddress(wsuperViewId)) { |
70 | 1256 |
parentWindow = _WindowVal(wsuperViewId); |
0 | 1257 |
} else { |
70 | 1258 |
parentWindow = RootWindow(dpy, screen); |
1259 |
isTopWindow = 1; |
|
0 | 1260 |
} |
1261 |
||
157 | 1262 |
if (wisPopUpView == true) |
70 | 1263 |
xswa.override_redirect = 1; |
0 | 1264 |
else |
70 | 1265 |
xswa.override_redirect = 0; |
0 | 1266 |
|
1267 |
if (winputOnly == true) |
|
70 | 1268 |
ioClass = InputOnly; |
0 | 1269 |
else |
70 | 1270 |
ioClass = InputOutput; |
0 | 1271 |
|
97 | 1272 |
if (__isSmallInteger(weventMask)) { |
555 | 1273 |
xswa.event_mask = __intVal(weventMask); |
0 | 1274 |
} else { |
70 | 1275 |
xswa.event_mask = 0; |
0 | 1276 |
} |
1277 |
||
1278 |
if (ioClass == InputOnly) { |
|
70 | 1279 |
bw = 0; |
1280 |
depth = 0; |
|
1281 |
flags |= CWEventMask; |
|
0 | 1282 |
} else { |
70 | 1283 |
depth = DefaultDepth(dpy,screen); |
1284 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
|
1285 |
||
1286 |
if (backPixmap != (Pixmap)0) { |
|
1287 |
xswa.background_pixmap = backPixmap; |
|
1288 |
flags |= CWBackPixmap; |
|
1289 |
} else { |
|
1290 |
xswa.background_pixel = bg; |
|
1291 |
flags |= CWBackPixel; |
|
1292 |
} |
|
1293 |
xswa.border_pixel = bd; |
|
0 | 1294 |
} |
23 | 1295 |
|
0 | 1296 |
visual.visualid = CopyFromParent; |
150 | 1297 |
if (__isSmallInteger(preferredDepth)) { |
555 | 1298 |
depth = __intVal(preferredDepth); |
23 | 1299 |
} |
54 | 1300 |
|
1301 |
BEGIN_INTERRUPTSBLOCKED |
|
150 | 1302 |
if (preferredVisual != nil) { |
70 | 1303 |
XVisualInfo vi; |
1304 |
int cls; |
|
1305 |
||
150 | 1306 |
if (preferredVisual == @symbol(StaticGray)) |
70 | 1307 |
cls = StaticGray; |
150 | 1308 |
else if (preferredVisual == @symbol(GrayScale)) |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
1309 |
cls = GrayScale; |
150 | 1310 |
else if (preferredVisual == @symbol(StaticColor)) |
70 | 1311 |
cls = StaticColor; |
150 | 1312 |
else if (preferredVisual == @symbol(PseudoColor)) |
70 | 1313 |
cls = PseudoColor; |
150 | 1314 |
else if (preferredVisual == @symbol(TrueColor)) |
70 | 1315 |
cls = TrueColor; |
150 | 1316 |
else if (preferredVisual == @symbol(DirectColor)) |
70 | 1317 |
cls = DirectColor; |
1318 |
else |
|
1319 |
cls = PseudoColor; |
|
200 | 1320 |
|
70 | 1321 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
1322 |
visual.visualid = vi.visualid; |
|
163 | 1323 |
/* |
1324 |
printf("visualId=%x\n", vi.visualid); |
|
1325 |
*/ |
|
70 | 1326 |
} |
23 | 1327 |
} |
0 | 1328 |
|
1329 |
newWindow = XCreateWindow(dpy, parentWindow, |
|
70 | 1330 |
sizehints.x, sizehints.y, |
1331 |
sizehints.width, sizehints.height, |
|
1332 |
bw, depth, ioClass, &visual, |
|
1333 |
flags, &xswa); |
|
54 | 1334 |
END_INTERRUPTSBLOCKED |
0 | 1335 |
|
1336 |
if (! newWindow) { |
|
70 | 1337 |
RETURN ( nil ); |
0 | 1338 |
} |
1339 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1340 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1341 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1342 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1343 |
|
54 | 1344 |
BEGIN_INTERRUPTSBLOCKED |
0 | 1345 |
/* |
1346 |
* define its cursor |
|
1347 |
*/ |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1348 |
if (__isExternalAddress(wcursorId)) { |
70 | 1349 |
XDefineCursor(dpy, newWindow, _CursorVal(wcursorId)); |
0 | 1350 |
} |
1351 |
||
1352 |
/* |
|
1353 |
* define its icon and name |
|
1354 |
* (only makes sense for topWindows) |
|
1355 |
*/ |
|
1356 |
if (isTopWindow) { |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1357 |
if (__isExternalAddress(wiconId)) |
70 | 1358 |
iconBitmap = _PixmapVal(wiconId); |
1359 |
else |
|
1360 |
iconBitmap = (Pixmap)0; |
|
1361 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1362 |
if (__isExternalAddress(wiconViewId)) |
70 | 1363 |
iconWindow = _WindowVal(wiconViewId); |
1364 |
else |
|
1365 |
iconWindow = (Window)0; |
|
1366 |
||
1367 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1368 |
windowName = (char *)_stringVal(wlabel); |
|
1369 |
else |
|
1370 |
windowName = ""; |
|
1371 |
||
1372 |
if (iconBitmap || windowName) { |
|
1373 |
XSetStandardProperties(dpy, newWindow, |
|
1374 |
windowName, windowName, |
|
1375 |
iconBitmap, |
|
1376 |
0, 0, &sizehints); |
|
1377 |
||
1378 |
} |
|
1379 |
||
1380 |
wmhints.flags = 0; |
|
1381 |
if (iconBitmap) { |
|
1382 |
wmhints.flags |= IconPixmapHint; |
|
1383 |
wmhints.icon_pixmap = iconBitmap; |
|
1384 |
} |
|
1385 |
if (iconWindow) { |
|
1386 |
wmhints.flags |= IconWindowHint; |
|
1387 |
wmhints.icon_window = iconWindow; |
|
1388 |
} |
|
0 | 1389 |
/* |
70 | 1390 |
wmhints.flags |= InputHint; |
1391 |
wmhints.input = True; |
|
0 | 1392 |
*/ |
70 | 1393 |
XSetWMHints(dpy, newWindow, &wmhints); |
1394 |
||
1395 |
/* |
|
1396 |
* tell window manager to not kill us but send an event instead |
|
1397 |
*/ |
|
1398 |
/* |
|
1399 |
* get atoms first (if not already known) |
|
1400 |
*/ |
|
555 | 1401 |
if (__INST(protocolsAtom) == nil) { |
70 | 1402 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
555 | 1403 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
0 | 1404 |
#ifdef USE_SAVEYOURSELF_ATOM |
70 | 1405 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
555 | 1406 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
0 | 1407 |
#endif |
1408 |
#ifdef USE_QUIT_APP_ATOM |
|
70 | 1409 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
555 | 1410 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
0 | 1411 |
#endif |
70 | 1412 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
555 | 1413 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
70 | 1414 |
} else { |
0 | 1415 |
#ifdef USE_QUIT_APP_ATOM |
555 | 1416 |
WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); |
0 | 1417 |
#else |
70 | 1418 |
WmQuitAppAtom = 0; |
0 | 1419 |
#endif |
555 | 1420 |
WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); |
1421 |
WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); |
|
0 | 1422 |
#ifdef USE_SAVEYOURSELF_ATOM |
555 | 1423 |
WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); |
0 | 1424 |
#else |
70 | 1425 |
WmSaveYourselfAtom = 0; |
0 | 1426 |
#endif |
70 | 1427 |
} |
1428 |
||
1429 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
|
0 | 1430 |
#ifdef USE_SAVEYOURSELF_ATOM |
70 | 1431 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1432 |
#endif |
1433 |
#ifdef USE_QUIT_APP_ATOM |
|
70 | 1434 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1435 |
#endif |
70 | 1436 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
1437 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
|
0 | 1438 |
} |
1439 |
||
54 | 1440 |
END_INTERRUPTSBLOCKED |
1441 |
||
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1442 |
windowId = __MKOBJ(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1443 |
%}. |
0 | 1444 |
self addKnownView:aView withId:windowId. |
1445 |
^ windowId |
|
1446 |
! |
|
1447 |
||
1448 |
destroyGC:aGCId |
|
1449 |
||
1450 |
%{ /* NOCONTEXT */ |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1451 |
if (__isExternalAddress(aGCId) && ISCONNECTED) { |
366 | 1452 |
GC gc = _GCVal(aGCId); |
1453 |
||
1454 |
if (gc) { |
|
1455 |
BEGIN_INTERRUPTSBLOCKED |
|
1456 |
XFreeGC(myDpy, gc); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1457 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1458 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1459 |
#endif |
366 | 1460 |
END_INTERRUPTSBLOCKED |
1461 |
} |
|
70 | 1462 |
RETURN ( self ); |
0 | 1463 |
} |
118 | 1464 |
%}. |
0 | 1465 |
self primitiveFailed |
1466 |
! |
|
1467 |
||
295 | 1468 |
destroyPixmap:aDrawableId |
0 | 1469 |
|
1470 |
%{ /* NOCONTEXT */ |
|
1471 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1472 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1473 |
Pixmap pix = _PixmapVal(aDrawableId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1474 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1475 |
if (pix) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1476 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1477 |
XFreePixmap(myDpy, pix); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1478 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1479 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1480 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1481 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1482 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1483 |
RETURN ( self ); |
0 | 1484 |
} |
118 | 1485 |
%}. |
295 | 1486 |
self primitiveFailed |
1487 |
! |
|
1488 |
||
1489 |
destroyView:aView withId:aWindowId |
|
1490 |
%{ |
|
1491 |
if (__isExternalAddress(aWindowId) && ISCONNECTED) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1492 |
Window win = _WindowVal(aWindowId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1493 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1494 |
if (win) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1495 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1496 |
XDestroyWindow(myDpy, win); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1497 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1498 |
__cnt_view--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1499 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1500 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1501 |
} |
295 | 1502 |
} |
1503 |
%}. |
|
1504 |
self removeKnownView:aView |
|
0 | 1505 |
! |
1506 |
||
1507 |
dpsContextFor:aDrawableId and:aGCId |
|
1508 |
||
1509 |
%{ /* NOCONTEXT */ |
|
1510 |
#ifdef XXDPS |
|
555 | 1511 |
int screen = __intVal(__INST(screen)); |
0 | 1512 |
DPSContext dps; |
1513 |
int height; |
|
1514 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1515 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1516 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1517 |
&& ISCONNECTED) { |
70 | 1518 |
BEGIN_INTERRUPTSBLOCKED |
1519 |
dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
|
1520 |
_GCVal(aGCId), |
|
1521 |
0, height, 0, colormap, NULL, 0, |
|
1522 |
XDPSDefaultTextBackstop, |
|
1523 |
XDPSDefaultErrorProc, |
|
1524 |
NULL); |
|
1525 |
END_INTERRUPTSBLOCKED |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1526 |
RETURN ( dps ? __MKOBJ(dps) : nil ); |
0 | 1527 |
} |
1528 |
#endif |
|
1529 |
%} |
|
1530 |
. |
|
43 | 1531 |
self primitiveFailed. |
1532 |
^ nil |
|
295 | 1533 |
! |
1534 |
||
1535 |
gcFor:aDrawableId |
|
132 | 1536 |
|
1537 |
%{ /* NOCONTEXT */ |
|
555 | 1538 |
int screen = __intVal(__INST(screen)); |
295 | 1539 |
GC gc; |
1540 |
||
1541 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
1542 |
BEGIN_INTERRUPTSBLOCKED |
|
1543 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
|
1544 |
0L, (XGCValues *)0); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1545 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1546 |
if (gc) |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1547 |
__cnt_gc++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1548 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1549 |
|
295 | 1550 |
END_INTERRUPTSBLOCKED |
1551 |
RETURN ( gc ? __MKOBJ(gc) : nil ); |
|
200 | 1552 |
} |
1553 |
%}. |
|
1554 |
self primitiveFailed. |
|
1555 |
^ nil |
|
295 | 1556 |
! |
1557 |
||
1558 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 1559 |
|
1560 |
%{ /* UNLIMITEDSTACK */ |
|
1561 |
||
295 | 1562 |
Display *dpy = myDpy; |
555 | 1563 |
int screen = __intVal(__INST(screen)); |
295 | 1564 |
Pixmap newBitmap; |
1565 |
unsigned int b_width, b_height; |
|
1566 |
REGISTER unsigned char *cp; |
|
1567 |
REGISTER unsigned char *pBits; |
|
1568 |
unsigned char *b_bits, *allocatedBits; |
|
1569 |
int index, row; |
|
1570 |
REGISTER int col; |
|
1571 |
unsigned bits; |
|
1572 |
static char reverseBitTable[256]; |
|
1573 |
static firstCall = 1; |
|
1574 |
int nBytes; |
|
1575 |
unsigned char fastBits[10000]; |
|
1576 |
OBJ num, *op; |
|
1577 |
int bytesPerRow; |
|
1578 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1579 |
if (! ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1580 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1581 |
} |
295 | 1582 |
if (firstCall) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1583 |
for (index=0; index < 256; index++) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1584 |
reverseBitTable[index] = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1585 |
if (index & 128) reverseBitTable[index] |= 1; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1586 |
if (index & 64) reverseBitTable[index] |= 2; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1587 |
if (index & 32) reverseBitTable[index] |= 4; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1588 |
if (index & 16) reverseBitTable[index] |= 8; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1589 |
if (index & 8) reverseBitTable[index] |= 16; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1590 |
if (index & 4) reverseBitTable[index] |= 32; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1591 |
if (index & 2) reverseBitTable[index] |= 64; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1592 |
if (index & 1) reverseBitTable[index] |= 128; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1593 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1594 |
firstCall = 0; |
295 | 1595 |
} |
1596 |
||
1597 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1598 |
newBitmap = (Pixmap)0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1599 |
b_width = __intVal(w); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1600 |
b_height = __intVal(h); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1601 |
bytesPerRow = (b_width + 7) / 8; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1602 |
nBytes = b_height * bytesPerRow; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1603 |
if (nBytes < sizeof(fastBits)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1604 |
cp = b_bits = fastBits; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1605 |
allocatedBits = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1606 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1607 |
cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1608 |
if (! cp) goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1609 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1610 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1611 |
if (__qClass(anArray) == @global(Array)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1612 |
index = 1; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1613 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1614 |
for (row = b_height; row; row--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1615 |
for (col = bytesPerRow; col; col--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1616 |
num = *op++; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1617 |
if (! __isSmallInteger(num)) goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1618 |
bits = __intVal(num); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1619 |
*cp++ = reverseBitTable[bits]; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1620 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1621 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1622 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1623 |
if (__qClass(anArray) == @global(ByteArray)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1624 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1625 |
for (col = b_height*bytesPerRow; col; col--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1626 |
*cp++ = reverseBitTable[*pBits++]; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1627 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1628 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1629 |
goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1630 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1631 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1632 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1633 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1634 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1635 |
(char *)b_bits, |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1636 |
b_width, b_height); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1637 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1638 |
if (newBitmap) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1639 |
__cnt_bitmap++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1640 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1641 |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1642 |
END_INTERRUPTSBLOCKED |
295 | 1643 |
fail: ; |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1644 |
if (allocatedBits) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1645 |
free(allocatedBits); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1646 |
RETURN ( newBitmap ? __MKOBJ(newBitmap) : nil ); |
0 | 1647 |
} |
1648 |
%} |
|
295 | 1649 |
! |
1650 |
||
1651 |
realRootWindowFor:aView |
|
1652 |
"the name of this method is historic; |
|
1653 |
- it will vanish" |
|
1654 |
||
1655 |
|id| |
|
1656 |
||
1657 |
id := self realRootWindowId. |
|
1658 |
self addKnownView:aView withId:id. |
|
1659 |
^ id |
|
1660 |
! |
|
1661 |
||
1662 |
realRootWindowId |
|
1663 |
"return the id of the real root window. |
|
1664 |
This may not be the window you see as background, |
|
1665 |
since some window managers install a virtual root window on top |
|
1666 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
1667 |
care of any virtual root." |
|
0 | 1668 |
|
1669 |
%{ /* NOCONTEXT */ |
|
1670 |
||
555 | 1671 |
int screen = __intVal(__INST(screen)); |
295 | 1672 |
Window root; |
1673 |
OBJ id; |
|
1674 |
||
555 | 1675 |
if (__INST(rootId) != nil) { |
1676 |
RETURN (__INST(rootId)); |
|
295 | 1677 |
} |
0 | 1678 |
|
150 | 1679 |
if (ISCONNECTED) { |
295 | 1680 |
root = RootWindow(myDpy, screen); |
1681 |
if (! root) { |
|
1682 |
id = nil; |
|
1683 |
} else { |
|
555 | 1684 |
__INST(rootId) = id = __MKOBJ(root); __STORE(self, id); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1685 |
} |
295 | 1686 |
RETURN (id); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1687 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1688 |
%}. |
295 | 1689 |
self primitiveFailed |
1690 |
! |
|
1691 |
||
1692 |
rootWindowFor:aView |
|
1693 |
|id| |
|
1694 |
||
1695 |
id := self rootWindowId. |
|
1696 |
self addKnownView:aView withId:id. |
|
0 | 1697 |
^ id |
1698 |
! |
|
1699 |
||
295 | 1700 |
rootWindowId |
1701 |
"return the id of the root window. |
|
1702 |
This is the window you see as background, |
|
1703 |
however, it may or may not be the real physical root window, |
|
1704 |
since some window managers install a virtual root window on top |
|
1705 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 1706 |
|
0 | 1707 |
%{ /* NOCONTEXT */ |
555 | 1708 |
int screen = __intVal(__INST(screen)); |
295 | 1709 |
Window rootWin, vRootWin; |
1710 |
OBJ id; |
|
1711 |
||
555 | 1712 |
if (__INST(virtualRootId) != nil) { |
1713 |
RETURN (__INST(virtualRootId)); |
|
295 | 1714 |
} |
0 | 1715 |
|
169 | 1716 |
if (ISCONNECTED) { |
295 | 1717 |
vRootWin = rootWin = RootWindow(myDpy, screen); |
1718 |
#ifndef IRIS |
|
180 | 1719 |
BEGIN_INTERRUPTSBLOCKED |
295 | 1720 |
/* |
1721 |
* on IRIS, this creates a badwindow error - why ? |
|
1722 |
* children contains a funny window (000034) |
|
1723 |
*/ |
|
1724 |
||
1725 |
/* |
|
1726 |
* care for virtual root windows (tvtwm & friends) |
|
1727 |
*/ |
|
1728 |
{ |
|
1729 |
Atom vRootAtom = None; |
|
1730 |
int i; |
|
1731 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
1732 |
Window* children = (Window *)0; |
295 | 1733 |
unsigned int numChildren; |
1734 |
||
1735 |
if (XQueryTree(myDpy, rootWin, |
|
1736 |
&rootReturn, &parentReturn, |
|
1737 |
&children, &numChildren)) { |
|
1738 |
vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True ); |
|
1739 |
if (vRootAtom != None) { |
|
1740 |
for (i=0; i < numChildren; i++) { |
|
1741 |
Atom actual_type; |
|
1742 |
int actual_format; |
|
1743 |
unsigned long nitems, bytesafter; |
|
1744 |
Window* newRoot = (Window*) 0; |
|
1745 |
||
1746 |
if (children[i]) { |
|
1747 |
if (XGetWindowProperty(myDpy, children[i], vRootAtom, |
|
1748 |
0L, 1L, False, XA_WINDOW, |
|
1749 |
&actual_type, &actual_format, |
|
1750 |
&nitems, &bytesafter, |
|
1751 |
(unsigned char**) &newRoot |
|
1752 |
) == Success && newRoot) { |
|
1753 |
vRootWin = *newRoot; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1754 |
XFree(newRoot); /* XXX */ |
295 | 1755 |
break; |
1756 |
} |
|
1757 |
} |
|
1758 |
} |
|
1759 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
1760 |
if (children) XFree( children ); |
295 | 1761 |
} |
1762 |
} |
|
180 | 1763 |
END_INTERRUPTSBLOCKED |
295 | 1764 |
#endif |
1765 |
} |
|
1766 |
||
1767 |
/* cannot happen */ |
|
1768 |
if (! vRootWin) { |
|
1769 |
vRootWin = rootWin; |
|
1770 |
if (! rootWin) { |
|
1771 |
RETURN ( nil ); |
|
1772 |
} |
|
1773 |
} |
|
555 | 1774 |
__INST(rootId) = id = __MKOBJ(rootWin); __STORE(self, id); |
1775 |
__INST(virtualRootId) = id = __MKOBJ(vRootWin); __STORE(self, id); |
|
295 | 1776 |
RETURN ( id ); |
63 | 1777 |
%} |
0 | 1778 |
! ! |
1779 |
||
1780 |
!XWorkstation methodsFor:'color stuff'! |
|
1781 |
||
295 | 1782 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1783 |
"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
|
1784 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 1785 |
|
1786 |
%{ /* NOCONTEXT */ |
|
1787 |
||
1788 |
Display *dpy = myDpy; |
|
555 | 1789 |
int screen = __intVal(__INST(screen)); |
295 | 1790 |
XColor color; |
1791 |
unsigned long dummy; |
|
1792 |
Status ok; |
|
1793 |
||
1794 |
BEGIN_INTERRUPTSBLOCKED |
|
1795 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
|
1796 |
&dummy, 0, &color.pixel, 1); |
|
1797 |
END_INTERRUPTSBLOCKED |
|
1798 |
if (ok) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1799 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1800 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1801 |
#endif |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1802 |
RETURN ( __MKSMALLINT(color.pixel) ); |
0 | 1803 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1804 |
%}. |
43 | 1805 |
^ nil |
0 | 1806 |
! |
1807 |
||
1808 |
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
|
1809 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 1810 |
Dont use this method, colornames are mostly X specific" |
1811 |
||
1812 |
%{ /* NOCONTEXT */ |
|
1813 |
||
1814 |
char *colorname; |
|
1815 |
Display *dpy = myDpy; |
|
1816 |
XColor scolor, ecolor; |
|
555 | 1817 |
int screen = __intVal(__INST(screen)); |
850 | 1818 |
int id; |
54 | 1819 |
Status ok; |
0 | 1820 |
|
150 | 1821 |
if (ISCONNECTED) { |
850 | 1822 |
if (__isString(aString) || __isSymbol(aString)) { |
1823 |
colorname = (char *)_stringVal(aString); |
|
1824 |
||
1825 |
BEGIN_INTERRUPTSBLOCKED |
|
1826 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
|
1827 |
if (ok) { |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
1828 |
#ifdef QUICK_TRUE_COLORS |
850 | 1829 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1830 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
1831 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
1832 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
1833 |
RETURN ( __MKSMALLINT(id) ); |
|
1834 |
} |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
1835 |
#endif |
850 | 1836 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
1837 |
} |
|
1838 |
END_INTERRUPTSBLOCKED |
|
1839 |
if (! ok) { |
|
1840 |
RETURN ( nil ); |
|
1841 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1842 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1843 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1844 |
#endif |
850 | 1845 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
1846 |
} |
|
0 | 1847 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1848 |
%}. |
43 | 1849 |
self primitiveFailed. |
1850 |
^ nil |
|
0 | 1851 |
! |
1852 |
||
295 | 1853 |
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
|
1854 |
"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
|
1855 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
295 | 1856 |
|
1857 |
|r g b| |
|
1858 |
||
1859 |
r := self percentToXColorValue:redVal. |
|
1860 |
g := self percentToXColorValue:greenVal. |
|
1861 |
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
|
1862 |
^ 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
|
1863 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1864 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1865 |
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
|
1866 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
295 | 1867 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1868 |
Display *dpy; |
295 | 1869 |
XColor ecolor; |
555 | 1870 |
int screen = __intVal(__INST(screen)); |
295 | 1871 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1872 |
int id; |
295 | 1873 |
|
1874 |
if (__bothSmallInteger(r, g) |
|
1875 |
&& __isSmallInteger(b) |
|
1876 |
&& ISCONNECTED) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1877 |
ecolor.red = __intVal(r); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1878 |
ecolor.green= __intVal(g); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1879 |
ecolor.blue = __intVal(b); |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1880 |
#ifdef QUICK_TRUE_COLORS |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1881 |
if (__INST(visualType) == @symbol(TrueColor)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1882 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1883 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1884 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1885 |
RETURN ( __MKSMALLINT(id) ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1886 |
} |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1887 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1888 |
dpy = myDpy; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1889 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1890 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1891 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1892 |
if (! ok) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1893 |
RETURN ( nil ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1894 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1895 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1896 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1897 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1898 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
295 | 1899 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1900 |
%}. |
295 | 1901 |
self primitiveFailed. |
1902 |
^ nil |
|
1903 |
! |
|
1904 |
||
1905 |
freeColor:colorIndex |
|
1906 |
"free a display color when its no longer needed" |
|
0 | 1907 |
|
1908 |
%{ /* NOCONTEXT */ |
|
1909 |
||
1910 |
Display *dpy = myDpy; |
|
295 | 1911 |
unsigned long color; |
555 | 1912 |
int screen = __intVal(__INST(screen)); |
295 | 1913 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1914 |
#ifdef QUICK_TRUE_COLORS |
555 | 1915 |
if (__INST(visualType) == @symbol(TrueColor)) { |
850 | 1916 |
/* no need to do anything on TrueColor displays ... */ |
1917 |
RETURN (self); |
|
295 | 1918 |
} |
1919 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1920 |
|
295 | 1921 |
if (__isSmallInteger(colorIndex) && ISCONNECTED) { |
850 | 1922 |
color = (long) __intVal(colorIndex); |
1923 |
BEGIN_INTERRUPTSBLOCKED |
|
1924 |
XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1925 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1926 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1927 |
#endif |
850 | 1928 |
END_INTERRUPTSBLOCKED |
1929 |
RETURN ( self ); |
|
0 | 1930 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1931 |
%}. |
295 | 1932 |
self primitiveFailed |
1933 |
! |
|
1934 |
||
1935 |
getRGBFrom:index into:aBlock |
|
1936 |
"get rgb components (0..100) of color in map at:index, |
|
1937 |
and evaluate the 3-arg block, aBlock with them" |
|
1938 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1939 |
|val| |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1940 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1941 |
self getScaledRGBFrom:index into:[:r :g :b | |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1942 |
val := aBlock |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1943 |
value:(r * 100.0 / 16rFFFF) |
850 | 1944 |
value:(g * 100.0 / 16rFFFF) |
1945 |
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
|
1946 |
]. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1947 |
^ val |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1948 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1949 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1950 |
getRGBFromName:colorName into:aBlock |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1951 |
"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
|
1952 |
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
|
1953 |
|val| |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1954 |
|
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1955 |
self getScaledRGBFromName:colorName into:[:r :g :b | |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1956 |
r isNil ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1957 |
^ super getRGBFromName:colorName into:aBlock |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1958 |
]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1959 |
val := aBlock |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1960 |
value:(r * 100.0 / 16rFFFF) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1961 |
value:(g * 100.0 / 16rFFFF) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1962 |
value:(b * 100.0 / 16rFFFF) |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1963 |
]. |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1964 |
^ val |
1056 | 1965 |
|
1966 |
"Modified: 16.9.1996 / 17:27:42 / cg" |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1967 |
! |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1968 |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1969 |
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
|
1970 |
"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
|
1971 |
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
|
1972 |
|
295 | 1973 |
|r g b| |
1974 |
%{ |
|
1975 |
Display *dpy = myDpy; |
|
555 | 1976 |
int screen = __intVal(__INST(screen)); |
295 | 1977 |
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
|
1978 |
int sr, sg, sb; |
295 | 1979 |
int bits, scale, shift; |
1980 |
||
1981 |
if (__isSmallInteger(index)) { |
|
555 | 1982 |
color.pixel = __intVal(index); |
295 | 1983 |
BEGIN_INTERRUPTSBLOCKED |
1984 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
|
1985 |
END_INTERRUPTSBLOCKED |
|
1986 |
||
1987 |
/* |
|
1988 |
* have to compensate for an error in X ?, which does not scale |
|
1989 |
* colors correctly if lesser than 16bits are valid in a color, |
|
1990 |
* (for example, color white on a 4bitsPerRGB server will return |
|
1991 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
|
1992 |
*/ |
|
555 | 1993 |
bits = __intVal(__INST(bitsPerRGB)); |
295 | 1994 |
scale = (1<<bits) - 1; |
1995 |
shift = 16 - bits; |
|
1996 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1997 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1998 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1999 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2000 |
r = __MKSMALLINT(sr); |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2001 |
g = __MKSMALLINT(sg); |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2002 |
b = __MKSMALLINT(sb); |
295 | 2003 |
} |
2004 |
%}. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2005 |
^ aBlock value:r value:g value:b |
295 | 2006 |
! |
2007 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2008 |
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
|
2009 |
"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
|
2010 |
and evaluate the 3-arg block, aBlock with them" |
295 | 2011 |
|
2012 |
|r g b| |
|
2013 |
||
2014 |
displayId isNil ifTrue:[ |
|
2015 |
self pimitiveFailed. |
|
2016 |
^ nil |
|
2017 |
]. |
|
2018 |
%{ |
|
2019 |
Display *dpy = myDpy; |
|
555 | 2020 |
int screen = __intVal(__INST(screen)); |
295 | 2021 |
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
|
2022 |
int sr, sg, sb; |
295 | 2023 |
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
|
2024 |
int bits, scale, shift; |
295 | 2025 |
|
2026 |
if (__isString(colorName) || __isSymbol(colorName)) { |
|
2027 |
BEGIN_INTERRUPTSBLOCKED |
|
2028 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
|
2029 |
(char *)_stringVal(colorName), &color)) { |
|
2030 |
/* |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2031 |
* have to compensate for an error in X ?, which does not scale |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2032 |
* colors correctly if lesser than 16bits are valid in a color, |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2033 |
* (for example, color white on a 4bitsPerRGB server will return |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2034 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
295 | 2035 |
*/ |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2036 |
bits = __intVal(__INST(bitsPerRGB)); |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2037 |
scale = (1<<bits) - 1; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2038 |
shift = 16 - bits; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2039 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2040 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2041 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2042 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2043 |
r = __MKSMALLINT(sr); |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2044 |
g = __MKSMALLINT(sg); |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2045 |
b = __MKSMALLINT(sb); |
295 | 2046 |
} |
2047 |
END_INTERRUPTSBLOCKED |
|
2048 |
} |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2049 |
%}. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2050 |
^ aBlock value:r value:g value:b |
295 | 2051 |
! |
2052 |
||
2053 |
listOfAvailableColors |
|
2054 |
"return a list of all available colornames. |
|
2055 |
This should not be used, since colornames are very |
|
2056 |
display-specific (here X-specific)." |
|
2057 |
||
2058 |
|aStream list line index colorName| |
|
2059 |
||
2060 |
aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'. |
|
2061 |
aStream isNil ifTrue:[^ nil]. |
|
2062 |
list := OrderedCollection new. |
|
2063 |
[aStream atEnd] whileFalse:[ |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2064 |
line := aStream nextLine. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2065 |
line notNil ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2066 |
"skip the r/g/b numbers" |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2067 |
index := 1. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2068 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2069 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2070 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2071 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2072 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2073 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2074 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2075 |
colorName := line copyFrom:index. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2076 |
((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2077 |
list add:colorName |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2078 |
] |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2079 |
] |
295 | 2080 |
]. |
2081 |
aStream close. |
|
2082 |
^ list sort |
|
1047 | 2083 |
|
2084 |
" |
|
2085 |
Screen current listOfAvailableColors |
|
2086 |
" |
|
2087 |
||
2088 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2089 |
! |
2090 |
||
2091 |
percentToXColorValue:aPercentage |
|
2092 |
"given a color-component value in percent (0..100), return the corresponding |
|
2093 |
x-component value (0..65k) as an integer" |
|
2094 |
||
2095 |
%{ /* NOCONTEXT */ |
|
2096 |
||
2097 |
if (__isSmallInteger(aPercentage)) { |
|
555 | 2098 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2099 |
} |
2100 |
if (__isFloat(aPercentage)) { |
|
555 | 2101 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2102 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2103 |
%}. |
295 | 2104 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2105 |
! |
2106 |
||
892 | 2107 |
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
|
2108 |
"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
|
2109 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2110 |
|
2111 |
%{ /* NOCONTEXT */ |
|
2112 |
||
2113 |
char *colorname; |
|
2114 |
Display *dpy = myDpy; |
|
2115 |
XColor color; |
|
555 | 2116 |
int screen = __intVal(__INST(screen)); |
0 | 2117 |
int r, g, b; |
2118 |
int ok = 1; |
|
2119 |
||
892 | 2120 |
if (__isSmallInteger(sred)) |
2121 |
r = __intVal(sred); |
|
0 | 2122 |
else ok = 0; |
2123 |
||
892 | 2124 |
if (__isSmallInteger(sgreen)) |
2125 |
g = __intVal(sgreen); |
|
0 | 2126 |
else ok = 0; |
2127 |
||
892 | 2128 |
if (__isSmallInteger(sblue)) |
2129 |
b = __intVal(sblue); |
|
0 | 2130 |
else ok = 0; |
2131 |
||
97 | 2132 |
if (__isSmallInteger(index) && ok) { |
555 | 2133 |
color.pixel = __intVal(index); |
70 | 2134 |
color.red = r; |
2135 |
color.green = g; |
|
2136 |
color.blue = b; |
|
2137 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2138 |
||
2139 |
BEGIN_INTERRUPTSBLOCKED |
|
2140 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
|
2141 |
END_INTERRUPTSBLOCKED |
|
2142 |
RETURN ( self ); |
|
0 | 2143 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2144 |
%}. |
0 | 2145 |
self primitiveFailed |
295 | 2146 |
! ! |
2147 |
||
2148 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2149 |
||
2150 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
|
2151 |
"change a cursors colors" |
|
2152 |
||
2153 |
|fgR fgG fgB bgR bgG bgB| |
|
2154 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2155 |
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
|
2156 |
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
|
2157 |
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
|
2158 |
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
|
2159 |
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
|
2160 |
bgB := bgColor scaledBlue. |
0 | 2161 |
%{ |
295 | 2162 |
XColor fgcolor, bgcolor; |
2163 |
||
2164 |
if (__isExternalAddress(aCursorId) |
|
2165 |
&& __bothSmallInteger(fgG, fgB) |
|
2166 |
&& __bothSmallInteger(bgR, bgG) |
|
2167 |
&& __bothSmallInteger(bgB, fgR)) { |
|
2168 |
||
555 | 2169 |
fgcolor.red = __intVal(fgR); |
2170 |
fgcolor.green= __intVal(fgG); |
|
2171 |
fgcolor.blue = __intVal(fgB); |
|
2172 |
bgcolor.red = __intVal(bgR); |
|
2173 |
bgcolor.green= __intVal(bgG); |
|
2174 |
bgcolor.blue = __intVal(bgB); |
|
70 | 2175 |
BEGIN_INTERRUPTSBLOCKED |
295 | 2176 |
XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); |
72 | 2177 |
END_INTERRUPTSBLOCKED |
2178 |
RETURN ( self ); |
|
2179 |
} |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2180 |
%}. |
0 | 2181 |
self primitiveFailed |
70 | 2182 |
! |
2183 |
||
295 | 2184 |
createCursorShape:aShape |
974 | 2185 |
"create a cursor given a shape-symbol. This only works |
2186 |
for a few standard cursors, and returns nil if no such cursor exists. |
|
2187 |
Always care for a fallBack, in case of a nil return." |
|
295 | 2188 |
|
2189 |
|number id| |
|
2190 |
||
2191 |
displayId isNil ifTrue:[ |
|
2192 |
self primitiveFailed. |
|
2193 |
^ nil |
|
2194 |
]. |
|
2195 |
number := self shapeNumberFromSymbol:aShape. |
|
2196 |
%{ |
|
2197 |
Cursor newCursor; |
|
2198 |
||
2199 |
if (__isSmallInteger(number)) { |
|
2200 |
BEGIN_INTERRUPTSBLOCKED |
|
555 | 2201 |
newCursor = XCreateFontCursor(myDpy, __intVal(number)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2202 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2203 |
if (newCursor) |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2204 |
__cnt_cursor++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2205 |
#endif |
295 | 2206 |
END_INTERRUPTSBLOCKED |
2207 |
if (newCursor != (Cursor)0) { |
|
2208 |
id = __MKOBJ(newCursor); |
|
70 | 2209 |
} |
0 | 2210 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2211 |
%}. |
295 | 2212 |
^ id |
2213 |
! |
|
2214 |
||
974 | 2215 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2216 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2217 |
||
2218 |
|id sourceId maskId| |
|
2219 |
||
2220 |
displayId isNil ifTrue:[ |
|
2221 |
self primitiveFailed. |
|
2222 |
^ nil |
|
2223 |
]. |
|
2224 |
sourceId := sourceForm id. |
|
2225 |
maskId := maskForm id. |
|
2226 |
%{ |
|
2227 |
Cursor newCursor; |
|
2228 |
XColor fgColor, bgColor; |
|
2229 |
||
2230 |
if (__isExternalAddress(sourceId) |
|
2231 |
&& __isExternalAddress(maskId) |
|
2232 |
&& __bothSmallInteger(hx, hy)) { |
|
2233 |
fgColor.red = 0; /* fg is black */ |
|
2234 |
fgColor.green = 0; |
|
2235 |
fgColor.blue = 0; |
|
2236 |
bgColor.red = 0xFFFF; /* bg is white */ |
|
2237 |
bgColor.green = 0xFFFF; |
|
2238 |
bgColor.blue = 0xFFFF; |
|
2239 |
||
2240 |
BEGIN_INTERRUPTSBLOCKED |
|
2241 |
newCursor = XCreatePixmapCursor(myDpy, |
|
2242 |
_PixmapVal(sourceId), |
|
2243 |
_PixmapVal(maskId), |
|
555 | 2244 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2245 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2246 |
if (newCursor) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2247 |
__cnt_cursor++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2248 |
#endif |
295 | 2249 |
END_INTERRUPTSBLOCKED |
2250 |
if (newCursor != (Cursor)0) { |
|
2251 |
id = __MKOBJ(newCursor); |
|
70 | 2252 |
} |
0 | 2253 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2254 |
%}. |
295 | 2255 |
^ id |
2256 |
! |
|
2257 |
||
2258 |
destroyCursor:aCursorId |
|
974 | 2259 |
"release a cursor - frees any device resources" |
0 | 2260 |
|
2261 |
%{ /* NOCONTEXT */ |
|
2262 |
||
295 | 2263 |
if (ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2264 |
if (__isExternalAddress(aCursorId)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2265 |
Cursor curs = _CursorVal(aCursorId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2266 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2267 |
if (curs) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2268 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2269 |
XFreeCursor(myDpy, curs); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2270 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2271 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2272 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2273 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2274 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2275 |
RETURN ( self ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2276 |
} |
0 | 2277 |
} |
974 | 2278 |
%}. |
0 | 2279 |
self primitiveFailed |
295 | 2280 |
! |
2281 |
||
974 | 2282 |
needDeviceFormsForCursor |
2283 |
^ true |
|
2284 |
! |
|
2285 |
||
295 | 2286 |
shapeNumberFromSymbol:shape |
974 | 2287 |
"given a shape-symbol, return the corresponding cursor-number, |
2288 |
or nil if no such standard cursor exists." |
|
295 | 2289 |
|
2290 |
"this is pure X-knowlegde - but you may easily add more" |
|
2291 |
||
2292 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2293 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2294 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2295 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2296 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2297 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2298 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2299 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2300 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2301 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2302 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2303 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2304 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2305 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2306 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2307 |
((shape == #origin) |
|
2308 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2309 |
((shape == #corner) |
|
2310 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2311 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2312 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2313 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2314 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2315 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
974 | 2316 |
"/ ('XWORKSTATION: invalid cursorShape:' , shape printString) infoPrintNL. |
2317 |
^ nil |
|
0 | 2318 |
! ! |
2319 |
||
2320 |
!XWorkstation methodsFor:'drawing'! |
|
2321 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2322 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2323 |
"do a bit-blt; copy bits from the rectangle defined by |
2324 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2325 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2326 |
argument is not integer." |
|
0 | 2327 |
|
2328 |
%{ /* NOCONTEXT */ |
|
2329 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2330 |
GC gc; |
0 | 2331 |
Drawable source, dest; |
2332 |
||
975 | 2333 |
if (__isExternalAddress(dstGCId) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2334 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2335 |
&& __isExternalAddress(destId) |
97 | 2336 |
&& __bothSmallInteger(w, h) |
2337 |
&& __bothSmallInteger(srcX, srcY) |
|
2338 |
&& __bothSmallInteger(dstX, dstY)) { |
|
975 | 2339 |
gc = _GCVal(dstGCId); |
70 | 2340 |
source = (Drawable) _WindowVal(sourceId); |
2341 |
dest = (Drawable) _WindowVal(destId); |
|
2342 |
XCopyArea(myDpy, source, dest, gc, |
|
555 | 2343 |
__intVal(srcX), __intVal(srcY), |
2344 |
__intVal(w), __intVal(h), |
|
2345 |
__intVal(dstX), __intVal(dstY)); |
|
70 | 2346 |
RETURN ( self ); |
0 | 2347 |
} |
118 | 2348 |
%}. |
2349 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2350 |
or any non integer coordinate" |
|
2351 |
||
0 | 2352 |
self primitiveFailed |
2353 |
! |
|
2354 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2355 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2356 |
"do a bit-blt, but only copy the low-bit plane; |
2357 |
copy bits from the rectangle defined by |
|
2358 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2359 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2360 |
argument is not integer." |
|
0 | 2361 |
|
2362 |
%{ /* NOCONTEXT */ |
|
2363 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2364 |
GC gc; |
0 | 2365 |
Drawable source, dest; |
2366 |
||
975 | 2367 |
if (__isExternalAddress(dstGCId) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2368 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2369 |
&& __isExternalAddress(destId) |
97 | 2370 |
&& __bothSmallInteger(w, h) |
2371 |
&& __bothSmallInteger(srcX, srcY) |
|
2372 |
&& __bothSmallInteger(dstX, dstY)) { |
|
975 | 2373 |
gc = _GCVal(dstGCId); |
70 | 2374 |
source = (Drawable) _WindowVal(sourceId); |
2375 |
dest = (Drawable) _WindowVal(destId); |
|
2376 |
XCopyPlane(myDpy, source, dest, gc, |
|
555 | 2377 |
__intVal(srcX), __intVal(srcY), |
2378 |
__intVal(w), __intVal(h), |
|
2379 |
__intVal(dstX), __intVal(dstY), 1); |
|
70 | 2380 |
RETURN ( self ); |
0 | 2381 |
} |
118 | 2382 |
%}. |
2383 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2384 |
or any non integer coordinate" |
|
2385 |
||
0 | 2386 |
self primitiveFailed |
2387 |
! |
|
2388 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2389 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 2390 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
2391 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2392 |
|
2393 |
%{ /* NOCONTEXT */ |
|
2394 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2395 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2396 |
Window win; |
0 | 2397 |
int w, h, angle1, angle2; |
2398 |
double f; |
|
2399 |
||
97 | 2400 |
if (__isSmallInteger(startAngle)) |
850 | 2401 |
angle1 = __intVal(startAngle) * 64; |
36 | 2402 |
else if (__isFloat(startAngle)) { |
850 | 2403 |
f = __floatVal(startAngle); |
2404 |
angle1 = f * 64; |
|
0 | 2405 |
} |
97 | 2406 |
if (__isSmallInteger(angle)) |
850 | 2407 |
angle2 = __intVal(angle) * 64; |
36 | 2408 |
else if (__isFloat(angle)) { |
850 | 2409 |
f = __floatVal(angle); |
2410 |
angle2 = f * 64; |
|
0 | 2411 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2412 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2413 |
&& __isExternalAddress(aDrawableId) |
97 | 2414 |
&& __bothSmallInteger(x, y) |
2415 |
&& __bothSmallInteger(width, height)) { |
|
850 | 2416 |
win = _WindowVal(aDrawableId); |
2417 |
gc = _GCVal(aGCId); |
|
2418 |
w = __intVal(width); |
|
2419 |
h = __intVal(height); |
|
2420 |
/* |
|
2421 |
* need this check here: some servers simply dump core with bad args |
|
2422 |
*/ |
|
2423 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2424 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
|
2425 |
w, h, angle1, angle2); |
|
2426 |
} |
|
2427 |
RETURN ( self ); |
|
0 | 2428 |
} |
73 | 2429 |
%}. |
2430 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2431 |
self primitiveFailed |
2432 |
! |
|
2433 |
||
295 | 2434 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
2435 |
"draw a line. If the coordinates are not integers, an error is triggered." |
|
2436 |
||
2437 |
%{ /* NOCONTEXT */ |
|
2438 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2439 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2440 |
Window win; |
295 | 2441 |
|
2442 |
if (__isExternalAddress(aGCId) |
|
2443 |
&& __isExternalAddress(aDrawableId) |
|
2444 |
&& __bothSmallInteger(x0, y0) |
|
2445 |
&& __bothSmallInteger(x1, y1)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2446 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2447 |
win = _WindowVal(aDrawableId); |
555 | 2448 |
XDrawLine(myDpy, win, gc, __intVal(x0), __intVal(y0), |
2449 |
__intVal(x1), __intVal(y1)); |
|
295 | 2450 |
RETURN ( self ); |
2451 |
} |
|
2452 |
%}. |
|
2453 |
"badGC, badDrawable or coordinates not integer" |
|
2454 |
self primitiveFailed |
|
2455 |
! |
|
2456 |
||
2457 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
2458 |
"draw a point. If x/y are not integers, an error is triggered." |
|
2459 |
||
2460 |
%{ /* NOCONTEXT */ |
|
2461 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2462 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2463 |
Window win; |
295 | 2464 |
|
2465 |
if (__isExternalAddress(aGCId) |
|
2466 |
&& __isExternalAddress(aDrawableId) |
|
2467 |
&& __bothSmallInteger(x, y)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2468 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2469 |
win = _WindowVal(aDrawableId); |
555 | 2470 |
XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); |
295 | 2471 |
RETURN ( self ); |
2472 |
} |
|
2473 |
%}. |
|
2474 |
"badGC, badDrawable or x/y not integer" |
|
2475 |
self primitiveFailed |
|
2476 |
! |
|
2477 |
||
2478 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
2479 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
2480 |
define the polygon. |
|
2481 |
If any coordinate is not integer, an error is triggered." |
|
2482 |
||
2483 |
|numberOfPoints newPoints| |
|
2484 |
||
2485 |
numberOfPoints := aPolygon size. |
|
2486 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2487 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2488 |
Window win; |
295 | 2489 |
OBJ point, x, y; |
2490 |
int i, num; |
|
2491 |
XPoint *points; |
|
2492 |
XPoint qPoints[100]; |
|
377 | 2493 |
int mustFree = 0; |
295 | 2494 |
|
2495 |
if (__isExternalAddress(aGCId) |
|
2496 |
&& __isExternalAddress(aDrawableId) |
|
2497 |
&& __isSmallInteger(numberOfPoints)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2498 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2499 |
win = _WindowVal(aDrawableId); |
555 | 2500 |
num = __intVal(numberOfPoints); |
295 | 2501 |
/* |
2502 |
* avoid a (slow) malloc, if the number of points is small |
|
2503 |
*/ |
|
2504 |
if (num > 100) { |
|
2505 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
|
2506 |
if (! points) goto fail; |
|
377 | 2507 |
mustFree = 1; |
295 | 2508 |
} else |
2509 |
points = qPoints; |
|
2510 |
||
2511 |
for (i=0; i<num; i++) { |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
2512 |
point = __AT_(aPolygon COMMA_CON, __MKSMALLINT(i+1)); |
295 | 2513 |
if (! __isPoint(point)) goto fail; |
2514 |
x = _point_X(point); |
|
2515 |
y = _point_Y(point); |
|
2516 |
if (! __bothSmallInteger(x, y)) |
|
2517 |
goto fail; |
|
555 | 2518 |
points[i].x = __intVal(x); |
2519 |
points[i].y = __intVal(y); |
|
295 | 2520 |
} |
2521 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
|
377 | 2522 |
if (mustFree) |
295 | 2523 |
free(points); |
2524 |
RETURN ( self ); |
|
2525 |
} |
|
2526 |
fail: ; |
|
377 | 2527 |
if (mustFree) |
382 | 2528 |
free(points); |
295 | 2529 |
%}. |
2530 |
"badGC, badDrawable or coordinates not integer" |
|
2531 |
self primitiveFailed |
|
2532 |
! |
|
2533 |
||
2534 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
2535 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
|
2536 |
||
2537 |
%{ /* NOCONTEXT */ |
|
2538 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2539 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2540 |
Window win; |
295 | 2541 |
int w, h; |
2542 |
||
2543 |
if (__isExternalAddress(aGCId) |
|
2544 |
&& __isExternalAddress(aDrawableId) |
|
2545 |
&& __bothSmallInteger(x, y) |
|
2546 |
&& __bothSmallInteger(width, height)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2547 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2548 |
win = _WindowVal(aDrawableId); |
555 | 2549 |
w = __intVal(width); |
2550 |
h = __intVal(height); |
|
295 | 2551 |
/* |
2552 |
* need this check here: some servers simply dump core with bad args |
|
2553 |
*/ |
|
2554 |
if ((w >= 0) && (h >= 0)) { |
|
555 | 2555 |
XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h); |
295 | 2556 |
} |
2557 |
RETURN ( self ); |
|
2558 |
} |
|
2559 |
%}. |
|
2560 |
"badGC, badDrawable or coordinates not integer" |
|
2561 |
self primitiveFailed |
|
2562 |
! |
|
2563 |
||
2564 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2565 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
|
2566 |
foreground and background characters. |
|
2567 |
If the coordinates are not integers, an error is triggered." |
|
2568 |
||
2569 |
%{ /* NOCONTEXT */ |
|
2570 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2571 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2572 |
Window win; |
295 | 2573 |
unsigned char *cp; |
2574 |
OBJ cls; |
|
2575 |
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
|
2576 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2577 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2578 |
int nInstBytes; |
295 | 2579 |
|
2580 |
if (__isExternalAddress(aGCId) |
|
2581 |
&& __isExternalAddress(aDrawableId) |
|
2582 |
&& __isNonNilObject(aString) |
|
2583 |
&& __bothSmallInteger(index1, index2) |
|
2584 |
&& __bothSmallInteger(x, y)) { |
|
850 | 2585 |
gc = _GCVal(aGCId); |
2586 |
win = _WindowVal(aDrawableId); |
|
2587 |
cls = __qClass(aString); |
|
2588 |
||
2589 |
i1 = __intVal(index1) - 1; |
|
2590 |
if (i1 >= 0) { |
|
2591 |
i2 = __intVal(index2) - 1; |
|
2592 |
if (i2 < i1) { |
|
2593 |
RETURN (self); |
|
2594 |
} |
|
2595 |
||
2596 |
cp = _stringVal(aString); |
|
2597 |
l = i2 - i1 + 1; |
|
2598 |
||
2599 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2600 |
n = _stringSize(aString); |
|
2601 |
if (i2 < n) { |
|
2602 |
cp += i1; |
|
2603 |
if (l > 1000) l = 1000; |
|
2604 |
if (opaque == true) |
|
2605 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2606 |
else |
|
2607 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2608 |
RETURN ( self ); |
|
2609 |
} |
|
2610 |
} |
|
2611 |
||
2612 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
2613 |
cp += nInstBytes; |
|
2614 |
||
2615 |
if (__isBytes(aString)) { |
|
2616 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
2617 |
||
2618 |
if (i2 < n) { |
|
2619 |
cp += i1; |
|
2620 |
if (l > 1000) l = 1000; |
|
2621 |
if (opaque == true) |
|
2622 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2623 |
else |
|
2624 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2625 |
RETURN ( self ); |
|
2626 |
} |
|
2627 |
} |
|
2628 |
||
2629 |
/* TWOBYTESTRINGS */ |
|
2630 |
if (__isWords(aString)) { |
|
2631 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
2632 |
||
2633 |
if (i2 < n) { |
|
2634 |
union { |
|
2635 |
char b[2]; |
|
2636 |
unsigned short s; |
|
2637 |
} u; |
|
2638 |
int i; |
|
2639 |
XChar2b *cp2 = (XChar2b *)0; |
|
2640 |
int mustFree = 0; |
|
2641 |
||
2642 |
cp += (i1 * 2); |
|
2643 |
if (l > 1000) l = 1000; |
|
2644 |
||
2645 |
/* |
|
2646 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
2647 |
* X expects them MSB first |
|
2648 |
* convert as required |
|
2649 |
*/ |
|
2650 |
||
2651 |
u.s = 0x1234; |
|
2652 |
if (u.b[0] != 0x12) { |
|
2653 |
if (l <= NLOCALBUFFER) { |
|
2654 |
cp2 = xlatebuffer; |
|
2655 |
} else { |
|
2656 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
2657 |
mustFree = 1; |
|
2658 |
} |
|
2659 |
for (i=0; i<l; i++) { |
|
2660 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
2661 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
2662 |
} |
|
2663 |
cp = (char *) cp2; |
|
2664 |
} |
|
2665 |
||
2666 |
if (opaque == true) |
|
2667 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
2668 |
else |
|
2669 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
2670 |
||
2671 |
if (mustFree) { |
|
2672 |
free(cp2); |
|
2673 |
} |
|
2674 |
||
2675 |
RETURN ( self ); |
|
2676 |
} |
|
2677 |
} |
|
2678 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2679 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2680 |
#undef NLOCALBUFFER |
295 | 2681 |
%}. |
2682 |
"x/y not integer, badGC or drawable, or not a string" |
|
2683 |
self primitiveFailed |
|
2684 |
! |
|
2685 |
||
2686 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2687 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
|
2688 |
foreground and background characters. |
|
2689 |
If the coordinates are not integers, an error is triggered." |
|
2690 |
||
2691 |
%{ /* NOCONTEXT */ |
|
2692 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2693 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2694 |
Window win; |
295 | 2695 |
unsigned char *cp; |
2696 |
int n; |
|
2697 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2698 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2699 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2700 |
int nInstBytes; |
295 | 2701 |
|
2702 |
if (__isExternalAddress(aGCId) |
|
2703 |
&& __isExternalAddress(aDrawableId) |
|
2704 |
&& __isNonNilObject(aString) |
|
2705 |
&& __bothSmallInteger(x, y)) { |
|
850 | 2706 |
gc = _GCVal(aGCId); |
2707 |
win = _WindowVal(aDrawableId); |
|
2708 |
cls = __qClass(aString); |
|
2709 |
||
2710 |
cp = _stringVal(aString); |
|
2711 |
||
2712 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2713 |
n = _stringSize(aString); |
|
2714 |
if (n > 1000) n = 1000; |
|
2715 |
if (opaque == true) |
|
2716 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2717 |
else |
|
2718 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2719 |
RETURN ( self ); |
|
2720 |
} |
|
2721 |
||
2722 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
2723 |
cp += nInstBytes; |
|
2724 |
||
2725 |
if (__isBytes(aString)) { |
|
2726 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
2727 |
||
2728 |
if (n > 1000) n = 1000; |
|
2729 |
if (opaque == true) |
|
2730 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2731 |
else |
|
2732 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2733 |
RETURN ( self ); |
|
2734 |
} |
|
2735 |
||
2736 |
/* TWOBYTESTRINGS */ |
|
2737 |
if (__isWords(aString)) { |
|
2738 |
union { |
|
2739 |
char b[2]; |
|
2740 |
unsigned short s; |
|
2741 |
} u; |
|
2742 |
int i; |
|
2743 |
XChar2b *cp2; |
|
2744 |
int mustFree = 0; |
|
2745 |
||
2746 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
2747 |
if (n > 1000) n = 1000; |
|
2748 |
||
2749 |
/* |
|
2750 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
2751 |
* X expects them MSB first |
|
2752 |
* convert as required |
|
2753 |
*/ |
|
2754 |
||
2755 |
u.s = 0x1234; |
|
2756 |
if (u.b[0] != 0x12) { |
|
2757 |
if (n <= NLOCALBUFFER) { |
|
2758 |
cp2 = xlatebuffer; |
|
2759 |
} else { |
|
2760 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
2761 |
mustFree = 1; |
|
2762 |
} |
|
2763 |
||
2764 |
for (i=0; i<n; i++) { |
|
2765 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
2766 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
2767 |
} |
|
2768 |
cp = (char *) cp2; |
|
2769 |
} |
|
2770 |
||
2771 |
if (opaque == true) |
|
2772 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
2773 |
else |
|
2774 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
2775 |
||
2776 |
||
2777 |
if (mustFree) { |
|
2778 |
free(cp2); |
|
2779 |
} |
|
2780 |
||
2781 |
RETURN ( self ); |
|
2782 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2783 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2784 |
#undef NLOCALBUFFER |
295 | 2785 |
%}. |
2786 |
"x/y not integer, badGC or drawable, or not a string" |
|
2787 |
self primitiveFailed |
|
2788 |
! |
|
2789 |
||
2790 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
2791 |
width:imageWidth height:imageHeight |
|
2792 |
x:srcx y:srcy |
|
2793 |
into:aDrawableId |
|
2794 |
x:dstx y:dsty |
|
2795 |
width:w height:h |
|
2796 |
with:aGCId |
|
2797 |
||
2798 |
"draw a bitImage which has depth id, width iw and height ih into |
|
2799 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
2800 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
2801 |
depth and pixel-units to be different. |
|
2802 |
It has to be checked elsewhere, that the server can do it with the given |
|
2803 |
depth - otherwise, primitive failure will be signalled. |
|
2804 |
Also it is assumed, that the colormap is setup correctly and the |
|
2805 |
colors are allocated - otherwise the colors may be wrong." |
|
2806 |
||
2807 |
" |
|
2808 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
2809 |
an unlimited stack, and thus cannot send primitiveFailed |
|
2810 |
" |
|
2811 |
(self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
2812 |
width:imageWidth height:imageHeight |
|
2813 |
x:srcx y:srcy |
|
2814 |
into:aDrawableId |
|
2815 |
x:dstx y:dsty |
|
2816 |
width:w height:h |
|
2817 |
with:aGCId) |
|
2818 |
ifFalse:[ |
|
2819 |
" |
|
2820 |
also happens, if a segmentation violation occurs in the |
|
2821 |
XPutImage ... |
|
2822 |
" |
|
2823 |
self primitiveFailed |
|
2824 |
]. |
|
2825 |
! |
|
2826 |
||
2827 |
drawBits:imageBits depth:imageDepth |
|
2828 |
width:imageWidth height:imageHeight |
|
2829 |
x:srcx y:srcy |
|
2830 |
into:aDrawableId |
|
2831 |
x:dstx y:dsty |
|
2832 |
width:w height:h |
|
2833 |
with:aGCId |
|
2834 |
||
2835 |
"draw a bitImage which has depth id, width iw and height ih into |
|
2836 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
2837 |
Individual source pixels must have imageDepth bits. |
|
2838 |
It has to be checked elsewhere, that the server can do it with the given |
|
2839 |
depth - otherwise, primitive failure will be signalled. |
|
2840 |
Also it is assumed, that the colormap is setup correctly and the |
|
2841 |
colors are allocated - otherwise the colors may be wrong." |
|
2842 |
||
2843 |
^ self drawBits:imageBits bitsPerPixel:imageDepth depth:imageDepth |
|
2844 |
width:imageWidth height:imageHeight |
|
2845 |
x:srcx y:srcy |
|
2846 |
into:aDrawableId |
|
2847 |
x:dstx y:dsty |
|
2848 |
width:w height:h |
|
2849 |
with:aGCId |
|
2850 |
||
2851 |
! |
|
2852 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2853 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
850 | 2854 |
in:aDrawableId with:aGCId |
90 | 2855 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
2856 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2857 |
|
2858 |
%{ /* NOCONTEXT */ |
|
2859 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2860 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2861 |
Window win; |
0 | 2862 |
int w, h, angle1, angle2; |
2863 |
double f; |
|
2864 |
||
97 | 2865 |
if (__isSmallInteger(startAngle)) |
850 | 2866 |
angle1 = __intVal(startAngle) * 64; |
36 | 2867 |
else if (__isFloat(startAngle)) { |
850 | 2868 |
f = __floatVal(startAngle); |
2869 |
angle1 = f * 64; |
|
0 | 2870 |
} |
97 | 2871 |
if (__isSmallInteger(angle)) |
850 | 2872 |
angle2 = __intVal(angle) * 64; |
36 | 2873 |
else if (__isFloat(angle)) { |
850 | 2874 |
f = __floatVal(angle); |
2875 |
angle2 = f * 64; |
|
0 | 2876 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2877 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2878 |
&& __isExternalAddress(aDrawableId) |
97 | 2879 |
&& __bothSmallInteger(x, y) |
2880 |
&& __bothSmallInteger(width, height)) { |
|
850 | 2881 |
gc = _GCVal(aGCId); |
2882 |
win = _WindowVal(aDrawableId); |
|
2883 |
w = __intVal(width); |
|
2884 |
h = __intVal(height); |
|
2885 |
/* |
|
2886 |
* need this check here: some servers simply dump core with bad args |
|
2887 |
*/ |
|
2888 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2889 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
|
2890 |
w, h, angle1, angle2); |
|
2891 |
} |
|
2892 |
RETURN ( self ); |
|
0 | 2893 |
} |
73 | 2894 |
%}. |
2895 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2896 |
self primitiveFailed |
2897 |
! |
|
2898 |
||
2899 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
118 | 2900 |
"fill a polygon given by its points. |
2901 |
If any coordinate is not integer, an error is triggered." |
|
73 | 2902 |
|
2903 |
|numberOfPoints| |
|
0 | 2904 |
|
2905 |
numberOfPoints := aPolygon size. |
|
2906 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2907 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2908 |
Window win; |
73 | 2909 |
OBJ point, x, y; |
2910 |
int i, num; |
|
2911 |
XPoint *points; |
|
2912 |
XPoint qPoints[100]; |
|
377 | 2913 |
int mustFree = 0; |
73 | 2914 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2915 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2916 |
&& __isExternalAddress(aDrawableId) |
97 | 2917 |
&& __isSmallInteger(numberOfPoints)) { |
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2918 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2919 |
win = _WindowVal(aDrawableId); |
555 | 2920 |
num = __intVal(numberOfPoints); |
73 | 2921 |
if (num < 3) { |
70 | 2922 |
RETURN ( self ); |
2923 |
} |
|
73 | 2924 |
/* |
2925 |
* avoid (slow) malloc, if not many points |
|
2926 |
*/ |
|
96 | 2927 |
if (num > 100) { |
73 | 2928 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
96 | 2929 |
if (! points) goto fail; |
377 | 2930 |
mustFree = 1; |
96 | 2931 |
} else |
73 | 2932 |
points = qPoints; |
2933 |
for (i=0; i<num; i++) { |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
2934 |
point = __AT_(aPolygon COMMA_CON, __MKSMALLINT(i+1)); |
73 | 2935 |
if (! __isPoint(point)) goto fail; |
2936 |
x = _point_X(point); |
|
2937 |
y = _point_Y(point); |
|
97 | 2938 |
if (! __bothSmallInteger(x, y)) |
73 | 2939 |
goto fail; |
555 | 2940 |
points[i].x = __intVal(x); |
2941 |
points[i].y = __intVal(y); |
|
73 | 2942 |
} |
2943 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
|
377 | 2944 |
if (mustFree) |
73 | 2945 |
free(points); |
2946 |
RETURN ( self ); |
|
377 | 2947 |
|
0 | 2948 |
fail: ; |
382 | 2949 |
if (mustFree) |
2950 |
free(points); |
|
0 | 2951 |
} |
73 | 2952 |
%}. |
2953 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2954 |
self primitiveFailed |
2955 |
! |
|
2956 |
||
295 | 2957 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
2958 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
2959 |
||
2960 |
%{ /* NOCONTEXT */ |
|
2961 |
||
2962 |
int w, h; |
|
2963 |
||
2964 |
if (__isExternalAddress(aGCId) |
|
2965 |
&& __isExternalAddress(aDrawableId) |
|
2966 |
&& __bothSmallInteger(x, y) |
|
2967 |
&& __bothSmallInteger(width, height)) { |
|
555 | 2968 |
w = __intVal(width); |
2969 |
h = __intVal(height); |
|
295 | 2970 |
/* |
2971 |
* need this check here: some servers simply dump core with bad args |
|
2972 |
*/ |
|
2973 |
if ((w >= 0) && (h >= 0)) { |
|
2974 |
XFillRectangle(myDpy, |
|
2975 |
(Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), |
|
555 | 2976 |
__intVal(x), __intVal(y), w, h); |
295 | 2977 |
} |
2978 |
RETURN ( self ); |
|
2979 |
} |
|
2980 |
%}. |
|
2981 |
"badGC, badDrawable or coordinates not integer" |
|
2982 |
self primitiveFailed |
|
43 | 2983 |
! |
2984 |
||
2985 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
70 | 2986 |
width:imageWidth height:imageHeight |
2987 |
x:srcx y:srcy |
|
2988 |
into:aDrawableId |
|
2989 |
x:dstx y:dsty |
|
2990 |
width:w height:h |
|
2991 |
with:aGCId |
|
0 | 2992 |
|
132 | 2993 |
"since XPutImage may allocate huge amount of stack space |
2994 |
(some implementations use alloca), this must run with unlimited stack." |
|
2995 |
||
12 | 2996 |
%{ /* UNLIMITEDSTACK */ |
0 | 2997 |
|
43 | 2998 |
/* |
2999 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
3000 |
* XPutImage |
|
3001 |
*/ |
|
3002 |
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
|
3003 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3004 |
Window win; |
43 | 3005 |
XImage image; |
377 | 3006 |
int imgWdth; |
43 | 3007 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3008 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3009 |
&& __isExternalAddress(aDrawableId) |
97 | 3010 |
&& __bothSmallInteger(srcx, srcy) |
3011 |
&& __bothSmallInteger(dstx, dsty) |
|
3012 |
&& __bothSmallInteger(w, h) |
|
3013 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
3014 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
43 | 3015 |
&& __isByteArray(imageBits)) { |
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3016 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3017 |
win = _WindowVal(aDrawableId); |
811 | 3018 |
if (! gc || !win) |
3019 |
goto fail; |
|
46 | 3020 |
#ifdef ARGDEBUG |
70 | 3021 |
printf("args ok\n"); |
46 | 3022 |
#endif |
555 | 3023 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
3024 |
image.width = imgWdth = __intVal(imageWidth); |
|
3025 |
image.height = __intVal(imageHeight); |
|
70 | 3026 |
image.xoffset = 0; |
3027 |
image.format = ZPixmap; |
|
3028 |
image.byte_order = MSBFirst; |
|
3029 |
image.bitmap_unit = 8; |
|
3030 |
image.bitmap_bit_order = MSBFirst; |
|
3031 |
image.bitmap_pad = 8; |
|
555 | 3032 |
image.depth = __intVal(imageDepth); |
3033 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
|
70 | 3034 |
switch (image.bits_per_pixel) { |
3035 |
case 1: |
|
377 | 3036 |
image.bytes_per_line = (imgWdth + 7) / 8; |
70 | 3037 |
break; |
3038 |
case 2: |
|
377 | 3039 |
image.bytes_per_line = (imgWdth*2 + 7) / 8; |
70 | 3040 |
break; |
3041 |
case 4: |
|
377 | 3042 |
image.bytes_per_line = (imgWdth*4 + 7) / 8; |
70 | 3043 |
break; |
3044 |
case 8: |
|
377 | 3045 |
image.bytes_per_line = imgWdth; |
70 | 3046 |
break; |
3047 |
case 16: |
|
377 | 3048 |
image.bytes_per_line = imgWdth*2; |
70 | 3049 |
break; |
3050 |
case 24: |
|
377 | 3051 |
image.bytes_per_line = imgWdth*3; |
70 | 3052 |
break; |
193 | 3053 |
case 32: |
377 | 3054 |
image.bytes_per_line = imgWdth*4; |
193 | 3055 |
break; |
70 | 3056 |
default: |
46 | 3057 |
#ifdef ARGDEBUG |
70 | 3058 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 3059 |
#endif |
70 | 3060 |
goto fail; |
3061 |
} |
|
3062 |
image.red_mask = 0xFFFF; |
|
3063 |
image.green_mask = 0xFFFF; |
|
3064 |
image.blue_mask = 0xFFFF; |
|
555 | 3065 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
3066 |
__intVal(dstx), __intVal(dsty), |
|
3067 |
__intVal(w), __intVal(h)); |
|
70 | 3068 |
RETURN ( true ); |
43 | 3069 |
} |
46 | 3070 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3071 |
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
|
3072 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 3073 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
3074 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
3075 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
3076 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
3077 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
3078 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
3079 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
3080 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
3081 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
3082 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
3083 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 3084 |
#endif |
3085 |
||
0 | 3086 |
fail: ; |
3087 |
%} |
|
3088 |
. |
|
12 | 3089 |
^ false |
0 | 3090 |
! ! |
3091 |
||
86 | 3092 |
!XWorkstation methodsFor:'event handling'! |
0 | 3093 |
|
3094 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
3095 |
"central event handling method: |
|
54 | 3096 |
get next event and send appropriate message to the sensor or view. |
0 | 3097 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
12 | 3098 |
otherwise only events for the view with given id are processed. |
3099 |
If the argument aMask is nonNil, only events for this eventMask are |
|
3100 |
handled." |
|
3101 |
||
54 | 3102 |
(self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[ |
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
3103 |
AbortSignal catch:[ |
83 | 3104 |
self dispatchLastEvent. |
3105 |
] |
|
54 | 3106 |
]. |
12 | 3107 |
! |
3108 |
||
295 | 3109 |
dispatchExposeEventFor:aViewIdOrNil |
3110 |
"get next expose event and send appropriate message to the sensor or view. |
|
3111 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
3112 |
otherwise only events for the view with given id are processed." |
|
3113 |
||
3114 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
|
12 | 3115 |
! |
3116 |
||
3117 |
dispatchLastEvent |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3118 |
|theView symS arg butt sibling windowID siblingID propertyID selectionID targetID requestorID |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3119 |
eventType| |
12 | 3120 |
|
3121 |
%{ /* STACK: 8000 */ |
|
3122 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
|
0 | 3123 |
|
3124 |
Display *dpy = myDpy; |
|
135 | 3125 |
OBJ eB; |
3126 |
XEvent *ev; |
|
3127 |
||
3128 |
# define ae ((XAnyEvent *)ev) |
|
3129 |
# define ee ((XExposeEvent *)ev) |
|
3130 |
# define ke ((XKeyPressedEvent *)ev) |
|
3131 |
# define be ((XButtonPressedEvent *)ev) |
|
3132 |
# define ce ((XConfigureEvent *)ev) |
|
3133 |
# define me ((XMotionEvent *)ev) |
|
3134 |
# define ewe ((XEnterWindowEvent *)ev) |
|
3135 |
# define lwe ((XLeaveWindowEvent *)ev) |
|
3136 |
# define de ((XDestroyWindowEvent *)ev) |
|
3137 |
# define ve ((XVisibilityEvent *)ev) |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3138 |
# define mape ((XMappingEvent *)ev) |
135 | 3139 |
|
0 | 3140 |
KeySym keySym; |
3141 |
unsigned char buffer[10]; |
|
3142 |
int i, nchars; |
|
3143 |
char *keySymString; |
|
3144 |
char keySymStringBuffer[32]; |
|
3145 |
static unsigned multiClickTime = 0; |
|
3146 |
unsigned nextMultiClickTime; |
|
150 | 3147 |
OBJ upDown; |
115 | 3148 |
|
3149 |
struct inlineCache *ipS; |
|
0 | 3150 |
static struct inlineCache vid = _ILC1; |
12 | 3151 |
|
3152 |
static struct inlineCache expS = _ILC5; |
|
3153 |
static struct inlineCache gexpS = _ILC5; |
|
3154 |
static struct inlineCache nexpS = _ILC1; |
|
3155 |
static struct inlineCache motS = _ILC4; |
|
3156 |
static struct inlineCache bpS = _ILC4; |
|
3157 |
static struct inlineCache bmpS = _ILC4; |
|
3158 |
static struct inlineCache bspS = _ILC4; |
|
3159 |
static struct inlineCache brS = _ILC4; |
|
3160 |
static struct inlineCache focInS = _ILC1; |
|
3161 |
static struct inlineCache focOutS = _ILC1; |
|
3162 |
static struct inlineCache peS = _ILC4; |
|
3163 |
static struct inlineCache plS = _ILC2; |
|
54 | 3164 |
static struct inlineCache termS = _ILC1; |
3165 |
static struct inlineCache savtermS = _ILC1; |
|
3166 |
static struct inlineCache destrS = _ILC1; |
|
3167 |
static struct inlineCache unmapS = _ILC1; |
|
3168 |
static struct inlineCache mapS = _ILC1; |
|
3169 |
static struct inlineCache confS = _ILC5; |
|
70 | 3170 |
static struct inlineCache coveredS = _ILC2; |
12 | 3171 |
|
3172 |
static struct inlineCache keymap = _ILC0; |
|
3173 |
static struct inlineCache created = _ILC0; |
|
3174 |
static struct inlineCache mapReq = _ILC0; |
|
3175 |
static struct inlineCache repar = _ILC0; |
|
3176 |
static struct inlineCache confReq = _ILC0; |
|
3177 |
static struct inlineCache resReq = _ILC0; |
|
3178 |
static struct inlineCache prop = _ILC0; |
|
129 | 3179 |
static struct inlineCache selClear = _ILC1; |
90 | 3180 |
static struct inlineCache selReq = _ILC4; |
3181 |
static struct inlineCache selNotify = _ILC4; |
|
12 | 3182 |
static struct inlineCache colormap = _ILC0; |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3183 |
static struct inlineCache mapping = _ILC2; |
70 | 3184 |
static struct inlineCache vis = _ILC1; |
12 | 3185 |
|
3186 |
static struct inlineCache skpS = _ILC4; |
|
63 | 3187 |
static struct inlineCache skrS = _ILC4; |
12 | 3188 |
|
555 | 3189 |
eB = __INST(eventBuffer); |
135 | 3190 |
if (__isByteArray(eB)) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3191 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
135 | 3192 |
} else { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3193 |
printf("DISPLAY: no eventBuffer\n"); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3194 |
RETURN (false); |
135 | 3195 |
} |
3196 |
||
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
3197 |
windowID = __MKOBJ(ae->window); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3198 |
theView = (*vid.ilc_func)(self, @symbol(viewFromId:) COMMA_CON, nil, &vid, windowID); |
12 | 3199 |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3200 |
if ((theView == nil) && (ev->type != MappingNotify)) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3201 |
RETURN (nil); |
12 | 3202 |
} |
3203 |
||
3204 |
/* |
|
3205 |
* key, button and pointer events are sent to the sensor, |
|
3206 |
* or (if there is none) to the delegate. |
|
3207 |
* or (if there is none) to the view. |
|
26 | 3208 |
* |
3209 |
* expose events are sent to the sensor, |
|
3210 |
* or (if there is none) to the view |
|
3211 |
* |
|
12 | 3212 |
* sensor and delegate get view as additional argument |
115 | 3213 |
* all of this has been taken out of here to corresponding methods |
3214 |
* in DeviceWorkstation. |
|
12 | 3215 |
*/ |
90 | 3216 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3217 |
#ifdef DEBUG |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3218 |
eventType = __MKSMALLINT(ev->type); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3219 |
#endif |
135 | 3220 |
switch (ev->type) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3221 |
case KeyRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3222 |
symS = @symbol(keyRelease:x:y:view:); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3223 |
ipS = &skrS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3224 |
upDown = false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3225 |
goto keyPressAndRelease; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3226 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3227 |
case KeyPress: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3228 |
symS = @symbol(keyPress:x:y:view:); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3229 |
ipS = &skpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3230 |
upDown = true; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3231 |
/* FALL INTO */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3232 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3233 |
keyPressAndRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3234 |
__INST(eventRootX) = __MKSMALLINT(ke->x_root); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3235 |
__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
|
3236 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3237 |
__INST(altDown) = (ke->state & Mod2Mask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3238 |
__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
|
3239 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3240 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3241 |
__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
|
3242 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3243 |
__INST(shiftDown) = (ke->state & ShiftMask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3244 |
__INST(ctrlDown) = (ke->state & ControlMask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3245 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3246 |
arg = nil; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3247 |
nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3248 |
if (nchars |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3249 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3250 |
|| (buffer[0] >= 0x80))) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3251 |
arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3252 |
keySymString = NULL; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3253 |
} else { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3254 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3255 |
switch (keySym) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3256 |
case XK_Control_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3257 |
case XK_Control_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3258 |
__INST(ctrlDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3259 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3260 |
case XK_Shift_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3261 |
case XK_Shift_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3262 |
__INST(shiftDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3263 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3264 |
case XK_Meta_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3265 |
case XK_Meta_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3266 |
__INST(metaDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3267 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3268 |
case XK_Alt_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3269 |
case XK_Alt_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3270 |
__INST(altDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3271 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3272 |
} |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3273 |
#endif |
150 | 3274 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3275 |
keySymString = XKeysymToString(keySym); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3276 |
if (keySymString) { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3277 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3278 |
if (keySymString[0] == 'D') { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3279 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3280 |
* remove underscore, dont want it in symbols |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3281 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3282 |
if (strcmp(keySymString, "Delete_line") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3283 |
keySymString = "DeleteLine"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3284 |
} else if (strcmp(keySymString, "Delete_word") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3285 |
keySymString = "DeleteWord"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3286 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3287 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3288 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3289 |
* make names compatible |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3290 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3291 |
if (strcmp(keySymString, "Down") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3292 |
keySymString = "CursorDown"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3293 |
} else if (strcmp(keySymString, "Up") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3294 |
keySymString = "CursorUp"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3295 |
} else if (strcmp(keySymString, "Left") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3296 |
keySymString = "CursorLeft"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3297 |
} else if (strcmp(keySymString, "Right") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3298 |
keySymString = "CursorRight"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3299 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3300 |
arg = __MKSYMBOL(keySymString, (OBJ *)0, __context); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3301 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3302 |
__PROTECT__(theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3303 |
arg = __MKSTRING(keySymString COMMA_CON); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3304 |
__UNPROTECT__(theView); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3305 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3306 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3307 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3308 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3309 |
if (arg == nil) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3310 |
/* happens sometimes (alt-graph on sun has no keysym) */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3311 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3312 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3313 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3314 |
(*(*ipS).ilc_func)(self, symS COMMA_CON, nil, ipS, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3315 |
arg, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3316 |
__MKSMALLINT(ke->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3317 |
__MKSMALLINT(ke->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3318 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3319 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3320 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3321 |
case ButtonPress: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3322 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button)); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3323 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3324 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3325 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3326 |
if (__isSmallInteger(__INST(multiClickTimeDelta))) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3327 |
nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta)); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3328 |
else |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3329 |
nextMultiClickTime = 0; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3330 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3331 |
if (multiClickTime) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3332 |
if (be->time < multiClickTime) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3333 |
multiClickTime = nextMultiClickTime; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3334 |
ipS = &bmpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3335 |
symS = @symbol(buttonMultiPress:x:y:view:); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3336 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3337 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3338 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3339 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3340 |
multiClickTime = nextMultiClickTime; |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
3341 |
#ifdef NO_LONGER |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3342 |
if (be->state & ShiftMask) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3343 |
ipS = &bspS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3344 |
symS = @symbol(buttonShiftPress:x:y:view:); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3345 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3346 |
} |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
3347 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3348 |
ipS = &bpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3349 |
symS = @symbol(buttonPress:x:y:view:); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3350 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3351 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3352 |
/* NOT REACHED */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3353 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3354 |
case ButtonRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3355 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button)); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3356 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3357 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3358 |
ipS = &brS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3359 |
symS = @symbol(buttonRelease:x:y:view:); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3360 |
/* fall into */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3361 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3362 |
sendButtonEvent: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3363 |
butt = __MKSMALLINT(be->button); |
12 | 3364 |
#ifdef NOTDEF |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3365 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3366 |
* this allows operation with single button mouses: meta-click is always Button 2 |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3367 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3368 |
if (__INST(metaDown) == true) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3369 |
butt = __MKSMALLINT(2); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3370 |
else |
0 | 3371 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3372 |
butt = __AT_(__INST(buttonTranslation), butt); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3373 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3374 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3375 |
(*(*ipS).ilc_func)(self, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3376 |
symS |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3377 |
COMMA_CON, nil, ipS, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3378 |
butt, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3379 |
__MKSMALLINT(ke->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3380 |
__MKSMALLINT(ke->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3381 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3382 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3383 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3384 |
case MotionNotify: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3385 |
if (__INST(motionEventCompression) != false) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3386 |
while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3387 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3388 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3389 |
__INST(eventRootX) = __MKSMALLINT(me->x_root); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3390 |
__INST(eventRootY) = __MKSMALLINT(me->y_root); |
70 | 3391 |
|
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
3392 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3393 |
__INST(altDown) = (me->state & Mod2Mask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3394 |
__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
|
3395 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3396 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3397 |
__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
|
3398 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3399 |
__INST(shiftDown) = (me->state & ShiftMask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3400 |
__INST(ctrlDown) = (me->state & ControlMask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3401 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3402 |
(*motS.ilc_func)(self, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3403 |
@symbol(buttonMotion:x:y:view:) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3404 |
COMMA_CON, nil, &motS, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3405 |
__MKSMALLINT(me->state), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3406 |
__MKSMALLINT(me->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3407 |
__MKSMALLINT(me->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3408 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3409 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3410 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3411 |
case FocusIn: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3412 |
(*focInS.ilc_func)(self, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3413 |
@symbol(focusInView:) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3414 |
COMMA_CON, nil, &focInS, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3415 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3416 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3417 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3418 |
case FocusOut: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3419 |
(*focOutS.ilc_func)(self, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3420 |
@symbol(focusOutView:) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3421 |
COMMA_CON, nil, &focOutS, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3422 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3423 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3424 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3425 |
case EnterNotify: |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
3426 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3427 |
__INST(altDown) = (ewe->state & Mod2Mask) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3428 |
__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
|
3429 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3430 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3431 |
__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
|
3432 |
#endif |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3433 |
__INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3434 |
__INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3435 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3436 |
(*peS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3437 |
@symbol(pointerEnter:x:y:view:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3438 |
COMMA_CON, nil, &peS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3439 |
__MKSMALLINT(ewe->state), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3440 |
__MKSMALLINT(ewe->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3441 |
__MKSMALLINT(ewe->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3442 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3443 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3444 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3445 |
case LeaveNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3446 |
(*plS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3447 |
@symbol(pointerLeave:view:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3448 |
COMMA_CON, nil, &plS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3449 |
__MKSMALLINT(lwe->state), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3450 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3451 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3452 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3453 |
case GraphicsExpose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3454 |
(*gexpS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3455 |
@symbol(graphicExposeX:y:width:height:view:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3456 |
COMMA_CON, nil, &gexpS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3457 |
__MKSMALLINT(ee->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3458 |
__MKSMALLINT(ee->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3459 |
__MKSMALLINT(ee->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3460 |
__MKSMALLINT(ee->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3461 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3462 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3463 |
if (ee->count != 0) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3464 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3465 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3466 |
/* fall into */ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3467 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3468 |
case NoExpose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3469 |
(*nexpS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3470 |
@symbol(noExposeView:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3471 |
COMMA_CON, nil, &nexpS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3472 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3473 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3474 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3475 |
case Expose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3476 |
(*expS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3477 |
@symbol(exposeX:y:width:height:view:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3478 |
COMMA_CON, nil, &expS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3479 |
__MKSMALLINT(ee->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3480 |
__MKSMALLINT(ee->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3481 |
__MKSMALLINT(ee->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3482 |
__MKSMALLINT(ee->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3483 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3484 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3485 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3486 |
case ConfigureNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3487 |
if (ce->above != None) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3488 |
siblingID = __MKOBJ(ce->above); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3489 |
sibling = (*vid.ilc_func)(self, @symbol(viewFromId:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3490 |
COMMA_CON, nil, &vid, siblingID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3491 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3492 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3493 |
(*confS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3494 |
@symbol(configureX:y:width:height:view:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3495 |
COMMA_CON, nil, &confS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3496 |
__MKSMALLINT(ce->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3497 |
__MKSMALLINT(ce->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3498 |
__MKSMALLINT(ce->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3499 |
__MKSMALLINT(ce->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3500 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3501 |
if (sibling != nil) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3502 |
(*coveredS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3503 |
@symbol(coveredBy:view:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3504 |
COMMA_CON, nil, &coveredS, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3505 |
theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3506 |
sibling); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3507 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3508 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3509 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3510 |
case ClientMessage: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3511 |
if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3512 |
if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom))) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3513 |
|| (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3514 |
(*termS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3515 |
@symbol(terminateView:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3516 |
COMMA_CON, nil, &termS, theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3517 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3518 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3519 |
if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3520 |
(*savtermS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3521 |
@symbol(saveAndTerminateView:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3522 |
COMMA_CON, nil, &savtermS, theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3523 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3524 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3525 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3526 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3527 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3528 |
case DestroyNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3529 |
(*destrS.ilc_func)(self, @symbol(destroyedView:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3530 |
COMMA_CON, nil, &destrS, theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3531 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3532 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3533 |
case UnmapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3534 |
(*unmapS.ilc_func)(self, @symbol(unmappedView:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3535 |
COMMA_CON, nil, &unmapS, theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3536 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3537 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3538 |
case MapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3539 |
(*mapS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3540 |
@symbol(mappedView:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3541 |
COMMA_CON, nil, &mapS, theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3542 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3543 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3544 |
case KeymapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3545 |
(*keymap.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3546 |
@symbol(keyMapChange) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3547 |
COMMA_CON, nil, &keymap); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3548 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3549 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3550 |
case VisibilityNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3551 |
switch (ve->state) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3552 |
case VisibilityUnobscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3553 |
arg = @symbol(unobscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3554 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3555 |
case VisibilityPartiallyObscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3556 |
arg = @symbol(partiallyObscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3557 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3558 |
case VisibilityFullyObscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3559 |
arg = @symbol(fullyObscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3560 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3561 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3562 |
(*vis.ilc_func)(theView, @symbol(visibilityChange:) COMMA_CON, nil, &vis, arg); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3563 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3564 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3565 |
case CreateNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3566 |
(*created.ilc_func)(theView, @symbol(created) COMMA_CON, nil, &created); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3567 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3568 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3569 |
case MapRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3570 |
(*mapReq.ilc_func)(theView, @symbol(mapRequest) COMMA_CON, nil, &mapReq); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3571 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3572 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3573 |
case ReparentNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3574 |
(*repar.ilc_func)(theView, @symbol(reparented) COMMA_CON, nil, &repar); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3575 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3576 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3577 |
case ConfigureRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3578 |
(*confReq.ilc_func)(theView, @symbol(configRequest) COMMA_CON, nil, &confReq); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3579 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3580 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3581 |
case GravityNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3582 |
case ResizeRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3583 |
(*resReq.ilc_func)(theView, @symbol(resizeRequest) COMMA_CON, nil, &resReq); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3584 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3585 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3586 |
case CirculateNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3587 |
case CirculateRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3588 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3589 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3590 |
case PropertyNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3591 |
(*prop.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3592 |
@symbol(propertyChange) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3593 |
COMMA_CON, nil, &prop); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3594 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3595 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3596 |
case SelectionClear: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3597 |
selectionID = __MKATOMOBJ(ev->xselectionclear.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3598 |
(*selClear.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3599 |
@symbol(selectionClear:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3600 |
COMMA_CON, nil, &selClear, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3601 |
selectionID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3602 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3603 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3604 |
case SelectionNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3605 |
/* |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3606 |
* returned selection value (answer from SelectionRequest) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3607 |
*/ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3608 |
DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3609 |
ev->xselection.property, ev->xselection.target, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3610 |
ev->xselection.selection, ev->xselection.requestor)); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3611 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3612 |
propertyID = __MKATOMOBJ(ev->xselection.property); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3613 |
targetID = __MKATOMOBJ(ev->xselection.target); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3614 |
selectionID = __MKATOMOBJ(ev->xselection.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3615 |
requestorID = __MKOBJ(ev->xselection.requestor); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3616 |
(*selNotify.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3617 |
@symbol(selectionNotify:target:selection:from:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3618 |
COMMA_CON, nil, &selNotify, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3619 |
propertyID, targetID, selectionID, requestorID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3620 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3621 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3622 |
case SelectionRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3623 |
/* |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3624 |
* someone wants the selection |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3625 |
*/ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3626 |
DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3627 |
ev->xselectionrequest.property, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3628 |
ev->xselectionrequest.target, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3629 |
ev->xselectionrequest.selection, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3630 |
ev->xselectionrequest.requestor)); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3631 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3632 |
propertyID = __MKATOMOBJ(ev->xselectionrequest.property); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3633 |
targetID = __MKATOMOBJ(ev->xselectionrequest.target); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3634 |
selectionID = __MKATOMOBJ(ev->xselectionrequest.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3635 |
requestorID = __MKOBJ(ev->xselectionrequest.requestor); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3636 |
(*selReq.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3637 |
@symbol(selectionRequest:target:selection:from:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3638 |
COMMA_CON, nil, &selReq, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3639 |
propertyID, targetID, selectionID, requestorID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3640 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3641 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3642 |
case ColormapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3643 |
(*colormap.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3644 |
@symbol(colorMapChange) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3645 |
COMMA_CON, nil, &colormap); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3646 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3647 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3648 |
case MappingNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3649 |
switch(mape->request) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3650 |
case MappingModifier: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3651 |
arg = @symbol(mappingModifier); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3652 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3653 |
case MappingKeyboard: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3654 |
arg = @symbol(mappingKeyboard); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3655 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3656 |
case MappingPointer: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3657 |
arg = @symbol(mappingPointer); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3658 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3659 |
default: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3660 |
arg = nil; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3661 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3662 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3663 |
(*mapping.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3664 |
@symbol(mappingChanged:event:) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3665 |
COMMA_CON, nil, &mapping, arg, eB); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3666 |
break; |
0 | 3667 |
} |
135 | 3668 |
#undef ae |
0 | 3669 |
#undef ee |
3670 |
#undef ke |
|
3671 |
#undef be |
|
3672 |
#undef ce |
|
3673 |
#undef me |
|
3674 |
#undef ewe |
|
3675 |
#undef lwe |
|
3676 |
#undef de |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3677 |
#undef mape |
0 | 3678 |
%} |
3679 |
. |
|
3680 |
^ true |
|
3681 |
! |
|
3682 |
||
295 | 3683 |
dispatchPendingEvents |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3684 |
"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
|
3685 |
(i.e. this is now only used in the modal debugger) |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3686 |
This code is somewhat special, since X has a concept of graphic |
295 | 3687 |
expose events (which are sent after a bitblt). After such a bitblt, |
3688 |
we only handle exposes until the graphicsExpose arrives. |
|
3689 |
Other systems may not need such a kludge" |
|
3690 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
3691 |
"interested in exposes only ?" |
295 | 3692 |
dispatchingExpose notNil ifTrue:[ |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3693 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
295 | 3694 |
self dispatchExposeEventFor:dispatchingExpose |
3695 |
]. |
|
3696 |
^ self |
|
3697 |
]. |
|
3698 |
||
3699 |
"no, general dispatch" |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3700 |
[self eventPendingWithSync:false] whileTrue:[ |
295 | 3701 |
self dispatchEventFor:nil withMask:nil |
3702 |
] |
|
3703 |
! |
|
3704 |
||
81 | 3705 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
3706 |
"dispose (throw away) specific events. If aWindowId is nil, |
|
3707 |
events matching the mask are thrown away regardless of which |
|
3708 |
view they are for. Otherwise, only matching events for that |
|
3709 |
view are flushed." |
|
0 | 3710 |
|
3711 |
%{ /* NOCONTEXT */ |
|
3712 |
||
3713 |
Display *dpy = myDpy; |
|
3714 |
XEvent ev; |
|
3715 |
Window win; |
|
3716 |
||
97 | 3717 |
if (__isSmallInteger(aMask)) { |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3718 |
if (__isExternalAddress(aWindowIdOrNil)) { |
81 | 3719 |
win = _WindowVal(aWindowIdOrNil); |
555 | 3720 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
81 | 3721 |
} else { |
555 | 3722 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
81 | 3723 |
} |
70 | 3724 |
RETURN ( self ); |
0 | 3725 |
} |
3726 |
%} |
|
3727 |
. |
|
3728 |
self primitiveFailed |
|
3729 |
! |
|
3730 |
||
295 | 3731 |
eventMaskFor:anEventSymbol |
3732 |
"return the eventMask bit-constant corresponding to an event symbol" |
|
3733 |
||
3734 |
%{ /* NOCONTEXT */ |
|
3735 |
||
3736 |
int m = 0; |
|
3737 |
||
3738 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
|
3739 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
|
3740 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
|
3741 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
|
3742 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
|
3743 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
|
3744 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
|
3745 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
|
3746 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
|
3747 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
|
3748 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
|
3749 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
|
3750 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
|
3751 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
|
3752 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
|
3753 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
3754 |
RETURN (__MKSMALLINT(m)); |
295 | 3755 |
%} |
3756 |
! |
|
3757 |
||
12 | 3758 |
eventPending |
310 | 3759 |
"return true, if any event is pending. |
3760 |
This looks for both the internal queue and the display connection." |
|
12 | 3761 |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3762 |
ConservativeSyncing == true ifTrue:[self sync]. |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3763 |
|
12 | 3764 |
dispatchingExpose notNil ifTrue:[ |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3765 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
12 | 3766 |
]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3767 |
^ self eventPendingWithSync:false |
0 | 3768 |
! |
3769 |
||
295 | 3770 |
eventPending:anEventSymbol for:aWindowIdOrNil |
3771 |
"return true, if a specific event is pending" |
|
3772 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3773 |
^ 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
|
3774 |
! |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3775 |
|
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3776 |
eventPendingWithSync:doSync |
7 | 3777 |
"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
|
3778 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
310 | 3779 |
before checking." |
0 | 3780 |
|
12 | 3781 |
%{ /* UNLIMITEDSTACK */ |
0 | 3782 |
|
3783 |
Display *dpy = myDpy; |
|
3784 |
||
150 | 3785 |
if (ISCONNECTED) { |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3786 |
if (doSync == true) { |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3787 |
XSync(dpy, 0); /* make certain everything is flushed */ |
150 | 3788 |
} |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3789 |
if (XPending(dpy)) { |
150 | 3790 |
RETURN (true); |
3791 |
} |
|
3792 |
} |
|
3793 |
RETURN ( false ); |
|
0 | 3794 |
%} |
3795 |
! |
|
3796 |
||
341 | 3797 |
eventQueued |
3798 |
"return true, if any event is queued" |
|
3799 |
||
3800 |
dispatchingExpose notNil ifTrue:[ |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3801 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
341 | 3802 |
]. |
3803 |
^ self eventQueuedAlready |
|
3804 |
||
3805 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
|
3806 |
! |
|
3807 |
||
3808 |
eventQueuedAlready |
|
3809 |
"return true, if any event is queued internally. |
|
3810 |
(i.e. in X's internal event queue, which is both filled by explicit |
|
3811 |
nextEvent calls AND whenever drawing is done and events are pending on |
|
3812 |
the display connection)." |
|
3813 |
||
3814 |
%{ /* UNLIMITEDSTACK */ |
|
3815 |
||
3816 |
if (ISCONNECTED) { |
|
3817 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
|
3818 |
RETURN (true); |
|
3819 |
} |
|
3820 |
} |
|
3821 |
RETURN ( false ); |
|
3822 |
%} |
|
3823 |
! |
|
3824 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3825 |
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync |
295 | 3826 |
"return true, if any of the masked events is pending" |
3827 |
||
3828 |
%{ /* UNLIMITEDSTACK */ |
|
3829 |
||
3830 |
Display *dpy = myDpy; |
|
3831 |
XEvent ev; |
|
3832 |
Window win; |
|
3833 |
int thereIsOne; |
|
3834 |
||
3835 |
if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3836 |
if (doSync == true) { |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3837 |
XSync(dpy, 0); /* make certain everything is flushed */ |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3838 |
} |
295 | 3839 |
if (__isExternalAddress(aWindowIdOrNil)) { |
3840 |
win = _WindowVal(aWindowIdOrNil); |
|
555 | 3841 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
295 | 3842 |
} else { |
555 | 3843 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
295 | 3844 |
} |
3845 |
if (thereIsOne) { |
|
3846 |
XPutBackEvent(dpy, &ev); |
|
3847 |
RETURN ( true ); |
|
3848 |
} |
|
3849 |
} |
|
3850 |
RETURN ( false ); |
|
3851 |
%} |
|
3852 |
! |
|
3853 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3854 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
310 | 3855 |
"return true, if any expose event is pending for a specific view, |
3856 |
or any view (if the arg is nil). |
|
3857 |
This is an X specific, only required after a scroll operation." |
|
7 | 3858 |
|
12 | 3859 |
%{ /* UNLIMITEDSTACK */ |
7 | 3860 |
|
3861 |
Display *dpy = myDpy; |
|
3862 |
XEvent ev; |
|
3863 |
Window win; |
|
81 | 3864 |
int thereIsOne; |
3865 |
||
150 | 3866 |
if (ISCONNECTED) { |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3867 |
if (doSync == true) { |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3868 |
XSync(dpy, 0); /* make certain everything is flushed */ |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3869 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3870 |
if (__isExternalAddress(aWindowIdOrNil)) { |
150 | 3871 |
win = _WindowVal(aWindowIdOrNil); |
3872 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
|
3873 |
} else { |
|
3874 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
|
3875 |
} |
|
3876 |
if (thereIsOne) { |
|
3877 |
XPutBackEvent(dpy, &ev); |
|
3878 |
RETURN ( true ); |
|
3879 |
} |
|
81 | 3880 |
} |
3881 |
RETURN ( false ); |
|
3882 |
%} |
|
3883 |
! |
|
3884 |
||
295 | 3885 |
getEventFor:aViewIdOrNil withMask:eventMask |
3886 |
"read next event - put into local eventBuffer. |
|
3887 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
3888 |
otherwise only events for that specific view will be fetched. |
|
3889 |
Returns true, if there was an event, false otherwise. |
|
3890 |
This method may block - so you better check for pending events |
|
3891 |
before calling for it. |
|
3892 |
||
3893 |
Sorry I had to split dispatch into this fetch method and an extra |
|
3894 |
handle method to allow unlimitedstack here. |
|
3895 |
(some Xlibs do a big alloca there ...) which cannot be done in |
|
3896 |
dispatchLastEvent, since it dispatches out into ST-methods. |
|
3897 |
BUG: uses a static buffer - has to be rewritten, to support multiple |
|
3898 |
display connections. |
|
3899 |
" |
|
81 | 3900 |
|
3901 |
%{ /* UNLIMITEDSTACK */ |
|
3902 |
||
3903 |
Display *dpy = myDpy; |
|
295 | 3904 |
Window win, wWanted; |
3905 |
int evMask; |
|
3906 |
OBJ eB; |
|
3907 |
XEvent *ev; |
|
3908 |
||
3909 |
if (! ISCONNECTED) { |
|
3910 |
RETURN (false); |
|
3911 |
} |
|
3912 |
||
555 | 3913 |
eB = __INST(eventBuffer); |
295 | 3914 |
if (__isByteArray(eB)) { |
555 | 3915 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 3916 |
} else { |
3917 |
printf("DISPLAY: no eventBuffer\n"); |
|
3918 |
RETURN (false); |
|
3919 |
} |
|
3920 |
ev->type = 0; |
|
3921 |
||
3922 |
if (__isSmallInteger(eventMask)) { |
|
555 | 3923 |
evMask = __intVal(eventMask); |
295 | 3924 |
} else { |
3925 |
evMask = ~0; |
|
3926 |
} |
|
3927 |
||
3928 |
if (__isExternalAddress(aViewIdOrNil)) { |
|
3929 |
wWanted = _WindowVal(aViewIdOrNil); |
|
3930 |
if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { |
|
70 | 3931 |
RETURN ( true ); |
3932 |
} |
|
295 | 3933 |
} else { |
3934 |
if (evMask == ~0) { |
|
3935 |
XNextEvent(dpy, ev); |
|
3936 |
RETURN (true); |
|
3937 |
} |
|
3938 |
if (XCheckMaskEvent(dpy, evMask, ev)) { |
|
3939 |
RETURN (true); |
|
3940 |
} |
|
3941 |
} |
|
3942 |
%}. |
|
3943 |
^ false |
|
3944 |
! |
|
3945 |
||
3946 |
handleAllEvents |
|
3947 |
"from now on, handle any kind of event" |
|
3948 |
||
3949 |
dispatchingExpose := nil |
|
3950 |
! |
|
3951 |
||
3952 |
handleExposeOnlyFor:aView |
|
3953 |
"from now on, handle expose events only" |
|
3954 |
||
3955 |
dispatchingExpose := aView id |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3956 |
! |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3957 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3958 |
mappingChanged:what event:eB |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3959 |
"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
|
3960 |
Tell xlib about the fact." |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3961 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3962 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3963 |
self refreshKeyboardMapping:eB. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3964 |
"Maybe some of our modifiers have been changed" |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3965 |
self initializeModifierMappings. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3966 |
]. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3967 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3968 |
"Created: 1.12.1995 / 16:28:23 / stefan" |
295 | 3969 |
! |
3970 |
||
3971 |
setEventMask:aMask in:aWindowId |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
3972 |
"tell X that we are only interested in events from aMask, which |
295 | 3973 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
3974 |
||
3975 |
%{ /* NOCONTEXT */ |
|
3976 |
||
3977 |
int mask; |
|
3978 |
||
3979 |
if (__isExternalAddress(aWindowId) |
|
3980 |
&& __isSmallInteger(aMask)) { |
|
555 | 3981 |
mask = __intVal(aMask); |
295 | 3982 |
|
3983 |
#ifdef OLD |
|
3984 |
/* these may not be disabled */ |
|
3985 |
mask |= ExposureMask | StructureNotifyMask | |
|
3986 |
KeyPressMask | KeyReleaseMask | |
|
3987 |
EnterWindowMask | LeaveWindowMask | |
|
3988 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
|
3989 |
#endif |
|
3990 |
||
3991 |
XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
|
3992 |
RETURN ( self ); |
|
3993 |
} |
|
3994 |
%} |
|
3995 |
. |
|
3996 |
self primitiveFailed |
|
3997 |
! |
|
3998 |
||
3999 |
startDispatch |
|
4000 |
"redefined to clear dispatchingExpose, which is a special X feature" |
|
4001 |
||
4002 |
dispatching ifTrue:[^ self]. |
|
4003 |
dispatchingExpose := nil. |
|
4004 |
super startDispatch |
|
0 | 4005 |
! ! |
295 | 4006 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4007 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4008 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4009 |
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4010 |
"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
|
4011 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4012 |
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
|
4013 |
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
|
4014 |
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
|
4015 |
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
|
4016 |
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
|
4017 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4018 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4019 |
%{ /* NOCONTEXT */ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4020 |
Display *dpy = myDpy; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4021 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4022 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4023 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4024 |
if (__isSmallInteger(stateMask)) { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4025 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4026 |
} else { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4027 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4028 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4029 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4030 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4031 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4032 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4033 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4034 |
XEvent ev; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4035 |
Window target; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4036 |
Status result; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4037 |
KeySym keySym, *syms; |
555 | 4038 |
int screen = __intVal(__INST(screen)); |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4039 |
char s[2]; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4040 |
int nSyms; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4041 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4042 |
if ((typeSymbol == @symbol(keyPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4043 |
|| (typeSymbol == @symbol(keyRelease))) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4044 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4045 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4046 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4047 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4048 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4049 |
s[1] = '\0'; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4050 |
keySym = XStringToKeysym(s); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4051 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4052 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4053 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4054 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4055 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4056 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4057 |
if (stateMask == nil) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4058 |
/* |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4059 |
* get the modifier from the keySym |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4060 |
*/ |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4061 |
nSyms = 0; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4062 |
syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4063 |
if (syms) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4064 |
int i; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4065 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4066 |
for (i=0; i<nSyms; i++) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4067 |
if (syms[i] == keySym) { |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4068 |
#ifdef MODIFIERDEBUG |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4069 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4070 |
#endif |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4071 |
if (i) state = (1 << (i-1)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4072 |
break; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4073 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4074 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4075 |
XFree(syms); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4076 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4077 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4078 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4079 |
if ((typeSymbol == @symbol(buttonPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4080 |
|| (typeSymbol == @symbol(buttonRelease))) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4081 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4082 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4083 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4084 |
ev.xbutton.button = 1; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4085 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4086 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4087 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4088 |
RETURN (false); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4089 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4090 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4091 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4092 |
if (typeSymbol == @symbol(keyPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4093 |
ev.xany.type = KeyPress; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4094 |
else if (typeSymbol == @symbol(keyRelease)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4095 |
ev.xany.type = KeyRelease; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4096 |
else if (typeSymbol == @symbol(buttonPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4097 |
ev.xany.type = ButtonPress; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4098 |
else if (typeSymbol == @symbol(buttonRelease)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4099 |
ev.xany.type = ButtonRelease; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4100 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4101 |
if (__isExternalAddress(targetId)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4102 |
target = _WindowVal(targetId); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4103 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4104 |
target = (Window) __longIntVal(targetId); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4105 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4106 |
ev.xkey.window = target; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4107 |
ev.xkey.same_screen = 1; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4108 |
ev.xkey.subwindow = 0; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4109 |
ev.xkey.root = RootWindow(myDpy, screen); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4110 |
ev.xkey.x = __intVal(xPos); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4111 |
ev.xkey.y = __intVal(yPos); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4112 |
ev.xkey.state = state; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4113 |
ev.xkey.time = CurrentTime; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4114 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4115 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4116 |
if ((result == BadValue) || (result == BadWindow)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4117 |
DPRINTF(("bad status\n")); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4118 |
RETURN ( false ) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4119 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4120 |
RETURN (true) |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4121 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4122 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4123 |
self primitiveFailed. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4124 |
^ false |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4125 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4126 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4127 |
simulateKeyboardInput:aCharacterOrString inViewId:viewId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4128 |
"send input to some other view, by simulating keyPress/keyRelease |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4129 |
events. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4130 |
Only a few control characters are supported. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4131 |
Notice: not all alien views allow this kind of synthetic input; |
850 | 4132 |
some simply ignore it." |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4133 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4134 |
|control code state| |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4135 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4136 |
aCharacterOrString isString ifTrue:[ |
850 | 4137 |
aCharacterOrString do:[:char | |
4138 |
self simulateKeyboardInput:char inViewId:viewId |
|
4139 |
]. |
|
4140 |
^ self |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4141 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4142 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4143 |
control := false. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4144 |
code := aCharacterOrString asciiValue. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4145 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4146 |
(aCharacterOrString == Character cr) ifTrue:[ |
850 | 4147 |
code := #Return |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4148 |
] ifFalse:[ |
850 | 4149 |
(aCharacterOrString == Character tab) ifTrue:[ |
4150 |
code := #Tab |
|
4151 |
] ifFalse:[ |
|
4152 |
(aCharacterOrString == Character esc) ifTrue:[ |
|
4153 |
code := #Escape |
|
4154 |
] |
|
4155 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4156 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4157 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4158 |
control ifTrue:[ |
850 | 4159 |
state := self controlMask |
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4160 |
]. |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4161 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4162 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4163 |
"/ the stuff below should not be needed |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4164 |
"/ (sendKeyOrButtonevent should be able to figure out things itself) |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4165 |
"/ however, on some linux systems it seems to not work correctly. |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4166 |
"/ Hopefully, this is correct ... |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4167 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4168 |
code isNumber ifTrue:[ |
850 | 4169 |
code >= $A asciiValue ifTrue:[ |
4170 |
code <= $Z asciiValue ifTrue:[ |
|
4171 |
state := self shiftMask |
|
4172 |
] |
|
4173 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4174 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4175 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4176 |
self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4177 |
self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4178 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4179 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4180 |
sending input to some (possibly alien) view: |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4181 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4182 |
|point id| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4183 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4184 |
point := Display pointFromUser. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4185 |
id := Display viewIdFromPoint:point. |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4186 |
Display simulateKeyboardInput:'Hello_world' inViewId:id |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4187 |
" |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4188 |
|
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4189 |
"Modified: 11.6.1996 / 10:59:42 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4190 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4191 |
|
295 | 4192 |
!XWorkstation methodsFor:'font stuff'! |
4193 |
||
4194 |
createFontFor:aFontName |
|
4195 |
"a basic method for X-font allocation; this method allows |
|
4196 |
any font to be aquired (even those not conforming to |
|
4197 |
standard naming conventions, such as cursor, fixed or k14)" |
|
4198 |
||
4199 |
%{ /* UNLIMITEDSTACK */ |
|
4200 |
/* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */ |
|
4201 |
||
4202 |
XFontStruct *newFont; |
|
4203 |
||
4204 |
if (ISCONNECTED) { |
|
4205 |
if (__isString(aFontName) || __isSymbol(aFontName)) { |
|
4206 |
BEGIN_INTERRUPTSBLOCKED |
|
4207 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4208 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4209 |
if (newFont) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4210 |
__cnt_font++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4211 |
#endif |
295 | 4212 |
END_INTERRUPTSBLOCKED |
4213 |
RETURN ( newFont ? __MKOBJ(newFont) : nil ); |
|
4214 |
} |
|
4215 |
} |
|
4216 |
%}. |
|
4217 |
^ nil |
|
4218 |
! |
|
4219 |
||
4220 |
decomposeXFontName:aString into:aBlock |
|
4221 |
"extract family, face, style and size from an |
|
4222 |
X-font name |
|
4223 |
(-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); |
|
4224 |
evaluate aBlock with these" |
|
4225 |
||
4226 |
|origin family face style moreStyle skip fheight size |
|
4227 |
resX resY x1 x2 coding start end | |
|
4228 |
||
4229 |
aString isNil ifTrue:[^ false]. |
|
4230 |
(aString startsWith:'-') ifFalse:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4231 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4232 |
take care for ill-named fonts (i.e. pre Rel4 fonts) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4233 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4234 |
('*-*-[0-9]*' match:aString) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4235 |
end := aString indexOf:$- startingAt:1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4236 |
family := aString copyFrom:1 to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4237 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4238 |
end := aString indexOf:$- startingAt:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4239 |
style := aString copyFrom:start to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4240 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4241 |
size := aString copyFrom:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4242 |
size := (Number readFromString:size onError:[^false]). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4243 |
aBlock value:family value:nil value:style value:size value:nil. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4244 |
^ true. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4245 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4246 |
('*-[0-9]*' match:aString) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4247 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4248 |
something like lucidasans-24 |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4249 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4250 |
end := aString indexOf:$- startingAt:1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4251 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4252 |
family := aString copyFrom:1 to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4253 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4254 |
size := aString copyFrom:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4255 |
size := (Number readFromString:size onError:[^false]). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4256 |
aBlock value:family value:nil value:nil value:size value:nil. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4257 |
^ true. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4258 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4259 |
aBlock value:aString value:nil value:nil value:nil value:nil. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4260 |
^ true. |
295 | 4261 |
]. |
4262 |
||
4263 |
end := aString indexOf:$- startingAt:2. |
|
4264 |
(end == 0) ifTrue:[^ false]. |
|
4265 |
origin := aString copyFrom:2 to:(end - 1). |
|
4266 |
||
4267 |
start := end + 1. |
|
4268 |
end := aString indexOf:$- startingAt:start. |
|
4269 |
(end == 0) ifTrue:[^ false]. |
|
4270 |
family := aString copyFrom:start to:(end - 1). |
|
4271 |
||
4272 |
start := end + 1. |
|
4273 |
end := aString indexOf:$- startingAt:start. |
|
4274 |
(end == 0) ifTrue:[^ false]. |
|
4275 |
face := aString copyFrom:start to:(end - 1). |
|
4276 |
||
4277 |
start := end + 1. |
|
4278 |
end := aString indexOf:$- startingAt:start. |
|
4279 |
(end == 0) ifTrue:[^ false]. |
|
4280 |
style := aString copyFrom:start to:(end - 1). |
|
4281 |
(style = 'o') ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4282 |
style := 'oblique' |
295 | 4283 |
] ifFalse:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4284 |
(style = 'i') ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4285 |
style := 'italic' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4286 |
] ifFalse:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4287 |
(style = 'r') ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4288 |
style := 'roman' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4289 |
] |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4290 |
] |
295 | 4291 |
]. |
4292 |
||
4293 |
start := end + 1. |
|
4294 |
end := aString indexOf:$- startingAt:start. |
|
4295 |
(end == 0) ifTrue:[^ false]. |
|
4296 |
moreStyle := aString copyFrom:start to:(end - 1). |
|
4297 |
||
4298 |
start := end + 1. |
|
4299 |
end := aString indexOf:$- startingAt:start. |
|
4300 |
(end == 0) ifTrue:[^ false]. |
|
4301 |
skip := aString copyFrom:start to:(end - 1). |
|
4302 |
||
4303 |
start := end + 1. |
|
4304 |
end := aString indexOf:$- startingAt:start. |
|
4305 |
(end == 0) ifTrue:[^ false]. |
|
4306 |
fheight := aString copyFrom:start to:(end - 1). |
|
4307 |
||
4308 |
start := end + 1. |
|
4309 |
end := aString indexOf:$- startingAt:start. |
|
4310 |
(end == 0) ifTrue:[^ false]. |
|
4311 |
size := aString copyFrom:start to:(end - 1). |
|
4312 |
size := (Number readFromString:size) / 10. |
|
4313 |
||
4314 |
start := end + 1. |
|
4315 |
end := aString indexOf:$- startingAt:start. |
|
4316 |
(end == 0) ifTrue:[^ false]. |
|
4317 |
resX := aString copyFrom:start to:(end - 1). |
|
4318 |
||
4319 |
start := end + 1. |
|
4320 |
end := aString indexOf:$- startingAt:start. |
|
4321 |
(end == 0) ifTrue:[^ false]. |
|
4322 |
resY := aString copyFrom:start to:(end - 1). |
|
4323 |
||
4324 |
start := end + 1. |
|
4325 |
end := aString indexOf:$- startingAt:start. |
|
4326 |
(end == 0) ifTrue:[^ false]. |
|
4327 |
x1 := aString copyFrom:start to:(end - 1). |
|
4328 |
||
4329 |
start := end + 1. |
|
4330 |
end := aString indexOf:$- startingAt:start. |
|
4331 |
(end == 0) ifTrue:[^ false]. |
|
4332 |
x2 := aString copyFrom:start to:(end - 1). |
|
4333 |
||
4334 |
start := end + 1. |
|
4335 |
end := aString indexOf:$- startingAt:start. |
|
4336 |
(end == 0) ifTrue:[^ false]. |
|
4337 |
coding := aString copyFrom:start to:(end - 1). |
|
4338 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4339 |
(moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4340 |
style := style, '-', moreStyle. |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4341 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4342 |
|
295 | 4343 |
aBlock value:family value:face value:style value:size value:coding. |
4344 |
^ true |
|
4345 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4346 |
"Modified: 4.7.1996 / 11:12:25 / stefan" |
295 | 4347 |
! |
4348 |
||
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4349 |
encodingOf:aFontId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4350 |
"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
|
4351 |
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
|
4352 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4353 |
|enc fullName fontName registry encoding charSetCollections| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4354 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4355 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4356 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4357 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4358 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4359 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4360 |
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4361 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4362 |
registryAtom = XInternAtom(myDpy, "CHARSET_REGISTRY", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4363 |
encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4364 |
charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4365 |
fontAtom = XInternAtom(myDpy, "FONT", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4366 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4367 |
if (ISCONNECTED) { |
850 | 4368 |
if (__isExternalAddress(aFontId)) { |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4369 |
|
850 | 4370 |
f = _FontVal(aFontId); |
4371 |
if (f) { |
|
4372 |
n = f->n_properties; |
|
4373 |
prop = f->properties; |
|
4374 |
if (prop) { |
|
4375 |
while (n--) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4376 |
#ifdef SUPERDEBUG |
850 | 4377 |
cp = XGetAtomName(myDpy, prop->name); |
4378 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4379 |
XFree(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4380 |
#endif |
850 | 4381 |
if (prop->name == XA_FULL_NAME) { |
4382 |
cp = XGetAtomName(myDpy, prop->card32); |
|
4383 |
if (cp) { |
|
4384 |
fullName = __MKSTRING(cp COMMA_CON); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4385 |
#ifdef SUPERDEBUG |
850 | 4386 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4387 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4388 |
XFree(cp); |
850 | 4389 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4390 |
} else if (prop->name == fontAtom) { |
850 | 4391 |
cp = XGetAtomName(myDpy, prop->card32); |
4392 |
if (cp) { |
|
4393 |
fontName = __MKSTRING(cp COMMA_CON); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4394 |
#ifdef SUPERDEBUG |
850 | 4395 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4396 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4397 |
XFree(cp); |
850 | 4398 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4399 |
} else if (prop->name == encodingAtom) { |
850 | 4400 |
cp = XGetAtomName(myDpy, prop->card32); |
4401 |
if (cp) { |
|
4402 |
encoding = __MKSTRING(cp COMMA_CON); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4403 |
#ifdef SUPERDEBUG |
850 | 4404 |
printf(" ENCODING -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4405 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4406 |
XFree(cp); |
850 | 4407 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4408 |
} else if (prop->name == registryAtom) { |
850 | 4409 |
cp = XGetAtomName(myDpy, prop->card32); |
4410 |
if (cp) { |
|
4411 |
registry = __MKSTRING(cp COMMA_CON); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4412 |
#ifdef SUPERDEBUG |
850 | 4413 |
printf(" REGISTRY -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4414 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4415 |
XFree(cp); |
850 | 4416 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4417 |
} else if (prop->name == charSetCollAtom) { |
850 | 4418 |
cp = XGetAtomName(myDpy, prop->card32); |
4419 |
if (cp) { |
|
4420 |
charSetCollections = __MKSTRING(cp COMMA_CON); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4421 |
#ifdef SUPERDEBUG |
850 | 4422 |
printf(" CHARSET_COLLECTIONS -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4423 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4424 |
XFree(cp); |
850 | 4425 |
} |
4426 |
} |
|
4427 |
prop++; |
|
4428 |
} |
|
4429 |
} |
|
4430 |
} |
|
4431 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4432 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4433 |
%}. |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4434 |
^ self |
850 | 4435 |
extractEncodingFromRegistry:registry |
4436 |
encoding:encoding |
|
4437 |
charSetCollections:charSetCollections |
|
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4438 |
! |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4439 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4440 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4441 |
"this is pure magic ..." |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4442 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4443 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4444 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4445 |
(registry notNil and:[registry notEmpty]) ifTrue:[ |
850 | 4446 |
enc := registry asLowercase asSymbol. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4447 |
] ifFalse:[ |
850 | 4448 |
(encoding notNil and:[encoding notEmpty]) ifTrue:[ |
4449 |
enc := encoding asLowercase asSymbol |
|
4450 |
] ifFalse:[ |
|
4451 |
charSets := charSetCollections. |
|
4452 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
|
4453 |
charSets := charSets asUppercase asCollectionOfWords. |
|
4454 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
4455 |
enc := #iso8859 |
|
4456 |
] ifFalse:[ |
|
4457 |
(charSets includes:'ISO8859') ifTrue:[ |
|
4458 |
enc := #iso8859 |
|
4459 |
] ifFalse:[ |
|
4460 |
(charSets includes:'ASCII') ifTrue:[ |
|
4461 |
enc := #ascii |
|
4462 |
] ifFalse:[ |
|
4463 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
4464 |
enc := #iso8859 |
|
4465 |
] |
|
4466 |
] |
|
4467 |
] |
|
4468 |
] |
|
4469 |
] |
|
4470 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4471 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4472 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4473 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4474 |
"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
|
4475 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4476 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4477 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4478 |
flushListOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4479 |
"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
|
4480 |
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
|
4481 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4482 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4483 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4484 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4485 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4486 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4487 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4488 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4489 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4490 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4491 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4492 |
|
991 | 4493 |
fontMetricsOf:fontId into:aBlock |
4494 |
"evaluate aBlock, passing a fonts metrics as arguments" |
|
4495 |
||
4496 |
|encoding avgAscent avgDescent |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4497 |
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
|
4498 |
res resX resY| |
991 | 4499 |
|
994 | 4500 |
%{ |
991 | 4501 |
XFontStruct *f; |
4502 |
int len; |
|
4503 |
||
4504 |
if (ISCONNECTED) { |
|
994 | 4505 |
if (__isExternalAddress(fontId)) { |
4506 |
f = _FontVal(fontId); |
|
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
4507 |
if (f) { |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4508 |
#ifdef NOTDEF |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4509 |
char *cp; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4510 |
XFontProp *prop; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4511 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4512 |
n = f->n_properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4513 |
prop = f->properties; |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4514 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4515 |
if (prop) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4516 |
while (n--) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4517 |
if (prop->name == RESOLUTION_X) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4518 |
resX = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4519 |
} else if (prop->name == RESOLUTION_Y) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4520 |
resY = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4521 |
} else if (prop->name == RESOLUTION) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4522 |
res = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4523 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4524 |
prop++; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4525 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4526 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4527 |
#endif |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4528 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4529 |
avgAscent = __MKSMALLINT(f->ascent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4530 |
avgDescent = __MKSMALLINT(f->descent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4531 |
maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4532 |
maxDescent = __MKSMALLINT(f->max_bounds.descent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4533 |
minWidth = __MKSMALLINT(f->min_bounds.width); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4534 |
maxWidth = __MKSMALLINT(f->max_bounds.width); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4535 |
BEGIN_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4536 |
len = XTextWidth(f, " ", 1); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4537 |
END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4538 |
avgWidth = __MKSMALLINT( len ); |
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
4539 |
} |
991 | 4540 |
} |
4541 |
} |
|
4542 |
%}. |
|
4543 |
encoding := self encodingOf:fontId. |
|
4544 |
aBlock value:encoding |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4545 |
value:avgAscent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4546 |
value:avgDescent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4547 |
value:maxAscent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4548 |
value:maxDescent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4549 |
value:minWidth |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4550 |
value:maxWidth |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4551 |
value:avgWidth |
991 | 4552 |
! |
4553 |
||
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4554 |
fontResolutionOf:fontId |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4555 |
"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
|
4556 |
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
|
4557 |
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
|
4558 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4559 |
|res resX resY| |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4560 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4561 |
%{ |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4562 |
XFontStruct *f; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4563 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4564 |
if (ISCONNECTED) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4565 |
if (__isExternalAddress(fontId)) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4566 |
f = _FontVal(fontId); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4567 |
if (f) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4568 |
char *cp; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4569 |
XFontProp *prop; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4570 |
Atom resolutionXAtom, resolutionYAtom; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4571 |
int n; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4572 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4573 |
n = f->n_properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4574 |
prop = f->properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4575 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4576 |
if (prop) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4577 |
resolutionXAtom = XInternAtom(myDpy, "RESOLUTION_X", True); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4578 |
resolutionYAtom = XInternAtom(myDpy, "RESOLUTION_Y", True); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4579 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4580 |
while (n--) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4581 |
if (prop->name == resolutionXAtom) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4582 |
resX = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4583 |
} else if (prop->name == resolutionYAtom) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4584 |
resY = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4585 |
} else if (prop->name == XA_RESOLUTION) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4586 |
res = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4587 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4588 |
prop++; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4589 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4590 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4591 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4592 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4593 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4594 |
%}. |
1046 | 4595 |
(resX notNil and:[resY notNil]) ifTrue:[ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4596 |
^ resX @ resY |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4597 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4598 |
res notNil ifTrue:[ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4599 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4600 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4601 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4602 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4603 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4604 |
fullNameOf:aFontId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4605 |
"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
|
4606 |
used for user feed-back (for example: in the fontPanel). |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4607 |
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
|
4608 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4609 |
|fullName fontName| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4610 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4611 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4612 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4613 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4614 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4615 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4616 |
Atom fontAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4617 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4618 |
fontAtom = XInternAtom(myDpy, "FONT", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4619 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4620 |
if (ISCONNECTED) { |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4621 |
if (__isExternalAddress(aFontId)) { |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4622 |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4623 |
f = _FontVal(aFontId); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4624 |
if (f) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4625 |
n = f->n_properties; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4626 |
prop = f->properties; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4627 |
if (prop) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4628 |
while (n--) { |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4629 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4630 |
cp = XGetAtomName(myDpy, prop->name); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4631 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4632 |
XFree(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4633 |
#endif |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4634 |
if (prop->name == XA_FULL_NAME) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4635 |
cp = XGetAtomName(myDpy, prop->card32); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4636 |
if (cp) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4637 |
fullName = __MKSTRING(cp COMMA_CON); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4638 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4639 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4640 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4641 |
XFree(cp); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4642 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4643 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4644 |
if (prop->name == fontAtom) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4645 |
cp = XGetAtomName(myDpy, prop->card32); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4646 |
if (cp) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4647 |
fontName = __MKSTRING(cp COMMA_CON); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4648 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4649 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4650 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4651 |
XFree(cp); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4652 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4653 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4654 |
prop++; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4655 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4656 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4657 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4658 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4659 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4660 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4661 |
(fullName notNil and:[fullName notEmpty]) ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4662 |
^ fullName |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4663 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4664 |
^ fontName |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4665 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4666 |
|
295 | 4667 |
getAvailableFontsMatching:pattern |
4668 |
"return an Array filled with font names matching aPattern" |
|
4669 |
||
4670 |
%{ /* UNLIMITEDSTACK */ |
|
4671 |
||
4672 |
int nnames = 1500; |
|
4673 |
int available = nnames + 1; |
|
4674 |
char **fonts; |
|
4675 |
OBJ arr, str; |
|
4676 |
int i; |
|
4677 |
||
4678 |
if (ISCONNECTED) { |
|
4679 |
if (__isString(pattern)) { |
|
4680 |
for (;;) { |
|
4681 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
4682 |
if ((fonts == NULL) || (available < nnames)) break; |
|
4683 |
XFreeFontNames(fonts); |
|
4684 |
nnames = available * 2; |
|
4685 |
} |
|
4686 |
if (fonts == NULL) { |
|
4687 |
RETURN ( nil ); |
|
4688 |
} |
|
4689 |
/* |
|
4690 |
* now, that we know the number of font names, |
|
4691 |
* create the array ... |
|
4692 |
*/ |
|
4693 |
arr = __ARRAY_NEW_INT(available); |
|
4694 |
if (! arr) { |
|
4695 |
RETURN (nil); |
|
4696 |
} |
|
4697 |
/* |
|
4698 |
* ... and fill it |
|
4699 |
*/ |
|
4700 |
for (i=0; i<available; i++) { |
|
350 | 4701 |
__PROTECT__(arr); |
295 | 4702 |
str = __MKSTRING(fonts[i] COMMA_CON); |
350 | 4703 |
__UNPROTECT__(arr); |
295 | 4704 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
4705 |
} |
|
4706 |
RETURN (arr); |
|
4707 |
} |
|
4708 |
} |
|
4709 |
%}. |
|
4710 |
^ nil |
|
4711 |
! |
|
4712 |
||
4713 |
getDefaultFont |
|
4714 |
"return a default font id - used when class Font cannot |
|
4715 |
find anything usable" |
|
4716 |
||
4717 |
^ self createFontFor:'fixed' |
|
4718 |
! |
|
4719 |
||
4720 |
getFontWithFamily:familyString face:faceString |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4721 |
style:styleArgString size:sizeArg encoding:encodingSym |
295 | 4722 |
|
4723 |
"try to get the specified font, if not available, try next smaller |
|
4724 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
4725 |
as family and the other parameters as nil. For example, the cursor font |
|
4726 |
can be aquired that way." |
|
4727 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4728 |
|styleString theName theId xlatedStyle id spacing| |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4729 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4730 |
styleString := styleArgString. |
295 | 4731 |
|
4732 |
"special: if face is nil, allow access to X-fonts" |
|
4733 |
faceString isNil ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4734 |
sizeArg notNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4735 |
theName := familyString , '-' , sizeArg printString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4736 |
] ifFalse:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4737 |
theName := familyString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4738 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4739 |
theName isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4740 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4741 |
mhmh - fall back to the default font |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4742 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4743 |
theName := 'fixed' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4744 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4745 |
theId := self createFontFor:theName. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4746 |
theId isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4747 |
theId := self getDefaultFont |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4748 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4749 |
^ theId |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4750 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4751 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4752 |
"/ 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
|
4753 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4754 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4755 |
((styleString endsWith:'-narrow') |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4756 |
or:[styleString endsWith:'-semicondensed']) ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4757 |
|i| |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4758 |
i := styleString lastIndexOf:$-. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4759 |
spacing := styleString copyFrom:(i+1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4760 |
styleString := styleString copyTo:(i-1). |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4761 |
] ifFalse:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4762 |
spacing := 'normal'. |
295 | 4763 |
]. |
4764 |
||
4765 |
xlatedStyle := styleString. |
|
4766 |
xlatedStyle notNil ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4767 |
xlatedStyle := xlatedStyle first asString |
295 | 4768 |
]. |
4769 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4770 |
id := self |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4771 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4772 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4773 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4774 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4775 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4776 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4777 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4778 |
registry:encodingSym |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4779 |
encoding:'*'. |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4780 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4781 |
id isNil ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4782 |
(encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4783 |
"/ too stupid: encodings come in both cases |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4784 |
"/ and X does not ignore case |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4785 |
"/ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4786 |
id := self |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4787 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4788 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4789 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4790 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4791 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4792 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4793 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4794 |
registry:encodingSym asUppercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4795 |
encoding:'*'. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4796 |
id isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4797 |
id := self |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4798 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4799 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4800 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4801 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4802 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4803 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4804 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4805 |
registry:encodingSym asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4806 |
encoding:'*'. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4807 |
] |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4808 |
] |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4809 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4810 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4811 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4812 |
"Modified: 24.2.1996 / 22:37:24 / cg" |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4813 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
295 | 4814 |
! |
4815 |
||
4816 |
getFontWithFoundry:foundry family:family weight:weight |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4817 |
slant:slant spacing:spc pixelSize:pSize size:size |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4818 |
registry:registry encoding:encoding |
295 | 4819 |
|
4820 |
"get the specified font, if not available, return nil. |
|
4821 |
This is the new font creation method - all others will be changed to |
|
4822 |
use this entry. |
|
4823 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
4824 |
||
4825 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
4826 |
family: 'helvetica' 'courier' 'times' ... |
|
4827 |
weight: 'bold' 'medium' 'demi' ... |
|
4828 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
4829 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
4830 |
pixelSize: 16,18 ... usually left empty |
|
4831 |
size: size in point (1/72th of an inch) |
|
4832 |
registry: iso8859, sgi ... '*' |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4833 |
encoding: vendor specific encoding (usually '*') |
295 | 4834 |
" |
4835 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4836 |
|theName sizeMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4837 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4838 |
pSizeMatch registryMatch encodingMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4839 |
id| |
295 | 4840 |
|
4841 |
"this works only on 'Release >= 3' - X-servers" |
|
4842 |
"name is: |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4843 |
-foundry-family -weight -slant- |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4844 |
sony helvetica bold r |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4845 |
adobe courier medium i |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4846 |
msic fixed o |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4847 |
... ... |
295 | 4848 |
" |
4849 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4850 |
size isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4851 |
sizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4852 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4853 |
sizeMatch := size printString , '0' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4854 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4855 |
foundry isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4856 |
foundryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4857 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4858 |
foundryMatch := foundry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4859 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4860 |
family isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4861 |
familyMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4862 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4863 |
familyMatch := family |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4864 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4865 |
weight isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4866 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4867 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4868 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4869 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4870 |
slant isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4871 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4872 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4873 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4874 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4875 |
spc isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4876 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4877 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4878 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4879 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4880 |
pSize isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4881 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4882 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4883 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4884 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4885 |
registry isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4886 |
registryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4887 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4888 |
registryMatch := registry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4889 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4890 |
encoding isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4891 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4892 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4893 |
encodingMatch := encoding |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4894 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4895 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4896 |
theName := ('-' , foundryMatch, |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4897 |
'-' , familyMatch, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4898 |
'-' , weightMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4899 |
'-' , slantMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4900 |
'-' , spcMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4901 |
'-*' , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4902 |
'-' , pSizeMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4903 |
'-' , sizeMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4904 |
'-*-*-*-*' , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4905 |
'-' , registryMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4906 |
'-' , encodingMatch). |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4907 |
|
697 | 4908 |
"/ Transcript showCR:theName; endEntry. |
295 | 4909 |
|
4910 |
^ self createFontFor:theName. |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4911 |
|
295 | 4912 |
|
4913 |
" |
|
4914 |
Display getFontWithFoundry:'*' |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4915 |
family:'courier' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4916 |
weight:'medium' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4917 |
slant:'r' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4918 |
spacing:nil |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4919 |
pixelSize:nil |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4920 |
size:13 |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4921 |
registry:'iso8859' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4922 |
encoding:'*' |
295 | 4923 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4924 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4925 |
"Modified: 24.2.1996 / 22:33:29 / cg" |
295 | 4926 |
! |
4927 |
||
4928 |
listOfAvailableFonts |
|
4929 |
"return a list with all available fonts on this display. |
|
4930 |
Since this takes a long time, keep the result of the query for the |
|
4931 |
next time. The elements of the returned collection are instances of |
|
4932 |
FontDescription." |
|
4933 |
||
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
4934 |
|"stream aName fntDescr" names| |
295 | 4935 |
|
4936 |
listOfXFonts isNil ifTrue:[ |
|
4937 |
"/ |
|
4938 |
"/ old code; using a pipe to xlsfonts |
|
4939 |
"/ |
|
4940 |
"/ stream := PipeStream readingFrom:'xlsfonts ''*'''. |
|
4941 |
"/ stream isNil ifTrue:[^ nil]. |
|
4942 |
"/ listOfXFonts := OrderedCollection new. |
|
4943 |
"/ [stream atEnd] whileFalse:[ |
|
4944 |
"/ aName := stream nextLine. |
|
4945 |
"/ aName notNil ifTrue:[ |
|
4946 |
"/ self decomposeXFontName:aName into: |
|
4947 |
"/ [:family :face :style :size :coding | |
|
4948 |
"/ family notNil ifTrue:[ |
|
4949 |
"/ fntDescr := FontDescription |
|
4950 |
"/ family:family |
|
4951 |
"/ face:face |
|
4952 |
"/ style:style |
|
4953 |
"/ size:size |
|
4954 |
"/ encoding:coding. |
|
4955 |
"/ listOfXFonts add:fntDescr |
|
4956 |
"/ ] |
|
4957 |
"/ ] |
|
4958 |
"/ ] |
|
4959 |
"/ ]. |
|
4960 |
"/ stream close. |
|
4961 |
"/ "if xlsfont is broken ... (hey sco)" |
|
4962 |
"/ (listOfXFonts size == 0) ifTrue:[ |
|
4963 |
"/ listOfXFonts := nil |
|
4964 |
"/ ] ifFalse:[ |
|
4965 |
"/ listOfXFonts sort:[:a :b | a family < b family]. |
|
4966 |
"/ ]. |
|
4967 |
||
850 | 4968 |
"/ |
4969 |
"/ new code: |
|
4970 |
"/ use new primitive to get font names; |
|
4971 |
"/ this is much faster, and also works on systems where |
|
4972 |
"/ a) xlsfonts is broken (sco) |
|
4973 |
"/ b) xlsfonts is not available (aix) |
|
4974 |
"/ |
|
4975 |
names := self getAvailableFontsMatching:'*'. |
|
4976 |
names isNil ifTrue:[ |
|
4977 |
"no names returned ..." |
|
4978 |
^ nil |
|
4979 |
]. |
|
4980 |
listOfXFonts := names collect:[:aName | |
|
4981 |
|fntDescr| |
|
4982 |
||
4983 |
(self decomposeXFontName:aName into: |
|
4984 |
[:family :face :style :size :coding | |
|
4985 |
family notNil ifTrue:[ |
|
4986 |
fntDescr := FontDescription |
|
4987 |
family:family |
|
4988 |
face:face |
|
4989 |
style:style |
|
4990 |
size:size |
|
4991 |
encoding:coding. |
|
4992 |
] ifFalse:[ |
|
4993 |
fntDescr := FontDescription |
|
4994 |
name:aName |
|
4995 |
] |
|
4996 |
] |
|
4997 |
) ifFalse:[ |
|
4998 |
fntDescr := FontDescription name:aName. |
|
4999 |
]. |
|
5000 |
fntDescr |
|
5001 |
]. |
|
295 | 5002 |
|
5003 |
]. |
|
5004 |
^ listOfXFonts |
|
5005 |
||
5006 |
" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5007 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5008 |
|
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5009 |
Display getAvailableFontsMatching:'*'. |
295 | 5010 |
" |
5011 |
||
5012 |
"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
|
5013 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 5014 |
! |
5015 |
||
5016 |
releaseFont:aFontId |
|
5017 |
||
5018 |
%{ /* NOCONTEXT */ |
|
5019 |
||
5020 |
XFontStruct *f; |
|
5021 |
||
5022 |
if (ISCONNECTED) { |
|
5023 |
if (__isExternalAddress(aFontId)) { |
|
5024 |
f = _FontVal(aFontId); |
|
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
5025 |
if (f) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5026 |
BEGIN_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5027 |
XFreeFont(myDpy, f); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5028 |
#ifdef COUNT_RESOURCES |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5029 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5030 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5031 |
END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5032 |
RETURN ( self ); |
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
5033 |
} |
295 | 5034 |
} |
5035 |
} |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5036 |
%}. |
295 | 5037 |
self primitiveFailed |
5038 |
! |
|
5039 |
||
466 | 5040 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 5041 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
5042 |
on this display. |
|
5043 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
5044 |
||
5045 |
|sizes| |
|
5046 |
||
466 | 5047 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 5048 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5049 |
"special: in X11R5 and above, size 0 means: |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5050 |
there are scaled versions in all sizes available" |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5051 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5052 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64) |
295 | 5053 |
]. |
5054 |
^ sizes |
|
5055 |
||
5056 |
" |
|
5057 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
5058 |
" |
|
466 | 5059 |
|
5060 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 5061 |
! |
5062 |
||
5063 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
5064 |
||
5065 |
%{ /* NOCONTEXT */ |
|
5066 |
||
5067 |
XFontStruct *f; |
|
5068 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5069 |
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
|
5070 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5071 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5072 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5073 |
int nInstBytes; |
295 | 5074 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5075 |
if (ISCONNECTED) { |
850 | 5076 |
if (__bothSmallInteger(index1, index2) |
5077 |
&& __isExternalAddress(aFontId) |
|
5078 |
&& __isNonNilObject(aString)) { |
|
5079 |
f = _FontVal(aFontId); |
|
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
5080 |
if (! f) goto fail; |
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
5081 |
|
850 | 5082 |
i1 = __intVal(index1) - 1; |
5083 |
cls = __qClass(aString); |
|
5084 |
||
5085 |
if (i1 >= 0) { |
|
5086 |
i2 = __intVal(index2) - 1; |
|
5087 |
if (i2 < i1) { |
|
5088 |
RETURN (self); |
|
5089 |
} |
|
5090 |
||
5091 |
cp = (char *) _stringVal(aString); |
|
5092 |
l = i2 - i1 + 1; |
|
5093 |
||
5094 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
5095 |
n = _stringSize(aString); |
|
5096 |
if (i2 < n) { |
|
5097 |
cp += i1; |
|
5098 |
BEGIN_INTERRUPTSBLOCKED |
|
5099 |
len = XTextWidth(f, cp, l); |
|
5100 |
END_INTERRUPTSBLOCKED |
|
5101 |
RETURN ( __MKSMALLINT(len) ); |
|
5102 |
} |
|
5103 |
} |
|
5104 |
||
5105 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5106 |
cp += nInstBytes; |
|
5107 |
||
5108 |
if (__isBytes(aString)) { |
|
5109 |
n = __byteArraySize(aString) - nInstBytes; |
|
5110 |
if (i2 < n) { |
|
5111 |
cp += i1; |
|
5112 |
BEGIN_INTERRUPTSBLOCKED |
|
5113 |
len = XTextWidth(f, cp, l); |
|
5114 |
END_INTERRUPTSBLOCKED |
|
5115 |
RETURN ( __MKSMALLINT(len) ); |
|
5116 |
} |
|
5117 |
} |
|
5118 |
||
5119 |
/* TWOBYTESTRINGS */ |
|
5120 |
if (__isWords(aString)) { |
|
5121 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
5122 |
||
5123 |
if (i2 < n) { |
|
5124 |
union { |
|
5125 |
char b[2]; |
|
5126 |
unsigned short s; |
|
5127 |
} u; |
|
5128 |
int i; |
|
5129 |
XChar2b *cp2 = (XChar2b *)0; |
|
5130 |
int mustFree = 0; |
|
5131 |
||
5132 |
cp += (i1 * 2); |
|
5133 |
if (l > 1000) l = 1000; |
|
5134 |
||
5135 |
/* |
|
5136 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
5137 |
* X expects them MSB first |
|
5138 |
* convert as required |
|
5139 |
*/ |
|
5140 |
||
5141 |
u.s = 0x1234; |
|
5142 |
if (u.b[0] != 0x12) { |
|
5143 |
if (l <= NLOCALBUFFER) { |
|
5144 |
cp2 = xlatebuffer; |
|
5145 |
} else { |
|
5146 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
5147 |
mustFree = 1; |
|
5148 |
} |
|
5149 |
for (i=0; i<l; i++) { |
|
5150 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
5151 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
5152 |
} |
|
5153 |
cp = (char *) cp2; |
|
5154 |
} |
|
5155 |
BEGIN_INTERRUPTSBLOCKED |
|
5156 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
|
5157 |
END_INTERRUPTSBLOCKED |
|
5158 |
||
5159 |
if (mustFree) { |
|
5160 |
free(cp2); |
|
5161 |
} |
|
5162 |
||
5163 |
RETURN ( __MKSMALLINT(len) ); |
|
5164 |
} |
|
5165 |
} |
|
5166 |
} |
|
5167 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5168 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5169 |
#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
|
5170 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5171 |
%}. |
295 | 5172 |
self primitiveFailed. |
5173 |
^ nil |
|
5174 |
! |
|
5175 |
||
5176 |
widthOf:aString inFont:aFontId |
|
5177 |
||
5178 |
%{ /* NOCONTEXT */ |
|
5179 |
||
5180 |
XFontStruct *f; |
|
5181 |
char *cp; |
|
5182 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
5183 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5184 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5185 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5186 |
int nInstBytes; |
295 | 5187 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5188 |
if (ISCONNECTED) { |
850 | 5189 |
if (__isExternalAddress(aFontId) |
5190 |
&& __isNonNilObject(aString)) { |
|
5191 |
f = _FontVal(aFontId); |
|
995
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
5192 |
if (! f) goto fail; |
2f2c0b2bff1a
check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents:
994
diff
changeset
|
5193 |
|
850 | 5194 |
cls = __qClass(aString); |
5195 |
||
5196 |
cp = (char *)_stringVal(aString); |
|
5197 |
||
5198 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
5199 |
n = _stringSize(aString); |
|
5200 |
BEGIN_INTERRUPTSBLOCKED |
|
5201 |
len = XTextWidth(f, cp, n); |
|
5202 |
END_INTERRUPTSBLOCKED |
|
5203 |
RETURN ( __MKSMALLINT(len) ); |
|
5204 |
} |
|
5205 |
||
5206 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5207 |
cp += nInstBytes; |
|
5208 |
||
5209 |
if (__isBytes(aString)) { |
|
5210 |
n = __byteArraySize(aString) - nInstBytes; |
|
5211 |
||
5212 |
BEGIN_INTERRUPTSBLOCKED |
|
5213 |
len = XTextWidth(f, cp, n); |
|
5214 |
END_INTERRUPTSBLOCKED |
|
5215 |
RETURN ( __MKSMALLINT(len) ); |
|
5216 |
} |
|
5217 |
||
5218 |
/* TWOBYTESTRINGS */ |
|
5219 |
if (__isWords(aString)) { |
|
5220 |
union { |
|
5221 |
char b[2]; |
|
5222 |
unsigned short s; |
|
5223 |
} u; |
|
5224 |
int i; |
|
5225 |
XChar2b *cp2; |
|
5226 |
int mustFree = 0; |
|
5227 |
||
5228 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
5229 |
if (n > 1000) n = 1000; |
|
5230 |
||
5231 |
/* |
|
5232 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
5233 |
* X expects them MSB first |
|
5234 |
* convert as required |
|
5235 |
*/ |
|
5236 |
||
5237 |
u.s = 0x1234; |
|
5238 |
if (u.b[0] != 0x12) { |
|
5239 |
if (n <= NLOCALBUFFER) { |
|
5240 |
cp2 = xlatebuffer; |
|
5241 |
} else { |
|
5242 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
5243 |
mustFree = 1; |
|
5244 |
} |
|
5245 |
||
5246 |
for (i=0; i<n; i++) { |
|
5247 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
5248 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
5249 |
} |
|
5250 |
cp = (char *) cp2; |
|
5251 |
} |
|
5252 |
||
5253 |
BEGIN_INTERRUPTSBLOCKED |
|
5254 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
|
5255 |
END_INTERRUPTSBLOCKED |
|
5256 |
||
5257 |
if (mustFree) { |
|
5258 |
free(cp2); |
|
5259 |
} |
|
5260 |
||
5261 |
RETURN ( __MKSMALLINT(len) ); |
|
5262 |
} |
|
5263 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5264 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5265 |
#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
|
5266 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5267 |
%}. |
295 | 5268 |
self primitiveFailed. |
5269 |
^ nil |
|
5270 |
! ! |
|
5271 |
||
5272 |
!XWorkstation methodsFor:'grabbing '! |
|
5273 |
||
5274 |
allowEvents:mode |
|
5275 |
%{ /* NOCONTEXT */ |
|
5276 |
||
5277 |
int _mode, ok = 1; |
|
5278 |
||
5279 |
if (mode == @symbol(asyncPointer)) |
|
5280 |
_mode = AsyncPointer; |
|
5281 |
else if (mode == @symbol(syncPointer)) |
|
5282 |
_mode = SyncPointer; |
|
5283 |
else if (mode == @symbol(asyncKeyboard)) |
|
5284 |
_mode = AsyncKeyboard; |
|
5285 |
else if (mode == @symbol(syncKeyboard)) |
|
5286 |
_mode = SyncKeyboard; |
|
5287 |
else if (mode == @symbol(syncBoth)) |
|
5288 |
_mode = SyncBoth; |
|
5289 |
else if (mode == @symbol(asyncBoth)) |
|
5290 |
_mode = AsyncBoth; |
|
5291 |
else if (mode == @symbol(replayPointer)) |
|
5292 |
_mode = ReplayPointer; |
|
5293 |
else if (mode == @symbol(replayKeyboard)) |
|
5294 |
_mode = ReplayKeyboard; |
|
5295 |
else |
|
5296 |
ok = 0; |
|
5297 |
||
5298 |
if (ok) { |
|
5299 |
BEGIN_INTERRUPTSBLOCKED |
|
5300 |
XAllowEvents(myDpy, _mode, CurrentTime); |
|
5301 |
END_INTERRUPTSBLOCKED |
|
5302 |
RETURN (self); |
|
5303 |
} |
|
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5304 |
%}. |
295 | 5305 |
self primitiveFailed |
5306 |
! |
|
5307 |
||
5308 |
grabKeyboardIn:aWindowId |
|
5309 |
"grab the keyboard" |
|
5310 |
||
5311 |
%{ /* NOCONTEXT */ |
|
5312 |
int result, ok; |
|
5313 |
||
5314 |
if (__isExternalAddress(aWindowId)) { |
|
5315 |
BEGIN_INTERRUPTSBLOCKED |
|
5316 |
result = XGrabKeyboard(myDpy, |
|
5317 |
_WindowVal(aWindowId), |
|
5318 |
True /* False */, |
|
5319 |
GrabModeAsync, |
|
5320 |
GrabModeAsync, |
|
5321 |
CurrentTime); |
|
5322 |
END_INTERRUPTSBLOCKED |
|
5323 |
ok = 0; |
|
5324 |
switch(result) { |
|
5325 |
case AlreadyGrabbed: |
|
5326 |
printf("XWORKSTAT: grab keyboard: AlreadyGrabbed\n"); |
|
5327 |
break; |
|
5328 |
case GrabNotViewable: |
|
5329 |
printf("XWORKSTAT: grab keyboard: GrabNotViewable\n"); |
|
5330 |
break; |
|
5331 |
case GrabInvalidTime: |
|
5332 |
printf("XWORKSTAT: grab keyboard: InvalidTime\n"); |
|
5333 |
break; |
|
5334 |
case GrabFrozen: |
|
5335 |
printf("XWORKSTAT: grab keyboard: Frozen\n"); |
|
5336 |
break; |
|
5337 |
default: |
|
5338 |
ok = 1; |
|
5339 |
break; |
|
5340 |
} |
|
5341 |
if (! ok) { |
|
5342 |
XUngrabKeyboard(myDpy, CurrentTime); |
|
5343 |
RETURN (false); |
|
5344 |
} |
|
5345 |
||
5346 |
RETURN ( true ); |
|
5347 |
} |
|
5348 |
%} |
|
5349 |
. |
|
5350 |
self primitiveFailed |
|
5351 |
! |
|
5352 |
||
5353 |
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
5354 |
"grap the pointer - return true if ok" |
|
5355 |
||
5356 |
%{ /* NOCONTEXT */ |
|
5357 |
||
5358 |
int result, ok; |
|
5359 |
Window confineWin; |
|
5360 |
Cursor curs; |
|
5361 |
int pointer_mode, keyboard_mode; |
|
5362 |
||
5363 |
if (__isExternalAddress(aWindowId)) { |
|
5364 |
if (__isExternalAddress(confineId)) |
|
5365 |
confineWin = _WindowVal(confineId); |
|
5366 |
else |
|
5367 |
confineWin = (Window) None; |
|
5368 |
||
5369 |
if (__isExternalAddress(aCursorId)) |
|
5370 |
curs = _CursorVal(aCursorId); |
|
5371 |
else |
|
5372 |
curs = (Cursor) None; |
|
5373 |
||
5374 |
if (pMode == @symbol(sync)) |
|
5375 |
pointer_mode = GrabModeSync; |
|
5376 |
else |
|
5377 |
pointer_mode = GrabModeAsync; |
|
5378 |
||
5379 |
if (kMode == @symbol(sync)) |
|
5380 |
keyboard_mode = GrabModeSync; |
|
5381 |
else |
|
5382 |
keyboard_mode = GrabModeAsync; |
|
5383 |
||
5384 |
BEGIN_INTERRUPTSBLOCKED |
|
5385 |
result = XGrabPointer(myDpy, |
|
5386 |
_WindowVal(aWindowId), |
|
5387 |
False, |
|
5388 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask, |
|
5389 |
pointer_mode, keyboard_mode, |
|
5390 |
confineWin, |
|
5391 |
curs, |
|
5392 |
CurrentTime); |
|
5393 |
END_INTERRUPTSBLOCKED |
|
5394 |
||
5395 |
ok = 0; |
|
5396 |
switch (result) { |
|
5397 |
case AlreadyGrabbed: |
|
5398 |
printf("XWORKSTAT: grab pointer: AlreadyGrabbed\n"); |
|
5399 |
break; |
|
5400 |
case GrabNotViewable: |
|
5401 |
printf("XWORKSTAT: grab pointer: GrabNotViewable\n"); |
|
5402 |
break; |
|
5403 |
case GrabInvalidTime: |
|
5404 |
printf("XWORKSTAT: grab pointer: InvalidTime\n"); |
|
5405 |
break; |
|
5406 |
case GrabFrozen: |
|
5407 |
printf("XWORKSTAT: grab pointer: Frozen\n"); |
|
5408 |
break; |
|
5409 |
default: |
|
5410 |
ok = 1; |
|
5411 |
break; |
|
5412 |
} |
|
5413 |
||
5414 |
if (! ok) { |
|
5415 |
XUngrabPointer(myDpy, CurrentTime); |
|
5416 |
RETURN (false); |
|
5417 |
} |
|
5418 |
RETURN ( true ); |
|
5419 |
} |
|
5420 |
%} |
|
5421 |
. |
|
5422 |
self primitiveFailed |
|
5423 |
! |
|
5424 |
||
5425 |
ungrabKeyboard |
|
5426 |
"release the keyboard" |
|
5427 |
||
5428 |
%{ /* NOCONTEXT */ |
|
5429 |
||
5430 |
if (ISCONNECTED) { |
|
5431 |
BEGIN_INTERRUPTSBLOCKED |
|
5432 |
XUngrabKeyboard(myDpy, CurrentTime); |
|
5433 |
XSync(myDpy, 0); |
|
5434 |
END_INTERRUPTSBLOCKED |
|
5435 |
} |
|
5436 |
%}. |
|
5437 |
activeKeyboardGrab := nil |
|
5438 |
! |
|
5439 |
||
5440 |
ungrabPointer |
|
5441 |
"release the pointer" |
|
5442 |
||
5443 |
%{ /* NOCONTEXT */ |
|
5444 |
||
5445 |
if (ISCONNECTED) { |
|
5446 |
BEGIN_INTERRUPTSBLOCKED |
|
5447 |
XUngrabPointer(myDpy, CurrentTime); |
|
5448 |
XSync(myDpy, 0); |
|
5449 |
END_INTERRUPTSBLOCKED |
|
5450 |
} |
|
5451 |
%}. |
|
5452 |
activePointerGrab := nil |
|
5453 |
! ! |
|
5454 |
||
5455 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
5456 |
||
5457 |
noClipIn:aGCId |
|
5458 |
"disable clipping rectangle" |
|
5459 |
||
5460 |
%{ /* NOCONTEXT */ |
|
5461 |
||
5462 |
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
|
5463 |
GC gc; |
295 | 5464 |
|
5465 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5466 |
gc = _GCVal(aGCId); |
295 | 5467 |
gcv.clip_mask = None; |
5468 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
|
5469 |
RETURN ( self ); |
|
5470 |
} |
|
5471 |
%}. |
|
5472 |
self primitiveFailed |
|
5473 |
! |
|
5474 |
||
5475 |
setBackground:bgColorIndex in:aGCId |
|
5476 |
"set background color to be drawn with" |
|
5477 |
||
5478 |
%{ /* NOCONTEXT */ |
|
5479 |
||
5480 |
if (__isExternalAddress(aGCId) |
|
5481 |
&& __isSmallInteger(bgColorIndex)) { |
|
555 | 5482 |
XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); |
295 | 5483 |
RETURN ( self ); |
5484 |
} |
|
5485 |
%}. |
|
5486 |
self primitiveFailed |
|
5487 |
! |
|
5488 |
||
5489 |
setBitmapMask:aBitmapId in:aGCId |
|
5490 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
5491 |
||
5492 |
%{ /* NOCONTEXT */ |
|
5493 |
||
5494 |
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
|
5495 |
GC gc; |
295 | 5496 |
Pixmap bitmap; |
5497 |
||
5498 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5499 |
gc = _GCVal(aGCId); |
295 | 5500 |
if (__isExternalAddress(aBitmapId)) { |
5501 |
bitmap = _PixmapVal(aBitmapId); |
|
5502 |
XSetStipple(dpy, gc, bitmap); |
|
5503 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5504 |
RETURN ( self ); |
|
5505 |
} |
|
5506 |
if (aBitmapId == nil) { |
|
5507 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5508 |
RETURN ( self ); |
|
5509 |
} |
|
5510 |
} |
|
5511 |
%}. |
|
5512 |
self primitiveFailed |
|
5513 |
! |
|
5514 |
||
5515 |
setClipByChildren:aBool in:aGCId |
|
5516 |
"enable/disable drawing into child views" |
|
5517 |
||
5518 |
%{ /* NOCONTEXT */ |
|
5519 |
||
5520 |
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
|
5521 |
GC gc; |
295 | 5522 |
|
5523 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5524 |
gc = _GCVal(aGCId); |
295 | 5525 |
if (aBool == true) |
5526 |
gcv.subwindow_mode = ClipByChildren; |
|
5527 |
else |
|
5528 |
gcv.subwindow_mode = IncludeInferiors; |
|
5529 |
||
5530 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
|
5531 |
RETURN ( self ); |
|
5532 |
} |
|
5533 |
%}. |
|
5534 |
self primitiveFailed |
|
5535 |
! |
|
5536 |
||
5537 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId |
|
5538 |
"clip to a rectangle" |
|
5539 |
||
5540 |
%{ /* NOCONTEXT */ |
|
5541 |
||
5542 |
XRectangle r; |
|
5543 |
||
5544 |
if (__isExternalAddress(aGCId) |
|
5545 |
&& __bothSmallInteger(clipX, clipY) |
|
5546 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
555 | 5547 |
r.x = __intVal(clipX); |
5548 |
r.y = __intVal(clipY); |
|
5549 |
r.width = __intVal(clipWidth); |
|
5550 |
r.height = __intVal(clipHeight); |
|
295 | 5551 |
XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
5552 |
RETURN ( self ); |
|
5553 |
} |
|
5554 |
%}. |
|
5555 |
self primitiveFailed |
|
5556 |
! |
|
5557 |
||
788 | 5558 |
setDashes:dashList dashOffset:offset in:aGCId |
5559 |
"set line attributes" |
|
5560 |
||
5561 |
%{ /* NOCONTEXT */ |
|
5562 |
||
5563 |
if (__isExternalAddress(aGCId) |
|
5564 |
&& __isSmallInteger(offset) |
|
5565 |
&& __isByteArray(dashList)) { |
|
850 | 5566 |
XSetDashes(myDpy, _GCVal(aGCId), |
5567 |
__intVal(offset), |
|
5568 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
5569 |
__byteArraySize(dashList)); |
|
5570 |
RETURN ( self ); |
|
788 | 5571 |
} |
5572 |
bad: ; |
|
5573 |
%}. |
|
5574 |
" |
|
5575 |
either aGCId is invalid, |
|
5576 |
and/or dashList is not a byteArray |
|
5577 |
and/or offset is not a smallInteger |
|
5578 |
" |
|
5579 |
self primitiveFailed |
|
5580 |
! |
|
5581 |
||
295 | 5582 |
setFont:aFontId in:aGCId |
5583 |
"set font to be drawn in" |
|
5584 |
||
5585 |
%{ /* NOCONTEXT */ |
|
5586 |
||
5587 |
XFontStruct *f; |
|
5588 |
||
5589 |
if (__isExternalAddress(aFontId) |
|
5590 |
&& __isExternalAddress(aGCId)) { |
|
5591 |
f = (XFontStruct *) _FontVal(aFontId); |
|
5592 |
XSetFont(myDpy, _GCVal(aGCId), f->fid); |
|
5593 |
RETURN ( self ); |
|
5594 |
} |
|
5595 |
%}. |
|
5596 |
" |
|
5597 |
aGCId and/or aFontId are invalid |
|
5598 |
" |
|
5599 |
self primitiveFailed |
|
5600 |
! |
|
5601 |
||
5602 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
5603 |
"set foreground and background colors to be drawn with" |
|
5604 |
||
5605 |
%{ /* NOCONTEXT */ |
|
5606 |
||
5607 |
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
|
5608 |
GC gc; |
295 | 5609 |
|
5610 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
5611 |
&& __isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5612 |
gc = _GCVal(aGCId); |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5613 |
|
555 | 5614 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
5615 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
295 | 5616 |
RETURN ( self ); |
5617 |
} |
|
5618 |
%}. |
|
5619 |
self primitiveFailed |
|
5620 |
! |
|
5621 |
||
5622 |
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId |
|
5623 |
"set foreground and background colors to be drawn with using mask or |
|
5624 |
solid (if aBitmapId is nil)" |
|
5625 |
||
5626 |
%{ /* NOCONTEXT */ |
|
5627 |
||
5628 |
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
|
5629 |
GC gc; |
295 | 5630 |
|
5631 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5632 |
gc = _GCVal(aGCId); |
295 | 5633 |
if (__isSmallInteger(fgColor)) |
555 | 5634 |
XSetForeground(dpy, gc, __intVal(fgColor)); |
295 | 5635 |
if (__isSmallInteger(bgColor)) |
555 | 5636 |
XSetBackground(dpy, gc, __intVal(bgColor)); |
295 | 5637 |
|
5638 |
if (__isExternalAddress(aBitmapId)) { |
|
5639 |
XSetStipple(dpy, gc, _PixmapVal(aBitmapId)); |
|
5640 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5641 |
RETURN ( self ); |
|
5642 |
} |
|
5643 |
if (aBitmapId == nil) { |
|
5644 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5645 |
RETURN ( self ); |
|
5646 |
} |
|
5647 |
} |
|
5648 |
%}. |
|
5649 |
self primitiveFailed |
|
5650 |
! |
|
5651 |
||
5652 |
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId |
|
5653 |
"set foreground and background colors to be drawn with using mask or |
|
5654 |
solid (if aBitmapId is nil); also set lineWidth" |
|
5655 |
||
5656 |
%{ /* NOCONTEXT */ |
|
5657 |
||
5658 |
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
|
5659 |
GC gc; |
295 | 5660 |
|
5661 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5662 |
gc = _GCVal(aGCId); |
295 | 5663 |
if (__isSmallInteger(lw)) { |
555 | 5664 |
XSetLineAttributes(dpy, gc, __intVal(lw), |
295 | 5665 |
LineSolid, CapNotLast, JoinMiter); |
5666 |
} |
|
5667 |
if (__isSmallInteger(fgColor)) |
|
555 | 5668 |
XSetForeground(dpy, gc, __intVal(fgColor)); |
295 | 5669 |
if (__isSmallInteger(bgColor)) |
555 | 5670 |
XSetBackground(dpy, gc, __intVal(bgColor)); |
295 | 5671 |
|
5672 |
if (__isExternalAddress(aBitmapId)) { |
|
5673 |
XSetStipple(dpy, gc, _PixmapVal(aBitmapId)); |
|
5674 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5675 |
RETURN ( self ); |
|
5676 |
} |
|
5677 |
if (aBitmapId == nil) { |
|
5678 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5679 |
RETURN ( self ); |
|
5680 |
} |
|
5681 |
} |
|
5682 |
%}. |
|
5683 |
self primitiveFailed |
|
5684 |
! |
|
5685 |
||
5686 |
setForeground:fgColorIndex in:aGCId |
|
5687 |
"set foreground color to be drawn with" |
|
5688 |
||
5689 |
%{ /* NOCONTEXT */ |
|
5690 |
||
5691 |
if (__isExternalAddress(aGCId) |
|
5692 |
&& __isSmallInteger(fgColorIndex)) { |
|
555 | 5693 |
XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); |
295 | 5694 |
RETURN ( self ); |
5695 |
} |
|
5696 |
%}. |
|
5697 |
self primitiveFailed |
|
5698 |
! |
|
5699 |
||
5700 |
setFunction:aFunctionSymbol in:aGCId |
|
5701 |
"set alu function to be drawn with" |
|
5702 |
||
5703 |
%{ /* NOCONTEXT */ |
|
5704 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5705 |
GC gc; |
295 | 5706 |
int fun = -1; |
5707 |
||
5708 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5709 |
gc = _GCVal(aGCId); |
295 | 5710 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
5711 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
|
5712 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
|
5713 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
|
5714 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
|
5715 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
|
5716 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
|
5717 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
|
5718 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
|
5719 |
if (fun != -1) { |
|
5720 |
XSetFunction(myDpy, gc, fun); |
|
5721 |
RETURN ( self ); |
|
5722 |
} |
|
5723 |
} |
|
5724 |
%}. |
|
5725 |
" |
|
5726 |
either aGCId is not an integer, or an invalid symbol |
|
5727 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
5728 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
5729 |
" |
|
5730 |
self primitiveFailed |
|
5731 |
! |
|
5732 |
||
5733 |
setGraphicsExposures:aBoolean in:aGCId |
|
5734 |
"set or clear the graphics exposures flag" |
|
5735 |
||
5736 |
%{ /* NOCONTEXT */ |
|
5737 |
||
5738 |
if (__isExternalAddress(aGCId)) { |
|
5739 |
XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); |
|
5740 |
RETURN ( self ); |
|
5741 |
} |
|
5742 |
%} |
|
5743 |
. |
|
5744 |
self primitiveFailed |
|
5745 |
! |
|
5746 |
||
5747 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
5748 |
"set line attributes" |
|
5749 |
||
5750 |
%{ /* NOCONTEXT */ |
|
5751 |
||
5752 |
int x_style, x_cap, x_join; |
|
5753 |
||
5754 |
if (__isExternalAddress(aGCId) |
|
5755 |
&& __isSmallInteger(aNumber)) { |
|
5756 |
if (lineStyle == @symbol(solid)) x_style = LineSolid; |
|
5757 |
else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash; |
|
5758 |
else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash; |
|
5759 |
else goto bad; |
|
5760 |
||
5761 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
|
5762 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
|
5763 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
|
5764 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
|
5765 |
else goto bad; |
|
5766 |
||
5767 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
|
5768 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
|
5769 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
|
5770 |
else goto bad; |
|
5771 |
||
5772 |
XSetLineAttributes(myDpy, |
|
555 | 5773 |
_GCVal(aGCId), __intVal(aNumber), |
295 | 5774 |
x_style, x_cap, x_join); |
5775 |
RETURN ( self ); |
|
5776 |
} |
|
5777 |
bad: ; |
|
5778 |
%}. |
|
5779 |
" |
|
5780 |
either aGCId is invalid, |
|
5781 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
|
5782 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
5783 |
and/or joinStyle is none of #miter, #bevel, #round |
|
5784 |
" |
|
5785 |
self primitiveFailed |
|
5786 |
! |
|
5787 |
||
5788 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
5789 |
"set the mask origin" |
|
5790 |
||
5791 |
%{ /* NOCONTEXT */ |
|
5792 |
||
5793 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
|
555 | 5794 |
XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
295 | 5795 |
RETURN ( self ); |
5796 |
} |
|
5797 |
%}. |
|
5798 |
self primitiveFailed |
|
5799 |
! |
|
5800 |
||
5801 |
setPixmapMask:aPixmapId in:aGCId |
|
5802 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
5803 |
||
5804 |
%{ /* NOCONTEXT */ |
|
5805 |
||
5806 |
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
|
5807 |
GC gc; |
295 | 5808 |
Pixmap pixmap; |
5809 |
||
5810 |
if (__isExternalAddress(aGCId)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5811 |
gc = _GCVal(aGCId); |
295 | 5812 |
if (__isExternalAddress(aPixmapId)) { |
5813 |
pixmap = _PixmapVal(aPixmapId); |
|
5814 |
XSetTile(dpy, gc, pixmap); |
|
5815 |
XSetFillStyle(dpy, gc, FillTiled); |
|
5816 |
RETURN ( self ); |
|
5817 |
} |
|
5818 |
if (aPixmapId == nil) { |
|
5819 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5820 |
RETURN ( self ); |
|
5821 |
} |
|
5822 |
} |
|
5823 |
%}. |
|
5824 |
self primitiveFailed |
|
5825 |
! ! |
|
5826 |
||
5827 |
!XWorkstation methodsFor:'initialize / release'! |
|
5828 |
||
5829 |
close |
|
5830 |
"close down the connection to the X-server" |
|
5831 |
||
5832 |
%{ /* NOCONTEXT */ |
|
5833 |
||
5834 |
if (ISCONNECTED) { |
|
5835 |
BEGIN_INTERRUPTSBLOCKED |
|
5836 |
XCloseDisplay(myDpy); |
|
555 | 5837 |
__INST(displayId) = nil; |
295 | 5838 |
END_INTERRUPTSBLOCKED |
5839 |
} |
|
5840 |
%} |
|
5841 |
! |
|
5842 |
||
5843 |
initializeDefaultValues |
|
5844 |
buttonTranslation := ButtonTranslation. |
|
5845 |
multiClickTimeDelta := MultiClickTimeDelta. |
|
5846 |
||
5847 |
self initializeModifierMappings |
|
5848 |
! |
|
5849 |
||
5850 |
initializeEventBuffer |
|
5851 |
|sz| |
|
5852 |
||
5853 |
%{ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5854 |
sz = __MKSMALLINT(sizeof(XEvent) + 100); |
295 | 5855 |
%}. |
5856 |
eventBuffer isNil ifTrue:[ |
|
5857 |
eventBuffer := ByteArray new:sz. |
|
5858 |
]. |
|
5859 |
! |
|
5860 |
||
5861 |
initializeFor:aDisplayName |
|
5862 |
"initialize the receiver for a connection to an X-Server; |
|
5863 |
the argument, aDisplayName may be nil (for the default server from |
|
5864 |
DISPLAY-variable or command line argument) or the name of the server |
|
5865 |
as hostname:number" |
|
5866 |
||
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5867 |
|dpyName index arguments| |
295 | 5868 |
|
5869 |
dpyName := aDisplayName. |
|
5870 |
dpyName isNil ifTrue:[ |
|
5871 |
"look for a '-display xxx' argument" |
|
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5872 |
(arguments := Smalltalk commandLineArguments) notNil ifTrue:[ |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5873 |
index := arguments indexOf:'-display'. |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5874 |
(index between:1 and:(arguments size - 1)) ifTrue:[ |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5875 |
dpyName := arguments at:index+1 |
295 | 5876 |
] |
5877 |
] |
|
5878 |
]. |
|
5879 |
%{ |
|
5880 |
int scr; |
|
5881 |
Display *dpy; |
|
5882 |
Visual *visual; |
|
5883 |
XVisualInfo viproto; |
|
5884 |
XVisualInfo *vip; /* retured info */ |
|
5885 |
int maxRGBDepth; |
|
5886 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
5887 |
int rgbVisualID; |
|
5888 |
int nvi, i; |
|
5889 |
int shapeEventBase, shapeErrorBase; |
|
5890 |
int shmEventBase, shmErrorBase; |
|
5891 |
int faxEventBase, faxErrorBase; |
|
5892 |
char *type, *nm; |
|
5893 |
int dummy; |
|
5894 |
OBJ dpyID; |
|
5895 |
||
555 | 5896 |
if (__INST(displayId) != nil) { |
295 | 5897 |
/* |
5898 |
* already connected - you bad guy try to |
|
5899 |
* trick me manually ? |
|
5900 |
*/ |
|
5901 |
RETURN ( self ); |
|
5902 |
} |
|
5903 |
||
5904 |
BEGIN_INTERRUPTSBLOCKED |
|
5905 |
||
5906 |
if (__isString(dpyName)) |
|
5907 |
nm = (char *)_stringVal(dpyName); |
|
5908 |
else { |
|
5909 |
dpyName = __MKSTRING((char *)getenv("DISPLAY") COMMA_CON); |
|
5910 |
nm = NULL; |
|
5911 |
} |
|
5912 |
dpy = XOpenDisplay(nm); |
|
5913 |
||
5914 |
if (dpy) { |
|
555 | 5915 |
__INST(displayId) = dpyID = __MKOBJ(dpy); __STORE(self, dpyID); |
295 | 5916 |
|
5917 |
#ifdef SUPERDEBUG |
|
5918 |
XSynchronize(dpy, 1); |
|
5919 |
#endif |
|
5920 |
||
5921 |
XSetErrorHandler(__XErrorHandler__); |
|
5922 |
} |
|
5923 |
||
5924 |
END_INTERRUPTSBLOCKED |
|
5925 |
%}. |
|
5926 |
displayId isNil ifTrue:[ |
|
5927 |
'XWORKSTATION: cannot connect to Display.' errorPrintNL. |
|
5928 |
^ nil |
|
5929 |
]. |
|
5930 |
||
5931 |
dispatching := false. |
|
5932 |
dispatchingExpose := false. |
|
5933 |
isSlow := false. |
|
5934 |
shiftDown := false. |
|
5935 |
ctrlDown := false. |
|
5936 |
metaDown := false. |
|
5937 |
altDown := false. |
|
5938 |
motionEventCompression := true. |
|
5939 |
buttonsPressed := 0. |
|
5940 |
displayName := dpyName. |
|
5941 |
||
5942 |
protocolsAtom := nil. |
|
5943 |
deleteWindowAtom := nil. |
|
5944 |
saveYourselfAtom := nil. |
|
5945 |
quitAppAtom := nil. |
|
5946 |
||
5947 |
self initializeScreenProperties. |
|
5948 |
||
5949 |
self initializeDefaultValues. |
|
5950 |
self initializeEventBuffer. |
|
5951 |
self initializeSpecialFlags. |
|
5952 |
self initializeKeyboardMap. |
|
5953 |
||
5954 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
|
5955 |
! |
|
5956 |
||
5957 |
initializeModifierMappings |
|
5958 |
|map mod| |
|
5959 |
||
5960 |
"/ altModifiers := #(Alt_L Alt_R). |
|
5961 |
"/ metaModifiers := #(Meta_L Meta_R). |
|
5962 |
"/ ctrlModifiers := #(Control_L Control_R). |
|
5963 |
"/ shiftModifiers := #(Shift_L Shift_R). |
|
5964 |
||
5965 |
shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil. |
|
5966 |
altModifierMask := metaModifierMask := nil. |
|
5967 |
||
5968 |
map := self modifierMapping. |
|
342 | 5969 |
map isNil ifTrue:[ |
5970 |
"/ |
|
5971 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
|
5972 |
"/ setup some reasonable default. If that is not sufficient, |
|
5973 |
"/ you have to change things from your display.rc file. |
|
5974 |
"/ |
|
5975 |
altModifierMask := self modifier1Mask. |
|
5976 |
metaModifierMask := self modifier2Mask. |
|
5977 |
||
5978 |
shiftModifiers := #(Shift_L Shift_R Shift). |
|
5979 |
ctrlModifiers := #(Control_L Control_R Control). |
|
5980 |
metaModifiers := #(Alt_L Meta_L Meta_R Meta). |
|
5981 |
altModifiers := #(Alt_R Alt). |
|
5982 |
] ifFalse:[ |
|
5983 |
altModifierMask := 0. |
|
374 | 5984 |
metaModifierMask := 0. |
5985 |
||
5986 |
mod := map at:1. |
|
5987 |
mod notNil ifTrue:[ |
|
342 | 5988 |
shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
374 | 5989 |
]. |
5990 |
mod := map at:3. |
|
5991 |
mod notNil ifTrue:[ |
|
342 | 5992 |
ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
374 | 5993 |
]. |
5994 |
mod := map at:4. |
|
5995 |
mod notNil ifTrue:[ |
|
342 | 5996 |
metaModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
5997 |
metaModifierMask := 1 bitShift:(4-1). |
|
374 | 5998 |
]. |
5999 |
mod := map at:5. |
|
6000 |
mod notNil ifTrue:[ |
|
342 | 6001 |
altModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
6002 |
altModifierMask := 1 bitShift:(5-1). |
|
6003 |
] |
|
295 | 6004 |
]. |
6005 |
||
6006 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
6007 |
! |
|
6008 |
||
6009 |
initializeScreenProperties |
|
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6010 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6011 |
|
295 | 6012 |
%{ /* NOCONTEXT */ |
6013 |
||
6014 |
Display *dpy = myDpy; |
|
6015 |
int scr; |
|
6016 |
Visual *visual; |
|
6017 |
XVisualInfo viproto; |
|
6018 |
XVisualInfo *vip; /* retured info */ |
|
6019 |
int maxRGBDepth; |
|
6020 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
6021 |
int rgbVisualID; |
|
6022 |
int nvi, i; |
|
6023 |
int shapeEventBase, shapeErrorBase; |
|
6024 |
int shmEventBase, shmErrorBase; |
|
6025 |
int faxEventBase, faxErrorBase; |
|
6026 |
char *type, *nm; |
|
6027 |
int dummy; |
|
6028 |
int mask, shift, nBits; |
|
6029 |
||
6030 |
if (ISCONNECTED) { |
|
850 | 6031 |
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask); |
6032 |
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask); |
|
6033 |
||
6034 |
BEGIN_INTERRUPTSBLOCKED |
|
6035 |
||
6036 |
__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy)); |
|
6037 |
__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr)); |
|
6038 |
__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr)); |
|
6039 |
__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr)); |
|
6040 |
__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr)); |
|
6041 |
__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr)); |
|
6042 |
__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr)); |
|
6043 |
__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr)); |
|
6044 |
__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr)); |
|
295 | 6045 |
|
6046 |
#ifdef SHAPE |
|
850 | 6047 |
if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase)) |
6048 |
__INST(hasShapeExtension) = true; |
|
6049 |
else |
|
295 | 6050 |
#endif |
850 | 6051 |
__INST(hasShapeExtension) = false; |
295 | 6052 |
|
6053 |
#ifdef SHM |
|
850 | 6054 |
if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase)) |
6055 |
__INST(hasShmExtension) = true; |
|
6056 |
else |
|
295 | 6057 |
#endif |
850 | 6058 |
__INST(hasShmExtension) = false; |
295 | 6059 |
|
6060 |
#ifdef DPS |
|
850 | 6061 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
6062 |
__INST(hasDPSExtension) = true; |
|
6063 |
else |
|
295 | 6064 |
#endif |
850 | 6065 |
__INST(hasDPSExtension) = false; |
295 | 6066 |
|
6067 |
#ifdef XVIDEO |
|
850 | 6068 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
6069 |
__INST(hasXVideoExtension) = true; |
|
6070 |
else |
|
295 | 6071 |
#endif |
850 | 6072 |
__INST(hasXVideoExtension) = false; |
295 | 6073 |
|
6074 |
#ifdef MBUF |
|
850 | 6075 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
6076 |
__INST(hasMbufExtension) = true; |
|
6077 |
else |
|
295 | 6078 |
#endif |
850 | 6079 |
__INST(hasMbufExtension) = false; |
295 | 6080 |
|
6081 |
#ifdef PEX5 |
|
850 | 6082 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) |
6083 |
__INST(hasPEXExtension) = true; |
|
6084 |
else |
|
295 | 6085 |
#endif |
850 | 6086 |
__INST(hasPEXExtension) = false; |
295 | 6087 |
|
6088 |
#ifdef XIE |
|
850 | 6089 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) |
6090 |
__INST(hasImageExtension) = true; |
|
6091 |
else |
|
295 | 6092 |
#endif |
850 | 6093 |
__INST(hasImageExtension) = false; |
295 | 6094 |
|
6095 |
#ifdef XI |
|
850 | 6096 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) |
6097 |
__INST(hasInputExtension) = true; |
|
6098 |
else |
|
295 | 6099 |
#endif |
850 | 6100 |
__INST(hasInputExtension) = false; |
6101 |
||
6102 |
/* |
|
6103 |
* look for RGB visual |
|
6104 |
*/ |
|
6105 |
nvi = 0; |
|
6106 |
viproto.screen = scr; |
|
6107 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
|
6108 |
maxRGBDepth = 0; |
|
6109 |
for (i = 0; i < nvi; i++) { |
|
6110 |
switch (vip[i].class) { |
|
6111 |
case TrueColor: |
|
6112 |
if (vip[i].depth > maxRGBDepth) { |
|
6113 |
maxRGBDepth = vip[i].depth; |
|
6114 |
rgbRedMask = vip[i].red_mask; |
|
6115 |
rgbGreenMask = vip[i].green_mask; |
|
6116 |
rgbBlueMask = vip[i].blue_mask; |
|
6117 |
rgbVisualID = vip[i].visualid; |
|
6118 |
} |
|
6119 |
break; |
|
6120 |
} |
|
6121 |
} |
|
6122 |
if (vip) XFree ((char *) vip); |
|
6123 |
||
6124 |
if (maxRGBDepth) { |
|
6125 |
__INST(rgbVisual) = __MKOBJ(rgbVisualID); __STORESELF(rgbVisual); |
|
6126 |
} |
|
6127 |
||
6128 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
6129 |
__INST(monitorType) = @symbol(unknown); |
|
6130 |
__INST(hasColors) = true; |
|
6131 |
__INST(hasGreyscales) = true; |
|
6132 |
switch (visual->class) { |
|
6133 |
case StaticGray: |
|
6134 |
__INST(visualType) = @symbol(StaticGray); |
|
6135 |
__INST(hasColors) = false; |
|
6136 |
__INST(monitorType) = @symbol(monochrome); |
|
6137 |
break; |
|
6138 |
case GrayScale: |
|
6139 |
__INST(visualType) = @symbol(GrayScale); |
|
6140 |
__INST(hasColors) = false; |
|
6141 |
__INST(monitorType) = @symbol(monochrome); |
|
6142 |
break; |
|
6143 |
case StaticColor: |
|
6144 |
__INST(visualType) = @symbol(StaticColor); |
|
6145 |
break; |
|
6146 |
case PseudoColor: |
|
6147 |
__INST(visualType) = @symbol(PseudoColor); |
|
6148 |
break; |
|
6149 |
case TrueColor: |
|
6150 |
__INST(visualType) = @symbol(TrueColor); |
|
6151 |
break; |
|
6152 |
case DirectColor: |
|
6153 |
__INST(visualType) = @symbol(DirectColor); |
|
6154 |
break; |
|
6155 |
} |
|
6156 |
if (DisplayCells(dpy, scr) == 2) { |
|
6157 |
__INST(hasColors) = false; |
|
6158 |
__INST(hasGreyscales) = false; |
|
6159 |
__INST(monitorType) = @symbol(monochrome); |
|
6160 |
} |
|
6161 |
__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb); |
|
6162 |
__INST(redMask) = __MKSMALLINT(visual->red_mask); |
|
6163 |
__INST(greenMask) = __MKSMALLINT(visual->green_mask); |
|
6164 |
__INST(blueMask) = __MKSMALLINT(visual->blue_mask); |
|
6165 |
switch (visual->class) { |
|
6166 |
case TrueColor: |
|
6167 |
/* extract number of bits and shift counts */ |
|
6168 |
mask = visual->red_mask; |
|
6169 |
shift = 0; |
|
6170 |
while (mask && ((mask & 1) == 0)) { |
|
6171 |
mask >>= 1; |
|
6172 |
shift++; |
|
6173 |
} |
|
6174 |
__INST(redShift) = __MKSMALLINT(shift); |
|
6175 |
nBits = 0; |
|
6176 |
while (mask) { |
|
6177 |
mask >>= 1; |
|
6178 |
nBits++; |
|
6179 |
} |
|
6180 |
__INST(bitsRed) = __MKSMALLINT(nBits); |
|
6181 |
||
6182 |
mask = visual->green_mask; |
|
6183 |
shift = 0; |
|
6184 |
while (mask && ((mask & 1) == 0)) { |
|
6185 |
mask >>= 1; |
|
6186 |
shift++; |
|
6187 |
} |
|
6188 |
__INST(greenShift) = __MKSMALLINT(shift); |
|
6189 |
nBits = 0; |
|
6190 |
while (mask) { |
|
6191 |
mask >>= 1; |
|
6192 |
nBits++; |
|
6193 |
} |
|
6194 |
__INST(bitsGreen) = __MKSMALLINT(nBits); |
|
6195 |
||
6196 |
mask = visual->blue_mask; |
|
6197 |
shift = 0; |
|
6198 |
while (mask && ((mask & 1) == 0)) { |
|
6199 |
mask >>= 1; |
|
6200 |
shift++; |
|
6201 |
} |
|
6202 |
__INST(blueShift) = __MKSMALLINT(shift); |
|
6203 |
nBits = 0; |
|
6204 |
while (mask) { |
|
6205 |
mask >>= 1; |
|
6206 |
nBits++; |
|
6207 |
} |
|
6208 |
__INST(bitsBlue) = __MKSMALLINT(nBits); |
|
6209 |
break; |
|
6210 |
} |
|
295 | 6211 |
|
6212 |
#ifndef XA_PRIMARY |
|
850 | 6213 |
__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) ); |
295 | 6214 |
#else |
850 | 6215 |
__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY ); |
295 | 6216 |
#endif |
6217 |
#ifndef XA_SECONDARY |
|
850 | 6218 |
__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) ); |
295 | 6219 |
#else |
850 | 6220 |
__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY ); |
295 | 6221 |
#endif |
6222 |
#ifndef XA_CUT_BUFFER0 |
|
850 | 6223 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) ); |
295 | 6224 |
#else |
850 | 6225 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 ); |
295 | 6226 |
#endif |
6227 |
#ifndef XA_STRING |
|
850 | 6228 |
__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) ); |
295 | 6229 |
#else |
850 | 6230 |
__INST(stringAtom) = __MKATOMOBJ( XA_STRING ); |
295 | 6231 |
#endif |
6232 |
#ifndef XA_LENGTH |
|
850 | 6233 |
__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) ); |
295 | 6234 |
#else |
850 | 6235 |
__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH ); |
295 | 6236 |
#endif |
6237 |
||
850 | 6238 |
END_INTERRUPTSBLOCKED |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6239 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6240 |
%}. |
295 | 6241 |
! |
6242 |
||
6243 |
initializeSpecialFlags |
|
6244 |
"perform additional special server implementation flags" |
|
6245 |
||
6246 |
"/ |
|
6247 |
"/ assume we have it ... (should check) |
|
6248 |
"/ |
|
6249 |
hasSaveUnder := true. |
|
6250 |
ignoreBackingStore := false. |
|
6251 |
||
6252 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
6253 |
"/ |
|
6254 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
6255 |
"/ which does not correctly handle saveUnder |
|
6256 |
"/ |
|
6257 |
hasSaveUnder := false. |
|
6258 |
]. |
|
6259 |
! |
|
6260 |
||
6261 |
reinitialize |
|
6262 |
virtualRootId := rootId := nil. |
|
6263 |
super reinitialize. |
|
6264 |
dispatchingExpose := nil |
|
6265 |
! ! |
|
6266 |
||
6267 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
6268 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6269 |
altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6270 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6271 |
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
|
6272 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6273 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6274 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6275 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6276 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6277 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6278 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6279 |
|
341 | 6280 |
altModifierMask:aSmallInteger |
6281 |
"define which key takes the role of an alt-key. |
|
6282 |
By default, this is X's modifier1, which is the ALT key on |
|
6283 |
most keyboards. However, there may be exceptions to this, |
|
6284 |
and the setting can be changed with: |
|
6285 |
Display altModifierMask:(Display modifier2Mask) |
|
6286 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
|
6287 |
" |
|
6288 |
||
6289 |
altModifierMask := aSmallInteger |
|
6290 |
! |
|
6291 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6292 |
metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6293 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6294 |
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
|
6295 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6296 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6297 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6298 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6299 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6300 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6301 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6302 |
|
341 | 6303 |
metaModifierMask:aSmallInteger |
6304 |
"define which key takes the role of a meta key. |
|
6305 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
6306 |
most keyboards (if present at all). |
|
6307 |
However, there may be exceptions to this, and the setting can |
|
6308 |
be changed with: |
|
6309 |
Display metaModifierMask:(Display modifier1Mask) |
|
6310 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
|
6311 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
6312 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
6313 |
all the time. On those, you should disable the meta key by setting |
|
6314 |
the mask to 0. |
|
6315 |
" |
|
6316 |
||
6317 |
metaModifierMask := aSmallInteger |
|
6318 |
! |
|
6319 |
||
6320 |
modifier1Mask |
|
6321 |
"return the Xlib mask bit for the 1st modifier key. |
|
6322 |
See comment in altModifierMask: / metaModifierMask: for what |
|
6323 |
this could be used." |
|
6324 |
||
6325 |
%{ /* NOCONTEXT */ |
|
6326 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
6327 |
%} |
|
6328 |
! |
|
6329 |
||
6330 |
modifier2Mask |
|
6331 |
"return the Xlib mask bit for the 2nd modifier key. |
|
6332 |
See comment in altModifierMask: / metaModifierMask: for what |
|
6333 |
this could be used." |
|
6334 |
||
6335 |
%{ /* NOCONTEXT */ |
|
6336 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
6337 |
%} |
|
6338 |
! |
|
6339 |
||
6340 |
modifierMapping |
|
6341 |
"Get the Modifier Mapping. |
|
6342 |
We return an array of arrays of keycodes" |
|
6343 |
||
6344 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
6345 |
||
6346 |
%{ |
|
6347 |
Display *dpy = myDpy; |
|
6348 |
XModifierKeymap *modmap; |
|
6349 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
6350 |
||
6351 |
if (ISCONNECTED) { |
|
6352 |
if ((modmap = XGetModifierMapping(myDpy)) != 0) { |
|
6353 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
6354 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
|
6355 |
if (modifierKeyMap != nil) { |
|
6356 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
6357 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
|
6358 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
|
6359 |
} |
|
6360 |
XFreeModifiermap(modmap); |
|
6361 |
} |
|
6362 |
} |
|
6363 |
%}. |
|
6364 |
||
6365 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
6366 |
||
6367 |
ret := Array new:8. |
|
6368 |
nextKey := 1. |
|
6369 |
1 to:8 do:[ :i | |
|
6370 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
|
6371 |
|mod| |
|
6372 |
||
6373 |
mod := OrderedCollection new:maxKeyPerMod. |
|
6374 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
6375 |
key ~= 0 ifTrue:[ |
|
6376 |
mod add:key |
|
6377 |
]. |
|
6378 |
]. |
|
6379 |
ret at:i put:mod. |
|
6380 |
]. |
|
6381 |
nextKey := nextKey+maxKeyPerMod. |
|
6382 |
]. |
|
6383 |
||
6384 |
^ ret |
|
6385 |
||
6386 |
" |
|
6387 |
Display modifierMapping |
|
6388 |
" |
|
6389 |
! |
|
6390 |
||
6391 |
stringFromKeycode:code |
|
6392 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
|
6393 |
||
6394 |
|str| |
|
6395 |
||
6396 |
%{ |
|
6397 |
Display *dpy = myDpy; |
|
6398 |
KeySym keysym; |
|
6399 |
char *keystring; |
|
6400 |
||
6401 |
if (ISCONNECTED && __isSmallInteger(code)) { |
|
6402 |
if ((keysym = XKeycodeToKeysym(myDpy, __intVal(code), 0)) != NoSymbol && |
|
6403 |
(keystring = XKeysymToString(keysym)) != 0) |
|
6404 |
str = __MKSTRING(keystring); |
|
6405 |
} |
|
6406 |
%}. |
|
6407 |
^ str |
|
6408 |
||
6409 |
" |
|
6410 |
Display stringFromKeycode:28 |
|
6411 |
" |
|
6412 |
! |
|
6413 |
||
295 | 6414 |
translateKey:untranslatedKey |
6415 |
"Return the key translated via the translation table. |
|
6416 |
Here, we preTranslate the key into a common ST/X symbolic name, |
|
6417 |
which gets further processed in the superclasses translation method." |
|
6418 |
||
6419 |
|key| |
|
6420 |
||
6421 |
(key := untranslatedKey) isString ifTrue:[ |
|
6422 |
key := RawKeysymTranslation at:key ifAbsent:key. |
|
6423 |
key := key asSymbol. |
|
6424 |
]. |
|
6425 |
^ super translateKey:key |
|
6426 |
! ! |
|
6427 |
||
6428 |
!XWorkstation methodsFor:'misc'! |
|
6429 |
||
6430 |
beep |
|
6431 |
"output an audible beep or bell" |
|
6432 |
||
6433 |
self beep:50 |
|
6434 |
! |
|
6435 |
||
6436 |
beep:volumeInPercent |
|
6437 |
"output an audible beep" |
|
6438 |
%{ |
|
6439 |
int volume; |
|
6440 |
||
6441 |
if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
|
6442 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
|
555 | 6443 |
volume = __intVal(volumeInPercent) * 2 - 100; |
295 | 6444 |
if (volume < -100) volume = -100; |
6445 |
else if (volume > 100) volume = 100; |
|
6446 |
BEGIN_INTERRUPTSBLOCKED |
|
6447 |
XBell(myDpy, volume); |
|
6448 |
END_INTERRUPTSBLOCKED |
|
6449 |
} |
|
6450 |
%} |
|
6451 |
! |
|
6452 |
||
6453 |
buffered |
|
6454 |
"buffer drawing - do not send it immediately to the display. |
|
374 | 6455 |
This is the default anyway. |
6456 |
See #unBuffered for additional info." |
|
295 | 6457 |
|
6458 |
%{ /* NOCONTEXT */ |
|
6459 |
||
6460 |
if (ISCONNECTED) { |
|
6461 |
BEGIN_INTERRUPTSBLOCKED |
|
6462 |
XSynchronize(myDpy, 0); |
|
6463 |
END_INTERRUPTSBLOCKED |
|
6464 |
} |
|
6465 |
%} |
|
374 | 6466 |
" |
6467 |
Display buffered |
|
6468 |
" |
|
295 | 6469 |
! |
6470 |
||
6471 |
flush |
|
6472 |
"send all buffered drawing to the display. |
|
6473 |
This may be required to make certain, that all previous operations |
|
6474 |
are really sent to the display before continuing. For example, |
|
6475 |
after a cursor-change with a followup long computation. |
|
374 | 6476 |
(otherwise, the cursor change request may still be in the output buffer) |
6477 |
See also #sync, which even waits until the request has been processed." |
|
295 | 6478 |
|
6479 |
%{ /* NOCONTEXT */ |
|
6480 |
||
6481 |
if (ISCONNECTED) { |
|
6482 |
BEGIN_INTERRUPTSBLOCKED |
|
310 | 6483 |
XFlush(myDpy); |
6484 |
END_INTERRUPTSBLOCKED |
|
6485 |
} |
|
6486 |
%} |
|
6487 |
! |
|
6488 |
||
295 | 6489 |
flushDpsContext:aDPSContext |
6490 |
||
6491 |
%{ /* NOCONTEXT */ |
|
6492 |
#ifdef DPS |
|
6493 |
if (__isExternalAddress(aDPSContext)) { |
|
6494 |
BEGIN_INTERRUPTSBLOCKED |
|
6495 |
DPSFlushContext(MKDPSCONTEXT(aDPSContext)); |
|
6496 |
END_INTERRUPTSBLOCKED |
|
6497 |
RETURN ( self ); |
|
6498 |
} |
|
6499 |
#endif |
|
374 | 6500 |
%}. |
295 | 6501 |
self primitiveFailed |
6502 |
! |
|
6503 |
||
6504 |
refreshKeyboardMapping:eB |
|
6505 |
%{ |
|
6506 |
XMappingEvent *ev; |
|
6507 |
||
6508 |
if (__isByteArray(eB)) { |
|
555 | 6509 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 6510 |
XRefreshKeyboardMapping(ev); |
6511 |
} |
|
6512 |
%} |
|
6513 |
! |
|
6514 |
||
6515 |
setInputFocusTo:aWindowId |
|
6516 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
|
6517 |
self setInputFocusTo:aWindowId revertTo:#root |
|
6518 |
! |
|
6519 |
||
6520 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
|
6521 |
"set the focus to the view as defined by aWindowId. |
|
6522 |
Passing nil set the focus to no window and lets the display discard all |
|
6523 |
input until a new focus is set. |
|
6524 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
6525 |
passing one of #parent, #root or nil specifies that the focus should be |
|
6526 |
given to the parent view, the root view or no view." |
|
6527 |
||
6528 |
%{ /* NOCONTEXT */ |
|
6529 |
int arg; |
|
6530 |
Window focusWindow; |
|
6531 |
||
6532 |
if (ISCONNECTED) { |
|
6533 |
if (__isExternalAddress(aWindowId)) { |
|
6534 |
focusWindow = _WindowVal(aWindowId); |
|
6535 |
} else { |
|
6536 |
focusWindow = None; |
|
6537 |
} |
|
6538 |
if (revertSymbol == @symbol(parent)) |
|
6539 |
arg = RevertToParent; |
|
6540 |
else if (revertSymbol == @symbol(root)) |
|
6541 |
arg = RevertToPointerRoot; |
|
6542 |
else |
|
6543 |
arg = RevertToNone; |
|
6544 |
||
6545 |
BEGIN_INTERRUPTSBLOCKED |
|
6546 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
|
6547 |
END_INTERRUPTSBLOCKED |
|
6548 |
RETURN ( self ); |
|
6549 |
} |
|
6550 |
%}. |
|
6551 |
self primitiveFailed |
|
6552 |
! |
|
6553 |
||
341 | 6554 |
sync |
6555 |
"send all buffered drawing to the display AND wait until the display |
|
6556 |
has finished drawing it. |
|
6557 |
This is almost never needed, except if you are about to read previously |
|
374 | 6558 |
drawn pixels back from the display screen, or you want to wait for a beep |
6559 |
to be finished. See also #flush." |
|
341 | 6560 |
|
6561 |
%{ /* NOCONTEXT */ |
|
6562 |
||
6563 |
if (ISCONNECTED) { |
|
6564 |
BEGIN_INTERRUPTSBLOCKED |
|
6565 |
XSync(myDpy, 0); |
|
6566 |
END_INTERRUPTSBLOCKED |
|
6567 |
} |
|
6568 |
%} |
|
6569 |
! |
|
6570 |
||
295 | 6571 |
unBuffered |
374 | 6572 |
"make all drawing be sent immediately to the display. |
6573 |
This makes all graphics synchronous and turns off any buffering |
|
6574 |
(i.e. each individual draw-request is sent immediately without |
|
6575 |
packing multiple requests into a larger message buffer). |
|
6576 |
Be prepared, that this slows down graphics considerably. |
|
6577 |
However, it allows display errors to be handled immediately and |
|
6578 |
may be useful if you get Xdisplay errors and want to find the request |
|
6579 |
which was responsiblefor it. See also #buffered." |
|
295 | 6580 |
|
6581 |
%{ /* NOCONTEXT */ |
|
6582 |
||
6583 |
if (ISCONNECTED) { |
|
6584 |
BEGIN_INTERRUPTSBLOCKED |
|
6585 |
XSynchronize(myDpy, 1); |
|
6586 |
END_INTERRUPTSBLOCKED |
|
6587 |
} |
|
6588 |
%} |
|
6589 |
"Display unbuffered" |
|
6590 |
! ! |
|
6591 |
||
6592 |
!XWorkstation methodsFor:'pointer queries '! |
|
6593 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6594 |
anyButtonStateMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6595 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6596 |
buttonStates value." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6597 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6598 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6599 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6600 |
^ 256 + 512 + 1024 |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6601 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6602 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6603 |
"Created: 23.3.1996 / 12:46:35 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6604 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6605 |
|
295 | 6606 |
buttonStates |
6607 |
"return an integer representing the state of the pointer buttons; |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6608 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6609 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6610 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 6611 |
|
6612 |
%{ /* NOCONTEXT*/ |
|
6613 |
Display *dpy = myDpy; |
|
6614 |
Window w; |
|
555 | 6615 |
int screen = __intVal(__INST(screen)); |
295 | 6616 |
Window rootRet, childRet; |
6617 |
int rootX, rootY, winX, winY; |
|
6618 |
unsigned int mask; |
|
6619 |
||
6620 |
BEGIN_INTERRUPTSBLOCKED |
|
6621 |
#ifdef VIRTUAL_ROOT |
|
6622 |
w = getRootWindow(myDpy, screen); |
|
6623 |
#else |
|
6624 |
w = RootWindow(dpy, screen); |
|
6625 |
#endif |
|
6626 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
|
850 | 6627 |
&rootX, &rootY, |
6628 |
&winX, &winY, |
|
6629 |
&mask); |
|
295 | 6630 |
END_INTERRUPTSBLOCKED |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6631 |
RETURN (__MKSMALLINT(mask)); |
295 | 6632 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6633 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6634 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6635 |
Display buttonStates |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6636 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6637 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6638 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6639 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6640 |
Display buttonStates bitTest:(Display controlMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6641 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6642 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6643 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6644 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6645 |
Display buttonStates bitTest:(Display altModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6646 |
Display buttonStates bitTest:(Display metaModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6647 |
" |
295 | 6648 |
! |
6649 |
||
6650 |
leftButtonStateMask |
|
6651 |
"return an integer for masking out the left button from a |
|
6652 |
buttonStates value" |
|
6653 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6654 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6655 |
|
295 | 6656 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6657 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6658 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 6659 |
! |
6660 |
||
6661 |
middleButtonStateMask |
|
6662 |
"return an integer for masking out the middle button from a |
|
6663 |
buttonStates value" |
|
6664 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6665 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6666 |
|
295 | 6667 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6668 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6669 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 6670 |
! |
6671 |
||
6672 |
pointerPosition |
|
6673 |
"return the current pointer position in root-window coordinates" |
|
6674 |
||
6675 |
|xpos ypos| |
|
6676 |
||
6677 |
%{ |
|
6678 |
Display *dpy = myDpy; |
|
6679 |
Window w; |
|
555 | 6680 |
int screen = __intVal(__INST(screen)); |
295 | 6681 |
Window rootRet, childRet; |
6682 |
int rootX, rootY, winX, winY; |
|
6683 |
unsigned int mask; |
|
6684 |
||
6685 |
BEGIN_INTERRUPTSBLOCKED |
|
6686 |
#ifdef VIRTUAL_ROOT |
|
6687 |
w = getRootWindow(myDpy, screen); |
|
6688 |
#else |
|
6689 |
w = RootWindow(dpy, screen); |
|
6690 |
#endif |
|
6691 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
|
6692 |
&rootX, &rootY, |
|
6693 |
&winX, &winY, |
|
6694 |
&mask); |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6695 |
xpos = __MKSMALLINT(rootX); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6696 |
ypos = __MKSMALLINT(rootY); |
295 | 6697 |
END_INTERRUPTSBLOCKED |
6698 |
%} |
|
6699 |
. |
|
6700 |
^ xpos @ ypos |
|
6701 |
! |
|
6702 |
||
6703 |
rightButtonStateMask |
|
6704 |
"return an integer for masking out the right button from a |
|
6705 |
buttonStates value" |
|
6706 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6707 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6708 |
|
295 | 6709 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6710 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6711 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 6712 |
! |
6713 |
||
6714 |
rootPositionOfLastEvent |
|
6715 |
"return the position in root-window coordinates |
|
6716 |
of the last button, key or pointer event" |
|
6717 |
||
6718 |
^ eventRootX @ eventRootY |
|
6719 |
! ! |
|
6720 |
||
6721 |
!XWorkstation methodsFor:'resources'! |
|
6722 |
||
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6723 |
atomIDOf:aStringOrSymbol |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6724 |
"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
|
6725 |
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
|
6726 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6727 |
^ self atomIDOf:aStringOrSymbol create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6728 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6729 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6730 |
Display atomIDOf:'FACE_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6731 |
Display atomIDOf:'FULL_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6732 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6733 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6734 |
"Modified: 2.3.1996 / 15:09:29 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6735 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6736 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6737 |
atomIDOf:aStringOrSymbol create:create |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6738 |
"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
|
6739 |
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
|
6740 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6741 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6742 |
Atom prop; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6743 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6744 |
if (ISCONNECTED) { |
850 | 6745 |
if (__isString(aStringOrSymbol) |
6746 |
|| __isSymbol(aStringOrSymbol)) { |
|
6747 |
prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), |
|
6748 |
(create == true) ? False : True); |
|
6749 |
if (prop == None) { |
|
6750 |
RETURN (nil); |
|
6751 |
} |
|
6752 |
RETURN ( __MKATOMOBJ(prop) ); |
|
6753 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6754 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6755 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6756 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6757 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6758 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6759 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6760 |
Display atomIDOf:'VT_SELECTION' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6761 |
Display atomIDOf:'CUT_BUFFER0' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6762 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6763 |
Display atomIDOf:'PRIMARY' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6764 |
Display atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6765 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6766 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6767 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6768 |
atomIDOfCUTBUFFER0 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6769 |
"return the CUTBUFFER0 AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6770 |
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
|
6771 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6772 |
^ cutBuffer0Atom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6773 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6774 |
"Modified: 2.3.1996 / 15:10:36 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6775 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6776 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6777 |
atomIDOfLENGTH |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6778 |
"return the LENGTH AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6779 |
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
|
6780 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6781 |
^ lengthAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6782 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6783 |
"Modified: 2.3.1996 / 15:10:41 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6784 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6785 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6786 |
atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6787 |
"return the PRIMARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6788 |
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
|
6789 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6790 |
^ primaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6791 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6792 |
"Modified: 2.3.1996 / 15:10:49 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6793 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6794 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6795 |
atomIDOfSECONDARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6796 |
"return the SECONDARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6797 |
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
|
6798 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6799 |
^ secondaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6800 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6801 |
"Modified: 2.3.1996 / 15:10:59 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6802 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6803 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6804 |
atomIDOfSTRING |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6805 |
"return the STRING AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6806 |
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
|
6807 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6808 |
^ stringAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6809 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6810 |
"Modified: 2.3.1996 / 15:11:08 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6811 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6812 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6813 |
atomName:anAtomID |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6814 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6815 |
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
|
6816 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6817 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6818 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6819 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6820 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6821 |
if (ISCONNECTED) { |
850 | 6822 |
if (__isAtomID(anAtomID)) { |
6823 |
name = XGetAtomName(myDpy, _AtomVal(anAtomID)); |
|
6824 |
if (name == 0) { |
|
6825 |
RETURN (nil); |
|
6826 |
} |
|
6827 |
str = __MKSTRING(name COMMA_CON); |
|
6828 |
XFree(name); |
|
6829 |
RETURN ( str ); |
|
6830 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6831 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6832 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6833 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6834 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6835 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6836 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6837 |
Display atomName:1 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6838 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6839 |
Display atomName:132 'FONTNAME_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6840 |
Display atomName:135 'FOUNDRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6841 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6842 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6843 |
Display atomName:152 'CHARSET_ENCODING' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6844 |
Display atomName:154 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6845 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6846 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6847 |
|
295 | 6848 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6849 |
"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
|
6850 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6851 |
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
|
6852 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6853 |
Notice: |
850 | 6854 |
we do not plan to use X's resources for ST/X's defaults, |
6855 |
styles or resources. This would make porting of applications |
|
6856 |
to different platforms much more difficult (Windows has no resource |
|
6857 |
database). If you stay within ST/X's resource files, these can be |
|
6858 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6859 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6860 |
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
|
6861 |
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
|
6862 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6863 |
|
295 | 6864 |
%{ |
6865 |
char *rslt; |
|
6866 |
||
6867 |
if ((__isString(name) || __isSymbol(name)) |
|
6868 |
&& (__isString(cls) || __isSymbol(cls)) |
|
6869 |
&& ISCONNECTED) { |
|
850 | 6870 |
BEGIN_INTERRUPTSBLOCKED |
6871 |
rslt = XGetDefault(myDpy, (char *)_stringVal(cls), |
|
6872 |
(char *)_stringVal(name)); |
|
6873 |
END_INTERRUPTSBLOCKED |
|
6874 |
RETURN (rslt ? __MKSTRING(rslt COMMA_CON) : nil ); |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6875 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6876 |
%}. |
295 | 6877 |
self primitiveFailed. |
6878 |
^ nil |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6879 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6880 |
"if your ~/.Xdefaults contains an entry such as: |
850 | 6881 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6882 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6883 |
|
850 | 6884 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6885 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6886 |
if your ~/.Xdefaults contains an entry such as: |
850 | 6887 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6888 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6889 |
|
850 | 6890 |
Display getResource:'beNiceToColormap' class:'any' |
6891 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6892 |
" |
295 | 6893 |
! ! |
6894 |
||
6895 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
6896 |
||
6897 |
getBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
|
6898 |
"get bits from a drawable into the imageBits. The storage for the bits |
|
6899 |
must be big enough for the data to fit. If ok, returns an array with some |
|
6900 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
6901 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
6902 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
6903 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6904 |
|rawInfo info| |
295 | 6905 |
|
6906 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
6907 |
self primitiveFailed. |
|
6908 |
^ nil |
|
6909 |
]. |
|
6910 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6911 |
rawInfo := Array new:8. |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6912 |
"1 -> bit order" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6913 |
"2 -> depth" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6914 |
"3 -> bytes_per_line" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6915 |
"4 -> byte_order" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6916 |
"5 -> format" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6917 |
"6 -> bitmap_unit" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6918 |
"7 -> bitmap_pad" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6919 |
"8 -> bits_per_pixel" |
295 | 6920 |
|
6921 |
"/ had to extract the getPixel call into a separate method, to specify |
|
6922 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
6923 |
"/ of temporary stack space |
|
6924 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6925 |
(self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6926 |
info := IdentityDictionary new. |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6927 |
info at:#bitOrder put:(rawInfo at:1). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6928 |
info at:#depth put:(rawInfo at:2). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6929 |
info at:#bytesPerLine put:(rawInfo at:3). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6930 |
info at:#byteOrder put:(rawInfo at:4). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6931 |
info at:#format put:(rawInfo at:5). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6932 |
info at:#bitmapUnit put:(rawInfo at:6). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6933 |
info at:#bitmapPad put:(rawInfo at:7). |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6934 |
info at:#bitsPerPixel put:(rawInfo at:8). |
295 | 6935 |
^ info |
6936 |
]. |
|
6937 |
" |
|
6938 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
6939 |
or is too small to hold the bits |
|
6940 |
" |
|
6941 |
^ self primitiveFailed |
|
6942 |
! |
|
6943 |
||
6944 |
getPixelX:x y:y from:aDrawableId |
|
790
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
6945 |
"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
|
6946 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 6947 |
|
6948 |
%{ /* UNLIMITEDSTACK NOCONTEXT */ |
|
6949 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6950 |
Window win; |
295 | 6951 |
XImage *img; |
6952 |
int ret; |
|
6953 |
int xpos, ypos; |
|
6954 |
||
6955 |
if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
850 | 6956 |
win = _WindowVal(aDrawableId); |
6957 |
xpos = __intVal(x); |
|
6958 |
ypos = __intVal(y); |
|
6959 |
if ((xpos < 0) || (ypos < 0)) { |
|
6960 |
RETURN ( __MKSMALLINT(0) ); |
|
6961 |
} |
|
6962 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
|
6963 |
if (img != 0) { |
|
6964 |
ret = XGetPixel(img, 0, 0); |
|
6965 |
XDestroyImage(img); |
|
6966 |
RETURN ( __MKSMALLINT(ret) ); |
|
6967 |
} |
|
295 | 6968 |
} |
6969 |
%}. |
|
6970 |
^ nil |
|
6971 |
! |
|
6972 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6973 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
295 | 6974 |
"since XGetImage may allocate huge amount of stack space |
6975 |
(some implementations use alloca), this must run with unlimited stack." |
|
6976 |
||
6977 |
%{ /* UNLIMITEDSTACK */ |
|
6978 |
||
6979 |
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
|
6980 |
Window win; |
295 | 6981 |
XImage *image = (XImage *)0; |
6982 |
int pad, bytes_per_line, numBytes; |
|
6983 |
||
6984 |
if (__isExternalAddress(aDrawableId) |
|
6985 |
&& __bothSmallInteger(srcx, srcy) |
|
6986 |
&& __bothSmallInteger(w, h) |
|
6987 |
&& __isArray(info) |
|
6988 |
&& __isByteArray(imageBits)) { |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6989 |
win = _WindowVal(aDrawableId); |
555 | 6990 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
6991 |
__intVal(w), __intVal(h), |
|
295 | 6992 |
(unsigned)AllPlanes, ZPixmap); |
6993 |
||
378 | 6994 |
if (! image) { |
6995 |
RETURN ( false ); |
|
6996 |
} |
|
6997 |
||
295 | 6998 |
pad = image->bitmap_pad; |
6999 |
#ifdef SUPERDEBUG |
|
7000 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
|
7001 |
#endif |
|
7002 |
switch (image->depth) { |
|
7003 |
case 1: |
|
7004 |
case 2: |
|
7005 |
case 4: |
|
7006 |
case 8: |
|
7007 |
case 16: |
|
7008 |
case 24: |
|
7009 |
case 32: |
|
7010 |
numBytes = image->bytes_per_line * image->height; |
|
7011 |
break; |
|
7012 |
default: |
|
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7013 |
/* unsupported depth ? */ |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7014 |
printf("possibly unsupported depth:%d in primGetBits\n", image->depth); |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7015 |
numBytes = image->bytes_per_line * image->height; |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7016 |
break; |
295 | 7017 |
} |
7018 |
||
7019 |
#ifdef SUPERDEBUG |
|
555 | 7020 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 7021 |
#endif |
7022 |
||
555 | 7023 |
if (numBytes > __byteArraySize(imageBits)) { |
295 | 7024 |
/* imageBits too small */ |
378 | 7025 |
printf("provided byteArray too small\n"); |
295 | 7026 |
goto fail; |
7027 |
} |
|
7028 |
if (image->bitmap_bit_order == MSBFirst) |
|
555 | 7029 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
295 | 7030 |
else |
555 | 7031 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
7032 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
7033 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
295 | 7034 |
if (image->byte_order == MSBFirst) |
555 | 7035 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
295 | 7036 |
else |
555 | 7037 |
__ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7038 |
if (image->format == XYBitmap) |
555 | 7039 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7040 |
else if (image->format == XYPixmap) |
555 | 7041 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7042 |
else if (image->format == ZPixmap) |
555 | 7043 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7044 |
|
555 | 7045 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
7046 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
7047 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
7048 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
295 | 7049 |
XDestroyImage(image); |
7050 |
RETURN ( true ); |
|
7051 |
} |
|
7052 |
fail: |
|
7053 |
if (image) { |
|
7054 |
XDestroyImage(image); |
|
7055 |
} |
|
7056 |
%}. |
|
7057 |
^ false |
|
7058 |
! ! |
|
7059 |
||
7060 |
!XWorkstation methodsFor:'selections'! |
|
7061 |
||
7062 |
getObjectProperty:propertyID from:aWindowID |
|
7063 |
"get an object property; return object or nil" |
|
7064 |
||
7065 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
7066 |
type == stringAtom ifTrue:[ |
|
7067 |
^ value |
|
7068 |
]. |
|
7069 |
(value isMemberOf:ByteArray) ifTrue:[ |
|
7070 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
|
7071 |
] |
|
7072 |
]. |
|
7073 |
^ nil |
|
7074 |
! |
|
7075 |
||
7076 |
getProperty:propertyID from:aWindowID into:aTwoArgBlock |
|
7077 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
|
7078 |
||
7079 |
|val typeID cls| |
|
7080 |
||
7081 |
cls := ByteArray. |
|
7082 |
%{ |
|
7083 |
Display *dpy = myDpy; |
|
7084 |
Window window; |
|
7085 |
Atom property; |
|
7086 |
char *cp, *cp2; |
|
7087 |
Atom actual_type; |
|
7088 |
int actual_format,i; |
|
7089 |
unsigned long nitems, bytes_after, nread; |
|
7090 |
unsigned char *data; |
|
7091 |
int ok = 1; |
|
7092 |
# define PROP_SIZE 2048 |
|
7093 |
||
7094 |
if (__isAtomID(propertyID)) { |
|
7095 |
property = _AtomVal(propertyID); |
|
7096 |
if (__isExternalAddress(aWindowID)) { |
|
7097 |
window = _WindowVal(aWindowID); |
|
7098 |
} else { |
|
7099 |
window = DefaultRootWindow(dpy); |
|
7100 |
} |
|
7101 |
||
7102 |
nread = 0; |
|
7103 |
cp = 0; |
|
7104 |
/* |
|
7105 |
fprintf(stderr, "getProperty: "); |
|
7106 |
*/ |
|
7107 |
do { |
|
7108 |
if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False, |
|
7109 |
AnyPropertyType,&actual_type,&actual_format, |
|
7110 |
&nitems,&bytes_after,(unsigned char **)&data) |
|
7111 |
!= Success) { |
|
7112 |
ok = 0; |
|
7113 |
break; |
|
7114 |
} |
|
7115 |
typeID = __MKATOMOBJ(actual_type); |
|
7116 |
if (! cp) { |
|
7117 |
cp = cp2 = (char *)malloc(nitems+1); |
|
7118 |
} else { |
|
7119 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
7120 |
cp2 = cp + nread; |
|
7121 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7122 |
if (! cp) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
7123 |
XFree(data); |
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7124 |
goto fail; |
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7125 |
} |
295 | 7126 |
|
7127 |
nread += nitems; |
|
7128 |
bcopy(data, cp2, nitems); |
|
7129 |
XFree(data); |
|
7130 |
/* |
|
7131 |
fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after); |
|
7132 |
*/ |
|
7133 |
} while (bytes_after > 0); |
|
7134 |
/* |
|
7135 |
fprintf(stderr, "\n"); |
|
7136 |
*/ |
|
7137 |
||
7138 |
if (ok) { |
|
7139 |
if (actual_type == XA_STRING) { |
|
7140 |
cp[nread] = '\0'; |
|
7141 |
val = __MKSTRING_L(cp, nread COMMA_CON); |
|
7142 |
} else { |
|
7143 |
val = __new(nread + OHDR_SIZE); |
|
7144 |
val->o_class = cls; |
|
555 | 7145 |
bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread); |
295 | 7146 |
} |
7147 |
} |
|
7148 |
if (cp) |
|
7149 |
free(cp); |
|
7150 |
} |
|
7151 |
fail: ; |
|
7152 |
%}. |
|
7153 |
typeID isNil ifTrue:[ |
|
7154 |
^ false |
|
7155 |
]. |
|
7156 |
aTwoArgBlock value:typeID value:val. |
|
7157 |
^ true |
|
7158 |
! |
|
7159 |
||
7160 |
getSelectionFor:drawableId |
|
7161 |
"get the object selection - either immediate, or asynchronous. |
|
7162 |
Returns nil, if async request is on its way" |
|
7163 |
||
7164 |
|selProp sel| |
|
7165 |
||
7166 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
7167 |
"no primary selection - use cut buffer" |
|
7168 |
sel := self getObjectProperty:cutBuffer0Atom from:nil. |
|
7169 |
^ sel |
|
7170 |
]. |
|
7171 |
selProp := self atomIDOf:'ST_SELECTION' create:true. |
|
7172 |
self requestObjectSelection:primaryAtom property:selProp for:drawableId. |
|
7173 |
^ nil |
|
7174 |
! |
|
7175 |
||
7176 |
getSelectionOwnerOf:selectionAtomID |
|
7177 |
"get the owner of a selection" |
|
7178 |
||
7179 |
%{ /* NOCONTEXT */ |
|
7180 |
Display *dpy = myDpy; |
|
7181 |
Atom selection; |
|
7182 |
Window window; |
|
7183 |
||
7184 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
|
7185 |
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); |
|
7186 |
RETURN ((window == None) ? nil : __MKOBJ(window)); |
|
7187 |
} |
|
7188 |
%}. |
|
7189 |
self primitiveFailed. |
|
7190 |
^ nil |
|
7191 |
! |
|
7192 |
||
7193 |
getTextProperty:propertyID from:aWindowID |
|
7194 |
"get a text property; return string or nil" |
|
7195 |
||
7196 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
7197 |
type == stringAtom ifTrue:[ |
|
7198 |
^ value |
|
7199 |
] |
|
7200 |
]. |
|
7201 |
^ nil |
|
7202 |
! |
|
7203 |
||
7204 |
getTextSelectionFor:drawableId |
|
7205 |
"get the text selection - either immediate, or asynchronous. |
|
7206 |
Returns nil, if async request is on its way" |
|
7207 |
||
7208 |
|selProp sel| |
|
7209 |
||
7210 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
7211 |
"no primary selection - use cut buffer" |
|
7212 |
sel := self getTextProperty:cutBuffer0Atom from:nil. |
|
7213 |
^ sel |
|
7214 |
]. |
|
7215 |
selProp := self atomIDOf:'VT_SELECTION' create:true. |
|
7216 |
self requestTextSelection:primaryAtom property:selProp for:drawableId. |
|
7217 |
^ nil |
|
7218 |
! |
|
7219 |
||
7220 |
requestObjectSelection:selectionID property:propertyID for:aWindowId |
|
7221 |
"ask the server to send us the selection - the view with ID aWindowID |
|
7222 |
will later receive a SelectionNotify event for it." |
|
7223 |
||
7224 |
^ self requestSelection:selectionID |
|
7225 |
property:propertyID |
|
7226 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
7227 |
for:aWindowId |
|
7228 |
! |
|
7229 |
||
7230 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
|
7231 |
"ask the server to send us the selection - the view with id aWindowID |
|
7232 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
7233 |
with the selections value)." |
|
7234 |
||
7235 |
%{ /* NOCONTEXT */ |
|
7236 |
Display *dpy = myDpy; |
|
7237 |
Atom sel_prop; |
|
7238 |
char *cp; |
|
7239 |
||
7240 |
if (__isExternalAddress(aWindowId) |
|
7241 |
&& ISCONNECTED |
|
7242 |
&& __isSmallInteger(typeID) |
|
7243 |
&& __isAtomID(selectionID)) { |
|
7244 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
|
7245 |
/* |
|
7246 |
* no owner of primary selection |
|
7247 |
*/ |
|
7248 |
RETURN (false); |
|
7249 |
} |
|
7250 |
/* |
|
7251 |
* PRIMARY selection |
|
7252 |
*/ |
|
7253 |
XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), |
|
7254 |
_AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); |
|
7255 |
RETURN (true); |
|
7256 |
} |
|
7257 |
%}. |
|
7258 |
self primitiveFailed. |
|
7259 |
^ false |
|
7260 |
||
7261 |
" |
|
7262 |
Display requestSelection:(Display atomIDOf:'PRIMARY') |
|
7263 |
property:(Display atomIDOf:'VT_SELECTION') |
|
7264 |
for:0 |
|
7265 |
" |
|
7266 |
! |
|
7267 |
||
7268 |
requestTextSelection:selectionID property:propertyID for:aWindowId |
|
7269 |
"ask the server to send us the selection - the view with ID aWindowID |
|
7270 |
will later receive a SelectionNotify event for it." |
|
7271 |
||
7272 |
^ self requestSelection:selectionID |
|
7273 |
property:propertyID |
|
7274 |
type:stringAtom |
|
7275 |
for:aWindowId |
|
7276 |
! |
|
7277 |
||
7278 |
sendSelection:something property:propertyID target:targetID from:windowID to:requestorID |
|
7279 |
"send aString back from a SelectionRequest" |
|
7280 |
||
7281 |
self |
|
7282 |
sendSelection:something |
|
7283 |
selection:primaryAtom |
|
7284 |
property:propertyID |
|
7285 |
target:targetID |
|
7286 |
from:windowID |
|
7287 |
to:requestorID |
|
7288 |
! |
|
7289 |
||
7290 |
sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
7291 |
"send aString back from a SelectionRequest" |
|
7292 |
||
7293 |
self |
|
7294 |
setProperty:propertyID |
|
7295 |
type:targetID |
|
7296 |
value:something |
|
7297 |
for:requestorID. |
|
7298 |
self |
|
7299 |
sendSelectionNotifySelection:selectionID |
|
7300 |
property:propertyID |
|
7301 |
target:targetID |
|
7302 |
from:requestorID |
|
7303 |
to:requestorID. |
|
7304 |
! |
|
7305 |
||
7306 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
7307 |
"send a selectionNotify back from a SelectionRequest" |
|
7308 |
||
7309 |
%{ /* NOCONTEXT */ |
|
7310 |
Display *dpy = myDpy; |
|
7311 |
||
7312 |
if (__isAtomID(propertyID) |
|
7313 |
&& __isExternalAddress(requestorID) |
|
7314 |
&& ISCONNECTED |
|
7315 |
&& __isAtomID(targetID) |
|
7316 |
&& __isAtomID(selectionID)) { |
|
7317 |
XEvent ev; |
|
7318 |
Window requestor = _WindowVal(requestorID); |
|
7319 |
Atom property = _AtomVal(propertyID); |
|
7320 |
Atom target = _AtomVal(targetID); |
|
7321 |
Atom selection = _AtomVal(selectionID); |
|
7322 |
Status result; |
|
7323 |
||
7324 |
ev.xselection.type = SelectionNotify; |
|
7325 |
ev.xselection.selection = selection; |
|
7326 |
ev.xselection.target = target; |
|
7327 |
if (__isExternalAddress(windowID)) |
|
7328 |
ev.xselection.requestor = _WindowVal(windowID); |
|
7329 |
else |
|
7330 |
ev.xselection.requestor = DefaultRootWindow(dpy); |
|
7331 |
ev.xselection.time = CurrentTime; |
|
7332 |
if (property == None) |
|
7333 |
ev.xselection.property = target; |
|
7334 |
else |
|
7335 |
ev.xselection.property = property; |
|
7336 |
||
7337 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
|
7338 |
ev.xselection.selection, |
|
7339 |
ev.xselection.property, |
|
7340 |
ev.xselection.target, |
|
7341 |
ev.xselection.requestor, |
|
7342 |
requestor)); |
|
7343 |
||
7344 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
|
7345 |
if ((result == BadValue) || (result == BadWindow)) { |
|
7346 |
DPRINTF(("bad status\n")); |
|
382 | 7347 |
RETURN (false); |
295 | 7348 |
} |
382 | 7349 |
RETURN (true) |
7350 |
} |
|
7351 |
%}. |
|
7352 |
self primitiveFailed. |
|
7353 |
^ false |
|
295 | 7354 |
! |
7355 |
||
7356 |
setLengthProperty:propertyID value:aNumber for:aWindowID |
|
7357 |
^ self setProperty:propertyID type:(self atomIDOfLENGTH) value:aNumber for:aWindowID |
|
7358 |
! |
|
7359 |
||
7360 |
setObjectProperty:propertyID value:anObject for:aWindowID |
|
7361 |
|s| |
|
7362 |
||
7363 |
(anObject isMemberOf:String) ifTrue:[ |
|
7364 |
^ self setTextProperty:propertyID value:anObject for:aWindowID |
|
7365 |
]. |
|
7366 |
s := WriteStream on:(ByteArray new:200). |
|
7367 |
anObject storeBinaryOn:s. |
|
7368 |
^ self |
|
7369 |
setProperty:propertyID |
|
7370 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
7371 |
value:(s contents) |
|
7372 |
for:aWindowID |
|
7373 |
! |
|
7374 |
||
7375 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
|
7376 |
||
7377 |
%{ /* UNLIMITEDSTACK */ |
|
7378 |
||
7379 |
Display *dpy = myDpy; |
|
7380 |
Atom prop, type; |
|
7381 |
Window window; |
|
7382 |
unsigned int value; |
|
7383 |
||
7384 |
if (__isAtomID(propertyID) |
|
7385 |
&& __isAtomID(typeID) |
|
7386 |
&& ISCONNECTED |
|
7387 |
&& (__isString(anObject) |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7388 |
|| __isSmallInteger(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7389 |
|| __isSymbol(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7390 |
|| __isByteArray(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7391 |
|| __isWords(anObject))) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7392 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7393 |
prop = _AtomVal(propertyID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7394 |
type = _AtomVal(typeID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7395 |
if (__isExternalAddress(aWindowID)) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7396 |
window = _WindowVal(aWindowID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7397 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7398 |
window = DefaultRootWindow(dpy); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7399 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7400 |
if (__isSmallInteger(anObject)) { |
555 | 7401 |
value = __intVal(anObject); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7402 |
XChangeProperty(dpy, window, prop, type, 32, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7403 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7404 |
(unsigned char *)(&value), sizeof(unsigned int)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7405 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7406 |
if (__isByteArray(anObject)) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7407 |
XChangeProperty(dpy, window, prop, type, 8, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7408 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7409 |
__ByteArrayInstPtr(anObject)->ba_element, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7410 |
__byteArraySize(anObject)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7411 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7412 |
/* string or symbol or wordArray-like (16bit-string) object */ |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7413 |
if (__isWords(__qClass(anObject))) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7414 |
XChangeProperty(dpy, window, prop, XA_STRING, 16, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7415 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7416 |
__stringVal(anObject), |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7417 |
__wordArraySize(anObject)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7418 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7419 |
XChangeProperty(dpy, window, prop, XA_STRING, 8, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7420 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7421 |
__stringVal(anObject), |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7422 |
strlen(__stringVal(anObject))); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7423 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7424 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7425 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7426 |
RETURN (true); |
295 | 7427 |
} |
7428 |
%}. |
|
7429 |
^ false |
|
7430 |
! |
|
7431 |
||
7432 |
setSelection:anObject owner:aWindowId |
|
7433 |
"set the object selection, and make aWindowId be the owner. |
|
7434 |
This can be used by other Smalltalk(X) applications only." |
|
7435 |
||
7436 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
7437 |
^ false |
|
7438 |
]. |
|
7439 |
"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil |
|
7440 |
^ true |
|
7441 |
! |
|
7442 |
||
7443 |
setSelectionOwner:aWindowId of:selectionID |
|
7444 |
"set the owner of a selection; return false if failed" |
|
7445 |
||
7446 |
%{ /* NOCONTEXT */ |
|
7447 |
Display *dpy = myDpy; |
|
7448 |
Window win; |
|
7449 |
||
7450 |
if (__isExternalAddress(aWindowId) |
|
7451 |
&& __isAtomID(selectionID) |
|
7452 |
&& ISCONNECTED) { |
|
7453 |
win = _WindowVal(aWindowId); |
|
7454 |
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); |
|
7455 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { |
|
7456 |
RETURN (false); |
|
7457 |
} |
|
7458 |
RETURN (true); |
|
7459 |
} |
|
7460 |
%} |
|
7461 |
. |
|
7462 |
self primitiveFailed. |
|
7463 |
^ nil |
|
7464 |
! |
|
7465 |
||
7466 |
setTextProperty:propertyID value:aString for:aWindowID |
|
7467 |
^ self setProperty:propertyID type:(self atomIDOfSTRING) value:aString for:aWindowID |
|
7468 |
! |
|
7469 |
||
7470 |
setTextSelection:aString owner:aWindowId |
|
7471 |
"set the text selection, and make aWindowId be the owner. |
|
7472 |
This can be used by any other X application." |
|
7473 |
||
7474 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
7475 |
'ownerchange failed' errorPrintNL. |
|
7476 |
]. |
|
7477 |
^ self setTextProperty:cutBuffer0Atom value:aString for:nil |
|
7478 |
! ! |
|
7479 |
||
7480 |
!XWorkstation methodsFor:'window stuff'! |
|
7481 |
||
7482 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
|
7483 |
"clear a rectangular area to viewbackground" |
|
7484 |
||
7485 |
%{ /* NOCONTEXT */ |
|
7486 |
||
7487 |
int w, h; |
|
7488 |
||
7489 |
if (__isExternalAddress(aWindowId) |
|
7490 |
&& __bothSmallInteger(x, y) |
|
7491 |
&& __bothSmallInteger(width, height)) { |
|
555 | 7492 |
w = __intVal(width); |
7493 |
h = __intVal(height); |
|
1018 | 7494 |
/* |
7495 |
* need this check here: some servers simply dump core with bad args |
|
7496 |
*/ |
|
7497 |
if ((w >= 0) && (h >= 0)) { |
|
7498 |
XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
|
7499 |
} |
|
295 | 7500 |
RETURN ( self ); |
7501 |
} |
|
7502 |
%} |
|
7503 |
. |
|
7504 |
self primitiveFailed |
|
7505 |
! |
|
7506 |
||
7507 |
clearWindow:aWindowId |
|
7508 |
"clear a window to viewbackground" |
|
7509 |
||
7510 |
%{ /* NOCONTEXT */ |
|
7511 |
||
7512 |
if (__isExternalAddress(aWindowId)) { |
|
7513 |
XClearWindow(myDpy, _WindowVal(aWindowId)); |
|
7514 |
RETURN ( self ); |
|
7515 |
} |
|
7516 |
%} |
|
7517 |
. |
|
7518 |
self primitiveFailed |
|
7519 |
! |
|
7520 |
||
7521 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
|
7522 |
"configure stacking operation of aWindowId w.r.t siblingId" |
|
7523 |
||
7524 |
%{ /* NOCONTEXT */ |
|
7525 |
||
7526 |
XWindowChanges chg; |
|
7527 |
int mask = CWSibling | CWStackMode; |
|
7528 |
||
7529 |
if (__isExternalAddress(aWindowId) |
|
7530 |
&& __isExternalAddress(siblingId)) { |
|
7531 |
if (modeSymbol == @symbol(above)) { |
|
7532 |
chg.stack_mode = Above; |
|
7533 |
} else if (modeSymbol == @symbol(below)) { |
|
7534 |
chg.stack_mode = Below; |
|
7535 |
} else if (modeSymbol == @symbol(topIf)) { |
|
7536 |
chg.stack_mode = TopIf; |
|
7537 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
7538 |
chg.stack_mode = BottomIf; |
|
7539 |
} else if (modeSymbol == @symbol(opposite)) { |
|
7540 |
chg.stack_mode = Opposite; |
|
7541 |
} else { |
|
7542 |
mask = CWSibling; |
|
7543 |
} |
|
7544 |
||
7545 |
chg.sibling = _WindowVal(siblingId); |
|
7546 |
XConfigureWindow(myDpy, _WindowVal(aWindowId), |
|
7547 |
mask, &chg); |
|
7548 |
RETURN ( self ); |
|
7549 |
} |
|
7550 |
bad: ; |
|
7551 |
%} |
|
7552 |
. |
|
7553 |
self primitiveFailed |
|
7554 |
! |
|
7555 |
||
7556 |
lowerWindow:aWindowId |
|
7557 |
"bring a window to back" |
|
7558 |
||
7559 |
%{ /* NOCONTEXT */ |
|
7560 |
||
7561 |
if (__isExternalAddress(aWindowId)) { |
|
7562 |
XLowerWindow(myDpy, _WindowVal(aWindowId)); |
|
7563 |
RETURN ( self ); |
|
7564 |
} |
|
7565 |
%} |
|
7566 |
. |
|
7567 |
self primitiveFailed |
|
7568 |
! |
|
7569 |
||
7570 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h |
|
7571 |
"make a window visible - either as icon or as a real view - needed for restart" |
|
7572 |
||
7573 |
|wicon wiconId wiconView wiconViewId wlabel| |
|
7574 |
||
7575 |
aBoolean ifTrue:[ |
|
7576 |
wicon := aView icon. |
|
7577 |
wicon notNil ifTrue:[ |
|
7578 |
wiconId := wicon id |
|
7579 |
]. |
|
7580 |
wiconView := aView iconView. |
|
7581 |
wiconView notNil ifTrue:[ |
|
7582 |
wiconViewId := wiconView id |
|
7583 |
]. |
|
7584 |
wlabel := aView label. |
|
7585 |
]. |
|
7586 |
%{ |
|
7587 |
||
7588 |
XWMHints wmhints; |
|
7589 |
XSizeHints szhints; |
|
7590 |
Display *dpy = myDpy; |
|
7591 |
Window win; |
|
7592 |
||
7593 |
if (__isExternalAddress(aWindowId)) { |
|
7594 |
win = _WindowVal(aWindowId); |
|
7595 |
||
7596 |
szhints.flags = 0; |
|
7597 |
if (__bothSmallInteger(xPos, yPos)) { |
|
555 | 7598 |
szhints.x = __intVal(xPos); |
7599 |
szhints.y = __intVal(yPos); |
|
295 | 7600 |
szhints.flags |= USPosition; |
7601 |
} |
|
7602 |
if (__bothSmallInteger(w, h)) { |
|
555 | 7603 |
szhints.width = __intVal(w); |
7604 |
szhints.height = __intVal(h); |
|
295 | 7605 |
szhints.flags |= USSize; |
7606 |
} |
|
7607 |
||
7608 |
if (aBoolean == true) { |
|
7609 |
char *windowName; |
|
7610 |
Pixmap iconBitmap = (Pixmap)0; |
|
7611 |
Window iconWindow; |
|
7612 |
||
7613 |
if (__isExternalAddress(wiconId)) |
|
7614 |
iconBitmap = _PixmapVal(wiconId); |
|
7615 |
else |
|
7616 |
iconBitmap = (Pixmap)0; |
|
7617 |
||
7618 |
if (__isExternalAddress(wiconViewId)) |
|
7619 |
iconWindow = _WindowVal(wiconViewId); |
|
7620 |
else |
|
7621 |
iconWindow = (Window)0; |
|
7622 |
||
7623 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
7624 |
windowName = (char *)_stringVal(wlabel); |
|
7625 |
else |
|
7626 |
windowName = ""; |
|
7627 |
||
7628 |
if (iconBitmap || windowName) { |
|
7629 |
XSetStandardProperties(dpy, win, |
|
7630 |
windowName, windowName, |
|
7631 |
iconBitmap, |
|
7632 |
0, 0, &szhints); |
|
7633 |
} |
|
7634 |
||
7635 |
wmhints.flags = 0; |
|
7636 |
if (iconBitmap) { |
|
7637 |
wmhints.flags |= IconPixmapHint; |
|
7638 |
wmhints.icon_pixmap = iconBitmap; |
|
7639 |
} |
|
7640 |
if (iconWindow) { |
|
7641 |
wmhints.flags |= IconWindowHint; |
|
7642 |
wmhints.icon_window = iconWindow; |
|
7643 |
} |
|
7644 |
||
7645 |
wmhints.initial_state = IconicState; |
|
7646 |
wmhints.flags |= StateHint; |
|
7647 |
XSetWMHints(dpy, win, &wmhints); |
|
7648 |
} |
|
7649 |
||
7650 |
if (szhints.flags) { |
|
7651 |
XSetNormalHints(dpy, win, &szhints); |
|
7652 |
} |
|
7653 |
||
7654 |
XMapWindow(dpy, win); |
|
7655 |
RETURN ( self ); |
|
7656 |
} |
|
7657 |
%} |
|
7658 |
. |
|
7659 |
self primitiveFailed |
|
7660 |
! |
|
7661 |
||
7662 |
mapWindow:aWindowId |
|
7663 |
"make a window visible" |
|
7664 |
||
7665 |
%{ /* NOCONTEXT */ |
|
7666 |
||
7667 |
if (__isExternalAddress(aWindowId)) { |
|
7668 |
XMapWindow(myDpy, _WindowVal(aWindowId)); |
|
7669 |
RETURN ( self ); |
|
7670 |
} |
|
7671 |
%} |
|
7672 |
. |
|
7673 |
self primitiveFailed |
|
7674 |
! |
|
7675 |
||
7676 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
|
7677 |
"move and resize a window" |
|
7678 |
||
7679 |
%{ /* NOCONTEXT */ |
|
7680 |
||
7681 |
int newWidth, newHeight; |
|
7682 |
||
7683 |
if (__isExternalAddress(aWindowId) |
|
7684 |
&& __bothSmallInteger(w, h) |
|
7685 |
&& __bothSmallInteger(x, y)) { |
|
555 | 7686 |
newWidth = __intVal(w); |
7687 |
newHeight = __intVal(h); |
|
295 | 7688 |
if (newWidth < 1) newWidth = 1; |
7689 |
if (newHeight < 1) newHeight = 1; |
|
7690 |
XMoveResizeWindow(myDpy, _WindowVal(aWindowId), |
|
555 | 7691 |
__intVal(x), __intVal(y), |
295 | 7692 |
newWidth, newHeight); |
7693 |
RETURN ( self ); |
|
7694 |
} |
|
7695 |
%} |
|
7696 |
. |
|
7697 |
self primitiveFailed |
|
7698 |
! |
|
7699 |
||
7700 |
moveWindow:aWindowId x:x y:y |
|
7701 |
"move a window" |
|
7702 |
||
7703 |
%{ /* NOCONTEXT */ |
|
7704 |
||
7705 |
if (__isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
|
555 | 7706 |
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); |
295 | 7707 |
RETURN ( self ); |
7708 |
} |
|
7709 |
%} |
|
7710 |
. |
|
7711 |
self primitiveFailed |
|
7712 |
! |
|
7713 |
||
7714 |
raiseWindow:aWindowId |
|
7715 |
"bring a window to front" |
|
7716 |
||
7717 |
%{ /* NOCONTEXT */ |
|
7718 |
||
7719 |
if (__isExternalAddress(aWindowId)) { |
|
7720 |
XRaiseWindow(myDpy, _WindowVal(aWindowId)); |
|
7721 |
RETURN ( self ); |
|
7722 |
} |
|
7723 |
%} |
|
7724 |
. |
|
7725 |
self primitiveFailed |
|
7726 |
! |
|
7727 |
||
7728 |
resizeWindow:aWindowId width:w height:h |
|
7729 |
"resize a window" |
|
7730 |
||
7731 |
%{ /* NOCONTEXT */ |
|
7732 |
||
7733 |
int newWidth, newHeight; |
|
7734 |
||
7735 |
if (__isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
|
555 | 7736 |
newWidth = __intVal(w); |
7737 |
newHeight = __intVal(h); |
|
295 | 7738 |
if (newWidth < 1) newWidth = 1; |
7739 |
if (newHeight < 1) newHeight = 1; |
|
7740 |
XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); |
|
7741 |
RETURN ( self ); |
|
7742 |
} |
|
7743 |
%} |
|
7744 |
. |
|
7745 |
self primitiveFailed |
|
7746 |
! |
|
7747 |
||
7748 |
setBackingStore:how in:aWindowId |
|
7749 |
"turn on/off backing-store for a window" |
|
7750 |
||
7751 |
%{ /* NOCONTEXT */ |
|
7752 |
||
7753 |
XSetWindowAttributes wa; |
|
7754 |
||
7755 |
if (__isExternalAddress(aWindowId)) { |
|
555 | 7756 |
if (__INST(ignoreBackingStore) != true) { |
295 | 7757 |
if (how == @symbol(always)) wa.backing_store = Always; |
7758 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
7759 |
else if (how == true) wa.backing_store = Always; |
|
7760 |
else wa.backing_store = 0; |
|
7761 |
BEGIN_INTERRUPTSBLOCKED |
|
7762 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); |
|
7763 |
END_INTERRUPTSBLOCKED |
|
7764 |
} |
|
7765 |
RETURN ( self ); |
|
7766 |
} |
|
7767 |
%}. |
|
7768 |
self primitiveFailed |
|
7769 |
! |
|
7770 |
||
7771 |
setBitGravity:how in:aWindowId |
|
7772 |
"set bit gravity for a window" |
|
7773 |
||
7774 |
%{ /* NOCONTEXT */ |
|
7775 |
||
7776 |
XSetWindowAttributes wa; |
|
7777 |
||
7778 |
if (__isExternalAddress(aWindowId)) { |
|
7779 |
if (how == @symbol(NorthWest)) { |
|
7780 |
wa.bit_gravity = NorthWestGravity; |
|
7781 |
} else if (how == @symbol(NorthEast)) { |
|
7782 |
wa.bit_gravity = NorthEastGravity; |
|
7783 |
} else if (how == @symbol(SouthWest)) { |
|
7784 |
wa.bit_gravity = SouthWestGravity; |
|
7785 |
} else if (how == @symbol(SouthEast)) { |
|
7786 |
wa.bit_gravity = SouthEastGravity; |
|
7787 |
} else if (how == @symbol(Center)) { |
|
7788 |
wa.bit_gravity = CenterGravity; |
|
7789 |
} else if (how == @symbol(North)) { |
|
7790 |
wa.bit_gravity = NorthGravity; |
|
7791 |
} else if (how == @symbol(South)) { |
|
7792 |
wa.bit_gravity = SouthGravity; |
|
7793 |
} else if (how == @symbol(West)) { |
|
7794 |
wa.bit_gravity = WestGravity; |
|
7795 |
} else if (how == @symbol(East)) { |
|
7796 |
wa.bit_gravity = EastGravity; |
|
7797 |
} else { |
|
7798 |
wa.bit_gravity = NorthWestGravity; |
|
7799 |
} |
|
7800 |
||
7801 |
BEGIN_INTERRUPTSBLOCKED |
|
7802 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); |
|
7803 |
END_INTERRUPTSBLOCKED |
|
7804 |
RETURN ( self ); |
|
7805 |
} |
|
7806 |
%}. |
|
7807 |
self primitiveFailed |
|
7808 |
! |
|
7809 |
||
7810 |
setCursor:aCursorId in:aWindowId |
|
7811 |
"define a windows cursor" |
|
7812 |
||
7813 |
%{ /* NOCONTEXT */ |
|
7814 |
||
7815 |
Display *dpy = myDpy; |
|
7816 |
||
7817 |
if (__isExternalAddress(aWindowId) |
|
7818 |
&& __isExternalAddress(aCursorId)) { |
|
7819 |
XDefineCursor(dpy, _WindowVal(aWindowId), _CursorVal(aCursorId)); |
|
7820 |
RETURN ( self ); |
|
7821 |
} |
|
7822 |
%}. |
|
7823 |
self primitiveFailed |
|
7824 |
! |
|
7825 |
||
7826 |
setIconName:aString in:aWindowId |
|
7827 |
"define a windows iconname" |
|
7828 |
||
7829 |
%{ /* NOCONTEXT */ |
|
7830 |
||
7831 |
if (__isExternalAddress(aWindowId) |
|
7832 |
&& (__isString(aString) || __isSymbol(aString))) { |
|
7833 |
XSetIconName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString)); |
|
7834 |
RETURN ( self ); |
|
7835 |
} |
|
7836 |
%}. |
|
7837 |
self primitiveFailed |
|
7838 |
! |
|
7839 |
||
7840 |
setSaveUnder:yesOrNo in:aWindowId |
|
7841 |
"turn on/off save-under for a window" |
|
7842 |
||
7843 |
%{ /* NOCONTEXT */ |
|
7844 |
||
7845 |
XSetWindowAttributes wa; |
|
7846 |
||
7847 |
if (__isExternalAddress(aWindowId)) { |
|
555 | 7848 |
if (__INST(hasSaveUnder) == true) { |
295 | 7849 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
7850 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); |
|
7851 |
} |
|
7852 |
RETURN ( self ); |
|
7853 |
} |
|
7854 |
%}. |
|
7855 |
self primitiveFailed |
|
7856 |
! |
|
7857 |
||
7858 |
setTransient:aWindowId for:aMainWindowId |
|
7859 |
"set aWindowId to be a transient of aMainWindow" |
|
7860 |
||
7861 |
%{ /* NOCONTEXT */ |
|
7862 |
||
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7863 |
if (__isExternalAddress(aWindowId)) { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7864 |
Window w; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7865 |
|
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7866 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7867 |
w = (Window) 0; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7868 |
} else { |
374 | 7869 |
if (__isExternalAddress(aMainWindowId)) { |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7870 |
w = _WindowVal(aMainWindowId); |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7871 |
} else { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7872 |
goto getOutOfHere; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7873 |
} |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7874 |
} |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7875 |
XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); |
295 | 7876 |
RETURN ( self ); |
7877 |
} |
|
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7878 |
getOutOfHere: ; |
295 | 7879 |
%}. |
7880 |
self primitiveFailed |
|
7881 |
! |
|
7882 |
||
7883 |
setWindowBackground:aColorIndex in:aWindowId |
|
7884 |
"set the windows background color. This is the color with which |
|
7885 |
the view is filled whenever exposed. Do not confuse this with |
|
7886 |
the background drawing color, which is used with opaque drawing." |
|
7887 |
||
7888 |
%{ /* NOCONTEXT */ |
|
7889 |
||
7890 |
if (__isExternalAddress(aWindowId) |
|
7891 |
&& __isSmallInteger(aColorIndex)) { |
|
555 | 7892 |
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
295 | 7893 |
RETURN ( self ); |
7894 |
} |
|
7895 |
%}. |
|
7896 |
self primitiveFailed |
|
7897 |
! |
|
7898 |
||
7899 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
7900 |
"set the windows background pattern to be a form. |
|
7901 |
This is the pattern with which the view is filled whenever exposed. |
|
7902 |
Do not confuse this with the background drawing color, which is used |
|
7903 |
with opaque drawing." |
|
7904 |
||
7905 |
%{ /* NOCONTEXT */ |
|
7906 |
||
7907 |
if (__isExternalAddress(aWindowId) |
|
7908 |
&& __isExternalAddress(aPixmapId)) { |
|
7909 |
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
|
7910 |
RETURN ( self ); |
|
7911 |
} |
|
7912 |
%}. |
|
7913 |
self primitiveFailed |
|
7914 |
! |
|
7915 |
||
7916 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
7917 |
"set the windows border color" |
|
7918 |
||
7919 |
%{ /* NOCONTEXT */ |
|
7920 |
||
7921 |
if (__isExternalAddress(aWindowId) |
|
7922 |
&& __isSmallInteger(aColorIndex)) { |
|
555 | 7923 |
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
295 | 7924 |
RETURN ( self ); |
7925 |
} |
|
7926 |
%}. |
|
7927 |
self primitiveFailed |
|
7928 |
! |
|
7929 |
||
7930 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
7931 |
"set the windows border pattern" |
|
7932 |
||
7933 |
%{ /* NOCONTEXT */ |
|
7934 |
||
7935 |
if (__isExternalAddress(aWindowId) |
|
7936 |
&& __isExternalAddress(aPixmapId)) { |
|
7937 |
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
|
7938 |
RETURN ( self ); |
|
7939 |
} |
|
7940 |
%} |
|
7941 |
. |
|
7942 |
self primitiveFailed |
|
7943 |
! |
|
7944 |
||
7945 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
7946 |
"set the windows border shape" |
|
7947 |
||
7948 |
hasShapeExtension ifFalse:[^ self]. |
|
7949 |
||
7950 |
%{ /* NOCONTEXT */ |
|
7951 |
||
7952 |
#ifdef SHAPE |
|
7953 |
if (__isExternalAddress(aWindowId) |
|
7954 |
&& __isExternalAddress(aPixmapId)) { |
|
7955 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, |
|
7956 |
0, 0, _PixmapVal(aPixmapId), ShapeSet); |
|
7957 |
RETURN ( self ); |
|
7958 |
} |
|
7959 |
#endif |
|
7960 |
%}. |
|
7961 |
self primitiveFailed |
|
7962 |
! |
|
7963 |
||
7964 |
setWindowBorderWidth:aNumber in:aWindowId |
|
7965 |
"set the windows border width" |
|
7966 |
||
7967 |
%{ /* NOCONTEXT */ |
|
7968 |
||
7969 |
if (__isExternalAddress(aWindowId) |
|
7970 |
&& __isSmallInteger(aNumber)) { |
|
555 | 7971 |
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); |
295 | 7972 |
RETURN ( self ); |
7973 |
} |
|
7974 |
%}. |
|
7975 |
self primitiveFailed |
|
7976 |
! |
|
7977 |
||
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7978 |
setWindowClass:wClass name:wName in:aWindowId |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7979 |
"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
|
7980 |
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
|
7981 |
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
|
7982 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7983 |
%{ |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7984 |
if (__isExternalAddress(aWindowId)) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7985 |
XClassHint classhint; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7986 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7987 |
classhint.res_class = classhint.res_name = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7988 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7989 |
if (__isString(wClass) || __isSymbol(wClass)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7990 |
classhint.res_class = (char *)_stringVal(wClass); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7991 |
} else if (wClass != nil) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7992 |
goto error; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7993 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7994 |
if (__isString(wName) || __isSymbol(wName)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7995 |
classhint.res_name = (char *)_stringVal(wName); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7996 |
} else if (wName != nil) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7997 |
goto error; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7998 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7999 |
XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8000 |
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
|
8001 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8002 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8003 |
%}. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8004 |
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
|
8005 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8006 |
|
295 | 8007 |
setWindowGravity:how in:aWindowId |
8008 |
"set window gravity for a window" |
|
8009 |
||
8010 |
%{ /* NOCONTEXT */ |
|
8011 |
||
8012 |
XSetWindowAttributes wa; |
|
8013 |
||
8014 |
if (__isExternalAddress(aWindowId)) { |
|
8015 |
if (how == @symbol(NorthWest)) { |
|
8016 |
wa.win_gravity = NorthWestGravity; |
|
8017 |
} else if (how == @symbol(NorthEast)) { |
|
8018 |
wa.win_gravity = NorthEastGravity; |
|
8019 |
} else if (how == @symbol(SouthWest)) { |
|
8020 |
wa.win_gravity = SouthWestGravity; |
|
8021 |
} else if (how == @symbol(SouthEast)) { |
|
8022 |
wa.win_gravity = SouthEastGravity; |
|
8023 |
} else if (how == @symbol(Center)) { |
|
8024 |
wa.win_gravity = CenterGravity; |
|
8025 |
} else if (how == @symbol(North)) { |
|
8026 |
wa.win_gravity = NorthGravity; |
|
8027 |
} else if (how == @symbol(South)) { |
|
8028 |
wa.win_gravity = SouthGravity; |
|
8029 |
} else if (how == @symbol(West)) { |
|
8030 |
wa.win_gravity = WestGravity; |
|
8031 |
} else if (how == @symbol(East)) { |
|
8032 |
wa.win_gravity = EastGravity; |
|
8033 |
} else { |
|
8034 |
wa.win_gravity = NorthWestGravity; |
|
8035 |
} |
|
8036 |
||
8037 |
BEGIN_INTERRUPTSBLOCKED |
|
8038 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); |
|
8039 |
END_INTERRUPTSBLOCKED |
|
8040 |
RETURN ( self ); |
|
8041 |
} |
|
8042 |
%}. |
|
8043 |
self primitiveFailed |
|
8044 |
! |
|
8045 |
||
8046 |
setWindowIcon:aForm in:aWindowId |
|
8047 |
"define a bitmap to be used as icon" |
|
8048 |
||
8049 |
|iconId| |
|
8050 |
||
8051 |
aForm notNil ifTrue:[ |
|
8052 |
iconId := aForm id |
|
8053 |
]. |
|
8054 |
%{ |
|
8055 |
if (__isExternalAddress(iconId) |
|
8056 |
&& __isExternalAddress(aWindowId)) { |
|
8057 |
XWMHints hints; |
|
8058 |
||
8059 |
hints.icon_pixmap = _PixmapVal(iconId); |
|
8060 |
hints.flags = IconPixmapHint; |
|
8061 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
|
8062 |
RETURN ( self ); |
|
8063 |
} |
|
8064 |
%}. |
|
8065 |
self primitiveFailed |
|
8066 |
! |
|
8067 |
||
8068 |
setWindowIconWindow:aView in:aWindowId |
|
8069 |
"define a window to be used as icon" |
|
8070 |
||
8071 |
|iconWindowId| |
|
8072 |
||
8073 |
aView notNil ifTrue:[ |
|
8074 |
iconWindowId := aView id |
|
8075 |
]. |
|
8076 |
%{ |
|
8077 |
if (__isExternalAddress(iconWindowId) |
|
8078 |
&& __isExternalAddress(aWindowId)) { |
|
8079 |
XWMHints wmhints; |
|
8080 |
||
8081 |
wmhints.icon_window = _WindowVal(iconWindowId); |
|
8082 |
wmhints.flags = IconWindowHint; |
|
8083 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); |
|
8084 |
RETURN ( self ); |
|
8085 |
} |
|
8086 |
%}. |
|
8087 |
self primitiveFailed |
|
8088 |
! |
|
8089 |
||
8090 |
setWindowName:aString in:aWindowId |
|
8091 |
"define a windows name" |
|
8092 |
||
8093 |
%{ /* NOCONTEXT */ |
|
8094 |
||
8095 |
if (__isExternalAddress(aWindowId) |
|
8096 |
&& (__isString(aString) || __isSymbol(aString))) { |
|
8097 |
XStoreName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString)); |
|
8098 |
RETURN ( self ); |
|
8099 |
} |
|
8100 |
%}. |
|
8101 |
self primitiveFailed |
|
8102 |
! |
|
8103 |
||
8104 |
setWindowShape:aPixmapId in:aWindowId |
|
8105 |
"set the windows shape" |
|
8106 |
||
8107 |
hasShapeExtension ifFalse:[^ self]. |
|
8108 |
||
8109 |
%{ /* NOCONTEXT */ |
|
8110 |
||
8111 |
#ifdef SHAPE |
|
8112 |
if (__isExternalAddress(aWindowId) |
|
8113 |
&& __isExternalAddress(aPixmapId)) { |
|
8114 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, |
|
8115 |
0, 0, |
|
8116 |
_PixmapVal(aPixmapId), ShapeSet); |
|
8117 |
RETURN ( self ); |
|
8118 |
} |
|
8119 |
#endif |
|
8120 |
%}. |
|
8121 |
self primitiveFailed |
|
8122 |
! |
|
8123 |
||
8124 |
unmapWindow:aWindowId |
|
8125 |
"make a window invisible" |
|
8126 |
||
8127 |
%{ /* NOCONTEXT */ |
|
8128 |
||
8129 |
if (__isExternalAddress(aWindowId)) { |
|
8130 |
XUnmapWindow(myDpy, _WindowVal(aWindowId)); |
|
8131 |
RETURN ( self ); |
|
8132 |
} |
|
8133 |
%} |
|
8134 |
. |
|
8135 |
self primitiveFailed |
|
8136 |
! ! |
|
8137 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
8138 |
!XWorkstation class methodsFor:'documentation'! |
295 | 8139 |
|
8140 |
version |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
8141 |
^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.174 1996-09-18 10:30:16 cg Exp $' |
295 | 8142 |
! ! |
8143 |
XWorkstation initialize! |