author | Claus Gittinger <cg@exept.de> |
Sat, 11 Jan 1997 12:12:58 +0100 | |
changeset 1183 | 28cfb8ef3504 |
parent 1180 | cebccdb0e9c0 |
child 1195 | 91fef292a475 |
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 |
|
1098 | 175 |
|
78 | 176 |
# define BEGIN_INTERRUPTSBLOCKED /* */ |
177 |
# define END_INTERRUPTSBLOCKED /* */ |
|
1098 | 178 |
|
78 | 179 |
#else |
1098 | 180 |
|
78 | 181 |
# define BEGIN_INTERRUPTSBLOCKED \ |
182 |
{ \ |
|
850 | 183 |
int needUnblock = 0; \ |
184 |
\ |
|
1098 | 185 |
__BEGIN_PROTECT_REGISTERS__ \ |
850 | 186 |
if (!__interruptsBlocked) { \ |
187 |
__BLOCKINTERRUPTS(); \ |
|
188 |
needUnblock = 1; \ |
|
189 |
} |
|
78 | 190 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
191 |
# define END_INTERRUPTSBLOCKED_NOW \ |
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
192 |
__END_PROTECT_REGISTERS__ \ |
850 | 193 |
if (needUnblock) { \ |
194 |
__UNBLOCKINTERRUPTS(); \ |
|
195 |
} \ |
|
78 | 196 |
} |
197 |
||
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
198 |
# define END_INTERRUPTSBLOCKED \ |
1098 | 199 |
__END_PROTECT_REGISTERS__ |
1060
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 |
|
1081 | 223 |
#ifdef __GNUC__ |
224 |
VOLATILE |
|
225 |
#endif |
|
226 |
||
227 |
static |
|
1062 | 228 |
dummyToForceLoading() { |
229 |
XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
|
230 |
XCloseDisplay(0); |
|
231 |
XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
|
232 |
XSetWindowColormap(0, 0, 0); |
|
233 |
XQueryColors(0,0,0,0); |
|
234 |
#ifdef SHM |
|
235 |
XShmAttach(0, 0); |
|
236 |
XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
|
237 |
XShmDetach(0, 0); |
|
238 |
XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
|
239 |
shmctl(0,0,0); |
|
240 |
fgetc(0); |
|
241 |
#endif |
|
242 |
} |
|
243 |
||
18 | 244 |
/* |
144 | 245 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
246 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 247 |
* the implementation below is somewhat wrong: it will |
78 | 248 |
* report all errors for Display, even though there could be |
162 | 249 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
250 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 251 |
*/ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
252 |
|
12 | 253 |
__XErrorHandler__(dpy, event) |
0 | 254 |
Display *dpy; |
255 |
XErrorEvent *event; |
|
256 |
{ |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
257 |
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
|
258 |
lastErrorMsg[79] = '\0'; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
259 |
|
0 | 260 |
if (lastErrorMsg[0] == '\0') { |
70 | 261 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 262 |
} |
2 | 263 |
lastRequestCode = event->request_code; |
264 |
lastMinorCode = event->minor_code; |
|
265 |
lastResource = event->resourceid; |
|
911 | 266 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
267 |
/* |
|
268 |
* this is a BadWindow error for X_DestroyWindow. |
|
269 |
* ignore it here, since it results from the GC freeing windows |
|
270 |
* in non bottom-up window order. |
|
271 |
*/ |
|
272 |
return 0; |
|
273 |
} |
|
2 | 274 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
275 |
if (@global(ErrorPrinting) == true) { |
1183 | 276 |
fprintf(stderr, "XWorkstation [error]: x-error cought maj=%d (0x%x) min=%d (0x%x) resource=%x\n", |
219
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
277 |
event->request_code, event->request_code, |
9ff0660f447f
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
218
diff
changeset
|
278 |
event->minor_code, event->minor_code, event->resourceid); |
1183 | 279 |
fprintf(stderr, "XWorkstation [error]: 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
|
280 |
} |
43 | 281 |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
282 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKOBJ(dpy)); |
0 | 283 |
return 0; |
284 |
} |
|
285 |
||
90 | 286 |
#ifdef VIRTUAL_ROOT |
0 | 287 |
/* |
18 | 288 |
* added since RootWindow-macro is not suficient |
289 |
* when virtual root-windows are involved (i.e. tvtwm) |
|
290 |
*/ |
|
291 |
static Window |
|
292 |
getRootWindow(dpy, screen) |
|
293 |
Display *dpy; |
|
294 |
{ |
|
295 |
Window root; |
|
296 |
Atom vRootAtom = None; |
|
297 |
int i; |
|
298 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
299 |
Window* children = (Window *)0; |
18 | 300 |
unsigned int numChildren; |
301 |
||
302 |
root = RootWindow(dpy, screen); |
|
303 |
/* |
|
304 |
* on IRIS, this creates a badwindow error - why ? |
|
305 |
* children contains a funny window (000034) |
|
306 |
*/ |
|
90 | 307 |
# if !defined(IRIS) || defined(IRIX5) |
18 | 308 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
70 | 309 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
310 |
if (vRootAtom != None) { |
|
311 |
for (i=0; i < numChildren; i++) { |
|
312 |
Atom actual_type; |
|
313 |
int actual_format; |
|
314 |
unsigned long nitems, bytesafter; |
|
315 |
Window* newRoot = (Window*) 0; |
|
316 |
||
317 |
if (children[i]) { |
|
318 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
|
319 |
0L, 1L, False, XA_WINDOW, |
|
320 |
&actual_type, &actual_format, &nitems, &bytesafter, |
|
321 |
(unsigned char**) &newRoot) == Success && newRoot) { |
|
322 |
root = *newRoot; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
323 |
XFree(newRoot); /* XXX */ |
70 | 324 |
break; |
325 |
} |
|
326 |
} |
|
327 |
} |
|
328 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
329 |
if (children) XFree( children ); |
18 | 330 |
} |
90 | 331 |
# endif |
18 | 332 |
return root; |
333 |
} |
|
90 | 334 |
#endif |
0 | 335 |
%} |
78 | 336 |
! ! |
0 | 337 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
338 |
!XWorkstation class methodsFor:'documentation'! |
295 | 339 |
|
340 |
copyright |
|
341 |
" |
|
342 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
343 |
All Rights Reserved |
|
344 |
||
345 |
This software is furnished under a license and may be used |
|
346 |
only in accordance with the terms of that license and with the |
|
347 |
inclusion of the above copyright notice. This software may not |
|
348 |
be provided or otherwise made available to, or used by, any |
|
349 |
other person. No title to or ownership of the software is |
|
350 |
hereby transferred. |
|
351 |
" |
|
352 |
! |
|
353 |
||
354 |
documentation |
|
355 |
" |
|
356 |
this class provides the interface to X11. It redefines all required methods |
|
357 |
from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically |
|
358 |
limited to one display - in theory, you can create Views on many displays |
|
359 |
simultanously. However, the default setup is for one display only. |
|
360 |
To support multiple displays, you will have to start another event dispatcher |
|
361 |
process for the other display(s) and create the other views with a slightly |
|
362 |
different protocol. However, 'normal' applications do not have to care for |
|
363 |
all of this ... |
|
364 |
||
365 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 366 |
|
367 |
[author:] |
|
850 | 368 |
Claus Gittinger |
295 | 369 |
" |
370 |
! ! |
|
371 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
372 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
373 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
374 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
375 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
376 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
377 |
super initialize. |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
378 |
|
386 | 379 |
RawKeysymTranslation isNil ifTrue:[ |
380 |
"/ the following table maps X-keyevents to ST/X |
|
381 |
"/ device independed events. |
|
382 |
"/ It is NOT meant as a keyboardMap replacement. |
|
383 |
||
384 |
RawKeysymTranslation := d := Dictionary new. |
|
385 |
d at:'Delete_line' put:#DeleteLine. |
|
386 |
d at:'Delete_word' put:#DeleteWord. |
|
387 |
d at:'Down' put:#CursorDown. |
|
388 |
d at:'Up' put:#CursorUp. |
|
389 |
d at:'Left' put:#CursorLeft. |
|
390 |
d at:'Right' put:#CursorRight. |
|
391 |
] |
|
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
392 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
393 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
394 |
!XWorkstation class methodsFor:'error handling'! |
2 | 395 |
|
129 | 396 |
debug:aBoolean |
397 |
%{ /* NOCONTEXT */ |
|
398 |
||
399 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
400 |
%} |
|
401 |
! |
|
402 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
403 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
404 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
405 |
#ifdef COUNT_RESOURCES |
928 | 406 |
printf("colors %d bitmaps %d view %d gc %d cursor %d font %d\n", |
407 |
__cnt_color, __cnt_bitmap, |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
408 |
__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
|
409 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
410 |
%} |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
411 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
412 |
|
78 | 413 |
errorStringOfLastError |
414 |
%{ |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
415 |
RETURN ( __MKSTRING(lastErrorMsg) ); |
78 | 416 |
%} |
417 |
! |
|
418 |
||
135 | 419 |
lastErrorString |
2 | 420 |
"return the last X-error string - |
421 |
when buffering is on, this may be |
|
422 |
an error for a long-ago operation" |
|
78 | 423 |
|
424 |
|string requestCode s match line| |
|
425 |
||
426 |
string := self errorStringOfLastError. |
|
427 |
requestCode := self requestCodeOfLastError. |
|
428 |
" |
|
429 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
430 |
and append the name of the corresponding X-request |
|
431 |
" |
|
432 |
s := '/usr/lib/X11/XErrorDB' asFilename readStream. |
|
433 |
s notNil ifTrue:[ |
|
434 |
match := 'XRequest.' , requestCode printString. |
|
435 |
line := s peekForLineStartingWith:match. |
|
436 |
line notNil ifTrue:[ |
|
437 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
438 |
]. |
|
439 |
s close. |
|
440 |
]. |
|
441 |
^ string |
|
295 | 442 |
! |
443 |
||
444 |
minorCodeOfLastError |
|
445 |
%{ /* NOCONTEXT */ |
|
446 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
447 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 448 |
%} |
449 |
! |
|
450 |
||
451 |
requestCodeOfLastError |
|
152 | 452 |
%{ /* NOCONTEXT */ |
453 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
454 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 455 |
%} |
135 | 456 |
! |
457 |
||
295 | 458 |
resourceIdOfLastError |
0 | 459 |
%{ /* NOCONTEXT */ |
295 | 460 |
|
461 |
RETURN ( __MKOBJ(lastResource) ); |
|
0 | 462 |
%} |
463 |
! ! |
|
464 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
465 |
!XWorkstation class methodsFor:'queries'! |
104 | 466 |
|
467 |
platformName |
|
133 | 468 |
"ST-80 compatibility. |
469 |
Return a string describing the display systems platform." |
|
470 |
||
715 | 471 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
472 |
||
473 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 474 |
! ! |
475 |
||
0 | 476 |
!XWorkstation methodsFor:'accessing & queries'! |
477 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
478 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
479 |
"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
|
480 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
481 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
482 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
483 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
484 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
485 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
486 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
487 |
|
295 | 488 |
blackpixel |
489 |
"return the colornumber of black" |
|
490 |
||
491 |
^ blackpixel |
|
492 |
! |
|
493 |
||
494 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
495 |
"return the state-mask for button1 in motion events' state-field. |
295 | 496 |
For backward compatibility." |
497 |
||
498 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
499 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
295 | 500 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
501 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
502 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
503 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
504 |
" |
295 | 505 |
! |
506 |
||
507 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
508 |
"return the state-mask for button2 in motion events' state-field |
295 | 509 |
For backward compatibility." |
510 |
||
511 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
512 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 513 |
%} |
514 |
! |
|
515 |
||
516 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
517 |
"return the state-mask for button3 in motion events' state-field |
295 | 518 |
For backward compatibility." |
519 |
||
520 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
521 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 522 |
%} |
523 |
! |
|
524 |
||
525 |
buttonMotionMask:aButton |
|
526 |
"return the state-mask for button1 in motion events state-field. |
|
527 |
This is the devices mask." |
|
528 |
||
529 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
530 |
if (aButton == __MKSMALLINT(1)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
531 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
532 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
533 |
if (aButton == __MKSMALLINT(2)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
534 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
535 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
536 |
if (aButton == __MKSMALLINT(3)) { |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
537 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 538 |
} |
539 |
%}. |
|
540 |
^ nil |
|
541 |
! |
|
542 |
||
382 | 543 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
544 |
"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
|
545 |
|
382 | 546 |
%{ /* NOCONTEXT */ |
547 |
RETURN (__MKSMALLINT(ControlMask)); |
|
548 |
%} |
|
549 |
! |
|
550 |
||
295 | 551 |
defaultEventMask |
552 |
"return a mask to enable some events by default." |
|
553 |
||
554 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
555 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
295 | 556 |
KeyPressMask | KeyReleaseMask | |
557 |
EnterWindowMask | LeaveWindowMask | |
|
558 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
|
559 |
%} |
|
560 |
! |
|
561 |
||
0 | 562 |
displayFileDescriptor |
563 |
"return the displays fileNumber - for select" |
|
564 |
||
565 |
%{ /* NOCONTEXT */ |
|
566 |
||
150 | 567 |
if (ISCONNECTED) { |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
568 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 569 |
} |
570 |
RETURN (nil); |
|
0 | 571 |
%} |
572 |
! |
|
573 |
||
133 | 574 |
displayName |
575 |
"return the X-connections display name. |
|
576 |
This is (currently) nil for the default display, |
|
577 |
something like foo:0 for any other remote display. |
|
578 |
Future versions may return non-nil strings for the default display as well." |
|
579 |
||
580 |
^ displayName |
|
581 |
! |
|
582 |
||
341 | 583 |
protocolVersion |
584 |
"return the X-servers protocol version - should normally not be of |
|
585 |
any interest" |
|
586 |
||
587 |
%{ /* NOCONTEXT */ |
|
588 |
if (ISCONNECTED) { |
|
589 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
|
590 |
} |
|
591 |
RETURN (nil); |
|
592 |
%} |
|
593 |
||
594 |
" |
|
595 |
Display protocolVersion |
|
596 |
" |
|
597 |
! |
|
598 |
||
599 |
serverVendor |
|
600 |
"return the X-server vendor string - this should normally not be of |
|
601 |
any interest, but can be for special cases |
|
602 |
(to avoid bugs in certain implementations)" |
|
603 |
%{ |
|
604 |
if (ISCONNECTED) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
605 |
RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
341 | 606 |
} |
607 |
RETURN (nil); |
|
608 |
%} |
|
609 |
||
610 |
" |
|
611 |
Display serverVendor |
|
612 |
" |
|
613 |
! |
|
614 |
||
382 | 615 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
616 |
"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
|
617 |
|
382 | 618 |
%{ /* NOCONTEXT */ |
619 |
RETURN (__MKSMALLINT(ShiftMask)); |
|
620 |
%} |
|
621 |
! |
|
622 |
||
341 | 623 |
translatePoint:aPoint from:windowId1 to:windowId2 |
624 |
"given a point in window1, return the coordinate in window2. |
|
625 |
This expects a device coordinate (relative to the first views origin) |
|
626 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
627 |
- use to xlate points from a window to rootwindow" |
|
628 |
||
629 |
|x1 y1 x2 y2| |
|
630 |
||
631 |
x1 := x2 := aPoint x truncated. |
|
632 |
y1 := y2 := aPoint y truncated. |
|
633 |
%{ |
|
634 |
int xpos, ypos; |
|
635 |
Window w1, w2, child_return; |
|
555 | 636 |
int screen = __intVal(__INST(screen)); |
341 | 637 |
Display *dpy = myDpy; |
638 |
||
639 |
if (__isExternalAddress(windowId1) |
|
640 |
&& __isExternalAddress(windowId2) |
|
641 |
&& __bothSmallInteger(x1, y1)) { |
|
642 |
w1 = _WindowVal(windowId1); |
|
643 |
w2 = _WindowVal(windowId2); |
|
644 |
#ifdef VIRTUAL_ROOT |
|
645 |
if ((w1 == RootWindow(dpy, screen)) |
|
646 |
|| (w2 == RootWindow(dpy, screen))) { |
|
647 |
if (w1 == RootWindow(dpy, screen)) { |
|
648 |
w1 = getRootWindow(dpy, screen); |
|
649 |
} |
|
650 |
if (w2 == RootWindow(dpy, screen)) { |
|
651 |
w2 = getRootWindow(dpy, screen); |
|
652 |
} |
|
653 |
} |
|
654 |
#endif |
|
655 |
BEGIN_INTERRUPTSBLOCKED |
|
656 |
XTranslateCoordinates(dpy, w1, w2, |
|
555 | 657 |
__intVal(x1), __intVal(y1), |
341 | 658 |
&xpos, &ypos, &child_return); |
659 |
END_INTERRUPTSBLOCKED |
|
660 |
x2 = __MKSMALLINT(xpos); |
|
661 |
y2 = __MKSMALLINT(ypos); |
|
662 |
} |
|
663 |
%}. |
|
664 |
||
665 |
^ (x2 @ y2) |
|
666 |
! |
|
667 |
||
668 |
vendorRelease |
|
669 |
"return the X-servers vendor release - should normally not be of |
|
670 |
any interest, but can be for special cases. |
|
671 |
(to avoid bugs in certain implementations)" |
|
672 |
||
673 |
%{ /* NOCONTEXT */ |
|
674 |
if (ISCONNECTED) { |
|
675 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
|
676 |
} |
|
677 |
RETURN (nil); |
|
678 |
%} |
|
679 |
||
680 |
" |
|
681 |
Display vendorRelease |
|
682 |
" |
|
683 |
! |
|
684 |
||
685 |
viewIdFromPoint:aPoint in:windowId |
|
686 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
687 |
hit by this coordinate. Return nil if no view was hit. |
|
688 |
The returned id may be the id of a non ST view. |
|
689 |
- used to find the window to drop objects after a cross-view drag." |
|
690 |
||
691 |
%{ /* NOCONTEXT */ |
|
692 |
||
693 |
Display *dpy = myDpy; |
|
555 | 694 |
int screen = __intVal(__INST(screen)); |
341 | 695 |
OBJ xp, yp; |
696 |
int xpos, ypos; |
|
697 |
Window child_return; |
|
698 |
||
699 |
if (__isExternalAddress(windowId) |
|
700 |
&& __isPoint(aPoint)) { |
|
701 |
xp = _point_X(aPoint); |
|
702 |
yp = _point_Y(aPoint); |
|
703 |
if (__bothSmallInteger(xp, yp)) { |
|
704 |
BEGIN_INTERRUPTSBLOCKED |
|
705 |
XTranslateCoordinates(dpy, |
|
706 |
RootWindow(dpy, screen), |
|
707 |
_WindowVal(windowId), |
|
555 | 708 |
__intVal(xp), __intVal(yp), |
341 | 709 |
&xpos, &ypos, &child_return); |
710 |
END_INTERRUPTSBLOCKED |
|
711 |
if (child_return) { |
|
712 |
RETURN ( __MKOBJ(child_return) ); |
|
713 |
} |
|
714 |
RETURN ( nil ); |
|
715 |
} |
|
716 |
} |
|
717 |
%}. |
|
718 |
windowId notNil ifTrue:[ |
|
719 |
aPoint isPoint ifTrue:[ |
|
720 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
721 |
] |
|
722 |
]. |
|
723 |
||
724 |
^ nil |
|
725 |
! |
|
726 |
||
727 |
virtualExtent |
|
728 |
"return the virtual extent of the display (in pixels). |
|
729 |
On most systems, this is the same as the physical width; |
|
730 |
except, if a window manager with a virtual desktop like olvwm |
|
731 |
(simulating a bigger screen) is running." |
|
732 |
||
733 |
%{ |
|
555 | 734 |
if ((__INST(rootId) != __INST(virtualRootId)) |
735 |
&& __isExternalAddress(__INST(virtualRootId))) { |
|
341 | 736 |
Window vRootWin; |
737 |
Window root; |
|
738 |
int x, y; |
|
739 |
unsigned int width, height; |
|
740 |
unsigned int dummy; |
|
741 |
||
555 | 742 |
vRootWin = _WindowVal(__INST(virtualRootId)); |
341 | 743 |
if (XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
744 |
&dummy, &dummy)) { |
|
745 |
RETURN ( __MKPOINT_INT(width, height) ); |
|
746 |
} |
|
747 |
} |
|
748 |
%}. |
|
749 |
^ width @ height |
|
750 |
! |
|
751 |
||
752 |
whitepixel |
|
753 |
"return the colornumber of white" |
|
754 |
||
755 |
^ whitepixel |
|
756 |
! ! |
|
757 |
||
758 |
!XWorkstation methodsFor:'accessing display capabilities'! |
|
759 |
||
0 | 760 |
hasDPS |
186 | 761 |
"return true, if this workstation supports display postscript. |
762 |
Both the server must support it, and the feature must have been |
|
763 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 764 |
|
765 |
^ hasDPSExtension |
|
186 | 766 |
|
767 |
" |
|
768 |
Display hasDPS |
|
769 |
" |
|
770 |
! |
|
771 |
||
150 | 772 |
hasExtension:extensionString |
773 |
"query for an X extension. The argument, extensionString |
|
774 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 775 |
Return true, if that extension is available in the server. |
776 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 777 |
|
778 |
%{ |
|
779 |
int dummy; |
|
780 |
||
781 |
if (__isString(extensionString) && ISCONNECTED) { |
|
782 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
|
783 |
RETURN ( true ); |
|
784 |
} |
|
785 |
} |
|
786 |
%}. |
|
787 |
^ false |
|
186 | 788 |
|
789 |
" |
|
790 |
Display hasExtension:'XVideo' |
|
791 |
Display hasExtension:'Input' |
|
792 |
Display hasExtension:'GLX' |
|
793 |
Display hasExtension:'X3D-PEX' |
|
794 |
Display hasExtension:'XInputExtension' |
|
795 |
Display hasExtension:'SHAPE' |
|
796 |
Display hasExtension:'MIT-SHM' |
|
797 |
Display hasExtension:'SGIFullScreenStereo' |
|
798 |
" |
|
150 | 799 |
! |
800 |
||
295 | 801 |
hasImageExtension |
802 |
"return true, if this workstation supports the X image extension. |
|
803 |
Both the server must support it, and the feature must have been |
|
804 |
enabled in the smalltalk system, for true to be returned." |
|
805 |
||
806 |
^ hasImageExtension |
|
807 |
||
808 |
" |
|
809 |
Display hasImageExtension |
|
810 |
" |
|
811 |
! |
|
812 |
||
813 |
hasInputExtension |
|
814 |
"return true, if this workstation supports the X input extension. |
|
815 |
Both the server must support it, and the feature must have been |
|
816 |
enabled in the smalltalk system, for true to be returned." |
|
817 |
||
818 |
^ hasInputExtension |
|
819 |
||
820 |
" |
|
821 |
Display hasInputExtension |
|
822 |
" |
|
823 |
! |
|
824 |
||
825 |
hasMultibuffer |
|
826 |
"return true, if this workstation supports the multibuffer extension. |
|
827 |
Both the server must support it, and the feature must have been |
|
828 |
enabled in the smalltalk system, for true to be returned." |
|
829 |
||
830 |
^ hasMbufExtension |
|
831 |
||
832 |
" |
|
833 |
Display hasMultibuffer |
|
834 |
" |
|
835 |
! |
|
836 |
||
837 |
hasPEX |
|
838 |
"return true, if this workstation supports PEX 3D graphics. |
|
839 |
Both the server must support it, and the feature must have been |
|
840 |
enabled in the smalltalk system, for true to be returned." |
|
841 |
||
842 |
^ hasPEXExtension |
|
843 |
||
844 |
" |
|
845 |
Display hasPEX |
|
846 |
" |
|
847 |
! |
|
848 |
||
849 |
hasShape |
|
850 |
"return true, if this workstation supports non-rectangular windows. |
|
851 |
Both the server must support it, and the feature must have been |
|
852 |
enabled in the smalltalk system, for true to be returned." |
|
853 |
||
854 |
^ hasShapeExtension |
|
855 |
||
856 |
" |
|
857 |
Display hasShape |
|
858 |
" |
|
859 |
! |
|
860 |
||
861 |
hasShm |
|
862 |
"return true, if this workstation supports the shared pixmap extension. |
|
863 |
Both the server must support it, and the feature must have been |
|
864 |
enabled in the smalltalk system, for true to be returned." |
|
865 |
||
866 |
^ hasShmExtension |
|
867 |
||
868 |
" |
|
869 |
Display hasShm |
|
870 |
" |
|
871 |
! |
|
872 |
||
873 |
hasXVideo |
|
874 |
"return true, if this workstation supports the XVideo extension. |
|
875 |
Both the server must support it, and the feature must have been |
|
876 |
enabled in the smalltalk system, for true to be returned." |
|
877 |
||
878 |
^ hasXVideoExtension |
|
879 |
||
880 |
" |
|
881 |
Display hasXVideo |
|
882 |
" |
|
883 |
! |
|
884 |
||
885 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
886 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 887 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 888 |
|
889 |
|xIconSizes count ret| |
|
890 |
||
891 |
%{ |
|
892 |
Display *dpy = myDpy; |
|
555 | 893 |
int screen = __intVal(__INST(screen)); |
295 | 894 |
XIconSize *sizeList; |
895 |
int cnt; |
|
896 |
||
897 |
if (ISCONNECTED) { |
|
850 | 898 |
if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) { |
899 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
|
900 |
count = __MKSMALLINT(cnt); |
|
901 |
} |
|
295 | 902 |
} |
903 |
%}. |
|
904 |
xIconSizes isNil ifTrue:[^ nil]. |
|
905 |
||
906 |
ret := OrderedCollection new:count. |
|
907 |
1 to:count do:[ :i | |
|
850 | 908 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 909 |
|
910 |
%{ |
|
850 | 911 |
XIconSize *slp; |
912 |
||
913 |
slp = &((XIconSize *)__externalBytesAddress(xIconSizes))[__intVal(i)-1]; |
|
914 |
minWidth = __MKSMALLINT(slp->min_width); |
|
915 |
minHeight = __MKSMALLINT(slp->min_height); |
|
916 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
917 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
918 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
919 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 920 |
%}. |
850 | 921 |
d := IdentityDictionary new. |
922 |
d at:#minWidth put:minWidth. |
|
923 |
d at:#maxWidth put:maxWidth. |
|
924 |
d at:#widthStep put:widthStep. |
|
925 |
d at:#minHeight put:minHeight. |
|
926 |
d at:#maxHeight put:maxHeight. |
|
927 |
d at:#heightStep put:heightStep. |
|
928 |
||
929 |
ret add:d |
|
295 | 930 |
]. |
931 |
||
932 |
xIconSizes free. |
|
933 |
^ ret |
|
934 |
||
935 |
" |
|
819 | 936 |
Display iconSizes |
295 | 937 |
" |
938 |
! |
|
939 |
||
341 | 940 |
ignoreBackingStore:aBoolean |
941 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
942 |
no backing store used - this can be used on servers where backing store is |
|
943 |
very slow or is broken (can be put into display-rc-file)" |
|
944 |
||
945 |
ignoreBackingStore := aBoolean |
|
295 | 946 |
! |
947 |
||
823 | 948 |
preferredIconSize |
949 |
"return the displays preferred size for icons. |
|
950 |
Redefined to return a special value on SGI servers." |
|
951 |
||
952 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
850 | 953 |
^ 86@68 |
823 | 954 |
]. |
955 |
^ super preferredIconSize |
|
956 |
||
957 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
958 |
! |
|
959 |
||
1025 | 960 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
961 |
"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
|
962 |
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
|
963 |
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
|
964 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
965 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
966 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
967 |
|
43 | 968 |
supportedImageFormats |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
969 |
"return an array with supported image formats; |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
970 |
each array entry is an attribute dictionary, consisting of |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
971 |
depth, bitsPerPixel and padding values." |
43 | 972 |
|
150 | 973 |
|nFormats "{ Class: SmallInteger }" |
974 |
formatArray| |
|
43 | 975 |
%{ |
976 |
Display *dpy = myDpy; |
|
150 | 977 |
|
978 |
if (! ISCONNECTED) { |
|
979 |
RETURN (nil); |
|
980 |
} |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
981 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
43 | 982 |
%}. |
983 |
formatArray := Array new:nFormats. |
|
150 | 984 |
1 to:nFormats do:[:index | |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
985 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
150 | 986 |
|
987 |
i := index. |
|
43 | 988 |
%{ |
70 | 989 |
ScreenFormat *format; |
990 |
Display *dpy = myDpy; |
|
991 |
||
90 | 992 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
555 | 993 |
format += (__intVal(i)-1); |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
994 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
995 |
depthInfo = __MKSMALLINT(format->depth); |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
996 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
43 | 997 |
%}. |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
998 |
info := IdentityDictionary new. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
999 |
info at:#depth put:depthInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1000 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1001 |
info at:#padding put:paddingInfo. |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1002 |
formatArray at:index put:info. |
43 | 1003 |
]. |
1004 |
^ formatArray |
|
1005 |
||
1006 |
" |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1007 |
Display supportedImageFormats |
43 | 1008 |
" |
1009 |
! |
|
1010 |
||
823 | 1011 |
supportsIconViews |
1012 |
"return true, if this device supports views as icons. |
|
1013 |
Only Xservers (currently) support this." |
|
1014 |
||
1015 |
^ true |
|
1016 |
||
1017 |
" |
|
1018 |
Display supportsIconViews |
|
1019 |
" |
|
1020 |
||
1021 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1022 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
1023 |
! |
|
1024 |
||
81 | 1025 |
supportsViewGravity |
1026 |
"return true, if this device supports gravity attributes. |
|
82 | 1027 |
We do not depend on it being implemented, but some resizing operations |
81 | 1028 |
are faster, it is is." |
1029 |
||
1030 |
^ true |
|
0 | 1031 |
! ! |
1032 |
||
1033 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1034 |
||
295 | 1035 |
createBitmapFromArray:anArray width:w height:h |
1036 |
|bitmapId| |
|
1037 |
||
1038 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1039 |
bitmapId isNil ifTrue:[ |
|
1040 |
self primitiveFailed |
|
1041 |
]. |
|
1042 |
^ bitmapId |
|
1043 |
! |
|
1044 |
||
1045 |
createBitmapFromFile:aString for:aForm |
|
1046 |
|id w h| |
|
1047 |
||
1048 |
%{ |
|
1049 |
Display *dpy = myDpy; |
|
555 | 1050 |
int screen = __intVal(__INST(screen)); |
295 | 1051 |
Pixmap newBitmap; |
1052 |
char *filename; |
|
1053 |
unsigned b_width, b_height; |
|
1054 |
int b_x_hot, b_y_hot; |
|
1055 |
int status; |
|
1056 |
||
1057 |
if (ISCONNECTED) { |
|
1058 |
if (__isString(aString) || __isSymbol(aString)) { |
|
1059 |
filename = (char *)_stringVal(aString); |
|
1060 |
||
1061 |
BEGIN_INTERRUPTSBLOCKED |
|
1062 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
|
1063 |
filename, &b_width, &b_height, &newBitmap, |
|
1064 |
&b_x_hot, &b_y_hot); |
|
1065 |
END_INTERRUPTSBLOCKED |
|
1066 |
||
892 | 1067 |
if ((status == BitmapSuccess) && newBitmap) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1068 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1069 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1070 |
#endif |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1071 |
w = __MKSMALLINT(b_width); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1072 |
h = __MKSMALLINT(b_height); |
295 | 1073 |
id = __MKOBJ(newBitmap); |
1074 |
} |
|
1075 |
} |
|
1076 |
} |
|
1077 |
%}. |
|
1078 |
id notNil ifTrue:[ |
|
1079 |
aForm setWidth:w height:h |
|
1080 |
]. |
|
1081 |
^ id |
|
1082 |
! |
|
1083 |
||
1084 |
createBitmapWidth:w height:h |
|
1085 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1086 |
(i.e. random). Return a bitmap id or nil" |
|
1087 |
||
1088 |
%{ /* NOCONTEXT */ |
|
1089 |
||
1090 |
Display *dpy = myDpy; |
|
555 | 1091 |
int screen = __intVal(__INST(screen)); |
295 | 1092 |
Pixmap newBitmap; |
1093 |
||
1094 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1095 |
BEGIN_INTERRUPTSBLOCKED |
|
1096 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
|
555 | 1097 |
__intVal(w), __intVal(h), 1); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1098 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1099 |
if (newBitmap) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1100 |
__cnt_bitmap++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1101 |
#endif |
295 | 1102 |
END_INTERRUPTSBLOCKED |
1103 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil ); |
|
1104 |
} |
|
1105 |
%} |
|
1106 |
. |
|
1107 |
self primitiveFailed. |
|
1108 |
^ nil |
|
1109 |
! |
|
1110 |
||
0 | 1111 |
createPixmapWidth:w height:h depth:d |
1112 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1113 |
(i.e. random). Return a bitmap id or nil" |
|
1114 |
||
1115 |
%{ /* NOCONTEXT */ |
|
1116 |
||
1117 |
Display *dpy = myDpy; |
|
555 | 1118 |
int screen = __intVal(__INST(screen)); |
0 | 1119 |
Pixmap newBitmap; |
1120 |
||
150 | 1121 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
70 | 1122 |
BEGIN_INTERRUPTSBLOCKED |
1123 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
|
555 | 1124 |
__intVal(w), __intVal(h), __intVal(d)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1125 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1126 |
if (newBitmap) |
928 | 1127 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1128 |
#endif |
70 | 1129 |
END_INTERRUPTSBLOCKED |
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1130 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil ); |
0 | 1131 |
} |
1132 |
%} |
|
1133 |
. |
|
43 | 1134 |
self primitiveFailed. |
1135 |
^ nil |
|
0 | 1136 |
! |
1137 |
||
1138 |
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight |
|
46 | 1139 |
"will vanish - for compatibility with previous versions" |
1140 |
||
1141 |
^ self |
|
850 | 1142 |
createWindowFor:aView |
1143 |
origin:(xpos @ ypos) |
|
1144 |
extent:(wwidth @ wheight) |
|
1145 |
minExtent:(aView minExtent) |
|
1146 |
maxExtent:(aView maxExtent) |
|
1147 |
borderWidth:(aView borderWidth) |
|
1148 |
subViewOf:(aView superView) |
|
1149 |
onTop:(aView isPopUpView) |
|
1150 |
inputOnly:(aView isInputOnly) |
|
1151 |
label:(aView label) |
|
1152 |
cursor:(aView cursor) |
|
1153 |
icon:(aView icon) |
|
1154 |
iconView:(aView iconView) |
|
780
b2f13d436188
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
729
diff
changeset
|
1155 |
|
b2f13d436188
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
729
diff
changeset
|
1156 |
"Modified: 1.6.1996 / 13:22:48 / cg" |
46 | 1157 |
! |
1158 |
||
1159 |
createWindowFor:aView |
|
1180 | 1160 |
origin:origin |
1161 |
extent:extent |
|
1162 |
minExtent:minExt |
|
1163 |
maxExtent:maxExt |
|
1164 |
borderWidth:bWidth |
|
1165 |
subViewOf:wsuperView |
|
1166 |
onTop:wisPopUpView |
|
1167 |
inputOnly:winputOnly |
|
1168 |
label:wlabel |
|
1169 |
cursor:wcursor |
|
1170 |
icon:wicon |
|
1171 |
iconView:wiconView |
|
46 | 1172 |
|
1173 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
|
1174 |
bColorId wsuperViewId wcursorId wiconId windowId |
|
1175 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
|
150 | 1176 |
vBgForm deepForm preferredVisual preferredDepth| |
1177 |
||
1178 |
displayId isNil ifTrue:[ |
|
1180 | 1179 |
self primitiveFailed. |
1180 |
^ nil |
|
150 | 1181 |
]. |
0 | 1182 |
|
46 | 1183 |
origin notNil ifTrue:[ |
1180 | 1184 |
xpos := origin x. |
1185 |
ypos := origin y. |
|
46 | 1186 |
] ifFalse:[ |
1180 | 1187 |
xpos := ypos := 0. |
0 | 1188 |
]. |
46 | 1189 |
extent notNil ifTrue:[ |
1180 | 1190 |
wwidth := extent x. |
1191 |
wheight := extent y. |
|
46 | 1192 |
] ifFalse:[ |
1180 | 1193 |
wwidth := wheight := 100. |
46 | 1194 |
]. |
1195 |
minExt notNil ifTrue:[ |
|
1180 | 1196 |
minWidth := minExt x. |
1197 |
minHeight := minExt y |
|
0 | 1198 |
]. |
46 | 1199 |
maxExt notNil ifTrue:[ |
1180 | 1200 |
maxWidth := maxExt x. |
1201 |
maxHeight := maxExt y |
|
46 | 1202 |
]. |
1203 |
||
0 | 1204 |
wsuperView notNil ifTrue:[ |
1180 | 1205 |
wsuperViewId := wsuperView id |
0 | 1206 |
]. |
1207 |
wcursor isNil ifTrue:[ |
|
1180 | 1208 |
'XWorkstation [info]: cursor nil - defaulted' infoPrintCR |
0 | 1209 |
] ifFalse:[ |
1180 | 1210 |
wcursorId := wcursor id |
0 | 1211 |
]. |
1212 |
||
1213 |
wicon notNil ifTrue:[ |
|
1180 | 1214 |
wiconId := wicon id |
0 | 1215 |
]. |
1216 |
wiconView notNil ifTrue:[ |
|
1180 | 1217 |
wiconViewId := wiconView id |
0 | 1218 |
]. |
1219 |
weventMask := aView eventMask. |
|
1220 |
||
150 | 1221 |
preferredVisual := aView preferredVisual. |
1222 |
preferredDepth := aView preferredDepth. |
|
23 | 1223 |
|
72 | 1224 |
%{ /* STACK:16000 */ |
0 | 1225 |
Display *dpy = myDpy; |
555 | 1226 |
int screen = __intVal(__INST(screen)); |
0 | 1227 |
Visual visual; |
1228 |
XGCValues xgcv; |
|
1229 |
XSetWindowAttributes xswa; |
|
1230 |
XSizeHints sizehints; |
|
1231 |
XWMHints wmhints; |
|
46 | 1232 |
int bw, bd, bg; |
0 | 1233 |
Window newWindow, parentWindow; |
1234 |
char *windowName; |
|
1235 |
XFontStruct *f; |
|
1236 |
Pixmap backPixmap = (Pixmap)0, iconBitmap = (Pixmap)0; |
|
1237 |
int flags = 0, depth, ioClass; |
|
1238 |
Window iconWindow; |
|
1239 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
1240 |
Atom WmQuitAppAtom; |
|
1241 |
Atom atoms[3]; |
|
1242 |
int atomCount = 0, isTopWindow = 0; |
|
1243 |
||
1244 |
sizehints.flags = 0; |
|
1245 |
sizehints.width = 100; |
|
1246 |
sizehints.height = 100; |
|
1247 |
sizehints.x = 0; |
|
1248 |
sizehints.y = 0; |
|
1249 |
||
97 | 1250 |
if (__bothSmallInteger(wwidth, wheight)) { |
1180 | 1251 |
sizehints.flags |= PSize; |
1252 |
sizehints.width = __intVal(wwidth); |
|
1253 |
sizehints.height = __intVal(wheight); |
|
0 | 1254 |
} |
97 | 1255 |
if (__bothSmallInteger(xpos, ypos)) { |
1180 | 1256 |
sizehints.flags |= PPosition; |
1257 |
sizehints.x = __intVal(xpos); |
|
1258 |
sizehints.y = __intVal(ypos); |
|
0 | 1259 |
} |
97 | 1260 |
if (__bothSmallInteger(minWidth, minHeight)) { |
1180 | 1261 |
sizehints.flags |= PMinSize; |
1262 |
sizehints.min_width = __intVal(minWidth); |
|
1263 |
sizehints.min_height = __intVal(minHeight); |
|
0 | 1264 |
} |
97 | 1265 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
1180 | 1266 |
sizehints.flags |= PMaxSize; |
1267 |
sizehints.max_width = __intVal(maxWidth); |
|
1268 |
sizehints.max_height = __intVal(maxHeight); |
|
0 | 1269 |
} |
1270 |
||
37 | 1271 |
bg = WhitePixel(dpy, screen); |
0 | 1272 |
|
97 | 1273 |
if (__isSmallInteger(bWidth)) { |
1180 | 1274 |
bw = __intVal(bWidth); |
46 | 1275 |
} else { |
1180 | 1276 |
bw = 0; |
0 | 1277 |
} |
1278 |
||
72 | 1279 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1280 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1281 |
if (__isExternalAddress(wsuperViewId)) { |
1180 | 1282 |
parentWindow = _WindowVal(wsuperViewId); |
0 | 1283 |
} else { |
1180 | 1284 |
parentWindow = RootWindow(dpy, screen); |
1285 |
isTopWindow = 1; |
|
0 | 1286 |
} |
1287 |
||
157 | 1288 |
if (wisPopUpView == true) |
1180 | 1289 |
xswa.override_redirect = 1; |
0 | 1290 |
else |
1180 | 1291 |
xswa.override_redirect = 0; |
0 | 1292 |
|
1293 |
if (winputOnly == true) |
|
1180 | 1294 |
ioClass = InputOnly; |
0 | 1295 |
else |
1180 | 1296 |
ioClass = InputOutput; |
0 | 1297 |
|
97 | 1298 |
if (__isSmallInteger(weventMask)) { |
1180 | 1299 |
xswa.event_mask = __intVal(weventMask); |
0 | 1300 |
} else { |
1180 | 1301 |
xswa.event_mask = 0; |
0 | 1302 |
} |
1303 |
||
1304 |
if (ioClass == InputOnly) { |
|
1180 | 1305 |
bw = 0; |
1306 |
depth = 0; |
|
1307 |
flags |= CWEventMask; |
|
0 | 1308 |
} else { |
1180 | 1309 |
depth = DefaultDepth(dpy,screen); |
1310 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
|
1311 |
||
1312 |
if (backPixmap != (Pixmap)0) { |
|
1313 |
xswa.background_pixmap = backPixmap; |
|
1314 |
flags |= CWBackPixmap; |
|
1315 |
} else { |
|
1316 |
xswa.background_pixel = bg; |
|
1317 |
flags |= CWBackPixel; |
|
1318 |
} |
|
1319 |
xswa.border_pixel = bd; |
|
0 | 1320 |
} |
23 | 1321 |
|
0 | 1322 |
visual.visualid = CopyFromParent; |
150 | 1323 |
if (__isSmallInteger(preferredDepth)) { |
1180 | 1324 |
depth = __intVal(preferredDepth); |
23 | 1325 |
} |
54 | 1326 |
|
1327 |
BEGIN_INTERRUPTSBLOCKED |
|
150 | 1328 |
if (preferredVisual != nil) { |
1180 | 1329 |
XVisualInfo vi; |
1330 |
int cls; |
|
1331 |
||
1332 |
if (preferredVisual == @symbol(StaticGray)) |
|
1333 |
cls = StaticGray; |
|
1334 |
else if (preferredVisual == @symbol(GrayScale)) |
|
1335 |
cls = GrayScale; |
|
1336 |
else if (preferredVisual == @symbol(StaticColor)) |
|
1337 |
cls = StaticColor; |
|
1338 |
else if (preferredVisual == @symbol(PseudoColor)) |
|
1339 |
cls = PseudoColor; |
|
1340 |
else if (preferredVisual == @symbol(TrueColor)) |
|
1341 |
cls = TrueColor; |
|
1342 |
else if (preferredVisual == @symbol(DirectColor)) |
|
1343 |
cls = DirectColor; |
|
1344 |
else |
|
1345 |
cls = PseudoColor; |
|
1346 |
||
1347 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
|
1348 |
visual.visualid = vi.visualid; |
|
163 | 1349 |
/* |
1180 | 1350 |
printf("visualId=%x\n", vi.visualid); |
163 | 1351 |
*/ |
1180 | 1352 |
} |
23 | 1353 |
} |
0 | 1354 |
|
1355 |
newWindow = XCreateWindow(dpy, parentWindow, |
|
1180 | 1356 |
sizehints.x, sizehints.y, |
1357 |
sizehints.width, sizehints.height, |
|
1358 |
bw, depth, ioClass, &visual, |
|
1359 |
flags, &xswa); |
|
54 | 1360 |
END_INTERRUPTSBLOCKED |
0 | 1361 |
|
1362 |
if (! newWindow) { |
|
1180 | 1363 |
RETURN ( nil ); |
0 | 1364 |
} |
1365 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1366 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1367 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1368 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1369 |
|
54 | 1370 |
BEGIN_INTERRUPTSBLOCKED |
0 | 1371 |
/* |
1372 |
* define its cursor |
|
1373 |
*/ |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1374 |
if (__isExternalAddress(wcursorId)) { |
1180 | 1375 |
XDefineCursor(dpy, newWindow, _CursorVal(wcursorId)); |
0 | 1376 |
} |
1377 |
||
1378 |
/* |
|
1379 |
* define its icon and name |
|
1380 |
* (only makes sense for topWindows) |
|
1381 |
*/ |
|
1382 |
if (isTopWindow) { |
|
1180 | 1383 |
if (__isExternalAddress(wiconId)) |
1384 |
iconBitmap = _PixmapVal(wiconId); |
|
1385 |
else |
|
1386 |
iconBitmap = (Pixmap)0; |
|
1387 |
||
1388 |
if (__isExternalAddress(wiconViewId)) |
|
1389 |
iconWindow = _WindowVal(wiconViewId); |
|
1390 |
else |
|
1391 |
iconWindow = (Window)0; |
|
1392 |
||
1393 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1394 |
windowName = (char *)_stringVal(wlabel); |
|
1395 |
else |
|
1396 |
windowName = ""; |
|
1397 |
||
1398 |
if (iconBitmap || windowName) { |
|
1399 |
XSetStandardProperties(dpy, newWindow, |
|
1400 |
windowName, windowName, |
|
1401 |
iconBitmap, |
|
1402 |
0, 0, &sizehints); |
|
1403 |
||
1404 |
} |
|
1405 |
||
1406 |
wmhints.flags = 0; |
|
1407 |
if (iconBitmap) { |
|
1408 |
wmhints.flags |= IconPixmapHint; |
|
1409 |
wmhints.icon_pixmap = iconBitmap; |
|
1410 |
} |
|
1411 |
if (iconWindow) { |
|
1412 |
wmhints.flags |= IconWindowHint; |
|
1413 |
wmhints.icon_window = iconWindow; |
|
1414 |
} |
|
0 | 1415 |
/* |
1180 | 1416 |
wmhints.flags |= InputHint; |
1417 |
wmhints.input = True; |
|
0 | 1418 |
*/ |
1180 | 1419 |
XSetWMHints(dpy, newWindow, &wmhints); |
1420 |
||
1421 |
/* |
|
1422 |
* tell window manager to not kill us but send an event instead |
|
1423 |
*/ |
|
1424 |
/* |
|
1425 |
* get atoms first (if not already known) |
|
1426 |
*/ |
|
1427 |
if (__INST(protocolsAtom) == nil) { |
|
1428 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
|
1429 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
|
0 | 1430 |
#ifdef USE_SAVEYOURSELF_ATOM |
1180 | 1431 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
1432 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
|
0 | 1433 |
#endif |
1434 |
#ifdef USE_QUIT_APP_ATOM |
|
1180 | 1435 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
1436 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
|
0 | 1437 |
#endif |
1180 | 1438 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
1439 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
|
1440 |
} else { |
|
0 | 1441 |
#ifdef USE_QUIT_APP_ATOM |
1180 | 1442 |
WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); |
0 | 1443 |
#else |
1180 | 1444 |
WmQuitAppAtom = 0; |
0 | 1445 |
#endif |
1180 | 1446 |
WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); |
1447 |
WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); |
|
0 | 1448 |
#ifdef USE_SAVEYOURSELF_ATOM |
1180 | 1449 |
WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); |
0 | 1450 |
#else |
1180 | 1451 |
WmSaveYourselfAtom = 0; |
0 | 1452 |
#endif |
1180 | 1453 |
} |
1454 |
||
1455 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
|
0 | 1456 |
#ifdef USE_SAVEYOURSELF_ATOM |
1180 | 1457 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1458 |
#endif |
1459 |
#ifdef USE_QUIT_APP_ATOM |
|
1180 | 1460 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1461 |
#endif |
1180 | 1462 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
1463 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
|
0 | 1464 |
} |
1465 |
||
54 | 1466 |
END_INTERRUPTSBLOCKED |
1467 |
||
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1468 |
windowId = __MKOBJ(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1469 |
%}. |
0 | 1470 |
self addKnownView:aView withId:windowId. |
1471 |
^ windowId |
|
1472 |
! |
|
1473 |
||
1474 |
destroyGC:aGCId |
|
1475 |
||
1476 |
%{ /* NOCONTEXT */ |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1477 |
if (__isExternalAddress(aGCId) && ISCONNECTED) { |
366 | 1478 |
GC gc = _GCVal(aGCId); |
1479 |
||
1480 |
if (gc) { |
|
1481 |
BEGIN_INTERRUPTSBLOCKED |
|
1482 |
XFreeGC(myDpy, gc); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1483 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1484 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1485 |
#endif |
366 | 1486 |
END_INTERRUPTSBLOCKED |
1487 |
} |
|
70 | 1488 |
RETURN ( self ); |
0 | 1489 |
} |
118 | 1490 |
%}. |
0 | 1491 |
self primitiveFailed |
1492 |
! |
|
1493 |
||
295 | 1494 |
destroyPixmap:aDrawableId |
0 | 1495 |
|
1496 |
%{ /* NOCONTEXT */ |
|
1497 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1498 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1499 |
Pixmap pix = _PixmapVal(aDrawableId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1500 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1501 |
if (pix) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1502 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1503 |
XFreePixmap(myDpy, pix); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1504 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1505 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1506 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1507 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1508 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1509 |
RETURN ( self ); |
0 | 1510 |
} |
118 | 1511 |
%}. |
295 | 1512 |
self primitiveFailed |
1513 |
! |
|
1514 |
||
1515 |
destroyView:aView withId:aWindowId |
|
1516 |
%{ |
|
1517 |
if (__isExternalAddress(aWindowId) && ISCONNECTED) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1518 |
Window win = _WindowVal(aWindowId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1519 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1520 |
if (win) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1521 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1522 |
XDestroyWindow(myDpy, win); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1523 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1524 |
__cnt_view--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1525 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1526 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1527 |
} |
295 | 1528 |
} |
1529 |
%}. |
|
1530 |
self removeKnownView:aView |
|
0 | 1531 |
! |
1532 |
||
1533 |
dpsContextFor:aDrawableId and:aGCId |
|
1534 |
||
1535 |
%{ /* NOCONTEXT */ |
|
1536 |
#ifdef XXDPS |
|
555 | 1537 |
int screen = __intVal(__INST(screen)); |
0 | 1538 |
DPSContext dps; |
1539 |
int height; |
|
1540 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1541 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1542 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1543 |
&& ISCONNECTED) { |
70 | 1544 |
BEGIN_INTERRUPTSBLOCKED |
1545 |
dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
|
1546 |
_GCVal(aGCId), |
|
1547 |
0, height, 0, colormap, NULL, 0, |
|
1548 |
XDPSDefaultTextBackstop, |
|
1549 |
XDPSDefaultErrorProc, |
|
1550 |
NULL); |
|
1551 |
END_INTERRUPTSBLOCKED |
|
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
1552 |
RETURN ( dps ? __MKOBJ(dps) : nil ); |
0 | 1553 |
} |
1554 |
#endif |
|
1555 |
%} |
|
1556 |
. |
|
43 | 1557 |
self primitiveFailed. |
1558 |
^ nil |
|
295 | 1559 |
! |
1560 |
||
1561 |
gcFor:aDrawableId |
|
132 | 1562 |
|
1563 |
%{ /* NOCONTEXT */ |
|
555 | 1564 |
int screen = __intVal(__INST(screen)); |
295 | 1565 |
GC gc; |
1566 |
||
1567 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
1568 |
BEGIN_INTERRUPTSBLOCKED |
|
1569 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
|
1570 |
0L, (XGCValues *)0); |
|
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1571 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1572 |
#ifdef COUNT_RESOURCES |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1573 |
if (gc) |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1574 |
__cnt_gc++; |
1089 | 1575 |
#endif |
1576 |
||
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1577 |
END_INTERRUPTSBLOCKED |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1578 |
RETURN ( gc ? __MKOBJ(gc) : nil ); |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1579 |
} |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1580 |
%}. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1581 |
self primitiveFailed. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1582 |
^ nil |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1583 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1584 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1585 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1586 |
"with X, this is the same as a normal gc" |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1587 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1588 |
%{ /* NOCONTEXT */ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1589 |
int screen = __intVal(__INST(screen)); |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1590 |
GC gc; |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1591 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1592 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1593 |
BEGIN_INTERRUPTSBLOCKED |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1594 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1595 |
0L, (XGCValues *)0); |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1596 |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1597 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1598 |
if (gc) |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1599 |
__cnt_gc++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1600 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1601 |
|
295 | 1602 |
END_INTERRUPTSBLOCKED |
1603 |
RETURN ( gc ? __MKOBJ(gc) : nil ); |
|
200 | 1604 |
} |
1605 |
%}. |
|
1606 |
self primitiveFailed. |
|
1607 |
^ nil |
|
295 | 1608 |
! |
1609 |
||
1610 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 1611 |
|
1612 |
%{ /* UNLIMITEDSTACK */ |
|
1613 |
||
295 | 1614 |
Display *dpy = myDpy; |
555 | 1615 |
int screen = __intVal(__INST(screen)); |
295 | 1616 |
Pixmap newBitmap; |
1617 |
unsigned int b_width, b_height; |
|
1618 |
REGISTER unsigned char *cp; |
|
1619 |
REGISTER unsigned char *pBits; |
|
1620 |
unsigned char *b_bits, *allocatedBits; |
|
1621 |
int index, row; |
|
1622 |
REGISTER int col; |
|
1623 |
unsigned bits; |
|
1624 |
static char reverseBitTable[256]; |
|
1625 |
static firstCall = 1; |
|
1626 |
int nBytes; |
|
1627 |
unsigned char fastBits[10000]; |
|
1628 |
OBJ num, *op; |
|
1629 |
int bytesPerRow; |
|
1630 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1631 |
if (! ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1632 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1633 |
} |
295 | 1634 |
if (firstCall) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1635 |
for (index=0; index < 256; index++) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1636 |
reverseBitTable[index] = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1637 |
if (index & 128) reverseBitTable[index] |= 1; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1638 |
if (index & 64) reverseBitTable[index] |= 2; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1639 |
if (index & 32) reverseBitTable[index] |= 4; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1640 |
if (index & 16) reverseBitTable[index] |= 8; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1641 |
if (index & 8) reverseBitTable[index] |= 16; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1642 |
if (index & 4) reverseBitTable[index] |= 32; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1643 |
if (index & 2) reverseBitTable[index] |= 64; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1644 |
if (index & 1) reverseBitTable[index] |= 128; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1645 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1646 |
firstCall = 0; |
295 | 1647 |
} |
1648 |
||
1649 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1650 |
newBitmap = (Pixmap)0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1651 |
b_width = __intVal(w); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1652 |
b_height = __intVal(h); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1653 |
bytesPerRow = (b_width + 7) / 8; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1654 |
nBytes = b_height * bytesPerRow; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1655 |
if (nBytes < sizeof(fastBits)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1656 |
cp = b_bits = fastBits; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1657 |
allocatedBits = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1658 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1659 |
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
|
1660 |
if (! cp) goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1661 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1662 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1663 |
if (__qClass(anArray) == @global(Array)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1664 |
index = 1; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1665 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1666 |
for (row = b_height; row; row--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1667 |
for (col = bytesPerRow; col; col--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1668 |
num = *op++; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1669 |
if (! __isSmallInteger(num)) goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1670 |
bits = __intVal(num); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1671 |
*cp++ = reverseBitTable[bits]; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1672 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1673 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1674 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1675 |
if (__qClass(anArray) == @global(ByteArray)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1676 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1677 |
for (col = b_height*bytesPerRow; col; col--) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1678 |
*cp++ = reverseBitTable[*pBits++]; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1679 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1680 |
} else { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1681 |
goto fail; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1682 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1683 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1684 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1685 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1686 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1687 |
(char *)b_bits, |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1688 |
b_width, b_height); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1689 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1690 |
if (newBitmap) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1691 |
__cnt_bitmap++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1692 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1693 |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1694 |
END_INTERRUPTSBLOCKED |
295 | 1695 |
fail: ; |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1696 |
if (allocatedBits) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1697 |
free(allocatedBits); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1698 |
RETURN ( newBitmap ? __MKOBJ(newBitmap) : nil ); |
0 | 1699 |
} |
1700 |
%} |
|
295 | 1701 |
! |
1702 |
||
1703 |
realRootWindowFor:aView |
|
1704 |
"the name of this method is historic; |
|
1705 |
- it will vanish" |
|
1706 |
||
1707 |
|id| |
|
1708 |
||
1709 |
id := self realRootWindowId. |
|
1710 |
self addKnownView:aView withId:id. |
|
1711 |
^ id |
|
1712 |
! |
|
1713 |
||
1714 |
realRootWindowId |
|
1715 |
"return the id of the real root window. |
|
1716 |
This may not be the window you see as background, |
|
1717 |
since some window managers install a virtual root window on top |
|
1718 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
1719 |
care of any virtual root." |
|
0 | 1720 |
|
1721 |
%{ /* NOCONTEXT */ |
|
1722 |
||
555 | 1723 |
int screen = __intVal(__INST(screen)); |
295 | 1724 |
Window root; |
1725 |
OBJ id; |
|
1726 |
||
555 | 1727 |
if (__INST(rootId) != nil) { |
1728 |
RETURN (__INST(rootId)); |
|
295 | 1729 |
} |
0 | 1730 |
|
150 | 1731 |
if (ISCONNECTED) { |
295 | 1732 |
root = RootWindow(myDpy, screen); |
1733 |
if (! root) { |
|
1734 |
id = nil; |
|
1735 |
} else { |
|
555 | 1736 |
__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
|
1737 |
} |
295 | 1738 |
RETURN (id); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1739 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1740 |
%}. |
295 | 1741 |
self primitiveFailed |
1742 |
! |
|
1743 |
||
1744 |
rootWindowFor:aView |
|
1745 |
|id| |
|
1746 |
||
1747 |
id := self rootWindowId. |
|
1748 |
self addKnownView:aView withId:id. |
|
0 | 1749 |
^ id |
1750 |
! |
|
1751 |
||
295 | 1752 |
rootWindowId |
1753 |
"return the id of the root window. |
|
1754 |
This is the window you see as background, |
|
1755 |
however, it may or may not be the real physical root window, |
|
1756 |
since some window managers install a virtual root window on top |
|
1757 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 1758 |
|
0 | 1759 |
%{ /* NOCONTEXT */ |
555 | 1760 |
int screen = __intVal(__INST(screen)); |
295 | 1761 |
Window rootWin, vRootWin; |
1762 |
OBJ id; |
|
1763 |
||
555 | 1764 |
if (__INST(virtualRootId) != nil) { |
1765 |
RETURN (__INST(virtualRootId)); |
|
295 | 1766 |
} |
0 | 1767 |
|
169 | 1768 |
if (ISCONNECTED) { |
295 | 1769 |
vRootWin = rootWin = RootWindow(myDpy, screen); |
1770 |
#ifndef IRIS |
|
180 | 1771 |
BEGIN_INTERRUPTSBLOCKED |
295 | 1772 |
/* |
1773 |
* on IRIS, this creates a badwindow error - why ? |
|
1774 |
* children contains a funny window (000034) |
|
1775 |
*/ |
|
1776 |
||
1777 |
/* |
|
1778 |
* care for virtual root windows (tvtwm & friends) |
|
1779 |
*/ |
|
1780 |
{ |
|
1781 |
Atom vRootAtom = None; |
|
1782 |
int i; |
|
1783 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
1784 |
Window* children = (Window *)0; |
295 | 1785 |
unsigned int numChildren; |
1786 |
||
1787 |
if (XQueryTree(myDpy, rootWin, |
|
1788 |
&rootReturn, &parentReturn, |
|
1789 |
&children, &numChildren)) { |
|
1790 |
vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True ); |
|
1791 |
if (vRootAtom != None) { |
|
1792 |
for (i=0; i < numChildren; i++) { |
|
1793 |
Atom actual_type; |
|
1794 |
int actual_format; |
|
1795 |
unsigned long nitems, bytesafter; |
|
1796 |
Window* newRoot = (Window*) 0; |
|
1797 |
||
1798 |
if (children[i]) { |
|
1799 |
if (XGetWindowProperty(myDpy, children[i], vRootAtom, |
|
1800 |
0L, 1L, False, XA_WINDOW, |
|
1801 |
&actual_type, &actual_format, |
|
1802 |
&nitems, &bytesafter, |
|
1803 |
(unsigned char**) &newRoot |
|
1804 |
) == Success && newRoot) { |
|
1805 |
vRootWin = *newRoot; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
1806 |
XFree(newRoot); /* XXX */ |
295 | 1807 |
break; |
1808 |
} |
|
1809 |
} |
|
1810 |
} |
|
1811 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
1812 |
if (children) XFree( children ); |
295 | 1813 |
} |
1814 |
} |
|
180 | 1815 |
END_INTERRUPTSBLOCKED |
295 | 1816 |
#endif |
1817 |
} |
|
1818 |
||
1819 |
/* cannot happen */ |
|
1820 |
if (! vRootWin) { |
|
1821 |
vRootWin = rootWin; |
|
1822 |
if (! rootWin) { |
|
1823 |
RETURN ( nil ); |
|
1824 |
} |
|
1825 |
} |
|
555 | 1826 |
__INST(rootId) = id = __MKOBJ(rootWin); __STORE(self, id); |
1827 |
__INST(virtualRootId) = id = __MKOBJ(vRootWin); __STORE(self, id); |
|
295 | 1828 |
RETURN ( id ); |
63 | 1829 |
%} |
0 | 1830 |
! ! |
1831 |
||
1832 |
!XWorkstation methodsFor:'color stuff'! |
|
1833 |
||
295 | 1834 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1835 |
"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
|
1836 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 1837 |
|
1838 |
%{ /* NOCONTEXT */ |
|
1839 |
||
1840 |
Display *dpy = myDpy; |
|
555 | 1841 |
int screen = __intVal(__INST(screen)); |
295 | 1842 |
XColor color; |
1843 |
unsigned long dummy; |
|
1844 |
Status ok; |
|
1845 |
||
1846 |
BEGIN_INTERRUPTSBLOCKED |
|
1847 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
|
1848 |
&dummy, 0, &color.pixel, 1); |
|
1849 |
END_INTERRUPTSBLOCKED |
|
1850 |
if (ok) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1851 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1852 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1853 |
#endif |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1854 |
RETURN ( __MKSMALLINT(color.pixel) ); |
0 | 1855 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1856 |
%}. |
43 | 1857 |
^ nil |
0 | 1858 |
! |
1859 |
||
1860 |
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
|
1861 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 1862 |
Dont use this method, colornames are mostly X specific" |
1863 |
||
1864 |
%{ /* NOCONTEXT */ |
|
1865 |
||
1866 |
char *colorname; |
|
1867 |
Display *dpy = myDpy; |
|
1868 |
XColor scolor, ecolor; |
|
555 | 1869 |
int screen = __intVal(__INST(screen)); |
850 | 1870 |
int id; |
54 | 1871 |
Status ok; |
0 | 1872 |
|
150 | 1873 |
if (ISCONNECTED) { |
850 | 1874 |
if (__isString(aString) || __isSymbol(aString)) { |
1875 |
colorname = (char *)_stringVal(aString); |
|
1876 |
||
1877 |
BEGIN_INTERRUPTSBLOCKED |
|
1878 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
|
1879 |
if (ok) { |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
1880 |
#ifdef QUICK_TRUE_COLORS |
850 | 1881 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1882 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
1883 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
1884 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
1885 |
RETURN ( __MKSMALLINT(id) ); |
|
1886 |
} |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
1887 |
#endif |
850 | 1888 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
1889 |
} |
|
1890 |
END_INTERRUPTSBLOCKED |
|
1891 |
if (! ok) { |
|
1892 |
RETURN ( nil ); |
|
1893 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1894 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1895 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1896 |
#endif |
850 | 1897 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
1898 |
} |
|
0 | 1899 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1900 |
%}. |
43 | 1901 |
self primitiveFailed. |
1902 |
^ nil |
|
0 | 1903 |
! |
1904 |
||
295 | 1905 |
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
|
1906 |
"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
|
1907 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
295 | 1908 |
|
1909 |
|r g b| |
|
1910 |
||
1911 |
r := self percentToXColorValue:redVal. |
|
1912 |
g := self percentToXColorValue:greenVal. |
|
1913 |
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
|
1914 |
^ 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
|
1915 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1916 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1917 |
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
|
1918 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
295 | 1919 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1920 |
Display *dpy; |
295 | 1921 |
XColor ecolor; |
555 | 1922 |
int screen = __intVal(__INST(screen)); |
295 | 1923 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1924 |
int id; |
295 | 1925 |
|
1926 |
if (__bothSmallInteger(r, g) |
|
1927 |
&& __isSmallInteger(b) |
|
1928 |
&& ISCONNECTED) { |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1929 |
ecolor.red = __intVal(r); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1930 |
ecolor.green= __intVal(g); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1931 |
ecolor.blue = __intVal(b); |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1932 |
#ifdef QUICK_TRUE_COLORS |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1933 |
if (__INST(visualType) == @symbol(TrueColor)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1934 |
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
|
1935 |
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
|
1936 |
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
|
1937 |
RETURN ( __MKSMALLINT(id) ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1938 |
} |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1939 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1940 |
dpy = myDpy; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1941 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1942 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1943 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1944 |
if (! ok) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1945 |
RETURN ( nil ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1946 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1947 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1948 |
__cnt_color++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1949 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1950 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
295 | 1951 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1952 |
%}. |
295 | 1953 |
self primitiveFailed. |
1954 |
^ nil |
|
1955 |
! |
|
1956 |
||
1957 |
freeColor:colorIndex |
|
1958 |
"free a display color when its no longer needed" |
|
0 | 1959 |
|
1960 |
%{ /* NOCONTEXT */ |
|
1961 |
||
1962 |
Display *dpy = myDpy; |
|
295 | 1963 |
unsigned long color; |
555 | 1964 |
int screen = __intVal(__INST(screen)); |
295 | 1965 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1966 |
#ifdef QUICK_TRUE_COLORS |
555 | 1967 |
if (__INST(visualType) == @symbol(TrueColor)) { |
850 | 1968 |
/* no need to do anything on TrueColor displays ... */ |
1969 |
RETURN (self); |
|
295 | 1970 |
} |
1971 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
1972 |
|
295 | 1973 |
if (__isSmallInteger(colorIndex) && ISCONNECTED) { |
850 | 1974 |
color = (long) __intVal(colorIndex); |
1975 |
BEGIN_INTERRUPTSBLOCKED |
|
1976 |
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
|
1977 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
1978 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1979 |
#endif |
850 | 1980 |
END_INTERRUPTSBLOCKED |
1981 |
RETURN ( self ); |
|
0 | 1982 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1983 |
%}. |
295 | 1984 |
self primitiveFailed |
1985 |
! |
|
1986 |
||
1987 |
getRGBFrom:index into:aBlock |
|
1988 |
"get rgb components (0..100) of color in map at:index, |
|
1989 |
and evaluate the 3-arg block, aBlock with them" |
|
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 |
|val| |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1992 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1993 |
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
|
1994 |
val := aBlock |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1995 |
value:(r * 100.0 / 16rFFFF) |
850 | 1996 |
value:(g * 100.0 / 16rFFFF) |
1997 |
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
|
1998 |
]. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
1999 |
^ val |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2000 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2001 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2002 |
getRGBFromName:colorName into:aBlock |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2003 |
"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
|
2004 |
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
|
2005 |
|val| |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2006 |
|
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2007 |
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
|
2008 |
r isNil ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2009 |
^ super getRGBFromName:colorName into:aBlock |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2010 |
]. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2011 |
val := aBlock |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2012 |
value:(r * 100.0 / 16rFFFF) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2013 |
value:(g * 100.0 / 16rFFFF) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2014 |
value:(b * 100.0 / 16rFFFF) |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2015 |
]. |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2016 |
^ val |
1056 | 2017 |
|
2018 |
"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
|
2019 |
! |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2020 |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2021 |
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
|
2022 |
"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
|
2023 |
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
|
2024 |
|
295 | 2025 |
|r g b| |
2026 |
%{ |
|
2027 |
Display *dpy = myDpy; |
|
555 | 2028 |
int screen = __intVal(__INST(screen)); |
295 | 2029 |
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
|
2030 |
int sr, sg, sb; |
295 | 2031 |
int bits, scale, shift; |
2032 |
||
2033 |
if (__isSmallInteger(index)) { |
|
555 | 2034 |
color.pixel = __intVal(index); |
295 | 2035 |
BEGIN_INTERRUPTSBLOCKED |
2036 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
|
2037 |
END_INTERRUPTSBLOCKED |
|
2038 |
||
2039 |
/* |
|
2040 |
* have to compensate for an error in X ?, which does not scale |
|
2041 |
* colors correctly if lesser than 16bits are valid in a color, |
|
2042 |
* (for example, color white on a 4bitsPerRGB server will return |
|
2043 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
|
2044 |
*/ |
|
555 | 2045 |
bits = __intVal(__INST(bitsPerRGB)); |
295 | 2046 |
scale = (1<<bits) - 1; |
2047 |
shift = 16 - bits; |
|
2048 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2049 |
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
|
2050 |
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
|
2051 |
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
|
2052 |
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
|
2053 |
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
|
2054 |
b = __MKSMALLINT(sb); |
295 | 2055 |
} |
2056 |
%}. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2057 |
^ aBlock value:r value:g value:b |
295 | 2058 |
! |
2059 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2060 |
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
|
2061 |
"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
|
2062 |
and evaluate the 3-arg block, aBlock with them" |
295 | 2063 |
|
2064 |
|r g b| |
|
2065 |
||
2066 |
displayId isNil ifTrue:[ |
|
2067 |
self pimitiveFailed. |
|
2068 |
^ nil |
|
2069 |
]. |
|
2070 |
%{ |
|
2071 |
Display *dpy = myDpy; |
|
555 | 2072 |
int screen = __intVal(__INST(screen)); |
295 | 2073 |
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
|
2074 |
int sr, sg, sb; |
295 | 2075 |
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
|
2076 |
int bits, scale, shift; |
295 | 2077 |
|
2078 |
if (__isString(colorName) || __isSymbol(colorName)) { |
|
2079 |
BEGIN_INTERRUPTSBLOCKED |
|
2080 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
|
2081 |
(char *)_stringVal(colorName), &color)) { |
|
2082 |
/* |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2083 |
* 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
|
2084 |
* 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
|
2085 |
* (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
|
2086 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
295 | 2087 |
*/ |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2088 |
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
|
2089 |
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
|
2090 |
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
|
2091 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2092 |
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
|
2093 |
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
|
2094 |
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
|
2095 |
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
|
2096 |
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
|
2097 |
b = __MKSMALLINT(sb); |
295 | 2098 |
} |
2099 |
END_INTERRUPTSBLOCKED |
|
2100 |
} |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2101 |
%}. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2102 |
^ aBlock value:r value:g value:b |
295 | 2103 |
! |
2104 |
||
2105 |
listOfAvailableColors |
|
2106 |
"return a list of all available colornames. |
|
2107 |
This should not be used, since colornames are very |
|
2108 |
display-specific (here X-specific)." |
|
2109 |
||
2110 |
|aStream list line index colorName| |
|
2111 |
||
2112 |
aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'. |
|
2113 |
aStream isNil ifTrue:[^ nil]. |
|
2114 |
list := OrderedCollection new. |
|
2115 |
[aStream atEnd] whileFalse:[ |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2116 |
line := aStream nextLine. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2117 |
line notNil ifTrue:[ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2118 |
"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
|
2119 |
index := 1. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2120 |
[(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
|
2121 |
[(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
|
2122 |
[(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
|
2123 |
[(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
|
2124 |
[(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
|
2125 |
[(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
|
2126 |
[(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
|
2127 |
colorName := line copyFrom:index. |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2128 |
((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
|
2129 |
list add:colorName |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2130 |
] |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
2131 |
] |
295 | 2132 |
]. |
2133 |
aStream close. |
|
2134 |
^ list sort |
|
1047 | 2135 |
|
2136 |
" |
|
2137 |
Screen current listOfAvailableColors |
|
2138 |
" |
|
2139 |
||
2140 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2141 |
! |
2142 |
||
2143 |
percentToXColorValue:aPercentage |
|
2144 |
"given a color-component value in percent (0..100), return the corresponding |
|
2145 |
x-component value (0..65k) as an integer" |
|
2146 |
||
2147 |
%{ /* NOCONTEXT */ |
|
2148 |
||
2149 |
if (__isSmallInteger(aPercentage)) { |
|
555 | 2150 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2151 |
} |
2152 |
if (__isFloat(aPercentage)) { |
|
555 | 2153 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2154 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2155 |
%}. |
295 | 2156 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2157 |
! |
2158 |
||
892 | 2159 |
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
|
2160 |
"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
|
2161 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2162 |
|
2163 |
%{ /* NOCONTEXT */ |
|
2164 |
||
2165 |
char *colorname; |
|
2166 |
Display *dpy = myDpy; |
|
2167 |
XColor color; |
|
555 | 2168 |
int screen = __intVal(__INST(screen)); |
0 | 2169 |
int r, g, b; |
2170 |
int ok = 1; |
|
2171 |
||
892 | 2172 |
if (__isSmallInteger(sred)) |
2173 |
r = __intVal(sred); |
|
0 | 2174 |
else ok = 0; |
2175 |
||
892 | 2176 |
if (__isSmallInteger(sgreen)) |
2177 |
g = __intVal(sgreen); |
|
0 | 2178 |
else ok = 0; |
2179 |
||
892 | 2180 |
if (__isSmallInteger(sblue)) |
2181 |
b = __intVal(sblue); |
|
0 | 2182 |
else ok = 0; |
2183 |
||
97 | 2184 |
if (__isSmallInteger(index) && ok) { |
555 | 2185 |
color.pixel = __intVal(index); |
70 | 2186 |
color.red = r; |
2187 |
color.green = g; |
|
2188 |
color.blue = b; |
|
2189 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2190 |
||
2191 |
BEGIN_INTERRUPTSBLOCKED |
|
2192 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
|
2193 |
END_INTERRUPTSBLOCKED |
|
2194 |
RETURN ( self ); |
|
0 | 2195 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2196 |
%}. |
0 | 2197 |
self primitiveFailed |
295 | 2198 |
! ! |
2199 |
||
2200 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2201 |
||
2202 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
|
2203 |
"change a cursors colors" |
|
2204 |
||
2205 |
|fgR fgG fgB bgR bgG bgB| |
|
2206 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2207 |
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
|
2208 |
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
|
2209 |
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
|
2210 |
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
|
2211 |
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
|
2212 |
bgB := bgColor scaledBlue. |
0 | 2213 |
%{ |
295 | 2214 |
XColor fgcolor, bgcolor; |
2215 |
||
2216 |
if (__isExternalAddress(aCursorId) |
|
2217 |
&& __bothSmallInteger(fgG, fgB) |
|
2218 |
&& __bothSmallInteger(bgR, bgG) |
|
2219 |
&& __bothSmallInteger(bgB, fgR)) { |
|
2220 |
||
555 | 2221 |
fgcolor.red = __intVal(fgR); |
2222 |
fgcolor.green= __intVal(fgG); |
|
2223 |
fgcolor.blue = __intVal(fgB); |
|
2224 |
bgcolor.red = __intVal(bgR); |
|
2225 |
bgcolor.green= __intVal(bgG); |
|
2226 |
bgcolor.blue = __intVal(bgB); |
|
70 | 2227 |
BEGIN_INTERRUPTSBLOCKED |
295 | 2228 |
XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); |
72 | 2229 |
END_INTERRUPTSBLOCKED |
2230 |
RETURN ( self ); |
|
2231 |
} |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2232 |
%}. |
0 | 2233 |
self primitiveFailed |
70 | 2234 |
! |
2235 |
||
295 | 2236 |
createCursorShape:aShape |
974 | 2237 |
"create a cursor given a shape-symbol. This only works |
2238 |
for a few standard cursors, and returns nil if no such cursor exists. |
|
2239 |
Always care for a fallBack, in case of a nil return." |
|
295 | 2240 |
|
2241 |
|number id| |
|
2242 |
||
2243 |
displayId isNil ifTrue:[ |
|
2244 |
self primitiveFailed. |
|
2245 |
^ nil |
|
2246 |
]. |
|
2247 |
number := self shapeNumberFromSymbol:aShape. |
|
2248 |
%{ |
|
2249 |
Cursor newCursor; |
|
2250 |
||
2251 |
if (__isSmallInteger(number)) { |
|
2252 |
BEGIN_INTERRUPTSBLOCKED |
|
555 | 2253 |
newCursor = XCreateFontCursor(myDpy, __intVal(number)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2254 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2255 |
if (newCursor) |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2256 |
__cnt_cursor++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2257 |
#endif |
295 | 2258 |
END_INTERRUPTSBLOCKED |
2259 |
if (newCursor != (Cursor)0) { |
|
2260 |
id = __MKOBJ(newCursor); |
|
70 | 2261 |
} |
0 | 2262 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2263 |
%}. |
295 | 2264 |
^ id |
2265 |
! |
|
2266 |
||
974 | 2267 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2268 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2269 |
||
2270 |
|id sourceId maskId| |
|
2271 |
||
2272 |
displayId isNil ifTrue:[ |
|
2273 |
self primitiveFailed. |
|
2274 |
^ nil |
|
2275 |
]. |
|
2276 |
sourceId := sourceForm id. |
|
2277 |
maskId := maskForm id. |
|
2278 |
%{ |
|
2279 |
Cursor newCursor; |
|
2280 |
XColor fgColor, bgColor; |
|
2281 |
||
2282 |
if (__isExternalAddress(sourceId) |
|
2283 |
&& __isExternalAddress(maskId) |
|
2284 |
&& __bothSmallInteger(hx, hy)) { |
|
2285 |
fgColor.red = 0; /* fg is black */ |
|
2286 |
fgColor.green = 0; |
|
2287 |
fgColor.blue = 0; |
|
2288 |
bgColor.red = 0xFFFF; /* bg is white */ |
|
2289 |
bgColor.green = 0xFFFF; |
|
2290 |
bgColor.blue = 0xFFFF; |
|
2291 |
||
2292 |
BEGIN_INTERRUPTSBLOCKED |
|
2293 |
newCursor = XCreatePixmapCursor(myDpy, |
|
2294 |
_PixmapVal(sourceId), |
|
2295 |
_PixmapVal(maskId), |
|
555 | 2296 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2297 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2298 |
if (newCursor) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2299 |
__cnt_cursor++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2300 |
#endif |
295 | 2301 |
END_INTERRUPTSBLOCKED |
2302 |
if (newCursor != (Cursor)0) { |
|
2303 |
id = __MKOBJ(newCursor); |
|
70 | 2304 |
} |
0 | 2305 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2306 |
%}. |
295 | 2307 |
^ id |
2308 |
! |
|
2309 |
||
2310 |
destroyCursor:aCursorId |
|
974 | 2311 |
"release a cursor - frees any device resources" |
0 | 2312 |
|
2313 |
%{ /* NOCONTEXT */ |
|
2314 |
||
295 | 2315 |
if (ISCONNECTED) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2316 |
if (__isExternalAddress(aCursorId)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2317 |
Cursor curs = _CursorVal(aCursorId); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2318 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2319 |
if (curs) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2320 |
BEGIN_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2321 |
XFreeCursor(myDpy, curs); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2322 |
#ifdef COUNT_RESOURCES |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2323 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2324 |
#endif |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2325 |
END_INTERRUPTSBLOCKED |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2326 |
} |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2327 |
RETURN ( self ); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
2328 |
} |
0 | 2329 |
} |
974 | 2330 |
%}. |
0 | 2331 |
self primitiveFailed |
295 | 2332 |
! |
2333 |
||
974 | 2334 |
needDeviceFormsForCursor |
2335 |
^ true |
|
2336 |
! |
|
2337 |
||
295 | 2338 |
shapeNumberFromSymbol:shape |
974 | 2339 |
"given a shape-symbol, return the corresponding cursor-number, |
2340 |
or nil if no such standard cursor exists." |
|
295 | 2341 |
|
2342 |
"this is pure X-knowlegde - but you may easily add more" |
|
2343 |
||
2344 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2345 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2346 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2347 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2348 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2349 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2350 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2351 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2352 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2353 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2354 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2355 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2356 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2357 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2358 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2359 |
((shape == #origin) |
|
2360 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2361 |
((shape == #corner) |
|
2362 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2363 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2364 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2365 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2366 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2367 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
1183 | 2368 |
|
2369 |
"/ ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL. |
|
974 | 2370 |
^ nil |
0 | 2371 |
! ! |
2372 |
||
2373 |
!XWorkstation methodsFor:'drawing'! |
|
2374 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2375 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2376 |
"do a bit-blt; copy bits from the rectangle defined by |
2377 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2378 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2379 |
argument is not integer." |
|
0 | 2380 |
|
2381 |
%{ /* NOCONTEXT */ |
|
2382 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2383 |
GC gc; |
0 | 2384 |
Drawable source, dest; |
2385 |
||
975 | 2386 |
if (__isExternalAddress(dstGCId) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2387 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2388 |
&& __isExternalAddress(destId) |
97 | 2389 |
&& __bothSmallInteger(w, h) |
2390 |
&& __bothSmallInteger(srcX, srcY) |
|
2391 |
&& __bothSmallInteger(dstX, dstY)) { |
|
975 | 2392 |
gc = _GCVal(dstGCId); |
70 | 2393 |
source = (Drawable) _WindowVal(sourceId); |
2394 |
dest = (Drawable) _WindowVal(destId); |
|
2395 |
XCopyArea(myDpy, source, dest, gc, |
|
555 | 2396 |
__intVal(srcX), __intVal(srcY), |
2397 |
__intVal(w), __intVal(h), |
|
2398 |
__intVal(dstX), __intVal(dstY)); |
|
70 | 2399 |
RETURN ( self ); |
0 | 2400 |
} |
118 | 2401 |
%}. |
2402 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2403 |
or any non integer coordinate" |
|
2404 |
||
0 | 2405 |
self primitiveFailed |
2406 |
! |
|
2407 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2408 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2409 |
"do a bit-blt, but only copy the low-bit plane; |
2410 |
copy bits from the rectangle defined by |
|
2411 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2412 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2413 |
argument is not integer." |
|
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; |
0 | 2418 |
Drawable source, dest; |
2419 |
||
975 | 2420 |
if (__isExternalAddress(dstGCId) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2421 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2422 |
&& __isExternalAddress(destId) |
97 | 2423 |
&& __bothSmallInteger(w, h) |
2424 |
&& __bothSmallInteger(srcX, srcY) |
|
2425 |
&& __bothSmallInteger(dstX, dstY)) { |
|
975 | 2426 |
gc = _GCVal(dstGCId); |
70 | 2427 |
source = (Drawable) _WindowVal(sourceId); |
2428 |
dest = (Drawable) _WindowVal(destId); |
|
2429 |
XCopyPlane(myDpy, source, dest, gc, |
|
555 | 2430 |
__intVal(srcX), __intVal(srcY), |
2431 |
__intVal(w), __intVal(h), |
|
2432 |
__intVal(dstX), __intVal(dstY), 1); |
|
70 | 2433 |
RETURN ( self ); |
0 | 2434 |
} |
118 | 2435 |
%}. |
2436 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2437 |
or any non integer coordinate" |
|
2438 |
||
0 | 2439 |
self primitiveFailed |
2440 |
! |
|
2441 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2442 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 2443 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
2444 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2445 |
|
2446 |
%{ /* NOCONTEXT */ |
|
2447 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2448 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2449 |
Window win; |
0 | 2450 |
int w, h, angle1, angle2; |
2451 |
double f; |
|
2452 |
||
97 | 2453 |
if (__isSmallInteger(startAngle)) |
850 | 2454 |
angle1 = __intVal(startAngle) * 64; |
36 | 2455 |
else if (__isFloat(startAngle)) { |
850 | 2456 |
f = __floatVal(startAngle); |
2457 |
angle1 = f * 64; |
|
0 | 2458 |
} |
97 | 2459 |
if (__isSmallInteger(angle)) |
850 | 2460 |
angle2 = __intVal(angle) * 64; |
36 | 2461 |
else if (__isFloat(angle)) { |
850 | 2462 |
f = __floatVal(angle); |
2463 |
angle2 = f * 64; |
|
0 | 2464 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2465 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2466 |
&& __isExternalAddress(aDrawableId) |
97 | 2467 |
&& __bothSmallInteger(x, y) |
2468 |
&& __bothSmallInteger(width, height)) { |
|
850 | 2469 |
win = _WindowVal(aDrawableId); |
2470 |
gc = _GCVal(aGCId); |
|
2471 |
w = __intVal(width); |
|
2472 |
h = __intVal(height); |
|
2473 |
/* |
|
2474 |
* need this check here: some servers simply dump core with bad args |
|
2475 |
*/ |
|
2476 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2477 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
|
2478 |
w, h, angle1, angle2); |
|
2479 |
} |
|
2480 |
RETURN ( self ); |
|
0 | 2481 |
} |
73 | 2482 |
%}. |
2483 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2484 |
self primitiveFailed |
2485 |
! |
|
2486 |
||
295 | 2487 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
2488 |
"draw a line. If the coordinates are not integers, an error is triggered." |
|
2489 |
||
2490 |
%{ /* NOCONTEXT */ |
|
2491 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2492 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2493 |
Window win; |
295 | 2494 |
|
2495 |
if (__isExternalAddress(aGCId) |
|
2496 |
&& __isExternalAddress(aDrawableId) |
|
2497 |
&& __bothSmallInteger(x0, y0) |
|
2498 |
&& __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
|
2499 |
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
|
2500 |
win = _WindowVal(aDrawableId); |
555 | 2501 |
XDrawLine(myDpy, win, gc, __intVal(x0), __intVal(y0), |
2502 |
__intVal(x1), __intVal(y1)); |
|
295 | 2503 |
RETURN ( self ); |
2504 |
} |
|
2505 |
%}. |
|
2506 |
"badGC, badDrawable or coordinates not integer" |
|
2507 |
self primitiveFailed |
|
2508 |
! |
|
2509 |
||
2510 |
displayPointX:x y:y in:aDrawableId with:aGCId |
|
2511 |
"draw a point. If x/y are not integers, an error is triggered." |
|
2512 |
||
2513 |
%{ /* NOCONTEXT */ |
|
2514 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2515 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2516 |
Window win; |
295 | 2517 |
|
2518 |
if (__isExternalAddress(aGCId) |
|
2519 |
&& __isExternalAddress(aDrawableId) |
|
2520 |
&& __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
|
2521 |
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
|
2522 |
win = _WindowVal(aDrawableId); |
555 | 2523 |
XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); |
295 | 2524 |
RETURN ( self ); |
2525 |
} |
|
2526 |
%}. |
|
2527 |
"badGC, badDrawable or x/y not integer" |
|
2528 |
self primitiveFailed |
|
2529 |
! |
|
2530 |
||
2531 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
2532 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
2533 |
define the polygon. |
|
2534 |
If any coordinate is not integer, an error is triggered." |
|
2535 |
||
2536 |
|numberOfPoints newPoints| |
|
2537 |
||
2538 |
numberOfPoints := aPolygon size. |
|
2539 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2540 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2541 |
Window win; |
295 | 2542 |
OBJ point, x, y; |
2543 |
int i, num; |
|
2544 |
XPoint *points; |
|
2545 |
XPoint qPoints[100]; |
|
377 | 2546 |
int mustFree = 0; |
295 | 2547 |
|
2548 |
if (__isExternalAddress(aGCId) |
|
2549 |
&& __isExternalAddress(aDrawableId) |
|
2550 |
&& __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
|
2551 |
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
|
2552 |
win = _WindowVal(aDrawableId); |
555 | 2553 |
num = __intVal(numberOfPoints); |
295 | 2554 |
/* |
2555 |
* avoid a (slow) malloc, if the number of points is small |
|
2556 |
*/ |
|
2557 |
if (num > 100) { |
|
2558 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
|
2559 |
if (! points) goto fail; |
|
377 | 2560 |
mustFree = 1; |
295 | 2561 |
} else |
2562 |
points = qPoints; |
|
2563 |
||
2564 |
for (i=0; i<num; i++) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
2565 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
295 | 2566 |
if (! __isPoint(point)) goto fail; |
2567 |
x = _point_X(point); |
|
2568 |
y = _point_Y(point); |
|
2569 |
if (! __bothSmallInteger(x, y)) |
|
2570 |
goto fail; |
|
555 | 2571 |
points[i].x = __intVal(x); |
2572 |
points[i].y = __intVal(y); |
|
295 | 2573 |
} |
2574 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
|
377 | 2575 |
if (mustFree) |
295 | 2576 |
free(points); |
2577 |
RETURN ( self ); |
|
2578 |
} |
|
2579 |
fail: ; |
|
377 | 2580 |
if (mustFree) |
382 | 2581 |
free(points); |
295 | 2582 |
%}. |
2583 |
"badGC, badDrawable or coordinates not integer" |
|
2584 |
self primitiveFailed |
|
2585 |
! |
|
2586 |
||
2587 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
2588 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
|
2589 |
||
2590 |
%{ /* NOCONTEXT */ |
|
2591 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2592 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2593 |
Window win; |
295 | 2594 |
int w, h; |
2595 |
||
2596 |
if (__isExternalAddress(aGCId) |
|
2597 |
&& __isExternalAddress(aDrawableId) |
|
2598 |
&& __bothSmallInteger(x, y) |
|
2599 |
&& __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
|
2600 |
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
|
2601 |
win = _WindowVal(aDrawableId); |
555 | 2602 |
w = __intVal(width); |
2603 |
h = __intVal(height); |
|
295 | 2604 |
/* |
2605 |
* need this check here: some servers simply dump core with bad args |
|
2606 |
*/ |
|
2607 |
if ((w >= 0) && (h >= 0)) { |
|
555 | 2608 |
XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h); |
295 | 2609 |
} |
2610 |
RETURN ( self ); |
|
2611 |
} |
|
2612 |
%}. |
|
2613 |
"badGC, badDrawable or coordinates not integer" |
|
2614 |
self primitiveFailed |
|
2615 |
! |
|
2616 |
||
2617 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2618 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
|
2619 |
foreground and background characters. |
|
2620 |
If the coordinates are not integers, an error is triggered." |
|
2621 |
||
2622 |
%{ /* NOCONTEXT */ |
|
2623 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2624 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2625 |
Window win; |
295 | 2626 |
unsigned char *cp; |
2627 |
OBJ cls; |
|
2628 |
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
|
2629 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2630 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2631 |
int nInstBytes; |
295 | 2632 |
|
2633 |
if (__isExternalAddress(aGCId) |
|
2634 |
&& __isExternalAddress(aDrawableId) |
|
2635 |
&& __isNonNilObject(aString) |
|
2636 |
&& __bothSmallInteger(index1, index2) |
|
2637 |
&& __bothSmallInteger(x, y)) { |
|
850 | 2638 |
gc = _GCVal(aGCId); |
2639 |
win = _WindowVal(aDrawableId); |
|
2640 |
cls = __qClass(aString); |
|
2641 |
||
2642 |
i1 = __intVal(index1) - 1; |
|
2643 |
if (i1 >= 0) { |
|
2644 |
i2 = __intVal(index2) - 1; |
|
2645 |
if (i2 < i1) { |
|
2646 |
RETURN (self); |
|
2647 |
} |
|
2648 |
||
2649 |
cp = _stringVal(aString); |
|
2650 |
l = i2 - i1 + 1; |
|
2651 |
||
2652 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2653 |
n = _stringSize(aString); |
|
2654 |
if (i2 < n) { |
|
2655 |
cp += i1; |
|
2656 |
if (l > 1000) l = 1000; |
|
2657 |
if (opaque == true) |
|
2658 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2659 |
else |
|
2660 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2661 |
RETURN ( self ); |
|
2662 |
} |
|
2663 |
} |
|
2664 |
||
2665 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
2666 |
cp += nInstBytes; |
|
2667 |
||
2668 |
if (__isBytes(aString)) { |
|
2669 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
2670 |
||
2671 |
if (i2 < n) { |
|
2672 |
cp += i1; |
|
2673 |
if (l > 1000) l = 1000; |
|
2674 |
if (opaque == true) |
|
2675 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2676 |
else |
|
2677 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l); |
|
2678 |
RETURN ( self ); |
|
2679 |
} |
|
2680 |
} |
|
2681 |
||
2682 |
/* TWOBYTESTRINGS */ |
|
2683 |
if (__isWords(aString)) { |
|
2684 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
2685 |
||
2686 |
if (i2 < n) { |
|
2687 |
union { |
|
2688 |
char b[2]; |
|
2689 |
unsigned short s; |
|
2690 |
} u; |
|
2691 |
int i; |
|
2692 |
XChar2b *cp2 = (XChar2b *)0; |
|
2693 |
int mustFree = 0; |
|
2694 |
||
2695 |
cp += (i1 * 2); |
|
2696 |
if (l > 1000) l = 1000; |
|
2697 |
||
2698 |
/* |
|
2699 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
2700 |
* X expects them MSB first |
|
2701 |
* convert as required |
|
2702 |
*/ |
|
2703 |
||
2704 |
u.s = 0x1234; |
|
2705 |
if (u.b[0] != 0x12) { |
|
2706 |
if (l <= NLOCALBUFFER) { |
|
2707 |
cp2 = xlatebuffer; |
|
2708 |
} else { |
|
2709 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
2710 |
mustFree = 1; |
|
2711 |
} |
|
2712 |
for (i=0; i<l; i++) { |
|
2713 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
2714 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
2715 |
} |
|
2716 |
cp = (char *) cp2; |
|
2717 |
} |
|
2718 |
||
2719 |
if (opaque == true) |
|
2720 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
2721 |
else |
|
2722 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
2723 |
||
2724 |
if (mustFree) { |
|
2725 |
free(cp2); |
|
2726 |
} |
|
2727 |
||
2728 |
RETURN ( self ); |
|
2729 |
} |
|
2730 |
} |
|
2731 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2732 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2733 |
#undef NLOCALBUFFER |
295 | 2734 |
%}. |
2735 |
"x/y not integer, badGC or drawable, or not a string" |
|
2736 |
self primitiveFailed |
|
2737 |
! |
|
2738 |
||
2739 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
2740 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
|
2741 |
foreground and background characters. |
|
2742 |
If the coordinates are not integers, an error is triggered." |
|
2743 |
||
2744 |
%{ /* NOCONTEXT */ |
|
2745 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2746 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2747 |
Window win; |
295 | 2748 |
unsigned char *cp; |
2749 |
int n; |
|
2750 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2751 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2752 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
2753 |
int nInstBytes; |
295 | 2754 |
|
2755 |
if (__isExternalAddress(aGCId) |
|
2756 |
&& __isExternalAddress(aDrawableId) |
|
2757 |
&& __isNonNilObject(aString) |
|
2758 |
&& __bothSmallInteger(x, y)) { |
|
850 | 2759 |
gc = _GCVal(aGCId); |
2760 |
win = _WindowVal(aDrawableId); |
|
2761 |
cls = __qClass(aString); |
|
2762 |
||
2763 |
cp = _stringVal(aString); |
|
2764 |
||
2765 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2766 |
n = _stringSize(aString); |
|
2767 |
if (n > 1000) n = 1000; |
|
2768 |
if (opaque == true) |
|
2769 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2770 |
else |
|
2771 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2772 |
RETURN ( self ); |
|
2773 |
} |
|
2774 |
||
2775 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
2776 |
cp += nInstBytes; |
|
2777 |
||
2778 |
if (__isBytes(aString)) { |
|
2779 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
2780 |
||
2781 |
if (n > 1000) n = 1000; |
|
2782 |
if (opaque == true) |
|
2783 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2784 |
else |
|
2785 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n); |
|
2786 |
RETURN ( self ); |
|
2787 |
} |
|
2788 |
||
2789 |
/* TWOBYTESTRINGS */ |
|
2790 |
if (__isWords(aString)) { |
|
2791 |
union { |
|
2792 |
char b[2]; |
|
2793 |
unsigned short s; |
|
2794 |
} u; |
|
2795 |
int i; |
|
2796 |
XChar2b *cp2; |
|
2797 |
int mustFree = 0; |
|
2798 |
||
2799 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
2800 |
if (n > 1000) n = 1000; |
|
2801 |
||
2802 |
/* |
|
2803 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
2804 |
* X expects them MSB first |
|
2805 |
* convert as required |
|
2806 |
*/ |
|
2807 |
||
2808 |
u.s = 0x1234; |
|
2809 |
if (u.b[0] != 0x12) { |
|
2810 |
if (n <= NLOCALBUFFER) { |
|
2811 |
cp2 = xlatebuffer; |
|
2812 |
} else { |
|
2813 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
2814 |
mustFree = 1; |
|
2815 |
} |
|
2816 |
||
2817 |
for (i=0; i<n; i++) { |
|
2818 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
2819 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
2820 |
} |
|
2821 |
cp = (char *) cp2; |
|
2822 |
} |
|
2823 |
||
2824 |
if (opaque == true) |
|
2825 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
2826 |
else |
|
2827 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
2828 |
||
2829 |
||
2830 |
if (mustFree) { |
|
2831 |
free(cp2); |
|
2832 |
} |
|
2833 |
||
2834 |
RETURN ( self ); |
|
2835 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
2836 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
2837 |
#undef NLOCALBUFFER |
295 | 2838 |
%}. |
2839 |
"x/y not integer, badGC or drawable, or not a string" |
|
2840 |
self primitiveFailed |
|
2841 |
! |
|
2842 |
||
2843 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
2844 |
width:imageWidth height:imageHeight |
|
2845 |
x:srcx y:srcy |
|
2846 |
into:aDrawableId |
|
2847 |
x:dstx y:dsty |
|
2848 |
width:w height:h |
|
2849 |
with:aGCId |
|
2850 |
||
2851 |
"draw a bitImage which has depth id, width iw and height ih into |
|
2852 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
2853 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
2854 |
depth and pixel-units to be different. |
|
2855 |
It has to be checked elsewhere, that the server can do it with the given |
|
2856 |
depth - otherwise, primitive failure will be signalled. |
|
2857 |
Also it is assumed, that the colormap is setup correctly and the |
|
2858 |
colors are allocated - otherwise the colors may be wrong." |
|
2859 |
||
2860 |
" |
|
2861 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
2862 |
an unlimited stack, and thus cannot send primitiveFailed |
|
2863 |
" |
|
2864 |
(self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
2865 |
width:imageWidth height:imageHeight |
|
2866 |
x:srcx y:srcy |
|
2867 |
into:aDrawableId |
|
2868 |
x:dstx y:dsty |
|
2869 |
width:w height:h |
|
2870 |
with:aGCId) |
|
2871 |
ifFalse:[ |
|
2872 |
" |
|
2873 |
also happens, if a segmentation violation occurs in the |
|
2874 |
XPutImage ... |
|
2875 |
" |
|
2876 |
self primitiveFailed |
|
2877 |
]. |
|
2878 |
! |
|
2879 |
||
2880 |
drawBits:imageBits depth:imageDepth |
|
2881 |
width:imageWidth height:imageHeight |
|
2882 |
x:srcx y:srcy |
|
2883 |
into:aDrawableId |
|
2884 |
x:dstx y:dsty |
|
2885 |
width:w height:h |
|
2886 |
with:aGCId |
|
2887 |
||
2888 |
"draw a bitImage which has depth id, width iw and height ih into |
|
2889 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
2890 |
Individual source pixels must have imageDepth bits. |
|
2891 |
It has to be checked elsewhere, that the server can do it with the given |
|
2892 |
depth - otherwise, primitive failure will be signalled. |
|
2893 |
Also it is assumed, that the colormap is setup correctly and the |
|
2894 |
colors are allocated - otherwise the colors may be wrong." |
|
2895 |
||
2896 |
^ self drawBits:imageBits bitsPerPixel:imageDepth depth:imageDepth |
|
2897 |
width:imageWidth height:imageHeight |
|
2898 |
x:srcx y:srcy |
|
2899 |
into:aDrawableId |
|
2900 |
x:dstx y:dsty |
|
2901 |
width:w height:h |
|
2902 |
with:aGCId |
|
2903 |
||
2904 |
! |
|
2905 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2906 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
850 | 2907 |
in:aDrawableId with:aGCId |
90 | 2908 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
2909 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2910 |
|
2911 |
%{ /* NOCONTEXT */ |
|
2912 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2913 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2914 |
Window win; |
0 | 2915 |
int w, h, angle1, angle2; |
2916 |
double f; |
|
2917 |
||
97 | 2918 |
if (__isSmallInteger(startAngle)) |
850 | 2919 |
angle1 = __intVal(startAngle) * 64; |
36 | 2920 |
else if (__isFloat(startAngle)) { |
850 | 2921 |
f = __floatVal(startAngle); |
2922 |
angle1 = f * 64; |
|
0 | 2923 |
} |
97 | 2924 |
if (__isSmallInteger(angle)) |
850 | 2925 |
angle2 = __intVal(angle) * 64; |
36 | 2926 |
else if (__isFloat(angle)) { |
850 | 2927 |
f = __floatVal(angle); |
2928 |
angle2 = f * 64; |
|
0 | 2929 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2930 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2931 |
&& __isExternalAddress(aDrawableId) |
97 | 2932 |
&& __bothSmallInteger(x, y) |
2933 |
&& __bothSmallInteger(width, height)) { |
|
850 | 2934 |
gc = _GCVal(aGCId); |
2935 |
win = _WindowVal(aDrawableId); |
|
2936 |
w = __intVal(width); |
|
2937 |
h = __intVal(height); |
|
2938 |
/* |
|
2939 |
* need this check here: some servers simply dump core with bad args |
|
2940 |
*/ |
|
2941 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2942 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
|
2943 |
w, h, angle1, angle2); |
|
2944 |
} |
|
2945 |
RETURN ( self ); |
|
0 | 2946 |
} |
73 | 2947 |
%}. |
2948 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 2949 |
self primitiveFailed |
2950 |
! |
|
2951 |
||
2952 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
118 | 2953 |
"fill a polygon given by its points. |
2954 |
If any coordinate is not integer, an error is triggered." |
|
73 | 2955 |
|
2956 |
|numberOfPoints| |
|
0 | 2957 |
|
2958 |
numberOfPoints := aPolygon size. |
|
2959 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2960 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2961 |
Window win; |
73 | 2962 |
OBJ point, x, y; |
2963 |
int i, num; |
|
2964 |
XPoint *points; |
|
2965 |
XPoint qPoints[100]; |
|
377 | 2966 |
int mustFree = 0; |
73 | 2967 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2968 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2969 |
&& __isExternalAddress(aDrawableId) |
97 | 2970 |
&& __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
|
2971 |
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
|
2972 |
win = _WindowVal(aDrawableId); |
555 | 2973 |
num = __intVal(numberOfPoints); |
73 | 2974 |
if (num < 3) { |
70 | 2975 |
RETURN ( self ); |
2976 |
} |
|
73 | 2977 |
/* |
2978 |
* avoid (slow) malloc, if not many points |
|
2979 |
*/ |
|
96 | 2980 |
if (num > 100) { |
73 | 2981 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
96 | 2982 |
if (! points) goto fail; |
377 | 2983 |
mustFree = 1; |
96 | 2984 |
} else |
73 | 2985 |
points = qPoints; |
2986 |
for (i=0; i<num; i++) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
2987 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
73 | 2988 |
if (! __isPoint(point)) goto fail; |
2989 |
x = _point_X(point); |
|
2990 |
y = _point_Y(point); |
|
97 | 2991 |
if (! __bothSmallInteger(x, y)) |
73 | 2992 |
goto fail; |
555 | 2993 |
points[i].x = __intVal(x); |
2994 |
points[i].y = __intVal(y); |
|
73 | 2995 |
} |
2996 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
|
377 | 2997 |
if (mustFree) |
73 | 2998 |
free(points); |
2999 |
RETURN ( self ); |
|
377 | 3000 |
|
0 | 3001 |
fail: ; |
382 | 3002 |
if (mustFree) |
3003 |
free(points); |
|
0 | 3004 |
} |
73 | 3005 |
%}. |
3006 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 3007 |
self primitiveFailed |
3008 |
! |
|
3009 |
||
295 | 3010 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
3011 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
3012 |
||
3013 |
%{ /* NOCONTEXT */ |
|
3014 |
||
3015 |
int w, h; |
|
3016 |
||
3017 |
if (__isExternalAddress(aGCId) |
|
3018 |
&& __isExternalAddress(aDrawableId) |
|
3019 |
&& __bothSmallInteger(x, y) |
|
3020 |
&& __bothSmallInteger(width, height)) { |
|
555 | 3021 |
w = __intVal(width); |
3022 |
h = __intVal(height); |
|
295 | 3023 |
/* |
3024 |
* need this check here: some servers simply dump core with bad args |
|
3025 |
*/ |
|
3026 |
if ((w >= 0) && (h >= 0)) { |
|
3027 |
XFillRectangle(myDpy, |
|
3028 |
(Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), |
|
555 | 3029 |
__intVal(x), __intVal(y), w, h); |
295 | 3030 |
} |
3031 |
RETURN ( self ); |
|
3032 |
} |
|
3033 |
%}. |
|
3034 |
"badGC, badDrawable or coordinates not integer" |
|
3035 |
self primitiveFailed |
|
43 | 3036 |
! |
3037 |
||
3038 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth |
|
70 | 3039 |
width:imageWidth height:imageHeight |
3040 |
x:srcx y:srcy |
|
3041 |
into:aDrawableId |
|
3042 |
x:dstx y:dsty |
|
3043 |
width:w height:h |
|
3044 |
with:aGCId |
|
0 | 3045 |
|
132 | 3046 |
"since XPutImage may allocate huge amount of stack space |
3047 |
(some implementations use alloca), this must run with unlimited stack." |
|
3048 |
||
12 | 3049 |
%{ /* UNLIMITEDSTACK */ |
0 | 3050 |
|
43 | 3051 |
/* |
3052 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
3053 |
* XPutImage |
|
3054 |
*/ |
|
3055 |
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
|
3056 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3057 |
Window win; |
43 | 3058 |
XImage image; |
377 | 3059 |
int imgWdth; |
43 | 3060 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3061 |
if (__isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3062 |
&& __isExternalAddress(aDrawableId) |
97 | 3063 |
&& __bothSmallInteger(srcx, srcy) |
3064 |
&& __bothSmallInteger(dstx, dsty) |
|
3065 |
&& __bothSmallInteger(w, h) |
|
3066 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
3067 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
43 | 3068 |
&& __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
|
3069 |
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
|
3070 |
win = _WindowVal(aDrawableId); |
811 | 3071 |
if (! gc || !win) |
3072 |
goto fail; |
|
46 | 3073 |
#ifdef ARGDEBUG |
70 | 3074 |
printf("args ok\n"); |
46 | 3075 |
#endif |
555 | 3076 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
3077 |
image.width = imgWdth = __intVal(imageWidth); |
|
3078 |
image.height = __intVal(imageHeight); |
|
70 | 3079 |
image.xoffset = 0; |
3080 |
image.format = ZPixmap; |
|
3081 |
image.byte_order = MSBFirst; |
|
3082 |
image.bitmap_unit = 8; |
|
3083 |
image.bitmap_bit_order = MSBFirst; |
|
3084 |
image.bitmap_pad = 8; |
|
555 | 3085 |
image.depth = __intVal(imageDepth); |
3086 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
|
70 | 3087 |
switch (image.bits_per_pixel) { |
3088 |
case 1: |
|
377 | 3089 |
image.bytes_per_line = (imgWdth + 7) / 8; |
70 | 3090 |
break; |
3091 |
case 2: |
|
377 | 3092 |
image.bytes_per_line = (imgWdth*2 + 7) / 8; |
70 | 3093 |
break; |
3094 |
case 4: |
|
377 | 3095 |
image.bytes_per_line = (imgWdth*4 + 7) / 8; |
70 | 3096 |
break; |
3097 |
case 8: |
|
377 | 3098 |
image.bytes_per_line = imgWdth; |
70 | 3099 |
break; |
3100 |
case 16: |
|
377 | 3101 |
image.bytes_per_line = imgWdth*2; |
70 | 3102 |
break; |
3103 |
case 24: |
|
377 | 3104 |
image.bytes_per_line = imgWdth*3; |
70 | 3105 |
break; |
193 | 3106 |
case 32: |
377 | 3107 |
image.bytes_per_line = imgWdth*4; |
193 | 3108 |
break; |
70 | 3109 |
default: |
46 | 3110 |
#ifdef ARGDEBUG |
70 | 3111 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 3112 |
#endif |
70 | 3113 |
goto fail; |
3114 |
} |
|
3115 |
image.red_mask = 0xFFFF; |
|
3116 |
image.green_mask = 0xFFFF; |
|
3117 |
image.blue_mask = 0xFFFF; |
|
555 | 3118 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
3119 |
__intVal(dstx), __intVal(dsty), |
|
3120 |
__intVal(w), __intVal(h)); |
|
70 | 3121 |
RETURN ( true ); |
43 | 3122 |
} |
46 | 3123 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3124 |
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
|
3125 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 3126 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
3127 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
3128 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
3129 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
3130 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
3131 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
3132 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
3133 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
3134 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
3135 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
3136 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 3137 |
#endif |
3138 |
||
0 | 3139 |
fail: ; |
3140 |
%} |
|
3141 |
. |
|
12 | 3142 |
^ false |
0 | 3143 |
! ! |
3144 |
||
86 | 3145 |
!XWorkstation methodsFor:'event handling'! |
0 | 3146 |
|
3147 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
3148 |
"central event handling method: |
|
54 | 3149 |
get next event and send appropriate message to the sensor or view. |
0 | 3150 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
12 | 3151 |
otherwise only events for the view with given id are processed. |
3152 |
If the argument aMask is nonNil, only events for this eventMask are |
|
3153 |
handled." |
|
3154 |
||
54 | 3155 |
(self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[ |
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
3156 |
AbortSignal catch:[ |
83 | 3157 |
self dispatchLastEvent. |
3158 |
] |
|
54 | 3159 |
]. |
12 | 3160 |
! |
3161 |
||
295 | 3162 |
dispatchExposeEventFor:aViewIdOrNil |
3163 |
"get next expose event and send appropriate message to the sensor or view. |
|
3164 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
3165 |
otherwise only events for the view with given id are processed." |
|
3166 |
||
3167 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
|
12 | 3168 |
! |
3169 |
||
3170 |
dispatchLastEvent |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3171 |
|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
|
3172 |
eventType| |
12 | 3173 |
|
3174 |
%{ /* STACK: 8000 */ |
|
3175 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
|
0 | 3176 |
|
3177 |
Display *dpy = myDpy; |
|
135 | 3178 |
OBJ eB; |
3179 |
XEvent *ev; |
|
3180 |
||
3181 |
# define ae ((XAnyEvent *)ev) |
|
3182 |
# define ee ((XExposeEvent *)ev) |
|
3183 |
# define ke ((XKeyPressedEvent *)ev) |
|
3184 |
# define be ((XButtonPressedEvent *)ev) |
|
3185 |
# define ce ((XConfigureEvent *)ev) |
|
3186 |
# define me ((XMotionEvent *)ev) |
|
3187 |
# define ewe ((XEnterWindowEvent *)ev) |
|
3188 |
# define lwe ((XLeaveWindowEvent *)ev) |
|
3189 |
# define de ((XDestroyWindowEvent *)ev) |
|
3190 |
# define ve ((XVisibilityEvent *)ev) |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3191 |
# define mape ((XMappingEvent *)ev) |
135 | 3192 |
|
0 | 3193 |
KeySym keySym; |
3194 |
unsigned char buffer[10]; |
|
3195 |
int i, nchars; |
|
3196 |
char *keySymString; |
|
3197 |
char keySymStringBuffer[32]; |
|
3198 |
static unsigned multiClickTime = 0; |
|
3199 |
unsigned nextMultiClickTime; |
|
150 | 3200 |
OBJ upDown; |
115 | 3201 |
|
3202 |
struct inlineCache *ipS; |
|
0 | 3203 |
static struct inlineCache vid = _ILC1; |
12 | 3204 |
|
3205 |
static struct inlineCache expS = _ILC5; |
|
3206 |
static struct inlineCache gexpS = _ILC5; |
|
3207 |
static struct inlineCache nexpS = _ILC1; |
|
3208 |
static struct inlineCache motS = _ILC4; |
|
3209 |
static struct inlineCache bpS = _ILC4; |
|
3210 |
static struct inlineCache bmpS = _ILC4; |
|
3211 |
static struct inlineCache bspS = _ILC4; |
|
3212 |
static struct inlineCache brS = _ILC4; |
|
3213 |
static struct inlineCache focInS = _ILC1; |
|
3214 |
static struct inlineCache focOutS = _ILC1; |
|
3215 |
static struct inlineCache peS = _ILC4; |
|
3216 |
static struct inlineCache plS = _ILC2; |
|
54 | 3217 |
static struct inlineCache termS = _ILC1; |
3218 |
static struct inlineCache savtermS = _ILC1; |
|
3219 |
static struct inlineCache destrS = _ILC1; |
|
3220 |
static struct inlineCache unmapS = _ILC1; |
|
3221 |
static struct inlineCache mapS = _ILC1; |
|
3222 |
static struct inlineCache confS = _ILC5; |
|
70 | 3223 |
static struct inlineCache coveredS = _ILC2; |
12 | 3224 |
|
3225 |
static struct inlineCache keymap = _ILC0; |
|
3226 |
static struct inlineCache created = _ILC0; |
|
3227 |
static struct inlineCache mapReq = _ILC0; |
|
3228 |
static struct inlineCache repar = _ILC0; |
|
3229 |
static struct inlineCache confReq = _ILC0; |
|
3230 |
static struct inlineCache resReq = _ILC0; |
|
3231 |
static struct inlineCache prop = _ILC0; |
|
129 | 3232 |
static struct inlineCache selClear = _ILC1; |
90 | 3233 |
static struct inlineCache selReq = _ILC4; |
3234 |
static struct inlineCache selNotify = _ILC4; |
|
12 | 3235 |
static struct inlineCache colormap = _ILC0; |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3236 |
static struct inlineCache mapping = _ILC2; |
70 | 3237 |
static struct inlineCache vis = _ILC1; |
12 | 3238 |
|
3239 |
static struct inlineCache skpS = _ILC4; |
|
63 | 3240 |
static struct inlineCache skrS = _ILC4; |
12 | 3241 |
|
555 | 3242 |
eB = __INST(eventBuffer); |
135 | 3243 |
if (__isByteArray(eB)) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3244 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
135 | 3245 |
} else { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3246 |
printf("DISPLAY: no eventBuffer\n"); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3247 |
RETURN (false); |
135 | 3248 |
} |
3249 |
||
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
3250 |
windowID = __MKOBJ(ae->window); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3251 |
theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); |
12 | 3252 |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3253 |
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
|
3254 |
RETURN (nil); |
12 | 3255 |
} |
3256 |
||
3257 |
/* |
|
3258 |
* key, button and pointer events are sent to the sensor, |
|
3259 |
* or (if there is none) to the delegate. |
|
3260 |
* or (if there is none) to the view. |
|
26 | 3261 |
* |
3262 |
* expose events are sent to the sensor, |
|
3263 |
* or (if there is none) to the view |
|
3264 |
* |
|
12 | 3265 |
* sensor and delegate get view as additional argument |
115 | 3266 |
* all of this has been taken out of here to corresponding methods |
3267 |
* in DeviceWorkstation. |
|
12 | 3268 |
*/ |
90 | 3269 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3270 |
#ifdef DEBUG |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3271 |
eventType = __MKSMALLINT(ev->type); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3272 |
#endif |
135 | 3273 |
switch (ev->type) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3274 |
case KeyRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3275 |
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
|
3276 |
ipS = &skrS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3277 |
upDown = false; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3278 |
goto keyPressAndRelease; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3279 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3280 |
case KeyPress: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3281 |
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
|
3282 |
ipS = &skpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3283 |
upDown = true; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3284 |
/* FALL INTO */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3285 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3286 |
keyPressAndRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3287 |
__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
|
3288 |
__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
|
3289 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3290 |
__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
|
3291 |
__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
|
3292 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3293 |
__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
|
3294 |
__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
|
3295 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3296 |
__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
|
3297 |
__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
|
3298 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3299 |
arg = nil; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3300 |
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
|
3301 |
if (nchars |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3302 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3303 |
|| (buffer[0] >= 0x80))) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3304 |
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
|
3305 |
keySymString = NULL; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3306 |
} else { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3307 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3308 |
switch (keySym) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3309 |
case XK_Control_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3310 |
case XK_Control_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3311 |
__INST(ctrlDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3312 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3313 |
case XK_Shift_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3314 |
case XK_Shift_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3315 |
__INST(shiftDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3316 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3317 |
case XK_Meta_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3318 |
case XK_Meta_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3319 |
__INST(metaDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3320 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3321 |
case XK_Alt_L: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3322 |
case XK_Alt_R: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3323 |
__INST(altDown) = upDown; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3324 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3325 |
} |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3326 |
#endif |
150 | 3327 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3328 |
keySymString = XKeysymToString(keySym); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3329 |
if (keySymString) { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3330 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3331 |
if (keySymString[0] == 'D') { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3332 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3333 |
* 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
|
3334 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3335 |
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
|
3336 |
keySymString = "DeleteLine"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3337 |
} 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
|
3338 |
keySymString = "DeleteWord"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3339 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3340 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3341 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3342 |
* make names compatible |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3343 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3344 |
if (strcmp(keySymString, "Down") == 0) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3345 |
keySymString = "CursorDown"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3346 |
} 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
|
3347 |
keySymString = "CursorUp"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3348 |
} 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
|
3349 |
keySymString = "CursorLeft"; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3350 |
} 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
|
3351 |
keySymString = "CursorRight"; |
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 |
arg = __MKSYMBOL(keySymString, (OBJ *)0, __context); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3354 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3355 |
__PROTECT__(theView); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3356 |
arg = __MKSTRING(keySymString); |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3357 |
__UNPROTECT__(theView); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
3358 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3359 |
} |
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 |
if (arg == nil) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3363 |
/* 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
|
3364 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3365 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3366 |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3367 |
(*(*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
|
3368 |
arg, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3369 |
__MKSMALLINT(ke->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3370 |
__MKSMALLINT(ke->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3371 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3372 |
break; |
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 |
case ButtonPress: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3375 |
__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
|
3376 |
__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
|
3377 |
__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
|
3378 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3379 |
if (__isSmallInteger(__INST(multiClickTimeDelta))) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3380 |
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
|
3381 |
else |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3382 |
nextMultiClickTime = 0; |
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 |
if (multiClickTime) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3385 |
if (be->time < multiClickTime) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3386 |
multiClickTime = nextMultiClickTime; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3387 |
ipS = &bmpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3388 |
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
|
3389 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3390 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3391 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3392 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3393 |
multiClickTime = nextMultiClickTime; |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
3394 |
#ifdef NO_LONGER |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3395 |
if (be->state & ShiftMask) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3396 |
ipS = &bspS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3397 |
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
|
3398 |
goto sendButtonEvent; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3399 |
} |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
3400 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3401 |
ipS = &bpS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3402 |
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
|
3403 |
goto sendButtonEvent; |
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 |
/* NOT REACHED */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3406 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3407 |
case ButtonRelease: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3408 |
__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
|
3409 |
__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
|
3410 |
__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
|
3411 |
ipS = &brS; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3412 |
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
|
3413 |
/* fall into */ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3414 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3415 |
sendButtonEvent: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3416 |
butt = __MKSMALLINT(be->button); |
12 | 3417 |
#ifdef NOTDEF |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3418 |
/* |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3419 |
* 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
|
3420 |
*/ |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3421 |
if (__INST(metaDown) == true) |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3422 |
butt = __MKSMALLINT(2); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3423 |
else |
0 | 3424 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3425 |
butt = __AT_(__INST(buttonTranslation), butt); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3426 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3427 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3428 |
(*(*ipS).ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3429 |
symS, nil, ipS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3430 |
butt, |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3431 |
__MKSMALLINT(ke->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3432 |
__MKSMALLINT(ke->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3433 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3434 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3435 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3436 |
case MotionNotify: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3437 |
if (__INST(motionEventCompression) != false) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3438 |
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
|
3439 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3440 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3441 |
__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
|
3442 |
__INST(eventRootY) = __MKSMALLINT(me->y_root); |
70 | 3443 |
|
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) = (me->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) = (me->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 |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3451 |
__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
|
3452 |
__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
|
3453 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3454 |
(*motS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3455 |
@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
|
3456 |
__MKSMALLINT(me->state), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3457 |
__MKSMALLINT(me->x), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3458 |
__MKSMALLINT(me->y), |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3459 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3460 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3461 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3462 |
case FocusIn: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3463 |
(*focInS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3464 |
@symbol(focusInView:), nil, &focInS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3465 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3466 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3467 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3468 |
case FocusOut: |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3469 |
(*focOutS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3470 |
@symbol(focusOutView:), nil, &focOutS, |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3471 |
theView); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3472 |
break; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3473 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3474 |
case EnterNotify: |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
3475 |
#ifdef OLD |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3476 |
__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
|
3477 |
__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
|
3478 |
#else |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
3479 |
__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
|
3480 |
__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
|
3481 |
#endif |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3482 |
__INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3483 |
__INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3484 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3485 |
(*peS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3486 |
@symbol(pointerEnter:x:y:view:), nil, &peS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3487 |
__MKSMALLINT(ewe->state), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3488 |
__MKSMALLINT(ewe->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3489 |
__MKSMALLINT(ewe->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3490 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3491 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3492 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3493 |
case LeaveNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3494 |
(*plS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3495 |
@symbol(pointerLeave:view:), nil, &plS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3496 |
__MKSMALLINT(lwe->state), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3497 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3498 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3499 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3500 |
case GraphicsExpose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3501 |
(*gexpS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3502 |
@symbol(graphicExposeX:y:width:height:view:), nil, &gexpS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3503 |
__MKSMALLINT(ee->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3504 |
__MKSMALLINT(ee->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3505 |
__MKSMALLINT(ee->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3506 |
__MKSMALLINT(ee->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3507 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3508 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3509 |
if (ee->count != 0) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3510 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3511 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3512 |
/* fall into */ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3513 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3514 |
case NoExpose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3515 |
(*nexpS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3516 |
@symbol(noExposeView:), nil, &nexpS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3517 |
theView); |
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 Expose: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3521 |
(*expS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3522 |
@symbol(exposeX:y:width:height:view:), nil, &expS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3523 |
__MKSMALLINT(ee->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3524 |
__MKSMALLINT(ee->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3525 |
__MKSMALLINT(ee->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3526 |
__MKSMALLINT(ee->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3527 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3528 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3529 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3530 |
case ConfigureNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3531 |
if (ce->above != None) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3532 |
siblingID = __MKOBJ(ce->above); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3533 |
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
|
3534 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3535 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3536 |
(*confS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3537 |
@symbol(configureX:y:width:height:view:), nil, &confS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3538 |
__MKSMALLINT(ce->x), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3539 |
__MKSMALLINT(ce->y), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3540 |
__MKSMALLINT(ce->width), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3541 |
__MKSMALLINT(ce->height), |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3542 |
theView); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3543 |
if (sibling != nil) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3544 |
(*coveredS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3545 |
@symbol(coveredBy:view:), nil, &coveredS, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3546 |
theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3547 |
sibling); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3548 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3549 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3550 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3551 |
case ClientMessage: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3552 |
if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3553 |
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
|
3554 |
|| (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3555 |
(*termS.ilc_func)(self, |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3556 |
@symbol(terminateView:), nil, &termS, theView); |
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 |
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
|
3560 |
(*savtermS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3561 |
@symbol(saveAndTerminateView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3562 |
, nil, &savtermS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3563 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3564 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3565 |
} |
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 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3568 |
case DestroyNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3569 |
(*destrS.ilc_func)(self, @symbol(destroyedView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3570 |
, nil, &destrS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3571 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3572 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3573 |
case UnmapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3574 |
(*unmapS.ilc_func)(self, @symbol(unmappedView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3575 |
, nil, &unmapS, theView); |
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 MapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3579 |
(*mapS.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3580 |
@symbol(mappedView:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3581 |
, nil, &mapS, theView); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3582 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3583 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3584 |
case KeymapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3585 |
(*keymap.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3586 |
@symbol(keyMapChange) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3587 |
, nil, &keymap); |
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 VisibilityNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3591 |
switch (ve->state) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3592 |
case VisibilityUnobscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3593 |
arg = @symbol(unobscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3594 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3595 |
case VisibilityPartiallyObscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3596 |
arg = @symbol(partiallyObscured); |
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 |
case VisibilityFullyObscured: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3599 |
arg = @symbol(fullyObscured); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3600 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3601 |
} |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3602 |
(*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
|
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 CreateNotify: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3606 |
(*created.ilc_func)(theView, @symbol(created), nil, &created); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3607 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3608 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3609 |
case MapRequest: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3610 |
(*mapReq.ilc_func)(theView, @symbol(mapRequest), nil, &mapReq); |
1014
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 ReparentNotify: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3614 |
(*repar.ilc_func)(theView, @symbol(reparented), nil, &repar); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3615 |
break; |
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 |
case ConfigureRequest: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3618 |
(*confReq.ilc_func)(theView, @symbol(configRequest), nil, &confReq); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3619 |
break; |
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 |
case GravityNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3622 |
case ResizeRequest: |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3623 |
(*resReq.ilc_func)(theView, @symbol(resizeRequest), nil, &resReq); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3624 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3625 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3626 |
case CirculateNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3627 |
case CirculateRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3628 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3629 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3630 |
case PropertyNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3631 |
(*prop.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3632 |
@symbol(propertyChange) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3633 |
, nil, &prop); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3634 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3635 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3636 |
case SelectionClear: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3637 |
selectionID = __MKATOMOBJ(ev->xselectionclear.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3638 |
(*selClear.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3639 |
@symbol(selectionClear:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3640 |
, nil, &selClear, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3641 |
selectionID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3642 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3643 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3644 |
case SelectionNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3645 |
/* |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3646 |
* returned selection value (answer from SelectionRequest) |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3647 |
*/ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3648 |
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
|
3649 |
ev->xselection.property, ev->xselection.target, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3650 |
ev->xselection.selection, ev->xselection.requestor)); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3651 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3652 |
propertyID = __MKATOMOBJ(ev->xselection.property); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3653 |
targetID = __MKATOMOBJ(ev->xselection.target); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3654 |
selectionID = __MKATOMOBJ(ev->xselection.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3655 |
requestorID = __MKOBJ(ev->xselection.requestor); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3656 |
(*selNotify.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3657 |
@symbol(selectionNotify:target:selection:from:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3658 |
, nil, &selNotify, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3659 |
propertyID, targetID, selectionID, requestorID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3660 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3661 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3662 |
case SelectionRequest: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3663 |
/* |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3664 |
* someone wants the selection |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3665 |
*/ |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3666 |
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
|
3667 |
ev->xselectionrequest.property, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3668 |
ev->xselectionrequest.target, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3669 |
ev->xselectionrequest.selection, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3670 |
ev->xselectionrequest.requestor)); |
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 |
propertyID = __MKATOMOBJ(ev->xselectionrequest.property); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3673 |
targetID = __MKATOMOBJ(ev->xselectionrequest.target); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3674 |
selectionID = __MKATOMOBJ(ev->xselectionrequest.selection); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3675 |
requestorID = __MKOBJ(ev->xselectionrequest.requestor); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3676 |
(*selReq.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3677 |
@symbol(selectionRequest:target:selection:from:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3678 |
, nil, &selReq, |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3679 |
propertyID, targetID, selectionID, requestorID); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3680 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3681 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3682 |
case ColormapNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3683 |
(*colormap.ilc_func)(theView, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3684 |
@symbol(colorMapChange) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3685 |
, nil, &colormap); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3686 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3687 |
|
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3688 |
case MappingNotify: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3689 |
switch(mape->request) { |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3690 |
case MappingModifier: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3691 |
arg = @symbol(mappingModifier); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3692 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3693 |
case MappingKeyboard: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3694 |
arg = @symbol(mappingKeyboard); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3695 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3696 |
case MappingPointer: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3697 |
arg = @symbol(mappingPointer); |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3698 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3699 |
default: |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3700 |
arg = nil; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3701 |
break; |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3702 |
} |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3703 |
(*mapping.ilc_func)(self, |
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3704 |
@symbol(mappingChanged:event:) |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
3705 |
, nil, &mapping, arg, eB); |
1014
6be12d5937f5
removed obsolete font access methods
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
3706 |
break; |
0 | 3707 |
} |
135 | 3708 |
#undef ae |
0 | 3709 |
#undef ee |
3710 |
#undef ke |
|
3711 |
#undef be |
|
3712 |
#undef ce |
|
3713 |
#undef me |
|
3714 |
#undef ewe |
|
3715 |
#undef lwe |
|
3716 |
#undef de |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3717 |
#undef mape |
0 | 3718 |
%} |
3719 |
. |
|
3720 |
^ true |
|
3721 |
! |
|
3722 |
||
295 | 3723 |
dispatchPendingEvents |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3724 |
"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
|
3725 |
(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
|
3726 |
This code is somewhat special, since X has a concept of graphic |
295 | 3727 |
expose events (which are sent after a bitblt). After such a bitblt, |
3728 |
we only handle exposes until the graphicsExpose arrives. |
|
3729 |
Other systems may not need such a kludge" |
|
3730 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
3731 |
"interested in exposes only ?" |
295 | 3732 |
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
|
3733 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
295 | 3734 |
self dispatchExposeEventFor:dispatchingExpose |
3735 |
]. |
|
3736 |
^ self |
|
3737 |
]. |
|
3738 |
||
3739 |
"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
|
3740 |
[self eventPendingWithSync:false] whileTrue:[ |
295 | 3741 |
self dispatchEventFor:nil withMask:nil |
3742 |
] |
|
3743 |
! |
|
3744 |
||
81 | 3745 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
3746 |
"dispose (throw away) specific events. If aWindowId is nil, |
|
3747 |
events matching the mask are thrown away regardless of which |
|
3748 |
view they are for. Otherwise, only matching events for that |
|
3749 |
view are flushed." |
|
0 | 3750 |
|
3751 |
%{ /* NOCONTEXT */ |
|
3752 |
||
3753 |
Display *dpy = myDpy; |
|
3754 |
XEvent ev; |
|
3755 |
Window win; |
|
3756 |
||
97 | 3757 |
if (__isSmallInteger(aMask)) { |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3758 |
if (__isExternalAddress(aWindowIdOrNil)) { |
81 | 3759 |
win = _WindowVal(aWindowIdOrNil); |
555 | 3760 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
81 | 3761 |
} else { |
555 | 3762 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
81 | 3763 |
} |
70 | 3764 |
RETURN ( self ); |
0 | 3765 |
} |
3766 |
%} |
|
3767 |
. |
|
3768 |
self primitiveFailed |
|
3769 |
! |
|
3770 |
||
295 | 3771 |
eventMaskFor:anEventSymbol |
3772 |
"return the eventMask bit-constant corresponding to an event symbol" |
|
3773 |
||
3774 |
%{ /* NOCONTEXT */ |
|
3775 |
||
3776 |
int m = 0; |
|
3777 |
||
3778 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
|
3779 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
|
3780 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
|
3781 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
|
3782 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
|
3783 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
|
3784 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
|
3785 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
|
3786 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
|
3787 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
|
3788 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
|
3789 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
|
3790 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
|
3791 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
|
3792 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
|
3793 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
3794 |
RETURN (__MKSMALLINT(m)); |
295 | 3795 |
%} |
3796 |
! |
|
3797 |
||
12 | 3798 |
eventPending |
310 | 3799 |
"return true, if any event is pending. |
3800 |
This looks for both the internal queue and the display connection." |
|
12 | 3801 |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3802 |
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
|
3803 |
|
12 | 3804 |
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
|
3805 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
12 | 3806 |
]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3807 |
^ self eventPendingWithSync:false |
0 | 3808 |
! |
3809 |
||
295 | 3810 |
eventPending:anEventSymbol for:aWindowIdOrNil |
3811 |
"return true, if a specific event is pending" |
|
3812 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3813 |
^ 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
|
3814 |
! |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3815 |
|
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3816 |
eventPendingWithSync:doSync |
7 | 3817 |
"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
|
3818 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
310 | 3819 |
before checking." |
0 | 3820 |
|
12 | 3821 |
%{ /* UNLIMITEDSTACK */ |
0 | 3822 |
|
3823 |
Display *dpy = myDpy; |
|
3824 |
||
150 | 3825 |
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
|
3826 |
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
|
3827 |
XSync(dpy, 0); /* make certain everything is flushed */ |
150 | 3828 |
} |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3829 |
if (XPending(dpy)) { |
150 | 3830 |
RETURN (true); |
3831 |
} |
|
3832 |
} |
|
3833 |
RETURN ( false ); |
|
0 | 3834 |
%} |
3835 |
! |
|
3836 |
||
341 | 3837 |
eventQueued |
3838 |
"return true, if any event is queued" |
|
3839 |
||
3840 |
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
|
3841 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
341 | 3842 |
]. |
3843 |
^ self eventQueuedAlready |
|
3844 |
||
3845 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
|
3846 |
! |
|
3847 |
||
3848 |
eventQueuedAlready |
|
3849 |
"return true, if any event is queued internally. |
|
3850 |
(i.e. in X's internal event queue, which is both filled by explicit |
|
3851 |
nextEvent calls AND whenever drawing is done and events are pending on |
|
3852 |
the display connection)." |
|
3853 |
||
3854 |
%{ /* UNLIMITEDSTACK */ |
|
3855 |
||
3856 |
if (ISCONNECTED) { |
|
3857 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
|
3858 |
RETURN (true); |
|
3859 |
} |
|
3860 |
} |
|
3861 |
RETURN ( false ); |
|
3862 |
%} |
|
3863 |
! |
|
3864 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3865 |
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync |
295 | 3866 |
"return true, if any of the masked events is pending" |
3867 |
||
3868 |
%{ /* UNLIMITEDSTACK */ |
|
3869 |
||
3870 |
Display *dpy = myDpy; |
|
3871 |
XEvent ev; |
|
3872 |
Window win; |
|
3873 |
int thereIsOne; |
|
3874 |
||
3875 |
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
|
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 |
} |
295 | 3879 |
if (__isExternalAddress(aWindowIdOrNil)) { |
3880 |
win = _WindowVal(aWindowIdOrNil); |
|
555 | 3881 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
295 | 3882 |
} else { |
555 | 3883 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
295 | 3884 |
} |
3885 |
if (thereIsOne) { |
|
3886 |
XPutBackEvent(dpy, &ev); |
|
3887 |
RETURN ( true ); |
|
3888 |
} |
|
3889 |
} |
|
3890 |
RETURN ( false ); |
|
3891 |
%} |
|
3892 |
! |
|
3893 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
3894 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
310 | 3895 |
"return true, if any expose event is pending for a specific view, |
3896 |
or any view (if the arg is nil). |
|
3897 |
This is an X specific, only required after a scroll operation." |
|
7 | 3898 |
|
12 | 3899 |
%{ /* UNLIMITEDSTACK */ |
7 | 3900 |
|
3901 |
Display *dpy = myDpy; |
|
3902 |
XEvent ev; |
|
3903 |
Window win; |
|
81 | 3904 |
int thereIsOne; |
3905 |
||
150 | 3906 |
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
|
3907 |
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
|
3908 |
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
|
3909 |
} |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3910 |
if (__isExternalAddress(aWindowIdOrNil)) { |
150 | 3911 |
win = _WindowVal(aWindowIdOrNil); |
3912 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
|
3913 |
} else { |
|
3914 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
|
3915 |
} |
|
3916 |
if (thereIsOne) { |
|
3917 |
XPutBackEvent(dpy, &ev); |
|
3918 |
RETURN ( true ); |
|
3919 |
} |
|
81 | 3920 |
} |
3921 |
RETURN ( false ); |
|
3922 |
%} |
|
3923 |
! |
|
3924 |
||
295 | 3925 |
getEventFor:aViewIdOrNil withMask:eventMask |
3926 |
"read next event - put into local eventBuffer. |
|
3927 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
3928 |
otherwise only events for that specific view will be fetched. |
|
3929 |
Returns true, if there was an event, false otherwise. |
|
3930 |
This method may block - so you better check for pending events |
|
3931 |
before calling for it. |
|
3932 |
||
3933 |
Sorry I had to split dispatch into this fetch method and an extra |
|
3934 |
handle method to allow unlimitedstack here. |
|
3935 |
(some Xlibs do a big alloca there ...) which cannot be done in |
|
3936 |
dispatchLastEvent, since it dispatches out into ST-methods. |
|
3937 |
BUG: uses a static buffer - has to be rewritten, to support multiple |
|
3938 |
display connections. |
|
3939 |
" |
|
81 | 3940 |
|
3941 |
%{ /* UNLIMITEDSTACK */ |
|
3942 |
||
3943 |
Display *dpy = myDpy; |
|
295 | 3944 |
Window win, wWanted; |
3945 |
int evMask; |
|
3946 |
OBJ eB; |
|
3947 |
XEvent *ev; |
|
3948 |
||
3949 |
if (! ISCONNECTED) { |
|
3950 |
RETURN (false); |
|
3951 |
} |
|
3952 |
||
555 | 3953 |
eB = __INST(eventBuffer); |
295 | 3954 |
if (__isByteArray(eB)) { |
555 | 3955 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 3956 |
} else { |
3957 |
printf("DISPLAY: no eventBuffer\n"); |
|
3958 |
RETURN (false); |
|
3959 |
} |
|
3960 |
ev->type = 0; |
|
3961 |
||
3962 |
if (__isSmallInteger(eventMask)) { |
|
555 | 3963 |
evMask = __intVal(eventMask); |
295 | 3964 |
} else { |
3965 |
evMask = ~0; |
|
3966 |
} |
|
3967 |
||
3968 |
if (__isExternalAddress(aViewIdOrNil)) { |
|
3969 |
wWanted = _WindowVal(aViewIdOrNil); |
|
3970 |
if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { |
|
70 | 3971 |
RETURN ( true ); |
3972 |
} |
|
295 | 3973 |
} else { |
3974 |
if (evMask == ~0) { |
|
3975 |
XNextEvent(dpy, ev); |
|
3976 |
RETURN (true); |
|
3977 |
} |
|
3978 |
if (XCheckMaskEvent(dpy, evMask, ev)) { |
|
3979 |
RETURN (true); |
|
3980 |
} |
|
3981 |
} |
|
3982 |
%}. |
|
3983 |
^ false |
|
3984 |
! |
|
3985 |
||
3986 |
handleAllEvents |
|
3987 |
"from now on, handle any kind of event" |
|
3988 |
||
3989 |
dispatchingExpose := nil |
|
3990 |
! |
|
3991 |
||
3992 |
handleExposeOnlyFor:aView |
|
3993 |
"from now on, handle expose events only" |
|
3994 |
||
3995 |
dispatchingExpose := aView id |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3996 |
! |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3997 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3998 |
mappingChanged:what event:eB |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
3999 |
"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
|
4000 |
Tell xlib about the fact." |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4001 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4002 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4003 |
self refreshKeyboardMapping:eB. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4004 |
"Maybe some of our modifiers have been changed" |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4005 |
self initializeModifierMappings. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4006 |
]. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4007 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4008 |
"Created: 1.12.1995 / 16:28:23 / stefan" |
295 | 4009 |
! |
4010 |
||
4011 |
setEventMask:aMask in:aWindowId |
|
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
4012 |
"tell X that we are only interested in events from aMask, which |
295 | 4013 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
4014 |
||
4015 |
%{ /* NOCONTEXT */ |
|
4016 |
||
4017 |
int mask; |
|
4018 |
||
4019 |
if (__isExternalAddress(aWindowId) |
|
4020 |
&& __isSmallInteger(aMask)) { |
|
555 | 4021 |
mask = __intVal(aMask); |
295 | 4022 |
|
4023 |
#ifdef OLD |
|
4024 |
/* these may not be disabled */ |
|
4025 |
mask |= ExposureMask | StructureNotifyMask | |
|
4026 |
KeyPressMask | KeyReleaseMask | |
|
4027 |
EnterWindowMask | LeaveWindowMask | |
|
4028 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
|
4029 |
#endif |
|
4030 |
||
4031 |
XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
|
4032 |
RETURN ( self ); |
|
4033 |
} |
|
4034 |
%} |
|
4035 |
. |
|
4036 |
self primitiveFailed |
|
4037 |
! |
|
4038 |
||
4039 |
startDispatch |
|
4040 |
"redefined to clear dispatchingExpose, which is a special X feature" |
|
4041 |
||
4042 |
dispatching ifTrue:[^ self]. |
|
4043 |
dispatchingExpose := nil. |
|
4044 |
super startDispatch |
|
0 | 4045 |
! ! |
295 | 4046 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4047 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4048 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4049 |
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
|
4050 |
"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
|
4051 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4052 |
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
|
4053 |
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
|
4054 |
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
|
4055 |
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
|
4056 |
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
|
4057 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4058 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4059 |
%{ /* NOCONTEXT */ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4060 |
Display *dpy = myDpy; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4061 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4062 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4063 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4064 |
if (__isSmallInteger(stateMask)) { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4065 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4066 |
} else { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4067 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4068 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4069 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4070 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4071 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4072 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4073 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4074 |
XEvent ev; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4075 |
Window target; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4076 |
Status result; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4077 |
KeySym keySym, *syms; |
555 | 4078 |
int screen = __intVal(__INST(screen)); |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4079 |
char s[2]; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4080 |
int nSyms; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4081 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4082 |
if ((typeSymbol == @symbol(keyPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4083 |
|| (typeSymbol == @symbol(keyRelease))) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4084 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4085 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4086 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4087 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4088 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4089 |
s[1] = '\0'; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4090 |
keySym = XStringToKeysym(s); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4091 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4092 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4093 |
} |
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 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4096 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4097 |
if (stateMask == nil) { |
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 |
* get the modifier from the keySym |
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 |
nSyms = 0; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4102 |
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
|
4103 |
if (syms) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4104 |
int i; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4105 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4106 |
for (i=0; i<nSyms; i++) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4107 |
if (syms[i] == keySym) { |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4108 |
#ifdef MODIFIERDEBUG |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4109 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4110 |
#endif |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4111 |
if (i) state = (1 << (i-1)); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4112 |
break; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4113 |
} |
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 |
XFree(syms); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4116 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4117 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4118 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4119 |
if ((typeSymbol == @symbol(buttonPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4120 |
|| (typeSymbol == @symbol(buttonRelease))) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4121 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4122 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4123 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4124 |
ev.xbutton.button = 1; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4125 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4126 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4127 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4128 |
RETURN (false); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4129 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4130 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4131 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4132 |
if (typeSymbol == @symbol(keyPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4133 |
ev.xany.type = KeyPress; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4134 |
else if (typeSymbol == @symbol(keyRelease)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4135 |
ev.xany.type = KeyRelease; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4136 |
else if (typeSymbol == @symbol(buttonPress)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4137 |
ev.xany.type = ButtonPress; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4138 |
else if (typeSymbol == @symbol(buttonRelease)) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4139 |
ev.xany.type = ButtonRelease; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4140 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4141 |
if (__isExternalAddress(targetId)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4142 |
target = _WindowVal(targetId); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4143 |
} else { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4144 |
target = (Window) __longIntVal(targetId); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4145 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4146 |
ev.xkey.window = target; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4147 |
ev.xkey.same_screen = 1; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4148 |
ev.xkey.subwindow = 0; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4149 |
ev.xkey.root = RootWindow(myDpy, screen); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4150 |
ev.xkey.x = __intVal(xPos); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4151 |
ev.xkey.y = __intVal(yPos); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4152 |
ev.xkey.state = state; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4153 |
ev.xkey.time = CurrentTime; |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4154 |
|
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4155 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4156 |
if ((result == BadValue) || (result == BadWindow)) { |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4157 |
DPRINTF(("bad status\n")); |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4158 |
RETURN ( false ) |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4159 |
} |
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
4160 |
RETURN (true) |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4161 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4162 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4163 |
self primitiveFailed. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4164 |
^ false |
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 |
simulateKeyboardInput:aCharacterOrString inViewId:viewId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4168 |
"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
|
4169 |
events. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4170 |
Only a few control characters are supported. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4171 |
Notice: not all alien views allow this kind of synthetic input; |
850 | 4172 |
some simply ignore it." |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4173 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4174 |
|control code state| |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4175 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4176 |
aCharacterOrString isString ifTrue:[ |
850 | 4177 |
aCharacterOrString do:[:char | |
4178 |
self simulateKeyboardInput:char inViewId:viewId |
|
4179 |
]. |
|
4180 |
^ self |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4181 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4182 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4183 |
control := false. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4184 |
code := aCharacterOrString asciiValue. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4185 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4186 |
(aCharacterOrString == Character cr) ifTrue:[ |
850 | 4187 |
code := #Return |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4188 |
] ifFalse:[ |
850 | 4189 |
(aCharacterOrString == Character tab) ifTrue:[ |
4190 |
code := #Tab |
|
4191 |
] ifFalse:[ |
|
4192 |
(aCharacterOrString == Character esc) ifTrue:[ |
|
4193 |
code := #Escape |
|
4194 |
] |
|
4195 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4196 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4197 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4198 |
control ifTrue:[ |
850 | 4199 |
state := self controlMask |
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4200 |
]. |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4201 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4202 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4203 |
"/ the stuff below should not be needed |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4204 |
"/ (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
|
4205 |
"/ 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
|
4206 |
"/ Hopefully, this is correct ... |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4207 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4208 |
code isNumber ifTrue:[ |
850 | 4209 |
code >= $A asciiValue ifTrue:[ |
4210 |
code <= $Z asciiValue ifTrue:[ |
|
4211 |
state := self shiftMask |
|
4212 |
] |
|
4213 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4214 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4215 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4216 |
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
|
4217 |
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
|
4218 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4219 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4220 |
sending input to some (possibly alien) view: |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4221 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4222 |
|point id| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4223 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4224 |
point := Display pointFromUser. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4225 |
id := Display viewIdFromPoint:point. |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4226 |
Display simulateKeyboardInput:'Hello_world' inViewId:id |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4227 |
" |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4228 |
|
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
4229 |
"Modified: 11.6.1996 / 10:59:42 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4230 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4231 |
|
295 | 4232 |
!XWorkstation methodsFor:'font stuff'! |
4233 |
||
4234 |
createFontFor:aFontName |
|
4235 |
"a basic method for X-font allocation; this method allows |
|
4236 |
any font to be aquired (even those not conforming to |
|
4237 |
standard naming conventions, such as cursor, fixed or k14)" |
|
4238 |
||
4239 |
%{ /* UNLIMITEDSTACK */ |
|
4240 |
/* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */ |
|
4241 |
||
4242 |
XFontStruct *newFont; |
|
4243 |
||
4244 |
if (ISCONNECTED) { |
|
4245 |
if (__isString(aFontName) || __isSymbol(aFontName)) { |
|
4246 |
BEGIN_INTERRUPTSBLOCKED |
|
4247 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4248 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4249 |
if (newFont) |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4250 |
__cnt_font++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
4251 |
#endif |
295 | 4252 |
END_INTERRUPTSBLOCKED |
4253 |
RETURN ( newFont ? __MKOBJ(newFont) : nil ); |
|
4254 |
} |
|
4255 |
} |
|
4256 |
%}. |
|
4257 |
^ nil |
|
4258 |
! |
|
4259 |
||
4260 |
decomposeXFontName:aString into:aBlock |
|
4261 |
"extract family, face, style and size from an |
|
4262 |
X-font name |
|
4263 |
(-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); |
|
4264 |
evaluate aBlock with these" |
|
4265 |
||
4266 |
|origin family face style moreStyle skip fheight size |
|
4267 |
resX resY x1 x2 coding start end | |
|
4268 |
||
4269 |
aString isNil ifTrue:[^ false]. |
|
4270 |
(aString startsWith:'-') ifFalse:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4271 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4272 |
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
|
4273 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4274 |
('*-*-[0-9]*' match:aString) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4275 |
end := aString indexOf:$- startingAt:1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4276 |
family := aString copyFrom:1 to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4277 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4278 |
end := aString indexOf:$- startingAt:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4279 |
style := aString copyFrom:start to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4280 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4281 |
size := aString copyFrom:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4282 |
size := (Number readFromString:size onError:[^false]). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4283 |
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
|
4284 |
^ true. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4285 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4286 |
('*-[0-9]*' match:aString) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4287 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4288 |
something like lucidasans-24 |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4289 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4290 |
end := aString indexOf:$- startingAt:1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4291 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4292 |
family := aString copyFrom:1 to:(end - 1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4293 |
start := end + 1. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4294 |
size := aString copyFrom:start. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4295 |
size := (Number readFromString:size onError:[^false]). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4296 |
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
|
4297 |
^ true. |
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 |
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
|
4300 |
^ true. |
295 | 4301 |
]. |
4302 |
||
4303 |
end := aString indexOf:$- startingAt:2. |
|
4304 |
(end == 0) ifTrue:[^ false]. |
|
4305 |
origin := aString copyFrom:2 to:(end - 1). |
|
4306 |
||
4307 |
start := end + 1. |
|
4308 |
end := aString indexOf:$- startingAt:start. |
|
4309 |
(end == 0) ifTrue:[^ false]. |
|
4310 |
family := aString copyFrom:start to:(end - 1). |
|
4311 |
||
4312 |
start := end + 1. |
|
4313 |
end := aString indexOf:$- startingAt:start. |
|
4314 |
(end == 0) ifTrue:[^ false]. |
|
4315 |
face := aString copyFrom:start to:(end - 1). |
|
4316 |
||
4317 |
start := end + 1. |
|
4318 |
end := aString indexOf:$- startingAt:start. |
|
4319 |
(end == 0) ifTrue:[^ false]. |
|
4320 |
style := aString copyFrom:start to:(end - 1). |
|
4321 |
(style = 'o') ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4322 |
style := 'oblique' |
295 | 4323 |
] ifFalse:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4324 |
(style = 'i') ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4325 |
style := 'italic' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4326 |
] ifFalse:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4327 |
(style = 'r') ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4328 |
style := 'roman' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4329 |
] |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4330 |
] |
295 | 4331 |
]. |
4332 |
||
4333 |
start := end + 1. |
|
4334 |
end := aString indexOf:$- startingAt:start. |
|
4335 |
(end == 0) ifTrue:[^ false]. |
|
4336 |
moreStyle := aString copyFrom:start to:(end - 1). |
|
4337 |
||
4338 |
start := end + 1. |
|
4339 |
end := aString indexOf:$- startingAt:start. |
|
4340 |
(end == 0) ifTrue:[^ false]. |
|
4341 |
skip := aString copyFrom:start to:(end - 1). |
|
4342 |
||
4343 |
start := end + 1. |
|
4344 |
end := aString indexOf:$- startingAt:start. |
|
4345 |
(end == 0) ifTrue:[^ false]. |
|
4346 |
fheight := aString copyFrom:start to:(end - 1). |
|
4347 |
||
4348 |
start := end + 1. |
|
4349 |
end := aString indexOf:$- startingAt:start. |
|
4350 |
(end == 0) ifTrue:[^ false]. |
|
4351 |
size := aString copyFrom:start to:(end - 1). |
|
4352 |
size := (Number readFromString:size) / 10. |
|
4353 |
||
4354 |
start := end + 1. |
|
4355 |
end := aString indexOf:$- startingAt:start. |
|
4356 |
(end == 0) ifTrue:[^ false]. |
|
4357 |
resX := aString copyFrom:start to:(end - 1). |
|
4358 |
||
4359 |
start := end + 1. |
|
4360 |
end := aString indexOf:$- startingAt:start. |
|
4361 |
(end == 0) ifTrue:[^ false]. |
|
4362 |
resY := aString copyFrom:start to:(end - 1). |
|
4363 |
||
4364 |
start := end + 1. |
|
4365 |
end := aString indexOf:$- startingAt:start. |
|
4366 |
(end == 0) ifTrue:[^ false]. |
|
4367 |
x1 := aString copyFrom:start to:(end - 1). |
|
4368 |
||
4369 |
start := end + 1. |
|
4370 |
end := aString indexOf:$- startingAt:start. |
|
4371 |
(end == 0) ifTrue:[^ false]. |
|
4372 |
x2 := aString copyFrom:start to:(end - 1). |
|
4373 |
||
4374 |
start := end + 1. |
|
4375 |
end := aString indexOf:$- startingAt:start. |
|
4376 |
(end == 0) ifTrue:[^ false]. |
|
4377 |
coding := aString copyFrom:start to:(end - 1). |
|
4378 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4379 |
(moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4380 |
style := style, '-', moreStyle. |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4381 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4382 |
|
295 | 4383 |
aBlock value:family value:face value:style value:size value:coding. |
4384 |
^ true |
|
4385 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4386 |
"Modified: 4.7.1996 / 11:12:25 / stefan" |
295 | 4387 |
! |
4388 |
||
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4389 |
encodingOf:aFontId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4390 |
"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
|
4391 |
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
|
4392 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4393 |
|enc fullName fontName registry encoding charSetCollections| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4394 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4395 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4396 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4397 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4398 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4399 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4400 |
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4401 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4402 |
registryAtom = XInternAtom(myDpy, "CHARSET_REGISTRY", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4403 |
encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4404 |
charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4405 |
fontAtom = XInternAtom(myDpy, "FONT", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4406 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4407 |
if (ISCONNECTED) { |
850 | 4408 |
if (__isExternalAddress(aFontId)) { |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4409 |
|
850 | 4410 |
f = _FontVal(aFontId); |
4411 |
if (f) { |
|
4412 |
n = f->n_properties; |
|
4413 |
prop = f->properties; |
|
4414 |
if (prop) { |
|
4415 |
while (n--) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4416 |
#ifdef SUPERDEBUG |
850 | 4417 |
cp = XGetAtomName(myDpy, prop->name); |
4418 |
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
|
4419 |
XFree(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4420 |
#endif |
850 | 4421 |
if (prop->name == XA_FULL_NAME) { |
4422 |
cp = XGetAtomName(myDpy, prop->card32); |
|
4423 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4424 |
fullName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4425 |
#ifdef SUPERDEBUG |
850 | 4426 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4427 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4428 |
XFree(cp); |
850 | 4429 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4430 |
} else if (prop->name == fontAtom) { |
850 | 4431 |
cp = XGetAtomName(myDpy, prop->card32); |
4432 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4433 |
fontName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4434 |
#ifdef SUPERDEBUG |
850 | 4435 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4436 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4437 |
XFree(cp); |
850 | 4438 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4439 |
} else if (prop->name == encodingAtom) { |
850 | 4440 |
cp = XGetAtomName(myDpy, prop->card32); |
4441 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4442 |
encoding = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4443 |
#ifdef SUPERDEBUG |
850 | 4444 |
printf(" ENCODING -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4445 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4446 |
XFree(cp); |
850 | 4447 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4448 |
} else if (prop->name == registryAtom) { |
850 | 4449 |
cp = XGetAtomName(myDpy, prop->card32); |
4450 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4451 |
registry = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4452 |
#ifdef SUPERDEBUG |
850 | 4453 |
printf(" REGISTRY -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4454 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4455 |
XFree(cp); |
850 | 4456 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4457 |
} else if (prop->name == charSetCollAtom) { |
850 | 4458 |
cp = XGetAtomName(myDpy, prop->card32); |
4459 |
if (cp) { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4460 |
charSetCollections = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4461 |
#ifdef SUPERDEBUG |
850 | 4462 |
printf(" CHARSET_COLLECTIONS -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4463 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4464 |
XFree(cp); |
850 | 4465 |
} |
4466 |
} |
|
4467 |
prop++; |
|
4468 |
} |
|
4469 |
} |
|
4470 |
} |
|
4471 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4472 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4473 |
%}. |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4474 |
^ self |
850 | 4475 |
extractEncodingFromRegistry:registry |
4476 |
encoding:encoding |
|
4477 |
charSetCollections:charSetCollections |
|
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4478 |
! |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4479 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4480 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4481 |
"this is pure magic ..." |
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 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4484 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4485 |
(registry notNil and:[registry notEmpty]) ifTrue:[ |
850 | 4486 |
enc := registry asLowercase asSymbol. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4487 |
] ifFalse:[ |
850 | 4488 |
(encoding notNil and:[encoding notEmpty]) ifTrue:[ |
4489 |
enc := encoding asLowercase asSymbol |
|
4490 |
] ifFalse:[ |
|
4491 |
charSets := charSetCollections. |
|
4492 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
|
4493 |
charSets := charSets asUppercase asCollectionOfWords. |
|
4494 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
4495 |
enc := #iso8859 |
|
4496 |
] ifFalse:[ |
|
4497 |
(charSets includes:'ISO8859') ifTrue:[ |
|
4498 |
enc := #iso8859 |
|
4499 |
] ifFalse:[ |
|
4500 |
(charSets includes:'ASCII') ifTrue:[ |
|
4501 |
enc := #ascii |
|
4502 |
] ifFalse:[ |
|
4503 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
4504 |
enc := #iso8859 |
|
4505 |
] |
|
4506 |
] |
|
4507 |
] |
|
4508 |
] |
|
4509 |
] |
|
4510 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4511 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4512 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4513 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
4514 |
"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
|
4515 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4516 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4517 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4518 |
flushListOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4519 |
"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
|
4520 |
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
|
4521 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4522 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4523 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4524 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4525 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4526 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4527 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4528 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4529 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4530 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4531 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4532 |
|
991 | 4533 |
fontMetricsOf:fontId into:aBlock |
4534 |
"evaluate aBlock, passing a fonts metrics as arguments" |
|
4535 |
||
4536 |
|encoding avgAscent avgDescent |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4537 |
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
|
4538 |
res resX resY| |
991 | 4539 |
|
994 | 4540 |
%{ |
991 | 4541 |
XFontStruct *f; |
4542 |
int len; |
|
4543 |
||
4544 |
if (ISCONNECTED) { |
|
994 | 4545 |
if (__isExternalAddress(fontId)) { |
4546 |
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
|
4547 |
if (f) { |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4548 |
#ifdef NOTDEF |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4549 |
char *cp; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4550 |
XFontProp *prop; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4551 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4552 |
n = f->n_properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4553 |
prop = f->properties; |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4554 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4555 |
if (prop) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4556 |
while (n--) { |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4557 |
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
|
4558 |
resX = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4559 |
} 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
|
4560 |
resY = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4561 |
} 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
|
4562 |
res = __MKSMALLINT(prop->card32); |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4563 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4564 |
prop++; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4565 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4566 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4567 |
#endif |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4568 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4569 |
avgAscent = __MKSMALLINT(f->ascent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4570 |
avgDescent = __MKSMALLINT(f->descent); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4571 |
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
|
4572 |
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
|
4573 |
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
|
4574 |
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
|
4575 |
BEGIN_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4576 |
len = XTextWidth(f, " ", 1); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4577 |
END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4578 |
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
|
4579 |
} |
991 | 4580 |
} |
4581 |
} |
|
4582 |
%}. |
|
4583 |
encoding := self encodingOf:fontId. |
|
4584 |
aBlock value:encoding |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4585 |
value:avgAscent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4586 |
value:avgDescent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4587 |
value:maxAscent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4588 |
value:maxDescent |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4589 |
value:minWidth |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4590 |
value:maxWidth |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4591 |
value:avgWidth |
991 | 4592 |
! |
4593 |
||
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4594 |
fontResolutionOf:fontId |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4595 |
"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
|
4596 |
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
|
4597 |
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
|
4598 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4599 |
|res resX resY| |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4600 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4601 |
%{ |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4602 |
XFontStruct *f; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4603 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4604 |
if (ISCONNECTED) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4605 |
if (__isExternalAddress(fontId)) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4606 |
f = _FontVal(fontId); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4607 |
if (f) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4608 |
char *cp; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4609 |
XFontProp *prop; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4610 |
Atom resolutionXAtom, resolutionYAtom; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4611 |
int n; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4612 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4613 |
n = f->n_properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4614 |
prop = f->properties; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4615 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4616 |
if (prop) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4617 |
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
|
4618 |
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
|
4619 |
|
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4620 |
while (n--) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4621 |
if (prop->name == resolutionXAtom) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4622 |
resX = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4623 |
} else if (prop->name == resolutionYAtom) { |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4624 |
resY = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4625 |
} 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
|
4626 |
res = __MKSMALLINT(prop->card32); |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4627 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4628 |
prop++; |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4629 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4630 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4631 |
} |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4632 |
} |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4633 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4634 |
%}. |
1046 | 4635 |
(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
|
4636 |
^ resX @ resY |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4637 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4638 |
res notNil ifTrue:[ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
4639 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4640 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4641 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4642 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
4643 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4644 |
fullNameOf:aFontId |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4645 |
"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
|
4646 |
used for user feed-back (for example: in the fontPanel). |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4647 |
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
|
4648 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4649 |
|fullName fontName| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4650 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4651 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4652 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4653 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4654 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4655 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4656 |
Atom fontAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4657 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4658 |
fontAtom = XInternAtom(myDpy, "FONT", True); |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4659 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4660 |
if (ISCONNECTED) { |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4661 |
if (__isExternalAddress(aFontId)) { |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4662 |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4663 |
f = _FontVal(aFontId); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4664 |
if (f) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4665 |
n = f->n_properties; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4666 |
prop = f->properties; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4667 |
if (prop) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4668 |
while (n--) { |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4669 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4670 |
cp = XGetAtomName(myDpy, prop->name); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4671 |
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
|
4672 |
XFree(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4673 |
#endif |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4674 |
if (prop->name == XA_FULL_NAME) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4675 |
cp = XGetAtomName(myDpy, prop->card32); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4676 |
if (cp) { |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4677 |
fullName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4678 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4679 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4680 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4681 |
XFree(cp); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4682 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4683 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4684 |
if (prop->name == fontAtom) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4685 |
cp = XGetAtomName(myDpy, prop->card32); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4686 |
if (cp) { |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4687 |
fontName = __MKSTRING(cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4688 |
#ifdef SUPERDEBUG |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4689 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4690 |
#endif |
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
4691 |
XFree(cp); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4692 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4693 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4694 |
prop++; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4695 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4696 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4697 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4698 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4699 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4700 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4701 |
(fullName notNil and:[fullName notEmpty]) ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4702 |
^ fullName |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4703 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4704 |
^ fontName |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4705 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4706 |
|
295 | 4707 |
getAvailableFontsMatching:pattern |
4708 |
"return an Array filled with font names matching aPattern" |
|
4709 |
||
4710 |
%{ /* UNLIMITEDSTACK */ |
|
4711 |
||
4712 |
int nnames = 1500; |
|
4713 |
int available = nnames + 1; |
|
4714 |
char **fonts; |
|
4715 |
OBJ arr, str; |
|
4716 |
int i; |
|
4717 |
||
4718 |
if (ISCONNECTED) { |
|
4719 |
if (__isString(pattern)) { |
|
4720 |
for (;;) { |
|
4721 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
4722 |
if ((fonts == NULL) || (available < nnames)) break; |
|
4723 |
XFreeFontNames(fonts); |
|
4724 |
nnames = available * 2; |
|
4725 |
} |
|
4726 |
if (fonts == NULL) { |
|
4727 |
RETURN ( nil ); |
|
4728 |
} |
|
4729 |
/* |
|
4730 |
* now, that we know the number of font names, |
|
4731 |
* create the array ... |
|
4732 |
*/ |
|
4733 |
arr = __ARRAY_NEW_INT(available); |
|
4734 |
if (! arr) { |
|
4735 |
RETURN (nil); |
|
4736 |
} |
|
4737 |
/* |
|
4738 |
* ... and fill it |
|
4739 |
*/ |
|
4740 |
for (i=0; i<available; i++) { |
|
350 | 4741 |
__PROTECT__(arr); |
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
4742 |
str = __MKSTRING(fonts[i]); |
350 | 4743 |
__UNPROTECT__(arr); |
295 | 4744 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
4745 |
} |
|
4746 |
RETURN (arr); |
|
4747 |
} |
|
4748 |
} |
|
4749 |
%}. |
|
4750 |
^ nil |
|
4751 |
! |
|
4752 |
||
4753 |
getDefaultFont |
|
4754 |
"return a default font id - used when class Font cannot |
|
4755 |
find anything usable" |
|
4756 |
||
4757 |
^ self createFontFor:'fixed' |
|
4758 |
! |
|
4759 |
||
4760 |
getFontWithFamily:familyString face:faceString |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4761 |
style:styleArgString size:sizeArg encoding:encodingSym |
295 | 4762 |
|
4763 |
"try to get the specified font, if not available, try next smaller |
|
4764 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
4765 |
as family and the other parameters as nil. For example, the cursor font |
|
4766 |
can be aquired that way." |
|
4767 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4768 |
|styleString theName theId xlatedStyle id spacing| |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4769 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4770 |
styleString := styleArgString. |
295 | 4771 |
|
4772 |
"special: if face is nil, allow access to X-fonts" |
|
4773 |
faceString isNil ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4774 |
sizeArg notNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4775 |
theName := familyString , '-' , sizeArg printString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4776 |
] ifFalse:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4777 |
theName := familyString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4778 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4779 |
theName isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4780 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4781 |
mhmh - fall back to the default font |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4782 |
" |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4783 |
theName := 'fixed' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4784 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4785 |
theId := self createFontFor:theName. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4786 |
theId isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4787 |
theId := self getDefaultFont |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4788 |
]. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4789 |
^ theId |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4790 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4791 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4792 |
"/ 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
|
4793 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4794 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4795 |
((styleString endsWith:'-narrow') |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4796 |
or:[styleString endsWith:'-semicondensed']) ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4797 |
|i| |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4798 |
i := styleString lastIndexOf:$-. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4799 |
spacing := styleString copyFrom:(i+1). |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4800 |
styleString := styleString copyTo:(i-1). |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
4801 |
] ifFalse:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4802 |
spacing := 'normal'. |
295 | 4803 |
]. |
4804 |
||
4805 |
xlatedStyle := styleString. |
|
4806 |
xlatedStyle notNil ifTrue:[ |
|
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4807 |
xlatedStyle := xlatedStyle first asString |
295 | 4808 |
]. |
4809 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4810 |
id := self |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4811 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4812 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4813 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4814 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4815 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4816 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4817 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4818 |
registry:encodingSym |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4819 |
encoding:'*'. |
457
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 |
id isNil ifTrue:[ |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4822 |
(encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4823 |
"/ too stupid: encodings come in both cases |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4824 |
"/ and X does not ignore case |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4825 |
"/ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4826 |
id := self |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4827 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4828 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4829 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4830 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4831 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4832 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4833 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4834 |
registry:encodingSym asUppercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4835 |
encoding:'*'. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4836 |
id isNil ifTrue:[ |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4837 |
id := self |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4838 |
getFontWithFoundry:'*' |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4839 |
family:familyString asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4840 |
weight:faceString |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4841 |
slant:xlatedStyle |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4842 |
spacing:spacing |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4843 |
pixelSize:nil |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4844 |
size:sizeArg |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4845 |
registry:encodingSym asLowercase |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4846 |
encoding:'*'. |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4847 |
] |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
4848 |
] |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4849 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4850 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4851 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4852 |
"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
|
4853 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
295 | 4854 |
! |
4855 |
||
4856 |
getFontWithFoundry:foundry family:family weight:weight |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4857 |
slant:slant spacing:spc pixelSize:pSize size:size |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4858 |
registry:registry encoding:encoding |
295 | 4859 |
|
4860 |
"get the specified font, if not available, return nil. |
|
4861 |
This is the new font creation method - all others will be changed to |
|
4862 |
use this entry. |
|
4863 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
4864 |
||
4865 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
4866 |
family: 'helvetica' 'courier' 'times' ... |
|
4867 |
weight: 'bold' 'medium' 'demi' ... |
|
4868 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
4869 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
4870 |
pixelSize: 16,18 ... usually left empty |
|
4871 |
size: size in point (1/72th of an inch) |
|
4872 |
registry: iso8859, sgi ... '*' |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4873 |
encoding: vendor specific encoding (usually '*') |
295 | 4874 |
" |
4875 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4876 |
|theName sizeMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4877 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
1099 | 4878 |
pSizeMatch registryMatch encodingMatch| |
295 | 4879 |
|
4880 |
"this works only on 'Release >= 3' - X-servers" |
|
4881 |
"name is: |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4882 |
-foundry-family -weight -slant- |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4883 |
sony helvetica bold r |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4884 |
adobe courier medium i |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4885 |
msic fixed o |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4886 |
... ... |
295 | 4887 |
" |
4888 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4889 |
size isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4890 |
sizeMatch := '*' |
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 |
sizeMatch := size printString , '0' |
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 |
foundry isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4895 |
foundryMatch := '*' |
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 |
foundryMatch := foundry |
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 |
family isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4900 |
familyMatch := '*' |
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 |
familyMatch := family |
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 |
weight isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4905 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4906 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4907 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4908 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4909 |
slant isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4910 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4911 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4912 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4913 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4914 |
spc isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4915 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4916 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4917 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4918 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4919 |
pSize isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4920 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4921 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4922 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4923 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4924 |
registry isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4925 |
registryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4926 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4927 |
registryMatch := registry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4928 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4929 |
encoding isNil ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4930 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4931 |
] ifFalse:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4932 |
encodingMatch := encoding |
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 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4935 |
theName := ('-' , foundryMatch, |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4936 |
'-' , familyMatch, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4937 |
'-' , weightMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4938 |
'-' , slantMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4939 |
'-' , spcMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4940 |
'-*' , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4941 |
'-' , pSizeMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4942 |
'-' , sizeMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4943 |
'-*-*-*-*' , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4944 |
'-' , registryMatch , |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4945 |
'-' , encodingMatch). |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4946 |
|
697 | 4947 |
"/ Transcript showCR:theName; endEntry. |
295 | 4948 |
|
4949 |
^ self createFontFor:theName. |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4950 |
|
295 | 4951 |
|
4952 |
" |
|
4953 |
Display getFontWithFoundry:'*' |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4954 |
family:'courier' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4955 |
weight:'medium' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4956 |
slant:'r' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4957 |
spacing:nil |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4958 |
pixelSize:nil |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4959 |
size:13 |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4960 |
registry:'iso8859' |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
4961 |
encoding:'*' |
295 | 4962 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4963 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
4964 |
"Modified: 24.2.1996 / 22:33:29 / cg" |
295 | 4965 |
! |
4966 |
||
4967 |
listOfAvailableFonts |
|
4968 |
"return a list with all available fonts on this display. |
|
4969 |
Since this takes a long time, keep the result of the query for the |
|
4970 |
next time. The elements of the returned collection are instances of |
|
4971 |
FontDescription." |
|
4972 |
||
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
4973 |
|"stream aName fntDescr" names| |
295 | 4974 |
|
4975 |
listOfXFonts isNil ifTrue:[ |
|
4976 |
"/ |
|
4977 |
"/ old code; using a pipe to xlsfonts |
|
4978 |
"/ |
|
4979 |
"/ stream := PipeStream readingFrom:'xlsfonts ''*'''. |
|
4980 |
"/ stream isNil ifTrue:[^ nil]. |
|
4981 |
"/ listOfXFonts := OrderedCollection new. |
|
4982 |
"/ [stream atEnd] whileFalse:[ |
|
4983 |
"/ aName := stream nextLine. |
|
4984 |
"/ aName notNil ifTrue:[ |
|
4985 |
"/ self decomposeXFontName:aName into: |
|
4986 |
"/ [:family :face :style :size :coding | |
|
4987 |
"/ family notNil ifTrue:[ |
|
4988 |
"/ fntDescr := FontDescription |
|
4989 |
"/ family:family |
|
4990 |
"/ face:face |
|
4991 |
"/ style:style |
|
4992 |
"/ size:size |
|
4993 |
"/ encoding:coding. |
|
4994 |
"/ listOfXFonts add:fntDescr |
|
4995 |
"/ ] |
|
4996 |
"/ ] |
|
4997 |
"/ ] |
|
4998 |
"/ ]. |
|
4999 |
"/ stream close. |
|
5000 |
"/ "if xlsfont is broken ... (hey sco)" |
|
5001 |
"/ (listOfXFonts size == 0) ifTrue:[ |
|
5002 |
"/ listOfXFonts := nil |
|
5003 |
"/ ] ifFalse:[ |
|
5004 |
"/ listOfXFonts sort:[:a :b | a family < b family]. |
|
5005 |
"/ ]. |
|
5006 |
||
850 | 5007 |
"/ |
5008 |
"/ new code: |
|
5009 |
"/ use new primitive to get font names; |
|
5010 |
"/ this is much faster, and also works on systems where |
|
5011 |
"/ a) xlsfonts is broken (sco) |
|
5012 |
"/ b) xlsfonts is not available (aix) |
|
5013 |
"/ |
|
5014 |
names := self getAvailableFontsMatching:'*'. |
|
5015 |
names isNil ifTrue:[ |
|
5016 |
"no names returned ..." |
|
5017 |
^ nil |
|
5018 |
]. |
|
5019 |
listOfXFonts := names collect:[:aName | |
|
5020 |
|fntDescr| |
|
5021 |
||
5022 |
(self decomposeXFontName:aName into: |
|
5023 |
[:family :face :style :size :coding | |
|
5024 |
family notNil ifTrue:[ |
|
5025 |
fntDescr := FontDescription |
|
5026 |
family:family |
|
5027 |
face:face |
|
5028 |
style:style |
|
5029 |
size:size |
|
5030 |
encoding:coding. |
|
5031 |
] ifFalse:[ |
|
5032 |
fntDescr := FontDescription |
|
5033 |
name:aName |
|
5034 |
] |
|
5035 |
] |
|
5036 |
) ifFalse:[ |
|
5037 |
fntDescr := FontDescription name:aName. |
|
5038 |
]. |
|
5039 |
fntDescr |
|
5040 |
]. |
|
295 | 5041 |
|
5042 |
]. |
|
5043 |
^ listOfXFonts |
|
5044 |
||
5045 |
" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5046 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5047 |
|
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
5048 |
Display getAvailableFontsMatching:'*'. |
295 | 5049 |
" |
5050 |
||
5051 |
"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
|
5052 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 5053 |
! |
5054 |
||
5055 |
releaseFont:aFontId |
|
5056 |
||
5057 |
%{ /* NOCONTEXT */ |
|
5058 |
||
5059 |
XFontStruct *f; |
|
5060 |
||
5061 |
if (ISCONNECTED) { |
|
5062 |
if (__isExternalAddress(aFontId)) { |
|
5063 |
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
|
5064 |
if (f) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5065 |
BEGIN_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5066 |
XFreeFont(myDpy, f); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5067 |
#ifdef COUNT_RESOURCES |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5068 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5069 |
#endif |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5070 |
END_INTERRUPTSBLOCKED |
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
5071 |
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
|
5072 |
} |
295 | 5073 |
} |
5074 |
} |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5075 |
%}. |
295 | 5076 |
self primitiveFailed |
5077 |
! |
|
5078 |
||
466 | 5079 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 5080 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
5081 |
on this display. |
|
5082 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
5083 |
||
5084 |
|sizes| |
|
5085 |
||
466 | 5086 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 5087 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5088 |
"special: in X11R5 and above, size 0 means: |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5089 |
there are scaled versions in all sizes available" |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5090 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5091 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64) |
295 | 5092 |
]. |
5093 |
^ sizes |
|
5094 |
||
5095 |
" |
|
5096 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
5097 |
" |
|
466 | 5098 |
|
5099 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 5100 |
! |
5101 |
||
5102 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
|
5103 |
||
5104 |
%{ /* NOCONTEXT */ |
|
5105 |
||
5106 |
XFontStruct *f; |
|
5107 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5108 |
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
|
5109 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5110 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5111 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5112 |
int nInstBytes; |
295 | 5113 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5114 |
if (ISCONNECTED) { |
850 | 5115 |
if (__bothSmallInteger(index1, index2) |
5116 |
&& __isExternalAddress(aFontId) |
|
5117 |
&& __isNonNilObject(aString)) { |
|
5118 |
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
|
5119 |
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
|
5120 |
|
850 | 5121 |
i1 = __intVal(index1) - 1; |
5122 |
cls = __qClass(aString); |
|
5123 |
||
5124 |
if (i1 >= 0) { |
|
5125 |
i2 = __intVal(index2) - 1; |
|
5126 |
if (i2 < i1) { |
|
5127 |
RETURN (self); |
|
5128 |
} |
|
5129 |
||
5130 |
cp = (char *) _stringVal(aString); |
|
5131 |
l = i2 - i1 + 1; |
|
5132 |
||
5133 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
5134 |
n = _stringSize(aString); |
|
5135 |
if (i2 < n) { |
|
5136 |
cp += i1; |
|
5137 |
BEGIN_INTERRUPTSBLOCKED |
|
5138 |
len = XTextWidth(f, cp, l); |
|
5139 |
END_INTERRUPTSBLOCKED |
|
5140 |
RETURN ( __MKSMALLINT(len) ); |
|
5141 |
} |
|
5142 |
} |
|
5143 |
||
5144 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5145 |
cp += nInstBytes; |
|
5146 |
||
5147 |
if (__isBytes(aString)) { |
|
5148 |
n = __byteArraySize(aString) - nInstBytes; |
|
5149 |
if (i2 < n) { |
|
5150 |
cp += i1; |
|
5151 |
BEGIN_INTERRUPTSBLOCKED |
|
5152 |
len = XTextWidth(f, cp, l); |
|
5153 |
END_INTERRUPTSBLOCKED |
|
5154 |
RETURN ( __MKSMALLINT(len) ); |
|
5155 |
} |
|
5156 |
} |
|
5157 |
||
5158 |
/* TWOBYTESTRINGS */ |
|
5159 |
if (__isWords(aString)) { |
|
5160 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
5161 |
||
5162 |
if (i2 < n) { |
|
5163 |
union { |
|
5164 |
char b[2]; |
|
5165 |
unsigned short s; |
|
5166 |
} u; |
|
5167 |
int i; |
|
5168 |
XChar2b *cp2 = (XChar2b *)0; |
|
5169 |
int mustFree = 0; |
|
5170 |
||
5171 |
cp += (i1 * 2); |
|
5172 |
if (l > 1000) l = 1000; |
|
5173 |
||
5174 |
/* |
|
5175 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
5176 |
* X expects them MSB first |
|
5177 |
* convert as required |
|
5178 |
*/ |
|
5179 |
||
5180 |
u.s = 0x1234; |
|
5181 |
if (u.b[0] != 0x12) { |
|
5182 |
if (l <= NLOCALBUFFER) { |
|
5183 |
cp2 = xlatebuffer; |
|
5184 |
} else { |
|
5185 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
5186 |
mustFree = 1; |
|
5187 |
} |
|
5188 |
for (i=0; i<l; i++) { |
|
5189 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
5190 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
5191 |
} |
|
5192 |
cp = (char *) cp2; |
|
5193 |
} |
|
5194 |
BEGIN_INTERRUPTSBLOCKED |
|
5195 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
|
5196 |
END_INTERRUPTSBLOCKED |
|
5197 |
||
5198 |
if (mustFree) { |
|
5199 |
free(cp2); |
|
5200 |
} |
|
5201 |
||
5202 |
RETURN ( __MKSMALLINT(len) ); |
|
5203 |
} |
|
5204 |
} |
|
5205 |
} |
|
5206 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5207 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5208 |
#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
|
5209 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5210 |
%}. |
295 | 5211 |
self primitiveFailed. |
5212 |
^ nil |
|
5213 |
! |
|
5214 |
||
5215 |
widthOf:aString inFont:aFontId |
|
5216 |
||
5217 |
%{ /* NOCONTEXT */ |
|
5218 |
||
5219 |
XFontStruct *f; |
|
5220 |
char *cp; |
|
5221 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
5222 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5223 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5224 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5225 |
int nInstBytes; |
295 | 5226 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5227 |
if (ISCONNECTED) { |
850 | 5228 |
if (__isExternalAddress(aFontId) |
5229 |
&& __isNonNilObject(aString)) { |
|
5230 |
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
|
5231 |
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
|
5232 |
|
850 | 5233 |
cls = __qClass(aString); |
5234 |
||
5235 |
cp = (char *)_stringVal(aString); |
|
5236 |
||
5237 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
5238 |
n = _stringSize(aString); |
|
5239 |
BEGIN_INTERRUPTSBLOCKED |
|
5240 |
len = XTextWidth(f, cp, n); |
|
5241 |
END_INTERRUPTSBLOCKED |
|
5242 |
RETURN ( __MKSMALLINT(len) ); |
|
5243 |
} |
|
5244 |
||
5245 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5246 |
cp += nInstBytes; |
|
5247 |
||
5248 |
if (__isBytes(aString)) { |
|
5249 |
n = __byteArraySize(aString) - nInstBytes; |
|
5250 |
||
5251 |
BEGIN_INTERRUPTSBLOCKED |
|
5252 |
len = XTextWidth(f, cp, n); |
|
5253 |
END_INTERRUPTSBLOCKED |
|
5254 |
RETURN ( __MKSMALLINT(len) ); |
|
5255 |
} |
|
5256 |
||
5257 |
/* TWOBYTESTRINGS */ |
|
5258 |
if (__isWords(aString)) { |
|
5259 |
union { |
|
5260 |
char b[2]; |
|
5261 |
unsigned short s; |
|
5262 |
} u; |
|
5263 |
int i; |
|
5264 |
XChar2b *cp2; |
|
5265 |
int mustFree = 0; |
|
5266 |
||
5267 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
5268 |
if (n > 1000) n = 1000; |
|
5269 |
||
5270 |
/* |
|
5271 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
5272 |
* X expects them MSB first |
|
5273 |
* convert as required |
|
5274 |
*/ |
|
5275 |
||
5276 |
u.s = 0x1234; |
|
5277 |
if (u.b[0] != 0x12) { |
|
5278 |
if (n <= NLOCALBUFFER) { |
|
5279 |
cp2 = xlatebuffer; |
|
5280 |
} else { |
|
5281 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
5282 |
mustFree = 1; |
|
5283 |
} |
|
5284 |
||
5285 |
for (i=0; i<n; i++) { |
|
5286 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
5287 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
5288 |
} |
|
5289 |
cp = (char *) cp2; |
|
5290 |
} |
|
5291 |
||
5292 |
BEGIN_INTERRUPTSBLOCKED |
|
5293 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
|
5294 |
END_INTERRUPTSBLOCKED |
|
5295 |
||
5296 |
if (mustFree) { |
|
5297 |
free(cp2); |
|
5298 |
} |
|
5299 |
||
5300 |
RETURN ( __MKSMALLINT(len) ); |
|
5301 |
} |
|
5302 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5303 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
5304 |
#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
|
5305 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
5306 |
%}. |
295 | 5307 |
self primitiveFailed. |
5308 |
^ nil |
|
5309 |
! ! |
|
5310 |
||
5311 |
!XWorkstation methodsFor:'grabbing '! |
|
5312 |
||
5313 |
allowEvents:mode |
|
5314 |
%{ /* NOCONTEXT */ |
|
5315 |
||
5316 |
int _mode, ok = 1; |
|
5317 |
||
5318 |
if (mode == @symbol(asyncPointer)) |
|
5319 |
_mode = AsyncPointer; |
|
5320 |
else if (mode == @symbol(syncPointer)) |
|
5321 |
_mode = SyncPointer; |
|
5322 |
else if (mode == @symbol(asyncKeyboard)) |
|
5323 |
_mode = AsyncKeyboard; |
|
5324 |
else if (mode == @symbol(syncKeyboard)) |
|
5325 |
_mode = SyncKeyboard; |
|
5326 |
else if (mode == @symbol(syncBoth)) |
|
5327 |
_mode = SyncBoth; |
|
5328 |
else if (mode == @symbol(asyncBoth)) |
|
5329 |
_mode = AsyncBoth; |
|
5330 |
else if (mode == @symbol(replayPointer)) |
|
5331 |
_mode = ReplayPointer; |
|
5332 |
else if (mode == @symbol(replayKeyboard)) |
|
5333 |
_mode = ReplayKeyboard; |
|
5334 |
else |
|
5335 |
ok = 0; |
|
5336 |
||
5337 |
if (ok) { |
|
5338 |
BEGIN_INTERRUPTSBLOCKED |
|
5339 |
XAllowEvents(myDpy, _mode, CurrentTime); |
|
5340 |
END_INTERRUPTSBLOCKED |
|
5341 |
RETURN (self); |
|
5342 |
} |
|
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
5343 |
%}. |
295 | 5344 |
self primitiveFailed |
5345 |
! |
|
5346 |
||
5347 |
grabKeyboardIn:aWindowId |
|
5348 |
"grab the keyboard" |
|
5349 |
||
5350 |
%{ /* NOCONTEXT */ |
|
5351 |
int result, ok; |
|
5352 |
||
5353 |
if (__isExternalAddress(aWindowId)) { |
|
5354 |
BEGIN_INTERRUPTSBLOCKED |
|
5355 |
result = XGrabKeyboard(myDpy, |
|
5356 |
_WindowVal(aWindowId), |
|
5357 |
True /* False */, |
|
5358 |
GrabModeAsync, |
|
5359 |
GrabModeAsync, |
|
5360 |
CurrentTime); |
|
5361 |
END_INTERRUPTSBLOCKED |
|
5362 |
ok = 0; |
|
5363 |
switch(result) { |
|
5364 |
case AlreadyGrabbed: |
|
1183 | 5365 |
if (@global(ErrorPrinting) == true) { |
5366 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
|
5367 |
} |
|
295 | 5368 |
break; |
5369 |
case GrabNotViewable: |
|
1183 | 5370 |
if (@global(ErrorPrinting) == true) { |
5371 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
|
5372 |
} |
|
295 | 5373 |
break; |
5374 |
case GrabInvalidTime: |
|
1183 | 5375 |
if (@global(ErrorPrinting) == true) { |
5376 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
|
5377 |
} |
|
295 | 5378 |
break; |
5379 |
case GrabFrozen: |
|
1183 | 5380 |
if (@global(ErrorPrinting) == true) { |
5381 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
|
5382 |
} |
|
295 | 5383 |
break; |
5384 |
default: |
|
5385 |
ok = 1; |
|
5386 |
break; |
|
5387 |
} |
|
5388 |
if (! ok) { |
|
5389 |
XUngrabKeyboard(myDpy, CurrentTime); |
|
5390 |
RETURN (false); |
|
5391 |
} |
|
5392 |
||
5393 |
RETURN ( true ); |
|
5394 |
} |
|
1183 | 5395 |
%}. |
295 | 5396 |
self primitiveFailed |
5397 |
! |
|
5398 |
||
5399 |
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
|
5400 |
"grap the pointer - return true if ok" |
|
5401 |
||
5402 |
%{ /* NOCONTEXT */ |
|
5403 |
||
5404 |
int result, ok; |
|
5405 |
Window confineWin; |
|
5406 |
Cursor curs; |
|
5407 |
int pointer_mode, keyboard_mode; |
|
5408 |
||
5409 |
if (__isExternalAddress(aWindowId)) { |
|
5410 |
if (__isExternalAddress(confineId)) |
|
5411 |
confineWin = _WindowVal(confineId); |
|
5412 |
else |
|
5413 |
confineWin = (Window) None; |
|
5414 |
||
5415 |
if (__isExternalAddress(aCursorId)) |
|
5416 |
curs = _CursorVal(aCursorId); |
|
5417 |
else |
|
5418 |
curs = (Cursor) None; |
|
5419 |
||
5420 |
if (pMode == @symbol(sync)) |
|
5421 |
pointer_mode = GrabModeSync; |
|
5422 |
else |
|
5423 |
pointer_mode = GrabModeAsync; |
|
5424 |
||
5425 |
if (kMode == @symbol(sync)) |
|
5426 |
keyboard_mode = GrabModeSync; |
|
5427 |
else |
|
5428 |
keyboard_mode = GrabModeAsync; |
|
5429 |
||
5430 |
BEGIN_INTERRUPTSBLOCKED |
|
5431 |
result = XGrabPointer(myDpy, |
|
5432 |
_WindowVal(aWindowId), |
|
5433 |
False, |
|
5434 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask, |
|
5435 |
pointer_mode, keyboard_mode, |
|
5436 |
confineWin, |
|
5437 |
curs, |
|
5438 |
CurrentTime); |
|
5439 |
END_INTERRUPTSBLOCKED |
|
5440 |
||
5441 |
ok = 0; |
|
5442 |
switch (result) { |
|
5443 |
case AlreadyGrabbed: |
|
1183 | 5444 |
if (@global(ErrorPrinting) == true) { |
5445 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
|
5446 |
} |
|
295 | 5447 |
break; |
5448 |
case GrabNotViewable: |
|
1183 | 5449 |
if (@global(ErrorPrinting) == true) { |
5450 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
|
5451 |
} |
|
295 | 5452 |
break; |
5453 |
case GrabInvalidTime: |
|
1183 | 5454 |
if (@global(ErrorPrinting) == true) { |
5455 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
|
5456 |
} |
|
295 | 5457 |
break; |
5458 |
case GrabFrozen: |
|
1183 | 5459 |
if (@global(ErrorPrinting) == true) { |
5460 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
|
5461 |
} |
|
295 | 5462 |
break; |
5463 |
default: |
|
5464 |
ok = 1; |
|
5465 |
break; |
|
5466 |
} |
|
5467 |
||
5468 |
if (! ok) { |
|
5469 |
XUngrabPointer(myDpy, CurrentTime); |
|
5470 |
RETURN (false); |
|
5471 |
} |
|
5472 |
RETURN ( true ); |
|
5473 |
} |
|
1183 | 5474 |
%}. |
295 | 5475 |
self primitiveFailed |
5476 |
! |
|
5477 |
||
5478 |
ungrabKeyboard |
|
5479 |
"release the keyboard" |
|
5480 |
||
5481 |
%{ /* NOCONTEXT */ |
|
5482 |
||
5483 |
if (ISCONNECTED) { |
|
5484 |
BEGIN_INTERRUPTSBLOCKED |
|
5485 |
XUngrabKeyboard(myDpy, CurrentTime); |
|
5486 |
XSync(myDpy, 0); |
|
5487 |
END_INTERRUPTSBLOCKED |
|
5488 |
} |
|
5489 |
%}. |
|
5490 |
activeKeyboardGrab := nil |
|
5491 |
! |
|
5492 |
||
5493 |
ungrabPointer |
|
5494 |
"release the pointer" |
|
5495 |
||
5496 |
%{ /* NOCONTEXT */ |
|
5497 |
||
5498 |
if (ISCONNECTED) { |
|
5499 |
BEGIN_INTERRUPTSBLOCKED |
|
5500 |
XUngrabPointer(myDpy, CurrentTime); |
|
5501 |
XSync(myDpy, 0); |
|
5502 |
END_INTERRUPTSBLOCKED |
|
5503 |
} |
|
5504 |
%}. |
|
5505 |
activePointerGrab := nil |
|
5506 |
! ! |
|
5507 |
||
5508 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
5509 |
||
5510 |
noClipIn:aGCId |
|
5511 |
"disable clipping rectangle" |
|
5512 |
||
5513 |
%{ /* NOCONTEXT */ |
|
5514 |
||
5515 |
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
|
5516 |
GC gc; |
295 | 5517 |
|
5518 |
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
|
5519 |
gc = _GCVal(aGCId); |
295 | 5520 |
gcv.clip_mask = None; |
5521 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
|
5522 |
RETURN ( self ); |
|
5523 |
} |
|
5524 |
%}. |
|
5525 |
self primitiveFailed |
|
5526 |
! |
|
5527 |
||
5528 |
setBackground:bgColorIndex in:aGCId |
|
5529 |
"set background color to be drawn with" |
|
5530 |
||
5531 |
%{ /* NOCONTEXT */ |
|
5532 |
||
5533 |
if (__isExternalAddress(aGCId) |
|
5534 |
&& __isSmallInteger(bgColorIndex)) { |
|
555 | 5535 |
XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); |
295 | 5536 |
RETURN ( self ); |
5537 |
} |
|
5538 |
%}. |
|
5539 |
self primitiveFailed |
|
5540 |
! |
|
5541 |
||
5542 |
setBitmapMask:aBitmapId in:aGCId |
|
5543 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
|
5544 |
||
5545 |
%{ /* NOCONTEXT */ |
|
5546 |
||
5547 |
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
|
5548 |
GC gc; |
295 | 5549 |
Pixmap bitmap; |
5550 |
||
5551 |
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
|
5552 |
gc = _GCVal(aGCId); |
295 | 5553 |
if (__isExternalAddress(aBitmapId)) { |
5554 |
bitmap = _PixmapVal(aBitmapId); |
|
5555 |
XSetStipple(dpy, gc, bitmap); |
|
5556 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5557 |
RETURN ( self ); |
|
5558 |
} |
|
5559 |
if (aBitmapId == nil) { |
|
5560 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5561 |
RETURN ( self ); |
|
5562 |
} |
|
5563 |
} |
|
5564 |
%}. |
|
5565 |
self primitiveFailed |
|
5566 |
! |
|
5567 |
||
5568 |
setClipByChildren:aBool in:aGCId |
|
5569 |
"enable/disable drawing into child views" |
|
5570 |
||
5571 |
%{ /* NOCONTEXT */ |
|
5572 |
||
5573 |
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
|
5574 |
GC gc; |
295 | 5575 |
|
5576 |
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
|
5577 |
gc = _GCVal(aGCId); |
295 | 5578 |
if (aBool == true) |
5579 |
gcv.subwindow_mode = ClipByChildren; |
|
5580 |
else |
|
5581 |
gcv.subwindow_mode = IncludeInferiors; |
|
5582 |
||
5583 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
|
5584 |
RETURN ( self ); |
|
5585 |
} |
|
5586 |
%}. |
|
5587 |
self primitiveFailed |
|
5588 |
! |
|
5589 |
||
5590 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId |
|
5591 |
"clip to a rectangle" |
|
5592 |
||
5593 |
%{ /* NOCONTEXT */ |
|
5594 |
||
5595 |
XRectangle r; |
|
5596 |
||
5597 |
if (__isExternalAddress(aGCId) |
|
5598 |
&& __bothSmallInteger(clipX, clipY) |
|
5599 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
555 | 5600 |
r.x = __intVal(clipX); |
5601 |
r.y = __intVal(clipY); |
|
5602 |
r.width = __intVal(clipWidth); |
|
5603 |
r.height = __intVal(clipHeight); |
|
295 | 5604 |
XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
5605 |
RETURN ( self ); |
|
5606 |
} |
|
5607 |
%}. |
|
5608 |
self primitiveFailed |
|
5609 |
! |
|
5610 |
||
788 | 5611 |
setDashes:dashList dashOffset:offset in:aGCId |
5612 |
"set line attributes" |
|
5613 |
||
5614 |
%{ /* NOCONTEXT */ |
|
5615 |
||
5616 |
if (__isExternalAddress(aGCId) |
|
5617 |
&& __isSmallInteger(offset) |
|
5618 |
&& __isByteArray(dashList)) { |
|
850 | 5619 |
XSetDashes(myDpy, _GCVal(aGCId), |
5620 |
__intVal(offset), |
|
5621 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
5622 |
__byteArraySize(dashList)); |
|
5623 |
RETURN ( self ); |
|
788 | 5624 |
} |
5625 |
bad: ; |
|
5626 |
%}. |
|
5627 |
" |
|
5628 |
either aGCId is invalid, |
|
5629 |
and/or dashList is not a byteArray |
|
5630 |
and/or offset is not a smallInteger |
|
5631 |
" |
|
5632 |
self primitiveFailed |
|
5633 |
! |
|
5634 |
||
295 | 5635 |
setFont:aFontId in:aGCId |
5636 |
"set font to be drawn in" |
|
5637 |
||
5638 |
%{ /* NOCONTEXT */ |
|
5639 |
||
5640 |
XFontStruct *f; |
|
5641 |
||
5642 |
if (__isExternalAddress(aFontId) |
|
5643 |
&& __isExternalAddress(aGCId)) { |
|
5644 |
f = (XFontStruct *) _FontVal(aFontId); |
|
5645 |
XSetFont(myDpy, _GCVal(aGCId), f->fid); |
|
5646 |
RETURN ( self ); |
|
5647 |
} |
|
5648 |
%}. |
|
5649 |
" |
|
5650 |
aGCId and/or aFontId are invalid |
|
5651 |
" |
|
5652 |
self primitiveFailed |
|
5653 |
! |
|
5654 |
||
5655 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
|
5656 |
"set foreground and background colors to be drawn with" |
|
5657 |
||
5658 |
%{ /* NOCONTEXT */ |
|
5659 |
||
5660 |
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
|
5661 |
GC gc; |
295 | 5662 |
|
5663 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
5664 |
&& __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
|
5665 |
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
|
5666 |
|
555 | 5667 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
5668 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
295 | 5669 |
RETURN ( self ); |
5670 |
} |
|
5671 |
%}. |
|
5672 |
self primitiveFailed |
|
5673 |
! |
|
5674 |
||
5675 |
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId |
|
5676 |
"set foreground and background colors to be drawn with using mask or |
|
5677 |
solid (if aBitmapId is nil)" |
|
5678 |
||
5679 |
%{ /* NOCONTEXT */ |
|
5680 |
||
5681 |
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
|
5682 |
GC gc; |
295 | 5683 |
|
5684 |
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
|
5685 |
gc = _GCVal(aGCId); |
295 | 5686 |
if (__isSmallInteger(fgColor)) |
555 | 5687 |
XSetForeground(dpy, gc, __intVal(fgColor)); |
295 | 5688 |
if (__isSmallInteger(bgColor)) |
555 | 5689 |
XSetBackground(dpy, gc, __intVal(bgColor)); |
295 | 5690 |
|
5691 |
if (__isExternalAddress(aBitmapId)) { |
|
5692 |
XSetStipple(dpy, gc, _PixmapVal(aBitmapId)); |
|
5693 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5694 |
RETURN ( self ); |
|
5695 |
} |
|
5696 |
if (aBitmapId == nil) { |
|
5697 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5698 |
RETURN ( self ); |
|
5699 |
} |
|
5700 |
} |
|
5701 |
%}. |
|
5702 |
self primitiveFailed |
|
5703 |
! |
|
5704 |
||
5705 |
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId |
|
5706 |
"set foreground and background colors to be drawn with using mask or |
|
5707 |
solid (if aBitmapId is nil); also set lineWidth" |
|
5708 |
||
5709 |
%{ /* NOCONTEXT */ |
|
5710 |
||
5711 |
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
|
5712 |
GC gc; |
295 | 5713 |
|
5714 |
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
|
5715 |
gc = _GCVal(aGCId); |
295 | 5716 |
if (__isSmallInteger(lw)) { |
555 | 5717 |
XSetLineAttributes(dpy, gc, __intVal(lw), |
295 | 5718 |
LineSolid, CapNotLast, JoinMiter); |
5719 |
} |
|
5720 |
if (__isSmallInteger(fgColor)) |
|
555 | 5721 |
XSetForeground(dpy, gc, __intVal(fgColor)); |
295 | 5722 |
if (__isSmallInteger(bgColor)) |
555 | 5723 |
XSetBackground(dpy, gc, __intVal(bgColor)); |
295 | 5724 |
|
5725 |
if (__isExternalAddress(aBitmapId)) { |
|
5726 |
XSetStipple(dpy, gc, _PixmapVal(aBitmapId)); |
|
5727 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
5728 |
RETURN ( self ); |
|
5729 |
} |
|
5730 |
if (aBitmapId == nil) { |
|
5731 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5732 |
RETURN ( self ); |
|
5733 |
} |
|
5734 |
} |
|
5735 |
%}. |
|
5736 |
self primitiveFailed |
|
5737 |
! |
|
5738 |
||
5739 |
setForeground:fgColorIndex in:aGCId |
|
5740 |
"set foreground color to be drawn with" |
|
5741 |
||
5742 |
%{ /* NOCONTEXT */ |
|
5743 |
||
5744 |
if (__isExternalAddress(aGCId) |
|
5745 |
&& __isSmallInteger(fgColorIndex)) { |
|
555 | 5746 |
XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); |
295 | 5747 |
RETURN ( self ); |
5748 |
} |
|
5749 |
%}. |
|
5750 |
self primitiveFailed |
|
5751 |
! |
|
5752 |
||
5753 |
setFunction:aFunctionSymbol in:aGCId |
|
5754 |
"set alu function to be drawn with" |
|
5755 |
||
5756 |
%{ /* NOCONTEXT */ |
|
5757 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
5758 |
GC gc; |
295 | 5759 |
int fun = -1; |
5760 |
||
5761 |
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
|
5762 |
gc = _GCVal(aGCId); |
295 | 5763 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
5764 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
|
5765 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
|
5766 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
|
5767 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
|
5768 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
|
5769 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
|
5770 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
|
5771 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
|
5772 |
if (fun != -1) { |
|
5773 |
XSetFunction(myDpy, gc, fun); |
|
5774 |
RETURN ( self ); |
|
5775 |
} |
|
5776 |
} |
|
5777 |
%}. |
|
5778 |
" |
|
5779 |
either aGCId is not an integer, or an invalid symbol |
|
5780 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
5781 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
5782 |
" |
|
5783 |
self primitiveFailed |
|
5784 |
! |
|
5785 |
||
5786 |
setGraphicsExposures:aBoolean in:aGCId |
|
5787 |
"set or clear the graphics exposures flag" |
|
5788 |
||
5789 |
%{ /* NOCONTEXT */ |
|
5790 |
||
5791 |
if (__isExternalAddress(aGCId)) { |
|
5792 |
XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); |
|
5793 |
RETURN ( self ); |
|
5794 |
} |
|
5795 |
%} |
|
5796 |
. |
|
5797 |
self primitiveFailed |
|
5798 |
! |
|
5799 |
||
5800 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
|
5801 |
"set line attributes" |
|
5802 |
||
5803 |
%{ /* NOCONTEXT */ |
|
5804 |
||
5805 |
int x_style, x_cap, x_join; |
|
5806 |
||
5807 |
if (__isExternalAddress(aGCId) |
|
5808 |
&& __isSmallInteger(aNumber)) { |
|
5809 |
if (lineStyle == @symbol(solid)) x_style = LineSolid; |
|
5810 |
else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash; |
|
5811 |
else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash; |
|
5812 |
else goto bad; |
|
5813 |
||
5814 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
|
5815 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
|
5816 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
|
5817 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
|
5818 |
else goto bad; |
|
5819 |
||
5820 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
|
5821 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
|
5822 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
|
5823 |
else goto bad; |
|
5824 |
||
5825 |
XSetLineAttributes(myDpy, |
|
555 | 5826 |
_GCVal(aGCId), __intVal(aNumber), |
295 | 5827 |
x_style, x_cap, x_join); |
5828 |
RETURN ( self ); |
|
5829 |
} |
|
5830 |
bad: ; |
|
5831 |
%}. |
|
5832 |
" |
|
5833 |
either aGCId is invalid, |
|
5834 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
|
5835 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
5836 |
and/or joinStyle is none of #miter, #bevel, #round |
|
5837 |
" |
|
5838 |
self primitiveFailed |
|
5839 |
! |
|
5840 |
||
5841 |
setMaskOriginX:orgX y:orgY in:aGCid |
|
5842 |
"set the mask origin" |
|
5843 |
||
5844 |
%{ /* NOCONTEXT */ |
|
5845 |
||
5846 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
|
555 | 5847 |
XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
295 | 5848 |
RETURN ( self ); |
5849 |
} |
|
5850 |
%}. |
|
5851 |
self primitiveFailed |
|
5852 |
! |
|
5853 |
||
5854 |
setPixmapMask:aPixmapId in:aGCId |
|
5855 |
"set or clear the drawing mask - a pixmap mask providing full color" |
|
5856 |
||
5857 |
%{ /* NOCONTEXT */ |
|
5858 |
||
5859 |
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
|
5860 |
GC gc; |
295 | 5861 |
Pixmap pixmap; |
5862 |
||
5863 |
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
|
5864 |
gc = _GCVal(aGCId); |
295 | 5865 |
if (__isExternalAddress(aPixmapId)) { |
5866 |
pixmap = _PixmapVal(aPixmapId); |
|
5867 |
XSetTile(dpy, gc, pixmap); |
|
5868 |
XSetFillStyle(dpy, gc, FillTiled); |
|
5869 |
RETURN ( self ); |
|
5870 |
} |
|
5871 |
if (aPixmapId == nil) { |
|
5872 |
XSetFillStyle(dpy, gc, FillSolid); |
|
5873 |
RETURN ( self ); |
|
5874 |
} |
|
5875 |
} |
|
5876 |
%}. |
|
5877 |
self primitiveFailed |
|
5878 |
! ! |
|
5879 |
||
5880 |
!XWorkstation methodsFor:'initialize / release'! |
|
5881 |
||
5882 |
close |
|
5883 |
"close down the connection to the X-server" |
|
5884 |
||
5885 |
%{ /* NOCONTEXT */ |
|
5886 |
||
5887 |
if (ISCONNECTED) { |
|
5888 |
BEGIN_INTERRUPTSBLOCKED |
|
5889 |
XCloseDisplay(myDpy); |
|
555 | 5890 |
__INST(displayId) = nil; |
295 | 5891 |
END_INTERRUPTSBLOCKED |
5892 |
} |
|
5893 |
%} |
|
5894 |
! |
|
5895 |
||
5896 |
initializeDefaultValues |
|
5897 |
buttonTranslation := ButtonTranslation. |
|
5898 |
multiClickTimeDelta := MultiClickTimeDelta. |
|
5899 |
||
5900 |
self initializeModifierMappings |
|
5901 |
! |
|
5902 |
||
5903 |
initializeEventBuffer |
|
5904 |
|sz| |
|
5905 |
||
5906 |
%{ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5907 |
sz = __MKSMALLINT(sizeof(XEvent) + 100); |
295 | 5908 |
%}. |
5909 |
eventBuffer isNil ifTrue:[ |
|
5910 |
eventBuffer := ByteArray new:sz. |
|
5911 |
]. |
|
5912 |
! |
|
5913 |
||
5914 |
initializeFor:aDisplayName |
|
5915 |
"initialize the receiver for a connection to an X-Server; |
|
5916 |
the argument, aDisplayName may be nil (for the default server from |
|
5917 |
DISPLAY-variable or command line argument) or the name of the server |
|
5918 |
as hostname:number" |
|
5919 |
||
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5920 |
|dpyName index arguments| |
295 | 5921 |
|
5922 |
dpyName := aDisplayName. |
|
5923 |
dpyName isNil ifTrue:[ |
|
5924 |
"look for a '-display xxx' argument" |
|
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5925 |
(arguments := Smalltalk commandLineArguments) notNil ifTrue:[ |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5926 |
index := arguments indexOf:'-display'. |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5927 |
(index between:1 and:(arguments size - 1)) ifTrue:[ |
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
5928 |
dpyName := arguments at:index+1 |
295 | 5929 |
] |
5930 |
] |
|
5931 |
]. |
|
5932 |
%{ |
|
5933 |
int scr; |
|
5934 |
Display *dpy; |
|
5935 |
Visual *visual; |
|
5936 |
XVisualInfo viproto; |
|
5937 |
XVisualInfo *vip; /* retured info */ |
|
5938 |
int maxRGBDepth; |
|
5939 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
5940 |
int rgbVisualID; |
|
5941 |
int nvi, i; |
|
5942 |
char *type, *nm; |
|
5943 |
int dummy; |
|
5944 |
OBJ dpyID; |
|
5945 |
||
555 | 5946 |
if (__INST(displayId) != nil) { |
295 | 5947 |
/* |
5948 |
* already connected - you bad guy try to |
|
5949 |
* trick me manually ? |
|
5950 |
*/ |
|
5951 |
RETURN ( self ); |
|
5952 |
} |
|
5953 |
||
5954 |
BEGIN_INTERRUPTSBLOCKED |
|
5955 |
||
5956 |
if (__isString(dpyName)) |
|
5957 |
nm = (char *)_stringVal(dpyName); |
|
5958 |
else { |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
5959 |
dpyName = __MKSTRING((char *)getenv("DISPLAY")); |
295 | 5960 |
nm = NULL; |
5961 |
} |
|
5962 |
dpy = XOpenDisplay(nm); |
|
5963 |
||
5964 |
if (dpy) { |
|
555 | 5965 |
__INST(displayId) = dpyID = __MKOBJ(dpy); __STORE(self, dpyID); |
295 | 5966 |
|
5967 |
#ifdef SUPERDEBUG |
|
5968 |
XSynchronize(dpy, 1); |
|
5969 |
#endif |
|
5970 |
||
5971 |
XSetErrorHandler(__XErrorHandler__); |
|
5972 |
} |
|
5973 |
||
5974 |
END_INTERRUPTSBLOCKED |
|
5975 |
%}. |
|
5976 |
displayId isNil ifTrue:[ |
|
1180 | 5977 |
'XWorkstation [warning]: cannot connect to Display.' errorPrintCR. |
295 | 5978 |
^ nil |
5979 |
]. |
|
5980 |
||
5981 |
dispatching := false. |
|
5982 |
dispatchingExpose := false. |
|
5983 |
isSlow := false. |
|
5984 |
shiftDown := false. |
|
5985 |
ctrlDown := false. |
|
5986 |
metaDown := false. |
|
5987 |
altDown := false. |
|
5988 |
motionEventCompression := true. |
|
5989 |
buttonsPressed := 0. |
|
5990 |
displayName := dpyName. |
|
5991 |
||
5992 |
protocolsAtom := nil. |
|
5993 |
deleteWindowAtom := nil. |
|
5994 |
saveYourselfAtom := nil. |
|
5995 |
quitAppAtom := nil. |
|
5996 |
||
5997 |
self initializeScreenProperties. |
|
5998 |
||
5999 |
self initializeDefaultValues. |
|
6000 |
self initializeEventBuffer. |
|
6001 |
self initializeSpecialFlags. |
|
6002 |
self initializeKeyboardMap. |
|
6003 |
||
6004 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
|
6005 |
! |
|
6006 |
||
6007 |
initializeModifierMappings |
|
6008 |
|map mod| |
|
6009 |
||
6010 |
"/ altModifiers := #(Alt_L Alt_R). |
|
6011 |
"/ metaModifiers := #(Meta_L Meta_R). |
|
6012 |
"/ ctrlModifiers := #(Control_L Control_R). |
|
6013 |
"/ shiftModifiers := #(Shift_L Shift_R). |
|
6014 |
||
6015 |
shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil. |
|
6016 |
altModifierMask := metaModifierMask := nil. |
|
6017 |
||
6018 |
map := self modifierMapping. |
|
342 | 6019 |
map isNil ifTrue:[ |
6020 |
"/ |
|
6021 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
|
6022 |
"/ setup some reasonable default. If that is not sufficient, |
|
6023 |
"/ you have to change things from your display.rc file. |
|
6024 |
"/ |
|
6025 |
altModifierMask := self modifier1Mask. |
|
6026 |
metaModifierMask := self modifier2Mask. |
|
6027 |
||
6028 |
shiftModifiers := #(Shift_L Shift_R Shift). |
|
6029 |
ctrlModifiers := #(Control_L Control_R Control). |
|
6030 |
metaModifiers := #(Alt_L Meta_L Meta_R Meta). |
|
6031 |
altModifiers := #(Alt_R Alt). |
|
6032 |
] ifFalse:[ |
|
6033 |
altModifierMask := 0. |
|
374 | 6034 |
metaModifierMask := 0. |
6035 |
||
6036 |
mod := map at:1. |
|
6037 |
mod notNil ifTrue:[ |
|
342 | 6038 |
shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
374 | 6039 |
]. |
6040 |
mod := map at:3. |
|
6041 |
mod notNil ifTrue:[ |
|
342 | 6042 |
ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
374 | 6043 |
]. |
6044 |
mod := map at:4. |
|
6045 |
mod notNil ifTrue:[ |
|
342 | 6046 |
metaModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
6047 |
metaModifierMask := 1 bitShift:(4-1). |
|
374 | 6048 |
]. |
6049 |
mod := map at:5. |
|
6050 |
mod notNil ifTrue:[ |
|
342 | 6051 |
altModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
6052 |
altModifierMask := 1 bitShift:(5-1). |
|
6053 |
] |
|
295 | 6054 |
]. |
6055 |
||
6056 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
6057 |
! |
|
6058 |
||
6059 |
initializeScreenProperties |
|
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6060 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6061 |
|
295 | 6062 |
%{ /* NOCONTEXT */ |
6063 |
||
6064 |
Display *dpy = myDpy; |
|
6065 |
int scr; |
|
6066 |
Visual *visual; |
|
6067 |
XVisualInfo viproto; |
|
6068 |
XVisualInfo *vip; /* retured info */ |
|
6069 |
int maxRGBDepth; |
|
6070 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
6071 |
int rgbVisualID; |
|
6072 |
int nvi, i; |
|
6073 |
int shapeEventBase, shapeErrorBase; |
|
6074 |
int shmEventBase, shmErrorBase; |
|
6075 |
char *type, *nm; |
|
6076 |
int dummy; |
|
6077 |
int mask, shift, nBits; |
|
6078 |
||
6079 |
if (ISCONNECTED) { |
|
850 | 6080 |
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask); |
6081 |
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask); |
|
6082 |
||
6083 |
BEGIN_INTERRUPTSBLOCKED |
|
6084 |
||
6085 |
__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy)); |
|
6086 |
__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr)); |
|
6087 |
__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr)); |
|
6088 |
__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr)); |
|
6089 |
__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr)); |
|
6090 |
__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr)); |
|
6091 |
__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr)); |
|
6092 |
__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr)); |
|
6093 |
__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr)); |
|
295 | 6094 |
|
6095 |
#ifdef SHAPE |
|
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
6096 |
if (XShapeQueryExtension(dpy, &dummy, &dummy)) |
850 | 6097 |
__INST(hasShapeExtension) = true; |
6098 |
else |
|
295 | 6099 |
#endif |
850 | 6100 |
__INST(hasShapeExtension) = false; |
295 | 6101 |
|
6102 |
#ifdef SHM |
|
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
6103 |
if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) |
850 | 6104 |
__INST(hasShmExtension) = true; |
6105 |
else |
|
295 | 6106 |
#endif |
850 | 6107 |
__INST(hasShmExtension) = false; |
295 | 6108 |
|
6109 |
#ifdef DPS |
|
850 | 6110 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
6111 |
__INST(hasDPSExtension) = true; |
|
6112 |
else |
|
295 | 6113 |
#endif |
850 | 6114 |
__INST(hasDPSExtension) = false; |
295 | 6115 |
|
6116 |
#ifdef XVIDEO |
|
850 | 6117 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
6118 |
__INST(hasXVideoExtension) = true; |
|
6119 |
else |
|
295 | 6120 |
#endif |
850 | 6121 |
__INST(hasXVideoExtension) = false; |
295 | 6122 |
|
6123 |
#ifdef MBUF |
|
850 | 6124 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
6125 |
__INST(hasMbufExtension) = true; |
|
6126 |
else |
|
295 | 6127 |
#endif |
850 | 6128 |
__INST(hasMbufExtension) = false; |
295 | 6129 |
|
6130 |
#ifdef PEX5 |
|
850 | 6131 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) |
6132 |
__INST(hasPEXExtension) = true; |
|
6133 |
else |
|
295 | 6134 |
#endif |
850 | 6135 |
__INST(hasPEXExtension) = false; |
295 | 6136 |
|
6137 |
#ifdef XIE |
|
850 | 6138 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) |
6139 |
__INST(hasImageExtension) = true; |
|
6140 |
else |
|
295 | 6141 |
#endif |
850 | 6142 |
__INST(hasImageExtension) = false; |
295 | 6143 |
|
6144 |
#ifdef XI |
|
850 | 6145 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) |
6146 |
__INST(hasInputExtension) = true; |
|
6147 |
else |
|
295 | 6148 |
#endif |
850 | 6149 |
__INST(hasInputExtension) = false; |
6150 |
||
6151 |
/* |
|
6152 |
* look for RGB visual |
|
6153 |
*/ |
|
6154 |
nvi = 0; |
|
6155 |
viproto.screen = scr; |
|
6156 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
|
6157 |
maxRGBDepth = 0; |
|
6158 |
for (i = 0; i < nvi; i++) { |
|
6159 |
switch (vip[i].class) { |
|
6160 |
case TrueColor: |
|
6161 |
if (vip[i].depth > maxRGBDepth) { |
|
6162 |
maxRGBDepth = vip[i].depth; |
|
6163 |
rgbRedMask = vip[i].red_mask; |
|
6164 |
rgbGreenMask = vip[i].green_mask; |
|
6165 |
rgbBlueMask = vip[i].blue_mask; |
|
6166 |
rgbVisualID = vip[i].visualid; |
|
6167 |
} |
|
6168 |
break; |
|
6169 |
} |
|
6170 |
} |
|
6171 |
if (vip) XFree ((char *) vip); |
|
6172 |
||
6173 |
if (maxRGBDepth) { |
|
6174 |
__INST(rgbVisual) = __MKOBJ(rgbVisualID); __STORESELF(rgbVisual); |
|
6175 |
} |
|
6176 |
||
6177 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
6178 |
__INST(monitorType) = @symbol(unknown); |
|
6179 |
__INST(hasColors) = true; |
|
6180 |
__INST(hasGreyscales) = true; |
|
6181 |
switch (visual->class) { |
|
6182 |
case StaticGray: |
|
6183 |
__INST(visualType) = @symbol(StaticGray); |
|
6184 |
__INST(hasColors) = false; |
|
6185 |
__INST(monitorType) = @symbol(monochrome); |
|
6186 |
break; |
|
6187 |
case GrayScale: |
|
6188 |
__INST(visualType) = @symbol(GrayScale); |
|
6189 |
__INST(hasColors) = false; |
|
6190 |
__INST(monitorType) = @symbol(monochrome); |
|
6191 |
break; |
|
6192 |
case StaticColor: |
|
6193 |
__INST(visualType) = @symbol(StaticColor); |
|
6194 |
break; |
|
6195 |
case PseudoColor: |
|
6196 |
__INST(visualType) = @symbol(PseudoColor); |
|
6197 |
break; |
|
6198 |
case TrueColor: |
|
6199 |
__INST(visualType) = @symbol(TrueColor); |
|
6200 |
break; |
|
6201 |
case DirectColor: |
|
6202 |
__INST(visualType) = @symbol(DirectColor); |
|
6203 |
break; |
|
6204 |
} |
|
6205 |
if (DisplayCells(dpy, scr) == 2) { |
|
6206 |
__INST(hasColors) = false; |
|
6207 |
__INST(hasGreyscales) = false; |
|
6208 |
__INST(monitorType) = @symbol(monochrome); |
|
6209 |
} |
|
6210 |
__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb); |
|
6211 |
__INST(redMask) = __MKSMALLINT(visual->red_mask); |
|
6212 |
__INST(greenMask) = __MKSMALLINT(visual->green_mask); |
|
6213 |
__INST(blueMask) = __MKSMALLINT(visual->blue_mask); |
|
6214 |
switch (visual->class) { |
|
6215 |
case TrueColor: |
|
6216 |
/* extract number of bits and shift counts */ |
|
6217 |
mask = visual->red_mask; |
|
6218 |
shift = 0; |
|
6219 |
while (mask && ((mask & 1) == 0)) { |
|
6220 |
mask >>= 1; |
|
6221 |
shift++; |
|
6222 |
} |
|
6223 |
__INST(redShift) = __MKSMALLINT(shift); |
|
6224 |
nBits = 0; |
|
6225 |
while (mask) { |
|
6226 |
mask >>= 1; |
|
6227 |
nBits++; |
|
6228 |
} |
|
6229 |
__INST(bitsRed) = __MKSMALLINT(nBits); |
|
6230 |
||
6231 |
mask = visual->green_mask; |
|
6232 |
shift = 0; |
|
6233 |
while (mask && ((mask & 1) == 0)) { |
|
6234 |
mask >>= 1; |
|
6235 |
shift++; |
|
6236 |
} |
|
6237 |
__INST(greenShift) = __MKSMALLINT(shift); |
|
6238 |
nBits = 0; |
|
6239 |
while (mask) { |
|
6240 |
mask >>= 1; |
|
6241 |
nBits++; |
|
6242 |
} |
|
6243 |
__INST(bitsGreen) = __MKSMALLINT(nBits); |
|
6244 |
||
6245 |
mask = visual->blue_mask; |
|
6246 |
shift = 0; |
|
6247 |
while (mask && ((mask & 1) == 0)) { |
|
6248 |
mask >>= 1; |
|
6249 |
shift++; |
|
6250 |
} |
|
6251 |
__INST(blueShift) = __MKSMALLINT(shift); |
|
6252 |
nBits = 0; |
|
6253 |
while (mask) { |
|
6254 |
mask >>= 1; |
|
6255 |
nBits++; |
|
6256 |
} |
|
6257 |
__INST(bitsBlue) = __MKSMALLINT(nBits); |
|
6258 |
break; |
|
6259 |
} |
|
295 | 6260 |
|
6261 |
#ifndef XA_PRIMARY |
|
850 | 6262 |
__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) ); |
295 | 6263 |
#else |
850 | 6264 |
__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY ); |
295 | 6265 |
#endif |
6266 |
#ifndef XA_SECONDARY |
|
850 | 6267 |
__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) ); |
295 | 6268 |
#else |
850 | 6269 |
__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY ); |
295 | 6270 |
#endif |
6271 |
#ifndef XA_CUT_BUFFER0 |
|
850 | 6272 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) ); |
295 | 6273 |
#else |
850 | 6274 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 ); |
295 | 6275 |
#endif |
6276 |
#ifndef XA_STRING |
|
850 | 6277 |
__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) ); |
295 | 6278 |
#else |
850 | 6279 |
__INST(stringAtom) = __MKATOMOBJ( XA_STRING ); |
295 | 6280 |
#endif |
6281 |
#ifndef XA_LENGTH |
|
850 | 6282 |
__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) ); |
295 | 6283 |
#else |
850 | 6284 |
__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH ); |
295 | 6285 |
#endif |
6286 |
||
850 | 6287 |
END_INTERRUPTSBLOCKED |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6288 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
6289 |
%}. |
295 | 6290 |
! |
6291 |
||
6292 |
initializeSpecialFlags |
|
6293 |
"perform additional special server implementation flags" |
|
6294 |
||
6295 |
"/ |
|
6296 |
"/ assume we have it ... (should check) |
|
6297 |
"/ |
|
6298 |
hasSaveUnder := true. |
|
6299 |
ignoreBackingStore := false. |
|
6300 |
||
6301 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
6302 |
"/ |
|
6303 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
6304 |
"/ which does not correctly handle saveUnder |
|
6305 |
"/ |
|
6306 |
hasSaveUnder := false. |
|
6307 |
]. |
|
6308 |
! |
|
6309 |
||
6310 |
reinitialize |
|
6311 |
virtualRootId := rootId := nil. |
|
6312 |
super reinitialize. |
|
6313 |
dispatchingExpose := nil |
|
6314 |
! ! |
|
6315 |
||
6316 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
6317 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6318 |
altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6319 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6320 |
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
|
6321 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6322 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6323 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6324 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6325 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6326 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6327 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6328 |
|
341 | 6329 |
altModifierMask:aSmallInteger |
6330 |
"define which key takes the role of an alt-key. |
|
6331 |
By default, this is X's modifier1, which is the ALT key on |
|
6332 |
most keyboards. However, there may be exceptions to this, |
|
6333 |
and the setting can be changed with: |
|
6334 |
Display altModifierMask:(Display modifier2Mask) |
|
6335 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
|
6336 |
" |
|
6337 |
||
6338 |
altModifierMask := aSmallInteger |
|
6339 |
! |
|
6340 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6341 |
metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6342 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6343 |
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
|
6344 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6345 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6346 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6347 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6348 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6349 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6350 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6351 |
|
341 | 6352 |
metaModifierMask:aSmallInteger |
6353 |
"define which key takes the role of a meta key. |
|
6354 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
6355 |
most keyboards (if present at all). |
|
6356 |
However, there may be exceptions to this, and the setting can |
|
6357 |
be changed with: |
|
6358 |
Display metaModifierMask:(Display modifier1Mask) |
|
6359 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
|
6360 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
6361 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
6362 |
all the time. On those, you should disable the meta key by setting |
|
6363 |
the mask to 0. |
|
6364 |
" |
|
6365 |
||
6366 |
metaModifierMask := aSmallInteger |
|
6367 |
! |
|
6368 |
||
6369 |
modifier1Mask |
|
6370 |
"return the Xlib mask bit for the 1st modifier key. |
|
6371 |
See comment in altModifierMask: / metaModifierMask: for what |
|
6372 |
this could be used." |
|
6373 |
||
6374 |
%{ /* NOCONTEXT */ |
|
6375 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
6376 |
%} |
|
6377 |
! |
|
6378 |
||
6379 |
modifier2Mask |
|
6380 |
"return the Xlib mask bit for the 2nd modifier key. |
|
6381 |
See comment in altModifierMask: / metaModifierMask: for what |
|
6382 |
this could be used." |
|
6383 |
||
6384 |
%{ /* NOCONTEXT */ |
|
6385 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
6386 |
%} |
|
6387 |
! |
|
6388 |
||
6389 |
modifierMapping |
|
6390 |
"Get the Modifier Mapping. |
|
6391 |
We return an array of arrays of keycodes" |
|
6392 |
||
6393 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
6394 |
||
6395 |
%{ |
|
6396 |
Display *dpy = myDpy; |
|
6397 |
XModifierKeymap *modmap; |
|
6398 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
6399 |
||
6400 |
if (ISCONNECTED) { |
|
6401 |
if ((modmap = XGetModifierMapping(myDpy)) != 0) { |
|
6402 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
6403 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
|
6404 |
if (modifierKeyMap != nil) { |
|
6405 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
6406 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
|
6407 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
|
6408 |
} |
|
6409 |
XFreeModifiermap(modmap); |
|
6410 |
} |
|
6411 |
} |
|
6412 |
%}. |
|
6413 |
||
6414 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
6415 |
||
6416 |
ret := Array new:8. |
|
6417 |
nextKey := 1. |
|
6418 |
1 to:8 do:[ :i | |
|
6419 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
|
6420 |
|mod| |
|
6421 |
||
6422 |
mod := OrderedCollection new:maxKeyPerMod. |
|
6423 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
6424 |
key ~= 0 ifTrue:[ |
|
6425 |
mod add:key |
|
6426 |
]. |
|
6427 |
]. |
|
6428 |
ret at:i put:mod. |
|
6429 |
]. |
|
6430 |
nextKey := nextKey+maxKeyPerMod. |
|
6431 |
]. |
|
6432 |
||
6433 |
^ ret |
|
6434 |
||
6435 |
" |
|
6436 |
Display modifierMapping |
|
6437 |
" |
|
6438 |
! |
|
6439 |
||
6440 |
stringFromKeycode:code |
|
6441 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
|
6442 |
||
6443 |
|str| |
|
6444 |
||
6445 |
%{ |
|
6446 |
Display *dpy = myDpy; |
|
6447 |
KeySym keysym; |
|
6448 |
char *keystring; |
|
6449 |
||
6450 |
if (ISCONNECTED && __isSmallInteger(code)) { |
|
6451 |
if ((keysym = XKeycodeToKeysym(myDpy, __intVal(code), 0)) != NoSymbol && |
|
6452 |
(keystring = XKeysymToString(keysym)) != 0) |
|
6453 |
str = __MKSTRING(keystring); |
|
6454 |
} |
|
6455 |
%}. |
|
6456 |
^ str |
|
6457 |
||
6458 |
" |
|
6459 |
Display stringFromKeycode:28 |
|
6460 |
" |
|
6461 |
! |
|
6462 |
||
295 | 6463 |
translateKey:untranslatedKey |
6464 |
"Return the key translated via the translation table. |
|
6465 |
Here, we preTranslate the key into a common ST/X symbolic name, |
|
6466 |
which gets further processed in the superclasses translation method." |
|
6467 |
||
6468 |
|key| |
|
6469 |
||
6470 |
(key := untranslatedKey) isString ifTrue:[ |
|
6471 |
key := RawKeysymTranslation at:key ifAbsent:key. |
|
6472 |
key := key asSymbol. |
|
6473 |
]. |
|
6474 |
^ super translateKey:key |
|
6475 |
! ! |
|
6476 |
||
6477 |
!XWorkstation methodsFor:'misc'! |
|
6478 |
||
6479 |
beep |
|
6480 |
"output an audible beep or bell" |
|
6481 |
||
6482 |
self beep:50 |
|
6483 |
! |
|
6484 |
||
6485 |
beep:volumeInPercent |
|
6486 |
"output an audible beep" |
|
6487 |
%{ |
|
6488 |
int volume; |
|
6489 |
||
6490 |
if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
|
6491 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
|
555 | 6492 |
volume = __intVal(volumeInPercent) * 2 - 100; |
295 | 6493 |
if (volume < -100) volume = -100; |
6494 |
else if (volume > 100) volume = 100; |
|
6495 |
BEGIN_INTERRUPTSBLOCKED |
|
6496 |
XBell(myDpy, volume); |
|
6497 |
END_INTERRUPTSBLOCKED |
|
6498 |
} |
|
6499 |
%} |
|
6500 |
! |
|
6501 |
||
6502 |
buffered |
|
6503 |
"buffer drawing - do not send it immediately to the display. |
|
374 | 6504 |
This is the default anyway. |
6505 |
See #unBuffered for additional info." |
|
295 | 6506 |
|
6507 |
%{ /* NOCONTEXT */ |
|
6508 |
||
6509 |
if (ISCONNECTED) { |
|
6510 |
BEGIN_INTERRUPTSBLOCKED |
|
6511 |
XSynchronize(myDpy, 0); |
|
6512 |
END_INTERRUPTSBLOCKED |
|
6513 |
} |
|
6514 |
%} |
|
374 | 6515 |
" |
6516 |
Display buffered |
|
6517 |
" |
|
295 | 6518 |
! |
6519 |
||
6520 |
flush |
|
6521 |
"send all buffered drawing to the display. |
|
6522 |
This may be required to make certain, that all previous operations |
|
6523 |
are really sent to the display before continuing. For example, |
|
6524 |
after a cursor-change with a followup long computation. |
|
374 | 6525 |
(otherwise, the cursor change request may still be in the output buffer) |
6526 |
See also #sync, which even waits until the request has been processed." |
|
295 | 6527 |
|
6528 |
%{ /* NOCONTEXT */ |
|
6529 |
||
6530 |
if (ISCONNECTED) { |
|
6531 |
BEGIN_INTERRUPTSBLOCKED |
|
310 | 6532 |
XFlush(myDpy); |
6533 |
END_INTERRUPTSBLOCKED |
|
6534 |
} |
|
6535 |
%} |
|
6536 |
! |
|
6537 |
||
295 | 6538 |
flushDpsContext:aDPSContext |
6539 |
||
6540 |
%{ /* NOCONTEXT */ |
|
6541 |
#ifdef DPS |
|
6542 |
if (__isExternalAddress(aDPSContext)) { |
|
6543 |
BEGIN_INTERRUPTSBLOCKED |
|
6544 |
DPSFlushContext(MKDPSCONTEXT(aDPSContext)); |
|
6545 |
END_INTERRUPTSBLOCKED |
|
6546 |
RETURN ( self ); |
|
6547 |
} |
|
6548 |
#endif |
|
374 | 6549 |
%}. |
295 | 6550 |
self primitiveFailed |
6551 |
! |
|
6552 |
||
6553 |
refreshKeyboardMapping:eB |
|
6554 |
%{ |
|
6555 |
XMappingEvent *ev; |
|
6556 |
||
6557 |
if (__isByteArray(eB)) { |
|
555 | 6558 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 6559 |
XRefreshKeyboardMapping(ev); |
6560 |
} |
|
6561 |
%} |
|
6562 |
! |
|
6563 |
||
6564 |
setInputFocusTo:aWindowId |
|
6565 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
|
6566 |
self setInputFocusTo:aWindowId revertTo:#root |
|
6567 |
! |
|
6568 |
||
6569 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
|
6570 |
"set the focus to the view as defined by aWindowId. |
|
6571 |
Passing nil set the focus to no window and lets the display discard all |
|
6572 |
input until a new focus is set. |
|
6573 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
6574 |
passing one of #parent, #root or nil specifies that the focus should be |
|
6575 |
given to the parent view, the root view or no view." |
|
6576 |
||
6577 |
%{ /* NOCONTEXT */ |
|
6578 |
int arg; |
|
6579 |
Window focusWindow; |
|
6580 |
||
6581 |
if (ISCONNECTED) { |
|
6582 |
if (__isExternalAddress(aWindowId)) { |
|
6583 |
focusWindow = _WindowVal(aWindowId); |
|
6584 |
} else { |
|
6585 |
focusWindow = None; |
|
6586 |
} |
|
6587 |
if (revertSymbol == @symbol(parent)) |
|
6588 |
arg = RevertToParent; |
|
6589 |
else if (revertSymbol == @symbol(root)) |
|
6590 |
arg = RevertToPointerRoot; |
|
6591 |
else |
|
6592 |
arg = RevertToNone; |
|
6593 |
||
6594 |
BEGIN_INTERRUPTSBLOCKED |
|
6595 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
|
6596 |
END_INTERRUPTSBLOCKED |
|
6597 |
RETURN ( self ); |
|
6598 |
} |
|
6599 |
%}. |
|
6600 |
self primitiveFailed |
|
6601 |
! |
|
6602 |
||
341 | 6603 |
sync |
6604 |
"send all buffered drawing to the display AND wait until the display |
|
6605 |
has finished drawing it. |
|
6606 |
This is almost never needed, except if you are about to read previously |
|
374 | 6607 |
drawn pixels back from the display screen, or you want to wait for a beep |
6608 |
to be finished. See also #flush." |
|
341 | 6609 |
|
6610 |
%{ /* NOCONTEXT */ |
|
6611 |
||
6612 |
if (ISCONNECTED) { |
|
6613 |
BEGIN_INTERRUPTSBLOCKED |
|
6614 |
XSync(myDpy, 0); |
|
6615 |
END_INTERRUPTSBLOCKED |
|
6616 |
} |
|
6617 |
%} |
|
6618 |
! |
|
6619 |
||
295 | 6620 |
unBuffered |
374 | 6621 |
"make all drawing be sent immediately to the display. |
6622 |
This makes all graphics synchronous and turns off any buffering |
|
6623 |
(i.e. each individual draw-request is sent immediately without |
|
6624 |
packing multiple requests into a larger message buffer). |
|
6625 |
Be prepared, that this slows down graphics considerably. |
|
6626 |
However, it allows display errors to be handled immediately and |
|
6627 |
may be useful if you get Xdisplay errors and want to find the request |
|
6628 |
which was responsiblefor it. See also #buffered." |
|
295 | 6629 |
|
6630 |
%{ /* NOCONTEXT */ |
|
6631 |
||
6632 |
if (ISCONNECTED) { |
|
6633 |
BEGIN_INTERRUPTSBLOCKED |
|
6634 |
XSynchronize(myDpy, 1); |
|
6635 |
END_INTERRUPTSBLOCKED |
|
6636 |
} |
|
6637 |
%} |
|
6638 |
"Display unbuffered" |
|
6639 |
! ! |
|
6640 |
||
6641 |
!XWorkstation methodsFor:'pointer queries '! |
|
6642 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6643 |
anyButtonStateMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6644 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6645 |
buttonStates value." |
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 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
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 |
^ 256 + 512 + 1024 |
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 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6652 |
"Created: 23.3.1996 / 12:46:35 / cg" |
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 |
|
295 | 6655 |
buttonStates |
6656 |
"return an integer representing the state of the pointer buttons; |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6657 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6658 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6659 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 6660 |
|
6661 |
%{ /* NOCONTEXT*/ |
|
6662 |
Display *dpy = myDpy; |
|
6663 |
Window w; |
|
555 | 6664 |
int screen = __intVal(__INST(screen)); |
295 | 6665 |
Window rootRet, childRet; |
6666 |
int rootX, rootY, winX, winY; |
|
6667 |
unsigned int mask; |
|
6668 |
||
6669 |
BEGIN_INTERRUPTSBLOCKED |
|
6670 |
#ifdef VIRTUAL_ROOT |
|
6671 |
w = getRootWindow(myDpy, screen); |
|
6672 |
#else |
|
6673 |
w = RootWindow(dpy, screen); |
|
6674 |
#endif |
|
6675 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
|
850 | 6676 |
&rootX, &rootY, |
6677 |
&winX, &winY, |
|
6678 |
&mask); |
|
295 | 6679 |
END_INTERRUPTSBLOCKED |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6680 |
RETURN (__MKSMALLINT(mask)); |
295 | 6681 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6682 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6683 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6684 |
Display buttonStates |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6685 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6686 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6687 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6688 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6689 |
Display buttonStates bitTest:(Display controlMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6690 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6691 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6692 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6693 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6694 |
Display buttonStates bitTest:(Display altModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6695 |
Display buttonStates bitTest:(Display metaModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6696 |
" |
295 | 6697 |
! |
6698 |
||
6699 |
leftButtonStateMask |
|
6700 |
"return an integer for masking out the left button from a |
|
6701 |
buttonStates value" |
|
6702 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6703 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6704 |
|
295 | 6705 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6706 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6707 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 6708 |
! |
6709 |
||
6710 |
middleButtonStateMask |
|
6711 |
"return an integer for masking out the middle button from a |
|
6712 |
buttonStates value" |
|
6713 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6714 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6715 |
|
295 | 6716 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6717 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6718 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 6719 |
! |
6720 |
||
6721 |
pointerPosition |
|
6722 |
"return the current pointer position in root-window coordinates" |
|
6723 |
||
6724 |
|xpos ypos| |
|
6725 |
||
6726 |
%{ |
|
6727 |
Display *dpy = myDpy; |
|
6728 |
Window w; |
|
555 | 6729 |
int screen = __intVal(__INST(screen)); |
295 | 6730 |
Window rootRet, childRet; |
6731 |
int rootX, rootY, winX, winY; |
|
6732 |
unsigned int mask; |
|
6733 |
||
6734 |
BEGIN_INTERRUPTSBLOCKED |
|
6735 |
#ifdef VIRTUAL_ROOT |
|
6736 |
w = getRootWindow(myDpy, screen); |
|
6737 |
#else |
|
6738 |
w = RootWindow(dpy, screen); |
|
6739 |
#endif |
|
6740 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
|
6741 |
&rootX, &rootY, |
|
6742 |
&winX, &winY, |
|
6743 |
&mask); |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6744 |
xpos = __MKSMALLINT(rootX); |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
6745 |
ypos = __MKSMALLINT(rootY); |
295 | 6746 |
END_INTERRUPTSBLOCKED |
6747 |
%} |
|
6748 |
. |
|
6749 |
^ xpos @ ypos |
|
6750 |
! |
|
6751 |
||
6752 |
rightButtonStateMask |
|
6753 |
"return an integer for masking out the right button from a |
|
6754 |
buttonStates value" |
|
6755 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6756 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6757 |
|
295 | 6758 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6759 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
6760 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 6761 |
! |
6762 |
||
6763 |
rootPositionOfLastEvent |
|
6764 |
"return the position in root-window coordinates |
|
6765 |
of the last button, key or pointer event" |
|
6766 |
||
6767 |
^ eventRootX @ eventRootY |
|
6768 |
! ! |
|
6769 |
||
6770 |
!XWorkstation methodsFor:'resources'! |
|
6771 |
||
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6772 |
atomIDOf:aStringOrSymbol |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6773 |
"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
|
6774 |
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
|
6775 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6776 |
^ self atomIDOf:aStringOrSymbol create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6777 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6778 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6779 |
Display atomIDOf:'FACE_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6780 |
Display atomIDOf:'FULL_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6781 |
" |
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:09:29 / 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 |
atomIDOf:aStringOrSymbol create:create |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6787 |
"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
|
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 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6791 |
Atom prop; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6792 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6793 |
if (ISCONNECTED) { |
850 | 6794 |
if (__isString(aStringOrSymbol) |
6795 |
|| __isSymbol(aStringOrSymbol)) { |
|
6796 |
prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), |
|
6797 |
(create == true) ? False : True); |
|
6798 |
if (prop == None) { |
|
6799 |
RETURN (nil); |
|
6800 |
} |
|
6801 |
RETURN ( __MKATOMOBJ(prop) ); |
|
6802 |
} |
|
487
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 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6805 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6806 |
^ nil |
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 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6809 |
Display atomIDOf:'VT_SELECTION' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6810 |
Display atomIDOf:'CUT_BUFFER0' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6811 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6812 |
Display atomIDOf:'PRIMARY' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6813 |
Display atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6814 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6815 |
! |
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 |
atomIDOfCUTBUFFER0 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6818 |
"return the CUTBUFFER0 AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6819 |
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
|
6820 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6821 |
^ cutBuffer0Atom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6822 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6823 |
"Modified: 2.3.1996 / 15:10:36 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6824 |
! |
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 |
atomIDOfLENGTH |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6827 |
"return the LENGTH AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6828 |
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
|
6829 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6830 |
^ lengthAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6831 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6832 |
"Modified: 2.3.1996 / 15:10:41 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6833 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6834 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6835 |
atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6836 |
"return the PRIMARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6837 |
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
|
6838 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6839 |
^ primaryAtom |
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 |
"Modified: 2.3.1996 / 15:10:49 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6842 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6843 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6844 |
atomIDOfSECONDARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6845 |
"return the SECONDARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6846 |
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
|
6847 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6848 |
^ secondaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6849 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6850 |
"Modified: 2.3.1996 / 15:10:59 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6851 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6852 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6853 |
atomIDOfSTRING |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6854 |
"return the STRING AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6855 |
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
|
6856 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6857 |
^ stringAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6858 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6859 |
"Modified: 2.3.1996 / 15:11:08 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6860 |
! |
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 |
atomName:anAtomID |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6863 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6864 |
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
|
6865 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6866 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6867 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6868 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6869 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6870 |
if (ISCONNECTED) { |
850 | 6871 |
if (__isAtomID(anAtomID)) { |
6872 |
name = XGetAtomName(myDpy, _AtomVal(anAtomID)); |
|
6873 |
if (name == 0) { |
|
6874 |
RETURN (nil); |
|
6875 |
} |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
6876 |
str = __MKSTRING(name); |
850 | 6877 |
XFree(name); |
6878 |
RETURN ( str ); |
|
6879 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6880 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6881 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6882 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6883 |
^ nil |
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 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6886 |
Display atomName:1 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6887 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6888 |
Display atomName:132 'FONTNAME_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6889 |
Display atomName:135 'FOUNDRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6890 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6891 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6892 |
Display atomName:152 'CHARSET_ENCODING' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6893 |
Display atomName:154 |
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 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6896 |
|
295 | 6897 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6898 |
"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
|
6899 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6900 |
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
|
6901 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6902 |
Notice: |
850 | 6903 |
we do not plan to use X's resources for ST/X's defaults, |
6904 |
styles or resources. This would make porting of applications |
|
6905 |
to different platforms much more difficult (Windows has no resource |
|
6906 |
database). If you stay within ST/X's resource files, these can be |
|
6907 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6908 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6909 |
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
|
6910 |
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
|
6911 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6912 |
|
295 | 6913 |
%{ |
6914 |
char *rslt; |
|
6915 |
||
6916 |
if ((__isString(name) || __isSymbol(name)) |
|
6917 |
&& (__isString(cls) || __isSymbol(cls)) |
|
6918 |
&& ISCONNECTED) { |
|
850 | 6919 |
BEGIN_INTERRUPTSBLOCKED |
6920 |
rslt = XGetDefault(myDpy, (char *)_stringVal(cls), |
|
6921 |
(char *)_stringVal(name)); |
|
6922 |
END_INTERRUPTSBLOCKED |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
6923 |
RETURN (rslt ? __MKSTRING(rslt) : nil ); |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6924 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6925 |
%}. |
295 | 6926 |
self primitiveFailed. |
6927 |
^ nil |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6928 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6929 |
"if your ~/.Xdefaults contains an entry such as: |
850 | 6930 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6931 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6932 |
|
850 | 6933 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6934 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6935 |
if your ~/.Xdefaults contains an entry such as: |
850 | 6936 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6937 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6938 |
|
850 | 6939 |
Display getResource:'beNiceToColormap' class:'any' |
6940 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
6941 |
" |
295 | 6942 |
! ! |
6943 |
||
6944 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
6945 |
||
6946 |
getBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
|
6947 |
"get bits from a drawable into the imageBits. The storage for the bits |
|
6948 |
must be big enough for the data to fit. If ok, returns an array with some |
|
6949 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
6950 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
6951 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
6952 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6953 |
|rawInfo info| |
295 | 6954 |
|
6955 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
6956 |
self primitiveFailed. |
|
6957 |
^ nil |
|
6958 |
]. |
|
6959 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6960 |
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
|
6961 |
"1 -> bit order" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6962 |
"2 -> depth" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6963 |
"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
|
6964 |
"4 -> byte_order" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6965 |
"5 -> format" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6966 |
"6 -> bitmap_unit" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6967 |
"7 -> bitmap_pad" |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6968 |
"8 -> bits_per_pixel" |
295 | 6969 |
|
6970 |
"/ had to extract the getPixel call into a separate method, to specify |
|
6971 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
6972 |
"/ of temporary stack space |
|
6973 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6974 |
(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
|
6975 |
info := IdentityDictionary new. |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
6976 |
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
|
6977 |
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
|
6978 |
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
|
6979 |
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
|
6980 |
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
|
6981 |
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
|
6982 |
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
|
6983 |
info at:#bitsPerPixel put:(rawInfo at:8). |
295 | 6984 |
^ info |
6985 |
]. |
|
6986 |
" |
|
6987 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
6988 |
or is too small to hold the bits |
|
6989 |
" |
|
6990 |
^ self primitiveFailed |
|
6991 |
! |
|
6992 |
||
6993 |
getPixelX:x y:y from:aDrawableId |
|
790
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
6994 |
"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
|
6995 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 6996 |
|
6997 |
%{ /* UNLIMITEDSTACK NOCONTEXT */ |
|
6998 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6999 |
Window win; |
295 | 7000 |
XImage *img; |
7001 |
int ret; |
|
7002 |
int xpos, ypos; |
|
7003 |
||
7004 |
if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
850 | 7005 |
win = _WindowVal(aDrawableId); |
7006 |
xpos = __intVal(x); |
|
7007 |
ypos = __intVal(y); |
|
7008 |
if ((xpos < 0) || (ypos < 0)) { |
|
7009 |
RETURN ( __MKSMALLINT(0) ); |
|
7010 |
} |
|
7011 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
|
7012 |
if (img != 0) { |
|
7013 |
ret = XGetPixel(img, 0, 0); |
|
7014 |
XDestroyImage(img); |
|
7015 |
RETURN ( __MKSMALLINT(ret) ); |
|
7016 |
} |
|
295 | 7017 |
} |
7018 |
%}. |
|
7019 |
^ nil |
|
7020 |
! |
|
7021 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7022 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
295 | 7023 |
"since XGetImage may allocate huge amount of stack space |
7024 |
(some implementations use alloca), this must run with unlimited stack." |
|
7025 |
||
7026 |
%{ /* UNLIMITEDSTACK */ |
|
7027 |
||
7028 |
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
|
7029 |
Window win; |
295 | 7030 |
XImage *image = (XImage *)0; |
7031 |
int pad, bytes_per_line, numBytes; |
|
7032 |
||
7033 |
if (__isExternalAddress(aDrawableId) |
|
7034 |
&& __bothSmallInteger(srcx, srcy) |
|
7035 |
&& __bothSmallInteger(w, h) |
|
7036 |
&& __isArray(info) |
|
7037 |
&& __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
|
7038 |
win = _WindowVal(aDrawableId); |
555 | 7039 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
7040 |
__intVal(w), __intVal(h), |
|
295 | 7041 |
(unsigned)AllPlanes, ZPixmap); |
7042 |
||
378 | 7043 |
if (! image) { |
7044 |
RETURN ( false ); |
|
7045 |
} |
|
7046 |
||
295 | 7047 |
pad = image->bitmap_pad; |
7048 |
#ifdef SUPERDEBUG |
|
7049 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
|
7050 |
#endif |
|
7051 |
switch (image->depth) { |
|
7052 |
case 1: |
|
7053 |
case 2: |
|
7054 |
case 4: |
|
7055 |
case 8: |
|
7056 |
case 16: |
|
7057 |
case 24: |
|
7058 |
case 32: |
|
7059 |
numBytes = image->bytes_per_line * image->height; |
|
7060 |
break; |
|
7061 |
default: |
|
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7062 |
/* unsupported depth ? */ |
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
7063 |
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
|
7064 |
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
|
7065 |
break; |
295 | 7066 |
} |
7067 |
||
7068 |
#ifdef SUPERDEBUG |
|
555 | 7069 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 7070 |
#endif |
7071 |
||
555 | 7072 |
if (numBytes > __byteArraySize(imageBits)) { |
295 | 7073 |
/* imageBits too small */ |
378 | 7074 |
printf("provided byteArray too small\n"); |
295 | 7075 |
goto fail; |
7076 |
} |
|
7077 |
if (image->bitmap_bit_order == MSBFirst) |
|
555 | 7078 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
295 | 7079 |
else |
555 | 7080 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
7081 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
7082 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
295 | 7083 |
if (image->byte_order == MSBFirst) |
555 | 7084 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
295 | 7085 |
else |
555 | 7086 |
__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
|
7087 |
if (image->format == XYBitmap) |
555 | 7088 |
__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
|
7089 |
else if (image->format == XYPixmap) |
555 | 7090 |
__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
|
7091 |
else if (image->format == ZPixmap) |
555 | 7092 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7093 |
|
555 | 7094 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
7095 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
7096 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
7097 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
295 | 7098 |
XDestroyImage(image); |
7099 |
RETURN ( true ); |
|
7100 |
} |
|
7101 |
fail: |
|
7102 |
if (image) { |
|
7103 |
XDestroyImage(image); |
|
7104 |
} |
|
7105 |
%}. |
|
7106 |
^ false |
|
7107 |
! ! |
|
7108 |
||
7109 |
!XWorkstation methodsFor:'selections'! |
|
7110 |
||
7111 |
getObjectProperty:propertyID from:aWindowID |
|
7112 |
"get an object property; return object or nil" |
|
7113 |
||
7114 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
7115 |
type == stringAtom ifTrue:[ |
|
7116 |
^ value |
|
7117 |
]. |
|
7118 |
(value isMemberOf:ByteArray) ifTrue:[ |
|
7119 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
|
7120 |
] |
|
7121 |
]. |
|
7122 |
^ nil |
|
7123 |
! |
|
7124 |
||
7125 |
getProperty:propertyID from:aWindowID into:aTwoArgBlock |
|
7126 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
|
7127 |
||
7128 |
|val typeID cls| |
|
7129 |
||
7130 |
cls := ByteArray. |
|
7131 |
%{ |
|
7132 |
Display *dpy = myDpy; |
|
7133 |
Window window; |
|
7134 |
Atom property; |
|
7135 |
char *cp, *cp2; |
|
7136 |
Atom actual_type; |
|
7137 |
int actual_format,i; |
|
7138 |
unsigned long nitems, bytes_after, nread; |
|
7139 |
unsigned char *data; |
|
7140 |
int ok = 1; |
|
7141 |
# define PROP_SIZE 2048 |
|
7142 |
||
7143 |
if (__isAtomID(propertyID)) { |
|
7144 |
property = _AtomVal(propertyID); |
|
7145 |
if (__isExternalAddress(aWindowID)) { |
|
7146 |
window = _WindowVal(aWindowID); |
|
7147 |
} else { |
|
7148 |
window = DefaultRootWindow(dpy); |
|
7149 |
} |
|
7150 |
||
7151 |
nread = 0; |
|
7152 |
cp = 0; |
|
7153 |
/* |
|
7154 |
fprintf(stderr, "getProperty: "); |
|
7155 |
*/ |
|
7156 |
do { |
|
7157 |
if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False, |
|
7158 |
AnyPropertyType,&actual_type,&actual_format, |
|
7159 |
&nitems,&bytes_after,(unsigned char **)&data) |
|
7160 |
!= Success) { |
|
7161 |
ok = 0; |
|
7162 |
break; |
|
7163 |
} |
|
7164 |
typeID = __MKATOMOBJ(actual_type); |
|
7165 |
if (! cp) { |
|
7166 |
cp = cp2 = (char *)malloc(nitems+1); |
|
7167 |
} else { |
|
7168 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
7169 |
cp2 = cp + nread; |
|
7170 |
} |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7171 |
if (! cp) { |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
7172 |
XFree(data); |
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7173 |
goto fail; |
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
7174 |
} |
295 | 7175 |
|
7176 |
nread += nitems; |
|
7177 |
bcopy(data, cp2, nitems); |
|
7178 |
XFree(data); |
|
7179 |
/* |
|
7180 |
fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after); |
|
7181 |
*/ |
|
7182 |
} while (bytes_after > 0); |
|
7183 |
/* |
|
7184 |
fprintf(stderr, "\n"); |
|
7185 |
*/ |
|
7186 |
||
7187 |
if (ok) { |
|
7188 |
if (actual_type == XA_STRING) { |
|
7189 |
cp[nread] = '\0'; |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
7190 |
val = __MKSTRING_L(cp, nread); |
295 | 7191 |
} else { |
7192 |
val = __new(nread + OHDR_SIZE); |
|
7193 |
val->o_class = cls; |
|
555 | 7194 |
bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread); |
295 | 7195 |
} |
7196 |
} |
|
7197 |
if (cp) |
|
7198 |
free(cp); |
|
7199 |
} |
|
7200 |
fail: ; |
|
7201 |
%}. |
|
7202 |
typeID isNil ifTrue:[ |
|
7203 |
^ false |
|
7204 |
]. |
|
7205 |
aTwoArgBlock value:typeID value:val. |
|
7206 |
^ true |
|
7207 |
! |
|
7208 |
||
7209 |
getSelectionFor:drawableId |
|
7210 |
"get the object selection - either immediate, or asynchronous. |
|
7211 |
Returns nil, if async request is on its way" |
|
7212 |
||
7213 |
|selProp sel| |
|
7214 |
||
7215 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
7216 |
"no primary selection - use cut buffer" |
|
7217 |
sel := self getObjectProperty:cutBuffer0Atom from:nil. |
|
7218 |
^ sel |
|
7219 |
]. |
|
7220 |
selProp := self atomIDOf:'ST_SELECTION' create:true. |
|
7221 |
self requestObjectSelection:primaryAtom property:selProp for:drawableId. |
|
7222 |
^ nil |
|
7223 |
! |
|
7224 |
||
7225 |
getSelectionOwnerOf:selectionAtomID |
|
7226 |
"get the owner of a selection" |
|
7227 |
||
7228 |
%{ /* NOCONTEXT */ |
|
7229 |
Display *dpy = myDpy; |
|
7230 |
Atom selection; |
|
7231 |
Window window; |
|
7232 |
||
7233 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
|
7234 |
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); |
|
7235 |
RETURN ((window == None) ? nil : __MKOBJ(window)); |
|
7236 |
} |
|
7237 |
%}. |
|
7238 |
self primitiveFailed. |
|
7239 |
^ nil |
|
7240 |
! |
|
7241 |
||
7242 |
getTextProperty:propertyID from:aWindowID |
|
7243 |
"get a text property; return string or nil" |
|
7244 |
||
7245 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
7246 |
type == stringAtom ifTrue:[ |
|
7247 |
^ value |
|
7248 |
] |
|
7249 |
]. |
|
7250 |
^ nil |
|
7251 |
! |
|
7252 |
||
7253 |
getTextSelectionFor:drawableId |
|
7254 |
"get the text selection - either immediate, or asynchronous. |
|
7255 |
Returns nil, if async request is on its way" |
|
7256 |
||
7257 |
|selProp sel| |
|
7258 |
||
7259 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
7260 |
"no primary selection - use cut buffer" |
|
7261 |
sel := self getTextProperty:cutBuffer0Atom from:nil. |
|
7262 |
^ sel |
|
7263 |
]. |
|
7264 |
selProp := self atomIDOf:'VT_SELECTION' create:true. |
|
7265 |
self requestTextSelection:primaryAtom property:selProp for:drawableId. |
|
7266 |
^ nil |
|
7267 |
! |
|
7268 |
||
7269 |
requestObjectSelection:selectionID property:propertyID for:aWindowId |
|
7270 |
"ask the server to send us the selection - the view with ID aWindowID |
|
7271 |
will later receive a SelectionNotify event for it." |
|
7272 |
||
7273 |
^ self requestSelection:selectionID |
|
7274 |
property:propertyID |
|
7275 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
7276 |
for:aWindowId |
|
7277 |
! |
|
7278 |
||
7279 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
|
7280 |
"ask the server to send us the selection - the view with id aWindowID |
|
7281 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
7282 |
with the selections value)." |
|
7283 |
||
7284 |
%{ /* NOCONTEXT */ |
|
7285 |
Display *dpy = myDpy; |
|
7286 |
Atom sel_prop; |
|
7287 |
char *cp; |
|
7288 |
||
7289 |
if (__isExternalAddress(aWindowId) |
|
7290 |
&& ISCONNECTED |
|
7291 |
&& __isSmallInteger(typeID) |
|
7292 |
&& __isAtomID(selectionID)) { |
|
7293 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
|
7294 |
/* |
|
7295 |
* no owner of primary selection |
|
7296 |
*/ |
|
7297 |
RETURN (false); |
|
7298 |
} |
|
7299 |
/* |
|
7300 |
* PRIMARY selection |
|
7301 |
*/ |
|
7302 |
XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), |
|
7303 |
_AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); |
|
7304 |
RETURN (true); |
|
7305 |
} |
|
7306 |
%}. |
|
7307 |
self primitiveFailed. |
|
7308 |
^ false |
|
7309 |
||
7310 |
" |
|
7311 |
Display requestSelection:(Display atomIDOf:'PRIMARY') |
|
7312 |
property:(Display atomIDOf:'VT_SELECTION') |
|
7313 |
for:0 |
|
7314 |
" |
|
7315 |
! |
|
7316 |
||
7317 |
requestTextSelection:selectionID property:propertyID for:aWindowId |
|
7318 |
"ask the server to send us the selection - the view with ID aWindowID |
|
7319 |
will later receive a SelectionNotify event for it." |
|
7320 |
||
7321 |
^ self requestSelection:selectionID |
|
7322 |
property:propertyID |
|
7323 |
type:stringAtom |
|
7324 |
for:aWindowId |
|
7325 |
! |
|
7326 |
||
7327 |
sendSelection:something property:propertyID target:targetID from:windowID to:requestorID |
|
7328 |
"send aString back from a SelectionRequest" |
|
7329 |
||
7330 |
self |
|
7331 |
sendSelection:something |
|
7332 |
selection:primaryAtom |
|
7333 |
property:propertyID |
|
7334 |
target:targetID |
|
7335 |
from:windowID |
|
7336 |
to:requestorID |
|
7337 |
! |
|
7338 |
||
7339 |
sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
7340 |
"send aString back from a SelectionRequest" |
|
7341 |
||
7342 |
self |
|
7343 |
setProperty:propertyID |
|
7344 |
type:targetID |
|
7345 |
value:something |
|
7346 |
for:requestorID. |
|
7347 |
self |
|
7348 |
sendSelectionNotifySelection:selectionID |
|
7349 |
property:propertyID |
|
7350 |
target:targetID |
|
7351 |
from:requestorID |
|
7352 |
to:requestorID. |
|
7353 |
! |
|
7354 |
||
7355 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
7356 |
"send a selectionNotify back from a SelectionRequest" |
|
7357 |
||
7358 |
%{ /* NOCONTEXT */ |
|
7359 |
Display *dpy = myDpy; |
|
7360 |
||
7361 |
if (__isAtomID(propertyID) |
|
7362 |
&& __isExternalAddress(requestorID) |
|
7363 |
&& ISCONNECTED |
|
7364 |
&& __isAtomID(targetID) |
|
7365 |
&& __isAtomID(selectionID)) { |
|
7366 |
XEvent ev; |
|
7367 |
Window requestor = _WindowVal(requestorID); |
|
7368 |
Atom property = _AtomVal(propertyID); |
|
7369 |
Atom target = _AtomVal(targetID); |
|
7370 |
Atom selection = _AtomVal(selectionID); |
|
7371 |
Status result; |
|
7372 |
||
7373 |
ev.xselection.type = SelectionNotify; |
|
7374 |
ev.xselection.selection = selection; |
|
7375 |
ev.xselection.target = target; |
|
7376 |
if (__isExternalAddress(windowID)) |
|
7377 |
ev.xselection.requestor = _WindowVal(windowID); |
|
7378 |
else |
|
7379 |
ev.xselection.requestor = DefaultRootWindow(dpy); |
|
7380 |
ev.xselection.time = CurrentTime; |
|
7381 |
if (property == None) |
|
7382 |
ev.xselection.property = target; |
|
7383 |
else |
|
7384 |
ev.xselection.property = property; |
|
7385 |
||
7386 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
|
7387 |
ev.xselection.selection, |
|
7388 |
ev.xselection.property, |
|
7389 |
ev.xselection.target, |
|
7390 |
ev.xselection.requestor, |
|
7391 |
requestor)); |
|
7392 |
||
7393 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
|
7394 |
if ((result == BadValue) || (result == BadWindow)) { |
|
7395 |
DPRINTF(("bad status\n")); |
|
382 | 7396 |
RETURN (false); |
295 | 7397 |
} |
382 | 7398 |
RETURN (true) |
7399 |
} |
|
7400 |
%}. |
|
7401 |
self primitiveFailed. |
|
7402 |
^ false |
|
295 | 7403 |
! |
7404 |
||
7405 |
setLengthProperty:propertyID value:aNumber for:aWindowID |
|
7406 |
^ self setProperty:propertyID type:(self atomIDOfLENGTH) value:aNumber for:aWindowID |
|
7407 |
! |
|
7408 |
||
7409 |
setObjectProperty:propertyID value:anObject for:aWindowID |
|
7410 |
|s| |
|
7411 |
||
7412 |
(anObject isMemberOf:String) ifTrue:[ |
|
7413 |
^ self setTextProperty:propertyID value:anObject for:aWindowID |
|
7414 |
]. |
|
7415 |
s := WriteStream on:(ByteArray new:200). |
|
7416 |
anObject storeBinaryOn:s. |
|
7417 |
^ self |
|
7418 |
setProperty:propertyID |
|
7419 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
7420 |
value:(s contents) |
|
7421 |
for:aWindowID |
|
7422 |
! |
|
7423 |
||
7424 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
|
7425 |
||
7426 |
%{ /* UNLIMITEDSTACK */ |
|
7427 |
||
7428 |
Display *dpy = myDpy; |
|
7429 |
Atom prop, type; |
|
7430 |
Window window; |
|
7431 |
unsigned int value; |
|
7432 |
||
7433 |
if (__isAtomID(propertyID) |
|
7434 |
&& __isAtomID(typeID) |
|
7435 |
&& ISCONNECTED |
|
7436 |
&& (__isString(anObject) |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7437 |
|| __isSmallInteger(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7438 |
|| __isSymbol(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7439 |
|| __isByteArray(anObject) |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7440 |
|| __isWords(anObject))) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7441 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7442 |
prop = _AtomVal(propertyID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7443 |
type = _AtomVal(typeID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7444 |
if (__isExternalAddress(aWindowID)) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7445 |
window = _WindowVal(aWindowID); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7446 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7447 |
window = DefaultRootWindow(dpy); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7448 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7449 |
if (__isSmallInteger(anObject)) { |
555 | 7450 |
value = __intVal(anObject); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7451 |
XChangeProperty(dpy, window, prop, type, 32, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7452 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7453 |
(unsigned char *)(&value), sizeof(unsigned int)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7454 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7455 |
if (__isByteArray(anObject)) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7456 |
XChangeProperty(dpy, window, prop, type, 8, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7457 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7458 |
__ByteArrayInstPtr(anObject)->ba_element, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7459 |
__byteArraySize(anObject)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7460 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7461 |
/* 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
|
7462 |
if (__isWords(__qClass(anObject))) { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7463 |
XChangeProperty(dpy, window, prop, XA_STRING, 16, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7464 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7465 |
__stringVal(anObject), |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7466 |
__wordArraySize(anObject)); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7467 |
} else { |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7468 |
XChangeProperty(dpy, window, prop, XA_STRING, 8, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7469 |
PropModeReplace, |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7470 |
__stringVal(anObject), |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7471 |
strlen(__stringVal(anObject))); |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7472 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7473 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7474 |
} |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
7475 |
RETURN (true); |
295 | 7476 |
} |
7477 |
%}. |
|
7478 |
^ false |
|
7479 |
! |
|
7480 |
||
7481 |
setSelection:anObject owner:aWindowId |
|
7482 |
"set the object selection, and make aWindowId be the owner. |
|
7483 |
This can be used by other Smalltalk(X) applications only." |
|
7484 |
||
7485 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
7486 |
^ false |
|
7487 |
]. |
|
7488 |
"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil |
|
7489 |
^ true |
|
7490 |
! |
|
7491 |
||
7492 |
setSelectionOwner:aWindowId of:selectionID |
|
7493 |
"set the owner of a selection; return false if failed" |
|
7494 |
||
7495 |
%{ /* NOCONTEXT */ |
|
7496 |
Display *dpy = myDpy; |
|
7497 |
Window win; |
|
7498 |
||
7499 |
if (__isExternalAddress(aWindowId) |
|
7500 |
&& __isAtomID(selectionID) |
|
7501 |
&& ISCONNECTED) { |
|
7502 |
win = _WindowVal(aWindowId); |
|
7503 |
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); |
|
7504 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { |
|
7505 |
RETURN (false); |
|
7506 |
} |
|
7507 |
RETURN (true); |
|
7508 |
} |
|
7509 |
%} |
|
7510 |
. |
|
7511 |
self primitiveFailed. |
|
7512 |
^ nil |
|
7513 |
! |
|
7514 |
||
7515 |
setTextProperty:propertyID value:aString for:aWindowID |
|
7516 |
^ self setProperty:propertyID type:(self atomIDOfSTRING) value:aString for:aWindowID |
|
7517 |
! |
|
7518 |
||
7519 |
setTextSelection:aString owner:aWindowId |
|
7520 |
"set the text selection, and make aWindowId be the owner. |
|
7521 |
This can be used by any other X application." |
|
7522 |
||
7523 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
1180 | 7524 |
'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. |
295 | 7525 |
]. |
7526 |
^ self setTextProperty:cutBuffer0Atom value:aString for:nil |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
7527 |
|
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
7528 |
"Modified: 10.1.1997 / 18:18:00 / cg" |
295 | 7529 |
! ! |
7530 |
||
7531 |
!XWorkstation methodsFor:'window stuff'! |
|
7532 |
||
7533 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
|
7534 |
"clear a rectangular area to viewbackground" |
|
7535 |
||
7536 |
%{ /* NOCONTEXT */ |
|
7537 |
||
7538 |
int w, h; |
|
7539 |
||
7540 |
if (__isExternalAddress(aWindowId) |
|
7541 |
&& __bothSmallInteger(x, y) |
|
7542 |
&& __bothSmallInteger(width, height)) { |
|
555 | 7543 |
w = __intVal(width); |
7544 |
h = __intVal(height); |
|
1018 | 7545 |
/* |
7546 |
* need this check here: some servers simply dump core with bad args |
|
7547 |
*/ |
|
7548 |
if ((w >= 0) && (h >= 0)) { |
|
7549 |
XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
|
7550 |
} |
|
295 | 7551 |
RETURN ( self ); |
7552 |
} |
|
7553 |
%} |
|
7554 |
. |
|
7555 |
self primitiveFailed |
|
7556 |
! |
|
7557 |
||
7558 |
clearWindow:aWindowId |
|
7559 |
"clear a window to viewbackground" |
|
7560 |
||
7561 |
%{ /* NOCONTEXT */ |
|
7562 |
||
7563 |
if (__isExternalAddress(aWindowId)) { |
|
7564 |
XClearWindow(myDpy, _WindowVal(aWindowId)); |
|
7565 |
RETURN ( self ); |
|
7566 |
} |
|
7567 |
%} |
|
7568 |
. |
|
7569 |
self primitiveFailed |
|
7570 |
! |
|
7571 |
||
7572 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
|
7573 |
"configure stacking operation of aWindowId w.r.t siblingId" |
|
7574 |
||
7575 |
%{ /* NOCONTEXT */ |
|
7576 |
||
7577 |
XWindowChanges chg; |
|
7578 |
int mask = CWSibling | CWStackMode; |
|
7579 |
||
7580 |
if (__isExternalAddress(aWindowId) |
|
7581 |
&& __isExternalAddress(siblingId)) { |
|
7582 |
if (modeSymbol == @symbol(above)) { |
|
7583 |
chg.stack_mode = Above; |
|
7584 |
} else if (modeSymbol == @symbol(below)) { |
|
7585 |
chg.stack_mode = Below; |
|
7586 |
} else if (modeSymbol == @symbol(topIf)) { |
|
7587 |
chg.stack_mode = TopIf; |
|
7588 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
7589 |
chg.stack_mode = BottomIf; |
|
7590 |
} else if (modeSymbol == @symbol(opposite)) { |
|
7591 |
chg.stack_mode = Opposite; |
|
7592 |
} else { |
|
7593 |
mask = CWSibling; |
|
7594 |
} |
|
7595 |
||
7596 |
chg.sibling = _WindowVal(siblingId); |
|
7597 |
XConfigureWindow(myDpy, _WindowVal(aWindowId), |
|
7598 |
mask, &chg); |
|
7599 |
RETURN ( self ); |
|
7600 |
} |
|
7601 |
bad: ; |
|
7602 |
%} |
|
7603 |
. |
|
7604 |
self primitiveFailed |
|
7605 |
! |
|
7606 |
||
7607 |
lowerWindow:aWindowId |
|
7608 |
"bring a window to back" |
|
7609 |
||
7610 |
%{ /* NOCONTEXT */ |
|
7611 |
||
7612 |
if (__isExternalAddress(aWindowId)) { |
|
7613 |
XLowerWindow(myDpy, _WindowVal(aWindowId)); |
|
7614 |
RETURN ( self ); |
|
7615 |
} |
|
7616 |
%} |
|
7617 |
. |
|
7618 |
self primitiveFailed |
|
7619 |
! |
|
7620 |
||
7621 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h |
|
7622 |
"make a window visible - either as icon or as a real view - needed for restart" |
|
7623 |
||
7624 |
|wicon wiconId wiconView wiconViewId wlabel| |
|
7625 |
||
7626 |
aBoolean ifTrue:[ |
|
7627 |
wicon := aView icon. |
|
7628 |
wicon notNil ifTrue:[ |
|
7629 |
wiconId := wicon id |
|
7630 |
]. |
|
7631 |
wiconView := aView iconView. |
|
7632 |
wiconView notNil ifTrue:[ |
|
7633 |
wiconViewId := wiconView id |
|
7634 |
]. |
|
7635 |
wlabel := aView label. |
|
7636 |
]. |
|
7637 |
%{ |
|
7638 |
||
7639 |
XWMHints wmhints; |
|
7640 |
XSizeHints szhints; |
|
7641 |
Display *dpy = myDpy; |
|
7642 |
Window win; |
|
7643 |
||
7644 |
if (__isExternalAddress(aWindowId)) { |
|
7645 |
win = _WindowVal(aWindowId); |
|
7646 |
||
7647 |
szhints.flags = 0; |
|
7648 |
if (__bothSmallInteger(xPos, yPos)) { |
|
555 | 7649 |
szhints.x = __intVal(xPos); |
7650 |
szhints.y = __intVal(yPos); |
|
295 | 7651 |
szhints.flags |= USPosition; |
7652 |
} |
|
7653 |
if (__bothSmallInteger(w, h)) { |
|
555 | 7654 |
szhints.width = __intVal(w); |
7655 |
szhints.height = __intVal(h); |
|
295 | 7656 |
szhints.flags |= USSize; |
7657 |
} |
|
7658 |
||
7659 |
if (aBoolean == true) { |
|
7660 |
char *windowName; |
|
7661 |
Pixmap iconBitmap = (Pixmap)0; |
|
7662 |
Window iconWindow; |
|
7663 |
||
7664 |
if (__isExternalAddress(wiconId)) |
|
7665 |
iconBitmap = _PixmapVal(wiconId); |
|
7666 |
else |
|
7667 |
iconBitmap = (Pixmap)0; |
|
7668 |
||
7669 |
if (__isExternalAddress(wiconViewId)) |
|
7670 |
iconWindow = _WindowVal(wiconViewId); |
|
7671 |
else |
|
7672 |
iconWindow = (Window)0; |
|
7673 |
||
7674 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
7675 |
windowName = (char *)_stringVal(wlabel); |
|
7676 |
else |
|
7677 |
windowName = ""; |
|
7678 |
||
7679 |
if (iconBitmap || windowName) { |
|
7680 |
XSetStandardProperties(dpy, win, |
|
7681 |
windowName, windowName, |
|
7682 |
iconBitmap, |
|
7683 |
0, 0, &szhints); |
|
7684 |
} |
|
7685 |
||
7686 |
wmhints.flags = 0; |
|
7687 |
if (iconBitmap) { |
|
7688 |
wmhints.flags |= IconPixmapHint; |
|
7689 |
wmhints.icon_pixmap = iconBitmap; |
|
7690 |
} |
|
7691 |
if (iconWindow) { |
|
7692 |
wmhints.flags |= IconWindowHint; |
|
7693 |
wmhints.icon_window = iconWindow; |
|
7694 |
} |
|
7695 |
||
7696 |
wmhints.initial_state = IconicState; |
|
7697 |
wmhints.flags |= StateHint; |
|
7698 |
XSetWMHints(dpy, win, &wmhints); |
|
7699 |
} |
|
7700 |
||
7701 |
if (szhints.flags) { |
|
7702 |
XSetNormalHints(dpy, win, &szhints); |
|
7703 |
} |
|
7704 |
||
7705 |
XMapWindow(dpy, win); |
|
7706 |
RETURN ( self ); |
|
7707 |
} |
|
7708 |
%} |
|
7709 |
. |
|
7710 |
self primitiveFailed |
|
7711 |
! |
|
7712 |
||
7713 |
mapWindow:aWindowId |
|
7714 |
"make a window visible" |
|
7715 |
||
7716 |
%{ /* NOCONTEXT */ |
|
7717 |
||
7718 |
if (__isExternalAddress(aWindowId)) { |
|
7719 |
XMapWindow(myDpy, _WindowVal(aWindowId)); |
|
7720 |
RETURN ( self ); |
|
7721 |
} |
|
7722 |
%} |
|
7723 |
. |
|
7724 |
self primitiveFailed |
|
7725 |
! |
|
7726 |
||
7727 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
|
7728 |
"move and resize a window" |
|
7729 |
||
7730 |
%{ /* NOCONTEXT */ |
|
7731 |
||
7732 |
int newWidth, newHeight; |
|
7733 |
||
7734 |
if (__isExternalAddress(aWindowId) |
|
7735 |
&& __bothSmallInteger(w, h) |
|
7736 |
&& __bothSmallInteger(x, y)) { |
|
555 | 7737 |
newWidth = __intVal(w); |
7738 |
newHeight = __intVal(h); |
|
295 | 7739 |
if (newWidth < 1) newWidth = 1; |
7740 |
if (newHeight < 1) newHeight = 1; |
|
7741 |
XMoveResizeWindow(myDpy, _WindowVal(aWindowId), |
|
555 | 7742 |
__intVal(x), __intVal(y), |
295 | 7743 |
newWidth, newHeight); |
7744 |
RETURN ( self ); |
|
7745 |
} |
|
7746 |
%} |
|
7747 |
. |
|
7748 |
self primitiveFailed |
|
7749 |
! |
|
7750 |
||
7751 |
moveWindow:aWindowId x:x y:y |
|
7752 |
"move a window" |
|
7753 |
||
7754 |
%{ /* NOCONTEXT */ |
|
7755 |
||
7756 |
if (__isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
|
555 | 7757 |
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); |
295 | 7758 |
RETURN ( self ); |
7759 |
} |
|
7760 |
%} |
|
7761 |
. |
|
7762 |
self primitiveFailed |
|
7763 |
! |
|
7764 |
||
7765 |
raiseWindow:aWindowId |
|
7766 |
"bring a window to front" |
|
7767 |
||
7768 |
%{ /* NOCONTEXT */ |
|
7769 |
||
7770 |
if (__isExternalAddress(aWindowId)) { |
|
7771 |
XRaiseWindow(myDpy, _WindowVal(aWindowId)); |
|
7772 |
RETURN ( self ); |
|
7773 |
} |
|
7774 |
%} |
|
7775 |
. |
|
7776 |
self primitiveFailed |
|
7777 |
! |
|
7778 |
||
7779 |
resizeWindow:aWindowId width:w height:h |
|
7780 |
"resize a window" |
|
7781 |
||
7782 |
%{ /* NOCONTEXT */ |
|
7783 |
||
7784 |
int newWidth, newHeight; |
|
7785 |
||
7786 |
if (__isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
|
555 | 7787 |
newWidth = __intVal(w); |
7788 |
newHeight = __intVal(h); |
|
295 | 7789 |
if (newWidth < 1) newWidth = 1; |
7790 |
if (newHeight < 1) newHeight = 1; |
|
7791 |
XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); |
|
7792 |
RETURN ( self ); |
|
7793 |
} |
|
7794 |
%} |
|
7795 |
. |
|
7796 |
self primitiveFailed |
|
7797 |
! |
|
7798 |
||
7799 |
setBackingStore:how in:aWindowId |
|
7800 |
"turn on/off backing-store for a window" |
|
7801 |
||
7802 |
%{ /* NOCONTEXT */ |
|
7803 |
||
7804 |
XSetWindowAttributes wa; |
|
7805 |
||
7806 |
if (__isExternalAddress(aWindowId)) { |
|
555 | 7807 |
if (__INST(ignoreBackingStore) != true) { |
295 | 7808 |
if (how == @symbol(always)) wa.backing_store = Always; |
7809 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
7810 |
else if (how == true) wa.backing_store = Always; |
|
7811 |
else wa.backing_store = 0; |
|
7812 |
BEGIN_INTERRUPTSBLOCKED |
|
7813 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); |
|
7814 |
END_INTERRUPTSBLOCKED |
|
7815 |
} |
|
7816 |
RETURN ( self ); |
|
7817 |
} |
|
7818 |
%}. |
|
7819 |
self primitiveFailed |
|
7820 |
! |
|
7821 |
||
7822 |
setBitGravity:how in:aWindowId |
|
7823 |
"set bit gravity for a window" |
|
7824 |
||
7825 |
%{ /* NOCONTEXT */ |
|
7826 |
||
7827 |
XSetWindowAttributes wa; |
|
7828 |
||
7829 |
if (__isExternalAddress(aWindowId)) { |
|
7830 |
if (how == @symbol(NorthWest)) { |
|
7831 |
wa.bit_gravity = NorthWestGravity; |
|
7832 |
} else if (how == @symbol(NorthEast)) { |
|
7833 |
wa.bit_gravity = NorthEastGravity; |
|
7834 |
} else if (how == @symbol(SouthWest)) { |
|
7835 |
wa.bit_gravity = SouthWestGravity; |
|
7836 |
} else if (how == @symbol(SouthEast)) { |
|
7837 |
wa.bit_gravity = SouthEastGravity; |
|
7838 |
} else if (how == @symbol(Center)) { |
|
7839 |
wa.bit_gravity = CenterGravity; |
|
7840 |
} else if (how == @symbol(North)) { |
|
7841 |
wa.bit_gravity = NorthGravity; |
|
7842 |
} else if (how == @symbol(South)) { |
|
7843 |
wa.bit_gravity = SouthGravity; |
|
7844 |
} else if (how == @symbol(West)) { |
|
7845 |
wa.bit_gravity = WestGravity; |
|
7846 |
} else if (how == @symbol(East)) { |
|
7847 |
wa.bit_gravity = EastGravity; |
|
7848 |
} else { |
|
7849 |
wa.bit_gravity = NorthWestGravity; |
|
7850 |
} |
|
7851 |
||
7852 |
BEGIN_INTERRUPTSBLOCKED |
|
7853 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); |
|
7854 |
END_INTERRUPTSBLOCKED |
|
7855 |
RETURN ( self ); |
|
7856 |
} |
|
7857 |
%}. |
|
7858 |
self primitiveFailed |
|
7859 |
! |
|
7860 |
||
7861 |
setCursor:aCursorId in:aWindowId |
|
7862 |
"define a windows cursor" |
|
7863 |
||
7864 |
%{ /* NOCONTEXT */ |
|
7865 |
||
7866 |
Display *dpy = myDpy; |
|
7867 |
||
7868 |
if (__isExternalAddress(aWindowId) |
|
7869 |
&& __isExternalAddress(aCursorId)) { |
|
7870 |
XDefineCursor(dpy, _WindowVal(aWindowId), _CursorVal(aCursorId)); |
|
7871 |
RETURN ( self ); |
|
7872 |
} |
|
7873 |
%}. |
|
7874 |
self primitiveFailed |
|
7875 |
! |
|
7876 |
||
7877 |
setIconName:aString in:aWindowId |
|
7878 |
"define a windows iconname" |
|
7879 |
||
7880 |
%{ /* NOCONTEXT */ |
|
7881 |
||
7882 |
if (__isExternalAddress(aWindowId) |
|
7883 |
&& (__isString(aString) || __isSymbol(aString))) { |
|
7884 |
XSetIconName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString)); |
|
7885 |
RETURN ( self ); |
|
7886 |
} |
|
7887 |
%}. |
|
7888 |
self primitiveFailed |
|
7889 |
! |
|
7890 |
||
7891 |
setSaveUnder:yesOrNo in:aWindowId |
|
7892 |
"turn on/off save-under for a window" |
|
7893 |
||
7894 |
%{ /* NOCONTEXT */ |
|
7895 |
||
7896 |
XSetWindowAttributes wa; |
|
7897 |
||
7898 |
if (__isExternalAddress(aWindowId)) { |
|
555 | 7899 |
if (__INST(hasSaveUnder) == true) { |
295 | 7900 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
7901 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); |
|
7902 |
} |
|
7903 |
RETURN ( self ); |
|
7904 |
} |
|
7905 |
%}. |
|
7906 |
self primitiveFailed |
|
7907 |
! |
|
7908 |
||
7909 |
setTransient:aWindowId for:aMainWindowId |
|
7910 |
"set aWindowId to be a transient of aMainWindow" |
|
7911 |
||
7912 |
%{ /* NOCONTEXT */ |
|
7913 |
||
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7914 |
if (__isExternalAddress(aWindowId)) { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7915 |
Window w; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7916 |
|
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7917 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7918 |
w = (Window) 0; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7919 |
} else { |
374 | 7920 |
if (__isExternalAddress(aMainWindowId)) { |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7921 |
w = _WindowVal(aMainWindowId); |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7922 |
} else { |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7923 |
goto getOutOfHere; |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7924 |
} |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7925 |
} |
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7926 |
XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); |
295 | 7927 |
RETURN ( self ); |
7928 |
} |
|
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
7929 |
getOutOfHere: ; |
295 | 7930 |
%}. |
7931 |
self primitiveFailed |
|
7932 |
! |
|
7933 |
||
7934 |
setWindowBackground:aColorIndex in:aWindowId |
|
7935 |
"set the windows background color. This is the color with which |
|
7936 |
the view is filled whenever exposed. Do not confuse this with |
|
7937 |
the background drawing color, which is used with opaque drawing." |
|
7938 |
||
7939 |
%{ /* NOCONTEXT */ |
|
7940 |
||
7941 |
if (__isExternalAddress(aWindowId) |
|
7942 |
&& __isSmallInteger(aColorIndex)) { |
|
555 | 7943 |
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
295 | 7944 |
RETURN ( self ); |
7945 |
} |
|
7946 |
%}. |
|
7947 |
self primitiveFailed |
|
7948 |
! |
|
7949 |
||
7950 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
|
7951 |
"set the windows background pattern to be a form. |
|
7952 |
This is the pattern with which the view is filled whenever exposed. |
|
7953 |
Do not confuse this with the background drawing color, which is used |
|
7954 |
with opaque drawing." |
|
7955 |
||
7956 |
%{ /* NOCONTEXT */ |
|
7957 |
||
7958 |
if (__isExternalAddress(aWindowId) |
|
7959 |
&& __isExternalAddress(aPixmapId)) { |
|
7960 |
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
|
7961 |
RETURN ( self ); |
|
7962 |
} |
|
7963 |
%}. |
|
7964 |
self primitiveFailed |
|
7965 |
! |
|
7966 |
||
7967 |
setWindowBorderColor:aColorIndex in:aWindowId |
|
7968 |
"set the windows border color" |
|
7969 |
||
7970 |
%{ /* NOCONTEXT */ |
|
7971 |
||
7972 |
if (__isExternalAddress(aWindowId) |
|
7973 |
&& __isSmallInteger(aColorIndex)) { |
|
555 | 7974 |
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
295 | 7975 |
RETURN ( self ); |
7976 |
} |
|
7977 |
%}. |
|
7978 |
self primitiveFailed |
|
7979 |
! |
|
7980 |
||
7981 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
|
7982 |
"set the windows border pattern" |
|
7983 |
||
7984 |
%{ /* NOCONTEXT */ |
|
7985 |
||
7986 |
if (__isExternalAddress(aWindowId) |
|
7987 |
&& __isExternalAddress(aPixmapId)) { |
|
7988 |
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
|
7989 |
RETURN ( self ); |
|
7990 |
} |
|
7991 |
%} |
|
7992 |
. |
|
7993 |
self primitiveFailed |
|
7994 |
! |
|
7995 |
||
7996 |
setWindowBorderShape:aPixmapId in:aWindowId |
|
7997 |
"set the windows border shape" |
|
7998 |
||
7999 |
hasShapeExtension ifFalse:[^ self]. |
|
8000 |
||
8001 |
%{ /* NOCONTEXT */ |
|
8002 |
||
8003 |
#ifdef SHAPE |
|
8004 |
if (__isExternalAddress(aWindowId) |
|
8005 |
&& __isExternalAddress(aPixmapId)) { |
|
8006 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, |
|
8007 |
0, 0, _PixmapVal(aPixmapId), ShapeSet); |
|
8008 |
RETURN ( self ); |
|
8009 |
} |
|
8010 |
#endif |
|
8011 |
%}. |
|
8012 |
self primitiveFailed |
|
8013 |
! |
|
8014 |
||
8015 |
setWindowBorderWidth:aNumber in:aWindowId |
|
8016 |
"set the windows border width" |
|
8017 |
||
8018 |
%{ /* NOCONTEXT */ |
|
8019 |
||
8020 |
if (__isExternalAddress(aWindowId) |
|
8021 |
&& __isSmallInteger(aNumber)) { |
|
555 | 8022 |
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); |
295 | 8023 |
RETURN ( self ); |
8024 |
} |
|
8025 |
%}. |
|
8026 |
self primitiveFailed |
|
8027 |
! |
|
8028 |
||
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8029 |
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
|
8030 |
"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
|
8031 |
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
|
8032 |
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
|
8033 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8034 |
%{ |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8035 |
if (__isExternalAddress(aWindowId)) { |
963
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8036 |
XClassHint classhint; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8037 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8038 |
classhint.res_class = classhint.res_name = 0; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8039 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8040 |
if (__isString(wClass) || __isSymbol(wClass)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8041 |
classhint.res_class = (char *)_stringVal(wClass); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8042 |
} else if (wClass != nil) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8043 |
goto error; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8044 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8045 |
if (__isString(wName) || __isSymbol(wName)) { |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8046 |
classhint.res_name = (char *)_stringVal(wName); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8047 |
} else if (wName != nil) |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8048 |
goto error; |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8049 |
|
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8050 |
XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); |
45ebbbb40f38
simply suppress those BadWindow-destroy messages (sigh)
Claus Gittinger <cg@exept.de>
parents:
928
diff
changeset
|
8051 |
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
|
8052 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8053 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8054 |
%}. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8055 |
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
|
8056 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
8057 |
|
295 | 8058 |
setWindowGravity:how in:aWindowId |
8059 |
"set window gravity for a window" |
|
8060 |
||
8061 |
%{ /* NOCONTEXT */ |
|
8062 |
||
8063 |
XSetWindowAttributes wa; |
|
8064 |
||
8065 |
if (__isExternalAddress(aWindowId)) { |
|
8066 |
if (how == @symbol(NorthWest)) { |
|
8067 |
wa.win_gravity = NorthWestGravity; |
|
8068 |
} else if (how == @symbol(NorthEast)) { |
|
8069 |
wa.win_gravity = NorthEastGravity; |
|
8070 |
} else if (how == @symbol(SouthWest)) { |
|
8071 |
wa.win_gravity = SouthWestGravity; |
|
8072 |
} else if (how == @symbol(SouthEast)) { |
|
8073 |
wa.win_gravity = SouthEastGravity; |
|
8074 |
} else if (how == @symbol(Center)) { |
|
8075 |
wa.win_gravity = CenterGravity; |
|
8076 |
} else if (how == @symbol(North)) { |
|
8077 |
wa.win_gravity = NorthGravity; |
|
8078 |
} else if (how == @symbol(South)) { |
|
8079 |
wa.win_gravity = SouthGravity; |
|
8080 |
} else if (how == @symbol(West)) { |
|
8081 |
wa.win_gravity = WestGravity; |
|
8082 |
} else if (how == @symbol(East)) { |
|
8083 |
wa.win_gravity = EastGravity; |
|
8084 |
} else { |
|
8085 |
wa.win_gravity = NorthWestGravity; |
|
8086 |
} |
|
8087 |
||
8088 |
BEGIN_INTERRUPTSBLOCKED |
|
8089 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); |
|
8090 |
END_INTERRUPTSBLOCKED |
|
8091 |
RETURN ( self ); |
|
8092 |
} |
|
8093 |
%}. |
|
8094 |
self primitiveFailed |
|
8095 |
! |
|
8096 |
||
8097 |
setWindowIcon:aForm in:aWindowId |
|
8098 |
"define a bitmap to be used as icon" |
|
8099 |
||
8100 |
|iconId| |
|
8101 |
||
8102 |
aForm notNil ifTrue:[ |
|
8103 |
iconId := aForm id |
|
8104 |
]. |
|
8105 |
%{ |
|
8106 |
if (__isExternalAddress(iconId) |
|
8107 |
&& __isExternalAddress(aWindowId)) { |
|
8108 |
XWMHints hints; |
|
8109 |
||
8110 |
hints.icon_pixmap = _PixmapVal(iconId); |
|
8111 |
hints.flags = IconPixmapHint; |
|
8112 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
|
8113 |
RETURN ( self ); |
|
8114 |
} |
|
8115 |
%}. |
|
8116 |
self primitiveFailed |
|
8117 |
! |
|
8118 |
||
8119 |
setWindowIconWindow:aView in:aWindowId |
|
8120 |
"define a window to be used as icon" |
|
8121 |
||
8122 |
|iconWindowId| |
|
8123 |
||
8124 |
aView notNil ifTrue:[ |
|
8125 |
iconWindowId := aView id |
|
8126 |
]. |
|
8127 |
%{ |
|
8128 |
if (__isExternalAddress(iconWindowId) |
|
8129 |
&& __isExternalAddress(aWindowId)) { |
|
8130 |
XWMHints wmhints; |
|
8131 |
||
8132 |
wmhints.icon_window = _WindowVal(iconWindowId); |
|
8133 |
wmhints.flags = IconWindowHint; |
|
8134 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); |
|
8135 |
RETURN ( self ); |
|
8136 |
} |
|
8137 |
%}. |
|
8138 |
self primitiveFailed |
|
8139 |
! |
|
8140 |
||
8141 |
setWindowName:aString in:aWindowId |
|
8142 |
"define a windows name" |
|
8143 |
||
8144 |
%{ /* NOCONTEXT */ |
|
8145 |
||
8146 |
if (__isExternalAddress(aWindowId) |
|
8147 |
&& (__isString(aString) || __isSymbol(aString))) { |
|
8148 |
XStoreName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString)); |
|
8149 |
RETURN ( self ); |
|
8150 |
} |
|
8151 |
%}. |
|
8152 |
self primitiveFailed |
|
8153 |
! |
|
8154 |
||
8155 |
setWindowShape:aPixmapId in:aWindowId |
|
8156 |
"set the windows shape" |
|
8157 |
||
8158 |
hasShapeExtension ifFalse:[^ self]. |
|
8159 |
||
8160 |
%{ /* NOCONTEXT */ |
|
8161 |
||
8162 |
#ifdef SHAPE |
|
8163 |
if (__isExternalAddress(aWindowId) |
|
8164 |
&& __isExternalAddress(aPixmapId)) { |
|
8165 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, |
|
8166 |
0, 0, |
|
8167 |
_PixmapVal(aPixmapId), ShapeSet); |
|
8168 |
RETURN ( self ); |
|
8169 |
} |
|
8170 |
#endif |
|
8171 |
%}. |
|
8172 |
self primitiveFailed |
|
8173 |
! |
|
8174 |
||
8175 |
unmapWindow:aWindowId |
|
8176 |
"make a window invisible" |
|
8177 |
||
8178 |
%{ /* NOCONTEXT */ |
|
8179 |
||
8180 |
if (__isExternalAddress(aWindowId)) { |
|
8181 |
XUnmapWindow(myDpy, _WindowVal(aWindowId)); |
|
8182 |
RETURN ( self ); |
|
8183 |
} |
|
8184 |
%} |
|
8185 |
. |
|
8186 |
self primitiveFailed |
|
8187 |
! ! |
|
8188 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
8189 |
!XWorkstation class methodsFor:'documentation'! |
295 | 8190 |
|
8191 |
version |
|
1183 | 8192 |
^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.187 1997-01-11 11:12:58 cg Exp $' |
295 | 8193 |
! ! |
8194 |
XWorkstation initialize! |