author | Claus Gittinger <cg@exept.de> |
Wed, 02 Oct 1996 13:39:30 +0200 | |
changeset 1065 | fdc5b9059d82 |
parent 1062 | 2a5d50022c96 |
child 1068 | 348a9c6703c2 |
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 |
|
1062 | 30 |
#ifdef LINUX |
31 |
# define SHM |
|
32 |
#endif |
|
33 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
34 |
#define COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
35 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
36 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
37 |
static int __cnt_color = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
38 |
static int __cnt_bitmap = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
39 |
static int __cnt_view = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
40 |
static int __cnt_gc = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
41 |
static int __cnt_cursor = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
42 |
static int __cnt_font = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
43 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
44 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
45 |
|
46 | 46 |
/* |
47 |
* x does a typedef Time - I need Object Time ... |
|
48 |
*/ |
|
0 | 49 |
#define Time XTime |
50 |
||
391
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
51 |
/* |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
52 |
* x does a #define True / False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
53 |
* 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
|
54 |
*/ |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
55 |
#undef True |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
56 |
#undef False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
57 |
|
37 | 58 |
#ifdef memset |
59 |
# undef memset |
|
60 |
#endif |
|
61 |
||
0 | 62 |
#include <stdio.h> |
63 |
#include <X11/Xlib.h> |
|
64 |
#include <X11/Xutil.h> |
|
65 |
#include <X11/Xatom.h> |
|
66 |
||
150 | 67 |
#define XK_MISCELLANY |
68 |
#include <X11/keysymdef.h> |
|
69 |
||
277
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
70 |
#include <X11/cursorfont.h> |
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
71 |
|
90 | 72 |
/* |
73 |
* this define adds support for two-byte-strings. |
|
74 |
* leaving it undefined does not really save you much |
|
75 |
* (the define will vanish) |
|
76 |
*/ |
|
36 | 77 |
#define TWOBYTESTRINGS |
78 |
||
0 | 79 |
/* |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
80 |
* this define suppresses XAllocColor/XFreeColor on |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
81 |
* 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
|
82 |
* 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
|
83 |
*/ |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
84 |
#define QUICK_TRUE_COLORS |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
85 |
|
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
86 |
/* |
0 | 87 |
* shape support works; enabled by -DSHAPE in makefile |
88 |
* see RoundClock and RoundGlobe examples |
|
89 |
*/ |
|
90 |
#ifdef SHAPE |
|
91 |
# include <X11/extensions/shape.h> |
|
92 |
#endif |
|
93 |
||
94 |
/* |
|
150 | 95 |
* shared memory extension access is currently not supported |
0 | 96 |
* (only query is implemented) |
97 |
*/ |
|
98 |
#ifdef SHM |
|
99 |
# include <X11/extensions/XShm.h> |
|
100 |
#endif |
|
101 |
||
102 |
/* |
|
150 | 103 |
* multiBuffer extension access is currently not supported |
104 |
* (only query is implemented) |
|
105 |
*/ |
|
106 |
#ifdef MBUF |
|
107 |
# include <X11/extensions/multibuf.h> |
|
108 |
#endif |
|
109 |
||
110 |
/* |
|
111 |
* XVideo extension access is currently not supported |
|
112 |
* (only query is implemented) |
|
113 |
*/ |
|
114 |
#ifdef XVIDEO |
|
115 |
# include <X11/extensions/Xv.h> |
|
116 |
#endif |
|
117 |
||
118 |
/* |
|
186 | 119 |
* PEX extension - if available |
120 |
*/ |
|
121 |
#ifdef PEX5 |
|
122 |
# include <PEX5/PEX.h> |
|
123 |
#endif |
|
124 |
||
125 |
/* |
|
126 |
* XImage extension - if available |
|
127 |
*/ |
|
128 |
#ifdef XIE |
|
129 |
# include <X11/extensions/XIE.h> |
|
130 |
#endif |
|
131 |
||
132 |
/* |
|
90 | 133 |
* when I have more time to check it out, I will support display-PS |
0 | 134 |
*/ |
135 |
#ifdef DPS |
|
136 |
# ifdef sgi |
|
137 |
# include <X11/extensions/XDPS.h> |
|
138 |
# include <X11/extensions/XDPSlib.h> |
|
139 |
# include <X11/extensions/dpsXclient.h> |
|
140 |
# else |
|
141 |
# include <DPS/XDPS.h> |
|
142 |
# include <DPS/XDPSlib.h> |
|
143 |
# include <DPS/dpsXclient.h> |
|
144 |
# endif |
|
145 |
#endif |
|
146 |
||
90 | 147 |
#if defined(IRIX5) || (XlibSpecificationRelease == 6) |
148 |
/* |
|
149 |
* accessing private data in Display ... sorry |
|
150 |
*/ |
|
151 |
# define DISPLAYACCESS(d) ((_XPrivDisplay)d) |
|
152 |
#else |
|
153 |
# define DISPLAYACCESS(d) d |
|
154 |
#endif |
|
155 |
||
78 | 156 |
/* |
157 |
* some defines - tired of typing ... |
|
158 |
*/ |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
159 |
#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
|
160 |
#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
|
161 |
#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
|
162 |
#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
|
163 |
#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
|
164 |
#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
|
165 |
#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
|
166 |
|
211 | 167 |
#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
|
168 |
#define _AtomVal(o) __intVal(o) |
211 | 169 |
#define __isAtomID(o) __isSmallInteger(o) |
170 |
||
555 | 171 |
#define myDpy _DisplayVal(__INST(displayId)) |
172 |
#define ISCONNECTED (__INST(displayId) != nil) |
|
78 | 173 |
|
174 |
#ifndef THISCONTEXT_IN_REGISTER |
|
175 |
# define BEGIN_INTERRUPTSBLOCKED /* */ |
|
176 |
# define END_INTERRUPTSBLOCKED /* */ |
|
177 |
#else |
|
178 |
# define BEGIN_INTERRUPTSBLOCKED \ |
|
179 |
{ \ |
|
850 | 180 |
int needUnblock = 0; \ |
181 |
extern OBJ __thisContext__; \ |
|
182 |
\ |
|
183 |
__thisContext__ = __thisContext;\ |
|
184 |
if (!__interruptsBlocked) { \ |
|
185 |
__BLOCKINTERRUPTS(); \ |
|
186 |
needUnblock = 1; \ |
|
187 |
} |
|
78 | 188 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
189 |
# define END_INTERRUPTSBLOCKED_NOW \ |
850 | 190 |
__thisContext = __thisContext; \ |
191 |
__thisContext__ = 0; \ |
|
192 |
if (needUnblock) { \ |
|
193 |
__UNBLOCKINTERRUPTS(); \ |
|
194 |
} \ |
|
78 | 195 |
} |
196 |
||
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
197 |
# define END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
198 |
__thisContext = __thisContext; \ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
199 |
__thisContext__ = 0; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
200 |
|
78 | 201 |
#endif |
202 |
%} |
|
203 |
! ! |
|
204 |
||
205 |
!XWorkstation primitiveVariables! |
|
206 |
%{ |
|
0 | 207 |
/* |
146 | 208 |
* remembered info from private error handler |
0 | 209 |
*/ |
2 | 210 |
static char lastErrorMsg[80] = ""; |
211 |
static unsigned lastRequestCode = 0; |
|
212 |
static unsigned lastMinorCode = 0; |
|
213 |
static unsigned lastResource = 0; |
|
129 | 214 |
|
215 |
static int __debug__ = 0; |
|
216 |
#define DPRINTF(x) if (__debug__) { printf x; } |
|
78 | 217 |
%} |
218 |
! ! |
|
219 |
||
220 |
!XWorkstation primitiveFunctions! |
|
221 |
%{ |
|
1062 | 222 |
|
223 |
volatile static |
|
224 |
dummyToForceLoading() { |
|
225 |
XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
|
226 |
XCloseDisplay(0); |
|
227 |
XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
|
228 |
XSetWindowColormap(0, 0, 0); |
|
229 |
XQueryColors(0,0,0,0); |
|
230 |
#ifdef SHM |
|
231 |
XShmAttach(0, 0); |
|
232 |
XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
|
233 |
XShmDetach(0, 0); |
|
234 |
XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
|
235 |
shmctl(0,0,0); |
|
236 |
fgetc(0); |
|
237 |
#endif |
|
238 |
} |
|
239 |
||
18 | 240 |
/* |
144 | 241 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
242 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 243 |
* the implementation below is somewhat wrong: it will |
78 | 244 |
* report all errors for Display, even though there could be |
162 | 245 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
246 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 247 |
*/ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
248 |
|
12 | 249 |
__XErrorHandler__(dpy, event) |
0 | 250 |
Display *dpy; |
251 |
XErrorEvent *event; |
|
252 |
{ |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
253 |
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
|
254 |
lastErrorMsg[79] = '\0'; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
255 |
|
0 | 256 |
if (lastErrorMsg[0] == '\0') { |
70 | 257 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 258 |
} |
2 | 259 |
lastRequestCode = event->request_code; |
260 |
lastMinorCode = event->minor_code; |
|
261 |
lastResource = event->resourceid; |
|
911 | 262 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
263 |
/* |
|
264 |
* this is a BadWindow error for X_DestroyWindow. |
|
265 |
* ignore it here, since it results from the GC freeing windows |
|
266 |
* in non bottom-up window order. |
|
267 |
*/ |
|
268 |
return 0; |
|
269 |
} |
|
2 | 270 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
271 |
if (@global(ErrorPrinting) == true) { |
219
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
272 |
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
|
273 |
event->request_code, event->request_code, |
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
274 |
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
|
275 |
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
|
276 |
} |
43 | 277 |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
278 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKOBJ(dpy)); |
0 | 279 |
return 0; |
280 |
} |
|
281 |
||
90 | 282 |
#ifdef VIRTUAL_ROOT |
0 | 283 |
/* |
18 | 284 |
* added since RootWindow-macro is not suficient |
285 |
* when virtual root-windows are involved (i.e. tvtwm) |
|
286 |
*/ |
|
287 |
static Window |
|
288 |
getRootWindow(dpy, screen) |
|
289 |
Display *dpy; |
|
290 |
{ |
|
291 |
Window root; |
|
292 |
Atom vRootAtom = None; |
|
293 |
int i; |
|
294 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
295 |
Window* children = (Window *)0; |
18 | 296 |
unsigned int numChildren; |
297 |
||
298 |
root = RootWindow(dpy, screen); |
|
299 |
/* |
|
300 |
* on IRIS, this creates a badwindow error - why ? |
|
301 |
* children contains a funny window (000034) |
|
302 |
*/ |
|
90 | 303 |
# if !defined(IRIS) || defined(IRIX5) |
18 | 304 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
70 | 305 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
306 |
if (vRootAtom != None) { |
|
307 |
for (i=0; i < numChildren; i++) { |
|
308 |
Atom actual_type; |
|
309 |
int actual_format; |
|
310 |
unsigned long nitems, bytesafter; |
|
311 |
Window* newRoot = (Window*) 0; |
|
312 |
||
313 |
if (children[i]) { |
|
314 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
|
315 |
0L, 1L, False, XA_WINDOW, |
|
316 |
&actual_type, &actual_format, &nitems, &bytesafter, |
|
317 |
(unsigned char**) &newRoot) == Success && newRoot) { |
|
318 |
root = *newRoot; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
319 |
XFree(newRoot); /* XXX */ |
70 | 320 |
break; |
321 |
} |
|
322 |
} |
|
323 |
} |
|
324 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
325 |
if (children) XFree( children ); |
18 | 326 |
} |
90 | 327 |
# endif |
18 | 328 |
return root; |
329 |
} |
|
90 | 330 |
#endif |
0 | 331 |
%} |
78 | 332 |
! ! |
0 | 333 |
|
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
334 |
!XWorkstation class methodsFor:'documentation'! |
295 | 335 |
|
336 |
copyright |
|
337 |
" |
|
338 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
339 |
All Rights Reserved |
|
340 |
||
341 |
This software is furnished under a license and may be used |
|
342 |
only in accordance with the terms of that license and with the |
|
343 |
inclusion of the above copyright notice. This software may not |
|
344 |
be provided or otherwise made available to, or used by, any |
|
345 |
other person. No title to or ownership of the software is |
|
346 |
hereby transferred. |
|
347 |
" |
|
348 |
! |
|
349 |
||
350 |
documentation |
|
351 |
" |
|
352 |
this class provides the interface to X11. It redefines all required methods |
|
353 |
from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically |
|
354 |
limited to one display - in theory, you can create Views on many displays |
|
355 |
simultanously. However, the default setup is for one display only. |
|
356 |
To support multiple displays, you will have to start another event dispatcher |
|
357 |
process for the other display(s) and create the other views with a slightly |
|
358 |
different protocol. However, 'normal' applications do not have to care for |
|
359 |
all of this ... |
|
360 |
||
361 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 362 |
|
363 |
[author:] |
|
850 | 364 |
Claus Gittinger |
295 | 365 |
" |
366 |
! ! |
|
367 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
368 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
369 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
370 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
371 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
372 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
373 |
super initialize. |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
374 |
|
386 | 375 |
RawKeysymTranslation isNil ifTrue:[ |
376 |
"/ the following table maps X-keyevents to ST/X |
|
377 |
"/ device independed events. |
|
378 |
"/ It is NOT meant as a keyboardMap replacement. |
|
379 |
||
380 |
RawKeysymTranslation := d := Dictionary new. |
|
381 |
d at:'Delete_line' put:#DeleteLine. |
|
382 |
d at:'Delete_word' put:#DeleteWord. |
|
383 |
d at:'Down' put:#CursorDown. |
|
384 |
d at:'Up' put:#CursorUp. |
|
385 |
d at:'Left' put:#CursorLeft. |
|
386 |
d at:'Right' put:#CursorRight. |
|
387 |
] |
|
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
388 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
389 |
|
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
390 |
!XWorkstation class methodsFor:'error handling'! |
2 | 391 |
|
129 | 392 |
debug:aBoolean |
393 |
%{ /* NOCONTEXT */ |
|
394 |
||
395 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
396 |
%} |
|
397 |
! |
|
398 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
399 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
400 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
401 |
#ifdef COUNT_RESOURCES |
928 | 402 |
printf("colors %d bitmaps %d view %d gc %d cursor %d font %d\n", |
403 |
__cnt_color, __cnt_bitmap, |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
404 |
__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
|
405 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
406 |
%} |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
407 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
408 |
|
78 | 409 |
errorStringOfLastError |
410 |
%{ |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
411 |
RETURN ( __MKSTRING(lastErrorMsg) ); |
78 | 412 |
%} |
413 |
! |
|
414 |
||
135 | 415 |
lastErrorString |
2 | 416 |
"return the last X-error string - |
417 |
when buffering is on, this may be |
|
418 |
an error for a long-ago operation" |
|
78 | 419 |
|
420 |
|string requestCode s match line| |
|
421 |
||
422 |
string := self errorStringOfLastError. |
|
423 |
requestCode := self requestCodeOfLastError. |
|
424 |
" |
|
425 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
426 |
and append the name of the corresponding X-request |
|
427 |
" |
|
428 |
s := '/usr/lib/X11/XErrorDB' asFilename readStream. |
|
429 |
s notNil ifTrue:[ |
|
430 |
match := 'XRequest.' , requestCode printString. |
|
431 |
line := s peekForLineStartingWith:match. |
|
432 |
line notNil ifTrue:[ |
|
433 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
434 |
]. |
|
435 |
s close. |
|
436 |
]. |
|
437 |
^ string |
|
295 | 438 |
! |
439 |
||
440 |
minorCodeOfLastError |
|
441 |
%{ /* NOCONTEXT */ |
|
442 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
443 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 444 |
%} |
445 |
! |
|
446 |
||
447 |
requestCodeOfLastError |
|
152 | 448 |
%{ /* NOCONTEXT */ |
449 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
450 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 451 |
%} |
135 | 452 |
! |
453 |
||
295 | 454 |
resourceIdOfLastError |
0 | 455 |
%{ /* NOCONTEXT */ |
295 | 456 |
|
457 |
RETURN ( __MKOBJ(lastResource) ); |
|
0 | 458 |
%} |
459 |
! ! |
|
460 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
461 |
!XWorkstation class methodsFor:'queries'! |
104 | 462 |
|
463 |
platformName |
|
133 | 464 |
"ST-80 compatibility. |
465 |
Return a string describing the display systems platform." |
|
466 |
||
715 | 467 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
468 |
||
469 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 470 |
! ! |
471 |
||
0 | 472 |
!XWorkstation methodsFor:'accessing & queries'! |
473 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
474 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
475 |
"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
|
476 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
477 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
478 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
479 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
480 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
481 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
482 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
483 |
|
295 | 484 |
blackpixel |
485 |
"return the colornumber of black" |
|
486 |
||
487 |
^ blackpixel |
|
488 |
! |
|
489 |
||
490 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
491 |
"return the state-mask for button1 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(Button1MotionMask)); |
295 | 496 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
497 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
498 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
499 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
500 |
" |
295 | 501 |
! |
502 |
||
503 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
504 |
"return the state-mask for button2 in motion events' state-field |
295 | 505 |
For backward compatibility." |
506 |
||
507 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
508 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 509 |
%} |
510 |
! |
|
511 |
||
512 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
513 |
"return the state-mask for button3 in motion events' state-field |
295 | 514 |
For backward compatibility." |
515 |
||
516 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
517 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 518 |
%} |
519 |
! |
|
520 |
||
521 |
buttonMotionMask:aButton |
|
522 |
"return the state-mask for button1 in motion events state-field. |
|
523 |
This is the devices mask." |
|
524 |
||
525 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
526 |
if (aButton == __MKSMALLINT(1)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
527 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
528 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
529 |
if (aButton == __MKSMALLINT(2)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
530 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
531 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
532 |
if (aButton == __MKSMALLINT(3)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
533 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 534 |
} |
535 |
%}. |
|
536 |
^ nil |
|
537 |
! |
|
538 |
||
382 | 539 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
540 |
"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
|
541 |
|
382 | 542 |
%{ /* NOCONTEXT */ |
543 |
RETURN (__MKSMALLINT(ControlMask)); |
|
544 |
%} |
|
545 |
! |
|
546 |
||
295 | 547 |
defaultEventMask |
548 |
"return a mask to enable some events by default." |
|
549 |
||
550 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
551 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
295 | 552 |
KeyPressMask | KeyReleaseMask | |
553 |
EnterWindowMask | LeaveWindowMask | |
|
554 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
|
555 |
%} |
|
556 |
! |
|
557 |
||
0 | 558 |
displayFileDescriptor |
559 |
"return the displays fileNumber - for select" |
|
560 |
||
561 |
%{ /* NOCONTEXT */ |
|
562 |
||
150 | 563 |
if (ISCONNECTED) { |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
564 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 565 |
} |
566 |
RETURN (nil); |
|
0 | 567 |
%} |
568 |
! |
|
569 |
||
133 | 570 |
displayName |
571 |
"return the X-connections display name. |
|
572 |
This is (currently) nil for the default display, |
|
573 |
something like foo:0 for any other remote display. |
|
574 |
Future versions may return non-nil strings for the default display as well." |
|
575 |
||
576 |
^ displayName |
|
577 |
! |
|
578 |
||
341 | 579 |
protocolVersion |
580 |
"return the X-servers protocol version - should normally not be of |
|
581 |
any interest" |
|
582 |
||
583 |
%{ /* NOCONTEXT */ |
|
584 |
if (ISCONNECTED) { |
|
585 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
|
586 |
} |
|
587 |
RETURN (nil); |
|
588 |
%} |
|
589 |
||
590 |
" |
|
591 |
Display protocolVersion |
|
592 |
" |
|
593 |
! |
|
594 |
||
595 |
serverVendor |
|
596 |
"return the X-server vendor string - this should normally not be of |
|
597 |
any interest, but can be for special cases |
|
598 |
(to avoid bugs in certain implementations)" |
|
599 |
%{ |
|
600 |
if (ISCONNECTED) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
601 |
RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
341 | 602 |
} |
603 |
RETURN (nil); |
|
604 |
%} |
|
605 |
||
606 |
" |
|
607 |
Display serverVendor |
|
608 |
" |
|
609 |
! |
|
610 |
||
382 | 611 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
612 |
"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
|
613 |
|
382 | 614 |
%{ /* NOCONTEXT */ |
615 |
RETURN (__MKSMALLINT(ShiftMask)); |
|
616 |
%} |
|
617 |
! |
|
618 |
||
341 | 619 |
translatePoint:aPoint from:windowId1 to:windowId2 |
620 |
"given a point in window1, return the coordinate in window2. |
|
621 |
This expects a device coordinate (relative to the first views origin) |
|
622 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
623 |
- use to xlate points from a window to rootwindow" |
|
624 |
||
625 |
|x1 y1 x2 y2| |
|
626 |
||
627 |
x1 := x2 := aPoint x truncated. |
|
628 |
y1 := y2 := aPoint y truncated. |
|
629 |
%{ |
|
630 |
int xpos, ypos; |
|
631 |
Window w1, w2, child_return; |
|
555 | 632 |
int screen = __intVal(__INST(screen)); |
341 | 633 |
Display *dpy = myDpy; |
634 |
||
635 |
if (__isExternalAddress(windowId1) |
|
636 |
&& __isExternalAddress(windowId2) |
|
637 |
&& __bothSmallInteger(x1, y1)) { |
|
638 |
w1 = _WindowVal(windowId1); |
|
639 |
w2 = _WindowVal(windowId2); |
|
640 |
#ifdef VIRTUAL_ROOT |
|
641 |
if ((w1 == RootWindow(dpy, screen)) |
|
642 |
|| (w2 == RootWindow(dpy, screen))) { |
|
643 |
if (w1 == RootWindow(dpy, screen)) { |
|
644 |
w1 = getRootWindow(dpy, screen); |
|
645 |
} |
|
646 |
if (w2 == RootWindow(dpy, screen)) { |
|
647 |
w2 = getRootWindow(dpy, screen); |
|
648 |
} |
|
649 |
} |
|
650 |
#endif |
|
651 |
BEGIN_INTERRUPTSBLOCKED |
|
652 |
XTranslateCoordinates(dpy, w1, w2, |
|
555 | 653 |
__intVal(x1), __intVal(y1), |
341 | 654 |
&xpos, &ypos, &child_return); |
655 |
END_INTERRUPTSBLOCKED |
|
656 |
x2 = __MKSMALLINT(xpos); |
|
657 |
y2 = __MKSMALLINT(ypos); |
|
658 |
} |
|
659 |
%}. |
|
660 |
||
661 |
^ (x2 @ y2) |
|
662 |
! |
|
663 |
||
664 |
vendorRelease |
|
665 |
"return the X-servers vendor release - should normally not be of |
|
666 |
any interest, but can be for special cases. |
|
667 |
(to avoid bugs in certain implementations)" |
|
668 |
||
669 |
%{ /* NOCONTEXT */ |
|
670 |
if (ISCONNECTED) { |
|
671 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
|
672 |
} |
|
673 |
RETURN (nil); |
|
674 |
%} |
|
675 |
||
676 |
" |
|
677 |
Display vendorRelease |
|
678 |
" |
|
679 |
! |
|
680 |
||
681 |
viewIdFromPoint:aPoint in:windowId |
|
682 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
683 |
hit by this coordinate. Return nil if no view was hit. |
|
684 |
The returned id may be the id of a non ST view. |
|
685 |
- used to find the window to drop objects after a cross-view drag." |
|
686 |
||
687 |
%{ /* NOCONTEXT */ |
|
688 |
||
689 |
Display *dpy = myDpy; |
|
555 | 690 |
int screen = __intVal(__INST(screen)); |
341 | 691 |
OBJ xp, yp; |
692 |
int xpos, ypos; |
|
693 |
Window child_return; |
|
694 |
||
695 |
if (__isExternalAddress(windowId) |
|
696 |
&& __isPoint(aPoint)) { |
|
697 |
xp = _point_X(aPoint); |
|
698 |
yp = _point_Y(aPoint); |
|
699 |
if (__bothSmallInteger(xp, yp)) { |
|
700 |
BEGIN_INTERRUPTSBLOCKED |
|
701 |
XTranslateCoordinates(dpy, |
|
702 |
RootWindow(dpy, screen), |
|
703 |
_WindowVal(windowId), |
|
555 | 704 |
__intVal(xp), __intVal(yp), |
341 | 705 |
&xpos, &ypos, &child_return); |
706 |
END_INTERRUPTSBLOCKED |
|
707 |
if (child_return) { |
|
708 |
RETURN ( __MKOBJ(child_return) ); |
|
709 |
} |
|
710 |
RETURN ( nil ); |
|
711 |
} |
|
712 |
} |
|
713 |
%}. |
|
714 |
windowId notNil ifTrue:[ |
|
715 |
aPoint isPoint ifTrue:[ |
|
716 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
717 |
] |
|
718 |
]. |
|
719 |
||
720 |
^ nil |
|
721 |
! |
|
722 |
||
723 |
virtualExtent |
|
724 |
"return the virtual extent of the display (in pixels). |
|
725 |
On most systems, this is the same as the physical width; |
|
726 |
except, if a window manager with a virtual desktop like olvwm |
|
727 |
(simulating a bigger screen) is running." |
|
728 |
||
729 |
%{ |
|
555 | 730 |
if ((__INST(rootId) != __INST(virtualRootId)) |
731 |
&& __isExternalAddress(__INST(virtualRootId))) { |
|
341 | 732 |
Window vRootWin; |
733 |
Window root; |
|
734 |
int x, y; |
|
735 |
unsigned int width, height; |
|
736 |
unsigned int dummy; |
|
737 |
||
555 | 738 |
vRootWin = _WindowVal(__INST(virtualRootId)); |
341 | 739 |
if (XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
740 |
&dummy, &dummy)) { |
|
741 |
RETURN ( __MKPOINT_INT(width, height) ); |
|
742 |
} |
|
743 |
} |
|
744 |
%}. |
|
745 |
^ width @ height |
|
746 |
! |
|
747 |
||
748 |
whitepixel |
|
749 |
"return the colornumber of white" |
|
750 |
||
751 |
^ whitepixel |
|
752 |
! ! |
|
753 |
||
754 |
!XWorkstation methodsFor:'accessing display capabilities'! |
|
755 |
||
0 | 756 |
hasDPS |
186 | 757 |
"return true, if this workstation supports display postscript. |
758 |
Both the server must support it, and the feature must have been |
|
759 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 760 |
|
761 |
^ hasDPSExtension |
|
186 | 762 |
|
763 |
" |
|
764 |
Display hasDPS |
|
765 |
" |
|
766 |
! |
|
767 |
||
150 | 768 |
hasExtension:extensionString |
769 |
"query for an X extension. The argument, extensionString |
|
770 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 771 |
Return true, if that extension is available in the server. |
772 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 773 |
|
774 |
%{ |
|
775 |
int dummy; |
|
776 |
||
777 |
if (__isString(extensionString) && ISCONNECTED) { |
|
778 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
|
779 |
RETURN ( true ); |
|
780 |
} |
|
781 |
} |
|
782 |
%}. |
|
783 |
^ false |
|
186 | 784 |
|
785 |
" |
|
786 |
Display hasExtension:'XVideo' |
|
787 |
Display hasExtension:'Input' |
|
788 |
Display hasExtension:'GLX' |
|
789 |
Display hasExtension:'X3D-PEX' |
|
790 |
Display hasExtension:'XInputExtension' |
|
791 |
Display hasExtension:'SHAPE' |
|
792 |
Display hasExtension:'MIT-SHM' |
|
793 |
Display hasExtension:'SGIFullScreenStereo' |
|
794 |
" |
|
150 | 795 |
! |
796 |
||
295 | 797 |
hasImageExtension |
798 |
"return true, if this workstation supports the X image extension. |
|
799 |
Both the server must support it, and the feature must have been |
|
800 |
enabled in the smalltalk system, for true to be returned." |
|
801 |
||
802 |
^ hasImageExtension |
|
803 |
||
804 |
" |
|
805 |
Display hasImageExtension |
|
806 |
" |
|
807 |
! |
|
808 |
||
809 |
hasInputExtension |
|
810 |
"return true, if this workstation supports the X input extension. |
|
811 |
Both the server must support it, and the feature must have been |
|
812 |
enabled in the smalltalk system, for true to be returned." |
|
813 |
||
814 |
^ hasInputExtension |
|
815 |
||
816 |
" |
|
817 |
Display hasInputExtension |
|
818 |
" |
|
819 |
! |
|
820 |
||
821 |
hasMultibuffer |
|
822 |
"return true, if this workstation supports the multibuffer extension. |
|
823 |
Both the server must support it, and the feature must have been |
|
824 |
enabled in the smalltalk system, for true to be returned." |
|
825 |
||
826 |
^ hasMbufExtension |
|
827 |
||
828 |
" |
|
829 |
Display hasMultibuffer |
|
830 |
" |
|
831 |
! |
|
832 |
||
833 |
hasPEX |
|
834 |
"return true, if this workstation supports PEX 3D graphics. |
|
835 |
Both the server must support it, and the feature must have been |
|
836 |
enabled in the smalltalk system, for true to be returned." |
|
837 |
||
838 |
^ hasPEXExtension |
|
839 |
||
840 |
" |
|
841 |
Display hasPEX |
|
842 |
" |
|
843 |
! |
|
844 |
||
845 |
hasShape |
|
846 |
"return true, if this workstation supports non-rectangular windows. |
|
847 |
Both the server must support it, and the feature must have been |
|
848 |
enabled in the smalltalk system, for true to be returned." |
|
849 |
||
850 |
^ hasShapeExtension |
|
851 |
||
852 |
" |
|
853 |
Display hasShape |
|
854 |
" |
|
855 |
! |
|
856 |
||
857 |
hasShm |
|
858 |
"return true, if this workstation supports the shared pixmap extension. |
|
859 |
Both the server must support it, and the feature must have been |
|
860 |
enabled in the smalltalk system, for true to be returned." |
|
861 |
||
862 |
^ hasShmExtension |
|
863 |
||
864 |
" |
|
865 |
Display hasShm |
|
866 |
" |
|
867 |
! |
|
868 |
||
869 |
hasXVideo |
|
870 |
"return true, if this workstation supports the XVideo extension. |
|
871 |
Both the server must support it, and the feature must have been |
|
872 |
enabled in the smalltalk system, for true to be returned." |
|
873 |
||
874 |
^ hasXVideoExtension |
|
875 |
||
876 |
" |
|
877 |
Display hasXVideo |
|
878 |
" |
|
879 |
! |
|
880 |
||
881 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
882 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 883 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 884 |
|
885 |
|xIconSizes count ret| |
|
886 |
||
887 |
%{ |
|
888 |
Display *dpy = myDpy; |
|
555 | 889 |
int screen = __intVal(__INST(screen)); |
295 | 890 |
XIconSize *sizeList; |
891 |
int cnt; |
|
892 |
||
893 |
if (ISCONNECTED) { |
|
850 | 894 |
if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) { |
895 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
|
896 |
count = __MKSMALLINT(cnt); |
|
897 |
} |
|
295 | 898 |
} |
899 |
%}. |
|
900 |
xIconSizes isNil ifTrue:[^ nil]. |
|
901 |
||
902 |
ret := OrderedCollection new:count. |
|
903 |
1 to:count do:[ :i | |
|
850 | 904 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 905 |
|
906 |
%{ |
|
850 | 907 |
XIconSize *slp; |
908 |
||
909 |
slp = &((XIconSize *)__externalBytesAddress(xIconSizes))[__intVal(i)-1]; |
|
910 |
minWidth = __MKSMALLINT(slp->min_width); |
|
911 |
minHeight = __MKSMALLINT(slp->min_height); |
|
912 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
913 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
914 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
915 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 916 |
%}. |
850 | 917 |
d := IdentityDictionary new. |
918 |
d at:#minWidth put:minWidth. |
|
919 |
d at:#maxWidth put:maxWidth. |
|
920 |
d at:#widthStep put:widthStep. |
|
921 |
d at:#minHeight put:minHeight. |
|
922 |
d at:#maxHeight put:maxHeight. |
|
923 |
d at:#heightStep put:heightStep. |
|
924 |
||
925 |
ret add:d |
|
295 | 926 |
]. |
927 |
||
928 |
xIconSizes free. |
|
929 |
^ ret |
|
930 |
||
931 |
" |
|
819 | 932 |
Display iconSizes |
295 | 933 |
" |
934 |
! |
|
935 |
||
341 | 936 |
ignoreBackingStore:aBoolean |
937 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
938 |
no backing store used - this can be used on servers where backing store is |
|
939 |
very slow or is broken (can be put into display-rc-file)" |
|
940 |
||
941 |
ignoreBackingStore := aBoolean |
|
295 | 942 |
! |
943 |
||
823 | 944 |
preferredIconSize |
945 |
"return the displays preferred size for icons. |
|
946 |
Redefined to return a special value on SGI servers." |
|
947 |
||
948 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
850 | 949 |
^ 86@68 |
823 | 950 |
]. |
951 |
^ super preferredIconSize |
|
952 |
||
953 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
954 |
! |
|
955 |
||
1025 | 956 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
957 |
"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
|
958 |
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
|
959 |
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
|
960 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
961 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
962 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
963 |
|
43 | 964 |
supportedImageFormats |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
965 |
"return an array with supported image formats; |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
966 |
each array entry is an attribute dictionary, consisting of |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
967 |
depth, bitsPerPixel and padding values." |
43 | 968 |
|
150 | 969 |
|nFormats "{ Class: SmallInteger }" |
970 |
formatArray| |
|
43 | 971 |
%{ |
972 |
Display *dpy = myDpy; |
|
150 | 973 |
|
974 |
if (! ISCONNECTED) { |
|
975 |
RETURN (nil); |
|
976 |
} |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
977 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
43 | 978 |
%}. |
979 |
formatArray := Array new:nFormats. |
|
150 | 980 |
1 to:nFormats do:[:index | |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
981 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
150 | 982 |
|
983 |
i := index. |
|
43 | 984 |
%{ |
70 | 985 |
ScreenFormat *format; |
986 |
Display *dpy = myDpy; |
|
987 |
||
90 | 988 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
555 | 989 |
format += (__intVal(i)-1); |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
990 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
991 |
depthInfo = __MKSMALLINT(format->depth); |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
992 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
43 | 993 |
%}. |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
994 |
info := IdentityDictionary new. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
995 |
info at:#depth put:depthInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
996 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
997 |
info at:#padding put:paddingInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
998 |
formatArray at:index put:info. |
43 | 999 |
]. |
1000 |
^ formatArray |
|
1001 |
||
1002 |
" |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1003 |
Display supportedImageFormats |
43 | 1004 |
" |
1005 |
! |
|
1006 |
||
823 | 1007 |
supportsIconViews |
1008 |
"return true, if this device supports views as icons. |
|
1009 |
Only Xservers (currently) support this." |
|
1010 |
||
1011 |
^ true |
|
1012 |
||
1013 |
" |
|
1014 |
Display supportsIconViews |
|
1015 |
" |
|
1016 |
||
1017 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1018 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
1019 |
! |
|
1020 |
||
81 | 1021 |
supportsViewGravity |
1022 |
"return true, if this device supports gravity attributes. |
|
82 | 1023 |
We do not depend on it being implemented, but some resizing operations |
81 | 1024 |
are faster, it is is." |
1025 |
||
1026 |
^ true |
|
0 | 1027 |
! ! |
1028 |
||
1029 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1030 |
||
295 | 1031 |
createBitmapFromArray:anArray width:w height:h |
1032 |
|bitmapId| |
|
1033 |
||
1034 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1035 |
bitmapId isNil ifTrue:[ |
|
1036 |
self primitiveFailed |
|
1037 |
]. |
|
1038 |
^ bitmapId |
|
1039 |
! |
|
1040 |
||
1041 |
createBitmapFromFile:aString for:aForm |
|
1042 |
|id w h| |
|
1043 |
||
1044 |
%{ |
|
1045 |
Display *dpy = myDpy; |
|
555 | 1046 |
int screen = __intVal(__INST(screen)); |
295 | 1047 |
Pixmap newBitmap; |
1048 |
char *filename; |
|
1049 |
unsigned b_width, b_height; |
|
1050 |
int b_x_hot, b_y_hot; |
|
1051 |
int status; |
|
1052 |
||
1053 |
if (ISCONNECTED) { |
|
1054 |
if (__isString(aString) || __isSymbol(aString)) { |
|
1055 |
filename = (char *)_stringVal(aString); |
|
1056 |
||
1057 |
BEGIN_INTERRUPTSBLOCKED |
|
1058 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
|
1059 |
filename, &b_width, &b_height, &newBitmap, |
|
1060 |
&b_x_hot, &b_y_hot); |
|
1061 |
END_INTERRUPTSBLOCKED |
|
1062 |
||
892 | 1063 |
if ((status == BitmapSuccess) && newBitmap) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1064 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1065 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1066 |
#endif |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1067 |
w = __MKSMALLINT(b_width); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1068 |
h = __MKSMALLINT(b_height); |
295 | 1069 |
id = __MKOBJ(newBitmap); |
1070 |
} |
|
1071 |
} |
|
1072 |
} |
|
1073 |
%}. |
|
1074 |
id notNil ifTrue:[ |
|
1075 |
aForm setWidth:w height:h |
|
1076 |
]. |
|
1077 |
^ id |
|
1078 |
! |
|
1079 |
||
1080 |
createBitmapWidth:w height:h |
|
1081 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1082 |
(i.e. random). Return a bitmap id or nil" |
|
1083 |
||
1084 |
%{ /* NOCONTEXT */ |
|
1085 |
||
1086 |
Display *dpy = myDpy; |
|
555 | 1087 |
int screen = __intVal(__INST(screen)); |
295 | 1088 |
Pixmap newBitmap; |
1089 |
||
1090 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1091 |
BEGIN_INTERRUPTSBLOCKED |
|
1092 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
|
555 | 1093 |
__intVal(w), __intVal(h), 1); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1094 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1095 |
if (newBitmap) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1096 |
__cnt_bitmap++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1097 |
#endif |
295 | 1098 |
END_INTERRUPTSBLOCKED |
1099 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil ); |
|
1100 |
} |
|
1101 |
%} |
|
1102 |
. |
|
1103 |
self primitiveFailed. |
|
1104 |
^ nil |
|
1105 |
! |
|
1106 |
||
0 | 1107 |
createPixmapWidth:w height:h depth:d |
1108 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1109 |
(i.e. random). Return a bitmap id or nil" |
|
1110 |
||
1111 |
%{ /* NOCONTEXT */ |
|
1112 |
||
1113 |
Display *dpy = myDpy; |
|
555 | 1114 |
int screen = __intVal(__INST(screen)); |
0 | 1115 |
Pixmap newBitmap; |
1116 |
||
150 | 1117 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
70 | 1118 |
BEGIN_INTERRUPTSBLOCKED |
1119 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
|
555 | 1120 |
__intVal(w), __intVal(h), __intVal(d)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1121 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1122 |
if (newBitmap) |
928 | 1123 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1124 |
#endif |
70 | 1125 |
END_INTERRUPTSBLOCKED |
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1126 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil ); |
0 | 1127 |
} |
1128 |
%} |
|
1129 |
. |
|
43 | 1130 |
self primitiveFailed. |
1131 |
^ nil |
|
0 | 1132 |
! |
1133 |
||
1134 |
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
|
46 | 1135 |
"will vanish - for compatibility with previous versions" |
1136 |
||
1137 |
^ self |
|
850 | 1138 |
createWindowFor:aView |
1139 |
origin:(xpos @ ypos) |
|
1140 |
extent:(wwidth @ wheight) |
|
1141 |
minExtent:(aView minExtent) |
|
1142 |
maxExtent:(aView maxExtent) |
|
1143 |
borderWidth:(aView borderWidth) |
|
1144 |
subViewOf:(aView superView) |
|
1145 |
onTop:(aView isPopUpView) |
|
1146 |
inputOnly:(aView isInputOnly) |
|
1147 |
label:(aView label) |
|
1148 |
cursor:(aView cursor) |
|
1149 |
icon:(aView icon) |
|
1150 |
iconView:(aView iconView) |
|
780
b2f13d436188
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
729
diff
changeset
|
1151 |
|
b2f13d436188
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
729
diff
changeset
|
1152 |
"Modified: 1.6.1996 / 13:22:48 / cg" |
46 | 1153 |
! |
1154 |
||
1155 |
createWindowFor:aView |
|
70 | 1156 |
origin:origin |
1157 |
extent:extent |
|
1158 |
minExtent:minExt |
|
1159 |
maxExtent:maxExt |
|
1160 |
borderWidth:bWidth |
|
1161 |
subViewOf:wsuperView |
|
157 | 1162 |
onTop:wisPopUpView |
70 | 1163 |
inputOnly:winputOnly |
1164 |
label:wlabel |
|
1165 |
cursor:wcursor |
|
1166 |
icon:wicon |
|
1167 |
iconView:wiconView |
|
46 | 1168 |
|
1169 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
|
1170 |
bColorId wsuperViewId wcursorId wiconId windowId |
|
1171 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
|
150 | 1172 |
vBgForm deepForm preferredVisual preferredDepth| |
1173 |
||
1174 |
displayId isNil ifTrue:[ |
|
1175 |
self primitiveFailed. |
|
1176 |
^ nil |
|
1177 |
]. |
|
0 | 1178 |
|
46 | 1179 |
origin notNil ifTrue:[ |
70 | 1180 |
xpos := origin x. |
1181 |
ypos := origin y. |
|
46 | 1182 |
] ifFalse:[ |
70 | 1183 |
xpos := ypos := 0. |
0 | 1184 |
]. |
46 | 1185 |
extent notNil ifTrue:[ |
70 | 1186 |
wwidth := extent x. |
1187 |
wheight := extent y. |
|
46 | 1188 |
] ifFalse:[ |
70 | 1189 |
wwidth := wheight := 100. |
46 | 1190 |
]. |
1191 |
minExt notNil ifTrue:[ |
|
70 | 1192 |
minWidth := minExt x. |
1193 |
minHeight := minExt y |
|
0 | 1194 |
]. |
46 | 1195 |
maxExt notNil ifTrue:[ |
70 | 1196 |
maxWidth := maxExt x. |
1197 |
maxHeight := maxExt y |
|
46 | 1198 |
]. |
1199 |
||
0 | 1200 |
wsuperView notNil ifTrue:[ |
70 | 1201 |
wsuperViewId := wsuperView id |
0 | 1202 |
]. |
1203 |
wcursor isNil ifTrue:[ |
|
145 | 1204 |
'XWORKSTATION: cursor nil - defaulted' errorPrintNL |
0 | 1205 |
] ifFalse:[ |
70 | 1206 |
wcursorId := wcursor id |
0 | 1207 |
]. |
1208 |
||
1209 |
wicon notNil ifTrue:[ |
|
70 | 1210 |
wiconId := wicon id |
0 | 1211 |
]. |
1212 |
wiconView notNil ifTrue:[ |
|
70 | 1213 |
wiconViewId := wiconView id |
0 | 1214 |
]. |
1215 |
weventMask := aView eventMask. |
|
1216 |
||
150 | 1217 |
preferredVisual := aView preferredVisual. |
1218 |
preferredDepth := aView preferredDepth. |
|
23 | 1219 |
|
72 | 1220 |
%{ /* STACK:16000 */ |
0 | 1221 |
Display *dpy = myDpy; |
555 | 1222 |
int screen = __intVal(__INST(screen)); |
0 | 1223 |
Visual visual; |
1224 |
XGCValues xgcv; |
|
1225 |
XSetWindowAttributes xswa; |
|
1226 |
XSizeHints sizehints; |
|
1227 |
XWMHints wmhints; |
|
46 | 1228 |
int bw, bd, bg; |
0 | 1229 |
Window newWindow, parentWindow; |
1230 |
char *windowName; |
|
1231 |
XFontStruct *f; |
|
1232 |
Pixmap backPixmap = (Pixmap)0, iconBitmap = (Pixmap)0; |
|
1233 |
int flags = 0, depth, ioClass; |
|
1234 |
Window iconWindow; |
|
1235 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
1236 |
Atom WmQuitAppAtom; |
|
1237 |
Atom atoms[3]; |
|
1238 |
int atomCount = 0, isTopWindow = 0; |
|
1239 |
||
1240 |
sizehints.flags = 0; |
|
1241 |
sizehints.width = 100; |
|
1242 |
sizehints.height = 100; |
|
1243 |
sizehints.x = 0; |
|
1244 |
sizehints.y = 0; |
|
1245 |
||
97 | 1246 |
if (__bothSmallInteger(wwidth, wheight)) { |
70 | 1247 |
sizehints.flags |= PSize; |
555 | 1248 |
sizehints.width = __intVal(wwidth); |
1249 |
sizehints.height = __intVal(wheight); |
|
0 | 1250 |
} |
97 | 1251 |
if (__bothSmallInteger(xpos, ypos)) { |
70 | 1252 |
sizehints.flags |= PPosition; |
555 | 1253 |
sizehints.x = __intVal(xpos); |
1254 |
sizehints.y = __intVal(ypos); |
|
0 | 1255 |
} |
97 | 1256 |
if (__bothSmallInteger(minWidth, minHeight)) { |
70 | 1257 |
sizehints.flags |= PMinSize; |
555 | 1258 |
sizehints.min_width = __intVal(minWidth); |
1259 |
sizehints.min_height = __intVal(minHeight); |
|
0 | 1260 |
} |
97 | 1261 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
70 | 1262 |
sizehints.flags |= PMaxSize; |
555 | 1263 |
sizehints.max_width = __intVal(maxWidth); |
1264 |
sizehints.max_height = __intVal(maxHeight); |
|
0 | 1265 |
} |
1266 |
||
37 | 1267 |
bg = WhitePixel(dpy, screen); |
0 | 1268 |
|
97 | 1269 |
if (__isSmallInteger(bWidth)) { |
555 | 1270 |
bw = __intVal(bWidth); |
46 | 1271 |
} else { |
70 | 1272 |
bw = 0; |
0 | 1273 |
} |
1274 |
||
72 | 1275 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1276 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1277 |
if (__isExternalAddress(wsuperViewId)) { |
70 | 1278 |
parentWindow = _WindowVal(wsuperViewId); |
0 | 1279 |
} else { |
70 | 1280 |
parentWindow = RootWindow(dpy, screen); |
1281 |
isTopWindow = 1; |
|
0 | 1282 |
} |
1283 |
||
157 | 1284 |
if (wisPopUpView == true) |
70 | 1285 |
xswa.override_redirect = 1; |
0 | 1286 |
else |
70 | 1287 |
xswa.override_redirect = 0; |
0 | 1288 |
|
1289 |
if (winputOnly == true) |
|
70 | 1290 |
ioClass = InputOnly; |
0 | 1291 |
else |
70 | 1292 |
ioClass = InputOutput; |
0 | 1293 |
|
97 | 1294 |
if (__isSmallInteger(weventMask)) { |
555 | 1295 |
xswa.event_mask = __intVal(weventMask); |
0 | 1296 |
} else { |
70 | 1297 |
xswa.event_mask = 0; |
0 | 1298 |
} |
1299 |
||
1300 |
if (ioClass == InputOnly) { |
|
70 | 1301 |
bw = 0; |
1302 |
depth = 0; |
|
1303 |
flags |= CWEventMask; |
|
0 | 1304 |
} else { |
70 | 1305 |
depth = DefaultDepth(dpy,screen); |
1306 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
|
1307 |
||
1308 |
if (backPixmap != (Pixmap)0) { |
|
1309 |
xswa.background_pixmap = backPixmap; |
|
1310 |
flags |= CWBackPixmap; |
|
1311 |
} else { |
|
1312 |
xswa.background_pixel = bg; |
|
1313 |
flags |= CWBackPixel; |
|
1314 |
} |
|
1315 |
xswa.border_pixel = bd; |
|
0 | 1316 |
} |
23 | 1317 |
|
0 | 1318 |
visual.visualid = CopyFromParent; |
150 | 1319 |
if (__isSmallInteger(preferredDepth)) { |
555 | 1320 |
depth = __intVal(preferredDepth); |
23 | 1321 |
} |
54 | 1322 |
|
1323 |
BEGIN_INTERRUPTSBLOCKED |
|
150 | 1324 |
if (preferredVisual != nil) { |
70 | 1325 |
XVisualInfo vi; |
1326 |
int cls; |
|
1327 |
||
150 | 1328 |
if (preferredVisual == @symbol(StaticGray)) |
70 | 1329 |
cls = StaticGray; |
150 | 1330 |
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
|
1331 |
cls = GrayScale; |
150 | 1332 |
else if (preferredVisual == @symbol(StaticColor)) |
70 | 1333 |
cls = StaticColor; |
150 | 1334 |
else if (preferredVisual == @symbol(PseudoColor)) |
70 | 1335 |
cls = PseudoColor; |
150 | 1336 |
else if (preferredVisual == @symbol(TrueColor)) |
70 | 1337 |
cls = TrueColor; |
150 | 1338 |
else if (preferredVisual == @symbol(DirectColor)) |
70 | 1339 |
cls = DirectColor; |
1340 |
else |
|
1341 |
cls = PseudoColor; |
|
200 | 1342 |
|
70 | 1343 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
1344 |
visual.visualid = vi.visualid; |
|
163 | 1345 |
/* |
1346 |
printf("visualId=%x\n", vi.visualid); |
|
1347 |
*/ |
|
70 | 1348 |
} |
23 | 1349 |
} |
0 | 1350 |
|
1351 |
newWindow = XCreateWindow(dpy, parentWindow, |
|
70 | 1352 |
sizehints.x, sizehints.y, |
1353 |
sizehints.width, sizehints.height, |
|
1354 |
bw, depth, ioClass, &visual, |
|
1355 |
flags, &xswa); |
|
54 | 1356 |
END_INTERRUPTSBLOCKED |
0 | 1357 |
|
1358 |
if (! newWindow) { |
|
70 | 1359 |
RETURN ( nil ); |
0 | 1360 |
} |
1361 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1362 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1363 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1364 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1365 |
|
54 | 1366 |
BEGIN_INTERRUPTSBLOCKED |
0 | 1367 |
/* |
1368 |
* define its cursor |
|
1369 |
*/ |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1370 |
if (__isExternalAddress(wcursorId)) { |
70 | 1371 |
XDefineCursor(dpy, newWindow, _CursorVal(wcursorId)); |
0 | 1372 |
} |
1373 |
||
1374 |
/* |
|
1375 |
* define its icon and name |
|
1376 |
* (only makes sense for topWindows) |
|
1377 |
*/ |
|
1378 |
if (isTopWindow) { |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1379 |
if (__isExternalAddress(wiconId)) |
70 | 1380 |
iconBitmap = _PixmapVal(wiconId); |
1381 |
else |
|
1382 |
iconBitmap = (Pixmap)0; |
|
1383 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1384 |
if (__isExternalAddress(wiconViewId)) |
70 | 1385 |
iconWindow = _WindowVal(wiconViewId); |
1386 |
else |
|
1387 |
iconWindow = (Window)0; |
|
1388 |
||
1389 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1390 |
windowName = (char *)_stringVal(wlabel); |
|
1391 |
else |
|
1392 |
windowName = ""; |
|
1393 |
||
1394 |
if (iconBitmap || windowName) { |
|
1395 |
XSetStandardProperties(dpy, newWindow, |
|
1396 |
windowName, windowName, |
|
1397 |
iconBitmap, |
|
1398 |
0, 0, &sizehints); |
|
1399 |
||
1400 |
} |
|
1401 |
||
1402 |
wmhints.flags = 0; |
|
1403 |
if (iconBitmap) { |
|
1404 |
wmhints.flags |= IconPixmapHint; |
|
1405 |
wmhints.icon_pixmap = iconBitmap; |
|
1406 |
} |
|
1407 |
if (iconWindow) { |
|
1408 |
wmhints.flags |= IconWindowHint; |
|
1409 |
wmhints.icon_window = iconWindow; |
|
1410 |
} |
|
0 | 1411 |
/* |
70 | 1412 |
wmhints.flags |= InputHint; |
1413 |
wmhints.input = True; |
|
0 | 1414 |
*/ |
70 | 1415 |
XSetWMHints(dpy, newWindow, &wmhints); |
1416 |
||
1417 |
/* |
|
1418 |
* tell window manager to not kill us but send an event instead |
|
1419 |
*/ |
|
1420 |
/* |
|
1421 |
* get atoms first (if not already known) |
|
1422 |
*/ |
|
555 | 1423 |
if (__INST(protocolsAtom) == nil) { |
70 | 1424 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
555 | 1425 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
0 | 1426 |
#ifdef USE_SAVEYOURSELF_ATOM |
70 | 1427 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
555 | 1428 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
0 | 1429 |
#endif |
1430 |
#ifdef USE_QUIT_APP_ATOM |
|
70 | 1431 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
555 | 1432 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
0 | 1433 |
#endif |
70 | 1434 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
555 | 1435 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
70 | 1436 |
} else { |
0 | 1437 |
#ifdef USE_QUIT_APP_ATOM |
555 | 1438 |
WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); |
0 | 1439 |
#else |
70 | 1440 |
WmQuitAppAtom = 0; |
0 | 1441 |
#endif |
555 | 1442 |
WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); |
1443 |
WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); |
|
0 | 1444 |
#ifdef USE_SAVEYOURSELF_ATOM |
555 | 1445 |
WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); |
0 | 1446 |
#else |
70 | 1447 |
WmSaveYourselfAtom = 0; |
0 | 1448 |
#endif |
70 | 1449 |
} |
1450 |
||
1451 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
|
0 | 1452 |
#ifdef USE_SAVEYOURSELF_ATOM |
70 | 1453 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1454 |
#endif |
1455 |
#ifdef USE_QUIT_APP_ATOM |
|
70 | 1456 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1457 |
#endif |
70 | 1458 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
1459 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
|
0 | 1460 |
} |
1461 |
||
54 | 1462 |
END_INTERRUPTSBLOCKED |
1463 |
||
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1464 |
windowId = __MKOBJ(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1465 |
%}. |
0 | 1466 |
self addKnownView:aView withId:windowId. |
1467 |
^ windowId |
|
1468 |
! |
|
1469 |
||
1470 |
destroyGC:aGCId |
|
1471 |
||
1472 |
%{ /* NOCONTEXT */ |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1473 |
if (__isExternalAddress(aGCId) && ISCONNECTED) { |
366 | 1474 |
GC gc = _GCVal(aGCId); |
1475 |
||
1476 |
if (gc) { |
|
1477 |
BEGIN_INTERRUPTSBLOCKED |
|
1478 |
XFreeGC(myDpy, gc); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1479 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1480 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1481 |
#endif |
366 | 1482 |
END_INTERRUPTSBLOCKED |
1483 |
} |
|
70 | 1484 |
RETURN ( self ); |
0 | 1485 |
} |
118 | 1486 |
%}. |
0 | 1487 |
self primitiveFailed |
1488 |
! |
|
1489 |
||
295 | 1490 |
destroyPixmap:aDrawableId |
0 | 1491 |
|
1492 |
%{ /* NOCONTEXT */ |
|
1493 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1494 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1495 |
Pixmap pix = _PixmapVal(aDrawableId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1496 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1497 |
if (pix) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1498 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1499 |
XFreePixmap(myDpy, pix); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1500 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1501 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1502 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1503 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1504 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1505 |
RETURN ( self ); |
0 | 1506 |
} |
118 | 1507 |
%}. |
295 | 1508 |
self primitiveFailed |
1509 |
! |
|
1510 |
||
1511 |
destroyView:aView withId:aWindowId |
|
1512 |
%{ |
|
1513 |
if (__isExternalAddress(aWindowId) && ISCONNECTED) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1514 |
Window win = _WindowVal(aWindowId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1515 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1516 |
if (win) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1517 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1518 |
XDestroyWindow(myDpy, win); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1519 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1520 |
__cnt_view--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1521 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1522 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1523 |
} |
295 | 1524 |
} |
1525 |
%}. |
|
1526 |
self removeKnownView:aView |
|
0 | 1527 |
! |
1528 |
||
1529 |
dpsContextFor:aDrawableId and:aGCId |
|
1530 |
||
1531 |
%{ /* NOCONTEXT */ |
|
1532 |
#ifdef XXDPS |
|
555 | 1533 |
int screen = __intVal(__INST(screen)); |
0 | 1534 |
DPSContext dps; |
1535 |
int height; |
|
1536 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1537 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1538 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1539 |
&& ISCONNECTED) { |
70 | 1540 |
BEGIN_INTERRUPTSBLOCKED |
1541 |
dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
|
1542 |
_GCVal(aGCId), |
|
1543 |
0, height, 0, colormap, NULL, 0, |
|
1544 |
XDPSDefaultTextBackstop, |
|
1545 |
XDPSDefaultErrorProc, |
|
1546 |
NULL); |
|
1547 |
END_INTERRUPTSBLOCKED |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1548 |
RETURN ( dps ? __MKOBJ(dps) : nil ); |
0 | 1549 |
} |
1550 |
#endif |
|
1551 |
%} |
|
1552 |
. |
|
43 | 1553 |
self primitiveFailed. |
1554 |
^ nil |
|
295 | 1555 |
! |
1556 |
||
1557 |
gcFor:aDrawableId |
|
132 | 1558 |
|
1559 |
%{ /* NOCONTEXT */ |
|
555 | 1560 |
int screen = __intVal(__INST(screen)); |
295 | 1561 |
GC gc; |
1562 |
||
1563 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
1564 |
BEGIN_INTERRUPTSBLOCKED |
|
1565 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
|
1566 |
0L, (XGCValues *)0); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1567 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1568 |
if (gc) |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1569 |
__cnt_gc++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1570 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1571 |
|
295 | 1572 |
END_INTERRUPTSBLOCKED |
1573 |
RETURN ( gc ? __MKOBJ(gc) : nil ); |
|
200 | 1574 |
} |
1575 |
%}. |
|
1576 |
self primitiveFailed. |
|
1577 |
^ nil |
|
295 | 1578 |
! |
1579 |
||
1580 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 1581 |
|
1582 |
%{ /* UNLIMITEDSTACK */ |
|
1583 |
||
295 | 1584 |
Display *dpy = myDpy; |
555 | 1585 |
int screen = __intVal(__INST(screen)); |
295 | 1586 |
Pixmap newBitmap; |
1587 |
unsigned int b_width, b_height; |
|
1588 |
REGISTER unsigned char *cp; |
|
1589 |
REGISTER unsigned char *pBits; |
|
1590 |
unsigned char *b_bits, *allocatedBits; |
|
1591 |
int index, row; |
|
1592 |
REGISTER int col; |
|
1593 |
unsigned bits; |
|
1594 |
static char reverseBitTable[256]; |
|
1595 |
static firstCall = 1; |
|
1596 |
int nBytes; |
|
1597 |
unsigned char fastBits[10000]; |
|
1598 |
OBJ num, *op; |
|
1599 |
int bytesPerRow; |
|
1600 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1601 |
if (! ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1602 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1603 |
} |
295 | 1604 |
if (firstCall) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1605 |
for (index=0; index < 256; index++) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1606 |
reverseBitTable[index] = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1607 |
if (index & 128) reverseBitTable[index] |= 1; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1608 |
if (index & 64) reverseBitTable[index] |= 2; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1609 |
if (index & 32) reverseBitTable[index] |= 4; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1610 |
if (index & 16) reverseBitTable[index] |= 8; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1611 |
if (index & 8) reverseBitTable[index] |= 16; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1612 |
if (index & 4) reverseBitTable[index] |= 32; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1613 |
if (index & 2) reverseBitTable[index] |= 64; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1614 |
if (index & 1) reverseBitTable[index] |= 128; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1615 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1616 |
firstCall = 0; |
295 | 1617 |
} |
1618 |
||
1619 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1620 |
newBitmap = (Pixmap)0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1621 |
b_width = __intVal(w); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1622 |
b_height = __intVal(h); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1623 |
bytesPerRow = (b_width + 7) / 8; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1624 |
nBytes = b_height * bytesPerRow; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1625 |
if (nBytes < sizeof(fastBits)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1626 |
cp = b_bits = fastBits; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1627 |
allocatedBits = 0; |
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 |
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
|
1630 |
if (! cp) goto fail; |
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 |
if (__qClass(anArray) == @global(Array)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1634 |
index = 1; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1635 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1636 |
for (row = b_height; row; row--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1637 |
for (col = bytesPerRow; col; col--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1638 |
num = *op++; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1639 |
if (! __isSmallInteger(num)) goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1640 |
bits = __intVal(num); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1641 |
*cp++ = reverseBitTable[bits]; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1642 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1643 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1644 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1645 |
if (__qClass(anArray) == @global(ByteArray)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1646 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1647 |
for (col = b_height*bytesPerRow; col; col--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1648 |
*cp++ = reverseBitTable[*pBits++]; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1649 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1650 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1651 |
goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1652 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1653 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1654 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1655 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1656 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1657 |
(char *)b_bits, |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1658 |
b_width, b_height); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1659 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1660 |
if (newBitmap) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1661 |
__cnt_bitmap++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1662 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1663 |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1664 |
END_INTERRUPTSBLOCKED |
295 | 1665 |
fail: ; |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1666 |
if (allocatedBits) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1667 |
free(allocatedBits); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1668 |
RETURN ( newBitmap ? __MKOBJ(newBitmap) : nil ); |
0 | 1669 |
} |
1670 |
%} |
|
295 | 1671 |
! |
1672 |
||
1673 |
realRootWindowFor:aView |
|
1674 |
"the name of this method is historic; |
|
1675 |
- it will vanish" |
|
1676 |
||
1677 |
|id| |
|
1678 |
||
1679 |
id := self realRootWindowId. |
|
1680 |
self addKnownView:aView withId:id. |
|
1681 |
^ id |
|
1682 |
! |
|
1683 |
||
1684 |
realRootWindowId |
|
1685 |
"return the id of the real root window. |
|
1686 |
This may not be the window you see as background, |
|
1687 |
since some window managers install a virtual root window on top |
|
1688 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
1689 |
care of any virtual root." |
|
0 | 1690 |
|
1691 |
%{ /* NOCONTEXT */ |
|
1692 |
||
555 | 1693 |
int screen = __intVal(__INST(screen)); |
295 | 1694 |
Window root; |
1695 |
OBJ id; |
|
1696 |
||
555 | 1697 |
if (__INST(rootId) != nil) { |
1698 |
RETURN (__INST(rootId)); |
|
295 | 1699 |
} |
0 | 1700 |
|
150 | 1701 |
if (ISCONNECTED) { |
295 | 1702 |
root = RootWindow(myDpy, screen); |
1703 |
if (! root) { |
|
1704 |
id = nil; |
|
1705 |
} else { |
|
555 | 1706 |
__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
|
1707 |
} |
295 | 1708 |
RETURN (id); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1709 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1710 |
%}. |
295 | 1711 |
self primitiveFailed |
1712 |
! |
|
1713 |
||
1714 |
rootWindowFor:aView |
|
1715 |
|id| |
|
1716 |
||
1717 |
id := self rootWindowId. |
|
1718 |
self addKnownView:aView withId:id. |
|
0 | 1719 |
^ id |
1720 |
! |
|
1721 |
||
295 | 1722 |
rootWindowId |
1723 |
"return the id of the root window. |
|
1724 |
This is the window you see as background, |
|
1725 |
however, it may or may not be the real physical root window, |
|
1726 |
since some window managers install a virtual root window on top |
|
1727 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 1728 |
|
0 | 1729 |
%{ /* NOCONTEXT */ |
555 | 1730 |
int screen = __intVal(__INST(screen)); |
295 | 1731 |
Window rootWin, vRootWin; |
1732 |
OBJ id; |
|
1733 |
||
555 | 1734 |
if (__INST(virtualRootId) != nil) { |
1735 |
RETURN (__INST(virtualRootId)); |
|
295 | 1736 |
} |
0 | 1737 |
|
169 | 1738 |
if (ISCONNECTED) { |
295 | 1739 |
vRootWin = rootWin = RootWindow(myDpy, screen); |
1740 |
#ifndef IRIS |
|
180 | 1741 |
BEGIN_INTERRUPTSBLOCKED |
295 | 1742 |
/* |
1743 |
* on IRIS, this creates a badwindow error - why ? |
|
1744 |
* children contains a funny window (000034) |
|
1745 |
*/ |
|
1746 |
||
1747 |
/* |
|
1748 |
* care for virtual root windows (tvtwm & friends) |
|
1749 |
*/ |
|
1750 |
{ |
|
1751 |
Atom vRootAtom = None; |
|
1752 |
int i; |
|
1753 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
1754 |
Window* children = (Window *)0; |
295 | 1755 |
unsigned int numChildren; |
1756 |
||
1757 |
if (XQueryTree(myDpy, rootWin, |
|
1758 |
&rootReturn, &parentReturn, |
|
1759 |
&children, &numChildren)) { |
|
1760 |
vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True ); |
|
1761 |
if (vRootAtom != None) { |
|
1762 |
for (i=0; i < numChildren; i++) { |
|
1763 |
Atom actual_type; |
|
1764 |
int actual_format; |
|
1765 |
unsigned long nitems, bytesafter; |
|
1766 |
Window* newRoot = (Window*) 0; |
|
1767 |
||
1768 |
if (children[i]) { |
|
1769 |
if (XGetWindowProperty(myDpy, children[i], vRootAtom, |
|
1770 |
0L, 1L, False, XA_WINDOW, |
|
1771 |
&actual_type, &actual_format, |
|
1772 |
&nitems, &bytesafter, |
|
1773 |
(unsigned char**) &newRoot |
|
1774 |
) == Success && newRoot) { |
|
1775 |
vRootWin = *newRoot; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1776 |
XFree(newRoot); /* XXX */ |
295 | 1777 |
break; |
1778 |
} |
|
1779 |
} |
|
1780 |
} |
|
1781 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
1782 |
if (children) XFree( children ); |
295 | 1783 |
} |
1784 |
} |
|
180 | 1785 |
END_INTERRUPTSBLOCKED |
295 | 1786 |
#endif |
1787 |
} |
|
1788 |
||
1789 |
/* cannot happen */ |
|
1790 |
if (! vRootWin) { |
|
1791 |
vRootWin = rootWin; |
|
1792 |
if (! rootWin) { |
|
1793 |
RETURN ( nil ); |
|
1794 |
} |
|
1795 |
} |
|
555 | 1796 |
__INST(rootId) = id = __MKOBJ(rootWin); __STORE(self, id); |
1797 |
__INST(virtualRootId) = id = __MKOBJ(vRootWin); __STORE(self, id); |
|
295 | 1798 |
RETURN ( id ); |
63 | 1799 |
%} |
0 | 1800 |
! ! |
1801 |
||
1802 |
!XWorkstation methodsFor:'color stuff'! |
|
1803 |
||
295 | 1804 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1805 |
"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
|
1806 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 1807 |
|
1808 |
%{ /* NOCONTEXT */ |
|
1809 |
||
1810 |
Display *dpy = myDpy; |
|
555 | 1811 |
int screen = __intVal(__INST(screen)); |
295 | 1812 |
XColor color; |
1813 |
unsigned long dummy; |
|
1814 |
Status ok; |
|
1815 |
||
1816 |
BEGIN_INTERRUPTSBLOCKED |
|
1817 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
|
1818 |
&dummy, 0, &color.pixel, 1); |
|
1819 |
END_INTERRUPTSBLOCKED |
|
1820 |
if (ok) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1821 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1822 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1823 |
#endif |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1824 |
RETURN ( __MKSMALLINT(color.pixel) ); |
0 | 1825 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1826 |
%}. |
43 | 1827 |
^ nil |
0 | 1828 |
! |
1829 |
||
1830 |
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
|
1831 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 1832 |
Dont use this method, colornames are mostly X specific" |
1833 |
||
1834 |
%{ /* NOCONTEXT */ |
|
1835 |
||
1836 |
char *colorname; |
|
1837 |
Display *dpy = myDpy; |
|
1838 |
XColor scolor, ecolor; |
|
555 | 1839 |
int screen = __intVal(__INST(screen)); |
850 | 1840 |
int id; |
54 | 1841 |
Status ok; |
0 | 1842 |
|
150 | 1843 |
if (ISCONNECTED) { |
850 | 1844 |
if (__isString(aString) || __isSymbol(aString)) { |
1845 |
colorname = (char *)_stringVal(aString); |
|
1846 |
||
1847 |
BEGIN_INTERRUPTSBLOCKED |
|
1848 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
|
1849 |
if (ok) { |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
1850 |
#ifdef QUICK_TRUE_COLORS |
850 | 1851 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1852 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
1853 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
1854 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
1855 |
RETURN ( __MKSMALLINT(id) ); |
|
1856 |
} |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
1857 |
#endif |
850 | 1858 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
1859 |
} |
|
1860 |
END_INTERRUPTSBLOCKED |
|
1861 |
if (! ok) { |
|
1862 |
RETURN ( nil ); |
|
1863 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1864 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1865 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1866 |
#endif |
850 | 1867 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
1868 |
} |
|
0 | 1869 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1870 |
%}. |
43 | 1871 |
self primitiveFailed. |
1872 |
^ nil |
|
0 | 1873 |
! |
1874 |
||
295 | 1875 |
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
|
1876 |
"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
|
1877 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
295 | 1878 |
|
1879 |
|r g b| |
|
1880 |
||
1881 |
r := self percentToXColorValue:redVal. |
|
1882 |
g := self percentToXColorValue:greenVal. |
|
1883 |
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
|
1884 |
^ 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
|
1885 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1886 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1887 |
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
|
1888 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
295 | 1889 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1890 |
Display *dpy; |
295 | 1891 |
XColor ecolor; |
555 | 1892 |
int screen = __intVal(__INST(screen)); |
295 | 1893 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1894 |
int id; |
295 | 1895 |
|
1896 |
if (__bothSmallInteger(r, g) |
|
1897 |
&& __isSmallInteger(b) |
|
1898 |
&& ISCONNECTED) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1899 |
ecolor.red = __intVal(r); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1900 |
ecolor.green= __intVal(g); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1901 |
ecolor.blue = __intVal(b); |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1902 |
#ifdef QUICK_TRUE_COLORS |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1903 |
if (__INST(visualType) == @symbol(TrueColor)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1904 |
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
|
1905 |
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
|
1906 |
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
|
1907 |
RETURN ( __MKSMALLINT(id) ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1908 |
} |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1909 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1910 |
dpy = myDpy; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1911 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1912 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1913 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1914 |
if (! ok) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1915 |
RETURN ( nil ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1916 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1917 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1918 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1919 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1920 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
295 | 1921 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1922 |
%}. |
295 | 1923 |
self primitiveFailed. |
1924 |
^ nil |
|
1925 |
! |
|
1926 |
||
1927 |
freeColor:colorIndex |
|
1928 |
"free a display color when its no longer needed" |
|
0 | 1929 |
|
1930 |
%{ /* NOCONTEXT */ |
|
1931 |
||
1932 |
Display *dpy = myDpy; |
|
295 | 1933 |
unsigned long color; |
555 | 1934 |
int screen = __intVal(__INST(screen)); |
295 | 1935 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1936 |
#ifdef QUICK_TRUE_COLORS |
555 | 1937 |
if (__INST(visualType) == @symbol(TrueColor)) { |
850 | 1938 |
/* no need to do anything on TrueColor displays ... */ |
1939 |
RETURN (self); |
|
295 | 1940 |
} |
1941 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1942 |
|
295 | 1943 |
if (__isSmallInteger(colorIndex) && ISCONNECTED) { |
850 | 1944 |
color = (long) __intVal(colorIndex); |
1945 |
BEGIN_INTERRUPTSBLOCKED |
|
1946 |
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
|
1947 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1948 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1949 |
#endif |
850 | 1950 |
END_INTERRUPTSBLOCKED |
1951 |
RETURN ( self ); |
|
0 | 1952 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1953 |
%}. |
295 | 1954 |
self primitiveFailed |
1955 |
! |
|
1956 |
||
1957 |
getRGBFrom:index into:aBlock |
|
1958 |
"get rgb components (0..100) of color in map at:index, |
|
1959 |
and evaluate the 3-arg block, aBlock with them" |
|
1960 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1961 |
|val| |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1962 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1963 |
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
|
1964 |
val := aBlock |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1965 |
value:(r * 100.0 / 16rFFFF) |
850 | 1966 |
value:(g * 100.0 / 16rFFFF) |
1967 |
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
|
1968 |
]. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1969 |
^ val |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1970 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1971 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1972 |
getRGBFromName:colorName into:aBlock |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1973 |
"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
|
1974 |
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
|
1975 |
|val| |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1976 |
|
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1977 |
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
|
1978 |
r isNil ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1979 |
^ super getRGBFromName:colorName into:aBlock |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1980 |
]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1981 |
val := aBlock |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1982 |
value:(r * 100.0 / 16rFFFF) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1983 |
value:(g * 100.0 / 16rFFFF) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1984 |
value:(b * 100.0 / 16rFFFF) |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1985 |
]. |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1986 |
^ val |
1056 | 1987 |
|
1988 |
"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
|
1989 |
! |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1990 |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1991 |
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
|
1992 |
"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
|
1993 |
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
|
1994 |
|
295 | 1995 |
|r g b| |
1996 |
%{ |
|
1997 |
Display *dpy = myDpy; |
|
555 | 1998 |
int screen = __intVal(__INST(screen)); |
295 | 1999 |
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
|
2000 |
int sr, sg, sb; |
295 | 2001 |
int bits, scale, shift; |
2002 |
||
2003 |
if (__isSmallInteger(index)) { |
|
555 | 2004 |
color.pixel = __intVal(index); |
295 | 2005 |
BEGIN_INTERRUPTSBLOCKED |
2006 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
|
2007 |
END_INTERRUPTSBLOCKED |
|
2008 |
||
2009 |
/* |
|
2010 |
* have to compensate for an error in X ?, which does not scale |
|
2011 |
* colors correctly if lesser than 16bits are valid in a color, |
|
2012 |
* (for example, color white on a 4bitsPerRGB server will return |
|
2013 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
|
2014 |
*/ |
|
555 | 2015 |
bits = __intVal(__INST(bitsPerRGB)); |
295 | 2016 |
scale = (1<<bits) - 1; |
2017 |
shift = 16 - bits; |
|
2018 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2019 |
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
|
2020 |
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
|
2021 |
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
|
2022 |
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
|
2023 |
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
|
2024 |
b = __MKSMALLINT(sb); |
295 | 2025 |
} |
2026 |
%}. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2027 |
^ aBlock value:r value:g value:b |
295 | 2028 |
! |
2029 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2030 |
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
|
2031 |
"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
|
2032 |
and evaluate the 3-arg block, aBlock with them" |
295 | 2033 |
|
2034 |
|r g b| |
|
2035 |
||
2036 |
displayId isNil ifTrue:[ |
|
2037 |
self pimitiveFailed. |
|
2038 |
^ nil |
|
2039 |
]. |
|
2040 |
%{ |
|
2041 |
Display *dpy = myDpy; |
|
555 | 2042 |
int screen = __intVal(__INST(screen)); |
295 | 2043 |
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
|
2044 |
int sr, sg, sb; |
295 | 2045 |
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
|
2046 |
int bits, scale, shift; |
295 | 2047 |
|
2048 |
if (__isString(colorName) || __isSymbol(colorName)) { |
|
2049 |
BEGIN_INTERRUPTSBLOCKED |
|
2050 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
|
2051 |
(char *)_stringVal(colorName), &color)) { |
|
2052 |
/* |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2053 |
* 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
|
2054 |
* 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
|
2055 |
* (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
|
2056 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
295 | 2057 |
*/ |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2058 |
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
|
2059 |
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
|
2060 |
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
|
2061 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2062 |
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
|
2063 |
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
|
2064 |
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
|
2065 |
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
|
2066 |
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
|
2067 |
b = __MKSMALLINT(sb); |
295 | 2068 |
} |
2069 |
END_INTERRUPTSBLOCKED |
|
2070 |
} |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2071 |
%}. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2072 |
^ aBlock value:r value:g value:b |
295 | 2073 |
! |
2074 |
||
2075 |
listOfAvailableColors |
|
2076 |
"return a list of all available colornames. |
|
2077 |
This should not be used, since colornames are very |
|
2078 |
display-specific (here X-specific)." |
|
2079 |
||
2080 |
|aStream list line index colorName| |
|
2081 |
||
2082 |
aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'. |
|
2083 |
aStream isNil ifTrue:[^ nil]. |
|
2084 |
list := OrderedCollection new. |
|
2085 |
[aStream atEnd] whileFalse:[ |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2086 |
line := aStream nextLine. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2087 |
line notNil ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2088 |
"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
|
2089 |
index := 1. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2090 |
[(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
|
2091 |
[(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
|
2092 |
[(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
|
2093 |
[(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
|
2094 |
[(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
|
2095 |
[(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
|
2096 |
[(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
|
2097 |
colorName := line copyFrom:index. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2098 |
((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
|
2099 |
list add:colorName |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2100 |
] |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2101 |
] |
295 | 2102 |
]. |
2103 |
aStream close. |
|
2104 |
^ list sort |
|
1047 | 2105 |
|
2106 |
" |
|
2107 |
Screen current listOfAvailableColors |
|
2108 |
" |
|
2109 |
||
2110 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2111 |
! |
2112 |
||
2113 |
percentToXColorValue:aPercentage |
|
2114 |
"given a color-component value in percent (0..100), return the corresponding |
|
2115 |
x-component value (0..65k) as an integer" |
|
2116 |
||
2117 |
%{ /* NOCONTEXT */ |
|
2118 |
||
2119 |
if (__isSmallInteger(aPercentage)) { |
|
555 | 2120 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2121 |
} |
2122 |
if (__isFloat(aPercentage)) { |
|
555 | 2123 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2124 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2125 |
%}. |
295 | 2126 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2127 |
! |
2128 |
||
892 | 2129 |
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
|
2130 |
"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
|
2131 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2132 |
|
2133 |
%{ /* NOCONTEXT */ |
|
2134 |
||
2135 |
char *colorname; |
|
2136 |
Display *dpy = myDpy; |
|
2137 |
XColor color; |
|
555 | 2138 |
int screen = __intVal(__INST(screen)); |
0 | 2139 |
int r, g, b; |
2140 |
int ok = 1; |
|
2141 |
||
892 | 2142 |
if (__isSmallInteger(sred)) |
2143 |
r = __intVal(sred); |
|
0 | 2144 |
else ok = 0; |
2145 |
||
892 | 2146 |
if (__isSmallInteger(sgreen)) |
2147 |
g = __intVal(sgreen); |
|
0 | 2148 |
else ok = 0; |
2149 |
||
892 | 2150 |
if (__isSmallInteger(sblue)) |
2151 |
b = __intVal(sblue); |
|
0 | 2152 |
else ok = 0; |
2153 |
||
97 | 2154 |
if (__isSmallInteger(index) && ok) { |
555 | 2155 |
color.pixel = __intVal(index); |
70 | 2156 |
color.red = r; |
2157 |
color.green = g; |
|
2158 |
color.blue = b; |
|
2159 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2160 |
||
2161 |
BEGIN_INTERRUPTSBLOCKED |
|
2162 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
|
2163 |
END_INTERRUPTSBLOCKED |
|
2164 |
RETURN ( self ); |
|
0 | 2165 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2166 |
%}. |
0 | 2167 |
self primitiveFailed |
295 | 2168 |
! ! |
2169 |
||
2170 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2171 |
||
2172 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
|
2173 |
"change a cursors colors" |
|
2174 |
||
2175 |
|fgR fgG fgB bgR bgG bgB| |
|
2176 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2177 |
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
|
2178 |
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
|
2179 |
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
|
2180 |
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
|
2181 |
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
|
2182 |
bgB := bgColor scaledBlue. |
0 | 2183 |
%{ |
295 | 2184 |
XColor fgcolor, bgcolor; |
2185 |
||
2186 |
if (__isExternalAddress(aCursorId) |
|
2187 |
&& __bothSmallInteger(fgG, fgB) |
|
2188 |
&& __bothSmallInteger(bgR, bgG) |
|
2189 |
&& __bothSmallInteger(bgB, fgR)) { |
|
2190 |
||
555 | 2191 |
fgcolor.red = __intVal(fgR); |
2192 |
fgcolor.green= __intVal(fgG); |
|
2193 |
fgcolor.blue = __intVal(fgB); |
|
2194 |
bgcolor.red = __intVal(bgR); |
|
2195 |
bgcolor.green= __intVal(bgG); |
|
2196 |
bgcolor.blue = __intVal(bgB); |
|
70 | 2197 |
BEGIN_INTERRUPTSBLOCKED |
295 | 2198 |
XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); |
72 | 2199 |
END_INTERRUPTSBLOCKED |
2200 |
RETURN ( self ); |
|
2201 |
} |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2202 |
%}. |
0 | 2203 |
self primitiveFailed |
70 | 2204 |
! |
2205 |
||
295 | 2206 |
createCursorShape:aShape |
974 | 2207 |
"create a cursor given a shape-symbol. This only works |
2208 |
for a few standard cursors, and returns nil if no such cursor exists. |
|
2209 |
Always care for a fallBack, in case of a nil return." |
|
295 | 2210 |
|
2211 |
|number id| |
|
2212 |
||
2213 |
displayId isNil ifTrue:[ |
|
2214 |
self primitiveFailed. |
|
2215 |
^ nil |
|
2216 |
]. |
|
2217 |
number := self shapeNumberFromSymbol:aShape. |
|
2218 |
%{ |
|
2219 |
Cursor newCursor; |
|
2220 |
||
2221 |
if (__isSmallInteger(number)) { |
|
2222 |
BEGIN_INTERRUPTSBLOCKED |
|
555 | 2223 |
newCursor = XCreateFontCursor(myDpy, __intVal(number)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2224 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2225 |
if (newCursor) |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2226 |
__cnt_cursor++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2227 |
#endif |
295 | 2228 |
END_INTERRUPTSBLOCKED |
2229 |
if (newCursor != (Cursor)0) { |
|
2230 |
id = __MKOBJ(newCursor); |
|
70 | 2231 |
} |
0 | 2232 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2233 |
%}. |
295 | 2234 |
^ id |
2235 |
! |
|
2236 |
||
974 | 2237 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2238 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2239 |
||
2240 |
|id sourceId maskId| |
|
2241 |
||
2242 |
displayId isNil ifTrue:[ |
|
2243 |
self primitiveFailed. |
|
2244 |
^ nil |
|
2245 |
]. |
|
2246 |
sourceId := sourceForm id. |
|
2247 |
maskId := maskForm id. |
|
2248 |
%{ |
|
2249 |
Cursor newCursor; |
|
2250 |
XColor fgColor, bgColor; |
|
2251 |
||
2252 |
if (__isExternalAddress(sourceId) |
|
2253 |
&& __isExternalAddress(maskId) |
|
2254 |
&& __bothSmallInteger(hx, hy)) { |
|
2255 |
fgColor.red = 0; /* fg is black */ |
|
2256 |
fgColor.green = 0; |
|
2257 |
fgColor.blue = 0; |
|
2258 |
bgColor.red = 0xFFFF; /* bg is white */ |
|
2259 |
bgColor.green = 0xFFFF; |
|
2260 |
bgColor.blue = 0xFFFF; |
|
2261 |
||
2262 |
BEGIN_INTERRUPTSBLOCKED |
|
2263 |
newCursor = XCreatePixmapCursor(myDpy, |
|
2264 |
_PixmapVal(sourceId), |
|
2265 |
_PixmapVal(maskId), |
|
555 | 2266 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2267 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2268 |
if (newCursor) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2269 |
__cnt_cursor++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2270 |
#endif |
295 | 2271 |
END_INTERRUPTSBLOCKED |
2272 |
if (newCursor != (Cursor)0) { |
|
2273 |
id = __MKOBJ(newCursor); |
|
70 | 2274 |
} |
0 | 2275 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2276 |
%}. |
295 | 2277 |
^ id |
2278 |
! |
|
2279 |
||
2280 |
destroyCursor:aCursorId |
|
974 | 2281 |
"release a cursor - frees any device resources" |
0 | 2282 |
|
2283 |
%{ /* NOCONTEXT */ |
|
2284 |
||
295 | 2285 |
if (ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2286 |
if (__isExternalAddress(aCursorId)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2287 |
Cursor curs = _CursorVal(aCursorId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2288 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2289 |
if (curs) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2290 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2291 |
XFreeCursor(myDpy, curs); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2292 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2293 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2294 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2295 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2296 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2297 |
RETURN ( self ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2298 |
} |
0 | 2299 |
} |
974 | 2300 |
%}. |
0 | 2301 |
self primitiveFailed |
295 | 2302 |
! |
2303 |
||
974 | 2304 |
needDeviceFormsForCursor |
2305 |
^ true |
|
2306 |
! |
|
2307 |
||
295 | 2308 |
shapeNumberFromSymbol:shape |
974 | 2309 |
"given a shape-symbol, return the corresponding cursor-number, |
2310 |
or nil if no such standard cursor exists." |
|
295 | 2311 |
|
2312 |
"this is pure X-knowlegde - but you may easily add more" |
|
2313 |
||
2314 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2315 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2316 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2317 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2318 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2319 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2320 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2321 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2322 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2323 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2324 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2325 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2326 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2327 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2328 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2329 |
((shape == #origin) |
|
2330 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2331 |
((shape == #corner) |
|
2332 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2333 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2334 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2335 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2336 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2337 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
974 | 2338 |
"/ ('XWORKSTATION: invalid cursorShape:' , shape printString) infoPrintNL. |
2339 |
^ nil |
|
0 | 2340 |
! ! |
2341 |
||
2342 |
!XWorkstation methodsFor:'drawing'! |
|
2343 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2344 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2345 |
"do a bit-blt; copy bits from the rectangle defined by |
2346 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2347 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2348 |
argument is not integer." |
|
0 | 2349 |
|
2350 |
%{ /* NOCONTEXT */ |
|
2351 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2352 |
GC gc; |
0 | 2353 |
Drawable source, dest; |
2354 |
||
975 | 2355 |
if (__isExternalAddress(dstGCId) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2356 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2357 |
&& __isExternalAddress(destId) |
97 | 2358 |
&& __bothSmallInteger(w, h) |
2359 |
&& __bothSmallInteger(srcX, srcY) |
|
2360 |
&& __bothSmallInteger(dstX, dstY)) { |
|
975 | 2361 |
gc = _GCVal(dstGCId); |
70 | 2362 |
source = (Drawable) _WindowVal(sourceId); |
2363 |
dest = (Drawable) _WindowVal(destId); |
|
2364 |
XCopyArea(myDpy, source, dest, gc, |
|
555 | 2365 |
__intVal(srcX), __intVal(srcY), |
2366 |
__intVal(w), __intVal(h), |
|
2367 |
__intVal(dstX), __intVal(dstY)); |
|
70 | 2368 |
RETURN ( self ); |
0 | 2369 |
} |
118 | 2370 |
%}. |
2371 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2372 |
or any non integer coordinate" |
|
2373 |
||
0 | 2374 |
self primitiveFailed |
2375 |
! |
|
2376 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2377 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2378 |
"do a bit-blt, but only copy the low-bit plane; |
2379 |
copy bits from the rectangle defined by |
|
2380 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2381 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2382 |
argument is not integer." |
|
0 | 2383 |
|
2384 |
%{ /* NOCONTEXT */ |
|
2385 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2386 |
GC gc; |
0 | 2387 |
Drawable source, dest; |
2388 |
||
975 | 2389 |
if (__isExternalAddress(dstGCId) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2390 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2391 |
&& __isExternalAddress(destId) |
97 | 2392 |
&& __bothSmallInteger(w, h) |
2393 |
&& __bothSmallInteger(srcX, srcY) |
|
2394 |
&& __bothSmallInteger(dstX, dstY)) { |
|
975 | 2395 |
gc = _GCVal(dstGCId); |
70 | 2396 |
source = (Drawable) _WindowVal(sourceId); |
2397 |
dest = (Drawable) _WindowVal(destId); |
|
2398 |
XCopyPlane(myDpy, source, dest, gc, |
|
555 | 2399 |
__intVal(srcX), __intVal(srcY), |
2400 |
__intVal(w), __intVal(h), |
|
2401 |
__intVal(dstX), __intVal(dstY), 1); |
|
70 | 2402 |
RETURN ( self ); |
0 | 2403 |
} |
118 | 2404 |
%}. |
2405 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2406 |
or any non integer coordinate" |
|
2407 |
||
0 | 2408 |
self primitiveFailed |
2409 |
! |
|
2410 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2411 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 2412 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
2413 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2414 |
|
2415 |
%{ /* NOCONTEXT */ |
|
2416 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2417 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2418 |
Window win; |
0 | 2419 |
int w, h, angle1, angle2; |
2420 |
double f; |
|
2421 |
||
97 | 2422 |
if (__isSmallInteger(startAngle)) |
850 | 2423 |
angle1 = __intVal(startAngle) * 64; |
36 | 2424 |
else if (__isFloat(startAngle)) { |
850 | 2425 |
f = __floatVal(startAngle); |
2426 |
angle1 = f * 64; |
|
0 | 2427 |
} |
97 | 2428 |
if (__isSmallInteger(angle)) |
850 | 2429 |
angle2 = __intVal(angle) * 64; |
36 | 2430 |
else if (__isFloat(angle)) { |
850 | 2431 |
f = __floatVal(angle); |
2432 |
angle2 = f * 64; |
|
0 | 2433 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2434 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2435 |
&& __isExternalAddress(aDrawableId) |
97 | 2436 |
&& __bothSmallInteger(x, y) |
2437 |
&& __bothSmallInteger(width, height)) { |
|
850 | 2438 |
win = _WindowVal(aDrawableId); |
2439 |
gc = _GCVal(aGCId); |
|
2440 |
w = __intVal(width); |
|
2441 |
h = __intVal(height); |
|
2442 |
/* |
|
2443 |
* need this check here: some servers simply dump core with bad args |
|
2444 |
*/ |
|
2445 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2446 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
|
2447 |
w, h, angle1, angle2); |
|
2448 |
} |
|
2449 |
RETURN ( self ); |
|
0 | 2450 |
} |
73 | 2451 |
%}. |
2452 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2453 |
self primitiveFailed |
2454 |
! |
|
2455 |
||
295 | 2456 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
2457 |
"draw a line. If the coordinates are not integers, an error is triggered." |
|
2458 |
||
2459 |
%{ /* NOCONTEXT */ |
|
2460 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2461 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2462 |
Window win; |
295 | 2463 |
|
2464 |
if (__isExternalAddress(aGCId) |
|
2465 |
&& __isExternalAddress(aDrawableId) |
|
2466 |
&& __bothSmallInteger(x0, y0) |
|
2467 |
&& __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
|
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 |
XDrawLine(myDpy, win, gc, __intVal(x0), __intVal(y0), |
2471 |
__intVal(x1), __intVal(y1)); |
|
295 | 2472 |
RETURN ( self ); |
2473 |
} |
|
2474 |
%}. |
|
2475 |
"badGC, badDrawable or coordinates not integer" |
|
2476 |
self primitiveFailed |
|
2477 |
! |
|
2478 |
||
2479 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
2480 |
"draw a point. If x/y are not integers, an error is triggered." |
|
2481 |
||
2482 |
%{ /* NOCONTEXT */ |
|
2483 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2484 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2485 |
Window win; |
295 | 2486 |
|
2487 |
if (__isExternalAddress(aGCId) |
|
2488 |
&& __isExternalAddress(aDrawableId) |
|
2489 |
&& __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
|
2490 |
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
|
2491 |
win = _WindowVal(aDrawableId); |
555 | 2492 |
XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); |
295 | 2493 |
RETURN ( self ); |
2494 |
} |
|
2495 |
%}. |
|
2496 |
"badGC, badDrawable or x/y not integer" |
|
2497 |
self primitiveFailed |
|
2498 |
! |
|
2499 |
||
2500 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
2501 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
2502 |
define the polygon. |
|
2503 |
If any coordinate is not integer, an error is triggered." |
|
2504 |
||
2505 |
|numberOfPoints newPoints| |
|
2506 |
||
2507 |
numberOfPoints := aPolygon size. |
|
2508 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2509 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2510 |
Window win; |
295 | 2511 |
OBJ point, x, y; |
2512 |
int i, num; |
|
2513 |
XPoint *points; |
|
2514 |
XPoint qPoints[100]; |
|
377 | 2515 |
int mustFree = 0; |
295 | 2516 |
|
2517 |
if (__isExternalAddress(aGCId) |
|
2518 |
&& __isExternalAddress(aDrawableId) |
|
2519 |
&& __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
|
2520 |
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
|
2521 |
win = _WindowVal(aDrawableId); |
555 | 2522 |
num = __intVal(numberOfPoints); |
295 | 2523 |
/* |
2524 |
* avoid a (slow) malloc, if the number of points is small |
|
2525 |
*/ |
|
2526 |
if (num > 100) { |
|
2527 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
|
2528 |
if (! points) goto fail; |
|
377 | 2529 |
mustFree = 1; |
295 | 2530 |
} else |
2531 |
points = qPoints; |
|
2532 |
||
2533 |
for (i=0; i<num; i++) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
2534 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
295 | 2535 |
if (! __isPoint(point)) goto fail; |
2536 |
x = _point_X(point); |
|
2537 |
y = _point_Y(point); |
|
2538 |
if (! __bothSmallInteger(x, y)) |
|
2539 |
goto fail; |
|
555 | 2540 |
points[i].x = __intVal(x); |
2541 |
points[i].y = __intVal(y); |
|
295 | 2542 |
} |
2543 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
|
377 | 2544 |
if (mustFree) |
295 | 2545 |
free(points); |
2546 |
RETURN ( self ); |
|
2547 |
} |
|
2548 |
fail: ; |
|
377 | 2549 |
if (mustFree) |
382 | 2550 |
free(points); |
295 | 2551 |
%}. |
2552 |
"badGC, badDrawable or coordinates not integer" |
|
2553 |
self primitiveFailed |
|
2554 |
! |
|
2555 |
||
2556 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
2557 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
|
2558 |
||
2559 |
%{ /* NOCONTEXT */ |
|
2560 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2561 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2562 |
Window win; |
295 | 2563 |
int w, h; |
2564 |
||
2565 |
if (__isExternalAddress(aGCId) |
|
2566 |
&& __isExternalAddress(aDrawableId) |
|
2567 |
&& __bothSmallInteger(x, y) |
|
2568 |
&& __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
|
2569 |
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
|
2570 |
win = _WindowVal(aDrawableId); |
555 | 2571 |
w = __intVal(width); |
2572 |
h = __intVal(height); |
|
295 | 2573 |
/* |
2574 |
* need this check here: some servers simply dump core with bad args |
|
2575 |
*/ |
|
2576 |
if ((w >= 0) && (h >= 0)) { |
|
555 | 2577 |
XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h); |
295 | 2578 |
} |
2579 |
RETURN ( self ); |
|
2580 |
} |
|
2581 |
%}. |
|
2582 |
"badGC, badDrawable or coordinates not integer" |
|
2583 |
self primitiveFailed |
|
2584 |
! |
|
2585 |
||
2586 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2587 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
|
2588 |
foreground and background characters. |
|
2589 |
If the coordinates are not integers, an error is triggered." |
|
2590 |
||
2591 |
%{ /* NOCONTEXT */ |
|
2592 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2593 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2594 |
Window win; |
295 | 2595 |
unsigned char *cp; |
2596 |
OBJ cls; |
|
2597 |
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
|
2598 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2599 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2600 |
int nInstBytes; |
295 | 2601 |
|
2602 |
if (__isExternalAddress(aGCId) |
|
2603 |
&& __isExternalAddress(aDrawableId) |
|
2604 |
&& __isNonNilObject(aString) |
|
2605 |
&& __bothSmallInteger(index1, index2) |
|
2606 |
&& __bothSmallInteger(x, y)) { |
|
850 | 2607 |
gc = _GCVal(aGCId); |
2608 |
win = _WindowVal(aDrawableId); |
|
2609 |
cls = __qClass(aString); |
|
2610 |
||
2611 |
i1 = __intVal(index1) - 1; |
|
2612 |
if (i1 >= 0) { |
|
2613 |
i2 = __intVal(index2) - 1; |
|
2614 |
if (i2 < i1) { |
|
2615 |
RETURN (self); |
|
2616 |
} |
|
2617 |
||
2618 |
cp = _stringVal(aString); |
|
2619 |
l = i2 - i1 + 1; |
|
2620 |
||
2621 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2622 |
n = _stringSize(aString); |
|
2623 |
if (i2 < n) { |
|
2624 |
cp += i1; |
|
2625 |
if (l > 1000) l = 1000; |
|
2626 |
if (opaque == true) |
|
2627 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2628 |
else |
|
2629 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2630 |
RETURN ( self ); |
|
2631 |
} |
|
2632 |
} |
|
2633 |
||
2634 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
2635 |
cp += nInstBytes; |
|
2636 |
||
2637 |
if (__isBytes(aString)) { |
|
2638 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
2639 |
||
2640 |
if (i2 < n) { |
|
2641 |
cp += i1; |
|
2642 |
if (l > 1000) l = 1000; |
|
2643 |
if (opaque == true) |
|
2644 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2645 |
else |
|
2646 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2647 |
RETURN ( self ); |
|
2648 |
} |
|
2649 |
} |
|
2650 |
||
2651 |
/* TWOBYTESTRINGS */ |
|
2652 |
if (__isWords(aString)) { |
|
2653 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
2654 |
||
2655 |
if (i2 < n) { |
|
2656 |
union { |
|
2657 |
char b[2]; |
|
2658 |
unsigned short s; |
|
2659 |
} u; |
|
2660 |
int i; |
|
2661 |
XChar2b *cp2 = (XChar2b *)0; |
|
2662 |
int mustFree = 0; |
|
2663 |
||
2664 |
cp += (i1 * 2); |
|
2665 |
if (l > 1000) l = 1000; |
|
2666 |
||
2667 |
/* |
|
2668 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
2669 |
* X expects them MSB first |
|
2670 |
* convert as required |
|
2671 |
*/ |
|
2672 |
||
2673 |
u.s = 0x1234; |
|
2674 |
if (u.b[0] != 0x12) { |
|
2675 |
if (l <= NLOCALBUFFER) { |
|
2676 |
cp2 = xlatebuffer; |
|
2677 |
} else { |
|
2678 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
2679 |
mustFree = 1; |
|
2680 |
} |
|
2681 |
for (i=0; i<l; i++) { |
|
2682 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
2683 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
2684 |
} |
|
2685 |
cp = (char *) cp2; |
|
2686 |
} |
|
2687 |
||
2688 |
if (opaque == true) |
|
2689 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
2690 |
else |
|
2691 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
2692 |
||
2693 |
if (mustFree) { |
|
2694 |
free(cp2); |
|
2695 |
} |
|
2696 |
||
2697 |
RETURN ( self ); |
|
2698 |
} |
|
2699 |
} |
|
2700 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2701 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2702 |
#undef NLOCALBUFFER |
295 | 2703 |
%}. |
2704 |
"x/y not integer, badGC or drawable, or not a string" |
|
2705 |
self primitiveFailed |
|
2706 |
! |
|
2707 |
||
2708 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2709 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
|
2710 |
foreground and background characters. |
|
2711 |
If the coordinates are not integers, an error is triggered." |
|
2712 |
||
2713 |
%{ /* NOCONTEXT */ |
|
2714 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2715 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2716 |
Window win; |
295 | 2717 |
unsigned char *cp; |
2718 |
int n; |
|
2719 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2720 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2721 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2722 |
int nInstBytes; |
295 | 2723 |
|
2724 |
if (__isExternalAddress(aGCId) |
|
2725 |
&& __isExternalAddress(aDrawableId) |
|
2726 |
&& __isNonNilObject(aString) |
|
2727 |
&& __bothSmallInteger(x, y)) { |
|
850 | 2728 |
gc = _GCVal(aGCId); |
2729 |
win = _WindowVal(aDrawableId); |
|
2730 |
cls = __qClass(aString); |
|
2731 |
||
2732 |
cp = _stringVal(aString); |
|
2733 |
||
2734 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2735 |
n = _stringSize(aString); |
|
2736 |
if (n > 1000) n = 1000; |
|
2737 |
if (opaque == true) |
|
2738 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2739 |
else |
|
2740 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2741 |
RETURN ( self ); |
|
2742 |
} |
|
2743 |
||
2744 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
2745 |
cp += nInstBytes; |
|
2746 |
||
2747 |
if (__isBytes(aString)) { |
|
2748 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
2749 |
||
2750 |
if (n > 1000) n = 1000; |
|
2751 |
if (opaque == true) |
|
2752 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2753 |
else |
|
2754 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2755 |
RETURN ( self ); |
|
2756 |
} |
|
2757 |
||
2758 |
/* TWOBYTESTRINGS */ |
|
2759 |
if (__isWords(aString)) { |
|
2760 |
union { |
|
2761 |
char b[2]; |
|
2762 |
unsigned short s; |
|
2763 |
} u; |
|
2764 |
int i; |
|
2765 |
XChar2b *cp2; |
|
2766 |
int mustFree = 0; |
|
2767 |
||
2768 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
2769 |
if (n > 1000) n = 1000; |
|
2770 |
||
2771 |
/* |
|
2772 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
2773 |
* X expects them MSB first |
|
2774 |
* convert as required |
|
2775 |
*/ |
|
2776 |
||
2777 |
u.s = 0x1234; |
|
2778 |
if (u.b[0] != 0x12) { |
|
2779 |
if (n <= NLOCALBUFFER) { |
|
2780 |
cp2 = xlatebuffer; |
|
2781 |
} else { |
|
2782 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
2783 |
mustFree = 1; |
|
2784 |
} |
|
2785 |
||
2786 |
for (i=0; i<n; i++) { |
|
2787 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
2788 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
2789 |
} |
|
2790 |
cp = (char *) cp2; |
|
2791 |
} |
|
2792 |
||
2793 |
if (opaque == true) |
|
2794 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
2795 |
else |
|
2796 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
2797 |
||
2798 |
||
2799 |
if (mustFree) { |
|
2800 |
free(cp2); |
|
2801 |
} |
|
2802 |
||
2803 |
RETURN ( self ); |
|
2804 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2805 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2806 |
#undef NLOCALBUFFER |
295 | 2807 |
%}. |
2808 |
"x/y not integer, badGC or drawable, or not a string" |
|
2809 |
self primitiveFailed |
|
2810 |
! |
|
2811 |
||
2812 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
2813 |
width:imageWidth height:imageHeight |
|
2814 |
x:srcx y:srcy |
|
2815 |
into:aDrawableId |
|
2816 |
x:dstx y:dsty |
|
2817 |
width:w height:h |
|
2818 |
with:aGCId |
|
2819 |
||
2820 |
"draw a bitImage which has depth id, width iw and height ih into |
|
2821 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
2822 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
2823 |
depth and pixel-units to be different. |
|
2824 |
It has to be checked elsewhere, that the server can do it with the given |
|
2825 |
depth - otherwise, primitive failure will be signalled. |
|
2826 |
Also it is assumed, that the colormap is setup correctly and the |
|
2827 |
colors are allocated - otherwise the colors may be wrong." |
|
2828 |
||
2829 |
" |
|
2830 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
2831 |
an unlimited stack, and thus cannot send primitiveFailed |
|
2832 |
" |
|
2833 |
(self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
2834 |
width:imageWidth height:imageHeight |
|
2835 |
x:srcx y:srcy |
|
2836 |
into:aDrawableId |
|
2837 |
x:dstx y:dsty |
|
2838 |
width:w height:h |
|
2839 |
with:aGCId) |
|
2840 |
ifFalse:[ |
|
2841 |
" |
|
2842 |
also happens, if a segmentation violation occurs in the |
|
2843 |
XPutImage ... |
|
2844 |
" |
|
2845 |
self primitiveFailed |
|
2846 |
]. |
|
2847 |
! |
|
2848 |
||
2849 |
drawBits:imageBits depth:imageDepth |
|
2850 |
width:imageWidth height:imageHeight |
|
2851 |
x:srcx y:srcy |
|
2852 |
into:aDrawableId |
|
2853 |
x:dstx y:dsty |
|
2854 |
width:w height:h |
|
2855 |
with:aGCId |
|
2856 |
||
2857 |
"draw a bitImage which has depth id, width iw and height ih into |
|
2858 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
2859 |
Individual source pixels must have imageDepth bits. |
|
2860 |
It has to be checked elsewhere, that the server can do it with the given |
|
2861 |
depth - otherwise, primitive failure will be signalled. |
|
2862 |
Also it is assumed, that the colormap is setup correctly and the |
|
2863 |
colors are allocated - otherwise the colors may be wrong." |
|
2864 |
||
2865 |
^ self drawBits:imageBits bitsPerPixel:imageDepth depth:imageDepth |
|
2866 |
width:imageWidth height:imageHeight |
|
2867 |
x:srcx y:srcy |
|
2868 |
into:aDrawableId |
|
2869 |
x:dstx y:dsty |
|
2870 |
width:w height:h |
|
2871 |
with:aGCId |
|
2872 |
||
2873 |
! |
|
2874 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2875 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
850 | 2876 |
in:aDrawableId with:aGCId |
90 | 2877 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
2878 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2879 |
|
2880 |
%{ /* NOCONTEXT */ |
|
2881 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2882 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2883 |
Window win; |
0 | 2884 |
int w, h, angle1, angle2; |
2885 |
double f; |
|
2886 |
||
97 | 2887 |
if (__isSmallInteger(startAngle)) |
850 | 2888 |
angle1 = __intVal(startAngle) * 64; |
36 | 2889 |
else if (__isFloat(startAngle)) { |
850 | 2890 |
f = __floatVal(startAngle); |
2891 |
angle1 = f * 64; |
|
0 | 2892 |
} |
97 | 2893 |
if (__isSmallInteger(angle)) |
850 | 2894 |
angle2 = __intVal(angle) * 64; |
36 | 2895 |
else if (__isFloat(angle)) { |
850 | 2896 |
f = __floatVal(angle); |
2897 |
angle2 = f * 64; |
|
0 | 2898 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2899 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2900 |
&& __isExternalAddress(aDrawableId) |
97 | 2901 |
&& __bothSmallInteger(x, y) |
2902 |
&& __bothSmallInteger(width, height)) { |
|
850 | 2903 |
gc = _GCVal(aGCId); |
2904 |
win = _WindowVal(aDrawableId); |
|
2905 |
w = __intVal(width); |
|
2906 |
h = __intVal(height); |
|
2907 |
/* |
|
2908 |
* need this check here: some servers simply dump core with bad args |
|
2909 |
*/ |
|
2910 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2911 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
|
2912 |
w, h, angle1, angle2); |
|
2913 |
} |
|
2914 |
RETURN ( self ); |
|
0 | 2915 |
} |
73 | 2916 |
%}. |
2917 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2918 |
self primitiveFailed |
2919 |
! |
|
2920 |
||
2921 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
118 | 2922 |
"fill a polygon given by its points. |
2923 |
If any coordinate is not integer, an error is triggered." |
|
73 | 2924 |
|
2925 |
|numberOfPoints| |
|
0 | 2926 |
|
2927 |
numberOfPoints := aPolygon size. |
|
2928 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2929 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2930 |
Window win; |
73 | 2931 |
OBJ point, x, y; |
2932 |
int i, num; |
|
2933 |
XPoint *points; |
|
2934 |
XPoint qPoints[100]; |
|
377 | 2935 |
int mustFree = 0; |
73 | 2936 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2937 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2938 |
&& __isExternalAddress(aDrawableId) |
97 | 2939 |
&& __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
|
2940 |
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
|
2941 |
win = _WindowVal(aDrawableId); |
555 | 2942 |
num = __intVal(numberOfPoints); |
73 | 2943 |
if (num < 3) { |
70 | 2944 |
RETURN ( self ); |
2945 |
} |
|
73 | 2946 |
/* |
2947 |
* avoid (slow) malloc, if not many points |
|
2948 |
*/ |
|
96 | 2949 |
if (num > 100) { |
73 | 2950 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
96 | 2951 |
if (! points) goto fail; |
377 | 2952 |
mustFree = 1; |
96 | 2953 |
} else |
73 | 2954 |
points = qPoints; |
2955 |
for (i=0; i<num; i++) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
2956 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
73 | 2957 |
if (! __isPoint(point)) goto fail; |
2958 |
x = _point_X(point); |
|
2959 |
y = _point_Y(point); |
|
97 | 2960 |
if (! __bothSmallInteger(x, y)) |
73 | 2961 |
goto fail; |
555 | 2962 |
points[i].x = __intVal(x); |
2963 |
points[i].y = __intVal(y); |
|
73 | 2964 |
} |
2965 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
|
377 | 2966 |
if (mustFree) |
73 | 2967 |
free(points); |
2968 |
RETURN ( self ); |
|
377 | 2969 |
|
0 | 2970 |
fail: ; |
382 | 2971 |
if (mustFree) |
2972 |
free(points); |
|
0 | 2973 |
} |
73 | 2974 |
%}. |
2975 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2976 |
self primitiveFailed |
2977 |
! |
|
2978 |
||
295 | 2979 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
2980 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
2981 |
||
2982 |
%{ /* NOCONTEXT */ |
|
2983 |
||
2984 |
int w, h; |
|
2985 |
||
2986 |
if (__isExternalAddress(aGCId) |
|
2987 |
&& __isExternalAddress(aDrawableId) |
|
2988 |
&& __bothSmallInteger(x, y) |
|
2989 |
&& __bothSmallInteger(width, height)) { |
|
555 | 2990 |
w = __intVal(width); |
2991 |
h = __intVal(height); |
|
295 | 2992 |
/* |
2993 |
* need this check here: some servers simply dump core with bad args |
|
2994 |
*/ |
|
2995 |
if ((w >= 0) && (h >= 0)) { |
|
2996 |
XFillRectangle(myDpy, |
|
2997 |
(Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), |
|
555 | 2998 |
__intVal(x), __intVal(y), w, h); |
295 | 2999 |
} |
3000 |
RETURN ( self ); |
|
3001 |
} |
|
3002 |
%}. |
|
3003 |
"badGC, badDrawable or coordinates not integer" |
|
3004 |
self primitiveFailed |
|
43 | 3005 |
! |
3006 |
||
3007 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
70 | 3008 |
width:imageWidth height:imageHeight |
3009 |
x:srcx y:srcy |
|
3010 |
into:aDrawableId |
|
3011 |
x:dstx y:dsty |
|
3012 |
width:w height:h |
|
3013 |
with:aGCId |
|
0 | 3014 |
|
132 | 3015 |
"since XPutImage may allocate huge amount of stack space |
3016 |
(some implementations use alloca), this must run with unlimited stack." |
|
3017 |
||
12 | 3018 |
%{ /* UNLIMITEDSTACK */ |
0 | 3019 |
|
43 | 3020 |
/* |
3021 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
3022 |
* XPutImage |
|
3023 |
*/ |
|
3024 |
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
|
3025 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3026 |
Window win; |
43 | 3027 |
XImage image; |
377 | 3028 |
int imgWdth; |
43 | 3029 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3030 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3031 |
&& __isExternalAddress(aDrawableId) |
97 | 3032 |
&& __bothSmallInteger(srcx, srcy) |
3033 |
&& __bothSmallInteger(dstx, dsty) |
|
3034 |
&& __bothSmallInteger(w, h) |
|
3035 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
3036 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
43 | 3037 |
&& __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
|
3038 |
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
|
3039 |
win = _WindowVal(aDrawableId); |
811 | 3040 |
if (! gc || !win) |
3041 |
goto fail; |
|
46 | 3042 |
#ifdef ARGDEBUG |
70 | 3043 |
printf("args ok\n"); |
46 | 3044 |
#endif |
555 | 3045 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
3046 |
image.width = imgWdth = __intVal(imageWidth); |
|
3047 |
image.height = __intVal(imageHeight); |
|
70 | 3048 |
image.xoffset = 0; |
3049 |
image.format = ZPixmap; |
|
3050 |
image.byte_order = MSBFirst; |
|
3051 |
image.bitmap_unit = 8; |
|
3052 |
image.bitmap_bit_order = MSBFirst; |
|
3053 |
image.bitmap_pad = 8; |
|
555 | 3054 |
image.depth = __intVal(imageDepth); |
3055 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
|
70 | 3056 |
switch (image.bits_per_pixel) { |
3057 |
case 1: |
|
377 | 3058 |
image.bytes_per_line = (imgWdth + 7) / 8; |
70 | 3059 |
break; |
3060 |
case 2: |
|
377 | 3061 |
image.bytes_per_line = (imgWdth*2 + 7) / 8; |
70 | 3062 |
break; |
3063 |
case 4: |
|
377 | 3064 |
image.bytes_per_line = (imgWdth*4 + 7) / 8; |
70 | 3065 |
break; |
3066 |
case 8: |
|
377 | 3067 |
image.bytes_per_line = imgWdth; |
70 | 3068 |
break; |
3069 |
case 16: |
|
377 | 3070 |
image.bytes_per_line = imgWdth*2; |
70 | 3071 |
break; |
3072 |
case 24: |
|
377 | 3073 |
image.bytes_per_line = imgWdth*3; |
70 | 3074 |
break; |
193 | 3075 |
case 32: |
377 | 3076 |
image.bytes_per_line = imgWdth*4; |
193 | 3077 |
break; |
70 | 3078 |
default: |
46 | 3079 |
#ifdef ARGDEBUG |
70 | 3080 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 3081 |
#endif |
70 | 3082 |
goto fail; |
3083 |
} |
|
3084 |
image.red_mask = 0xFFFF; |
|
3085 |
image.green_mask = 0xFFFF; |
|
3086 |
image.blue_mask = 0xFFFF; |
|
555 | 3087 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
3088 |
__intVal(dstx), __intVal(dsty), |
|
3089 |
__intVal(w), __intVal(h)); |
|
70 | 3090 |
RETURN ( true ); |
43 | 3091 |
} |
46 | 3092 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3093 |
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
|
3094 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 3095 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
3096 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
3097 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
3098 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
3099 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
3100 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
3101 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
3102 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
3103 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
3104 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
3105 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 3106 |
#endif |
3107 |
||
0 | 3108 |
fail: ; |
3109 |
%} |
|
3110 |
. |
|
12 | 3111 |
^ false |
0 | 3112 |
! ! |
3113 |
||
86 | 3114 |
!XWorkstation methodsFor:'event handling'! |
0 | 3115 |
|
3116 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
3117 |
"central event handling method: |
|
54 | 3118 |
get next event and send appropriate message to the sensor or view. |
0 | 3119 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
12 | 3120 |
otherwise only events for the view with given id are processed. |
3121 |
If the argument aMask is nonNil, only events for this eventMask are |
|
3122 |
handled." |
|
3123 |
||
54 | 3124 |
(self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[ |
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
3125 |
AbortSignal catch:[ |
83 | 3126 |
self dispatchLastEvent. |
3127 |
] |
|
54 | 3128 |
]. |
12 | 3129 |
! |
3130 |
||
295 | 3131 |
dispatchExposeEventFor:aViewIdOrNil |
3132 |
"get next expose event and send appropriate message to the sensor or view. |
|
3133 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
3134 |
otherwise only events for the view with given id are processed." |
|
3135 |
||
3136 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
|
12 | 3137 |
! |
3138 |
||
3139 |
dispatchLastEvent |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3140 |
|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
|
3141 |
eventType| |
12 | 3142 |
|
3143 |
%{ /* STACK: 8000 */ |
|
3144 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
|
0 | 3145 |
|
3146 |
Display *dpy = myDpy; |
|
135 | 3147 |
OBJ eB; |
3148 |
XEvent *ev; |
|
3149 |
||
3150 |
# define ae ((XAnyEvent *)ev) |
|
3151 |
# define ee ((XExposeEvent *)ev) |
|
3152 |
# define ke ((XKeyPressedEvent *)ev) |
|
3153 |
# define be ((XButtonPressedEvent *)ev) |
|
3154 |
# define ce ((XConfigureEvent *)ev) |
|
3155 |
# define me ((XMotionEvent *)ev) |
|
3156 |
# define ewe ((XEnterWindowEvent *)ev) |
|
3157 |
# define lwe ((XLeaveWindowEvent *)ev) |
|
3158 |
# define de ((XDestroyWindowEvent *)ev) |
|
3159 |
# define ve ((XVisibilityEvent *)ev) |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3160 |
# define mape ((XMappingEvent *)ev) |
135 | 3161 |
|
0 | 3162 |
KeySym keySym; |
3163 |
unsigned char buffer[10]; |
|
3164 |
int i, nchars; |
|
3165 |
char *keySymString; |
|
3166 |
char keySymStringBuffer[32]; |
|
3167 |
static unsigned multiClickTime = 0; |
|
3168 |
unsigned nextMultiClickTime; |
|
150 | 3169 |
OBJ upDown; |
115 | 3170 |
|
3171 |
struct inlineCache *ipS; |
|
0 | 3172 |
static struct inlineCache vid = _ILC1; |
12 | 3173 |
|
3174 |
static struct inlineCache expS = _ILC5; |
|
3175 |
static struct inlineCache gexpS = _ILC5; |
|
3176 |
static struct inlineCache nexpS = _ILC1; |
|
3177 |
static struct inlineCache motS = _ILC4; |
|
3178 |
static struct inlineCache bpS = _ILC4; |
|
3179 |
static struct inlineCache bmpS = _ILC4; |
|
3180 |
static struct inlineCache bspS = _ILC4; |
|
3181 |
static struct inlineCache brS = _ILC4; |
|
3182 |
static struct inlineCache focInS = _ILC1; |
|
3183 |
static struct inlineCache focOutS = _ILC1; |
|
3184 |
static struct inlineCache peS = _ILC4; |
|
3185 |
static struct inlineCache plS = _ILC2; |
|
54 | 3186 |
static struct inlineCache termS = _ILC1; |
3187 |
static struct inlineCache savtermS = _ILC1; |
|
3188 |
static struct inlineCache destrS = _ILC1; |
|
3189 |
static struct inlineCache unmapS = _ILC1; |
|
3190 |
static struct inlineCache mapS = _ILC1; |
|
3191 |
static struct inlineCache confS = _ILC5; |
|
70 | 3192 |
static struct inlineCache coveredS = _ILC2; |
12 | 3193 |
|
3194 |
static struct inlineCache keymap = _ILC0; |
|
3195 |
static struct inlineCache created = _ILC0; |
|
3196 |
static struct inlineCache mapReq = _ILC0; |
|
3197 |
static struct inlineCache repar = _ILC0; |
|
3198 |
static struct inlineCache confReq = _ILC0; |
|
3199 |
static struct inlineCache resReq = _ILC0; |
|
3200 |
static struct inlineCache prop = _ILC0; |
|
129 | 3201 |
static struct inlineCache selClear = _ILC1; |
90 | 3202 |
static struct inlineCache selReq = _ILC4; |
3203 |
static struct inlineCache selNotify = _ILC4; |
|
12 | 3204 |
static struct inlineCache colormap = _ILC0; |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3205 |
static struct inlineCache mapping = _ILC2; |
70 | 3206 |
static struct inlineCache vis = _ILC1; |
12 | 3207 |
|
3208 |
static struct inlineCache skpS = _ILC4; |
|
63 | 3209 |
static struct inlineCache skrS = _ILC4; |
12 | 3210 |
|
555 | 3211 |
eB = __INST(eventBuffer); |
135 | 3212 |
if (__isByteArray(eB)) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3213 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
135 | 3214 |
} else { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3215 |
printf("DISPLAY: no eventBuffer\n"); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3216 |
RETURN (false); |
135 | 3217 |
} |
3218 |
||
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
3219 |
windowID = __MKOBJ(ae->window); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3220 |
theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); |
12 | 3221 |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3222 |
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
|
3223 |
RETURN (nil); |
12 | 3224 |
} |
3225 |
||
3226 |
/* |
|
3227 |
* key, button and pointer events are sent to the sensor, |
|
3228 |
* or (if there is none) to the delegate. |
|
3229 |
* or (if there is none) to the view. |
|
26 | 3230 |
* |
3231 |
* expose events are sent to the sensor, |
|
3232 |
* or (if there is none) to the view |
|
3233 |
* |
|
12 | 3234 |
* sensor and delegate get view as additional argument |
115 | 3235 |
* all of this has been taken out of here to corresponding methods |
3236 |
* in DeviceWorkstation. |
|
12 | 3237 |
*/ |
90 | 3238 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3239 |
#ifdef DEBUG |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3240 |
eventType = __MKSMALLINT(ev->type); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3241 |
#endif |
135 | 3242 |
switch (ev->type) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3243 |
case KeyRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3244 |
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
|
3245 |
ipS = &skrS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3246 |
upDown = false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3247 |
goto keyPressAndRelease; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3248 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3249 |
case KeyPress: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3250 |
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
|
3251 |
ipS = &skpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3252 |
upDown = true; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3253 |
/* FALL INTO */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3254 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3255 |
keyPressAndRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3256 |
__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
|
3257 |
__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
|
3258 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3259 |
__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
|
3260 |
__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
|
3261 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3262 |
__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
|
3263 |
__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
|
3264 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3265 |
__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
|
3266 |
__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
|
3267 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3268 |
arg = nil; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3269 |
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
|
3270 |
if (nchars |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3271 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3272 |
|| (buffer[0] >= 0x80))) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3273 |
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
|
3274 |
keySymString = NULL; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3275 |
} else { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3276 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3277 |
switch (keySym) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3278 |
case XK_Control_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3279 |
case XK_Control_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3280 |
__INST(ctrlDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3281 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3282 |
case XK_Shift_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3283 |
case XK_Shift_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3284 |
__INST(shiftDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3285 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3286 |
case XK_Meta_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3287 |
case XK_Meta_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3288 |
__INST(metaDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3289 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3290 |
case XK_Alt_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3291 |
case XK_Alt_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3292 |
__INST(altDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3293 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3294 |
} |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3295 |
#endif |
150 | 3296 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3297 |
keySymString = XKeysymToString(keySym); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3298 |
if (keySymString) { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3299 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3300 |
if (keySymString[0] == 'D') { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3301 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3302 |
* 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
|
3303 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3304 |
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
|
3305 |
keySymString = "DeleteLine"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3306 |
} 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
|
3307 |
keySymString = "DeleteWord"; |
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 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3310 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3311 |
* make names compatible |
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 |
if (strcmp(keySymString, "Down") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3314 |
keySymString = "CursorDown"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3315 |
} 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
|
3316 |
keySymString = "CursorUp"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3317 |
} 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
|
3318 |
keySymString = "CursorLeft"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3319 |
} 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
|
3320 |
keySymString = "CursorRight"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3321 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3322 |
arg = __MKSYMBOL(keySymString, (OBJ *)0, __context); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3323 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3324 |
__PROTECT__(theView); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3325 |
arg = __MKSTRING(keySymString); |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3326 |
__UNPROTECT__(theView); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3327 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3328 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3329 |
} |
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 (arg == nil) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3332 |
/* 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
|
3333 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3334 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3335 |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3336 |
(*(*ipS).ilc_func)(self, symS, nil, ipS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3337 |
arg, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3338 |
__MKSMALLINT(ke->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3339 |
__MKSMALLINT(ke->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3340 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3341 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3342 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3343 |
case ButtonPress: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3344 |
__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
|
3345 |
__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
|
3346 |
__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
|
3347 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3348 |
if (__isSmallInteger(__INST(multiClickTimeDelta))) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3349 |
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
|
3350 |
else |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3351 |
nextMultiClickTime = 0; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3352 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3353 |
if (multiClickTime) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3354 |
if (be->time < multiClickTime) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3355 |
multiClickTime = nextMultiClickTime; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3356 |
ipS = &bmpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3357 |
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
|
3358 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3359 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3360 |
} |
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 |
multiClickTime = nextMultiClickTime; |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
3363 |
#ifdef NO_LONGER |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3364 |
if (be->state & ShiftMask) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3365 |
ipS = &bspS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3366 |
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
|
3367 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3368 |
} |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
3369 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3370 |
ipS = &bpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3371 |
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
|
3372 |
goto sendButtonEvent; |
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 |
/* NOT REACHED */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3375 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3376 |
case ButtonRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3377 |
__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
|
3378 |
__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
|
3379 |
__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
|
3380 |
ipS = &brS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3381 |
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
|
3382 |
/* fall into */ |
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 |
sendButtonEvent: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3385 |
butt = __MKSMALLINT(be->button); |
12 | 3386 |
#ifdef NOTDEF |
1060
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 |
* 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
|
3389 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3390 |
if (__INST(metaDown) == true) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3391 |
butt = __MKSMALLINT(2); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3392 |
else |
0 | 3393 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3394 |
butt = __AT_(__INST(buttonTranslation), butt); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3395 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3396 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3397 |
(*(*ipS).ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3398 |
symS, nil, ipS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3399 |
butt, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3400 |
__MKSMALLINT(ke->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3401 |
__MKSMALLINT(ke->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3402 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3403 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3404 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3405 |
case MotionNotify: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3406 |
if (__INST(motionEventCompression) != false) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3407 |
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
|
3408 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3409 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3410 |
__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
|
3411 |
__INST(eventRootY) = __MKSMALLINT(me->y_root); |
70 | 3412 |
|
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
3413 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3414 |
__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
|
3415 |
__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
|
3416 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3417 |
__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
|
3418 |
__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
|
3419 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3420 |
__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
|
3421 |
__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
|
3422 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3423 |
(*motS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3424 |
@symbol(buttonMotion:x:y:view:), nil, &motS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3425 |
__MKSMALLINT(me->state), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3426 |
__MKSMALLINT(me->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3427 |
__MKSMALLINT(me->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3428 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3429 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3430 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3431 |
case FocusIn: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3432 |
(*focInS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3433 |
@symbol(focusInView:), nil, &focInS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3434 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3435 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3436 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3437 |
case FocusOut: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3438 |
(*focOutS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3439 |
@symbol(focusOutView:), nil, &focOutS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3440 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3441 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3442 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3443 |
case EnterNotify: |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
3444 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3445 |
__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
|
3446 |
__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
|
3447 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3448 |
__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
|
3449 |
__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
|
3450 |
#endif |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3451 |
__INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3452 |
__INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3453 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3454 |
(*peS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3455 |
@symbol(pointerEnter:x:y:view:), nil, &peS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3456 |
__MKSMALLINT(ewe->state), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3457 |
__MKSMALLINT(ewe->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3458 |
__MKSMALLINT(ewe->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3459 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3460 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3461 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3462 |
case LeaveNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3463 |
(*plS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3464 |
@symbol(pointerLeave:view:), nil, &plS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3465 |
__MKSMALLINT(lwe->state), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3466 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3467 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3468 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3469 |
case GraphicsExpose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3470 |
(*gexpS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3471 |
@symbol(graphicExposeX:y:width:height:view:), nil, &gexpS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3472 |
__MKSMALLINT(ee->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3473 |
__MKSMALLINT(ee->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3474 |
__MKSMALLINT(ee->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3475 |
__MKSMALLINT(ee->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3476 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3477 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3478 |
if (ee->count != 0) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3479 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3480 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3481 |
/* fall into */ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3482 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3483 |
case NoExpose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3484 |
(*nexpS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3485 |
@symbol(noExposeView:), nil, &nexpS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3486 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3487 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3488 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3489 |
case Expose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3490 |
(*expS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3491 |
@symbol(exposeX:y:width:height:view:), nil, &expS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3492 |
__MKSMALLINT(ee->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3493 |
__MKSMALLINT(ee->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3494 |
__MKSMALLINT(ee->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3495 |
__MKSMALLINT(ee->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3496 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3497 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3498 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3499 |
case ConfigureNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3500 |
if (ce->above != None) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3501 |
siblingID = __MKOBJ(ce->above); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3502 |
sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3503 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3504 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3505 |
(*confS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3506 |
@symbol(configureX:y:width:height:view:), nil, &confS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3507 |
__MKSMALLINT(ce->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3508 |
__MKSMALLINT(ce->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3509 |
__MKSMALLINT(ce->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3510 |
__MKSMALLINT(ce->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3511 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3512 |
if (sibling != nil) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3513 |
(*coveredS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3514 |
@symbol(coveredBy:view:), nil, &coveredS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3515 |
theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3516 |
sibling); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3517 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3518 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3519 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3520 |
case ClientMessage: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3521 |
if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3522 |
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
|
3523 |
|| (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3524 |
(*termS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3525 |
@symbol(terminateView:), nil, &termS, theView); |
1014
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 |
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
|
3529 |
(*savtermS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3530 |
@symbol(saveAndTerminateView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3531 |
, nil, &savtermS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3532 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3533 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3534 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3535 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3536 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3537 |
case DestroyNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3538 |
(*destrS.ilc_func)(self, @symbol(destroyedView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3539 |
, nil, &destrS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3540 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3541 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3542 |
case UnmapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3543 |
(*unmapS.ilc_func)(self, @symbol(unmappedView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3544 |
, nil, &unmapS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3545 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3546 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3547 |
case MapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3548 |
(*mapS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3549 |
@symbol(mappedView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3550 |
, nil, &mapS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3551 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3552 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3553 |
case KeymapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3554 |
(*keymap.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3555 |
@symbol(keyMapChange) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3556 |
, nil, &keymap); |
1014
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 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3559 |
case VisibilityNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3560 |
switch (ve->state) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3561 |
case VisibilityUnobscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3562 |
arg = @symbol(unobscured); |
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 |
case VisibilityPartiallyObscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3565 |
arg = @symbol(partiallyObscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3566 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3567 |
case VisibilityFullyObscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3568 |
arg = @symbol(fullyObscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3569 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3570 |
} |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3571 |
(*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3572 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3573 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3574 |
case CreateNotify: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3575 |
(*created.ilc_func)(theView, @symbol(created), nil, &created); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3576 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3577 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3578 |
case MapRequest: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3579 |
(*mapReq.ilc_func)(theView, @symbol(mapRequest), nil, &mapReq); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3580 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3581 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3582 |
case ReparentNotify: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3583 |
(*repar.ilc_func)(theView, @symbol(reparented), nil, &repar); |
1014
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 ConfigureRequest: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3587 |
(*confReq.ilc_func)(theView, @symbol(configRequest), nil, &confReq); |
1014
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 GravityNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3591 |
case ResizeRequest: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3592 |
(*resReq.ilc_func)(theView, @symbol(resizeRequest), nil, &resReq); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3593 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3594 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3595 |
case CirculateNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3596 |
case CirculateRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3597 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3598 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3599 |
case PropertyNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3600 |
(*prop.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3601 |
@symbol(propertyChange) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3602 |
, nil, &prop); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3603 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3604 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3605 |
case SelectionClear: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3606 |
selectionID = __MKATOMOBJ(ev->xselectionclear.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3607 |
(*selClear.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3608 |
@symbol(selectionClear:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3609 |
, nil, &selClear, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3610 |
selectionID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3611 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3612 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3613 |
case SelectionNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3614 |
/* |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3615 |
* returned selection value (answer from SelectionRequest) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3616 |
*/ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3617 |
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
|
3618 |
ev->xselection.property, ev->xselection.target, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3619 |
ev->xselection.selection, ev->xselection.requestor)); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3620 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3621 |
propertyID = __MKATOMOBJ(ev->xselection.property); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3622 |
targetID = __MKATOMOBJ(ev->xselection.target); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3623 |
selectionID = __MKATOMOBJ(ev->xselection.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3624 |
requestorID = __MKOBJ(ev->xselection.requestor); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3625 |
(*selNotify.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3626 |
@symbol(selectionNotify:target:selection:from:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3627 |
, nil, &selNotify, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3628 |
propertyID, targetID, selectionID, requestorID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3629 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3630 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3631 |
case SelectionRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3632 |
/* |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3633 |
* someone wants the selection |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3634 |
*/ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3635 |
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
|
3636 |
ev->xselectionrequest.property, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3637 |
ev->xselectionrequest.target, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3638 |
ev->xselectionrequest.selection, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3639 |
ev->xselectionrequest.requestor)); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3640 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3641 |
propertyID = __MKATOMOBJ(ev->xselectionrequest.property); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3642 |
targetID = __MKATOMOBJ(ev->xselectionrequest.target); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3643 |
selectionID = __MKATOMOBJ(ev->xselectionrequest.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3644 |
requestorID = __MKOBJ(ev->xselectionrequest.requestor); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3645 |
(*selReq.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3646 |
@symbol(selectionRequest:target:selection:from:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3647 |
, nil, &selReq, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3648 |
propertyID, targetID, selectionID, requestorID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3649 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3650 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3651 |
case ColormapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3652 |
(*colormap.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3653 |
@symbol(colorMapChange) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3654 |
, nil, &colormap); |
1014
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 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3657 |
case MappingNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3658 |
switch(mape->request) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3659 |
case MappingModifier: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3660 |
arg = @symbol(mappingModifier); |
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 |
case MappingKeyboard: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3663 |
arg = @symbol(mappingKeyboard); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3664 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3665 |
case MappingPointer: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3666 |
arg = @symbol(mappingPointer); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3667 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3668 |
default: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3669 |
arg = nil; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3670 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3671 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3672 |
(*mapping.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3673 |
@symbol(mappingChanged:event:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3674 |
, nil, &mapping, arg, eB); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3675 |
break; |
0 | 3676 |
} |
135 | 3677 |
#undef ae |
0 | 3678 |
#undef ee |
3679 |
#undef ke |
|
3680 |
#undef be |
|
3681 |
#undef ce |
|
3682 |
#undef me |
|
3683 |
#undef ewe |
|
3684 |
#undef lwe |
|
3685 |
#undef de |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3686 |
#undef mape |
0 | 3687 |
%} |
3688 |
. |
|
3689 |
^ true |
|
3690 |
! |
|
3691 |
||
295 | 3692 |
dispatchPendingEvents |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3693 |
"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
|
3694 |
(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
|
3695 |
This code is somewhat special, since X has a concept of graphic |
295 | 3696 |
expose events (which are sent after a bitblt). After such a bitblt, |
3697 |
we only handle exposes until the graphicsExpose arrives. |
|
3698 |
Other systems may not need such a kludge" |
|
3699 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
3700 |
"interested in exposes only ?" |
295 | 3701 |
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
|
3702 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
295 | 3703 |
self dispatchExposeEventFor:dispatchingExpose |
3704 |
]. |
|
3705 |
^ self |
|
3706 |
]. |
|
3707 |
||
3708 |
"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
|
3709 |
[self eventPendingWithSync:false] whileTrue:[ |
295 | 3710 |
self dispatchEventFor:nil withMask:nil |
3711 |
] |
|
3712 |
! |
|
3713 |
||
81 | 3714 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
3715 |
"dispose (throw away) specific events. If aWindowId is nil, |
|
3716 |
events matching the mask are thrown away regardless of which |
|
3717 |
view they are for. Otherwise, only matching events for that |
|
3718 |
view are flushed." |
|
0 | 3719 |
|
3720 |
%{ /* NOCONTEXT */ |
|
3721 |
||
3722 |
Display *dpy = myDpy; |
|
3723 |
XEvent ev; |
|
3724 |
Window win; |
|
3725 |
||
97 | 3726 |
if (__isSmallInteger(aMask)) { |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3727 |
if (__isExternalAddress(aWindowIdOrNil)) { |
81 | 3728 |
win = _WindowVal(aWindowIdOrNil); |
555 | 3729 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
81 | 3730 |
} else { |
555 | 3731 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
81 | 3732 |
} |
70 | 3733 |
RETURN ( self ); |
0 | 3734 |
} |
3735 |
%} |
|
3736 |
. |
|
3737 |
self primitiveFailed |
|
3738 |
! |
|
3739 |
||
295 | 3740 |
eventMaskFor:anEventSymbol |
3741 |
"return the eventMask bit-constant corresponding to an event symbol" |
|
3742 |
||
3743 |
%{ /* NOCONTEXT */ |
|
3744 |
||
3745 |
int m = 0; |
|
3746 |
||
3747 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
|
3748 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
|
3749 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
|
3750 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
|
3751 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
|
3752 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
|
3753 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
|
3754 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
|
3755 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
|
3756 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
|
3757 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
|
3758 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
|
3759 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
|
3760 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
|
3761 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
|
3762 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
3763 |
RETURN (__MKSMALLINT(m)); |
295 | 3764 |
%} |
3765 |
! |
|
3766 |
||
12 | 3767 |
eventPending |
310 | 3768 |
"return true, if any event is pending. |
3769 |
This looks for both the internal queue and the display connection." |
|
12 | 3770 |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3771 |
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
|
3772 |
|
12 | 3773 |
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
|
3774 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
12 | 3775 |
]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3776 |
^ self eventPendingWithSync:false |
0 | 3777 |
! |
3778 |
||
295 | 3779 |
eventPending:anEventSymbol for:aWindowIdOrNil |
3780 |
"return true, if a specific event is pending" |
|
3781 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3782 |
^ 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
|
3783 |
! |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3784 |
|
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3785 |
eventPendingWithSync:doSync |
7 | 3786 |
"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
|
3787 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
310 | 3788 |
before checking." |
0 | 3789 |
|
12 | 3790 |
%{ /* UNLIMITEDSTACK */ |
0 | 3791 |
|
3792 |
Display *dpy = myDpy; |
|
3793 |
||
150 | 3794 |
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
|
3795 |
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
|
3796 |
XSync(dpy, 0); /* make certain everything is flushed */ |
150 | 3797 |
} |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3798 |
if (XPending(dpy)) { |
150 | 3799 |
RETURN (true); |
3800 |
} |
|
3801 |
} |
|
3802 |
RETURN ( false ); |
|
0 | 3803 |
%} |
3804 |
! |
|
3805 |
||
341 | 3806 |
eventQueued |
3807 |
"return true, if any event is queued" |
|
3808 |
||
3809 |
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
|
3810 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
341 | 3811 |
]. |
3812 |
^ self eventQueuedAlready |
|
3813 |
||
3814 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
|
3815 |
! |
|
3816 |
||
3817 |
eventQueuedAlready |
|
3818 |
"return true, if any event is queued internally. |
|
3819 |
(i.e. in X's internal event queue, which is both filled by explicit |
|
3820 |
nextEvent calls AND whenever drawing is done and events are pending on |
|
3821 |
the display connection)." |
|
3822 |
||
3823 |
%{ /* UNLIMITEDSTACK */ |
|
3824 |
||
3825 |
if (ISCONNECTED) { |
|
3826 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
|
3827 |
RETURN (true); |
|
3828 |
} |
|
3829 |
} |
|
3830 |
RETURN ( false ); |
|
3831 |
%} |
|
3832 |
! |
|
3833 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3834 |
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync |
295 | 3835 |
"return true, if any of the masked events is pending" |
3836 |
||
3837 |
%{ /* UNLIMITEDSTACK */ |
|
3838 |
||
3839 |
Display *dpy = myDpy; |
|
3840 |
XEvent ev; |
|
3841 |
Window win; |
|
3842 |
int thereIsOne; |
|
3843 |
||
3844 |
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
|
3845 |
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
|
3846 |
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
|
3847 |
} |
295 | 3848 |
if (__isExternalAddress(aWindowIdOrNil)) { |
3849 |
win = _WindowVal(aWindowIdOrNil); |
|
555 | 3850 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
295 | 3851 |
} else { |
555 | 3852 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
295 | 3853 |
} |
3854 |
if (thereIsOne) { |
|
3855 |
XPutBackEvent(dpy, &ev); |
|
3856 |
RETURN ( true ); |
|
3857 |
} |
|
3858 |
} |
|
3859 |
RETURN ( false ); |
|
3860 |
%} |
|
3861 |
! |
|
3862 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3863 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
310 | 3864 |
"return true, if any expose event is pending for a specific view, |
3865 |
or any view (if the arg is nil). |
|
3866 |
This is an X specific, only required after a scroll operation." |
|
7 | 3867 |
|
12 | 3868 |
%{ /* UNLIMITEDSTACK */ |
7 | 3869 |
|
3870 |
Display *dpy = myDpy; |
|
3871 |
XEvent ev; |
|
3872 |
Window win; |
|
81 | 3873 |
int thereIsOne; |
3874 |
||
150 | 3875 |
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
|
3876 |
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
|
3877 |
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
|
3878 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3879 |
if (__isExternalAddress(aWindowIdOrNil)) { |
150 | 3880 |
win = _WindowVal(aWindowIdOrNil); |
3881 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
|
3882 |
} else { |
|
3883 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
|
3884 |
} |
|
3885 |
if (thereIsOne) { |
|
3886 |
XPutBackEvent(dpy, &ev); |
|
3887 |
RETURN ( true ); |
|
3888 |
} |
|
81 | 3889 |
} |
3890 |
RETURN ( false ); |
|
3891 |
%} |
|
3892 |
! |
|
3893 |
||
295 | 3894 |
getEventFor:aViewIdOrNil withMask:eventMask |
3895 |
"read next event - put into local eventBuffer. |
|
3896 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
3897 |
otherwise only events for that specific view will be fetched. |
|
3898 |
Returns true, if there was an event, false otherwise. |
|
3899 |
This method may block - so you better check for pending events |
|
3900 |
before calling for it. |
|
3901 |
||
3902 |
Sorry I had to split dispatch into this fetch method and an extra |
|
3903 |
handle method to allow unlimitedstack here. |
|
3904 |
(some Xlibs do a big alloca there ...) which cannot be done in |
|
3905 |
dispatchLastEvent, since it dispatches out into ST-methods. |
|
3906 |
BUG: uses a static buffer - has to be rewritten, to support multiple |
|
3907 |
display connections. |
|
3908 |
" |
|
81 | 3909 |
|
3910 |
%{ /* UNLIMITEDSTACK */ |
|
3911 |
||
3912 |
Display *dpy = myDpy; |
|
295 | 3913 |
Window win, wWanted; |
3914 |
int evMask; |
|
3915 |
OBJ eB; |
|
3916 |
XEvent *ev; |
|
3917 |
||
3918 |
if (! ISCONNECTED) { |
|
3919 |
RETURN (false); |
|
3920 |
} |
|
3921 |
||
555 | 3922 |
eB = __INST(eventBuffer); |
295 | 3923 |
if (__isByteArray(eB)) { |
555 | 3924 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 3925 |
} else { |
3926 |
printf("DISPLAY: no eventBuffer\n"); |
|
3927 |
RETURN (false); |
|
3928 |
} |
|
3929 |
ev->type = 0; |
|
3930 |
||
3931 |
if (__isSmallInteger(eventMask)) { |
|
555 | 3932 |
evMask = __intVal(eventMask); |
295 | 3933 |
} else { |
3934 |
evMask = ~0; |
|
3935 |
} |
|
3936 |
||
3937 |
if (__isExternalAddress(aViewIdOrNil)) { |
|
3938 |
wWanted = _WindowVal(aViewIdOrNil); |
|
3939 |
if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { |
|
70 | 3940 |
RETURN ( true ); |
3941 |
} |
|
295 | 3942 |
} else { |
3943 |
if (evMask == ~0) { |
|
3944 |
XNextEvent(dpy, ev); |
|
3945 |
RETURN (true); |
|
3946 |
} |
|
3947 |
if (XCheckMaskEvent(dpy, evMask, ev)) { |
|
3948 |
RETURN (true); |
|
3949 |
} |
|
3950 |
} |
|
3951 |
%}. |
|
3952 |
^ false |
|
3953 |
! |
|
3954 |
||
3955 |
handleAllEvents |
|
3956 |
"from now on, handle any kind of event" |
|
3957 |
||
3958 |
dispatchingExpose := nil |
|
3959 |
! |
|
3960 |
||
3961 |
handleExposeOnlyFor:aView |
|
3962 |
"from now on, handle expose events only" |
|
3963 |
||
3964 |
dispatchingExpose := aView id |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3965 |
! |
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 |
mappingChanged:what event:eB |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3968 |
"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
|
3969 |
Tell xlib about the fact." |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3970 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3971 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3972 |
self refreshKeyboardMapping:eB. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3973 |
"Maybe some of our modifiers have been changed" |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3974 |
self initializeModifierMappings. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3975 |
]. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3976 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3977 |
"Created: 1.12.1995 / 16:28:23 / stefan" |
295 | 3978 |
! |
3979 |
||
3980 |
setEventMask:aMask in:aWindowId |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
3981 |
"tell X that we are only interested in events from aMask, which |
295 | 3982 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
3983 |
||
3984 |
%{ /* NOCONTEXT */ |
|
3985 |
||
3986 |
int mask; |
|
3987 |
||
3988 |
if (__isExternalAddress(aWindowId) |
|
3989 |
&& __isSmallInteger(aMask)) { |
|
555 | 3990 |
mask = __intVal(aMask); |
295 | 3991 |
|
3992 |
#ifdef OLD |
|
3993 |
/* these may not be disabled */ |
|
3994 |
mask |= ExposureMask | StructureNotifyMask | |
|
3995 |
KeyPressMask | KeyReleaseMask | |
|
3996 |
EnterWindowMask | LeaveWindowMask | |
|
3997 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
|
3998 |
#endif |
|
3999 |
||
4000 |
XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
|
4001 |
RETURN ( self ); |
|
4002 |
} |
|
4003 |
%} |
|
4004 |
. |
|
4005 |
self primitiveFailed |
|
4006 |
! |
|
4007 |
||
4008 |
startDispatch |
|
4009 |
"redefined to clear dispatchingExpose, which is a special X feature" |
|
4010 |
||
4011 |
dispatching ifTrue:[^ self]. |
|
4012 |
dispatchingExpose := nil. |
|
4013 |
super startDispatch |
|
0 | 4014 |
! ! |
295 | 4015 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4016 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4017 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4018 |
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
|
4019 |
"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
|
4020 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4021 |
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
|
4022 |
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
|
4023 |
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
|
4024 |
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
|
4025 |
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
|
4026 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4027 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4028 |
%{ /* NOCONTEXT */ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4029 |
Display *dpy = myDpy; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4030 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4031 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4032 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4033 |
if (__isSmallInteger(stateMask)) { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4034 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4035 |
} else { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4036 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4037 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4038 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4039 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4040 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4041 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4042 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4043 |
XEvent ev; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4044 |
Window target; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4045 |
Status result; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4046 |
KeySym keySym, *syms; |
555 | 4047 |
int screen = __intVal(__INST(screen)); |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4048 |
char s[2]; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4049 |
int nSyms; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4050 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4051 |
if ((typeSymbol == @symbol(keyPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4052 |
|| (typeSymbol == @symbol(keyRelease))) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4053 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4054 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4055 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4056 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4057 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4058 |
s[1] = '\0'; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4059 |
keySym = XStringToKeysym(s); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4060 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4061 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4062 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4063 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4064 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
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 |
if (stateMask == nil) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4067 |
/* |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4068 |
* get the modifier from the keySym |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4069 |
*/ |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4070 |
nSyms = 0; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4071 |
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
|
4072 |
if (syms) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4073 |
int i; |
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 |
for (i=0; i<nSyms; i++) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4076 |
if (syms[i] == keySym) { |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4077 |
#ifdef MODIFIERDEBUG |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4078 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4079 |
#endif |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4080 |
if (i) state = (1 << (i-1)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4081 |
break; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4082 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4083 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4084 |
XFree(syms); |
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 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4087 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4088 |
if ((typeSymbol == @symbol(buttonPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4089 |
|| (typeSymbol == @symbol(buttonRelease))) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4090 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4091 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4092 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4093 |
ev.xbutton.button = 1; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4094 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4095 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4096 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4097 |
RETURN (false); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4098 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4099 |
} |
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 (typeSymbol == @symbol(keyPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4102 |
ev.xany.type = KeyPress; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4103 |
else if (typeSymbol == @symbol(keyRelease)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4104 |
ev.xany.type = KeyRelease; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4105 |
else if (typeSymbol == @symbol(buttonPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4106 |
ev.xany.type = ButtonPress; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4107 |
else if (typeSymbol == @symbol(buttonRelease)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4108 |
ev.xany.type = ButtonRelease; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4109 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4110 |
if (__isExternalAddress(targetId)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4111 |
target = _WindowVal(targetId); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4112 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4113 |
target = (Window) __longIntVal(targetId); |
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 |
ev.xkey.window = target; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4116 |
ev.xkey.same_screen = 1; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4117 |
ev.xkey.subwindow = 0; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4118 |
ev.xkey.root = RootWindow(myDpy, screen); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4119 |
ev.xkey.x = __intVal(xPos); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4120 |
ev.xkey.y = __intVal(yPos); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4121 |
ev.xkey.state = state; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4122 |
ev.xkey.time = CurrentTime; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4123 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4124 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4125 |
if ((result == BadValue) || (result == BadWindow)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4126 |
DPRINTF(("bad status\n")); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4127 |
RETURN ( false ) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4128 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4129 |
RETURN (true) |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4130 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4131 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4132 |
self primitiveFailed. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4133 |
^ false |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4134 |
! |
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 |
simulateKeyboardInput:aCharacterOrString inViewId:viewId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4137 |
"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
|
4138 |
events. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4139 |
Only a few control characters are supported. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4140 |
Notice: not all alien views allow this kind of synthetic input; |
850 | 4141 |
some simply ignore it." |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4142 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4143 |
|control code state| |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4144 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4145 |
aCharacterOrString isString ifTrue:[ |
850 | 4146 |
aCharacterOrString do:[:char | |
4147 |
self simulateKeyboardInput:char inViewId:viewId |
|
4148 |
]. |
|
4149 |
^ self |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4150 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4151 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4152 |
control := false. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4153 |
code := aCharacterOrString asciiValue. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4154 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4155 |
(aCharacterOrString == Character cr) ifTrue:[ |
850 | 4156 |
code := #Return |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4157 |
] ifFalse:[ |
850 | 4158 |
(aCharacterOrString == Character tab) ifTrue:[ |
4159 |
code := #Tab |
|
4160 |
] ifFalse:[ |
|
4161 |
(aCharacterOrString == Character esc) ifTrue:[ |
|
4162 |
code := #Escape |
|
4163 |
] |
|
4164 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4165 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4166 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4167 |
control ifTrue:[ |
850 | 4168 |
state := self controlMask |
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4169 |
]. |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4170 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4171 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4172 |
"/ the stuff below should not be needed |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4173 |
"/ (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
|
4174 |
"/ 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
|
4175 |
"/ Hopefully, this is correct ... |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4176 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4177 |
code isNumber ifTrue:[ |
850 | 4178 |
code >= $A asciiValue ifTrue:[ |
4179 |
code <= $Z asciiValue ifTrue:[ |
|
4180 |
state := self shiftMask |
|
4181 |
] |
|
4182 |
] |
|
440
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 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4185 |
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
|
4186 |
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
|
4187 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4188 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4189 |
sending input to some (possibly alien) view: |
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 |
|point id| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4192 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4193 |
point := Display pointFromUser. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4194 |
id := Display viewIdFromPoint:point. |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4195 |
Display simulateKeyboardInput:'Hello_world' inViewId:id |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4196 |
" |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4197 |
|
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4198 |
"Modified: 11.6.1996 / 10:59:42 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4199 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4200 |
|
295 | 4201 |
!XWorkstation methodsFor:'font stuff'! |
4202 |
||
4203 |
createFontFor:aFontName |
|
4204 |
"a basic method for X-font allocation; this method allows |
|
4205 |
any font to be aquired (even those not conforming to |
|
4206 |
standard naming conventions, such as cursor, fixed or k14)" |
|
4207 |
||
4208 |
%{ /* UNLIMITEDSTACK */ |
|
4209 |
/* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */ |
|
4210 |
||
4211 |
XFontStruct *newFont; |
|
4212 |
||
4213 |
if (ISCONNECTED) { |
|
4214 |
if (__isString(aFontName) || __isSymbol(aFontName)) { |
|
4215 |
BEGIN_INTERRUPTSBLOCKED |
|
4216 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4217 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4218 |
if (newFont) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4219 |
__cnt_font++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4220 |
#endif |
295 | 4221 |
END_INTERRUPTSBLOCKED |
4222 |
RETURN ( newFont ? __MKOBJ(newFont) : nil ); |
|
4223 |
} |
|
4224 |
} |
|
4225 |
%}. |
|
4226 |
^ nil |
|
4227 |
! |
|
4228 |
||
4229 |
decomposeXFontName:aString into:aBlock |
|
4230 |
"extract family, face, style and size from an |
|
4231 |
X-font name |
|
4232 |
(-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); |
|
4233 |
evaluate aBlock with these" |
|
4234 |
||
4235 |
|origin family face style moreStyle skip fheight size |
|
4236 |
resX resY x1 x2 coding start end | |
|
4237 |
||
4238 |
aString isNil ifTrue:[^ false]. |
|
4239 |
(aString startsWith:'-') ifFalse:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4240 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4241 |
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
|
4242 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4243 |
('*-*-[0-9]*' match:aString) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4244 |
end := aString indexOf:$- startingAt:1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4245 |
family := aString copyFrom:1 to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4246 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4247 |
end := aString indexOf:$- startingAt:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4248 |
style := aString copyFrom:start to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4249 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4250 |
size := aString copyFrom:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4251 |
size := (Number readFromString:size onError:[^false]). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4252 |
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
|
4253 |
^ true. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4254 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4255 |
('*-[0-9]*' match:aString) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4256 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4257 |
something like lucidasans-24 |
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 |
end := aString indexOf:$- startingAt:1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4260 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4261 |
family := aString copyFrom:1 to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4262 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4263 |
size := aString copyFrom:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4264 |
size := (Number readFromString:size onError:[^false]). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4265 |
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
|
4266 |
^ true. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4267 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4268 |
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
|
4269 |
^ true. |
295 | 4270 |
]. |
4271 |
||
4272 |
end := aString indexOf:$- startingAt:2. |
|
4273 |
(end == 0) ifTrue:[^ false]. |
|
4274 |
origin := aString copyFrom:2 to:(end - 1). |
|
4275 |
||
4276 |
start := end + 1. |
|
4277 |
end := aString indexOf:$- startingAt:start. |
|
4278 |
(end == 0) ifTrue:[^ false]. |
|
4279 |
family := aString copyFrom:start to:(end - 1). |
|
4280 |
||
4281 |
start := end + 1. |
|
4282 |
end := aString indexOf:$- startingAt:start. |
|
4283 |
(end == 0) ifTrue:[^ false]. |
|
4284 |
face := aString copyFrom:start to:(end - 1). |
|
4285 |
||
4286 |
start := end + 1. |
|
4287 |
end := aString indexOf:$- startingAt:start. |
|
4288 |
(end == 0) ifTrue:[^ false]. |
|
4289 |
style := aString copyFrom:start to:(end - 1). |
|
4290 |
(style = 'o') ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4291 |
style := 'oblique' |
295 | 4292 |
] ifFalse:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4293 |
(style = 'i') ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4294 |
style := 'italic' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4295 |
] ifFalse:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4296 |
(style = 'r') ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4297 |
style := 'roman' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4298 |
] |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4299 |
] |
295 | 4300 |
]. |
4301 |
||
4302 |
start := end + 1. |
|
4303 |
end := aString indexOf:$- startingAt:start. |
|
4304 |
(end == 0) ifTrue:[^ false]. |
|
4305 |
moreStyle := aString copyFrom:start to:(end - 1). |
|
4306 |
||
4307 |
start := end + 1. |
|
4308 |
end := aString indexOf:$- startingAt:start. |
|
4309 |
(end == 0) ifTrue:[^ false]. |
|
4310 |
skip := aString copyFrom:start to:(end - 1). |
|
4311 |
||
4312 |
start := end + 1. |
|
4313 |
end := aString indexOf:$- startingAt:start. |
|
4314 |
(end == 0) ifTrue:[^ false]. |
|
4315 |
fheight := aString copyFrom:start to:(end - 1). |
|
4316 |
||
4317 |
start := end + 1. |
|
4318 |
end := aString indexOf:$- startingAt:start. |
|
4319 |
(end == 0) ifTrue:[^ false]. |
|
4320 |
size := aString copyFrom:start to:(end - 1). |
|
4321 |
size := (Number readFromString:size) / 10. |
|
4322 |
||
4323 |
start := end + 1. |
|
4324 |
end := aString indexOf:$- startingAt:start. |
|
4325 |
(end == 0) ifTrue:[^ false]. |
|
4326 |
resX := aString copyFrom:start to:(end - 1). |
|
4327 |
||
4328 |
start := end + 1. |
|
4329 |
end := aString indexOf:$- startingAt:start. |
|
4330 |
(end == 0) ifTrue:[^ false]. |
|
4331 |
resY := aString copyFrom:start to:(end - 1). |
|
4332 |
||
4333 |
start := end + 1. |
|
4334 |
end := aString indexOf:$- startingAt:start. |
|
4335 |
(end == 0) ifTrue:[^ false]. |
|
4336 |
x1 := aString copyFrom:start to:(end - 1). |
|
4337 |
||
4338 |
start := end + 1. |
|
4339 |
end := aString indexOf:$- startingAt:start. |
|
4340 |
(end == 0) ifTrue:[^ false]. |
|
4341 |
x2 := aString copyFrom:start to:(end - 1). |
|
4342 |
||
4343 |
start := end + 1. |
|
4344 |
end := aString indexOf:$- startingAt:start. |
|
4345 |
(end == 0) ifTrue:[^ false]. |
|
4346 |
coding := aString copyFrom:start to:(end - 1). |
|
4347 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4348 |
(moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4349 |
style := style, '-', moreStyle. |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4350 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4351 |
|
295 | 4352 |
aBlock value:family value:face value:style value:size value:coding. |
4353 |
^ true |
|
4354 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4355 |
"Modified: 4.7.1996 / 11:12:25 / stefan" |
295 | 4356 |
! |
4357 |
||
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4358 |
encodingOf:aFontId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4359 |
"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
|
4360 |
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
|
4361 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4362 |
|enc fullName fontName registry encoding charSetCollections| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4363 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4364 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4365 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4366 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4367 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4368 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4369 |
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4370 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4371 |
registryAtom = XInternAtom(myDpy, "CHARSET_REGISTRY", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4372 |
encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4373 |
charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4374 |
fontAtom = XInternAtom(myDpy, "FONT", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4375 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4376 |
if (ISCONNECTED) { |
850 | 4377 |
if (__isExternalAddress(aFontId)) { |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4378 |
|
850 | 4379 |
f = _FontVal(aFontId); |
4380 |
if (f) { |
|
4381 |
n = f->n_properties; |
|
4382 |
prop = f->properties; |
|
4383 |
if (prop) { |
|
4384 |
while (n--) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4385 |
#ifdef SUPERDEBUG |
850 | 4386 |
cp = XGetAtomName(myDpy, prop->name); |
4387 |
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
|
4388 |
XFree(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4389 |
#endif |
850 | 4390 |
if (prop->name == XA_FULL_NAME) { |
4391 |
cp = XGetAtomName(myDpy, prop->card32); |
|
4392 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4393 |
fullName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4394 |
#ifdef SUPERDEBUG |
850 | 4395 |
printf(" FULL_NAME -> %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 == fontAtom) { |
850 | 4400 |
cp = XGetAtomName(myDpy, prop->card32); |
4401 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4402 |
fontName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4403 |
#ifdef SUPERDEBUG |
850 | 4404 |
printf(" FONT -> %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 == encodingAtom) { |
850 | 4409 |
cp = XGetAtomName(myDpy, prop->card32); |
4410 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4411 |
encoding = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4412 |
#ifdef SUPERDEBUG |
850 | 4413 |
printf(" ENCODING -> %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 == registryAtom) { |
850 | 4418 |
cp = XGetAtomName(myDpy, prop->card32); |
4419 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4420 |
registry = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4421 |
#ifdef SUPERDEBUG |
850 | 4422 |
printf(" REGISTRY -> %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 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4426 |
} else if (prop->name == charSetCollAtom) { |
850 | 4427 |
cp = XGetAtomName(myDpy, prop->card32); |
4428 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4429 |
charSetCollections = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4430 |
#ifdef SUPERDEBUG |
850 | 4431 |
printf(" CHARSET_COLLECTIONS -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4432 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4433 |
XFree(cp); |
850 | 4434 |
} |
4435 |
} |
|
4436 |
prop++; |
|
4437 |
} |
|
4438 |
} |
|
4439 |
} |
|
4440 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4441 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4442 |
%}. |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4443 |
^ self |
850 | 4444 |
extractEncodingFromRegistry:registry |
4445 |
encoding:encoding |
|
4446 |
charSetCollections:charSetCollections |
|
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4447 |
! |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4448 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4449 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4450 |
"this is pure magic ..." |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4451 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4452 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4453 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4454 |
(registry notNil and:[registry notEmpty]) ifTrue:[ |
850 | 4455 |
enc := registry asLowercase asSymbol. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4456 |
] ifFalse:[ |
850 | 4457 |
(encoding notNil and:[encoding notEmpty]) ifTrue:[ |
4458 |
enc := encoding asLowercase asSymbol |
|
4459 |
] ifFalse:[ |
|
4460 |
charSets := charSetCollections. |
|
4461 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
|
4462 |
charSets := charSets asUppercase asCollectionOfWords. |
|
4463 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
4464 |
enc := #iso8859 |
|
4465 |
] ifFalse:[ |
|
4466 |
(charSets includes:'ISO8859') ifTrue:[ |
|
4467 |
enc := #iso8859 |
|
4468 |
] ifFalse:[ |
|
4469 |
(charSets includes:'ASCII') ifTrue:[ |
|
4470 |
enc := #ascii |
|
4471 |
] ifFalse:[ |
|
4472 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
4473 |
enc := #iso8859 |
|
4474 |
] |
|
4475 |
] |
|
4476 |
] |
|
4477 |
] |
|
4478 |
] |
|
4479 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4480 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4481 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4482 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4483 |
"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
|
4484 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4485 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4486 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4487 |
flushListOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4488 |
"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
|
4489 |
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
|
4490 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4491 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4492 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4493 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4494 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4495 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4496 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4497 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4498 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4499 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4500 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4501 |
|
991 | 4502 |
fontMetricsOf:fontId into:aBlock |
4503 |
"evaluate aBlock, passing a fonts metrics as arguments" |
|
4504 |
||
4505 |
|encoding avgAscent avgDescent |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4506 |
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
|
4507 |
res resX resY| |
991 | 4508 |
|
994 | 4509 |
%{ |
991 | 4510 |
XFontStruct *f; |
4511 |
int len; |
|
4512 |
||
4513 |
if (ISCONNECTED) { |
|
994 | 4514 |
if (__isExternalAddress(fontId)) { |
4515 |
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
|
4516 |
if (f) { |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4517 |
#ifdef NOTDEF |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4518 |
char *cp; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4519 |
XFontProp *prop; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4520 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4521 |
n = f->n_properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4522 |
prop = f->properties; |
1045
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 |
if (prop) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4525 |
while (n--) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4526 |
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
|
4527 |
resX = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4528 |
} 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
|
4529 |
resY = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4530 |
} 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
|
4531 |
res = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4532 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4533 |
prop++; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4534 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4535 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4536 |
#endif |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4537 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4538 |
avgAscent = __MKSMALLINT(f->ascent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4539 |
avgDescent = __MKSMALLINT(f->descent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4540 |
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
|
4541 |
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
|
4542 |
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
|
4543 |
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
|
4544 |
BEGIN_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4545 |
len = XTextWidth(f, " ", 1); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4546 |
END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4547 |
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
|
4548 |
} |
991 | 4549 |
} |
4550 |
} |
|
4551 |
%}. |
|
4552 |
encoding := self encodingOf:fontId. |
|
4553 |
aBlock value:encoding |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4554 |
value:avgAscent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4555 |
value:avgDescent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4556 |
value:maxAscent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4557 |
value:maxDescent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4558 |
value:minWidth |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4559 |
value:maxWidth |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4560 |
value:avgWidth |
991 | 4561 |
! |
4562 |
||
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4563 |
fontResolutionOf:fontId |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4564 |
"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
|
4565 |
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
|
4566 |
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
|
4567 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4568 |
|res resX resY| |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4569 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4570 |
%{ |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4571 |
XFontStruct *f; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4572 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4573 |
if (ISCONNECTED) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4574 |
if (__isExternalAddress(fontId)) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4575 |
f = _FontVal(fontId); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4576 |
if (f) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4577 |
char *cp; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4578 |
XFontProp *prop; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4579 |
Atom resolutionXAtom, resolutionYAtom; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4580 |
int n; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4581 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4582 |
n = f->n_properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4583 |
prop = f->properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4584 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4585 |
if (prop) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4586 |
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
|
4587 |
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
|
4588 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4589 |
while (n--) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4590 |
if (prop->name == resolutionXAtom) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4591 |
resX = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4592 |
} else if (prop->name == resolutionYAtom) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4593 |
resY = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4594 |
} 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
|
4595 |
res = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4596 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4597 |
prop++; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4598 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4599 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4600 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4601 |
} |
1045
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 |
%}. |
1046 | 4604 |
(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
|
4605 |
^ resX @ resY |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4606 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4607 |
res notNil ifTrue:[ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4608 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4609 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4610 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4611 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4612 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4613 |
fullNameOf:aFontId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4614 |
"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
|
4615 |
used for user feed-back (for example: in the fontPanel). |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4616 |
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
|
4617 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4618 |
|fullName fontName| |
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 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4621 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4622 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4623 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4624 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4625 |
Atom fontAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4626 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4627 |
fontAtom = XInternAtom(myDpy, "FONT", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4628 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4629 |
if (ISCONNECTED) { |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4630 |
if (__isExternalAddress(aFontId)) { |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4631 |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4632 |
f = _FontVal(aFontId); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4633 |
if (f) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4634 |
n = f->n_properties; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4635 |
prop = f->properties; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4636 |
if (prop) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4637 |
while (n--) { |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4638 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4639 |
cp = XGetAtomName(myDpy, prop->name); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4640 |
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
|
4641 |
XFree(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4642 |
#endif |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4643 |
if (prop->name == XA_FULL_NAME) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4644 |
cp = XGetAtomName(myDpy, prop->card32); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4645 |
if (cp) { |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4646 |
fullName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4647 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4648 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4649 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4650 |
XFree(cp); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4651 |
} |
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 |
if (prop->name == fontAtom) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4654 |
cp = XGetAtomName(myDpy, prop->card32); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4655 |
if (cp) { |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4656 |
fontName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4657 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4658 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4659 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4660 |
XFree(cp); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4661 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4662 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4663 |
prop++; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4664 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4665 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4666 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4667 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4668 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4669 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4670 |
(fullName notNil and:[fullName notEmpty]) ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4671 |
^ fullName |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4672 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4673 |
^ fontName |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4674 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4675 |
|
295 | 4676 |
getAvailableFontsMatching:pattern |
4677 |
"return an Array filled with font names matching aPattern" |
|
4678 |
||
4679 |
%{ /* UNLIMITEDSTACK */ |
|
4680 |
||
4681 |
int nnames = 1500; |
|
4682 |
int available = nnames + 1; |
|
4683 |
char **fonts; |
|
4684 |
OBJ arr, str; |
|
4685 |
int i; |
|
4686 |
||
4687 |
if (ISCONNECTED) { |
|
4688 |
if (__isString(pattern)) { |
|
4689 |
for (;;) { |
|
4690 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
4691 |
if ((fonts == NULL) || (available < nnames)) break; |
|
4692 |
XFreeFontNames(fonts); |
|
4693 |
nnames = available * 2; |
|
4694 |
} |
|
4695 |
if (fonts == NULL) { |
|
4696 |
RETURN ( nil ); |
|
4697 |
} |
|
4698 |
/* |
|
4699 |
* now, that we know the number of font names, |
|
4700 |
* create the array ... |
|
4701 |
*/ |
|
4702 |
arr = __ARRAY_NEW_INT(available); |
|
4703 |
if (! arr) { |
|
4704 |
RETURN (nil); |
|
4705 |
} |
|
4706 |
/* |
|
4707 |
* ... and fill it |
|
4708 |
*/ |
|
4709 |
for (i=0; i<available; i++) { |
|
350 | 4710 |
__PROTECT__(arr); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4711 |
str = __MKSTRING(fonts[i]); |
350 | 4712 |
__UNPROTECT__(arr); |
295 | 4713 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
4714 |
} |
|
4715 |
RETURN (arr); |
|
4716 |
} |
|
4717 |
} |
|
4718 |
%}. |
|
4719 |
^ nil |
|
4720 |
! |
|
4721 |
||
4722 |
getDefaultFont |
|
4723 |
"return a default font id - used when class Font cannot |
|
4724 |
find anything usable" |
|
4725 |
||
4726 |
^ self createFontFor:'fixed' |
|
4727 |
! |
|
4728 |
||
4729 |
getFontWithFamily:familyString face:faceString |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4730 |
style:styleArgString size:sizeArg encoding:encodingSym |
295 | 4731 |
|
4732 |
"try to get the specified font, if not available, try next smaller |
|
4733 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
4734 |
as family and the other parameters as nil. For example, the cursor font |
|
4735 |
can be aquired that way." |
|
4736 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4737 |
|styleString theName theId xlatedStyle id spacing| |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4738 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4739 |
styleString := styleArgString. |
295 | 4740 |
|
4741 |
"special: if face is nil, allow access to X-fonts" |
|
4742 |
faceString isNil ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4743 |
sizeArg notNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4744 |
theName := familyString , '-' , sizeArg printString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4745 |
] ifFalse:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4746 |
theName := familyString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4747 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4748 |
theName isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4749 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4750 |
mhmh - fall back to the default font |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4751 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4752 |
theName := 'fixed' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4753 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4754 |
theId := self createFontFor:theName. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4755 |
theId isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4756 |
theId := self getDefaultFont |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4757 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4758 |
^ theId |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4759 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4760 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4761 |
"/ 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
|
4762 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4763 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4764 |
((styleString endsWith:'-narrow') |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4765 |
or:[styleString endsWith:'-semicondensed']) ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4766 |
|i| |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4767 |
i := styleString lastIndexOf:$-. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4768 |
spacing := styleString copyFrom:(i+1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4769 |
styleString := styleString copyTo:(i-1). |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4770 |
] ifFalse:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4771 |
spacing := 'normal'. |
295 | 4772 |
]. |
4773 |
||
4774 |
xlatedStyle := styleString. |
|
4775 |
xlatedStyle notNil ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4776 |
xlatedStyle := xlatedStyle first asString |
295 | 4777 |
]. |
4778 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4779 |
id := self |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4780 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4781 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4782 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4783 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4784 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4785 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4786 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4787 |
registry:encodingSym |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4788 |
encoding:'*'. |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4789 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4790 |
id isNil ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4791 |
(encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4792 |
"/ too stupid: encodings come in both cases |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4793 |
"/ and X does not ignore case |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4794 |
"/ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4795 |
id := self |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4796 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4797 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4798 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4799 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4800 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4801 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4802 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4803 |
registry:encodingSym asUppercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4804 |
encoding:'*'. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4805 |
id isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4806 |
id := self |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4807 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4808 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4809 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4810 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4811 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4812 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4813 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4814 |
registry:encodingSym asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4815 |
encoding:'*'. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4816 |
] |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4817 |
] |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4818 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4819 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4820 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4821 |
"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
|
4822 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
295 | 4823 |
! |
4824 |
||
4825 |
getFontWithFoundry:foundry family:family weight:weight |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4826 |
slant:slant spacing:spc pixelSize:pSize size:size |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4827 |
registry:registry encoding:encoding |
295 | 4828 |
|
4829 |
"get the specified font, if not available, return nil. |
|
4830 |
This is the new font creation method - all others will be changed to |
|
4831 |
use this entry. |
|
4832 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
4833 |
||
4834 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
4835 |
family: 'helvetica' 'courier' 'times' ... |
|
4836 |
weight: 'bold' 'medium' 'demi' ... |
|
4837 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
4838 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
4839 |
pixelSize: 16,18 ... usually left empty |
|
4840 |
size: size in point (1/72th of an inch) |
|
4841 |
registry: iso8859, sgi ... '*' |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4842 |
encoding: vendor specific encoding (usually '*') |
295 | 4843 |
" |
4844 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4845 |
|theName sizeMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4846 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4847 |
pSizeMatch registryMatch encodingMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4848 |
id| |
295 | 4849 |
|
4850 |
"this works only on 'Release >= 3' - X-servers" |
|
4851 |
"name is: |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4852 |
-foundry-family -weight -slant- |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4853 |
sony helvetica bold r |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4854 |
adobe courier medium i |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4855 |
msic fixed o |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4856 |
... ... |
295 | 4857 |
" |
4858 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4859 |
size isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4860 |
sizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4861 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4862 |
sizeMatch := size printString , '0' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4863 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4864 |
foundry isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4865 |
foundryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4866 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4867 |
foundryMatch := foundry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4868 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4869 |
family isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4870 |
familyMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4871 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4872 |
familyMatch := family |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4873 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4874 |
weight isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4875 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4876 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4877 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4878 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4879 |
slant isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4880 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4881 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4882 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4883 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4884 |
spc isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4885 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4886 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4887 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4888 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4889 |
pSize isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4890 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4891 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4892 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4893 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4894 |
registry isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4895 |
registryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4896 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4897 |
registryMatch := registry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4898 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4899 |
encoding isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4900 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4901 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4902 |
encodingMatch := encoding |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4903 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4904 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4905 |
theName := ('-' , foundryMatch, |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4906 |
'-' , familyMatch, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4907 |
'-' , weightMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4908 |
'-' , slantMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4909 |
'-' , spcMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4910 |
'-*' , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4911 |
'-' , pSizeMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4912 |
'-' , sizeMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4913 |
'-*-*-*-*' , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4914 |
'-' , registryMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4915 |
'-' , encodingMatch). |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4916 |
|
697 | 4917 |
"/ Transcript showCR:theName; endEntry. |
295 | 4918 |
|
4919 |
^ self createFontFor:theName. |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4920 |
|
295 | 4921 |
|
4922 |
" |
|
4923 |
Display getFontWithFoundry:'*' |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4924 |
family:'courier' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4925 |
weight:'medium' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4926 |
slant:'r' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4927 |
spacing:nil |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4928 |
pixelSize:nil |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4929 |
size:13 |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4930 |
registry:'iso8859' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4931 |
encoding:'*' |
295 | 4932 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4933 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4934 |
"Modified: 24.2.1996 / 22:33:29 / cg" |
295 | 4935 |
! |
4936 |
||
4937 |
listOfAvailableFonts |
|
4938 |
"return a list with all available fonts on this display. |
|
4939 |
Since this takes a long time, keep the result of the query for the |
|
4940 |
next time. The elements of the returned collection are instances of |
|
4941 |
FontDescription." |
|
4942 |
||
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
4943 |
|"stream aName fntDescr" names| |
295 | 4944 |
|
4945 |
listOfXFonts isNil ifTrue:[ |
|
4946 |
"/ |
|
4947 |
"/ old code; using a pipe to xlsfonts |
|
4948 |
"/ |
|
4949 |
"/ stream := PipeStream readingFrom:'xlsfonts ''*'''. |
|
4950 |
"/ stream isNil ifTrue:[^ nil]. |
|
4951 |
"/ listOfXFonts := OrderedCollection new. |
|
4952 |
"/ [stream atEnd] whileFalse:[ |
|
4953 |
"/ aName := stream nextLine. |
|
4954 |
"/ aName notNil ifTrue:[ |
|
4955 |
"/ self decomposeXFontName:aName into: |
|
4956 |
"/ [:family :face :style :size :coding | |
|
4957 |
"/ family notNil ifTrue:[ |
|
4958 |
"/ fntDescr := FontDescription |
|
4959 |
"/ family:family |
|
4960 |
"/ face:face |
|
4961 |
"/ style:style |
|
4962 |
"/ size:size |
|
4963 |
"/ encoding:coding. |
|
4964 |
"/ listOfXFonts add:fntDescr |
|
4965 |
"/ ] |
|
4966 |
"/ ] |
|
4967 |
"/ ] |
|
4968 |
"/ ]. |
|
4969 |
"/ stream close. |
|
4970 |
"/ "if xlsfont is broken ... (hey sco)" |
|
4971 |
"/ (listOfXFonts size == 0) ifTrue:[ |
|
4972 |
"/ listOfXFonts := nil |
|
4973 |
"/ ] ifFalse:[ |
|
4974 |
"/ listOfXFonts sort:[:a :b | a family < b family]. |
|
4975 |
"/ ]. |
|
4976 |
||
850 | 4977 |
"/ |
4978 |
"/ new code: |
|
4979 |
"/ use new primitive to get font names; |
|
4980 |
"/ this is much faster, and also works on systems where |
|
4981 |
"/ a) xlsfonts is broken (sco) |
|
4982 |
"/ b) xlsfonts is not available (aix) |
|
4983 |
"/ |
|
4984 |
names := self getAvailableFontsMatching:'*'. |
|
4985 |
names isNil ifTrue:[ |
|
4986 |
"no names returned ..." |
|
4987 |
^ nil |
|
4988 |
]. |
|
4989 |
listOfXFonts := names collect:[:aName | |
|
4990 |
|fntDescr| |
|
4991 |
||
4992 |
(self decomposeXFontName:aName into: |
|
4993 |
[:family :face :style :size :coding | |
|
4994 |
family notNil ifTrue:[ |
|
4995 |
fntDescr := FontDescription |
|
4996 |
family:family |
|
4997 |
face:face |
|
4998 |
style:style |
|
4999 |
size:size |
|
5000 |
encoding:coding. |
|
5001 |
] ifFalse:[ |
|
5002 |
fntDescr := FontDescription |
|
5003 |
name:aName |
|
5004 |
] |
|
5005 |
] |
|
5006 |
) ifFalse:[ |
|
5007 |
fntDescr := FontDescription name:aName. |
|
5008 |
]. |
|
5009 |
fntDescr |
|
5010 |
]. |
|
295 | 5011 |
|
5012 |
]. |
|
5013 |
^ listOfXFonts |
|
5014 |
||
5015 |
" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5016 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5017 |
|
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5018 |
Display getAvailableFontsMatching:'*'. |
295 | 5019 |
" |
5020 |
||
5021 |
"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
|
5022 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 5023 |
! |
5024 |
||
5025 |
releaseFont:aFontId |
|
5026 |
||
5027 |
%{ /* NOCONTEXT */ |
|
5028 |
||
5029 |
XFontStruct *f; |
|
5030 |
||
5031 |
if (ISCONNECTED) { |
|
5032 |
if (__isExternalAddress(aFontId)) { |
|
5033 |
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
|
5034 |
if (f) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5035 |
BEGIN_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5036 |
XFreeFont(myDpy, f); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5037 |
#ifdef COUNT_RESOURCES |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5038 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5039 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5040 |
END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5041 |
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
|
5042 |
} |
295 | 5043 |
} |
5044 |
} |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5045 |
%}. |
295 | 5046 |
self primitiveFailed |
5047 |
! |
|
5048 |
||
466 | 5049 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 5050 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
5051 |
on this display. |
|
5052 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
5053 |
||
5054 |
|sizes| |
|
5055 |
||
466 | 5056 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 5057 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5058 |
"special: in X11R5 and above, size 0 means: |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5059 |
there are scaled versions in all sizes available" |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5060 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5061 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64) |
295 | 5062 |
]. |
5063 |
^ sizes |
|
5064 |
||
5065 |
" |
|
5066 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
5067 |
" |
|
466 | 5068 |
|
5069 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 5070 |
! |
5071 |
||
5072 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
5073 |
||
5074 |
%{ /* NOCONTEXT */ |
|
5075 |
||
5076 |
XFontStruct *f; |
|
5077 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5078 |
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
|
5079 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5080 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5081 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5082 |
int nInstBytes; |
295 | 5083 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5084 |
if (ISCONNECTED) { |
850 | 5085 |
if (__bothSmallInteger(index1, index2) |
5086 |
&& __isExternalAddress(aFontId) |
|
5087 |
&& __isNonNilObject(aString)) { |
|
5088 |
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
|
5089 |
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
|
5090 |
|
850 | 5091 |
i1 = __intVal(index1) - 1; |
5092 |
cls = __qClass(aString); |
|
5093 |
||
5094 |
if (i1 >= 0) { |
|
5095 |
i2 = __intVal(index2) - 1; |
|
5096 |
if (i2 < i1) { |
|
5097 |
RETURN (self); |
|
5098 |
} |
|
5099 |
||
5100 |
cp = (char *) _stringVal(aString); |
|
5101 |
l = i2 - i1 + 1; |
|
5102 |
||
5103 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
5104 |
n = _stringSize(aString); |
|
5105 |
if (i2 < n) { |
|
5106 |
cp += i1; |
|
5107 |
BEGIN_INTERRUPTSBLOCKED |
|
5108 |
len = XTextWidth(f, cp, l); |
|
5109 |
END_INTERRUPTSBLOCKED |
|
5110 |
RETURN ( __MKSMALLINT(len) ); |
|
5111 |
} |
|
5112 |
} |
|
5113 |
||
5114 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5115 |
cp += nInstBytes; |
|
5116 |
||
5117 |
if (__isBytes(aString)) { |
|
5118 |
n = __byteArraySize(aString) - nInstBytes; |
|
5119 |
if (i2 < n) { |
|
5120 |
cp += i1; |
|
5121 |
BEGIN_INTERRUPTSBLOCKED |
|
5122 |
len = XTextWidth(f, cp, l); |
|
5123 |
END_INTERRUPTSBLOCKED |
|
5124 |
RETURN ( __MKSMALLINT(len) ); |
|
5125 |
} |
|
5126 |
} |
|
5127 |
||
5128 |
/* TWOBYTESTRINGS */ |
|
5129 |
if (__isWords(aString)) { |
|
5130 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
5131 |
||
5132 |
if (i2 < n) { |
|
5133 |
union { |
|
5134 |
char b[2]; |
|
5135 |
unsigned short s; |
|
5136 |
} u; |
|
5137 |
int i; |
|
5138 |
XChar2b *cp2 = (XChar2b *)0; |
|
5139 |
int mustFree = 0; |
|
5140 |
||
5141 |
cp += (i1 * 2); |
|
5142 |
if (l > 1000) l = 1000; |
|
5143 |
||
5144 |
/* |
|
5145 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
5146 |
* X expects them MSB first |
|
5147 |
* convert as required |
|
5148 |
*/ |
|
5149 |
||
5150 |
u.s = 0x1234; |
|
5151 |
if (u.b[0] != 0x12) { |
|
5152 |
if (l <= NLOCALBUFFER) { |
|
5153 |
cp2 = xlatebuffer; |
|
5154 |
} else { |
|
5155 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
5156 |
mustFree = 1; |
|
5157 |
} |
|
5158 |
for (i=0; i<l; i++) { |
|
5159 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
5160 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
5161 |
} |
|
5162 |
cp = (char *) cp2; |
|
5163 |
} |
|
5164 |
BEGIN_INTERRUPTSBLOCKED |
|
5165 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
|
5166 |
END_INTERRUPTSBLOCKED |
|
5167 |
||
5168 |
if (mustFree) { |
|
5169 |
free(cp2); |
|
5170 |
} |
|
5171 |
||
5172 |
RETURN ( __MKSMALLINT(len) ); |
|
5173 |
} |
|
5174 |
} |
|
5175 |
} |
|
5176 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5177 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5178 |
#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
|
5179 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5180 |
%}. |
295 | 5181 |
self primitiveFailed. |
5182 |
^ nil |
|
5183 |
! |
|
5184 |
||
5185 |
widthOf:aString inFont:aFontId |
|
5186 |
||
5187 |
%{ /* NOCONTEXT */ |
|
5188 |
||
5189 |
XFontStruct *f; |
|
5190 |
char *cp; |
|
5191 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
5192 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5193 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5194 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5195 |
int nInstBytes; |
295 | 5196 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5197 |
if (ISCONNECTED) { |
850 | 5198 |
if (__isExternalAddress(aFontId) |
5199 |
&& __isNonNilObject(aString)) { |
|
5200 |
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
|
5201 |
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
|
5202 |
|
850 | 5203 |
cls = __qClass(aString); |
5204 |
||
5205 |
cp = (char *)_stringVal(aString); |
|
5206 |
||
5207 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
5208 |
n = _stringSize(aString); |
|
5209 |
BEGIN_INTERRUPTSBLOCKED |
|
5210 |
len = XTextWidth(f, cp, n); |
|
5211 |
END_INTERRUPTSBLOCKED |
|
5212 |
RETURN ( __MKSMALLINT(len) ); |
|
5213 |
} |
|
5214 |
||
5215 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5216 |
cp += nInstBytes; |
|
5217 |
||
5218 |
if (__isBytes(aString)) { |
|
5219 |
n = __byteArraySize(aString) - nInstBytes; |
|
5220 |
||
5221 |
BEGIN_INTERRUPTSBLOCKED |
|
5222 |
len = XTextWidth(f, cp, n); |
|
5223 |
END_INTERRUPTSBLOCKED |
|
5224 |
RETURN ( __MKSMALLINT(len) ); |
|
5225 |
} |
|
5226 |
||
5227 |
/* TWOBYTESTRINGS */ |
|
5228 |
if (__isWords(aString)) { |
|
5229 |
union { |
|
5230 |
char b[2]; |
|
5231 |
unsigned short s; |
|
5232 |
} u; |
|
5233 |
int i; |
|
5234 |
XChar2b *cp2; |
|
5235 |
int mustFree = 0; |
|
5236 |
||
5237 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
5238 |
if (n > 1000) n = 1000; |
|
5239 |
||
5240 |
/* |
|
5241 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
5242 |
* X expects them MSB first |
|
5243 |
* convert as required |
|
5244 |
*/ |
|
5245 |
||
5246 |
u.s = 0x1234; |
|
5247 |
if (u.b[0] != 0x12) { |
|
5248 |
if (n <= NLOCALBUFFER) { |
|
5249 |
cp2 = xlatebuffer; |
|
5250 |
} else { |
|
5251 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
5252 |
mustFree = 1; |
|
5253 |
} |
|
5254 |
||
5255 |
for (i=0; i<n; i++) { |
|
5256 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
5257 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
5258 |
} |
|
5259 |
cp = (char *) cp2; |
|
5260 |
} |
|
5261 |
||
5262 |
BEGIN_INTERRUPTSBLOCKED |
|
5263 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
|
5264 |
END_INTERRUPTSBLOCKED |
|
5265 |
||
5266 |
if (mustFree) { |
|
5267 |
free(cp2); |
|
5268 |
} |
|
5269 |
||
5270 |
RETURN ( __MKSMALLINT(len) ); |
|
5271 |
} |
|
5272 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5273 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5274 |
#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
|
5275 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5276 |
%}. |
295 | 5277 |
self primitiveFailed. |
5278 |
^ nil |
|
5279 |
! ! |
|
5280 |
||
5281 |
!XWorkstation methodsFor:'grabbing '! |
|
5282 |
||
5283 |
allowEvents:mode |
|
5284 |
%{ /* NOCONTEXT */ |
|
5285 |
||
5286 |
int _mode, ok = 1; |
|
5287 |
||
5288 |
if (mode == @symbol(asyncPointer)) |
|
5289 |
_mode = AsyncPointer; |
|
5290 |
else if (mode == @symbol(syncPointer)) |
|
5291 |
_mode = SyncPointer; |
|
5292 |
else if (mode == @symbol(asyncKeyboard)) |
|
5293 |
_mode = AsyncKeyboard; |
|
5294 |
else if (mode == @symbol(syncKeyboard)) |
|
5295 |
_mode = SyncKeyboard; |
|
5296 |
else if (mode == @symbol(syncBoth)) |
|
5297 |
_mode = SyncBoth; |
|
5298 |
else if (mode == @symbol(asyncBoth)) |
|
5299 |
_mode = AsyncBoth; |
|
5300 |
else if (mode == @symbol(replayPointer)) |
|
5301 |
_mode = ReplayPointer; |
|
5302 |
else if (mode == @symbol(replayKeyboard)) |
|
5303 |
_mode = ReplayKeyboard; |
|
5304 |
else |
|
5305 |
ok = 0; |
|
5306 |
||
5307 |
if (ok) { |
|
5308 |
BEGIN_INTERRUPTSBLOCKED |
|
5309 |
XAllowEvents(myDpy, _mode, CurrentTime); |
|
5310 |
END_INTERRUPTSBLOCKED |
|
5311 |
RETURN (self); |
|
5312 |
} |
|
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5313 |
%}. |
295 | 5314 |
self primitiveFailed |
5315 |
! |
|
5316 |
||
5317 |
grabKeyboardIn:aWindowId |
|
5318 |
"grab the keyboard" |
|
5319 |
||
5320 |
%{ /* NOCONTEXT */ |
|
5321 |
int result, ok; |
|
5322 |
||
5323 |
if (__isExternalAddress(aWindowId)) { |
|
5324 |
BEGIN_INTERRUPTSBLOCKED |
|
5325 |
result = XGrabKeyboard(myDpy, |
|
5326 |
_WindowVal(aWindowId), |
|
5327 |
True /* False */, |
|
5328 |
GrabModeAsync, |
|
5329 |
GrabModeAsync, |
|
5330 |
CurrentTime); |
|
5331 |
END_INTERRUPTSBLOCKED |
|
5332 |
ok = 0; |
|
5333 |
switch(result) { |
|
5334 |
case AlreadyGrabbed: |
|
5335 |
printf("XWORKSTAT: grab keyboard: AlreadyGrabbed\n"); |
|
5336 |
break; |
|
5337 |
case GrabNotViewable: |
|
5338 |
printf("XWORKSTAT: grab keyboard: GrabNotViewable\n"); |
|
5339 |
break; |
|
5340 |
case GrabInvalidTime: |
|
5341 |
printf("XWORKSTAT: grab keyboard: InvalidTime\n"); |
|
5342 |
break; |
|
5343 |
case GrabFrozen: |
|
5344 |
printf("XWORKSTAT: grab keyboard: Frozen\n"); |
|
5345 |
break; |
|
5346 |
default: |
|
5347 |
ok = 1; |
|
5348 |
break; |
|
5349 |
} |
|
5350 |
if (! ok) { |
|
5351 |
XUngrabKeyboard(myDpy, CurrentTime); |
|
5352 |
RETURN (false); |
|
5353 |
} |
|
5354 |
||
5355 |
RETURN ( true ); |
|
5356 |
} |
|
5357 |
%} |
|
5358 |
. |
|
5359 |
self primitiveFailed |
|
5360 |
! |
|
5361 |
||
5362 |
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
5363 |
"grap the pointer - return true if ok" |
|
5364 |
||
5365 |
%{ /* NOCONTEXT */ |
|
5366 |
||
5367 |
int result, ok; |
|
5368 |
Window confineWin; |
|
5369 |
Cursor curs; |
|
5370 |
int pointer_mode, keyboard_mode; |
|
5371 |
||
5372 |
if (__isExternalAddress(aWindowId)) { |
|
5373 |
if (__isExternalAddress(confineId)) |
|
5374 |
confineWin = _WindowVal(confineId); |
|
5375 |
else |
|
5376 |
confineWin = (Window) None; |
|
5377 |
||
5378 |
if (__isExternalAddress(aCursorId)) |
|
5379 |
curs = _CursorVal(aCursorId); |
|
5380 |
else |
|
5381 |
curs = (Cursor) None; |
|
5382 |
||
5383 |
if (pMode == @symbol(sync)) |
|
5384 |
pointer_mode = GrabModeSync; |
|
5385 |
else |
|
5386 |
pointer_mode = GrabModeAsync; |
|
5387 |
||
5388 |
if (kMode == @symbol(sync)) |
|
5389 |
keyboard_mode = GrabModeSync; |
|
5390 |
else |
|
5391 |
keyboard_mode = GrabModeAsync; |
|
5392 |
||
5393 |
BEGIN_INTERRUPTSBLOCKED |
|
5394 |
result = XGrabPointer(myDpy, |
|
5395 |
_WindowVal(aWindowId), |
|
5396 |
False, |
|
5397 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask, |
|
5398 |
pointer_mode, keyboard_mode, |
|
5399 |
confineWin, |
|
5400 |
curs, |
|
5401 |
CurrentTime); |
|
5402 |
END_INTERRUPTSBLOCKED |
|
5403 |
||
5404 |
ok = 0; |
|
5405 |
switch (result) { |
|
5406 |
case AlreadyGrabbed: |
|
5407 |
printf("XWORKSTAT: grab pointer: AlreadyGrabbed\n"); |
|
5408 |
break; |
|
5409 |
case GrabNotViewable: |
|
5410 |
printf("XWORKSTAT: grab pointer: GrabNotViewable\n"); |
|
5411 |
break; |
|
5412 |
case GrabInvalidTime: |
|
5413 |
printf("XWORKSTAT: grab pointer: InvalidTime\n"); |
|
5414 |
break; |
|
5415 |
case GrabFrozen: |
|
5416 |
printf("XWORKSTAT: grab pointer: Frozen\n"); |
|
5417 |
break; |
|
5418 |
default: |
|
5419 |
ok = 1; |
|
5420 |
break; |
|
5421 |
} |
|
5422 |
||
5423 |
if (! ok) { |
|
5424 |
XUngrabPointer(myDpy, CurrentTime); |
|
5425 |
RETURN (false); |
|
5426 |
} |
|
5427 |
RETURN ( true ); |
|
5428 |
} |
|
5429 |
%} |
|
5430 |
. |
|
5431 |
self primitiveFailed |
|
5432 |
! |
|
5433 |
||
5434 |
ungrabKeyboard |
|
5435 |
"release the keyboard" |
|
5436 |
||
5437 |
%{ /* NOCONTEXT */ |
|
5438 |
||
5439 |
if (ISCONNECTED) { |
|
5440 |
BEGIN_INTERRUPTSBLOCKED |
|
5441 |
XUngrabKeyboard(myDpy, CurrentTime); |
|
5442 |
XSync(myDpy, 0); |
|
5443 |
END_INTERRUPTSBLOCKED |
|
5444 |
} |
|
5445 |
%}. |
|
5446 |
activeKeyboardGrab := nil |
|
5447 |
! |
|
5448 |
||
5449 |
ungrabPointer |
|
5450 |
"release the pointer" |
|
5451 |
||
5452 |
%{ /* NOCONTEXT */ |
|
5453 |
||
5454 |
if (ISCONNECTED) { |
|
5455 |
BEGIN_INTERRUPTSBLOCKED |
|
5456 |
XUngrabPointer(myDpy, CurrentTime); |
|
5457 |
XSync(myDpy, 0); |
|
5458 |
END_INTERRUPTSBLOCKED |
|
5459 |
} |
|
5460 |
%}. |
|
5461 |
activePointerGrab := nil |
|
5462 |
! ! |
|
5463 |
||
5464 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
5465 |
||
5466 |
noClipIn:aGCId |
|
5467 |
"disable clipping rectangle" |
|
5468 |
||
5469 |
%{ /* NOCONTEXT */ |
|
5470 |
||
5471 |
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
|
5472 |
GC gc; |
295 | 5473 |
|
5474 |
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
|
5475 |
gc = _GCVal(aGCId); |
295 | 5476 |
gcv.clip_mask = None; |
5477 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
|
5478 |
RETURN ( self ); |
|
5479 |
} |
|
5480 |
%}. |
|
5481 |
self primitiveFailed |
|
5482 |
! |
|
5483 |
||
5484 |
setBackground:bgColorIndex in:aGCId |
|
5485 |
"set background color to be drawn with" |
|
5486 |
||
5487 |
%{ /* NOCONTEXT */ |
|
5488 |
||
5489 |
if (__isExternalAddress(aGCId) |
|
5490 |
&& __isSmallInteger(bgColorIndex)) { |
|
555 | 5491 |
XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); |
295 | 5492 |
RETURN ( self ); |
5493 |
} |
|
5494 |
%}. |
|
5495 |
self primitiveFailed |
|
5496 |
! |
|
5497 |
||
5498 |
setBitmapMask:aBitmapId in:aGCId |
|
5499 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
5500 |
||
5501 |
%{ /* NOCONTEXT */ |
|
5502 |
||
5503 |
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
|
5504 |
GC gc; |
295 | 5505 |
Pixmap bitmap; |
5506 |
||
5507 |
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
|
5508 |
gc = _GCVal(aGCId); |
295 | 5509 |
if (__isExternalAddress(aBitmapId)) { |
5510 |
bitmap = _PixmapVal(aBitmapId); |
|
5511 |
XSetStipple(dpy, gc, bitmap); |
|
5512 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5513 |
RETURN ( self ); |
|
5514 |
} |
|
5515 |
if (aBitmapId == nil) { |
|
5516 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5517 |
RETURN ( self ); |
|
5518 |
} |
|
5519 |
} |
|
5520 |
%}. |
|
5521 |
self primitiveFailed |
|
5522 |
! |
|
5523 |
||
5524 |
setClipByChildren:aBool in:aGCId |
|
5525 |
"enable/disable drawing into child views" |
|
5526 |
||
5527 |
%{ /* NOCONTEXT */ |
|
5528 |
||
5529 |
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
|
5530 |
GC gc; |
295 | 5531 |
|
5532 |
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
|
5533 |
gc = _GCVal(aGCId); |
295 | 5534 |
if (aBool == true) |
5535 |
gcv.subwindow_mode = ClipByChildren; |
|
5536 |
else |
|
5537 |
gcv.subwindow_mode = IncludeInferiors; |
|
5538 |
||
5539 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
|
5540 |
RETURN ( self ); |
|
5541 |
} |
|
5542 |
%}. |
|
5543 |
self primitiveFailed |
|
5544 |
! |
|
5545 |
||
5546 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId |
|
5547 |
"clip to a rectangle" |
|
5548 |
||
5549 |
%{ /* NOCONTEXT */ |
|
5550 |
||
5551 |
XRectangle r; |
|
5552 |
||
5553 |
if (__isExternalAddress(aGCId) |
|
5554 |
&& __bothSmallInteger(clipX, clipY) |
|
5555 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
555 | 5556 |
r.x = __intVal(clipX); |
5557 |
r.y = __intVal(clipY); |
|
5558 |
r.width = __intVal(clipWidth); |
|
5559 |
r.height = __intVal(clipHeight); |
|
295 | 5560 |
XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
5561 |
RETURN ( self ); |
|
5562 |
} |
|
5563 |
%}. |
|
5564 |
self primitiveFailed |
|
5565 |
! |
|
5566 |
||
788 | 5567 |
setDashes:dashList dashOffset:offset in:aGCId |
5568 |
"set line attributes" |
|
5569 |
||
5570 |
%{ /* NOCONTEXT */ |
|
5571 |
||
5572 |
if (__isExternalAddress(aGCId) |
|
5573 |
&& __isSmallInteger(offset) |
|
5574 |
&& __isByteArray(dashList)) { |
|
850 | 5575 |
XSetDashes(myDpy, _GCVal(aGCId), |
5576 |
__intVal(offset), |
|
5577 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
5578 |
__byteArraySize(dashList)); |
|
5579 |
RETURN ( self ); |
|
788 | 5580 |
} |
5581 |
bad: ; |
|
5582 |
%}. |
|
5583 |
" |
|
5584 |
either aGCId is invalid, |
|
5585 |
and/or dashList is not a byteArray |
|
5586 |
and/or offset is not a smallInteger |
|
5587 |
" |
|
5588 |
self primitiveFailed |
|
5589 |
! |
|
5590 |
||
295 | 5591 |
setFont:aFontId in:aGCId |
5592 |
"set font to be drawn in" |
|
5593 |
||
5594 |
%{ /* NOCONTEXT */ |
|
5595 |
||
5596 |
XFontStruct *f; |
|
5597 |
||
5598 |
if (__isExternalAddress(aFontId) |
|
5599 |
&& __isExternalAddress(aGCId)) { |
|
5600 |
f = (XFontStruct *) _FontVal(aFontId); |
|
5601 |
XSetFont(myDpy, _GCVal(aGCId), f->fid); |
|
5602 |
RETURN ( self ); |
|
5603 |
} |
|
5604 |
%}. |
|
5605 |
" |
|
5606 |
aGCId and/or aFontId are invalid |
|
5607 |
" |
|
5608 |
self primitiveFailed |
|
5609 |
! |
|
5610 |
||
5611 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
5612 |
"set foreground and background colors to be drawn with" |
|
5613 |
||
5614 |
%{ /* NOCONTEXT */ |
|
5615 |
||
5616 |
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
|
5617 |
GC gc; |
295 | 5618 |
|
5619 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
5620 |
&& __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
|
5621 |
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
|
5622 |
|
555 | 5623 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
5624 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
295 | 5625 |
RETURN ( self ); |
5626 |
} |
|
5627 |
%}. |
|
5628 |
self primitiveFailed |
|
5629 |
! |
|
5630 |
||
5631 |
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId |
|
5632 |
"set foreground and background colors to be drawn with using mask or |
|
5633 |
solid (if aBitmapId is nil)" |
|
5634 |
||
5635 |
%{ /* NOCONTEXT */ |
|
5636 |
||
5637 |
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
|
5638 |
GC gc; |
295 | 5639 |
|
5640 |
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
|
5641 |
gc = _GCVal(aGCId); |
295 | 5642 |
if (__isSmallInteger(fgColor)) |
555 | 5643 |
XSetForeground(dpy, gc, __intVal(fgColor)); |
295 | 5644 |
if (__isSmallInteger(bgColor)) |
555 | 5645 |
XSetBackground(dpy, gc, __intVal(bgColor)); |
295 | 5646 |
|
5647 |
if (__isExternalAddress(aBitmapId)) { |
|
5648 |
XSetStipple(dpy, gc, _PixmapVal(aBitmapId)); |
|
5649 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5650 |
RETURN ( self ); |
|
5651 |
} |
|
5652 |
if (aBitmapId == nil) { |
|
5653 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5654 |
RETURN ( self ); |
|
5655 |
} |
|
5656 |
} |
|
5657 |
%}. |
|
5658 |
self primitiveFailed |
|
5659 |
! |
|
5660 |
||
5661 |
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId |
|
5662 |
"set foreground and background colors to be drawn with using mask or |
|
5663 |
solid (if aBitmapId is nil); also set lineWidth" |
|
5664 |
||
5665 |
%{ /* NOCONTEXT */ |
|
5666 |
||
5667 |
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
|
5668 |
GC gc; |
295 | 5669 |
|
5670 |
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
|
5671 |
gc = _GCVal(aGCId); |
295 | 5672 |
if (__isSmallInteger(lw)) { |
555 | 5673 |
XSetLineAttributes(dpy, gc, __intVal(lw), |
295 | 5674 |
LineSolid, CapNotLast, JoinMiter); |
5675 |
} |
|
5676 |
if (__isSmallInteger(fgColor)) |
|
555 | 5677 |
XSetForeground(dpy, gc, __intVal(fgColor)); |
295 | 5678 |
if (__isSmallInteger(bgColor)) |
555 | 5679 |
XSetBackground(dpy, gc, __intVal(bgColor)); |
295 | 5680 |
|
5681 |
if (__isExternalAddress(aBitmapId)) { |
|
5682 |
XSetStipple(dpy, gc, _PixmapVal(aBitmapId)); |
|
5683 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5684 |
RETURN ( self ); |
|
5685 |
} |
|
5686 |
if (aBitmapId == nil) { |
|
5687 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5688 |
RETURN ( self ); |
|
5689 |
} |
|
5690 |
} |
|
5691 |
%}. |
|
5692 |
self primitiveFailed |
|
5693 |
! |
|
5694 |
||
5695 |
setForeground:fgColorIndex in:aGCId |
|
5696 |
"set foreground color to be drawn with" |
|
5697 |
||
5698 |
%{ /* NOCONTEXT */ |
|
5699 |
||
5700 |
if (__isExternalAddress(aGCId) |
|
5701 |
&& __isSmallInteger(fgColorIndex)) { |
|
555 | 5702 |
XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); |
295 | 5703 |
RETURN ( self ); |
5704 |
} |
|
5705 |
%}. |
|
5706 |
self primitiveFailed |
|
5707 |
! |
|
5708 |
||
5709 |
setFunction:aFunctionSymbol in:aGCId |
|
5710 |
"set alu function to be drawn with" |
|
5711 |
||
5712 |
%{ /* NOCONTEXT */ |
|
5713 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5714 |
GC gc; |
295 | 5715 |
int fun = -1; |
5716 |
||
5717 |
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
|
5718 |
gc = _GCVal(aGCId); |
295 | 5719 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
5720 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
|
5721 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
|
5722 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
|
5723 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
|
5724 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
|
5725 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
|
5726 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
|
5727 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
|
5728 |
if (fun != -1) { |
|
5729 |
XSetFunction(myDpy, gc, fun); |
|
5730 |
RETURN ( self ); |
|
5731 |
} |
|
5732 |
} |
|
5733 |
%}. |
|
5734 |
" |
|
5735 |
either aGCId is not an integer, or an invalid symbol |
|
5736 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
5737 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
5738 |
" |
|
5739 |
self primitiveFailed |
|
5740 |
! |
|
5741 |
||
5742 |
setGraphicsExposures:aBoolean in:aGCId |
|
5743 |
"set or clear the graphics exposures flag" |
|
5744 |
||
5745 |
%{ /* NOCONTEXT */ |
|
5746 |
||
5747 |
if (__isExternalAddress(aGCId)) { |
|
5748 |
XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); |
|
5749 |
RETURN ( self ); |
|
5750 |
} |
|
5751 |
%} |
|
5752 |
. |
|
5753 |
self primitiveFailed |
|
5754 |
! |
|
5755 |
||
5756 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
5757 |
"set line attributes" |
|
5758 |
||
5759 |
%{ /* NOCONTEXT */ |
|
5760 |
||
5761 |
int x_style, x_cap, x_join; |
|
5762 |
||
5763 |
if (__isExternalAddress(aGCId) |
|
5764 |
&& __isSmallInteger(aNumber)) { |
|
5765 |
if (lineStyle == @symbol(solid)) x_style = LineSolid; |
|
5766 |
else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash; |
|
5767 |
else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash; |
|
5768 |
else goto bad; |
|
5769 |
||
5770 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
|
5771 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
|
5772 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
|
5773 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
|
5774 |
else goto bad; |
|
5775 |
||
5776 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
|
5777 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
|
5778 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
|
5779 |
else goto bad; |
|
5780 |
||
5781 |
XSetLineAttributes(myDpy, |
|
555 | 5782 |
_GCVal(aGCId), __intVal(aNumber), |
295 | 5783 |
x_style, x_cap, x_join); |
5784 |
RETURN ( self ); |
|
5785 |
} |
|
5786 |
bad: ; |
|
5787 |
%}. |
|
5788 |
" |
|
5789 |
either aGCId is invalid, |
|
5790 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
|
5791 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
5792 |
and/or joinStyle is none of #miter, #bevel, #round |
|
5793 |
" |
|
5794 |
self primitiveFailed |
|
5795 |
! |
|
5796 |
||
5797 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
5798 |
"set the mask origin" |
|
5799 |
||
5800 |
%{ /* NOCONTEXT */ |
|
5801 |
||
5802 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
|
555 | 5803 |
XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
295 | 5804 |
RETURN ( self ); |
5805 |
} |
|
5806 |
%}. |
|
5807 |
self primitiveFailed |
|
5808 |
! |
|
5809 |
||
5810 |
setPixmapMask:aPixmapId in:aGCId |
|
5811 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
5812 |
||
5813 |
%{ /* NOCONTEXT */ |
|
5814 |
||
5815 |
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
|
5816 |
GC gc; |
295 | 5817 |
Pixmap pixmap; |
5818 |
||
5819 |
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
|
5820 |
gc = _GCVal(aGCId); |
295 | 5821 |
if (__isExternalAddress(aPixmapId)) { |
5822 |
pixmap = _PixmapVal(aPixmapId); |
|
5823 |
XSetTile(dpy, gc, pixmap); |
|
5824 |
XSetFillStyle(dpy, gc, FillTiled); |
|
5825 |
RETURN ( self ); |
|
5826 |
} |
|
5827 |
if (aPixmapId == nil) { |
|
5828 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5829 |
RETURN ( self ); |
|
5830 |
} |
|
5831 |
} |
|
5832 |
%}. |
|
5833 |
self primitiveFailed |
|
5834 |
! ! |
|
5835 |
||
5836 |
!XWorkstation methodsFor:'initialize / release'! |
|
5837 |
||
5838 |
close |
|
5839 |
"close down the connection to the X-server" |
|
5840 |
||
5841 |
%{ /* NOCONTEXT */ |
|
5842 |
||
5843 |
if (ISCONNECTED) { |
|
5844 |
BEGIN_INTERRUPTSBLOCKED |
|
5845 |
XCloseDisplay(myDpy); |
|
555 | 5846 |
__INST(displayId) = nil; |
295 | 5847 |
END_INTERRUPTSBLOCKED |
5848 |
} |
|
5849 |
%} |
|
5850 |
! |
|
5851 |
||
5852 |
initializeDefaultValues |
|
5853 |
buttonTranslation := ButtonTranslation. |
|
5854 |
multiClickTimeDelta := MultiClickTimeDelta. |
|
5855 |
||
5856 |
self initializeModifierMappings |
|
5857 |
! |
|
5858 |
||
5859 |
initializeEventBuffer |
|
5860 |
|sz| |
|
5861 |
||
5862 |
%{ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5863 |
sz = __MKSMALLINT(sizeof(XEvent) + 100); |
295 | 5864 |
%}. |
5865 |
eventBuffer isNil ifTrue:[ |
|
5866 |
eventBuffer := ByteArray new:sz. |
|
5867 |
]. |
|
5868 |
! |
|
5869 |
||
5870 |
initializeFor:aDisplayName |
|
5871 |
"initialize the receiver for a connection to an X-Server; |
|
5872 |
the argument, aDisplayName may be nil (for the default server from |
|
5873 |
DISPLAY-variable or command line argument) or the name of the server |
|
5874 |
as hostname:number" |
|
5875 |
||
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5876 |
|dpyName index arguments| |
295 | 5877 |
|
5878 |
dpyName := aDisplayName. |
|
5879 |
dpyName isNil ifTrue:[ |
|
5880 |
"look for a '-display xxx' argument" |
|
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5881 |
(arguments := Smalltalk commandLineArguments) notNil ifTrue:[ |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5882 |
index := arguments indexOf:'-display'. |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5883 |
(index between:1 and:(arguments size - 1)) ifTrue:[ |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5884 |
dpyName := arguments at:index+1 |
295 | 5885 |
] |
5886 |
] |
|
5887 |
]. |
|
5888 |
%{ |
|
5889 |
int scr; |
|
5890 |
Display *dpy; |
|
5891 |
Visual *visual; |
|
5892 |
XVisualInfo viproto; |
|
5893 |
XVisualInfo *vip; /* retured info */ |
|
5894 |
int maxRGBDepth; |
|
5895 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
5896 |
int rgbVisualID; |
|
5897 |
int nvi, i; |
|
5898 |
int shapeEventBase, shapeErrorBase; |
|
5899 |
int shmEventBase, shmErrorBase; |
|
5900 |
int faxEventBase, faxErrorBase; |
|
5901 |
char *type, *nm; |
|
5902 |
int dummy; |
|
5903 |
OBJ dpyID; |
|
5904 |
||
555 | 5905 |
if (__INST(displayId) != nil) { |
295 | 5906 |
/* |
5907 |
* already connected - you bad guy try to |
|
5908 |
* trick me manually ? |
|
5909 |
*/ |
|
5910 |
RETURN ( self ); |
|
5911 |
} |
|
5912 |
||
5913 |
BEGIN_INTERRUPTSBLOCKED |
|
5914 |
||
5915 |
if (__isString(dpyName)) |
|
5916 |
nm = (char *)_stringVal(dpyName); |
|
5917 |
else { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
5918 |
dpyName = __MKSTRING((char *)getenv("DISPLAY")); |
295 | 5919 |
nm = NULL; |
5920 |
} |
|
5921 |
dpy = XOpenDisplay(nm); |
|
5922 |
||
5923 |
if (dpy) { |
|
555 | 5924 |
__INST(displayId) = dpyID = __MKOBJ(dpy); __STORE(self, dpyID); |
295 | 5925 |
|
5926 |
#ifdef SUPERDEBUG |
|
5927 |
XSynchronize(dpy, 1); |
|
5928 |
#endif |
|
5929 |
||
5930 |
XSetErrorHandler(__XErrorHandler__); |
|
5931 |
} |
|
5932 |
||
5933 |
END_INTERRUPTSBLOCKED |
|
5934 |
%}. |
|
5935 |
displayId isNil ifTrue:[ |
|
5936 |
'XWORKSTATION: cannot connect to Display.' errorPrintNL. |
|
5937 |
^ nil |
|
5938 |
]. |
|
5939 |
||
5940 |
dispatching := false. |
|
5941 |
dispatchingExpose := false. |
|
5942 |
isSlow := false. |
|
5943 |
shiftDown := false. |
|
5944 |
ctrlDown := false. |
|
5945 |
metaDown := false. |
|
5946 |
altDown := false. |
|
5947 |
motionEventCompression := true. |
|
5948 |
buttonsPressed := 0. |
|
5949 |
displayName := dpyName. |
|
5950 |
||
5951 |
protocolsAtom := nil. |
|
5952 |
deleteWindowAtom := nil. |
|
5953 |
saveYourselfAtom := nil. |
|
5954 |
quitAppAtom := nil. |
|
5955 |
||
5956 |
self initializeScreenProperties. |
|
5957 |
||
5958 |
self initializeDefaultValues. |
|
5959 |
self initializeEventBuffer. |
|
5960 |
self initializeSpecialFlags. |
|
5961 |
self initializeKeyboardMap. |
|
5962 |
||
5963 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
|
5964 |
! |
|
5965 |
||
5966 |
initializeModifierMappings |
|
5967 |
|map mod| |
|
5968 |
||
5969 |
"/ altModifiers := #(Alt_L Alt_R). |
|
5970 |
"/ metaModifiers := #(Meta_L Meta_R). |
|
5971 |
"/ ctrlModifiers := #(Control_L Control_R). |
|
5972 |
"/ shiftModifiers := #(Shift_L Shift_R). |
|
5973 |
||
5974 |
shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil. |
|
5975 |
altModifierMask := metaModifierMask := nil. |
|
5976 |
||
5977 |
map := self modifierMapping. |
|
342 | 5978 |
map isNil ifTrue:[ |
5979 |
"/ |
|
5980 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
|
5981 |
"/ setup some reasonable default. If that is not sufficient, |
|
5982 |
"/ you have to change things from your display.rc file. |
|
5983 |
"/ |
|
5984 |
altModifierMask := self modifier1Mask. |
|
5985 |
metaModifierMask := self modifier2Mask. |
|
5986 |
||
5987 |
shiftModifiers := #(Shift_L Shift_R Shift). |
|
5988 |
ctrlModifiers := #(Control_L Control_R Control). |
|
5989 |
metaModifiers := #(Alt_L Meta_L Meta_R Meta). |
|
5990 |
altModifiers := #(Alt_R Alt). |
|
5991 |
] ifFalse:[ |
|
5992 |
altModifierMask := 0. |
|
374 | 5993 |
metaModifierMask := 0. |
5994 |
||
5995 |
mod := map at:1. |
|
5996 |
mod notNil ifTrue:[ |
|
342 | 5997 |
shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
374 | 5998 |
]. |
5999 |
mod := map at:3. |
|
6000 |
mod notNil ifTrue:[ |
|
342 | 6001 |
ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
374 | 6002 |
]. |
6003 |
mod := map at:4. |
|
6004 |
mod notNil ifTrue:[ |
|
342 | 6005 |
metaModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
6006 |
metaModifierMask := 1 bitShift:(4-1). |
|
374 | 6007 |
]. |
6008 |
mod := map at:5. |
|
6009 |
mod notNil ifTrue:[ |
|
342 | 6010 |
altModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
6011 |
altModifierMask := 1 bitShift:(5-1). |
|
6012 |
] |
|
295 | 6013 |
]. |
6014 |
||
6015 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
6016 |
! |
|
6017 |
||
6018 |
initializeScreenProperties |
|
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6019 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6020 |
|
295 | 6021 |
%{ /* NOCONTEXT */ |
6022 |
||
6023 |
Display *dpy = myDpy; |
|
6024 |
int scr; |
|
6025 |
Visual *visual; |
|
6026 |
XVisualInfo viproto; |
|
6027 |
XVisualInfo *vip; /* retured info */ |
|
6028 |
int maxRGBDepth; |
|
6029 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
6030 |
int rgbVisualID; |
|
6031 |
int nvi, i; |
|
6032 |
int shapeEventBase, shapeErrorBase; |
|
6033 |
int shmEventBase, shmErrorBase; |
|
6034 |
int faxEventBase, faxErrorBase; |
|
6035 |
char *type, *nm; |
|
6036 |
int dummy; |
|
6037 |
int mask, shift, nBits; |
|
6038 |
||
6039 |
if (ISCONNECTED) { |
|
850 | 6040 |
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask); |
6041 |
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask); |
|
6042 |
||
6043 |
BEGIN_INTERRUPTSBLOCKED |
|
6044 |
||
6045 |
__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy)); |
|
6046 |
__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr)); |
|
6047 |
__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr)); |
|
6048 |
__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr)); |
|
6049 |
__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr)); |
|
6050 |
__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr)); |
|
6051 |
__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr)); |
|
6052 |
__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr)); |
|
6053 |
__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr)); |
|
295 | 6054 |
|
6055 |
#ifdef SHAPE |
|
850 | 6056 |
if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase)) |
6057 |
__INST(hasShapeExtension) = true; |
|
6058 |
else |
|
295 | 6059 |
#endif |
850 | 6060 |
__INST(hasShapeExtension) = false; |
295 | 6061 |
|
6062 |
#ifdef SHM |
|
850 | 6063 |
if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase)) |
6064 |
__INST(hasShmExtension) = true; |
|
6065 |
else |
|
295 | 6066 |
#endif |
850 | 6067 |
__INST(hasShmExtension) = false; |
295 | 6068 |
|
6069 |
#ifdef DPS |
|
850 | 6070 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
6071 |
__INST(hasDPSExtension) = true; |
|
6072 |
else |
|
295 | 6073 |
#endif |
850 | 6074 |
__INST(hasDPSExtension) = false; |
295 | 6075 |
|
6076 |
#ifdef XVIDEO |
|
850 | 6077 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
6078 |
__INST(hasXVideoExtension) = true; |
|
6079 |
else |
|
295 | 6080 |
#endif |
850 | 6081 |
__INST(hasXVideoExtension) = false; |
295 | 6082 |
|
6083 |
#ifdef MBUF |
|
850 | 6084 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
6085 |
__INST(hasMbufExtension) = true; |
|
6086 |
else |
|
295 | 6087 |
#endif |
850 | 6088 |
__INST(hasMbufExtension) = false; |
295 | 6089 |
|
6090 |
#ifdef PEX5 |
|
850 | 6091 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) |
6092 |
__INST(hasPEXExtension) = true; |
|
6093 |
else |
|
295 | 6094 |
#endif |
850 | 6095 |
__INST(hasPEXExtension) = false; |
295 | 6096 |
|
6097 |
#ifdef XIE |
|
850 | 6098 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) |
6099 |
__INST(hasImageExtension) = true; |
|
6100 |
else |
|
295 | 6101 |
#endif |
850 | 6102 |
__INST(hasImageExtension) = false; |
295 | 6103 |
|
6104 |
#ifdef XI |
|
850 | 6105 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) |
6106 |
__INST(hasInputExtension) = true; |
|
6107 |
else |
|
295 | 6108 |
#endif |
850 | 6109 |
__INST(hasInputExtension) = false; |
6110 |
||
6111 |
/* |
|
6112 |
* look for RGB visual |
|
6113 |
*/ |
|
6114 |
nvi = 0; |
|
6115 |
viproto.screen = scr; |
|
6116 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
|
6117 |
maxRGBDepth = 0; |
|
6118 |
for (i = 0; i < nvi; i++) { |
|
6119 |
switch (vip[i].class) { |
|
6120 |
case TrueColor: |
|
6121 |
if (vip[i].depth > maxRGBDepth) { |
|
6122 |
maxRGBDepth = vip[i].depth; |
|
6123 |
rgbRedMask = vip[i].red_mask; |
|
6124 |
rgbGreenMask = vip[i].green_mask; |
|
6125 |
rgbBlueMask = vip[i].blue_mask; |
|
6126 |
rgbVisualID = vip[i].visualid; |
|
6127 |
} |
|
6128 |
break; |
|
6129 |
} |
|
6130 |
} |
|
6131 |
if (vip) XFree ((char *) vip); |
|
6132 |
||
6133 |
if (maxRGBDepth) { |
|
6134 |
__INST(rgbVisual) = __MKOBJ(rgbVisualID); __STORESELF(rgbVisual); |
|
6135 |
} |
|
6136 |
||
6137 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
6138 |
__INST(monitorType) = @symbol(unknown); |
|
6139 |
__INST(hasColors) = true; |
|
6140 |
__INST(hasGreyscales) = true; |
|
6141 |
switch (visual->class) { |
|
6142 |
case StaticGray: |
|
6143 |
__INST(visualType) = @symbol(StaticGray); |
|
6144 |
__INST(hasColors) = false; |
|
6145 |
__INST(monitorType) = @symbol(monochrome); |
|
6146 |
break; |
|
6147 |
case GrayScale: |
|
6148 |
__INST(visualType) = @symbol(GrayScale); |
|
6149 |
__INST(hasColors) = false; |
|
6150 |
__INST(monitorType) = @symbol(monochrome); |
|
6151 |
break; |
|
6152 |
case StaticColor: |
|
6153 |
__INST(visualType) = @symbol(StaticColor); |
|
6154 |
break; |
|
6155 |
case PseudoColor: |
|
6156 |
__INST(visualType) = @symbol(PseudoColor); |
|
6157 |
break; |
|
6158 |
case TrueColor: |
|
6159 |
__INST(visualType) = @symbol(TrueColor); |
|
6160 |
break; |
|
6161 |
case DirectColor: |
|
6162 |
__INST(visualType) = @symbol(DirectColor); |
|
6163 |
break; |
|
6164 |
} |
|
6165 |
if (DisplayCells(dpy, scr) == 2) { |
|
6166 |
__INST(hasColors) = false; |
|
6167 |
__INST(hasGreyscales) = false; |
|
6168 |
__INST(monitorType) = @symbol(monochrome); |
|
6169 |
} |
|
6170 |
__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb); |
|
6171 |
__INST(redMask) = __MKSMALLINT(visual->red_mask); |
|
6172 |
__INST(greenMask) = __MKSMALLINT(visual->green_mask); |
|
6173 |
__INST(blueMask) = __MKSMALLINT(visual->blue_mask); |
|
6174 |
switch (visual->class) { |
|
6175 |
case TrueColor: |
|
6176 |
/* extract number of bits and shift counts */ |
|
6177 |
mask = visual->red_mask; |
|
6178 |
shift = 0; |
|
6179 |
while (mask && ((mask & 1) == 0)) { |
|
6180 |
mask >>= 1; |
|
6181 |
shift++; |
|
6182 |
} |
|
6183 |
__INST(redShift) = __MKSMALLINT(shift); |
|
6184 |
nBits = 0; |
|
6185 |
while (mask) { |
|
6186 |
mask >>= 1; |
|
6187 |
nBits++; |
|
6188 |
} |
|
6189 |
__INST(bitsRed) = __MKSMALLINT(nBits); |
|
6190 |
||
6191 |
mask = visual->green_mask; |
|
6192 |
shift = 0; |
|
6193 |
while (mask && ((mask & 1) == 0)) { |
|
6194 |
mask >>= 1; |
|
6195 |
shift++; |
|
6196 |
} |
|
6197 |
__INST(greenShift) = __MKSMALLINT(shift); |
|
6198 |
nBits = 0; |
|
6199 |
while (mask) { |
|
6200 |
mask >>= 1; |
|
6201 |
nBits++; |
|
6202 |
} |
|
6203 |
__INST(bitsGreen) = __MKSMALLINT(nBits); |
|
6204 |
||
6205 |
mask = visual->blue_mask; |
|
6206 |
shift = 0; |
|
6207 |
while (mask && ((mask & 1) == 0)) { |
|
6208 |
mask >>= 1; |
|
6209 |
shift++; |
|
6210 |
} |
|
6211 |
__INST(blueShift) = __MKSMALLINT(shift); |
|
6212 |
nBits = 0; |
|
6213 |
while (mask) { |
|
6214 |
mask >>= 1; |
|
6215 |
nBits++; |
|
6216 |
} |
|
6217 |
__INST(bitsBlue) = __MKSMALLINT(nBits); |
|
6218 |
break; |
|
6219 |
} |
|
295 | 6220 |
|
6221 |
#ifndef XA_PRIMARY |
|
850 | 6222 |
__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) ); |
295 | 6223 |
#else |
850 | 6224 |
__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY ); |
295 | 6225 |
#endif |
6226 |
#ifndef XA_SECONDARY |
|
850 | 6227 |
__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) ); |
295 | 6228 |
#else |
850 | 6229 |
__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY ); |
295 | 6230 |
#endif |
6231 |
#ifndef XA_CUT_BUFFER0 |
|
850 | 6232 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) ); |
295 | 6233 |
#else |
850 | 6234 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 ); |
295 | 6235 |
#endif |
6236 |
#ifndef XA_STRING |
|
850 | 6237 |
__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) ); |
295 | 6238 |
#else |
850 | 6239 |
__INST(stringAtom) = __MKATOMOBJ( XA_STRING ); |
295 | 6240 |
#endif |
6241 |
#ifndef XA_LENGTH |
|
850 | 6242 |
__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) ); |
295 | 6243 |
#else |
850 | 6244 |
__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH ); |
295 | 6245 |
#endif |
6246 |
||
850 | 6247 |
END_INTERRUPTSBLOCKED |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6248 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6249 |
%}. |
295 | 6250 |
! |
6251 |
||
6252 |
initializeSpecialFlags |
|
6253 |
"perform additional special server implementation flags" |
|
6254 |
||
6255 |
"/ |
|
6256 |
"/ assume we have it ... (should check) |
|
6257 |
"/ |
|
6258 |
hasSaveUnder := true. |
|
6259 |
ignoreBackingStore := false. |
|
6260 |
||
6261 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
6262 |
"/ |
|
6263 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
6264 |
"/ which does not correctly handle saveUnder |
|
6265 |
"/ |
|
6266 |
hasSaveUnder := false. |
|
6267 |
]. |
|
6268 |
! |
|
6269 |
||
6270 |
reinitialize |
|
6271 |
virtualRootId := rootId := nil. |
|
6272 |
super reinitialize. |
|
6273 |
dispatchingExpose := nil |
|
6274 |
! ! |
|
6275 |
||
6276 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
6277 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6278 |
altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6279 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6280 |
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
|
6281 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6282 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6283 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6284 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6285 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6286 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6287 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6288 |
|
341 | 6289 |
altModifierMask:aSmallInteger |
6290 |
"define which key takes the role of an alt-key. |
|
6291 |
By default, this is X's modifier1, which is the ALT key on |
|
6292 |
most keyboards. However, there may be exceptions to this, |
|
6293 |
and the setting can be changed with: |
|
6294 |
Display altModifierMask:(Display modifier2Mask) |
|
6295 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
|
6296 |
" |
|
6297 |
||
6298 |
altModifierMask := aSmallInteger |
|
6299 |
! |
|
6300 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6301 |
metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6302 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6303 |
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
|
6304 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6305 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6306 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6307 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6308 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6309 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6310 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6311 |
|
341 | 6312 |
metaModifierMask:aSmallInteger |
6313 |
"define which key takes the role of a meta key. |
|
6314 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
6315 |
most keyboards (if present at all). |
|
6316 |
However, there may be exceptions to this, and the setting can |
|
6317 |
be changed with: |
|
6318 |
Display metaModifierMask:(Display modifier1Mask) |
|
6319 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
|
6320 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
6321 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
6322 |
all the time. On those, you should disable the meta key by setting |
|
6323 |
the mask to 0. |
|
6324 |
" |
|
6325 |
||
6326 |
metaModifierMask := aSmallInteger |
|
6327 |
! |
|
6328 |
||
6329 |
modifier1Mask |
|
6330 |
"return the Xlib mask bit for the 1st modifier key. |
|
6331 |
See comment in altModifierMask: / metaModifierMask: for what |
|
6332 |
this could be used." |
|
6333 |
||
6334 |
%{ /* NOCONTEXT */ |
|
6335 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
6336 |
%} |
|
6337 |
! |
|
6338 |
||
6339 |
modifier2Mask |
|
6340 |
"return the Xlib mask bit for the 2nd modifier key. |
|
6341 |
See comment in altModifierMask: / metaModifierMask: for what |
|
6342 |
this could be used." |
|
6343 |
||
6344 |
%{ /* NOCONTEXT */ |
|
6345 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
6346 |
%} |
|
6347 |
! |
|
6348 |
||
6349 |
modifierMapping |
|
6350 |
"Get the Modifier Mapping. |
|
6351 |
We return an array of arrays of keycodes" |
|
6352 |
||
6353 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
6354 |
||
6355 |
%{ |
|
6356 |
Display *dpy = myDpy; |
|
6357 |
XModifierKeymap *modmap; |
|
6358 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
6359 |
||
6360 |
if (ISCONNECTED) { |
|
6361 |
if ((modmap = XGetModifierMapping(myDpy)) != 0) { |
|
6362 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
6363 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
|
6364 |
if (modifierKeyMap != nil) { |
|
6365 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
6366 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
|
6367 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
|
6368 |
} |
|
6369 |
XFreeModifiermap(modmap); |
|
6370 |
} |
|
6371 |
} |
|
6372 |
%}. |
|
6373 |
||
6374 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
6375 |
||
6376 |
ret := Array new:8. |
|
6377 |
nextKey := 1. |
|
6378 |
1 to:8 do:[ :i | |
|
6379 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
|
6380 |
|mod| |
|
6381 |
||
6382 |
mod := OrderedCollection new:maxKeyPerMod. |
|
6383 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
6384 |
key ~= 0 ifTrue:[ |
|
6385 |
mod add:key |
|
6386 |
]. |
|
6387 |
]. |
|
6388 |
ret at:i put:mod. |
|
6389 |
]. |
|
6390 |
nextKey := nextKey+maxKeyPerMod. |
|
6391 |
]. |
|
6392 |
||
6393 |
^ ret |
|
6394 |
||
6395 |
" |
|
6396 |
Display modifierMapping |
|
6397 |
" |
|
6398 |
! |
|
6399 |
||
6400 |
stringFromKeycode:code |
|
6401 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
|
6402 |
||
6403 |
|str| |
|
6404 |
||
6405 |
%{ |
|
6406 |
Display *dpy = myDpy; |
|
6407 |
KeySym keysym; |
|
6408 |
char *keystring; |
|
6409 |
||
6410 |
if (ISCONNECTED && __isSmallInteger(code)) { |
|
6411 |
if ((keysym = XKeycodeToKeysym(myDpy, __intVal(code), 0)) != NoSymbol && |
|
6412 |
(keystring = XKeysymToString(keysym)) != 0) |
|
6413 |
str = __MKSTRING(keystring); |
|
6414 |
} |
|
6415 |
%}. |
|
6416 |
^ str |
|
6417 |
||
6418 |
" |
|
6419 |
Display stringFromKeycode:28 |
|
6420 |
" |
|
6421 |
! |
|
6422 |
||
295 | 6423 |
translateKey:untranslatedKey |
6424 |
"Return the key translated via the translation table. |
|
6425 |
Here, we preTranslate the key into a common ST/X symbolic name, |
|
6426 |
which gets further processed in the superclasses translation method." |
|
6427 |
||
6428 |
|key| |
|
6429 |
||
6430 |
(key := untranslatedKey) isString ifTrue:[ |
|
6431 |
key := RawKeysymTranslation at:key ifAbsent:key. |
|
6432 |
key := key asSymbol. |
|
6433 |
]. |
|
6434 |
^ super translateKey:key |
|
6435 |
! ! |
|
6436 |
||
6437 |
!XWorkstation methodsFor:'misc'! |
|
6438 |
||
6439 |
beep |
|
6440 |
"output an audible beep or bell" |
|
6441 |
||
6442 |
self beep:50 |
|
6443 |
! |
|
6444 |
||
6445 |
beep:volumeInPercent |
|
6446 |
"output an audible beep" |
|
6447 |
%{ |
|
6448 |
int volume; |
|
6449 |
||
6450 |
if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
|
6451 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
|
555 | 6452 |
volume = __intVal(volumeInPercent) * 2 - 100; |
295 | 6453 |
if (volume < -100) volume = -100; |
6454 |
else if (volume > 100) volume = 100; |
|
6455 |
BEGIN_INTERRUPTSBLOCKED |
|
6456 |
XBell(myDpy, volume); |
|
6457 |
END_INTERRUPTSBLOCKED |
|
6458 |
} |
|
6459 |
%} |
|
6460 |
! |
|
6461 |
||
6462 |
buffered |
|
6463 |
"buffer drawing - do not send it immediately to the display. |
|
374 | 6464 |
This is the default anyway. |
6465 |
See #unBuffered for additional info." |
|
295 | 6466 |
|
6467 |
%{ /* NOCONTEXT */ |
|
6468 |
||
6469 |
if (ISCONNECTED) { |
|
6470 |
BEGIN_INTERRUPTSBLOCKED |
|
6471 |
XSynchronize(myDpy, 0); |
|
6472 |
END_INTERRUPTSBLOCKED |
|
6473 |
} |
|
6474 |
%} |
|
374 | 6475 |
" |
6476 |
Display buffered |
|
6477 |
" |
|
295 | 6478 |
! |
6479 |
||
6480 |
flush |
|
6481 |
"send all buffered drawing to the display. |
|
6482 |
This may be required to make certain, that all previous operations |
|
6483 |
are really sent to the display before continuing. For example, |
|
6484 |
after a cursor-change with a followup long computation. |
|
374 | 6485 |
(otherwise, the cursor change request may still be in the output buffer) |
6486 |
See also #sync, which even waits until the request has been processed." |
|
295 | 6487 |
|
6488 |
%{ /* NOCONTEXT */ |
|
6489 |
||
6490 |
if (ISCONNECTED) { |
|
6491 |
BEGIN_INTERRUPTSBLOCKED |
|
310 | 6492 |
XFlush(myDpy); |
6493 |
END_INTERRUPTSBLOCKED |
|
6494 |
} |
|
6495 |
%} |
|
6496 |
! |
|
6497 |
||
295 | 6498 |
flushDpsContext:aDPSContext |
6499 |
||
6500 |
%{ /* NOCONTEXT */ |
|
6501 |
#ifdef DPS |
|
6502 |
if (__isExternalAddress(aDPSContext)) { |
|
6503 |
BEGIN_INTERRUPTSBLOCKED |
|
6504 |
DPSFlushContext(MKDPSCONTEXT(aDPSContext)); |
|
6505 |
END_INTERRUPTSBLOCKED |
|
6506 |
RETURN ( self ); |
|
6507 |
} |
|
6508 |
#endif |
|
374 | 6509 |
%}. |
295 | 6510 |
self primitiveFailed |
6511 |
! |
|
6512 |
||
6513 |
refreshKeyboardMapping:eB |
|
6514 |
%{ |
|
6515 |
XMappingEvent *ev; |
|
6516 |
||
6517 |
if (__isByteArray(eB)) { |
|
555 | 6518 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 6519 |
XRefreshKeyboardMapping(ev); |
6520 |
} |
|
6521 |
%} |
|
6522 |
! |
|
6523 |
||
6524 |
setInputFocusTo:aWindowId |
|
6525 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
|
6526 |
self setInputFocusTo:aWindowId revertTo:#root |
|
6527 |
! |
|
6528 |
||
6529 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
|
6530 |
"set the focus to the view as defined by aWindowId. |
|
6531 |
Passing nil set the focus to no window and lets the display discard all |
|
6532 |
input until a new focus is set. |
|
6533 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
6534 |
passing one of #parent, #root or nil specifies that the focus should be |
|
6535 |
given to the parent view, the root view or no view." |
|
6536 |
||
6537 |
%{ /* NOCONTEXT */ |
|
6538 |
int arg; |
|
6539 |
Window focusWindow; |
|
6540 |
||
6541 |
if (ISCONNECTED) { |
|
6542 |
if (__isExternalAddress(aWindowId)) { |
|
6543 |
focusWindow = _WindowVal(aWindowId); |
|
6544 |
} else { |
|
6545 |
focusWindow = None; |
|
6546 |
} |
|
6547 |
if (revertSymbol == @symbol(parent)) |
|
6548 |
arg = RevertToParent; |
|
6549 |
else if (revertSymbol == @symbol(root)) |
|
6550 |
arg = RevertToPointerRoot; |
|
6551 |
else |
|
6552 |
arg = RevertToNone; |
|
6553 |
||
6554 |
BEGIN_INTERRUPTSBLOCKED |
|
6555 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
|
6556 |
END_INTERRUPTSBLOCKED |
|
6557 |
RETURN ( self ); |
|
6558 |
} |
|
6559 |
%}. |
|
6560 |
self primitiveFailed |
|
6561 |
! |
|
6562 |
||
341 | 6563 |
sync |
6564 |
"send all buffered drawing to the display AND wait until the display |
|
6565 |
has finished drawing it. |
|
6566 |
This is almost never needed, except if you are about to read previously |
|
374 | 6567 |
drawn pixels back from the display screen, or you want to wait for a beep |
6568 |
to be finished. See also #flush." |
|
341 | 6569 |
|
6570 |
%{ /* NOCONTEXT */ |
|
6571 |
||
6572 |
if (ISCONNECTED) { |
|
6573 |
BEGIN_INTERRUPTSBLOCKED |
|
6574 |
XSync(myDpy, 0); |
|
6575 |
END_INTERRUPTSBLOCKED |
|
6576 |
} |
|
6577 |
%} |
|
6578 |
! |
|
6579 |
||
295 | 6580 |
unBuffered |
374 | 6581 |
"make all drawing be sent immediately to the display. |
6582 |
This makes all graphics synchronous and turns off any buffering |
|
6583 |
(i.e. each individual draw-request is sent immediately without |
|
6584 |
packing multiple requests into a larger message buffer). |
|
6585 |
Be prepared, that this slows down graphics considerably. |
|
6586 |
However, it allows display errors to be handled immediately and |
|
6587 |
may be useful if you get Xdisplay errors and want to find the request |
|
6588 |
which was responsiblefor it. See also #buffered." |
|
295 | 6589 |
|
6590 |
%{ /* NOCONTEXT */ |
|
6591 |
||
6592 |
if (ISCONNECTED) { |
|
6593 |
BEGIN_INTERRUPTSBLOCKED |
|
6594 |
XSynchronize(myDpy, 1); |
|
6595 |
END_INTERRUPTSBLOCKED |
|
6596 |
} |
|
6597 |
%} |
|
6598 |
"Display unbuffered" |
|
6599 |
! ! |
|
6600 |
||
6601 |
!XWorkstation methodsFor:'pointer queries '! |
|
6602 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6603 |
anyButtonStateMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6604 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6605 |
buttonStates value." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6606 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6607 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6608 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6609 |
^ 256 + 512 + 1024 |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6610 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6611 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6612 |
"Created: 23.3.1996 / 12:46:35 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6613 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6614 |
|
295 | 6615 |
buttonStates |
6616 |
"return an integer representing the state of the pointer buttons; |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6617 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6618 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6619 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 6620 |
|
6621 |
%{ /* NOCONTEXT*/ |
|
6622 |
Display *dpy = myDpy; |
|
6623 |
Window w; |
|
555 | 6624 |
int screen = __intVal(__INST(screen)); |
295 | 6625 |
Window rootRet, childRet; |
6626 |
int rootX, rootY, winX, winY; |
|
6627 |
unsigned int mask; |
|
6628 |
||
6629 |
BEGIN_INTERRUPTSBLOCKED |
|
6630 |
#ifdef VIRTUAL_ROOT |
|
6631 |
w = getRootWindow(myDpy, screen); |
|
6632 |
#else |
|
6633 |
w = RootWindow(dpy, screen); |
|
6634 |
#endif |
|
6635 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
|
850 | 6636 |
&rootX, &rootY, |
6637 |
&winX, &winY, |
|
6638 |
&mask); |
|
295 | 6639 |
END_INTERRUPTSBLOCKED |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6640 |
RETURN (__MKSMALLINT(mask)); |
295 | 6641 |
%} |
540
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 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6644 |
Display buttonStates |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6645 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6646 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6647 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6648 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6649 |
Display buttonStates bitTest:(Display controlMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6650 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6651 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6652 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6653 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6654 |
Display buttonStates bitTest:(Display altModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6655 |
Display buttonStates bitTest:(Display metaModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6656 |
" |
295 | 6657 |
! |
6658 |
||
6659 |
leftButtonStateMask |
|
6660 |
"return an integer for masking out the left button from a |
|
6661 |
buttonStates value" |
|
6662 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6663 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6664 |
|
295 | 6665 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6666 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6667 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 6668 |
! |
6669 |
||
6670 |
middleButtonStateMask |
|
6671 |
"return an integer for masking out the middle button from a |
|
6672 |
buttonStates value" |
|
6673 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6674 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6675 |
|
295 | 6676 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6677 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6678 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 6679 |
! |
6680 |
||
6681 |
pointerPosition |
|
6682 |
"return the current pointer position in root-window coordinates" |
|
6683 |
||
6684 |
|xpos ypos| |
|
6685 |
||
6686 |
%{ |
|
6687 |
Display *dpy = myDpy; |
|
6688 |
Window w; |
|
555 | 6689 |
int screen = __intVal(__INST(screen)); |
295 | 6690 |
Window rootRet, childRet; |
6691 |
int rootX, rootY, winX, winY; |
|
6692 |
unsigned int mask; |
|
6693 |
||
6694 |
BEGIN_INTERRUPTSBLOCKED |
|
6695 |
#ifdef VIRTUAL_ROOT |
|
6696 |
w = getRootWindow(myDpy, screen); |
|
6697 |
#else |
|
6698 |
w = RootWindow(dpy, screen); |
|
6699 |
#endif |
|
6700 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
|
6701 |
&rootX, &rootY, |
|
6702 |
&winX, &winY, |
|
6703 |
&mask); |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6704 |
xpos = __MKSMALLINT(rootX); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6705 |
ypos = __MKSMALLINT(rootY); |
295 | 6706 |
END_INTERRUPTSBLOCKED |
6707 |
%} |
|
6708 |
. |
|
6709 |
^ xpos @ ypos |
|
6710 |
! |
|
6711 |
||
6712 |
rightButtonStateMask |
|
6713 |
"return an integer for masking out the right button from a |
|
6714 |
buttonStates value" |
|
6715 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6716 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6717 |
|
295 | 6718 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6719 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6720 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 6721 |
! |
6722 |
||
6723 |
rootPositionOfLastEvent |
|
6724 |
"return the position in root-window coordinates |
|
6725 |
of the last button, key or pointer event" |
|
6726 |
||
6727 |
^ eventRootX @ eventRootY |
|
6728 |
! ! |
|
6729 |
||
6730 |
!XWorkstation methodsFor:'resources'! |
|
6731 |
||
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6732 |
atomIDOf:aStringOrSymbol |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6733 |
"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
|
6734 |
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
|
6735 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6736 |
^ self atomIDOf:aStringOrSymbol create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6737 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6738 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6739 |
Display atomIDOf:'FACE_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6740 |
Display atomIDOf:'FULL_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6741 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6742 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6743 |
"Modified: 2.3.1996 / 15:09:29 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6744 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6745 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6746 |
atomIDOf:aStringOrSymbol create:create |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6747 |
"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
|
6748 |
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
|
6749 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6750 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6751 |
Atom prop; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6752 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6753 |
if (ISCONNECTED) { |
850 | 6754 |
if (__isString(aStringOrSymbol) |
6755 |
|| __isSymbol(aStringOrSymbol)) { |
|
6756 |
prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), |
|
6757 |
(create == true) ? False : True); |
|
6758 |
if (prop == None) { |
|
6759 |
RETURN (nil); |
|
6760 |
} |
|
6761 |
RETURN ( __MKATOMOBJ(prop) ); |
|
6762 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6763 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6764 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6765 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6766 |
^ nil |
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 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6769 |
Display atomIDOf:'VT_SELECTION' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6770 |
Display atomIDOf:'CUT_BUFFER0' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6771 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6772 |
Display atomIDOf:'PRIMARY' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6773 |
Display atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6774 |
" |
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 |
atomIDOfCUTBUFFER0 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6778 |
"return the CUTBUFFER0 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 |
^ cutBuffer0Atom |
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:36 / 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 |
atomIDOfLENGTH |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6787 |
"return the LENGTH 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 |
^ lengthAtom |
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:41 / 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 |
atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6796 |
"return the PRIMARY 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 |
^ primaryAtom |
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:49 / 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 |
atomIDOfSECONDARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6805 |
"return the SECONDARY 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 |
^ secondaryAtom |
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:10:59 / 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 |
atomIDOfSTRING |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6814 |
"return the STRING AtomID. |
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 |
^ stringAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6818 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6819 |
"Modified: 2.3.1996 / 15:11:08 / cg" |
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 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6822 |
atomName:anAtomID |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6823 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6824 |
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
|
6825 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6826 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6827 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6828 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6829 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6830 |
if (ISCONNECTED) { |
850 | 6831 |
if (__isAtomID(anAtomID)) { |
6832 |
name = XGetAtomName(myDpy, _AtomVal(anAtomID)); |
|
6833 |
if (name == 0) { |
|
6834 |
RETURN (nil); |
|
6835 |
} |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
6836 |
str = __MKSTRING(name); |
850 | 6837 |
XFree(name); |
6838 |
RETURN ( str ); |
|
6839 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6840 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6841 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6842 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6843 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6844 |
|
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 |
Display atomName:1 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6847 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6848 |
Display atomName:132 'FONTNAME_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6849 |
Display atomName:135 'FOUNDRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6850 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6851 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6852 |
Display atomName:152 'CHARSET_ENCODING' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6853 |
Display atomName:154 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6854 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6855 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6856 |
|
295 | 6857 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6858 |
"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
|
6859 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6860 |
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
|
6861 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6862 |
Notice: |
850 | 6863 |
we do not plan to use X's resources for ST/X's defaults, |
6864 |
styles or resources. This would make porting of applications |
|
6865 |
to different platforms much more difficult (Windows has no resource |
|
6866 |
database). If you stay within ST/X's resource files, these can be |
|
6867 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6868 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6869 |
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
|
6870 |
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
|
6871 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6872 |
|
295 | 6873 |
%{ |
6874 |
char *rslt; |
|
6875 |
||
6876 |
if ((__isString(name) || __isSymbol(name)) |
|
6877 |
&& (__isString(cls) || __isSymbol(cls)) |
|
6878 |
&& ISCONNECTED) { |
|
850 | 6879 |
BEGIN_INTERRUPTSBLOCKED |
6880 |
rslt = XGetDefault(myDpy, (char *)_stringVal(cls), |
|
6881 |
(char *)_stringVal(name)); |
|
6882 |
END_INTERRUPTSBLOCKED |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
6883 |
RETURN (rslt ? __MKSTRING(rslt) : nil ); |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6884 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6885 |
%}. |
295 | 6886 |
self primitiveFailed. |
6887 |
^ nil |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6888 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6889 |
"if your ~/.Xdefaults contains an entry such as: |
850 | 6890 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6891 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6892 |
|
850 | 6893 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6894 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6895 |
if your ~/.Xdefaults contains an entry such as: |
850 | 6896 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6897 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6898 |
|
850 | 6899 |
Display getResource:'beNiceToColormap' class:'any' |
6900 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6901 |
" |
295 | 6902 |
! ! |
6903 |
||
6904 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
6905 |
||
6906 |
getBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
|
6907 |
"get bits from a drawable into the imageBits. The storage for the bits |
|
6908 |
must be big enough for the data to fit. If ok, returns an array with some |
|
6909 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
6910 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
6911 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
6912 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6913 |
|rawInfo info| |
295 | 6914 |
|
6915 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
6916 |
self primitiveFailed. |
|
6917 |
^ nil |
|
6918 |
]. |
|
6919 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6920 |
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
|
6921 |
"1 -> bit order" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6922 |
"2 -> depth" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6923 |
"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
|
6924 |
"4 -> byte_order" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6925 |
"5 -> format" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6926 |
"6 -> bitmap_unit" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6927 |
"7 -> bitmap_pad" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6928 |
"8 -> bits_per_pixel" |
295 | 6929 |
|
6930 |
"/ had to extract the getPixel call into a separate method, to specify |
|
6931 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
6932 |
"/ of temporary stack space |
|
6933 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6934 |
(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
|
6935 |
info := IdentityDictionary new. |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6936 |
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
|
6937 |
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
|
6938 |
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
|
6939 |
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
|
6940 |
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
|
6941 |
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
|
6942 |
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
|
6943 |
info at:#bitsPerPixel put:(rawInfo at:8). |
295 | 6944 |
^ info |
6945 |
]. |
|
6946 |
" |
|
6947 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
6948 |
or is too small to hold the bits |
|
6949 |
" |
|
6950 |
^ self primitiveFailed |
|
6951 |
! |
|
6952 |
||
6953 |
getPixelX:x y:y from:aDrawableId |
|
790
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
6954 |
"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
|
6955 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 6956 |
|
6957 |
%{ /* UNLIMITEDSTACK NOCONTEXT */ |
|
6958 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6959 |
Window win; |
295 | 6960 |
XImage *img; |
6961 |
int ret; |
|
6962 |
int xpos, ypos; |
|
6963 |
||
6964 |
if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
850 | 6965 |
win = _WindowVal(aDrawableId); |
6966 |
xpos = __intVal(x); |
|
6967 |
ypos = __intVal(y); |
|
6968 |
if ((xpos < 0) || (ypos < 0)) { |
|
6969 |
RETURN ( __MKSMALLINT(0) ); |
|
6970 |
} |
|
6971 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
|
6972 |
if (img != 0) { |
|
6973 |
ret = XGetPixel(img, 0, 0); |
|
6974 |
XDestroyImage(img); |
|
6975 |
RETURN ( __MKSMALLINT(ret) ); |
|
6976 |
} |
|
295 | 6977 |
} |
6978 |
%}. |
|
6979 |
^ nil |
|
6980 |
! |
|
6981 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6982 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
295 | 6983 |
"since XGetImage may allocate huge amount of stack space |
6984 |
(some implementations use alloca), this must run with unlimited stack." |
|
6985 |
||
6986 |
%{ /* UNLIMITEDSTACK */ |
|
6987 |
||
6988 |
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
|
6989 |
Window win; |
295 | 6990 |
XImage *image = (XImage *)0; |
6991 |
int pad, bytes_per_line, numBytes; |
|
6992 |
||
6993 |
if (__isExternalAddress(aDrawableId) |
|
6994 |
&& __bothSmallInteger(srcx, srcy) |
|
6995 |
&& __bothSmallInteger(w, h) |
|
6996 |
&& __isArray(info) |
|
6997 |
&& __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
|
6998 |
win = _WindowVal(aDrawableId); |
555 | 6999 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
7000 |
__intVal(w), __intVal(h), |
|
295 | 7001 |
(unsigned)AllPlanes, ZPixmap); |
7002 |
||
378 | 7003 |
if (! image) { |
7004 |
RETURN ( false ); |
|
7005 |
} |
|
7006 |
||
295 | 7007 |
pad = image->bitmap_pad; |
7008 |
#ifdef SUPERDEBUG |
|
7009 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
|
7010 |
#endif |
|
7011 |
switch (image->depth) { |
|
7012 |
case 1: |
|
7013 |
case 2: |
|
7014 |
case 4: |
|
7015 |
case 8: |
|
7016 |
case 16: |
|
7017 |
case 24: |
|
7018 |
case 32: |
|
7019 |
numBytes = image->bytes_per_line * image->height; |
|
7020 |
break; |
|
7021 |
default: |
|
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7022 |
/* unsupported depth ? */ |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7023 |
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
|
7024 |
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
|
7025 |
break; |
295 | 7026 |
} |
7027 |
||
7028 |
#ifdef SUPERDEBUG |
|
555 | 7029 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 7030 |
#endif |
7031 |
||
555 | 7032 |
if (numBytes > __byteArraySize(imageBits)) { |
295 | 7033 |
/* imageBits too small */ |
378 | 7034 |
printf("provided byteArray too small\n"); |
295 | 7035 |
goto fail; |
7036 |
} |
|
7037 |
if (image->bitmap_bit_order == MSBFirst) |
|
555 | 7038 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
295 | 7039 |
else |
555 | 7040 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
7041 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
7042 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
295 | 7043 |
if (image->byte_order == MSBFirst) |
555 | 7044 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
295 | 7045 |
else |
555 | 7046 |
__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
|
7047 |
if (image->format == XYBitmap) |
555 | 7048 |
__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
|
7049 |
else if (image->format == XYPixmap) |
555 | 7050 |
__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
|
7051 |
else if (image->format == ZPixmap) |
555 | 7052 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7053 |
|
555 | 7054 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
7055 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
7056 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
7057 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
295 | 7058 |
XDestroyImage(image); |
7059 |
RETURN ( true ); |
|
7060 |
} |
|
7061 |
fail: |
|
7062 |
if (image) { |
|
7063 |
XDestroyImage(image); |
|
7064 |
} |
|
7065 |
%}. |
|
7066 |
^ false |
|
7067 |
! ! |
|
7068 |
||
7069 |
!XWorkstation methodsFor:'selections'! |
|
7070 |
||
7071 |
getObjectProperty:propertyID from:aWindowID |
|
7072 |
"get an object property; return object or nil" |
|
7073 |
||
7074 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
7075 |
type == stringAtom ifTrue:[ |
|
7076 |
^ value |
|
7077 |
]. |
|
7078 |
(value isMemberOf:ByteArray) ifTrue:[ |
|
7079 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
|
7080 |
] |
|
7081 |
]. |
|
7082 |
^ nil |
|
7083 |
! |
|
7084 |
||
7085 |
getProperty:propertyID from:aWindowID into:aTwoArgBlock |
|
7086 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
|
7087 |
||
7088 |
|val typeID cls| |
|
7089 |
||
7090 |
cls := ByteArray. |
|
7091 |
%{ |
|
7092 |
Display *dpy = myDpy; |
|
7093 |
Window window; |
|
7094 |
Atom property; |
|
7095 |
char *cp, *cp2; |
|
7096 |
Atom actual_type; |
|
7097 |
int actual_format,i; |
|
7098 |
unsigned long nitems, bytes_after, nread; |
|
7099 |
unsigned char *data; |
|
7100 |
int ok = 1; |
|
7101 |
# define PROP_SIZE 2048 |
|
7102 |
||
7103 |
if (__isAtomID(propertyID)) { |
|
7104 |
property = _AtomVal(propertyID); |
|
7105 |
if (__isExternalAddress(aWindowID)) { |
|
7106 |
window = _WindowVal(aWindowID); |
|
7107 |
} else { |
|
7108 |
window = DefaultRootWindow(dpy); |
|
7109 |
} |
|
7110 |
||
7111 |
nread = 0; |
|
7112 |
cp = 0; |
|
7113 |
/* |
|
7114 |
fprintf(stderr, "getProperty: "); |
|
7115 |
*/ |
|
7116 |
do { |
|
7117 |
if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False, |
|
7118 |
AnyPropertyType,&actual_type,&actual_format, |
|
7119 |
&nitems,&bytes_after,(unsigned char **)&data) |
|
7120 |
!= Success) { |
|
7121 |
ok = 0; |
|
7122 |
break; |
|
7123 |
} |
|
7124 |
typeID = __MKATOMOBJ(actual_type); |
|
7125 |
if (! cp) { |
|
7126 |
cp = cp2 = (char *)malloc(nitems+1); |
|
7127 |
} else { |
|
7128 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
7129 |
cp2 = cp + nread; |
|
7130 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7131 |
if (! cp) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
7132 |
XFree(data); |
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7133 |
goto fail; |
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7134 |
} |
295 | 7135 |
|
7136 |
nread += nitems; |
|
7137 |
bcopy(data, cp2, nitems); |
|
7138 |
XFree(data); |
|
7139 |
/* |
|
7140 |
fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after); |
|
7141 |
*/ |
|
7142 |
} while (bytes_after > 0); |
|
7143 |
/* |
|
7144 |
fprintf(stderr, "\n"); |
|
7145 |
*/ |
|
7146 |
||
7147 |
if (ok) { |
|
7148 |
if (actual_type == XA_STRING) { |
|
7149 |
cp[nread] = '\0'; |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
7150 |
val = __MKSTRING_L(cp, nread); |
295 | 7151 |
} else { |
7152 |
val = __new(nread + OHDR_SIZE); |
|
7153 |
val->o_class = cls; |
|
555 | 7154 |
bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread); |
295 | 7155 |
} |
7156 |
} |
|
7157 |
if (cp) |
|
7158 |
free(cp); |
|
7159 |
} |
|
7160 |
fail: ; |
|
7161 |
%}. |
|
7162 |
typeID isNil ifTrue:[ |
|
7163 |
^ false |
|
7164 |
]. |
|
7165 |
aTwoArgBlock value:typeID value:val. |
|
7166 |
^ true |
|
7167 |
! |
|
7168 |
||
7169 |
getSelectionFor:drawableId |
|
7170 |
"get the object selection - either immediate, or asynchronous. |
|
7171 |
Returns nil, if async request is on its way" |
|
7172 |
||
7173 |
|selProp sel| |
|
7174 |
||
7175 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
7176 |
"no primary selection - use cut buffer" |
|
7177 |
sel := self getObjectProperty:cutBuffer0Atom from:nil. |
|
7178 |
^ sel |
|
7179 |
]. |
|
7180 |
selProp := self atomIDOf:'ST_SELECTION' create:true. |
|
7181 |
self requestObjectSelection:primaryAtom property:selProp for:drawableId. |
|
7182 |
^ nil |
|
7183 |
! |
|
7184 |
||
7185 |
getSelectionOwnerOf:selectionAtomID |
|
7186 |
"get the owner of a selection" |
|
7187 |
||
7188 |
%{ /* NOCONTEXT */ |
|
7189 |
Display *dpy = myDpy; |
|
7190 |
Atom selection; |
|
7191 |
Window window; |
|
7192 |
||
7193 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
|
7194 |
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); |
|
7195 |
RETURN ((window == None) ? nil : __MKOBJ(window)); |
|
7196 |
} |
|
7197 |
%}. |
|
7198 |
self primitiveFailed. |
|
7199 |
^ nil |
|
7200 |
! |
|
7201 |
||
7202 |
getTextProperty:propertyID from:aWindowID |
|
7203 |
"get a text property; return string or nil" |
|
7204 |
||
7205 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
7206 |
type == stringAtom ifTrue:[ |
|
7207 |
^ value |
|
7208 |
] |
|
7209 |
]. |
|
7210 |
^ nil |
|
7211 |
! |
|
7212 |
||
7213 |
getTextSelectionFor:drawableId |
|
7214 |
"get the text selection - either immediate, or asynchronous. |
|
7215 |
Returns nil, if async request is on its way" |
|
7216 |
||
7217 |
|selProp sel| |
|
7218 |
||
7219 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
7220 |
"no primary selection - use cut buffer" |
|
7221 |
sel := self getTextProperty:cutBuffer0Atom from:nil. |
|
7222 |
^ sel |
|
7223 |
]. |
|
7224 |
selProp := self atomIDOf:'VT_SELECTION' create:true. |
|
7225 |
self requestTextSelection:primaryAtom property:selProp for:drawableId. |
|
7226 |
^ nil |
|
7227 |
! |
|
7228 |
||
7229 |
requestObjectSelection:selectionID property:propertyID for:aWindowId |
|
7230 |
"ask the server to send us the selection - the view with ID aWindowID |
|
7231 |
will later receive a SelectionNotify event for it." |
|
7232 |
||
7233 |
^ self requestSelection:selectionID |
|
7234 |
property:propertyID |
|
7235 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
7236 |
for:aWindowId |
|
7237 |
! |
|
7238 |
||
7239 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
|
7240 |
"ask the server to send us the selection - the view with id aWindowID |
|
7241 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
7242 |
with the selections value)." |
|
7243 |
||
7244 |
%{ /* NOCONTEXT */ |
|
7245 |
Display *dpy = myDpy; |
|
7246 |
Atom sel_prop; |
|
7247 |
char *cp; |
|
7248 |
||
7249 |
if (__isExternalAddress(aWindowId) |
|
7250 |
&& ISCONNECTED |
|
7251 |
&& __isSmallInteger(typeID) |
|
7252 |
&& __isAtomID(selectionID)) { |
|
7253 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
|
7254 |
/* |
|
7255 |
* no owner of primary selection |
|
7256 |
*/ |
|
7257 |
RETURN (false); |
|
7258 |
} |
|
7259 |
/* |
|
7260 |
* PRIMARY selection |
|
7261 |
*/ |
|
7262 |
XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), |
|
7263 |
_AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); |
|
7264 |
RETURN (true); |
|
7265 |
} |
|
7266 |
%}. |
|
7267 |
self primitiveFailed. |
|
7268 |
^ false |
|
7269 |
||
7270 |
" |
|
7271 |
Display requestSelection:(Display atomIDOf:'PRIMARY') |
|
7272 |
property:(Display atomIDOf:'VT_SELECTION') |
|
7273 |
for:0 |
|
7274 |
" |
|
7275 |
! |
|
7276 |
||
7277 |
requestTextSelection:selectionID property:propertyID for:aWindowId |
|
7278 |
"ask the server to send us the selection - the view with ID aWindowID |
|
7279 |
will later receive a SelectionNotify event for it." |
|
7280 |
||
7281 |
^ self requestSelection:selectionID |
|
7282 |
property:propertyID |
|
7283 |
type:stringAtom |
|
7284 |
for:aWindowId |
|
7285 |
! |
|
7286 |
||
7287 |
sendSelection:something property:propertyID target:targetID from:windowID to:requestorID |
|
7288 |
"send aString back from a SelectionRequest" |
|
7289 |
||
7290 |
self |
|
7291 |
sendSelection:something |
|
7292 |
selection:primaryAtom |
|
7293 |
property:propertyID |
|
7294 |
target:targetID |
|
7295 |
from:windowID |
|
7296 |
to:requestorID |
|
7297 |
! |
|
7298 |
||
7299 |
sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
7300 |
"send aString back from a SelectionRequest" |
|
7301 |
||
7302 |
self |
|
7303 |
setProperty:propertyID |
|
7304 |
type:targetID |
|
7305 |
value:something |
|
7306 |
for:requestorID. |
|
7307 |
self |
|
7308 |
sendSelectionNotifySelection:selectionID |
|
7309 |
property:propertyID |
|
7310 |
target:targetID |
|
7311 |
from:requestorID |
|
7312 |
to:requestorID. |
|
7313 |
! |
|
7314 |
||
7315 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
7316 |
"send a selectionNotify back from a SelectionRequest" |
|
7317 |
||
7318 |
%{ /* NOCONTEXT */ |
|
7319 |
Display *dpy = myDpy; |
|
7320 |
||
7321 |
if (__isAtomID(propertyID) |
|
7322 |
&& __isExternalAddress(requestorID) |
|
7323 |
&& ISCONNECTED |
|
7324 |
&& __isAtomID(targetID) |
|
7325 |
&& __isAtomID(selectionID)) { |
|
7326 |
XEvent ev; |
|
7327 |
Window requestor = _WindowVal(requestorID); |
|
7328 |
Atom property = _AtomVal(propertyID); |
|
7329 |
Atom target = _AtomVal(targetID); |
|
7330 |
Atom selection = _AtomVal(selectionID); |
|
7331 |
Status result; |
|
7332 |
||
7333 |
ev.xselection.type = SelectionNotify; |
|
7334 |
ev.xselection.selection = selection; |
|
7335 |
ev.xselection.target = target; |
|
7336 |
if (__isExternalAddress(windowID)) |
|
7337 |
ev.xselection.requestor = _WindowVal(windowID); |
|
7338 |
else |
|
7339 |
ev.xselection.requestor = DefaultRootWindow(dpy); |
|
7340 |
ev.xselection.time = CurrentTime; |
|
7341 |
if (property == None) |
|
7342 |
ev.xselection.property = target; |
|
7343 |
else |
|
7344 |
ev.xselection.property = property; |
|
7345 |
||
7346 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
|
7347 |
ev.xselection.selection, |
|
7348 |
ev.xselection.property, |
|
7349 |
ev.xselection.target, |
|
7350 |
ev.xselection.requestor, |
|
7351 |
requestor)); |
|
7352 |
||
7353 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
|
7354 |
if ((result == BadValue) || (result == BadWindow)) { |
|
7355 |
DPRINTF(("bad status\n")); |
|
382 | 7356 |
RETURN (false); |
295 | 7357 |
} |
382 | 7358 |
RETURN (true) |
7359 |
} |
|
7360 |
%}. |
|
7361 |
self primitiveFailed. |
|
7362 |
^ false |
|
295 | 7363 |
! |
7364 |
||
7365 |
setLengthProperty:propertyID value:aNumber for:aWindowID |
|
7366 |
^ self setProperty:propertyID type:(self atomIDOfLENGTH) value:aNumber for:aWindowID |
|
7367 |
! |
|
7368 |
||
7369 |
setObjectProperty:propertyID value:anObject for:aWindowID |
|
7370 |
|s| |
|
7371 |
||
7372 |
(anObject isMemberOf:String) ifTrue:[ |
|
7373 |
^ self setTextProperty:propertyID value:anObject for:aWindowID |
|
7374 |
]. |
|
7375 |
s := WriteStream on:(ByteArray new:200). |
|
7376 |
anObject storeBinaryOn:s. |
|
7377 |
^ self |
|
7378 |
setProperty:propertyID |
|
7379 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
7380 |
value:(s contents) |
|
7381 |
for:aWindowID |
|
7382 |
! |
|
7383 |
||
7384 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
|
7385 |
||
7386 |
%{ /* UNLIMITEDSTACK */ |
|
7387 |
||
7388 |
Display *dpy = myDpy; |
|
7389 |
Atom prop, type; |
|
7390 |
Window window; |
|
7391 |
unsigned int value; |
|
7392 |
||
7393 |
if (__isAtomID(propertyID) |
|
7394 |
&& __isAtomID(typeID) |
|
7395 |
&& ISCONNECTED |
|
7396 |
&& (__isString(anObject) |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7397 |
|| __isSmallInteger(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7398 |
|| __isSymbol(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7399 |
|| __isByteArray(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7400 |
|| __isWords(anObject))) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7401 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7402 |
prop = _AtomVal(propertyID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7403 |
type = _AtomVal(typeID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7404 |
if (__isExternalAddress(aWindowID)) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7405 |
window = _WindowVal(aWindowID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7406 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7407 |
window = DefaultRootWindow(dpy); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7408 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7409 |
if (__isSmallInteger(anObject)) { |
555 | 7410 |
value = __intVal(anObject); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7411 |
XChangeProperty(dpy, window, prop, type, 32, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7412 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7413 |
(unsigned char *)(&value), sizeof(unsigned int)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7414 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7415 |
if (__isByteArray(anObject)) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7416 |
XChangeProperty(dpy, window, prop, type, 8, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7417 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7418 |
__ByteArrayInstPtr(anObject)->ba_element, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7419 |
__byteArraySize(anObject)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7420 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7421 |
/* 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
|
7422 |
if (__isWords(__qClass(anObject))) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7423 |
XChangeProperty(dpy, window, prop, XA_STRING, 16, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7424 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7425 |
__stringVal(anObject), |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7426 |
__wordArraySize(anObject)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7427 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7428 |
XChangeProperty(dpy, window, prop, XA_STRING, 8, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7429 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7430 |
__stringVal(anObject), |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7431 |
strlen(__stringVal(anObject))); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7432 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7433 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7434 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7435 |
RETURN (true); |
295 | 7436 |
} |
7437 |
%}. |
|
7438 |
^ false |
|
7439 |
! |
|
7440 |
||
7441 |
setSelection:anObject owner:aWindowId |
|
7442 |
"set the object selection, and make aWindowId be the owner. |
|
7443 |
This can be used by other Smalltalk(X) applications only." |
|
7444 |
||
7445 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
7446 |
^ false |
|
7447 |
]. |
|
7448 |
"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil |
|
7449 |
^ true |
|
7450 |
! |
|
7451 |
||
7452 |
setSelectionOwner:aWindowId of:selectionID |
|
7453 |
"set the owner of a selection; return false if failed" |
|
7454 |
||
7455 |
%{ /* NOCONTEXT */ |
|
7456 |
Display *dpy = myDpy; |
|
7457 |
Window win; |
|
7458 |
||
7459 |
if (__isExternalAddress(aWindowId) |
|
7460 |
&& __isAtomID(selectionID) |
|
7461 |
&& ISCONNECTED) { |
|
7462 |
win = _WindowVal(aWindowId); |
|
7463 |
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); |
|
7464 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { |
|
7465 |
RETURN (false); |
|
7466 |
} |
|
7467 |
RETURN (true); |
|
7468 |
} |
|
7469 |
%} |
|
7470 |
. |
|
7471 |
self primitiveFailed. |
|
7472 |
^ nil |
|
7473 |
! |
|
7474 |
||
7475 |
setTextProperty:propertyID value:aString for:aWindowID |
|
7476 |
^ self setProperty:propertyID type:(self atomIDOfSTRING) value:aString for:aWindowID |
|
7477 |
! |
|
7478 |
||
7479 |
setTextSelection:aString owner:aWindowId |
|
7480 |
"set the text selection, and make aWindowId be the owner. |
|
7481 |
This can be used by any other X application." |
|
7482 |
||
7483 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
7484 |
'ownerchange failed' errorPrintNL. |
|
7485 |
]. |
|
7486 |
^ self setTextProperty:cutBuffer0Atom value:aString for:nil |
|
7487 |
! ! |
|
7488 |
||
7489 |
!XWorkstation methodsFor:'window stuff'! |
|
7490 |
||
7491 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
|
7492 |
"clear a rectangular area to viewbackground" |
|
7493 |
||
7494 |
%{ /* NOCONTEXT */ |
|
7495 |
||
7496 |
int w, h; |
|
7497 |
||
7498 |
if (__isExternalAddress(aWindowId) |
|
7499 |
&& __bothSmallInteger(x, y) |
|
7500 |
&& __bothSmallInteger(width, height)) { |
|
555 | 7501 |
w = __intVal(width); |
7502 |
h = __intVal(height); |
|
1018 | 7503 |
/* |
7504 |
* need this check here: some servers simply dump core with bad args |
|
7505 |
*/ |
|
7506 |
if ((w >= 0) && (h >= 0)) { |
|
7507 |
XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
|
7508 |
} |
|
295 | 7509 |
RETURN ( self ); |
7510 |
} |
|
7511 |
%} |
|
7512 |
. |
|
7513 |
self primitiveFailed |
|
7514 |
! |
|
7515 |
||
7516 |
clearWindow:aWindowId |
|
7517 |
"clear a window to viewbackground" |
|
7518 |
||
7519 |
%{ /* NOCONTEXT */ |
|
7520 |
||
7521 |
if (__isExternalAddress(aWindowId)) { |
|
7522 |
XClearWindow(myDpy, _WindowVal(aWindowId)); |
|
7523 |
RETURN ( self ); |
|
7524 |
} |
|
7525 |
%} |
|
7526 |
. |
|
7527 |
self primitiveFailed |
|
7528 |
! |
|
7529 |
||
7530 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
|
7531 |
"configure stacking operation of aWindowId w.r.t siblingId" |
|
7532 |
||
7533 |
%{ /* NOCONTEXT */ |
|
7534 |
||
7535 |
XWindowChanges chg; |
|
7536 |
int mask = CWSibling | CWStackMode; |
|
7537 |
||
7538 |
if (__isExternalAddress(aWindowId) |
|
7539 |
&& __isExternalAddress(siblingId)) { |
|
7540 |
if (modeSymbol == @symbol(above)) { |
|
7541 |
chg.stack_mode = Above; |
|
7542 |
} else if (modeSymbol == @symbol(below)) { |
|
7543 |
chg.stack_mode = Below; |
|
7544 |
} else if (modeSymbol == @symbol(topIf)) { |
|
7545 |
chg.stack_mode = TopIf; |
|
7546 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
7547 |
chg.stack_mode = BottomIf; |
|
7548 |
} else if (modeSymbol == @symbol(opposite)) { |
|
7549 |
chg.stack_mode = Opposite; |
|
7550 |
} else { |
|
7551 |
mask = CWSibling; |
|
7552 |
} |
|
7553 |
||
7554 |
chg.sibling = _WindowVal(siblingId); |
|
7555 |
XConfigureWindow(myDpy, _WindowVal(aWindowId), |
|
7556 |
mask, &chg); |
|
7557 |
RETURN ( self ); |
|
7558 |
} |
|
7559 |
bad: ; |
|
7560 |
%} |
|
7561 |
. |
|
7562 |
self primitiveFailed |
|
7563 |
! |
|
7564 |
||
7565 |
lowerWindow:aWindowId |
|
7566 |
"bring a window to back" |
|
7567 |
||
7568 |
%{ /* NOCONTEXT */ |
|
7569 |
||
7570 |
if (__isExternalAddress(aWindowId)) { |
|
7571 |
XLowerWindow(myDpy, _WindowVal(aWindowId)); |
|
7572 |
RETURN ( self ); |
|
7573 |
} |
|
7574 |
%} |
|
7575 |
. |
|
7576 |
self primitiveFailed |
|
7577 |
! |
|
7578 |
||
7579 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h |
|
7580 |
"make a window visible - either as icon or as a real view - needed for restart" |
|
7581 |
||
7582 |
|wicon wiconId wiconView wiconViewId wlabel| |
|
7583 |
||
7584 |
aBoolean ifTrue:[ |
|
7585 |
wicon := aView icon. |
|
7586 |
wicon notNil ifTrue:[ |
|
7587 |
wiconId := wicon id |
|
7588 |
]. |
|
7589 |
wiconView := aView iconView. |
|
7590 |
wiconView notNil ifTrue:[ |
|
7591 |
wiconViewId := wiconView id |
|
7592 |
]. |
|
7593 |
wlabel := aView label. |
|
7594 |
]. |
|
7595 |
%{ |
|
7596 |
||
7597 |
XWMHints wmhints; |
|
7598 |
XSizeHints szhints; |
|
7599 |
Display *dpy = myDpy; |
|
7600 |
Window win; |
|
7601 |
||
7602 |
if (__isExternalAddress(aWindowId)) { |
|
7603 |
win = _WindowVal(aWindowId); |
|
7604 |
||
7605 |
szhints.flags = 0; |
|
7606 |
if (__bothSmallInteger(xPos, yPos)) { |
|
555 | 7607 |
szhints.x = __intVal(xPos); |
7608 |
szhints.y = __intVal(yPos); |
|
295 | 7609 |
szhints.flags |= USPosition; |
7610 |
} |
|
7611 |
if (__bothSmallInteger(w, h)) { |
|
555 | 7612 |
szhints.width = __intVal(w); |
7613 |
szhints.height = __intVal(h); |
|
295 | 7614 |
szhints.flags |= USSize; |
7615 |
} |
|
7616 |
||
7617 |
if (aBoolean == true) { |
|
7618 |
char *windowName; |
|
7619 |
Pixmap iconBitmap = (Pixmap)0; |
|
7620 |
Window iconWindow; |
|
7621 |
||
7622 |
if (__isExternalAddress(wiconId)) |
|
7623 |
iconBitmap = _PixmapVal(wiconId); |
|
7624 |
else |
|
7625 |
iconBitmap = (Pixmap)0; |
|
7626 |
||
7627 |
if (__isExternalAddress(wiconViewId)) |
|
7628 |
iconWindow = _WindowVal(wiconViewId); |
|
7629 |
else |
|
7630 |
iconWindow = (Window)0; |
|
7631 |
||
7632 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
7633 |
windowName = (char *)_stringVal(wlabel); |
|
7634 |
else |
|
7635 |
windowName = ""; |
|
7636 |
||
7637 |
if (iconBitmap || windowName) { |
|
7638 |
XSetStandardProperties(dpy, win, |
|
7639 |
windowName, windowName, |
|
7640 |
iconBitmap, |
|
7641 |
0, 0, &szhints); |
|
7642 |
} |
|
7643 |
||
7644 |
wmhints.flags = 0; |
|
7645 |
if (iconBitmap) { |
|
7646 |
wmhints.flags |= IconPixmapHint; |
|
7647 |
wmhints.icon_pixmap = iconBitmap; |
|
7648 |
} |
|
7649 |
if (iconWindow) { |
|
7650 |
wmhints.flags |= IconWindowHint; |
|
7651 |
wmhints.icon_window = iconWindow; |
|
7652 |
} |
|
7653 |
||
7654 |
wmhints.initial_state = IconicState; |
|
7655 |
wmhints.flags |= StateHint; |
|
7656 |
XSetWMHints(dpy, win, &wmhints); |
|
7657 |
} |
|
7658 |
||
7659 |
if (szhints.flags) { |
|
7660 |
XSetNormalHints(dpy, win, &szhints); |
|
7661 |
} |
|
7662 |
||
7663 |
XMapWindow(dpy, win); |
|
7664 |
RETURN ( self ); |
|
7665 |
} |
|
7666 |
%} |
|
7667 |
. |
|
7668 |
self primitiveFailed |
|
7669 |
! |
|
7670 |
||
7671 |
mapWindow:aWindowId |
|
7672 |
"make a window visible" |
|
7673 |
||
7674 |
%{ /* NOCONTEXT */ |
|
7675 |
||
7676 |
if (__isExternalAddress(aWindowId)) { |
|
7677 |
XMapWindow(myDpy, _WindowVal(aWindowId)); |
|
7678 |
RETURN ( self ); |
|
7679 |
} |
|
7680 |
%} |
|
7681 |
. |
|
7682 |
self primitiveFailed |
|
7683 |
! |
|
7684 |
||
7685 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
|
7686 |
"move and resize a window" |
|
7687 |
||
7688 |
%{ /* NOCONTEXT */ |
|
7689 |
||
7690 |
int newWidth, newHeight; |
|
7691 |
||
7692 |
if (__isExternalAddress(aWindowId) |
|
7693 |
&& __bothSmallInteger(w, h) |
|
7694 |
&& __bothSmallInteger(x, y)) { |
|
555 | 7695 |
newWidth = __intVal(w); |
7696 |
newHeight = __intVal(h); |
|
295 | 7697 |
if (newWidth < 1) newWidth = 1; |
7698 |
if (newHeight < 1) newHeight = 1; |
|
7699 |
XMoveResizeWindow(myDpy, _WindowVal(aWindowId), |
|
555 | 7700 |
__intVal(x), __intVal(y), |
295 | 7701 |
newWidth, newHeight); |
7702 |
RETURN ( self ); |
|
7703 |
} |
|
7704 |
%} |
|
7705 |
. |
|
7706 |
self primitiveFailed |
|
7707 |
! |
|
7708 |
||
7709 |
moveWindow:aWindowId x:x y:y |
|
7710 |
"move a window" |
|
7711 |
||
7712 |
%{ /* NOCONTEXT */ |
|
7713 |
||
7714 |
if (__isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
|
555 | 7715 |
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); |
295 | 7716 |
RETURN ( self ); |
7717 |
} |
|
7718 |
%} |
|
7719 |
. |
|
7720 |
self primitiveFailed |
|
7721 |
! |
|
7722 |
||
7723 |
raiseWindow:aWindowId |
|
7724 |
"bring a window to front" |
|
7725 |
||
7726 |
%{ /* NOCONTEXT */ |
|
7727 |
||
7728 |
if (__isExternalAddress(aWindowId)) { |
|
7729 |
XRaiseWindow(myDpy, _WindowVal(aWindowId)); |
|
7730 |
RETURN ( self ); |
|
7731 |
} |
|
7732 |
%} |
|
7733 |
. |
|
7734 |
self primitiveFailed |
|
7735 |
! |
|
7736 |
||
7737 |
resizeWindow:aWindowId width:w height:h |
|
7738 |
"resize a window" |
|
7739 |
||
7740 |
%{ /* NOCONTEXT */ |
|
7741 |
||
7742 |
int newWidth, newHeight; |
|
7743 |
||
7744 |
if (__isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
|
555 | 7745 |
newWidth = __intVal(w); |
7746 |
newHeight = __intVal(h); |
|
295 | 7747 |
if (newWidth < 1) newWidth = 1; |
7748 |
if (newHeight < 1) newHeight = 1; |
|
7749 |
XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); |
|
7750 |
RETURN ( self ); |
|
7751 |
} |
|
7752 |
%} |
|
7753 |
. |
|
7754 |
self primitiveFailed |
|
7755 |
! |
|
7756 |
||
7757 |
setBackingStore:how in:aWindowId |
|
7758 |
"turn on/off backing-store for a window" |
|
7759 |
||
7760 |
%{ /* NOCONTEXT */ |
|
7761 |
||
7762 |
XSetWindowAttributes wa; |
|
7763 |
||
7764 |
if (__isExternalAddress(aWindowId)) { |
|
555 | 7765 |
if (__INST(ignoreBackingStore) != true) { |
295 | 7766 |
if (how == @symbol(always)) wa.backing_store = Always; |
7767 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
7768 |
else if (how == true) wa.backing_store = Always; |
|
7769 |
else wa.backing_store = 0; |
|
7770 |
BEGIN_INTERRUPTSBLOCKED |
|
7771 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); |
|
7772 |
END_INTERRUPTSBLOCKED |
|
7773 |
} |
|
7774 |
RETURN ( self ); |
|
7775 |
} |
|
7776 |
%}. |
|
7777 |
self primitiveFailed |
|
7778 |
! |
|
7779 |
||
7780 |
setBitGravity:how in:aWindowId |
|
7781 |
"set bit gravity for a window" |
|
7782 |
||
7783 |
%{ /* NOCONTEXT */ |
|
7784 |
||
7785 |
XSetWindowAttributes wa; |
|
7786 |
||
7787 |
if (__isExternalAddress(aWindowId)) { |
|
7788 |
if (how == @symbol(NorthWest)) { |
|
7789 |
wa.bit_gravity = NorthWestGravity; |
|
7790 |
} else if (how == @symbol(NorthEast)) { |
|
7791 |
wa.bit_gravity = NorthEastGravity; |
|
7792 |
} else if (how == @symbol(SouthWest)) { |
|
7793 |
wa.bit_gravity = SouthWestGravity; |
|
7794 |
} else if (how == @symbol(SouthEast)) { |
|
7795 |
wa.bit_gravity = SouthEastGravity; |
|
7796 |
} else if (how == @symbol(Center)) { |
|
7797 |
wa.bit_gravity = CenterGravity; |
|
7798 |
} else if (how == @symbol(North)) { |
|
7799 |
wa.bit_gravity = NorthGravity; |
|
7800 |
} else if (how == @symbol(South)) { |
|
7801 |
wa.bit_gravity = SouthGravity; |
|
7802 |
} else if (how == @symbol(West)) { |
|
7803 |
wa.bit_gravity = WestGravity; |
|
7804 |
} else if (how == @symbol(East)) { |
|
7805 |
wa.bit_gravity = EastGravity; |
|
7806 |
} else { |
|
7807 |
wa.bit_gravity = NorthWestGravity; |
|
7808 |
} |
|
7809 |
||
7810 |
BEGIN_INTERRUPTSBLOCKED |
|
7811 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); |
|
7812 |
END_INTERRUPTSBLOCKED |
|
7813 |
RETURN ( self ); |
|
7814 |
} |
|
7815 |
%}. |
|
7816 |
self primitiveFailed |
|
7817 |
! |
|
7818 |
||
7819 |
setCursor:aCursorId in:aWindowId |
|
7820 |
"define a windows cursor" |
|
7821 |
||
7822 |
%{ /* NOCONTEXT */ |
|
7823 |
||
7824 |
Display *dpy = myDpy; |
|
7825 |
||
7826 |
if (__isExternalAddress(aWindowId) |
|
7827 |
&& __isExternalAddress(aCursorId)) { |
|
7828 |
XDefineCursor(dpy, _WindowVal(aWindowId), _CursorVal(aCursorId)); |
|
7829 |
RETURN ( self ); |
|
7830 |
} |
|
7831 |
%}. |
|
7832 |
self primitiveFailed |
|
7833 |
! |
|
7834 |
||
7835 |
setIconName:aString in:aWindowId |
|
7836 |
"define a windows iconname" |
|
7837 |
||
7838 |
%{ /* NOCONTEXT */ |
|
7839 |
||
7840 |
if (__isExternalAddress(aWindowId) |
|
7841 |
&& (__isString(aString) || __isSymbol(aString))) { |
|
7842 |
XSetIconName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString)); |
|
7843 |
RETURN ( self ); |
|
7844 |
} |
|
7845 |
%}. |
|
7846 |
self primitiveFailed |
|
7847 |
! |
|
7848 |
||
7849 |
setSaveUnder:yesOrNo in:aWindowId |
|
7850 |
"turn on/off save-under for a window" |
|
7851 |
||
7852 |
%{ /* NOCONTEXT */ |
|
7853 |
||
7854 |
XSetWindowAttributes wa; |
|
7855 |
||
7856 |
if (__isExternalAddress(aWindowId)) { |
|
555 | 7857 |
if (__INST(hasSaveUnder) == true) { |
295 | 7858 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
7859 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); |
|
7860 |
} |
|
7861 |
RETURN ( self ); |
|
7862 |
} |
|
7863 |
%}. |
|
7864 |
self primitiveFailed |
|
7865 |
! |
|
7866 |
||
7867 |
setTransient:aWindowId for:aMainWindowId |
|
7868 |
"set aWindowId to be a transient of aMainWindow" |
|
7869 |
||
7870 |
%{ /* NOCONTEXT */ |
|
7871 |
||
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7872 |
if (__isExternalAddress(aWindowId)) { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7873 |
Window w; |
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 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7876 |
w = (Window) 0; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7877 |
} else { |
374 | 7878 |
if (__isExternalAddress(aMainWindowId)) { |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7879 |
w = _WindowVal(aMainWindowId); |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7880 |
} else { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7881 |
goto getOutOfHere; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7882 |
} |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7883 |
} |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7884 |
XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); |
295 | 7885 |
RETURN ( self ); |
7886 |
} |
|
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7887 |
getOutOfHere: ; |
295 | 7888 |
%}. |
7889 |
self primitiveFailed |
|
7890 |
! |
|
7891 |
||
7892 |
setWindowBackground:aColorIndex in:aWindowId |
|
7893 |
"set the windows background color. This is the color with which |
|
7894 |
the view is filled whenever exposed. Do not confuse this with |
|
7895 |
the background drawing color, which is used with opaque drawing." |
|
7896 |
||
7897 |
%{ /* NOCONTEXT */ |
|
7898 |
||
7899 |
if (__isExternalAddress(aWindowId) |
|
7900 |
&& __isSmallInteger(aColorIndex)) { |
|
555 | 7901 |
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
295 | 7902 |
RETURN ( self ); |
7903 |
} |
|
7904 |
%}. |
|
7905 |
self primitiveFailed |
|
7906 |
! |
|
7907 |
||
7908 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
7909 |
"set the windows background pattern to be a form. |
|
7910 |
This is the pattern with which the view is filled whenever exposed. |
|
7911 |
Do not confuse this with the background drawing color, which is used |
|
7912 |
with opaque drawing." |
|
7913 |
||
7914 |
%{ /* NOCONTEXT */ |
|
7915 |
||
7916 |
if (__isExternalAddress(aWindowId) |
|
7917 |
&& __isExternalAddress(aPixmapId)) { |
|
7918 |
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
|
7919 |
RETURN ( self ); |
|
7920 |
} |
|
7921 |
%}. |
|
7922 |
self primitiveFailed |
|
7923 |
! |
|
7924 |
||
7925 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
7926 |
"set the windows border color" |
|
7927 |
||
7928 |
%{ /* NOCONTEXT */ |
|
7929 |
||
7930 |
if (__isExternalAddress(aWindowId) |
|
7931 |
&& __isSmallInteger(aColorIndex)) { |
|
555 | 7932 |
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
295 | 7933 |
RETURN ( self ); |
7934 |
} |
|
7935 |
%}. |
|
7936 |
self primitiveFailed |
|
7937 |
! |
|
7938 |
||
7939 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
7940 |
"set the windows border pattern" |
|
7941 |
||
7942 |
%{ /* NOCONTEXT */ |
|
7943 |
||
7944 |
if (__isExternalAddress(aWindowId) |
|
7945 |
&& __isExternalAddress(aPixmapId)) { |
|
7946 |
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
|
7947 |
RETURN ( self ); |
|
7948 |
} |
|
7949 |
%} |
|
7950 |
. |
|
7951 |
self primitiveFailed |
|
7952 |
! |
|
7953 |
||
7954 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
7955 |
"set the windows border shape" |
|
7956 |
||
7957 |
hasShapeExtension ifFalse:[^ self]. |
|
7958 |
||
7959 |
%{ /* NOCONTEXT */ |
|
7960 |
||
7961 |
#ifdef SHAPE |
|
7962 |
if (__isExternalAddress(aWindowId) |
|
7963 |
&& __isExternalAddress(aPixmapId)) { |
|
7964 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, |
|
7965 |
0, 0, _PixmapVal(aPixmapId), ShapeSet); |
|
7966 |
RETURN ( self ); |
|
7967 |
} |
|
7968 |
#endif |
|
7969 |
%}. |
|
7970 |
self primitiveFailed |
|
7971 |
! |
|
7972 |
||
7973 |
setWindowBorderWidth:aNumber in:aWindowId |
|
7974 |
"set the windows border width" |
|
7975 |
||
7976 |
%{ /* NOCONTEXT */ |
|
7977 |
||
7978 |
if (__isExternalAddress(aWindowId) |
|
7979 |
&& __isSmallInteger(aNumber)) { |
|
555 | 7980 |
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); |
295 | 7981 |
RETURN ( self ); |
7982 |
} |
|
7983 |
%}. |
|
7984 |
self primitiveFailed |
|
7985 |
! |
|
7986 |
||
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7987 |
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
|
7988 |
"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
|
7989 |
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
|
7990 |
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
|
7991 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7992 |
%{ |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
7993 |
if (__isExternalAddress(aWindowId)) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7994 |
XClassHint classhint; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7995 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7996 |
classhint.res_class = classhint.res_name = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7997 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7998 |
if (__isString(wClass) || __isSymbol(wClass)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
7999 |
classhint.res_class = (char *)_stringVal(wClass); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8000 |
} else if (wClass != nil) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8001 |
goto error; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8002 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8003 |
if (__isString(wName) || __isSymbol(wName)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8004 |
classhint.res_name = (char *)_stringVal(wName); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8005 |
} else if (wName != nil) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8006 |
goto error; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8007 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8008 |
XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8009 |
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
|
8010 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8011 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8012 |
%}. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8013 |
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
|
8014 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8015 |
|
295 | 8016 |
setWindowGravity:how in:aWindowId |
8017 |
"set window gravity for a window" |
|
8018 |
||
8019 |
%{ /* NOCONTEXT */ |
|
8020 |
||
8021 |
XSetWindowAttributes wa; |
|
8022 |
||
8023 |
if (__isExternalAddress(aWindowId)) { |
|
8024 |
if (how == @symbol(NorthWest)) { |
|
8025 |
wa.win_gravity = NorthWestGravity; |
|
8026 |
} else if (how == @symbol(NorthEast)) { |
|
8027 |
wa.win_gravity = NorthEastGravity; |
|
8028 |
} else if (how == @symbol(SouthWest)) { |
|
8029 |
wa.win_gravity = SouthWestGravity; |
|
8030 |
} else if (how == @symbol(SouthEast)) { |
|
8031 |
wa.win_gravity = SouthEastGravity; |
|
8032 |
} else if (how == @symbol(Center)) { |
|
8033 |
wa.win_gravity = CenterGravity; |
|
8034 |
} else if (how == @symbol(North)) { |
|
8035 |
wa.win_gravity = NorthGravity; |
|
8036 |
} else if (how == @symbol(South)) { |
|
8037 |
wa.win_gravity = SouthGravity; |
|
8038 |
} else if (how == @symbol(West)) { |
|
8039 |
wa.win_gravity = WestGravity; |
|
8040 |
} else if (how == @symbol(East)) { |
|
8041 |
wa.win_gravity = EastGravity; |
|
8042 |
} else { |
|
8043 |
wa.win_gravity = NorthWestGravity; |
|
8044 |
} |
|
8045 |
||
8046 |
BEGIN_INTERRUPTSBLOCKED |
|
8047 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); |
|
8048 |
END_INTERRUPTSBLOCKED |
|
8049 |
RETURN ( self ); |
|
8050 |
} |
|
8051 |
%}. |
|
8052 |
self primitiveFailed |
|
8053 |
! |
|
8054 |
||
8055 |
setWindowIcon:aForm in:aWindowId |
|
8056 |
"define a bitmap to be used as icon" |
|
8057 |
||
8058 |
|iconId| |
|
8059 |
||
8060 |
aForm notNil ifTrue:[ |
|
8061 |
iconId := aForm id |
|
8062 |
]. |
|
8063 |
%{ |
|
8064 |
if (__isExternalAddress(iconId) |
|
8065 |
&& __isExternalAddress(aWindowId)) { |
|
8066 |
XWMHints hints; |
|
8067 |
||
8068 |
hints.icon_pixmap = _PixmapVal(iconId); |
|
8069 |
hints.flags = IconPixmapHint; |
|
8070 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
|
8071 |
RETURN ( self ); |
|
8072 |
} |
|
8073 |
%}. |
|
8074 |
self primitiveFailed |
|
8075 |
! |
|
8076 |
||
8077 |
setWindowIconWindow:aView in:aWindowId |
|
8078 |
"define a window to be used as icon" |
|
8079 |
||
8080 |
|iconWindowId| |
|
8081 |
||
8082 |
aView notNil ifTrue:[ |
|
8083 |
iconWindowId := aView id |
|
8084 |
]. |
|
8085 |
%{ |
|
8086 |
if (__isExternalAddress(iconWindowId) |
|
8087 |
&& __isExternalAddress(aWindowId)) { |
|
8088 |
XWMHints wmhints; |
|
8089 |
||
8090 |
wmhints.icon_window = _WindowVal(iconWindowId); |
|
8091 |
wmhints.flags = IconWindowHint; |
|
8092 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); |
|
8093 |
RETURN ( self ); |
|
8094 |
} |
|
8095 |
%}. |
|
8096 |
self primitiveFailed |
|
8097 |
! |
|
8098 |
||
8099 |
setWindowName:aString in:aWindowId |
|
8100 |
"define a windows name" |
|
8101 |
||
8102 |
%{ /* NOCONTEXT */ |
|
8103 |
||
8104 |
if (__isExternalAddress(aWindowId) |
|
8105 |
&& (__isString(aString) || __isSymbol(aString))) { |
|
8106 |
XStoreName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString)); |
|
8107 |
RETURN ( self ); |
|
8108 |
} |
|
8109 |
%}. |
|
8110 |
self primitiveFailed |
|
8111 |
! |
|
8112 |
||
8113 |
setWindowShape:aPixmapId in:aWindowId |
|
8114 |
"set the windows shape" |
|
8115 |
||
8116 |
hasShapeExtension ifFalse:[^ self]. |
|
8117 |
||
8118 |
%{ /* NOCONTEXT */ |
|
8119 |
||
8120 |
#ifdef SHAPE |
|
8121 |
if (__isExternalAddress(aWindowId) |
|
8122 |
&& __isExternalAddress(aPixmapId)) { |
|
8123 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, |
|
8124 |
0, 0, |
|
8125 |
_PixmapVal(aPixmapId), ShapeSet); |
|
8126 |
RETURN ( self ); |
|
8127 |
} |
|
8128 |
#endif |
|
8129 |
%}. |
|
8130 |
self primitiveFailed |
|
8131 |
! |
|
8132 |
||
8133 |
unmapWindow:aWindowId |
|
8134 |
"make a window invisible" |
|
8135 |
||
8136 |
%{ /* NOCONTEXT */ |
|
8137 |
||
8138 |
if (__isExternalAddress(aWindowId)) { |
|
8139 |
XUnmapWindow(myDpy, _WindowVal(aWindowId)); |
|
8140 |
RETURN ( self ); |
|
8141 |
} |
|
8142 |
%} |
|
8143 |
. |
|
8144 |
self primitiveFailed |
|
8145 |
! ! |
|
8146 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
8147 |
!XWorkstation class methodsFor:'documentation'! |
295 | 8148 |
|
8149 |
version |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
8150 |
^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.176 1996-10-02 11:39:30 cg Exp $' |
295 | 8151 |
! ! |
8152 |
XWorkstation initialize! |