author | Claus Gittinger <cg@exept.de> |
Sat, 13 Jun 1998 13:55:14 +0200 | |
changeset 2146 | 1c13fdc62a9f |
parent 2140 | 21ad63e0c739 |
child 2156 | 0cb3b353630f |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
1344 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
DeviceWorkstation subclass:#XWorkstation |
|
1344 | 14 |
instanceVariableNames:'screen hasShapeExtension hasShmExtension hasDPSExtension |
15 |
hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
|
16 |
hasImageExtension hasInputExtension ignoreBackingStore blackpixel |
|
17 |
whitepixel protocolsAtom deleteWindowAtom saveYourselfAtom |
|
18 |
quitAppAtom primaryAtom secondaryAtom cutBuffer0Atom stringAtom |
|
1535 | 19 |
lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX |
20 |
eventRootY displayName eventTrace dispatchingExpose rgbVisual |
|
21 |
virtualRootId rootId eventBuffer altModifierMask metaModifierMask |
|
1978 | 22 |
multiClickTime deviceErrorSignal deviceIOErrorSignal |
23 |
deviceIOTimeoutErrorSignal' |
|
1344 | 24 |
classVariableNames:'RawKeysymTranslation ConservativeSync' |
25 |
poolDictionaries:'' |
|
26 |
category:'Interface-Graphics' |
|
295 | 27 |
! |
0 | 28 |
|
78 | 29 |
!XWorkstation primitiveDefinitions! |
0 | 30 |
%{ |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
31 |
|
1062 | 32 |
#ifdef LINUX |
33 |
# define SHM |
|
34 |
#endif |
|
35 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
36 |
#define COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
37 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
38 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
39 |
static int __cnt_color = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
40 |
static int __cnt_bitmap = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
41 |
static int __cnt_view = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
42 |
static int __cnt_gc = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
43 |
static int __cnt_cursor = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
44 |
static int __cnt_font = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
45 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
46 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
47 |
|
46 | 48 |
/* |
49 |
* x does a typedef Time - I need Object Time ... |
|
50 |
*/ |
|
0 | 51 |
#define Time XTime |
52 |
||
391
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
53 |
/* |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
54 |
* x does a #define True / False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
55 |
* we are lucky - the ST/X True/False are not needed |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
56 |
*/ |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
57 |
#undef True |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
58 |
#undef False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
59 |
|
37 | 60 |
#ifdef memset |
61 |
# undef memset |
|
62 |
#endif |
|
63 |
||
1891 | 64 |
#ifdef __openVMS__ |
65 |
# undef __new |
|
66 |
#endif |
|
67 |
||
0 | 68 |
#include <stdio.h> |
69 |
#include <X11/Xlib.h> |
|
70 |
#include <X11/Xutil.h> |
|
71 |
#include <X11/Xatom.h> |
|
72 |
||
150 | 73 |
#define XK_MISCELLANY |
74 |
#include <X11/keysymdef.h> |
|
75 |
||
277
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
76 |
#include <X11/cursorfont.h> |
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
77 |
|
1974 | 78 |
#ifdef LINUX |
79 |
# include <sys/socket.h> |
|
80 |
#endif |
|
81 |
||
90 | 82 |
/* |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
83 |
* this define suppresses XAllocColor/XFreeColor on |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
84 |
* 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
|
85 |
* 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
|
86 |
*/ |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
87 |
#define QUICK_TRUE_COLORS |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
88 |
|
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
89 |
/* |
0 | 90 |
* shape support works; enabled by -DSHAPE in makefile |
91 |
* see RoundClock and RoundGlobe examples |
|
92 |
*/ |
|
93 |
#ifdef SHAPE |
|
94 |
# include <X11/extensions/shape.h> |
|
95 |
#endif |
|
96 |
||
97 |
/* |
|
150 | 98 |
* shared memory extension access is currently not supported |
0 | 99 |
* (only query is implemented) |
100 |
*/ |
|
101 |
#ifdef SHM |
|
102 |
# include <X11/extensions/XShm.h> |
|
103 |
#endif |
|
104 |
||
105 |
/* |
|
150 | 106 |
* multiBuffer extension access is currently not supported |
107 |
* (only query is implemented) |
|
108 |
*/ |
|
109 |
#ifdef MBUF |
|
110 |
# include <X11/extensions/multibuf.h> |
|
111 |
#endif |
|
112 |
||
113 |
/* |
|
114 |
* XVideo extension access is currently not supported |
|
115 |
* (only query is implemented) |
|
116 |
*/ |
|
117 |
#ifdef XVIDEO |
|
118 |
# include <X11/extensions/Xv.h> |
|
119 |
#endif |
|
120 |
||
121 |
/* |
|
186 | 122 |
* PEX extension - if available |
123 |
*/ |
|
124 |
#ifdef PEX5 |
|
125 |
# include <PEX5/PEX.h> |
|
126 |
#endif |
|
127 |
||
128 |
/* |
|
129 |
* XImage extension - if available |
|
130 |
*/ |
|
131 |
#ifdef XIE |
|
132 |
# include <X11/extensions/XIE.h> |
|
133 |
#endif |
|
134 |
||
135 |
/* |
|
90 | 136 |
* when I have more time to check it out, I will support display-PS |
0 | 137 |
*/ |
138 |
#ifdef DPS |
|
139 |
# ifdef sgi |
|
140 |
# include <X11/extensions/XDPS.h> |
|
141 |
# include <X11/extensions/XDPSlib.h> |
|
142 |
# include <X11/extensions/dpsXclient.h> |
|
143 |
# else |
|
144 |
# include <DPS/XDPS.h> |
|
145 |
# include <DPS/XDPSlib.h> |
|
146 |
# include <DPS/dpsXclient.h> |
|
147 |
# endif |
|
148 |
#endif |
|
149 |
||
1898 | 150 |
#if defined(someMachine) |
151 |
/* |
|
152 |
* if nformats cannot be found in the Display structure ... |
|
153 |
*/ |
|
154 |
# define NO_PRIVATE_DISPLAY_ACCESS |
|
155 |
#endif |
|
156 |
||
157 |
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6) |
|
90 | 158 |
/* |
159 |
* accessing private data in Display ... sorry |
|
160 |
*/ |
|
161 |
# define DISPLAYACCESS(d) ((_XPrivDisplay)d) |
|
162 |
#else |
|
163 |
# define DISPLAYACCESS(d) d |
|
164 |
#endif |
|
165 |
||
78 | 166 |
/* |
167 |
* some defines - tired of typing ... |
|
168 |
*/ |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
169 |
#define _DisplayVal(o) (Display *)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
170 |
#define _WindowVal(o) (Window)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
171 |
#define _PixmapVal(o) (Pixmap)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
172 |
#define _GCVal(o) (GC)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
173 |
#define _CursorVal(o) (Cursor)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
174 |
#define _FontVal(o) (XFontStruct *)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
175 |
#define _DPSContextVal(o) (DPSContext)(__externalAddressVal(o)) |
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
176 |
|
211 | 177 |
#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
|
178 |
#define _AtomVal(o) __intVal(o) |
211 | 179 |
#define __isAtomID(o) __isSmallInteger(o) |
180 |
||
555 | 181 |
#define myDpy _DisplayVal(__INST(displayId)) |
182 |
#define ISCONNECTED (__INST(displayId) != nil) |
|
78 | 183 |
|
184 |
#ifndef THISCONTEXT_IN_REGISTER |
|
1098 | 185 |
|
78 | 186 |
# define BEGIN_INTERRUPTSBLOCKED /* */ |
187 |
# define END_INTERRUPTSBLOCKED /* */ |
|
1098 | 188 |
|
78 | 189 |
#else |
1098 | 190 |
|
78 | 191 |
# define BEGIN_INTERRUPTSBLOCKED \ |
192 |
{ \ |
|
1344 | 193 |
int needUnblock = 0; \ |
194 |
\ |
|
195 |
__BEGIN_PROTECT_REGISTERS__ \ |
|
196 |
if (!__interruptsBlocked) { \ |
|
197 |
__BLOCKINTERRUPTS(); \ |
|
198 |
needUnblock = 1; \ |
|
199 |
} |
|
78 | 200 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
201 |
# define END_INTERRUPTSBLOCKED_NOW \ |
1344 | 202 |
__END_PROTECT_REGISTERS__ \ |
203 |
if (needUnblock) { \ |
|
204 |
__UNBLOCKINTERRUPTS(); \ |
|
205 |
} \ |
|
78 | 206 |
} |
207 |
||
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
208 |
# define END_INTERRUPTSBLOCKED \ |
1344 | 209 |
__END_PROTECT_REGISTERS__ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
210 |
|
78 | 211 |
#endif |
1891 | 212 |
|
213 |
#ifdef __VMS__ |
|
1899 | 214 |
# include "vms_Xnames.h" |
1891 | 215 |
#endif |
216 |
||
1974 | 217 |
#ifdef LINUX |
2057
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
218 |
# define DEFAULT_XLIB_TIMEOUT 600 /* in 50ms ticks (30 seconds) */ |
1974 | 219 |
static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT; |
220 |
# define ENTER_XLIB() \ |
|
221 |
{ \ |
|
222 |
__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ |
|
223 |
__blockingPrimitiveTimeoutArg__ = (INT)self; \ |
|
224 |
__blockingPrimitiveTimeout__ = __xlibTimeout__; \ |
|
225 |
} |
|
226 |
# define LEAVE_XLIB() \ |
|
227 |
{ \ |
|
228 |
__blockingPrimitiveTimeout__ = 0; \ |
|
229 |
} |
|
230 |
#else |
|
231 |
# define ENTER_XLIB() /* as nothing */ |
|
232 |
# define LEAVE_XLIB() /* as nothing */ |
|
233 |
#endif |
|
234 |
||
78 | 235 |
%} |
236 |
! ! |
|
237 |
||
238 |
!XWorkstation primitiveVariables! |
|
239 |
%{ |
|
0 | 240 |
/* |
146 | 241 |
* remembered info from private error handler |
0 | 242 |
*/ |
1974 | 243 |
static char lastErrorMsg[128] = ""; |
1888 | 244 |
static unsigned INT lastRequestCode = 0; |
245 |
static unsigned INT lastMinorCode = 0; |
|
246 |
static unsigned INT lastResource = 0; |
|
129 | 247 |
|
248 |
static int __debug__ = 0; |
|
249 |
#define DPRINTF(x) if (__debug__) { printf x; } |
|
78 | 250 |
%} |
251 |
! ! |
|
252 |
||
253 |
!XWorkstation primitiveFunctions! |
|
254 |
%{ |
|
1062 | 255 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
256 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
257 |
* some systems need a dummy reference to force the linker |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
258 |
* to include that stuff. Should be #ifdef'd ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
259 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
260 |
#ifndef ELF |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
261 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
262 |
# ifdef __GNUC__ |
1081 | 263 |
VOLATILE |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
264 |
# endif |
1081 | 265 |
static |
1062 | 266 |
dummyToForceLoading() { |
1344 | 267 |
XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
268 |
XCloseDisplay(0); |
|
269 |
XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
|
270 |
XSetWindowColormap(0, 0, 0); |
|
271 |
XQueryColors(0,0,0,0); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
272 |
# ifdef SHM |
1344 | 273 |
XShmAttach(0, 0); |
274 |
XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
|
275 |
XShmDetach(0, 0); |
|
276 |
XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
|
277 |
shmctl(0,0,0); |
|
278 |
fgetc(0); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
279 |
# endif |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
280 |
} |
1062 | 281 |
#endif |
282 |
||
18 | 283 |
/* |
144 | 284 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
285 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 286 |
* the implementation below is somewhat wrong: it will |
78 | 287 |
* report all errors for Display, even though there could be |
162 | 288 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
289 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 290 |
*/ |
1974 | 291 |
int |
12 | 292 |
__XErrorHandler__(dpy, event) |
0 | 293 |
Display *dpy; |
294 |
XErrorEvent *event; |
|
295 |
{ |
|
1974 | 296 |
XGetErrorText(dpy, event->error_code, lastErrorMsg, 127); |
297 |
lastErrorMsg[127] = '\0'; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
298 |
|
0 | 299 |
if (lastErrorMsg[0] == '\0') { |
1344 | 300 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 301 |
} |
2 | 302 |
lastRequestCode = event->request_code; |
303 |
lastMinorCode = event->minor_code; |
|
304 |
lastResource = event->resourceid; |
|
911 | 305 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
1344 | 306 |
/* |
307 |
* this is a BadWindow error for X_DestroyWindow. |
|
308 |
* ignore it here, since it results from the GC freeing windows |
|
309 |
* in non bottom-up window order. |
|
310 |
*/ |
|
311 |
return 0; |
|
911 | 312 |
} |
2 | 313 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
314 |
if (@global(ErrorPrinting) == true) { |
1753 | 315 |
fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n", |
1344 | 316 |
event->request_code, event->request_code, |
317 |
event->minor_code, event->minor_code, event->resourceid); |
|
1974 | 318 |
fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", |
319 |
event->error_code, lastErrorMsg); |
|
320 |
} |
|
321 |
||
1990 | 322 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy)); |
0 | 323 |
return 0; |
324 |
} |
|
325 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
326 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
327 |
* much like the above, but for IO Errors; |
1974 | 328 |
* forwarded as errorInterrupt:#DisplayIOError, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
329 |
* In single display apps, handling those here does not |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
330 |
* really make sense (except, for a controlled cleanup). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
331 |
* However, in multiDisplay apps, a single broken |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
332 |
* connection should not affect the other users. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
333 |
*/ |
1974 | 334 |
int |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
335 |
__XIOErrorHandler__(dpy) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
336 |
Display *dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
337 |
{ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
338 |
if (@global(ErrorPrinting) == true) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
339 |
fprintf(stderr, "XWorkstation [error]: I/O error\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
340 |
} |
1974 | 341 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError), |
342 |
__MKEXTERNALADDRESS(dpy)); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
343 |
__internalError("unhandled display I/O error"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
344 |
__terminateProcess(0); /* soft terminate */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
345 |
__terminateProcess(1); /* hard terminate */ |
1974 | 346 |
/* never reached */ |
347 |
return 0; |
|
348 |
} |
|
349 |
||
350 |
/* |
|
351 |
* timeout error in case of Xlib request timeout. |
|
352 |
* forwarded as errorInterrupt:#DisplayIOTimeoutError, |
|
353 |
* This is generated synthetically by the VM if the |
|
354 |
* timeoutHandler has been set. |
|
355 |
*/ |
|
356 |
void |
|
357 |
__XTimeoutErrorHandler(displayDeviceInst) |
|
358 |
OBJ displayDeviceInst; |
|
359 |
{ |
|
360 |
if (@global(ErrorPrinting) == true) { |
|
361 |
fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst); |
|
362 |
} |
|
2057
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
363 |
if (displayDeviceInst == @global(MainDisplay)) { |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
364 |
fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n"); |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
365 |
return; |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
366 |
} |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
367 |
|
1974 | 368 |
/* |
369 |
* must immediately flush that displays deviceID - otherwise, |
|
370 |
* the scheduler may try to ask for pending events without a watchdog |
|
371 |
* timer ... |
|
372 |
*/ |
|
1990 | 373 |
__OINST(displayDeviceInst, displayId) = nil; |
374 |
||
375 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst); |
|
1974 | 376 |
__internalError("unhandled display Timeout error"); |
1990 | 377 |
|
1974 | 378 |
__terminateProcess(0); /* soft terminate */ |
379 |
__terminateProcess(1); /* hard terminate */ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
380 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
381 |
|
90 | 382 |
#ifdef VIRTUAL_ROOT |
0 | 383 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
384 |
* added since RootWindow-macro is not sufficient |
18 | 385 |
* when virtual root-windows are involved (i.e. tvtwm) |
386 |
*/ |
|
387 |
static Window |
|
388 |
getRootWindow(dpy, screen) |
|
389 |
Display *dpy; |
|
390 |
{ |
|
391 |
Window root; |
|
392 |
Atom vRootAtom = None; |
|
393 |
int i; |
|
394 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
395 |
Window* children = (Window *)0; |
18 | 396 |
unsigned int numChildren; |
397 |
||
398 |
root = RootWindow(dpy, screen); |
|
399 |
/* |
|
400 |
* on IRIS, this creates a badwindow error - why ? |
|
401 |
* children contains a funny window (000034) |
|
402 |
*/ |
|
90 | 403 |
# if !defined(IRIS) || defined(IRIX5) |
1887 | 404 |
if (root) { |
1906 | 405 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
1887 | 406 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
407 |
if (vRootAtom != None) { |
|
1906 | 408 |
for (i=0; i < numChildren; i++) { |
1887 | 409 |
Atom actual_type; |
410 |
int actual_format; |
|
411 |
unsigned long nitems, bytesafter; |
|
412 |
Window* newRoot = (Window*) 0; |
|
413 |
||
414 |
if (children[i]) { |
|
1906 | 415 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
1887 | 416 |
0L, 1L, False, XA_WINDOW, |
417 |
&actual_type, &actual_format, &nitems, &bytesafter, |
|
418 |
(unsigned char**) &newRoot) == Success && newRoot) { |
|
419 |
root = *newRoot; |
|
420 |
XFree(newRoot); /* XXX */ |
|
421 |
break; |
|
1906 | 422 |
} |
1344 | 423 |
} |
1906 | 424 |
} |
1344 | 425 |
} |
1887 | 426 |
if (children) XFree( children ); |
427 |
} |
|
18 | 428 |
} |
90 | 429 |
# endif |
18 | 430 |
return root; |
431 |
} |
|
90 | 432 |
#endif |
0 | 433 |
%} |
78 | 434 |
! ! |
0 | 435 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
436 |
!XWorkstation class methodsFor:'documentation'! |
295 | 437 |
|
438 |
copyright |
|
439 |
" |
|
440 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1344 | 441 |
All Rights Reserved |
295 | 442 |
|
443 |
This software is furnished under a license and may be used |
|
444 |
only in accordance with the terms of that license and with the |
|
445 |
inclusion of the above copyright notice. This software may not |
|
446 |
be provided or otherwise made available to, or used by, any |
|
447 |
other person. No title to or ownership of the software is |
|
448 |
hereby transferred. |
|
449 |
" |
|
450 |
! |
|
451 |
||
452 |
documentation |
|
453 |
" |
|
454 |
this class provides the interface to X11. It redefines all required methods |
|
455 |
from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically |
|
456 |
limited to one display - in theory, you can create Views on many displays |
|
457 |
simultanously. However, the default setup is for one display only. |
|
458 |
To support multiple displays, you will have to start another event dispatcher |
|
459 |
process for the other display(s) and create the other views with a slightly |
|
460 |
different protocol. However, 'normal' applications do not have to care for |
|
461 |
all of this ... |
|
462 |
||
463 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 464 |
|
465 |
[author:] |
|
1344 | 466 |
Claus Gittinger |
295 | 467 |
" |
468 |
! ! |
|
469 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
470 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
471 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
472 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
473 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
474 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
475 |
super initialize. |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
476 |
|
386 | 477 |
RawKeysymTranslation isNil ifTrue:[ |
1344 | 478 |
"/ the following table maps X-keyevents to ST/X |
479 |
"/ device independed events. |
|
480 |
"/ It is NOT meant as a keyboardMap replacement. |
|
481 |
||
482 |
RawKeysymTranslation := d := Dictionary new. |
|
483 |
d at:'Delete_line' put:#DeleteLine. |
|
484 |
d at:'Delete_word' put:#DeleteWord. |
|
485 |
d at:'Down' put:#CursorDown. |
|
486 |
d at:'Up' put:#CursorUp. |
|
487 |
d at:'Left' put:#CursorLeft. |
|
488 |
d at:'Right' put:#CursorRight. |
|
386 | 489 |
] |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
490 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
491 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
492 |
!XWorkstation class methodsFor:'error handling'! |
2 | 493 |
|
129 | 494 |
debug:aBoolean |
495 |
%{ /* NOCONTEXT */ |
|
496 |
||
497 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
498 |
%} |
|
499 |
! |
|
500 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
501 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
502 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
503 |
#ifdef COUNT_RESOURCES |
1404 | 504 |
printf("colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n", |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
505 |
__cnt_color, __cnt_bitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
506 |
__cnt_view, __cnt_gc, __cnt_cursor, __cnt_font); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
507 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
508 |
%} |
1404 | 509 |
|
510 |
" |
|
511 |
XWorkstation debugResources |
|
512 |
" |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
513 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
514 |
|
78 | 515 |
errorStringOfLastError |
516 |
%{ |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
517 |
RETURN ( __MKSTRING(lastErrorMsg) ); |
78 | 518 |
%} |
519 |
! |
|
520 |
||
135 | 521 |
lastErrorString |
2 | 522 |
"return the last X-error string - |
523 |
when buffering is on, this may be |
|
524 |
an error for a long-ago operation" |
|
78 | 525 |
|
526 |
|string requestCode s match line| |
|
527 |
||
528 |
string := self errorStringOfLastError. |
|
529 |
requestCode := self requestCodeOfLastError. |
|
530 |
" |
|
531 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
532 |
and append the name of the corresponding X-request |
|
533 |
" |
|
534 |
s := '/usr/lib/X11/XErrorDB' asFilename readStream. |
|
535 |
s notNil ifTrue:[ |
|
1344 | 536 |
match := 'XRequest.' , requestCode printString. |
537 |
line := s peekForLineStartingWith:match. |
|
538 |
line notNil ifTrue:[ |
|
539 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
540 |
]. |
|
541 |
s close. |
|
78 | 542 |
]. |
543 |
^ string |
|
295 | 544 |
! |
545 |
||
546 |
minorCodeOfLastError |
|
547 |
%{ /* NOCONTEXT */ |
|
548 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
549 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 550 |
%} |
551 |
! |
|
552 |
||
553 |
requestCodeOfLastError |
|
152 | 554 |
%{ /* NOCONTEXT */ |
555 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
556 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 557 |
%} |
135 | 558 |
! |
559 |
||
295 | 560 |
resourceIdOfLastError |
0 | 561 |
%{ /* NOCONTEXT */ |
295 | 562 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
563 |
RETURN ( __MKEXTERNALADDRESS(lastResource) ); |
0 | 564 |
%} |
565 |
! ! |
|
566 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
567 |
!XWorkstation class methodsFor:'queries'! |
104 | 568 |
|
569 |
platformName |
|
133 | 570 |
"ST-80 compatibility. |
571 |
Return a string describing the display systems platform." |
|
572 |
||
715 | 573 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
574 |
||
575 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 576 |
! ! |
577 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
578 |
!XWorkstation methodsFor:'Signal constants'! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
579 |
|
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
580 |
deviceErrorSignal |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
581 |
"return the per-device signal, which is raised when some |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
582 |
X-Error occurs." |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
583 |
|
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
584 |
^ deviceErrorSignal |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
585 |
! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
586 |
|
1974 | 587 |
deviceIOErrorSignal |
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
588 |
"return the per-device signal, which is raised when a fatal |
1974 | 589 |
IO error (i.e. broken connection) occurs." |
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
590 |
|
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
591 |
^ deviceIOErrorSignal |
1974 | 592 |
! |
593 |
||
594 |
deviceIOTimeoutErrorSignal |
|
595 |
"return the per-device signal, which is raised when a timeout |
|
596 |
IO error (i.e. broken connection) occurs." |
|
597 |
||
598 |
^ deviceIOTimeoutErrorSignal |
|
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
599 |
! ! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
600 |
|
0 | 601 |
!XWorkstation methodsFor:'accessing & queries'! |
602 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
603 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
604 |
"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
|
605 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
606 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
607 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
608 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
609 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
610 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
611 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
612 |
|
295 | 613 |
blackpixel |
614 |
"return the colornumber of black" |
|
615 |
||
616 |
^ blackpixel |
|
617 |
! |
|
618 |
||
619 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
620 |
"return the state-mask for button1 in motion events' state-field. |
295 | 621 |
For backward compatibility." |
622 |
||
623 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
624 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
295 | 625 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
626 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
627 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
628 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
629 |
" |
295 | 630 |
! |
631 |
||
632 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
633 |
"return the state-mask for button2 in motion events' state-field |
295 | 634 |
For backward compatibility." |
635 |
||
636 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
637 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 638 |
%} |
639 |
! |
|
640 |
||
641 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
642 |
"return the state-mask for button3 in motion events' state-field |
295 | 643 |
For backward compatibility." |
644 |
||
645 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
646 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 647 |
%} |
648 |
! |
|
649 |
||
650 |
buttonMotionMask:aButton |
|
651 |
"return the state-mask for button1 in motion events state-field. |
|
652 |
This is the devices mask." |
|
653 |
||
654 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
655 |
if (aButton == __MKSMALLINT(1)) { |
1344 | 656 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
657 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
658 |
if (aButton == __MKSMALLINT(2)) { |
1344 | 659 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
660 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
661 |
if (aButton == __MKSMALLINT(3)) { |
1344 | 662 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 663 |
} |
664 |
%}. |
|
665 |
^ nil |
|
666 |
! |
|
667 |
||
382 | 668 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
669 |
"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
|
670 |
|
382 | 671 |
%{ /* NOCONTEXT */ |
672 |
RETURN (__MKSMALLINT(ControlMask)); |
|
673 |
%} |
|
674 |
! |
|
675 |
||
295 | 676 |
defaultEventMask |
677 |
"return a mask to enable some events by default." |
|
678 |
||
679 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
680 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
1344 | 681 |
KeyPressMask | KeyReleaseMask | |
682 |
EnterWindowMask | LeaveWindowMask | |
|
683 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
|
295 | 684 |
%} |
685 |
! |
|
686 |
||
0 | 687 |
displayFileDescriptor |
688 |
"return the displays fileNumber - for select" |
|
689 |
||
690 |
%{ /* NOCONTEXT */ |
|
691 |
||
150 | 692 |
if (ISCONNECTED) { |
1344 | 693 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 694 |
} |
695 |
RETURN (nil); |
|
0 | 696 |
%} |
697 |
! |
|
698 |
||
133 | 699 |
displayName |
700 |
"return the X-connections display name. |
|
701 |
This is (currently) nil for the default display, |
|
702 |
something like foo:0 for any other remote display. |
|
703 |
Future versions may return non-nil strings for the default display as well." |
|
704 |
||
705 |
^ displayName |
|
706 |
! |
|
707 |
||
341 | 708 |
protocolVersion |
709 |
"return the X-servers protocol version - should normally not be of |
|
710 |
any interest" |
|
711 |
||
712 |
%{ /* NOCONTEXT */ |
|
713 |
if (ISCONNECTED) { |
|
1344 | 714 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
341 | 715 |
} |
716 |
RETURN (nil); |
|
717 |
%} |
|
718 |
||
719 |
" |
|
720 |
Display protocolVersion |
|
721 |
" |
|
722 |
! |
|
723 |
||
724 |
serverVendor |
|
725 |
"return the X-server vendor string - this should normally not be of |
|
726 |
any interest, but can be for special cases |
|
727 |
(to avoid bugs in certain implementations)" |
|
728 |
%{ |
|
729 |
if (ISCONNECTED) { |
|
1344 | 730 |
RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
341 | 731 |
} |
732 |
RETURN (nil); |
|
733 |
%} |
|
734 |
||
735 |
" |
|
736 |
Display serverVendor |
|
737 |
" |
|
738 |
! |
|
739 |
||
382 | 740 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
741 |
"return the state-mask for the SHIFT modified in motion events' state-field." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
742 |
|
382 | 743 |
%{ /* NOCONTEXT */ |
744 |
RETURN (__MKSMALLINT(ShiftMask)); |
|
745 |
%} |
|
746 |
! |
|
747 |
||
341 | 748 |
translatePoint:aPoint from:windowId1 to:windowId2 |
749 |
"given a point in window1, return the coordinate in window2. |
|
750 |
This expects a device coordinate (relative to the first views origin) |
|
751 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
752 |
- use to xlate points from a window to rootwindow" |
|
753 |
||
754 |
|x1 y1 x2 y2| |
|
755 |
||
756 |
x1 := x2 := aPoint x truncated. |
|
757 |
y1 := y2 := aPoint y truncated. |
|
758 |
%{ |
|
759 |
int xpos, ypos; |
|
760 |
Window w1, w2, child_return; |
|
555 | 761 |
int screen = __intVal(__INST(screen)); |
1209 | 762 |
|
763 |
if (ISCONNECTED |
|
764 |
&& __isExternalAddress(windowId1) |
|
341 | 765 |
&& __isExternalAddress(windowId2) |
766 |
&& __bothSmallInteger(x1, y1)) { |
|
1344 | 767 |
Display *dpy = myDpy; |
1974 | 768 |
Window rootWin; |
1344 | 769 |
|
770 |
w1 = _WindowVal(windowId1); |
|
771 |
w2 = _WindowVal(windowId2); |
|
1974 | 772 |
|
341 | 773 |
#ifdef VIRTUAL_ROOT |
1974 | 774 |
rootWin = RootWindow(dpy, screen); |
775 |
if ((w1 == rootWin) || (w2 == rootWin)) { |
|
776 |
if (w1 == rootWin) { |
|
1344 | 777 |
w1 = getRootWindow(dpy, screen); |
778 |
} |
|
1974 | 779 |
if (w2 == rootWin) { |
1344 | 780 |
w2 = getRootWindow(dpy, screen); |
781 |
} |
|
782 |
} |
|
341 | 783 |
#endif |
1344 | 784 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 785 |
ENTER_XLIB(); |
1344 | 786 |
XTranslateCoordinates(dpy, w1, w2, |
787 |
__intVal(x1), __intVal(y1), |
|
788 |
&xpos, &ypos, &child_return); |
|
1974 | 789 |
LEAVE_XLIB(); |
1344 | 790 |
END_INTERRUPTSBLOCKED |
791 |
x2 = __MKSMALLINT(xpos); |
|
792 |
y2 = __MKSMALLINT(ypos); |
|
341 | 793 |
} |
794 |
%}. |
|
795 |
||
796 |
^ (x2 @ y2) |
|
797 |
! |
|
798 |
||
799 |
vendorRelease |
|
800 |
"return the X-servers vendor release - should normally not be of |
|
801 |
any interest, but can be for special cases. |
|
802 |
(to avoid bugs in certain implementations)" |
|
803 |
||
804 |
%{ /* NOCONTEXT */ |
|
805 |
if (ISCONNECTED) { |
|
1344 | 806 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
341 | 807 |
} |
808 |
RETURN (nil); |
|
809 |
%} |
|
810 |
||
811 |
" |
|
812 |
Display vendorRelease |
|
813 |
" |
|
814 |
! |
|
815 |
||
816 |
viewIdFromPoint:aPoint in:windowId |
|
817 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
818 |
hit by this coordinate. Return nil if no view was hit. |
|
819 |
The returned id may be the id of a non ST view. |
|
820 |
- used to find the window to drop objects after a cross-view drag." |
|
821 |
||
822 |
%{ /* NOCONTEXT */ |
|
823 |
||
555 | 824 |
int screen = __intVal(__INST(screen)); |
341 | 825 |
OBJ xp, yp; |
826 |
int xpos, ypos; |
|
827 |
Window child_return; |
|
828 |
||
1209 | 829 |
if (ISCONNECTED |
830 |
&& __isExternalAddress(windowId) |
|
341 | 831 |
&& __isPoint(aPoint)) { |
1344 | 832 |
Display *dpy = myDpy; |
833 |
||
834 |
xp = _point_X(aPoint); |
|
835 |
yp = _point_Y(aPoint); |
|
836 |
if (__bothSmallInteger(xp, yp)) { |
|
837 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 838 |
ENTER_XLIB(); |
1344 | 839 |
XTranslateCoordinates(dpy, |
840 |
RootWindow(dpy, screen), |
|
841 |
_WindowVal(windowId), |
|
842 |
__intVal(xp), __intVal(yp), |
|
843 |
&xpos, &ypos, &child_return); |
|
1974 | 844 |
LEAVE_XLIB(); |
1344 | 845 |
END_INTERRUPTSBLOCKED |
846 |
if (child_return) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
847 |
RETURN ( __MKEXTERNALADDRESS(child_return) ); |
1344 | 848 |
} |
849 |
RETURN ( nil ); |
|
850 |
} |
|
341 | 851 |
} |
852 |
%}. |
|
853 |
windowId notNil ifTrue:[ |
|
1344 | 854 |
aPoint isPoint ifTrue:[ |
855 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
856 |
] |
|
341 | 857 |
]. |
858 |
||
859 |
^ nil |
|
860 |
! |
|
861 |
||
862 |
virtualExtent |
|
863 |
"return the virtual extent of the display (in pixels). |
|
864 |
On most systems, this is the same as the physical width; |
|
865 |
except, if a window manager with a virtual desktop like olvwm |
|
866 |
(simulating a bigger screen) is running." |
|
867 |
||
868 |
%{ |
|
1209 | 869 |
if (ISCONNECTED |
870 |
&& (__INST(rootId) != __INST(virtualRootId)) |
|
555 | 871 |
&& __isExternalAddress(__INST(virtualRootId))) { |
1344 | 872 |
Window vRootWin; |
873 |
Window root; |
|
874 |
int x, y; |
|
875 |
unsigned int width, height; |
|
876 |
unsigned int dummy; |
|
1974 | 877 |
int ret; |
1344 | 878 |
|
879 |
vRootWin = _WindowVal(__INST(virtualRootId)); |
|
1974 | 880 |
ENTER_XLIB(); |
881 |
ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
|
882 |
&dummy, &dummy); |
|
883 |
LEAVE_XLIB(); |
|
884 |
if (ret) { |
|
1344 | 885 |
RETURN ( __MKPOINT_INT(width, height) ); |
886 |
} |
|
341 | 887 |
} |
888 |
%}. |
|
889 |
^ width @ height |
|
890 |
! |
|
891 |
||
892 |
whitepixel |
|
893 |
"return the colornumber of white" |
|
894 |
||
895 |
^ whitepixel |
|
896 |
! ! |
|
897 |
||
898 |
!XWorkstation methodsFor:'accessing display capabilities'! |
|
899 |
||
0 | 900 |
hasDPS |
186 | 901 |
"return true, if this workstation supports display postscript. |
902 |
Both the server must support it, and the feature must have been |
|
903 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 904 |
|
905 |
^ hasDPSExtension |
|
186 | 906 |
|
907 |
" |
|
908 |
Display hasDPS |
|
909 |
" |
|
910 |
! |
|
911 |
||
150 | 912 |
hasExtension:extensionString |
913 |
"query for an X extension. The argument, extensionString |
|
914 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 915 |
Return true, if that extension is available in the server. |
916 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 917 |
|
918 |
%{ |
|
919 |
int dummy; |
|
1974 | 920 |
OBJ rslt = false; |
150 | 921 |
|
922 |
if (__isString(extensionString) && ISCONNECTED) { |
|
1974 | 923 |
ENTER_XLIB(); |
1344 | 924 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
1974 | 925 |
rslt = true; |
926 |
} |
|
927 |
LEAVE_XLIB(); |
|
928 |
} |
|
929 |
RETURN (rslt); |
|
930 |
%} |
|
186 | 931 |
|
932 |
" |
|
933 |
Display hasExtension:'XVideo' |
|
934 |
Display hasExtension:'Input' |
|
935 |
Display hasExtension:'GLX' |
|
936 |
Display hasExtension:'X3D-PEX' |
|
937 |
Display hasExtension:'XInputExtension' |
|
938 |
Display hasExtension:'SHAPE' |
|
939 |
Display hasExtension:'MIT-SHM' |
|
940 |
Display hasExtension:'SGIFullScreenStereo' |
|
941 |
" |
|
150 | 942 |
! |
943 |
||
295 | 944 |
hasImageExtension |
945 |
"return true, if this workstation supports the X image extension. |
|
946 |
Both the server must support it, and the feature must have been |
|
947 |
enabled in the smalltalk system, for true to be returned." |
|
948 |
||
949 |
^ hasImageExtension |
|
950 |
||
951 |
" |
|
952 |
Display hasImageExtension |
|
953 |
" |
|
954 |
! |
|
955 |
||
956 |
hasInputExtension |
|
957 |
"return true, if this workstation supports the X input extension. |
|
958 |
Both the server must support it, and the feature must have been |
|
959 |
enabled in the smalltalk system, for true to be returned." |
|
960 |
||
961 |
^ hasInputExtension |
|
962 |
||
963 |
" |
|
964 |
Display hasInputExtension |
|
965 |
" |
|
966 |
! |
|
967 |
||
968 |
hasMultibuffer |
|
969 |
"return true, if this workstation supports the multibuffer extension. |
|
970 |
Both the server must support it, and the feature must have been |
|
971 |
enabled in the smalltalk system, for true to be returned." |
|
972 |
||
973 |
^ hasMbufExtension |
|
974 |
||
975 |
" |
|
976 |
Display hasMultibuffer |
|
977 |
" |
|
978 |
! |
|
979 |
||
980 |
hasPEX |
|
981 |
"return true, if this workstation supports PEX 3D graphics. |
|
982 |
Both the server must support it, and the feature must have been |
|
983 |
enabled in the smalltalk system, for true to be returned." |
|
984 |
||
985 |
^ hasPEXExtension |
|
986 |
||
987 |
" |
|
988 |
Display hasPEX |
|
989 |
" |
|
990 |
! |
|
991 |
||
992 |
hasShape |
|
993 |
"return true, if this workstation supports non-rectangular windows. |
|
994 |
Both the server must support it, and the feature must have been |
|
995 |
enabled in the smalltalk system, for true to be returned." |
|
996 |
||
997 |
^ hasShapeExtension |
|
998 |
||
999 |
" |
|
1000 |
Display hasShape |
|
1001 |
" |
|
1002 |
! |
|
1003 |
||
1004 |
hasShm |
|
1005 |
"return true, if this workstation supports the shared pixmap extension. |
|
1006 |
Both the server must support it, and the feature must have been |
|
1007 |
enabled in the smalltalk system, for true to be returned." |
|
1008 |
||
1009 |
^ hasShmExtension |
|
1010 |
||
1011 |
" |
|
1012 |
Display hasShm |
|
1013 |
" |
|
1014 |
! |
|
1015 |
||
1016 |
hasXVideo |
|
1017 |
"return true, if this workstation supports the XVideo extension. |
|
1018 |
Both the server must support it, and the feature must have been |
|
1019 |
enabled in the smalltalk system, for true to be returned." |
|
1020 |
||
1021 |
^ hasXVideoExtension |
|
1022 |
||
1023 |
" |
|
1024 |
Display hasXVideo |
|
1025 |
" |
|
1026 |
! |
|
1027 |
||
1028 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
1029 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 1030 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 1031 |
|
1032 |
|xIconSizes count ret| |
|
1033 |
||
1034 |
%{ |
|
555 | 1035 |
int screen = __intVal(__INST(screen)); |
295 | 1036 |
XIconSize *sizeList; |
1037 |
int cnt; |
|
1038 |
||
1039 |
if (ISCONNECTED) { |
|
1344 | 1040 |
Display *dpy = myDpy; |
1974 | 1041 |
int status; |
1042 |
||
1043 |
ENTER_XLIB(); |
|
1044 |
status = XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt); |
|
1045 |
LEAVE_XLIB(); |
|
1046 |
if (status > 0) { |
|
1344 | 1047 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
1048 |
count = __MKSMALLINT(cnt); |
|
1049 |
} |
|
295 | 1050 |
} |
1051 |
%}. |
|
1052 |
xIconSizes isNil ifTrue:[^ nil]. |
|
1053 |
||
1054 |
ret := OrderedCollection new:count. |
|
1055 |
1 to:count do:[ :i | |
|
1344 | 1056 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 1057 |
|
1058 |
%{ |
|
1344 | 1059 |
XIconSize *slp; |
1060 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1061 |
slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1]; |
1344 | 1062 |
minWidth = __MKSMALLINT(slp->min_width); |
1063 |
minHeight = __MKSMALLINT(slp->min_height); |
|
1064 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
1065 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
1066 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
1067 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 1068 |
%}. |
1344 | 1069 |
d := IdentityDictionary new. |
1070 |
d at:#minWidth put:minWidth. |
|
1071 |
d at:#maxWidth put:maxWidth. |
|
1072 |
d at:#widthStep put:widthStep. |
|
1073 |
d at:#minHeight put:minHeight. |
|
1074 |
d at:#maxHeight put:maxHeight. |
|
1075 |
d at:#heightStep put:heightStep. |
|
1076 |
||
1077 |
ret add:d |
|
295 | 1078 |
]. |
1079 |
||
1080 |
xIconSizes free. |
|
1081 |
^ ret |
|
1082 |
||
1083 |
" |
|
819 | 1084 |
Display iconSizes |
295 | 1085 |
" |
1086 |
! |
|
1087 |
||
341 | 1088 |
ignoreBackingStore:aBoolean |
1089 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
1090 |
no backing store used - this can be used on servers where backing store is |
|
1091 |
very slow or is broken (can be put into display-rc-file)" |
|
1092 |
||
1093 |
ignoreBackingStore := aBoolean |
|
295 | 1094 |
! |
1095 |
||
823 | 1096 |
preferredIconSize |
1097 |
"return the displays preferred size for icons. |
|
1098 |
Redefined to return a special value on SGI servers." |
|
1099 |
||
1100 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
1344 | 1101 |
^ 86@68 |
823 | 1102 |
]. |
1103 |
^ super preferredIconSize |
|
1104 |
||
1105 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
1106 |
! |
|
1107 |
||
1025 | 1108 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1109 |
"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
|
1110 |
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
|
1111 |
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
|
1112 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1113 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1114 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1115 |
|
43 | 1116 |
supportedImageFormats |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1117 |
"return an array with supported image formats; |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1118 |
each array entry is an attribute dictionary, consisting of |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1119 |
depth, bitsPerPixel and padding values." |
43 | 1120 |
|
150 | 1121 |
|nFormats "{ Class: SmallInteger }" |
1122 |
formatArray| |
|
43 | 1123 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1124 |
Display *dpy; |
150 | 1125 |
|
1126 |
if (! ISCONNECTED) { |
|
1344 | 1127 |
RETURN (nil); |
150 | 1128 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1129 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1130 |
dpy = myDpy; |
1898 | 1131 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1132 |
nFormats = __MKSMALLINT(1); |
1133 |
#else |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1134 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
1891 | 1135 |
#endif |
43 | 1136 |
%}. |
1137 |
formatArray := Array new:nFormats. |
|
150 | 1138 |
1 to:nFormats do:[:index | |
1344 | 1139 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
1140 |
||
1141 |
i := index. |
|
43 | 1142 |
%{ |
1344 | 1143 |
ScreenFormat *format; |
1144 |
Display *dpy = myDpy; |
|
1145 |
||
1898 | 1146 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1147 |
depthInfo = __MKSMALLINT(1); |
1148 |
bitsPerPixelInfo = __MKSMALLINT(1); |
|
1149 |
paddingInfo = __MKSMALLINT(8); |
|
1150 |
#else |
|
1344 | 1151 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
1152 |
format += (__intVal(i)-1); |
|
1153 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
|
1154 |
depthInfo = __MKSMALLINT(format->depth); |
|
1155 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
|
1891 | 1156 |
#endif |
43 | 1157 |
%}. |
1344 | 1158 |
info := IdentityDictionary new. |
1159 |
info at:#depth put:depthInfo. |
|
1160 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
|
1161 |
info at:#padding put:paddingInfo. |
|
1162 |
formatArray at:index put:info. |
|
43 | 1163 |
]. |
1164 |
^ formatArray |
|
1165 |
||
1166 |
" |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1167 |
Display supportedImageFormats |
43 | 1168 |
" |
1169 |
! |
|
1170 |
||
823 | 1171 |
supportsIconViews |
1172 |
"return true, if this device supports views as icons. |
|
1173 |
Only Xservers (currently) support this." |
|
1174 |
||
1175 |
^ true |
|
1176 |
||
1177 |
" |
|
1178 |
Display supportsIconViews |
|
1179 |
" |
|
1180 |
||
1181 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1182 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
1183 |
! |
|
1184 |
||
81 | 1185 |
supportsViewGravity |
1186 |
"return true, if this device supports gravity attributes. |
|
82 | 1187 |
We do not depend on it being implemented, but some resizing operations |
81 | 1188 |
are faster, it is is." |
1189 |
||
1190 |
^ true |
|
0 | 1191 |
! ! |
1192 |
||
1193 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1194 |
||
295 | 1195 |
createBitmapFromArray:anArray width:w height:h |
1196 |
|bitmapId| |
|
1197 |
||
1198 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1199 |
bitmapId isNil ifTrue:[ |
|
1344 | 1200 |
self primitiveFailed |
295 | 1201 |
]. |
1202 |
^ bitmapId |
|
1203 |
! |
|
1204 |
||
1205 |
createBitmapFromFile:aString for:aForm |
|
1206 |
|id w h| |
|
1207 |
||
1208 |
%{ |
|
555 | 1209 |
int screen = __intVal(__INST(screen)); |
295 | 1210 |
Pixmap newBitmap; |
1211 |
char *filename; |
|
1212 |
unsigned b_width, b_height; |
|
1213 |
int b_x_hot, b_y_hot; |
|
1214 |
int status; |
|
1215 |
||
1216 |
if (ISCONNECTED) { |
|
1344 | 1217 |
Display *dpy = myDpy; |
1218 |
||
1219 |
if (__isString(aString) || __isSymbol(aString)) { |
|
1831 | 1220 |
filename = (char *) __stringVal(aString); |
1344 | 1221 |
|
1222 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1223 |
ENTER_XLIB(); |
1344 | 1224 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
1225 |
filename, &b_width, &b_height, &newBitmap, |
|
1226 |
&b_x_hot, &b_y_hot); |
|
1974 | 1227 |
LEAVE_XLIB(); |
1344 | 1228 |
END_INTERRUPTSBLOCKED |
1229 |
||
1230 |
if ((status == BitmapSuccess) && newBitmap) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1231 |
#ifdef COUNT_RESOURCES |
1344 | 1232 |
__cnt_bitmap++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1233 |
#endif |
1344 | 1234 |
w = __MKSMALLINT(b_width); |
1235 |
h = __MKSMALLINT(b_height); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1236 |
id = __MKEXTERNALADDRESS(newBitmap); |
1344 | 1237 |
} |
1238 |
} |
|
295 | 1239 |
} |
1240 |
%}. |
|
1241 |
id notNil ifTrue:[ |
|
1344 | 1242 |
aForm setWidth:w height:h |
295 | 1243 |
]. |
1244 |
^ id |
|
1245 |
! |
|
1246 |
||
1247 |
createBitmapWidth:w height:h |
|
1248 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1249 |
(i.e. random). Return a bitmap id or nil" |
|
1250 |
||
1251 |
%{ /* NOCONTEXT */ |
|
1252 |
||
555 | 1253 |
int screen = __intVal(__INST(screen)); |
295 | 1254 |
Pixmap newBitmap; |
1255 |
||
1256 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1344 | 1257 |
Display *dpy = myDpy; |
1258 |
||
1259 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1260 |
ENTER_XLIB(); |
1344 | 1261 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1262 |
__intVal(w), __intVal(h), 1); |
|
1974 | 1263 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1264 |
#ifdef COUNT_RESOURCES |
1344 | 1265 |
if (newBitmap) |
1266 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1267 |
#endif |
1344 | 1268 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1269 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
295 | 1270 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1271 |
%}. |
295 | 1272 |
self primitiveFailed. |
1273 |
^ nil |
|
1274 |
! |
|
1275 |
||
0 | 1276 |
createPixmapWidth:w height:h depth:d |
1277 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1278 |
(i.e. random). Return a bitmap id or nil" |
|
1279 |
||
1280 |
%{ /* NOCONTEXT */ |
|
1281 |
||
555 | 1282 |
int screen = __intVal(__INST(screen)); |
0 | 1283 |
Pixmap newBitmap; |
1284 |
||
150 | 1285 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1344 | 1286 |
Display *dpy = myDpy; |
1287 |
||
1288 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1289 |
ENTER_XLIB(); |
1344 | 1290 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1291 |
__intVal(w), __intVal(h), __intVal(d)); |
|
1974 | 1292 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1293 |
#ifdef COUNT_RESOURCES |
1344 | 1294 |
if (newBitmap) |
1295 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1296 |
#endif |
1344 | 1297 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1298 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1299 |
} |
1424 | 1300 |
%}. |
43 | 1301 |
self primitiveFailed. |
1302 |
^ nil |
|
0 | 1303 |
! |
1304 |
||
1468
9832c4017a70
added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
1305 |
createWindowFor:aView type:typeSymbol |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1306 |
origin:origin |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1307 |
extent:extent |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1308 |
minExtent:minExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1309 |
maxExtent:maxExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1310 |
borderWidth:bWidth |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1311 |
subViewOf:wsuperView |
1695
46d9101e4bee
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
1312 |
style:wStyle |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1313 |
inputOnly:winputOnly |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1314 |
label:wlabel |
1960 | 1315 |
owner:wowner |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1316 |
icon:wicon iconMask:wiconMask |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1317 |
iconView:wiconView |
46 | 1318 |
|
1319 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
|
1960 | 1320 |
bColorId wsuperViewId wiconId wiconMaskId windowId |
46 | 1321 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
150 | 1322 |
vBgForm deepForm preferredVisual preferredDepth| |
1323 |
||
1324 |
displayId isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1325 |
self primitiveFailed. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1326 |
^ nil |
150 | 1327 |
]. |
0 | 1328 |
|
46 | 1329 |
origin notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1330 |
xpos := origin x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1331 |
ypos := origin y. |
46 | 1332 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1333 |
xpos := ypos := 0. |
0 | 1334 |
]. |
46 | 1335 |
extent notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1336 |
wwidth := extent x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1337 |
wheight := extent y. |
46 | 1338 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1339 |
wwidth := wheight := 100. |
46 | 1340 |
]. |
1341 |
minExt notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1342 |
minWidth := minExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1343 |
minHeight := minExt y |
0 | 1344 |
]. |
46 | 1345 |
maxExt notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1346 |
maxWidth := maxExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1347 |
maxHeight := maxExt y |
46 | 1348 |
]. |
1349 |
||
0 | 1350 |
wsuperView notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1351 |
wsuperViewId := wsuperView id |
0 | 1352 |
]. |
1353 |
||
1354 |
wicon notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1355 |
wiconId := wicon id. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1356 |
wiconMask notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1357 |
wiconMaskId := wiconMask id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1358 |
] |
0 | 1359 |
]. |
1360 |
wiconView notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1361 |
wiconViewId := wiconView id |
0 | 1362 |
]. |
1363 |
weventMask := aView eventMask. |
|
1364 |
||
150 | 1365 |
preferredVisual := aView preferredVisual. |
1366 |
preferredDepth := aView preferredDepth. |
|
23 | 1367 |
|
1898 | 1368 |
%{ /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */ |
0 | 1369 |
Display *dpy = myDpy; |
555 | 1370 |
int screen = __intVal(__INST(screen)); |
0 | 1371 |
Visual visual; |
1372 |
XGCValues xgcv; |
|
1373 |
XSetWindowAttributes xswa; |
|
1374 |
XSizeHints sizehints; |
|
1375 |
XWMHints wmhints; |
|
46 | 1376 |
int bw, bd, bg; |
0 | 1377 |
Window newWindow, parentWindow; |
1378 |
char *windowName; |
|
1379 |
XFontStruct *f; |
|
1537 | 1380 |
Pixmap backPixmap = (Pixmap)0, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1381 |
iconBitmap = (Pixmap)0, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1382 |
iconMask = (Pixmap)0; |
0 | 1383 |
int flags = 0, depth, ioClass; |
1384 |
Window iconWindow; |
|
1385 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
1386 |
Atom WmQuitAppAtom; |
|
1387 |
Atom atoms[3]; |
|
1388 |
int atomCount = 0, isTopWindow = 0; |
|
1389 |
||
1390 |
sizehints.flags = 0; |
|
1391 |
sizehints.width = 100; |
|
1392 |
sizehints.height = 100; |
|
1393 |
sizehints.x = 0; |
|
1394 |
sizehints.y = 0; |
|
1395 |
||
97 | 1396 |
if (__bothSmallInteger(wwidth, wheight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1397 |
sizehints.flags |= PSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1398 |
sizehints.width = __intVal(wwidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1399 |
sizehints.height = __intVal(wheight); |
0 | 1400 |
} |
97 | 1401 |
if (__bothSmallInteger(xpos, ypos)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1402 |
sizehints.flags |= PPosition; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1403 |
sizehints.x = __intVal(xpos); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1404 |
sizehints.y = __intVal(ypos); |
0 | 1405 |
} |
97 | 1406 |
if (__bothSmallInteger(minWidth, minHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1407 |
sizehints.flags |= PMinSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1408 |
sizehints.min_width = __intVal(minWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1409 |
sizehints.min_height = __intVal(minHeight); |
0 | 1410 |
} |
97 | 1411 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1412 |
sizehints.flags |= PMaxSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1413 |
sizehints.max_width = __intVal(maxWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1414 |
sizehints.max_height = __intVal(maxHeight); |
0 | 1415 |
} |
1416 |
||
37 | 1417 |
bg = WhitePixel(dpy, screen); |
0 | 1418 |
|
97 | 1419 |
if (__isSmallInteger(bWidth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1420 |
bw = __intVal(bWidth); |
46 | 1421 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1422 |
bw = 0; |
0 | 1423 |
} |
1424 |
||
72 | 1425 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1426 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1427 |
if (__isExternalAddress(wsuperViewId)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1428 |
parentWindow = _WindowVal(wsuperViewId); |
0 | 1429 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1430 |
parentWindow = RootWindow(dpy, screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1431 |
isTopWindow = 1; |
0 | 1432 |
} |
1433 |
||
1695
46d9101e4bee
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
1434 |
if (wStyle == @symbol(popUp)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1435 |
xswa.override_redirect = 1; |
0 | 1436 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1437 |
xswa.override_redirect = 0; |
0 | 1438 |
|
1439 |
if (winputOnly == true) |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1440 |
ioClass = InputOnly; |
0 | 1441 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1442 |
ioClass = InputOutput; |
0 | 1443 |
|
97 | 1444 |
if (__isSmallInteger(weventMask)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1445 |
xswa.event_mask = __intVal(weventMask); |
0 | 1446 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1447 |
xswa.event_mask = 0; |
0 | 1448 |
} |
1449 |
||
1450 |
if (ioClass == InputOnly) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1451 |
bw = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1452 |
depth = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1453 |
flags |= CWEventMask; |
0 | 1454 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1455 |
depth = DefaultDepth(dpy,screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1456 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1457 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1458 |
if (backPixmap != (Pixmap)0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1459 |
xswa.background_pixmap = backPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1460 |
flags |= CWBackPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1461 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1462 |
xswa.background_pixel = bg; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1463 |
flags |= CWBackPixel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1464 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1465 |
xswa.border_pixel = bd; |
0 | 1466 |
} |
23 | 1467 |
|
0 | 1468 |
visual.visualid = CopyFromParent; |
150 | 1469 |
if (__isSmallInteger(preferredDepth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1470 |
depth = __intVal(preferredDepth); |
23 | 1471 |
} |
54 | 1472 |
|
1473 |
BEGIN_INTERRUPTSBLOCKED |
|
150 | 1474 |
if (preferredVisual != nil) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1475 |
XVisualInfo vi; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1476 |
int cls; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1477 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1478 |
if (preferredVisual == @symbol(StaticGray)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1479 |
cls = StaticGray; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1480 |
else if (preferredVisual == @symbol(GrayScale)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1481 |
cls = GrayScale; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1482 |
else if (preferredVisual == @symbol(StaticColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1483 |
cls = StaticColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1484 |
else if (preferredVisual == @symbol(PseudoColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1485 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1486 |
else if (preferredVisual == @symbol(TrueColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1487 |
cls = TrueColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1488 |
else if (preferredVisual == @symbol(DirectColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1489 |
cls = DirectColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1490 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1491 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1492 |
|
1974 | 1493 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1494 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1495 |
visual.visualid = vi.visualid; |
163 | 1496 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1497 |
printf("visualId=%x\n", vi.visualid); |
163 | 1498 |
*/ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1499 |
} |
1974 | 1500 |
LEAVE_XLIB(); |
1501 |
} |
|
1502 |
||
1503 |
ENTER_XLIB(); |
|
0 | 1504 |
newWindow = XCreateWindow(dpy, parentWindow, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1505 |
sizehints.x, sizehints.y, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1506 |
sizehints.width, sizehints.height, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1507 |
bw, depth, ioClass, &visual, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1508 |
flags, &xswa); |
1974 | 1509 |
LEAVE_XLIB(); |
54 | 1510 |
END_INTERRUPTSBLOCKED |
0 | 1511 |
|
1512 |
if (! newWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1513 |
RETURN ( nil ); |
0 | 1514 |
} |
1515 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1516 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1517 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1518 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1519 |
|
54 | 1520 |
BEGIN_INTERRUPTSBLOCKED |
0 | 1521 |
|
1522 |
/* |
|
1523 |
* define its icon and name |
|
1524 |
* (only makes sense for topWindows) |
|
1525 |
*/ |
|
1526 |
if (isTopWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1527 |
if (__isExternalAddress(wiconId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1528 |
iconBitmap = _PixmapVal(wiconId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1529 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1530 |
iconBitmap = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1531 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1532 |
if (__isExternalAddress(wiconMaskId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1533 |
iconMask = _PixmapVal(wiconMaskId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1534 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1535 |
iconMask = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1536 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1537 |
if (__isExternalAddress(wiconViewId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1538 |
iconWindow = _WindowVal(wiconViewId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1539 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1540 |
iconWindow = (Window)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1541 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1542 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
1831 | 1543 |
windowName = (char *) __stringVal(wlabel); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1544 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1545 |
windowName = ""; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1546 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1547 |
if (iconBitmap || windowName) { |
1974 | 1548 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1549 |
XSetStandardProperties(dpy, newWindow, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1550 |
windowName, windowName, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1551 |
iconBitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1552 |
0, 0, &sizehints); |
1974 | 1553 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1554 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1555 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1556 |
wmhints.flags = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1557 |
if (iconBitmap) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1558 |
wmhints.flags |= IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1559 |
wmhints.icon_pixmap = iconBitmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1560 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1561 |
if (iconMask) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1562 |
wmhints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1563 |
wmhints.icon_mask = iconMask; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1564 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1565 |
if (iconWindow) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1566 |
wmhints.flags |= IconWindowHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1567 |
wmhints.icon_window = iconWindow; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1568 |
} |
0 | 1569 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1570 |
wmhints.flags |= InputHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1571 |
wmhints.input = True; |
0 | 1572 |
*/ |
1974 | 1573 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1574 |
XSetWMHints(dpy, newWindow, &wmhints); |
1974 | 1575 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1576 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1577 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1578 |
* tell window manager to not kill us but send an event instead |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1579 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1580 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1581 |
* get atoms first (if not already known) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1582 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1583 |
if (__INST(protocolsAtom) == nil) { |
1974 | 1584 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1585 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1586 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
0 | 1587 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1588 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1589 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
0 | 1590 |
#endif |
1591 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1592 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1593 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
0 | 1594 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1595 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1596 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
1974 | 1597 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1598 |
} else { |
0 | 1599 |
#ifdef USE_QUIT_APP_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1600 |
WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); |
0 | 1601 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1602 |
WmQuitAppAtom = 0; |
0 | 1603 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1604 |
WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1605 |
WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); |
0 | 1606 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1607 |
WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); |
0 | 1608 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1609 |
WmSaveYourselfAtom = 0; |
0 | 1610 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1611 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1612 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1613 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
0 | 1614 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1615 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1616 |
#endif |
1617 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1618 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1619 |
#endif |
1974 | 1620 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1621 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1622 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
1974 | 1623 |
LEAVE_XLIB(); |
0 | 1624 |
} |
1625 |
||
54 | 1626 |
END_INTERRUPTSBLOCKED |
1627 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1628 |
windowId = __MKEXTERNALADDRESS(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1629 |
%}. |
0 | 1630 |
self addKnownView:aView withId:windowId. |
1631 |
^ windowId |
|
1632 |
! |
|
1633 |
||
1634 |
destroyGC:aGCId |
|
1635 |
||
1636 |
%{ /* NOCONTEXT */ |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1637 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1638 |
if (! ISCONNECTED) { |
1344 | 1639 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1640 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1641 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1642 |
if (__isExternalAddress(aGCId)) { |
1344 | 1643 |
GC gc = _GCVal(aGCId); |
1644 |
||
1645 |
if (gc) { |
|
1646 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1647 |
ENTER_XLIB(); |
1344 | 1648 |
XFreeGC(myDpy, gc); |
1974 | 1649 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1650 |
#ifdef COUNT_RESOURCES |
1344 | 1651 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1652 |
#endif |
1344 | 1653 |
END_INTERRUPTSBLOCKED |
1654 |
} |
|
1655 |
RETURN ( self ); |
|
0 | 1656 |
} |
118 | 1657 |
%}. |
0 | 1658 |
self primitiveFailed |
1659 |
! |
|
1660 |
||
295 | 1661 |
destroyPixmap:aDrawableId |
0 | 1662 |
|
1663 |
%{ /* NOCONTEXT */ |
|
1664 |
||
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1665 |
if (! ISCONNECTED) { |
1344 | 1666 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1667 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1668 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1669 |
if (__isExternalAddress(aDrawableId)) { |
1344 | 1670 |
Pixmap pix = _PixmapVal(aDrawableId); |
1671 |
||
1672 |
if (pix) { |
|
1673 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1674 |
ENTER_XLIB(); |
1344 | 1675 |
XFreePixmap(myDpy, pix); |
1974 | 1676 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1677 |
#ifdef COUNT_RESOURCES |
1344 | 1678 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1679 |
#endif |
1344 | 1680 |
END_INTERRUPTSBLOCKED |
1681 |
} |
|
1682 |
RETURN ( self ); |
|
0 | 1683 |
} |
118 | 1684 |
%}. |
295 | 1685 |
self primitiveFailed |
1686 |
! |
|
1687 |
||
1688 |
destroyView:aView withId:aWindowId |
|
1689 |
%{ |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1690 |
if (! ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1691 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1692 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1693 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1694 |
if (__isExternalAddress(aWindowId)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1695 |
Window win = _WindowVal(aWindowId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1696 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1697 |
if (win) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1698 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 1699 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1700 |
XDestroyWindow(myDpy, win); |
1974 | 1701 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1702 |
#ifdef COUNT_RESOURCES |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1703 |
__cnt_view--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1704 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1705 |
END_INTERRUPTSBLOCKED |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1706 |
} |
295 | 1707 |
} |
1708 |
%}. |
|
1480
7fd8dff4cfc3
pass view + id to removeKnownView
Claus Gittinger <cg@exept.de>
parents:
1468
diff
changeset
|
1709 |
self removeKnownView:aView withId:aWindowId |
0 | 1710 |
! |
1711 |
||
1712 |
dpsContextFor:aDrawableId and:aGCId |
|
1713 |
||
1714 |
%{ /* NOCONTEXT */ |
|
1715 |
#ifdef XXDPS |
|
555 | 1716 |
int screen = __intVal(__INST(screen)); |
0 | 1717 |
DPSContext dps; |
1718 |
int height; |
|
1719 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1720 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1721 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1722 |
&& ISCONNECTED) { |
1344 | 1723 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 1724 |
ENTER_XLIB(); |
1344 | 1725 |
dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
1726 |
_GCVal(aGCId), |
|
1727 |
0, height, 0, colormap, NULL, 0, |
|
1728 |
XDPSDefaultTextBackstop, |
|
1729 |
XDPSDefaultErrorProc, |
|
1730 |
NULL); |
|
1974 | 1731 |
LEAVE_XLIB(); |
1344 | 1732 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1733 |
RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); |
0 | 1734 |
} |
1735 |
#endif |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1736 |
%}. |
43 | 1737 |
self primitiveFailed. |
1738 |
^ nil |
|
295 | 1739 |
! |
1740 |
||
1741 |
gcFor:aDrawableId |
|
132 | 1742 |
|
1743 |
%{ /* NOCONTEXT */ |
|
555 | 1744 |
int screen = __intVal(__INST(screen)); |
295 | 1745 |
GC gc; |
1746 |
||
1747 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
1344 | 1748 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 1749 |
ENTER_XLIB(); |
1344 | 1750 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1751 |
0L, (XGCValues *)0); |
|
1974 | 1752 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1753 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1754 |
#ifdef COUNT_RESOURCES |
1344 | 1755 |
if (gc) |
1756 |
__cnt_gc++; |
|
1089 | 1757 |
#endif |
1758 |
||
1344 | 1759 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1760 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1761 |
} |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1762 |
%}. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1763 |
self primitiveFailed. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1764 |
^ nil |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1765 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1766 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1767 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1768 |
"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
|
1769 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1770 |
%{ /* NOCONTEXT */ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1771 |
int screen = __intVal(__INST(screen)); |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1772 |
GC gc; |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1773 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1774 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
1344 | 1775 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 1776 |
ENTER_XLIB(); |
1344 | 1777 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1778 |
0L, (XGCValues *)0); |
|
1974 | 1779 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1780 |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1781 |
#ifdef COUNT_RESOURCES |
1344 | 1782 |
if (gc) |
1783 |
__cnt_gc++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1784 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1785 |
|
1344 | 1786 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1787 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
200 | 1788 |
} |
1789 |
%}. |
|
1790 |
self primitiveFailed. |
|
1791 |
^ nil |
|
295 | 1792 |
! |
1793 |
||
1794 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 1795 |
|
1796 |
%{ /* UNLIMITEDSTACK */ |
|
1797 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1798 |
Display *dpy; |
555 | 1799 |
int screen = __intVal(__INST(screen)); |
295 | 1800 |
Pixmap newBitmap; |
1801 |
unsigned int b_width, b_height; |
|
1802 |
REGISTER unsigned char *cp; |
|
1803 |
REGISTER unsigned char *pBits; |
|
1804 |
unsigned char *b_bits, *allocatedBits; |
|
1805 |
int index, row; |
|
1806 |
REGISTER int col; |
|
1807 |
unsigned bits; |
|
1808 |
static char reverseBitTable[256]; |
|
1809 |
static firstCall = 1; |
|
1810 |
int nBytes; |
|
1811 |
unsigned char fastBits[10000]; |
|
1812 |
OBJ num, *op; |
|
1813 |
int bytesPerRow; |
|
1814 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1815 |
if (! ISCONNECTED) { |
1344 | 1816 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1817 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1818 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1819 |
dpy = myDpy; |
295 | 1820 |
if (firstCall) { |
1344 | 1821 |
for (index=0; index < 256; index++) { |
1822 |
reverseBitTable[index] = 0; |
|
1823 |
if (index & 128) reverseBitTable[index] |= 1; |
|
1824 |
if (index & 64) reverseBitTable[index] |= 2; |
|
1825 |
if (index & 32) reverseBitTable[index] |= 4; |
|
1826 |
if (index & 16) reverseBitTable[index] |= 8; |
|
1827 |
if (index & 8) reverseBitTable[index] |= 16; |
|
1828 |
if (index & 4) reverseBitTable[index] |= 32; |
|
1829 |
if (index & 2) reverseBitTable[index] |= 64; |
|
1830 |
if (index & 1) reverseBitTable[index] |= 128; |
|
1831 |
} |
|
1832 |
firstCall = 0; |
|
295 | 1833 |
} |
1834 |
||
1835 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
1344 | 1836 |
newBitmap = (Pixmap)0; |
1837 |
b_width = __intVal(w); |
|
1838 |
b_height = __intVal(h); |
|
1839 |
bytesPerRow = (b_width + 7) / 8; |
|
1840 |
nBytes = b_height * bytesPerRow; |
|
1841 |
if (nBytes < sizeof(fastBits)) { |
|
1842 |
cp = b_bits = fastBits; |
|
1843 |
allocatedBits = 0; |
|
1844 |
} else { |
|
1845 |
cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
|
1846 |
if (! cp) goto fail; |
|
1847 |
} |
|
1848 |
||
1849 |
if (__qClass(anArray) == @global(Array)) { |
|
1850 |
index = 1; |
|
1851 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
|
1852 |
for (row = b_height; row; row--) { |
|
1853 |
for (col = bytesPerRow; col; col--) { |
|
1854 |
num = *op++; |
|
1855 |
if (! __isSmallInteger(num)) goto fail; |
|
1856 |
bits = __intVal(num); |
|
1857 |
*cp++ = reverseBitTable[bits]; |
|
1858 |
} |
|
1859 |
} |
|
1860 |
} else { |
|
1861 |
if (__qClass(anArray) == @global(ByteArray)) { |
|
1862 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
|
1863 |
for (col = b_height*bytesPerRow; col; col--) { |
|
1864 |
*cp++ = reverseBitTable[*pBits++]; |
|
1865 |
} |
|
1866 |
} else { |
|
1867 |
goto fail; |
|
1868 |
} |
|
1869 |
} |
|
1870 |
||
1871 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1872 |
ENTER_XLIB(); |
1344 | 1873 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
1874 |
(char *)b_bits, |
|
1875 |
b_width, b_height); |
|
1974 | 1876 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1877 |
#ifdef COUNT_RESOURCES |
1344 | 1878 |
if (newBitmap) |
1879 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1880 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1881 |
|
1344 | 1882 |
END_INTERRUPTSBLOCKED |
295 | 1883 |
fail: ; |
1344 | 1884 |
if (allocatedBits) |
1885 |
free(allocatedBits); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1886 |
RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1887 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1888 |
%}. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1889 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1890 |
^ nil |
295 | 1891 |
! |
1892 |
||
1893 |
realRootWindowFor:aView |
|
1894 |
"the name of this method is historic; |
|
1895 |
- it will vanish" |
|
1896 |
||
1897 |
|id| |
|
1898 |
||
1899 |
id := self realRootWindowId. |
|
1900 |
self addKnownView:aView withId:id. |
|
1901 |
^ id |
|
1902 |
! |
|
1903 |
||
1904 |
realRootWindowId |
|
1905 |
"return the id of the real root window. |
|
1906 |
This may not be the window you see as background, |
|
1907 |
since some window managers install a virtual root window on top |
|
1908 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
1909 |
care of any virtual root." |
|
0 | 1910 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
1911 |
%{ |
555 | 1912 |
int screen = __intVal(__INST(screen)); |
295 | 1913 |
Window root; |
1914 |
OBJ id; |
|
1915 |
||
555 | 1916 |
if (__INST(rootId) != nil) { |
1344 | 1917 |
RETURN (__INST(rootId)); |
295 | 1918 |
} |
0 | 1919 |
|
150 | 1920 |
if (ISCONNECTED) { |
1344 | 1921 |
root = RootWindow(myDpy, screen); |
1922 |
if (! root) { |
|
1923 |
id = nil; |
|
1924 |
} else { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1925 |
__INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id); |
1344 | 1926 |
} |
1927 |
RETURN (id); |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1928 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1929 |
%}. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1930 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1931 |
^ nil |
295 | 1932 |
! |
1933 |
||
1934 |
rootWindowFor:aView |
|
1935 |
|id| |
|
1936 |
||
1937 |
id := self rootWindowId. |
|
1938 |
self addKnownView:aView withId:id. |
|
0 | 1939 |
^ id |
1940 |
! |
|
1941 |
||
295 | 1942 |
rootWindowId |
1943 |
"return the id of the root window. |
|
1944 |
This is the window you see as background, |
|
1945 |
however, it may or may not be the real physical root window, |
|
1946 |
since some window managers install a virtual root window on top |
|
1947 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 1948 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
1949 |
%{ |
555 | 1950 |
int screen = __intVal(__INST(screen)); |
295 | 1951 |
Window rootWin, vRootWin; |
1952 |
OBJ id; |
|
1953 |
||
555 | 1954 |
if (__INST(virtualRootId) != nil) { |
1344 | 1955 |
RETURN (__INST(virtualRootId)); |
295 | 1956 |
} |
0 | 1957 |
|
169 | 1958 |
if (ISCONNECTED) { |
1344 | 1959 |
vRootWin = rootWin = RootWindow(myDpy, screen); |
295 | 1960 |
#ifndef IRIS |
1344 | 1961 |
BEGIN_INTERRUPTSBLOCKED |
1962 |
/* |
|
1963 |
* on IRIS, this creates a badwindow error - why ? |
|
1964 |
* children contains a funny window (000034) |
|
1965 |
*/ |
|
1966 |
||
1967 |
/* |
|
1968 |
* care for virtual root windows (tvtwm & friends) |
|
1969 |
*/ |
|
1970 |
{ |
|
1971 |
Atom vRootAtom = None; |
|
1972 |
int i; |
|
1973 |
Window rootReturn, parentReturn; |
|
1974 |
Window* children = (Window *)0; |
|
1975 |
unsigned int numChildren; |
|
1976 |
||
1977 |
if (XQueryTree(myDpy, rootWin, |
|
1978 |
&rootReturn, &parentReturn, |
|
1979 |
&children, &numChildren)) { |
|
1980 |
vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True ); |
|
1981 |
if (vRootAtom != None) { |
|
1982 |
for (i=0; i < numChildren; i++) { |
|
1983 |
Atom actual_type; |
|
1984 |
int actual_format; |
|
1985 |
unsigned long nitems, bytesafter; |
|
1986 |
Window* newRoot = (Window*) 0; |
|
1987 |
||
1988 |
if (children[i]) { |
|
1989 |
if (XGetWindowProperty(myDpy, children[i], vRootAtom, |
|
1990 |
0L, 1L, False, XA_WINDOW, |
|
1991 |
&actual_type, &actual_format, |
|
1992 |
&nitems, &bytesafter, |
|
1993 |
(unsigned char**) &newRoot |
|
1994 |
) == Success && newRoot) { |
|
1995 |
vRootWin = *newRoot; |
|
1996 |
XFree(newRoot); /* XXX */ |
|
1997 |
break; |
|
1998 |
} |
|
1999 |
} |
|
2000 |
} |
|
2001 |
} |
|
2002 |
if (children) XFree( children ); |
|
2003 |
} |
|
2004 |
} |
|
2005 |
END_INTERRUPTSBLOCKED |
|
295 | 2006 |
#endif |
2007 |
} |
|
2008 |
||
2009 |
/* cannot happen */ |
|
2010 |
if (! vRootWin) { |
|
1344 | 2011 |
vRootWin = rootWin; |
2012 |
if (! rootWin) { |
|
2013 |
RETURN ( nil ); |
|
2014 |
} |
|
295 | 2015 |
} |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2016 |
__INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2017 |
__INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id); |
295 | 2018 |
RETURN ( id ); |
63 | 2019 |
%} |
0 | 2020 |
! ! |
2021 |
||
2022 |
!XWorkstation methodsFor:'color stuff'! |
|
2023 |
||
295 | 2024 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2025 |
"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
|
2026 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2027 |
|
2028 |
%{ /* NOCONTEXT */ |
|
2029 |
||
555 | 2030 |
int screen = __intVal(__INST(screen)); |
295 | 2031 |
XColor color; |
2032 |
unsigned long dummy; |
|
2033 |
Status ok; |
|
2034 |
||
1209 | 2035 |
if (ISCONNECTED) { |
1344 | 2036 |
Display *dpy = myDpy; |
2037 |
||
2038 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2039 |
ENTER_XLIB(); |
1344 | 2040 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
2041 |
&dummy, 0, &color.pixel, 1); |
|
1974 | 2042 |
LEAVE_XLIB(); |
1344 | 2043 |
END_INTERRUPTSBLOCKED |
2044 |
if (ok) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2045 |
#ifdef COUNT_RESOURCES |
1344 | 2046 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2047 |
#endif |
1344 | 2048 |
RETURN ( __MKSMALLINT(color.pixel) ); |
2049 |
} |
|
0 | 2050 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2051 |
%}. |
43 | 2052 |
^ nil |
0 | 2053 |
! |
2054 |
||
2055 |
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
|
2056 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 2057 |
Dont use this method, colornames are mostly X specific" |
2058 |
||
2059 |
%{ /* NOCONTEXT */ |
|
2060 |
||
2061 |
char *colorname; |
|
2062 |
XColor scolor, ecolor; |
|
555 | 2063 |
int screen = __intVal(__INST(screen)); |
850 | 2064 |
int id; |
54 | 2065 |
Status ok; |
0 | 2066 |
|
150 | 2067 |
if (ISCONNECTED) { |
1344 | 2068 |
Display *dpy = myDpy; |
2069 |
||
2070 |
if (__isString(aString) || __isSymbol(aString)) { |
|
1831 | 2071 |
colorname = (char *) __stringVal(aString); |
1344 | 2072 |
|
2073 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2074 |
ENTER_XLIB(); |
1344 | 2075 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
1974 | 2076 |
LEAVE_XLIB(); |
1344 | 2077 |
if (ok) { |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
2078 |
#ifdef QUICK_TRUE_COLORS |
1344 | 2079 |
if (__INST(visualType) == @symbol(TrueColor)) { |
2080 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
2081 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
2082 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
2083 |
RETURN ( __MKSMALLINT(id) ); |
|
2084 |
} |
|
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
2085 |
#endif |
1974 | 2086 |
ENTER_XLIB(); |
1344 | 2087 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
1974 | 2088 |
LEAVE_XLIB(); |
1344 | 2089 |
} |
2090 |
END_INTERRUPTSBLOCKED |
|
2091 |
if (! ok) { |
|
2092 |
RETURN ( nil ); |
|
2093 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2094 |
#ifdef COUNT_RESOURCES |
1344 | 2095 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2096 |
#endif |
1344 | 2097 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
2098 |
} |
|
0 | 2099 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2100 |
%}. |
43 | 2101 |
self primitiveFailed. |
2102 |
^ nil |
|
0 | 2103 |
! |
2104 |
||
295 | 2105 |
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
|
2106 |
"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
|
2107 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
295 | 2108 |
|
2109 |
|r g b| |
|
2110 |
||
2111 |
r := self percentToXColorValue:redVal. |
|
2112 |
g := self percentToXColorValue:greenVal. |
|
2113 |
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
|
2114 |
^ 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
|
2115 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2116 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2117 |
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
|
2118 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
295 | 2119 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2120 |
Display *dpy; |
295 | 2121 |
XColor ecolor; |
555 | 2122 |
int screen = __intVal(__INST(screen)); |
295 | 2123 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2124 |
int id; |
295 | 2125 |
|
2126 |
if (__bothSmallInteger(r, g) |
|
2127 |
&& __isSmallInteger(b) |
|
2128 |
&& ISCONNECTED) { |
|
1344 | 2129 |
ecolor.red = __intVal(r); |
2130 |
ecolor.green= __intVal(g); |
|
2131 |
ecolor.blue = __intVal(b); |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2132 |
#ifdef QUICK_TRUE_COLORS |
1344 | 2133 |
if (__INST(visualType) == @symbol(TrueColor)) { |
2134 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
2135 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
2136 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
2137 |
RETURN ( __MKSMALLINT(id) ); |
|
2138 |
} |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2139 |
#endif |
1344 | 2140 |
dpy = myDpy; |
2141 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2142 |
ENTER_XLIB(); |
1344 | 2143 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
1974 | 2144 |
LEAVE_XLIB(); |
1344 | 2145 |
END_INTERRUPTSBLOCKED |
2146 |
if (! ok) { |
|
2147 |
RETURN ( nil ); |
|
2148 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2149 |
#ifdef COUNT_RESOURCES |
1344 | 2150 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2151 |
#endif |
1344 | 2152 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
295 | 2153 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2154 |
%}. |
295 | 2155 |
self primitiveFailed. |
2156 |
^ nil |
|
2157 |
! |
|
2158 |
||
2159 |
freeColor:colorIndex |
|
2160 |
"free a display color when its no longer needed" |
|
0 | 2161 |
|
2162 |
%{ /* NOCONTEXT */ |
|
2163 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2164 |
Display *dpy; |
295 | 2165 |
unsigned long color; |
555 | 2166 |
int screen = __intVal(__INST(screen)); |
295 | 2167 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2168 |
#ifdef QUICK_TRUE_COLORS |
555 | 2169 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1344 | 2170 |
/* no need to do anything on TrueColor displays ... */ |
2171 |
RETURN (self); |
|
295 | 2172 |
} |
2173 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2174 |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2175 |
if (! ISCONNECTED) { |
1344 | 2176 |
RETURN (self); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2177 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2178 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2179 |
if (__isSmallInteger(colorIndex)) { |
1344 | 2180 |
dpy = myDpy; |
2181 |
color = (long) __intVal(colorIndex); |
|
2182 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2183 |
ENTER_XLIB(); |
1344 | 2184 |
XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
1974 | 2185 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2186 |
#ifdef COUNT_RESOURCES |
1344 | 2187 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2188 |
#endif |
1344 | 2189 |
END_INTERRUPTSBLOCKED |
2190 |
RETURN ( self ); |
|
0 | 2191 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2192 |
%}. |
295 | 2193 |
self primitiveFailed |
2194 |
! |
|
2195 |
||
2196 |
getRGBFrom:index into:aBlock |
|
2197 |
"get rgb components (0..100) of color in map at:index, |
|
2198 |
and evaluate the 3-arg block, aBlock with them" |
|
2199 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2200 |
|val| |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2201 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2202 |
self getScaledRGBFrom:index into:[:r :g :b | |
1344 | 2203 |
val := aBlock |
2204 |
value:(r * 100.0 / 16rFFFF) |
|
2205 |
value:(g * 100.0 / 16rFFFF) |
|
2206 |
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
|
2207 |
]. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2208 |
^ val |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2209 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2210 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2211 |
getRGBFromName:colorName into:aBlock |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2212 |
"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
|
2213 |
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
|
2214 |
|val| |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2215 |
|
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2216 |
self getScaledRGBFromName:colorName into:[:r :g :b | |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2217 |
r isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2218 |
^ nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2219 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2220 |
val := aBlock |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2221 |
value:(r * 100.0 / 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2222 |
value:(g * 100.0 / 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2223 |
value:(b * 100.0 / 16rFFFF) |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2224 |
]. |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2225 |
^ val |
1056 | 2226 |
|
1430 | 2227 |
"Modified: 6.3.1997 / 02:36:43 / cg" |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2228 |
! |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2229 |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2230 |
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
|
2231 |
"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
|
2232 |
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
|
2233 |
|
295 | 2234 |
|r g b| |
2235 |
%{ |
|
555 | 2236 |
int screen = __intVal(__INST(screen)); |
295 | 2237 |
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
|
2238 |
int sr, sg, sb; |
295 | 2239 |
int bits, scale, shift; |
2240 |
||
1209 | 2241 |
if (ISCONNECTED |
2242 |
&& __isSmallInteger(index)) { |
|
1344 | 2243 |
Display *dpy = myDpy; |
2244 |
||
2245 |
color.pixel = __intVal(index); |
|
2246 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2247 |
ENTER_XLIB(); |
1344 | 2248 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
1974 | 2249 |
LEAVE_XLIB(); |
1344 | 2250 |
END_INTERRUPTSBLOCKED |
2251 |
||
2252 |
/* |
|
2253 |
* have to compensate for an error in X ?, which does not scale |
|
2254 |
* colors correctly if lesser than 16bits are valid in a color, |
|
2255 |
* (for example, color white on a 4bitsPerRGB server will return |
|
2256 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
|
2257 |
*/ |
|
2258 |
bits = __intVal(__INST(bitsPerRGB)); |
|
2259 |
scale = (1<<bits) - 1; |
|
2260 |
shift = 16 - bits; |
|
2261 |
||
2262 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
|
2263 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
|
2264 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
|
2265 |
r = __MKSMALLINT(sr); |
|
2266 |
g = __MKSMALLINT(sg); |
|
2267 |
b = __MKSMALLINT(sb); |
|
295 | 2268 |
} |
2269 |
%}. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2270 |
^ aBlock value:r value:g value:b |
295 | 2271 |
! |
2272 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2273 |
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
|
2274 |
"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
|
2275 |
and evaluate the 3-arg block, aBlock with them" |
295 | 2276 |
|
2277 |
|r g b| |
|
2278 |
||
2279 |
displayId isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2280 |
self pimitiveFailed. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2281 |
^ nil |
295 | 2282 |
]. |
2283 |
%{ |
|
555 | 2284 |
int screen = __intVal(__INST(screen)); |
295 | 2285 |
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
|
2286 |
int sr, sg, sb; |
295 | 2287 |
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
|
2288 |
int bits, scale, shift; |
295 | 2289 |
|
1209 | 2290 |
if (ISCONNECTED |
2291 |
&& __isString(colorName) || __isSymbol(colorName)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2292 |
Display *dpy = myDpy; |
1209 | 2293 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2294 |
BEGIN_INTERRUPTSBLOCKED |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2295 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
1831 | 2296 |
(char *) __stringVal(colorName), &color)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2297 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2298 |
* have to compensate for an error in X ?, which does not scale |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2299 |
* colors correctly if lesser than 16bits are valid in a color, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2300 |
* (for example, color white on a 4bitsPerRGB server will return |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2301 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2302 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2303 |
bits = __intVal(__INST(bitsPerRGB)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2304 |
scale = (1<<bits) - 1; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2305 |
shift = 16 - bits; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2306 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2307 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2308 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2309 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2310 |
r = __MKSMALLINT(sr); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2311 |
g = __MKSMALLINT(sg); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2312 |
b = __MKSMALLINT(sb); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2313 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2314 |
END_INTERRUPTSBLOCKED |
295 | 2315 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2316 |
%}. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2317 |
^ aBlock value:r value:g value:b |
295 | 2318 |
! |
2319 |
||
2320 |
listOfAvailableColors |
|
2321 |
"return a list of all available colornames. |
|
2322 |
This should not be used, since colornames are very |
|
2323 |
display-specific (here X-specific)." |
|
2324 |
||
2325 |
|aStream list line index colorName| |
|
2326 |
||
2327 |
aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'. |
|
2328 |
aStream isNil ifTrue:[^ nil]. |
|
2329 |
list := OrderedCollection new. |
|
2330 |
[aStream atEnd] whileFalse:[ |
|
1344 | 2331 |
line := aStream nextLine. |
2332 |
line notNil ifTrue:[ |
|
2333 |
"skip the r/g/b numbers" |
|
2334 |
index := 1. |
|
2335 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2336 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2337 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2338 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2339 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2340 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2341 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2342 |
colorName := line copyFrom:index. |
|
2343 |
((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
|
2344 |
list add:colorName |
|
2345 |
] |
|
2346 |
] |
|
295 | 2347 |
]. |
2348 |
aStream close. |
|
2349 |
^ list sort |
|
1047 | 2350 |
|
2351 |
" |
|
2352 |
Screen current listOfAvailableColors |
|
2353 |
" |
|
2354 |
||
2355 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2356 |
! |
2357 |
||
2358 |
percentToXColorValue:aPercentage |
|
2359 |
"given a color-component value in percent (0..100), return the corresponding |
|
2360 |
x-component value (0..65k) as an integer" |
|
2361 |
||
2362 |
%{ /* NOCONTEXT */ |
|
2363 |
||
2364 |
if (__isSmallInteger(aPercentage)) { |
|
1344 | 2365 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2366 |
} |
2367 |
if (__isFloat(aPercentage)) { |
|
1344 | 2368 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2369 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2370 |
%}. |
295 | 2371 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2372 |
! |
2373 |
||
892 | 2374 |
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
|
2375 |
"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
|
2376 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2377 |
|
2378 |
%{ /* NOCONTEXT */ |
|
2379 |
||
2380 |
char *colorname; |
|
2381 |
XColor color; |
|
555 | 2382 |
int screen = __intVal(__INST(screen)); |
0 | 2383 |
int r, g, b; |
2384 |
int ok = 1; |
|
2385 |
||
892 | 2386 |
if (__isSmallInteger(sred)) |
1344 | 2387 |
r = __intVal(sred); |
0 | 2388 |
else ok = 0; |
2389 |
||
892 | 2390 |
if (__isSmallInteger(sgreen)) |
1344 | 2391 |
g = __intVal(sgreen); |
0 | 2392 |
else ok = 0; |
2393 |
||
892 | 2394 |
if (__isSmallInteger(sblue)) |
1344 | 2395 |
b = __intVal(sblue); |
0 | 2396 |
else ok = 0; |
2397 |
||
1209 | 2398 |
if (ISCONNECTED |
2399 |
&& __isSmallInteger(index) && ok) { |
|
1344 | 2400 |
Display *dpy = myDpy; |
2401 |
||
2402 |
color.pixel = __intVal(index); |
|
2403 |
color.red = r; |
|
2404 |
color.green = g; |
|
2405 |
color.blue = b; |
|
2406 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2407 |
||
2408 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2409 |
ENTER_XLIB(); |
1344 | 2410 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
1974 | 2411 |
LEAVE_XLIB(); |
1344 | 2412 |
END_INTERRUPTSBLOCKED |
2413 |
RETURN ( self ); |
|
0 | 2414 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2415 |
%}. |
0 | 2416 |
self primitiveFailed |
295 | 2417 |
! ! |
2418 |
||
2419 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2420 |
||
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2421 |
builtInCursorShapes |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2422 |
"return a collection of standard cursor names. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2423 |
Those are built into the XServer and need not be created as |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2424 |
user cursors. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2425 |
(actually, there are more than those below ...)" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2426 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2427 |
"/ if you add something here, also add to #shapeNumberFromCursor ... |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2428 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2429 |
^ #( |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2430 |
#upLeftArrow "/ XC_top_left_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2431 |
#upRightHand "/ XC_hand1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2432 |
#upDownArrow "/ XC_sb_v_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2433 |
#leftRightArrow "/ XC_sb_h_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2434 |
#upLimitArrow "/ XC_top_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2435 |
#downLimitArrow "/ XC_bottom_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2436 |
#leftLimitArrow "/ XC_left_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2437 |
#rightLimitArrow "/ XC_right_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2438 |
#text "/ XC_xterm |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2439 |
#upRightArrow "/ XC_draft_large |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2440 |
#leftHand "/ XC_hand2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2441 |
#questionMark "/ XC_question_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2442 |
#cross "/ XC_X_cursor |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2443 |
#wait "/ XC_watch |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2444 |
#crossHair "/ XC_tcross |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2445 |
#origin "/ XC_ul_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2446 |
#topLeft "/ XC_ul_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2447 |
#corner "/ XC_lr_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2448 |
#bottomRight "/ XC_lr_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2449 |
#topRight "/ XC_ur_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2450 |
#bottomLeft "/ XC_ll_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2451 |
#square "/ XC_dotbox |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2452 |
#fourWay "/ XC_fleur |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2453 |
#crossCursor "/ XC_X_cursor |
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2454 |
) |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2455 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2456 |
"Created: 8.4.1997 / 10:12:30 / cg" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2457 |
"Modified: 8.4.1997 / 10:31:46 / cg" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2458 |
! |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2459 |
|
295 | 2460 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
2461 |
"change a cursors colors" |
|
2462 |
||
2463 |
|fgR fgG fgB bgR bgG bgB| |
|
2464 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2465 |
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
|
2466 |
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
|
2467 |
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
|
2468 |
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
|
2469 |
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
|
2470 |
bgB := bgColor scaledBlue. |
0 | 2471 |
%{ |
295 | 2472 |
XColor fgcolor, bgcolor; |
2473 |
||
1209 | 2474 |
if (ISCONNECTED |
2475 |
&& __isExternalAddress(aCursorId) |
|
295 | 2476 |
&& __bothSmallInteger(fgG, fgB) |
2477 |
&& __bothSmallInteger(bgR, bgG) |
|
2478 |
&& __bothSmallInteger(bgB, fgR)) { |
|
2479 |
||
1344 | 2480 |
fgcolor.red = __intVal(fgR); |
2481 |
fgcolor.green= __intVal(fgG); |
|
2482 |
fgcolor.blue = __intVal(fgB); |
|
2483 |
bgcolor.red = __intVal(bgR); |
|
2484 |
bgcolor.green= __intVal(bgG); |
|
2485 |
bgcolor.blue = __intVal(bgB); |
|
2486 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2487 |
ENTER_XLIB(); |
1344 | 2488 |
XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); |
1974 | 2489 |
LEAVE_XLIB(); |
1344 | 2490 |
END_INTERRUPTSBLOCKED |
2491 |
RETURN ( self ); |
|
72 | 2492 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2493 |
%}. |
0 | 2494 |
self primitiveFailed |
70 | 2495 |
! |
2496 |
||
295 | 2497 |
createCursorShape:aShape |
974 | 2498 |
"create a cursor given a shape-symbol. This only works |
2499 |
for a few standard cursors, and returns nil if no such cursor exists. |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2500 |
Senders must always care for a fallBack, in case of a nil return." |
295 | 2501 |
|
2502 |
|number id| |
|
2503 |
||
2504 |
number := self shapeNumberFromSymbol:aShape. |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2505 |
number isNil ifTrue:[^ nil]. |
295 | 2506 |
%{ |
2507 |
Cursor newCursor; |
|
2508 |
||
1209 | 2509 |
if (ISCONNECTED |
2510 |
&& __isSmallInteger(number)) { |
|
1344 | 2511 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 2512 |
ENTER_XLIB(); |
1344 | 2513 |
newCursor = XCreateFontCursor(myDpy, __intVal(number)); |
1974 | 2514 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2515 |
#ifdef COUNT_RESOURCES |
1344 | 2516 |
if (newCursor) |
2517 |
__cnt_cursor++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2518 |
#endif |
1344 | 2519 |
END_INTERRUPTSBLOCKED |
2520 |
if (newCursor != (Cursor)0) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2521 |
id = __MKEXTERNALADDRESS(newCursor); |
1344 | 2522 |
} |
0 | 2523 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2524 |
%}. |
295 | 2525 |
^ id |
2526 |
! |
|
2527 |
||
974 | 2528 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2529 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2530 |
||
2531 |
|id sourceId maskId| |
|
2532 |
||
2533 |
sourceId := sourceForm id. |
|
2534 |
maskId := maskForm id. |
|
2535 |
%{ |
|
2536 |
Cursor newCursor; |
|
2537 |
XColor fgColor, bgColor; |
|
2538 |
||
1209 | 2539 |
if (ISCONNECTED |
2540 |
&& __isExternalAddress(sourceId) |
|
295 | 2541 |
&& __isExternalAddress(maskId) |
2542 |
&& __bothSmallInteger(hx, hy)) { |
|
1344 | 2543 |
fgColor.red = 0; /* fg is black */ |
2544 |
fgColor.green = 0; |
|
2545 |
fgColor.blue = 0; |
|
2546 |
bgColor.red = 0xFFFF; /* bg is white */ |
|
2547 |
bgColor.green = 0xFFFF; |
|
2548 |
bgColor.blue = 0xFFFF; |
|
2549 |
||
2550 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2551 |
ENTER_XLIB(); |
1344 | 2552 |
newCursor = XCreatePixmapCursor(myDpy, |
2553 |
_PixmapVal(sourceId), |
|
2554 |
_PixmapVal(maskId), |
|
2555 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
|
1974 | 2556 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2557 |
#ifdef COUNT_RESOURCES |
1344 | 2558 |
if (newCursor) |
2559 |
__cnt_cursor++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2560 |
#endif |
1344 | 2561 |
END_INTERRUPTSBLOCKED |
2562 |
if (newCursor != (Cursor)0) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2563 |
id = __MKEXTERNALADDRESS(newCursor); |
1344 | 2564 |
} |
0 | 2565 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2566 |
%}. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2567 |
id isNil ifTrue:[ |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2568 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2569 |
]. |
295 | 2570 |
^ id |
2571 |
! |
|
2572 |
||
2573 |
destroyCursor:aCursorId |
|
974 | 2574 |
"release a cursor - frees any device resources" |
0 | 2575 |
|
2576 |
%{ /* NOCONTEXT */ |
|
2577 |
||
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2578 |
if (! ISCONNECTED) { |
1344 | 2579 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2580 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2581 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2582 |
if (__isExternalAddress(aCursorId)) { |
1344 | 2583 |
Cursor curs = _CursorVal(aCursorId); |
2584 |
||
2585 |
if (curs) { |
|
2586 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 2587 |
ENTER_XLIB(); |
1344 | 2588 |
XFreeCursor(myDpy, curs); |
1974 | 2589 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2590 |
#ifdef COUNT_RESOURCES |
1344 | 2591 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2592 |
#endif |
1344 | 2593 |
END_INTERRUPTSBLOCKED |
2594 |
} |
|
2595 |
RETURN ( self ); |
|
0 | 2596 |
} |
974 | 2597 |
%}. |
0 | 2598 |
self primitiveFailed |
295 | 2599 |
! |
2600 |
||
974 | 2601 |
needDeviceFormsForCursor |
2602 |
^ true |
|
2603 |
! |
|
2604 |
||
295 | 2605 |
shapeNumberFromSymbol:shape |
974 | 2606 |
"given a shape-symbol, return the corresponding cursor-number, |
2607 |
or nil if no such standard cursor exists." |
|
295 | 2608 |
|
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2609 |
"/this is pure X-knowlegde - but you may easily add more |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2610 |
"/ if you add something here, also add to #builtInCursorShapes ... |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2611 |
|
295 | 2612 |
|
2613 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2614 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2615 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2616 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2617 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2618 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2619 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2620 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2621 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2622 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2623 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2624 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2625 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2626 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2627 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2628 |
((shape == #origin) |
|
2629 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2630 |
((shape == #corner) |
|
2631 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2632 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2633 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2634 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2635 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2636 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
1183 | 2637 |
|
2638 |
"/ ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL. |
|
974 | 2639 |
^ nil |
0 | 2640 |
! ! |
2641 |
||
1543 | 2642 |
!XWorkstation methodsFor:'drag & drop'! |
2643 |
||
1556 | 2644 |
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
2645 |
"drop something in some alien view, using the DND protocol. |
|
2646 |
Returns false, if the drop could not be performed." |
|
2647 |
||
2648 |
|msgType dropColl anyFile anyDir anyText anyOther |
|
2649 |
dropType dropTypeCode strings sz idx val| |
|
2650 |
||
2651 |
(msgType := self atomIDOf:'DndProtocol') notNil ifTrue:[ |
|
2652 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2653 |
"/ DND can drop files, file, dir, links, dirLink and text |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2654 |
"/ check for this. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2655 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2656 |
dropObjects isCollection ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2657 |
dropColl := Array with:dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2658 |
] ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2659 |
dropColl := dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2660 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2661 |
anyFile := anyDir := anyText := anyOther := false. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2662 |
dropColl do:[:aDropObject | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2663 |
aDropObject isFileObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2664 |
aDropObject theObject isDirectory ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2665 |
anyDir := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2666 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2667 |
anyFile := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2668 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2669 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2670 |
aDropObject isTextObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2671 |
anyText := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2672 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2673 |
anyOther := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2674 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2675 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2676 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2677 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2678 |
anyOther ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2679 |
"/ DND does not support this ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2680 |
'XWorkstation [info]: DND can only drop files or text' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2681 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2682 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2683 |
anyText ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2684 |
(anyFile or:[anyDir]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2685 |
"/ DND does not support mixed types |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2686 |
'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2687 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2688 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2689 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2690 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2691 |
anyFile ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2692 |
dropType := #DndFiles. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2693 |
dropColl size == 1 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2694 |
dropType := #DndFile |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2695 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2696 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2697 |
anyDir ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2698 |
dropType := #DndFiles. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2699 |
dropColl size == 1 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2700 |
dropType := #DndDir |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2701 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2702 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2703 |
anyText ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2704 |
dropColl size == 1 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2705 |
dropType := #DndText |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2706 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2707 |
"/ can only drop a single text object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2708 |
'XWorkstation [info]: DND can only drop a single text' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2709 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2710 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2711 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2712 |
"/ mhmh ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2713 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2714 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2715 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2716 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2717 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2718 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2719 |
dropTypeCode := self dndDropTypes indexOf:dropType. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2720 |
dropTypeCode == 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2721 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2722 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2723 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2724 |
dropTypeCode := dropTypeCode - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2725 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2726 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2727 |
"/ place the selection inTo the DndSelection property |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2728 |
"/ of the rootView ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2729 |
"/ ... need a single string, with 0-terminated parts. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2730 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2731 |
strings := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2732 |
sz := 0. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2733 |
dropColl do:[:anObject | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2734 |
|s| |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2735 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2736 |
anObject isFileObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2737 |
s := anObject theObject pathName asString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2738 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2739 |
s := anObject theObject asString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2740 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2741 |
strings add:s. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2742 |
sz := sz + (s size) + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2743 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2744 |
val := String new:sz. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2745 |
idx := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2746 |
strings do:[:aString | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2747 |
val replaceFrom:idx to:(idx + aString size - 1) with:aString startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2748 |
idx := idx + aString size. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2749 |
val at:idx put:(Character value:0). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2750 |
idx := idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2751 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2752 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2753 |
self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2754 |
setProperty:(self atomIDOf:'DndSelection') |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2755 |
type:(stringAtom) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2756 |
value:val |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2757 |
for:rootId. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2758 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2759 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2760 |
sendClientEvent:msgType |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2761 |
format:32 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2762 |
to:destinationId |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2763 |
data1:dropTypeCode |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2764 |
data2:0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2765 |
data3:(destinationId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2766 |
data4:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2767 |
data5:nil. |
1556 | 2768 |
]. |
2769 |
||
2770 |
^ false |
|
2771 |
||
2772 |
"Created: 6.4.1997 / 13:39:37 / cg" |
|
1558 | 2773 |
"Modified: 6.4.1997 / 14:30:43 / cg" |
1556 | 2774 |
! |
2775 |
||
2776 |
dndDropTypes |
|
2777 |
"return the dropTypes as supported by DND" |
|
2778 |
||
2779 |
^ #( |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2780 |
DndUnknown "/ 0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2781 |
DndRawData "/ 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2782 |
DndFile "/ 2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2783 |
DndFiles "/ 3 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2784 |
DndText "/ 4 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2785 |
DndDir "/ 5 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2786 |
DndLink "/ 6 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2787 |
DndExe "/ 7 |
1556 | 2788 |
) |
2789 |
||
2790 |
"Created: 6.4.1997 / 12:57:56 / cg" |
|
2791 |
"Modified: 6.4.1997 / 13:38:52 / cg" |
|
2792 |
! |
|
2793 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
2794 |
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
1556 | 2795 |
"drop something in some alien view. |
2796 |
Returns false, if the drop could not be performed." |
|
2797 |
||
2798 |
"/ |
|
1543 | 2799 |
"/ see, if the display supports the DND protocol ... |
1556 | 2800 |
"/ |
1543 | 2801 |
(self atomIDOf:'DndProtocol') notNil ifTrue:[ |
1694 | 2802 |
^ self |
2803 |
dndDrop:aCollectionOfDropObjects |
|
2804 |
inWindowID:destinationId |
|
2805 |
position:destinationPoint |
|
2806 |
rootPosition:rootPoint |
|
1543 | 2807 |
]. |
2808 |
||
1556 | 2809 |
"/ add more drag&drop protocols here. |
2810 |
||
2811 |
^ false |
|
2812 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
2813 |
"Modified: 11.4.1997 / 12:44:50 / cg" |
1543 | 2814 |
! ! |
2815 |
||
0 | 2816 |
!XWorkstation methodsFor:'drawing'! |
2817 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2818 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2819 |
"do a bit-blt; copy bits from the rectangle defined by |
2820 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2821 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2822 |
argument is not integer." |
|
0 | 2823 |
|
2824 |
%{ /* NOCONTEXT */ |
|
2825 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2826 |
GC gc; |
0 | 2827 |
Drawable source, dest; |
2828 |
||
1209 | 2829 |
if (ISCONNECTED |
2830 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2831 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2832 |
&& __isExternalAddress(destId) |
97 | 2833 |
&& __bothSmallInteger(w, h) |
2834 |
&& __bothSmallInteger(srcX, srcY) |
|
2835 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1848 | 2836 |
int _sX, _sY, _w, _h, _dX, _dY; |
2837 |
||
2838 |
_sX = __intVal(srcX); |
|
2839 |
_sY = __intVal(srcY); |
|
2840 |
_w = __intVal(w); |
|
2841 |
_h = __intVal(h); |
|
2842 |
_dX = __intVal(dstX); |
|
2843 |
_dY = __intVal(dstY); |
|
2844 |
||
1344 | 2845 |
gc = _GCVal(dstGCId); |
2846 |
source = (Drawable) _WindowVal(sourceId); |
|
2847 |
dest = (Drawable) _WindowVal(destId); |
|
1974 | 2848 |
ENTER_XLIB(); |
1848 | 2849 |
XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); |
1974 | 2850 |
LEAVE_XLIB(); |
1344 | 2851 |
RETURN ( self ); |
0 | 2852 |
} |
118 | 2853 |
%}. |
2854 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2855 |
or any non integer coordinate" |
|
2856 |
||
0 | 2857 |
self primitiveFailed |
2858 |
! |
|
2859 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2860 |
copyFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2861 |
"do a bit-blt from a pix- or bitmap; copy bits from the rectangle defined by |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2862 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2863 |
below dstX/dstY in the destId drawable. Trigger an error if any |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2864 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2865 |
This is basically the same as copyFromId:..., but does not generate expose events." |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2866 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2867 |
%{ /* NOCONTEXT */ |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2868 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2869 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2870 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2871 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2872 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2873 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2874 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2875 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2876 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2877 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2878 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 2879 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2880 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2881 |
gc = _GCVal(dstGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2882 |
source = (Drawable) _WindowVal(sourceId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2883 |
dest = (Drawable) _WindowVal(destId); |
1974 | 2884 |
ENTER_XLIB(); |
1344 | 2885 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2886 |
XCopyArea(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2887 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2888 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2889 |
__intVal(dstX), __intVal(dstY)); |
1344 | 2890 |
XSetGraphicsExposures(dpy, gc, 1); |
1974 | 2891 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2892 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2893 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2894 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2895 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2896 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2897 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2898 |
self primitiveFailed |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2899 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2900 |
|
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2901 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2902 |
"do a bit-blt, but only copy the low-bit plane; |
2903 |
copy bits from the rectangle defined by |
|
2904 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2905 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2906 |
argument is not integer." |
|
0 | 2907 |
|
2908 |
%{ /* NOCONTEXT */ |
|
2909 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2910 |
GC gc; |
0 | 2911 |
Drawable source, dest; |
2912 |
||
1209 | 2913 |
if (ISCONNECTED |
2914 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2915 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2916 |
&& __isExternalAddress(destId) |
97 | 2917 |
&& __bothSmallInteger(w, h) |
2918 |
&& __bothSmallInteger(srcX, srcY) |
|
2919 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1344 | 2920 |
gc = _GCVal(dstGCId); |
2921 |
source = (Drawable) _WindowVal(sourceId); |
|
2922 |
dest = (Drawable) _WindowVal(destId); |
|
1974 | 2923 |
ENTER_XLIB(); |
1344 | 2924 |
XCopyPlane(myDpy, source, dest, gc, |
2925 |
__intVal(srcX), __intVal(srcY), |
|
2926 |
__intVal(w), __intVal(h), |
|
2927 |
__intVal(dstX), __intVal(dstY), 1); |
|
1974 | 2928 |
LEAVE_XLIB(); |
1344 | 2929 |
RETURN ( self ); |
0 | 2930 |
} |
118 | 2931 |
%}. |
2932 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2933 |
or any non integer coordinate" |
|
2934 |
||
0 | 2935 |
self primitiveFailed |
2936 |
! |
|
2937 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2938 |
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2939 |
"do a bit-blt from a pix- or bitmap, but only copy the low-bit plane; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2940 |
copy bits from the rectangle defined by |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2941 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2942 |
below dstX/dstY in the destId drawable. Trigger an error if any |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2943 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2944 |
This is the same as copyPlaneFromId:..., but does not generate graphics exposes" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2945 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2946 |
%{ /* NOCONTEXT */ |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2947 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2948 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2949 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2950 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2951 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2952 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2953 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2954 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2955 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2956 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2957 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 2958 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2959 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2960 |
gc = _GCVal(dstGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2961 |
source = (Drawable) _WindowVal(sourceId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2962 |
dest = (Drawable) _WindowVal(destId); |
1974 | 2963 |
ENTER_XLIB(); |
1344 | 2964 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2965 |
XCopyPlane(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2966 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2967 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2968 |
__intVal(dstX), __intVal(dstY), 1); |
1344 | 2969 |
XSetGraphicsExposures(dpy, gc, 1); |
1974 | 2970 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2971 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2972 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2973 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2974 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2975 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2976 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2977 |
self primitiveFailed |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2978 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2979 |
|
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
2980 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 2981 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
2982 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 2983 |
|
2984 |
%{ /* NOCONTEXT */ |
|
2985 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2986 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2987 |
Window win; |
0 | 2988 |
int w, h, angle1, angle2; |
2989 |
double f; |
|
2990 |
||
97 | 2991 |
if (__isSmallInteger(startAngle)) |
1344 | 2992 |
angle1 = __intVal(startAngle) * 64; |
36 | 2993 |
else if (__isFloat(startAngle)) { |
1344 | 2994 |
f = __floatVal(startAngle); |
2995 |
angle1 = f * 64; |
|
0 | 2996 |
} |
97 | 2997 |
if (__isSmallInteger(angle)) |
1344 | 2998 |
angle2 = __intVal(angle) * 64; |
36 | 2999 |
else if (__isFloat(angle)) { |
1344 | 3000 |
f = __floatVal(angle); |
3001 |
angle2 = f * 64; |
|
0 | 3002 |
} |
1209 | 3003 |
if (ISCONNECTED |
3004 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3005 |
&& __isExternalAddress(aDrawableId) |
97 | 3006 |
&& __bothSmallInteger(x, y) |
3007 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3008 |
win = _WindowVal(aDrawableId); |
3009 |
gc = _GCVal(aGCId); |
|
3010 |
w = __intVal(width); |
|
3011 |
h = __intVal(height); |
|
3012 |
/* |
|
3013 |
* need this check here: some servers simply dump core with bad args |
|
3014 |
*/ |
|
3015 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
1974 | 3016 |
ENTER_XLIB(); |
1344 | 3017 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3018 |
w, h, angle1, angle2); |
|
1974 | 3019 |
LEAVE_XLIB(); |
1344 | 3020 |
} |
3021 |
RETURN ( self ); |
|
0 | 3022 |
} |
73 | 3023 |
%}. |
3024 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 3025 |
self primitiveFailed |
3026 |
! |
|
3027 |
||
295 | 3028 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
3029 |
"draw a line. If the coordinates are not integers, an error is triggered." |
|
3030 |
||
3031 |
%{ /* NOCONTEXT */ |
|
3032 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3033 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3034 |
Window win; |
295 | 3035 |
|
1209 | 3036 |
if (ISCONNECTED |
3037 |
&& __isExternalAddress(aGCId) |
|
295 | 3038 |
&& __isExternalAddress(aDrawableId) |
3039 |
&& __bothSmallInteger(x0, y0) |
|
3040 |
&& __bothSmallInteger(x1, y1)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3041 |
gc = _GCVal(aGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3042 |
win = _WindowVal(aDrawableId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3043 |
|
1974 | 3044 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3045 |
if ((x0 == x1) && (y0 == y1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3046 |
XDrawPoint(myDpy, win, gc, __intVal(x0), __intVal(y0)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3047 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3048 |
XDrawLine(myDpy, win, gc, __intVal(x0), __intVal(y0), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3049 |
__intVal(x1), __intVal(y1)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3050 |
} |
1974 | 3051 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3052 |
RETURN ( self ); |
295 | 3053 |
} |
3054 |
%}. |
|
3055 |
"badGC, badDrawable or coordinates not integer" |
|
3056 |
self primitiveFailed |
|
3057 |
! |
|
3058 |
||
1978 | 3059 |
displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
3060 |
"draw a polygon starting at x; the y values derives from the collection yValues. |
|
3061 |
The associated x is a multiple of step. Each y value will be scaled and translated |
|
3062 |
" |
|
3063 |
||
3064 |
|noY| |
|
3065 |
||
3066 |
(noY := yValues size) < 2 ifTrue:[ |
|
3067 |
^ self |
|
3068 |
]. |
|
3069 |
||
3070 |
%{ |
|
3071 |
OBJ yA, t; |
|
3072 |
int i, num; |
|
3073 |
float y, x, sY, tY, step; |
|
3074 |
GC gc; |
|
3075 |
XPoint * points; |
|
3076 |
XPoint qPoints[200]; |
|
3077 |
int mustFree = 0; |
|
3078 |
||
3079 |
Window win; |
|
3080 |
||
3081 |
if (ISCONNECTED |
|
3082 |
&& __isExternalAddress(aGCId) |
|
3083 |
&& __isExternalAddress(aDrawableId) ) { |
|
3084 |
gc = _GCVal(aGCId); |
|
3085 |
win = _WindowVal(aDrawableId); |
|
3086 |
||
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3087 |
if( __isSmallInteger(scaleY) ) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3088 |
sY = (float) __intVal( scaleY ); |
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3089 |
else if (__isFloat(scaleY)) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3090 |
sY = __floatVal( scaleY ); |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3091 |
else if (__isShortFloat(scaleY)) |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3092 |
sY = __shortFloatVal( scaleY ); |
1978 | 3093 |
else { |
3094 |
t = __SSEND0(scaleY, @symbol(asFloat), 0); |
|
3095 |
if (! __isFloat(t)) goto fail; |
|
3096 |
sY = __floatVal( t ); |
|
3097 |
} |
|
3098 |
||
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3099 |
if( __isSmallInteger(transY) ) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3100 |
tY = (float) __intVal( transY ); |
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3101 |
else if (__isFloat(transY)) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3102 |
tY = __floatVal( transY ); |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3103 |
else if (__isShortFloat(transY)) |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3104 |
tY = __shortFloatVal( transY ); |
1978 | 3105 |
else { |
3106 |
t = __SSEND0(transY, @symbol(asFloat), 0); |
|
3107 |
if (! __isFloat(t)) goto fail; |
|
3108 |
tY = __floatVal( t ); |
|
3109 |
} |
|
3110 |
||
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3111 |
if( __isSmallInteger(startX) ) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3112 |
x = (float) __intVal( startX ); |
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3113 |
else if (__isFloat(startX)) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3114 |
x = __floatVal( startX ); |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3115 |
else if (__isShortFloat(startX)) |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3116 |
x = __shortFloatVal( startX ); |
1978 | 3117 |
else { |
3118 |
t = __SSEND0(startX, @symbol(asFloat), 0); |
|
3119 |
if (! __isFloat(t)) goto fail; |
|
3120 |
x = __floatVal( t ); |
|
3121 |
} |
|
3122 |
||
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3123 |
if( __isSmallInteger(stepX) ) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3124 |
step = (float) __intVal( stepX ); |
2076
7202e4e5c2e2
also support shortFloats in a polygon
Claus Gittinger <cg@exept.de>
parents:
2057
diff
changeset
|
3125 |
else if (__isFloat(stepX)) |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3126 |
step = __floatVal( stepX ); |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3127 |
else if (__isShortFloat(stepX)) |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3128 |
step = __shortFloatVal( stepX ); |
1978 | 3129 |
else { |
3130 |
t = __SSEND0(stepX, @symbol(asFloat), 0); |
|
3131 |
if (! __isFloat(t)) goto fail; |
|
3132 |
step = __floatVal( t ); |
|
3133 |
} |
|
3134 |
||
3135 |
num = __intVal( noY ); |
|
3136 |
||
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3137 |
if( num > 200 ) { |
1978 | 3138 |
if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) |
3139 |
goto fail; |
|
3140 |
mustFree = 1; |
|
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3141 |
} else { |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3142 |
points = qPoints; |
1978 | 3143 |
} |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3144 |
for( i = 0; i < num; ++i ) { |
1978 | 3145 |
yA = __AT_(yValues, __MKSMALLINT(i+1) ); |
3146 |
||
3147 |
if( __isFloat(yA) ) |
|
3148 |
y = __floatVal( yA ); |
|
3149 |
else if( __isSmallInteger(yA) ) |
|
3150 |
y = (float) __intVal( yA ); |
|
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3151 |
else if( __isShortFloat( yA) ) |
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3152 |
y = __shortFloatVal( yA ); |
1978 | 3153 |
else { |
3154 |
t = __SSEND0(yA, @symbol(asFloat), 0); |
|
3155 |
if (! __isFloat(t)) goto fail; |
|
3156 |
y = __floatVal( t ); |
|
3157 |
} |
|
3158 |
||
3159 |
points[i].x = (int) (x + 0.5); |
|
3160 |
points[i].y = (int) ((y * sY) + tY + 0.5); |
|
3161 |
x = x + step; |
|
3162 |
} |
|
3163 |
||
1979 | 3164 |
ENTER_XLIB(); |
1978 | 3165 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
1979 | 3166 |
LEAVE_XLIB(); |
1978 | 3167 |
|
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3168 |
if( mustFree ) { |
1978 | 3169 |
free( points ); |
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3170 |
} |
1978 | 3171 |
RETURN ( self ); |
3172 |
} |
|
3173 |
||
3174 |
fail: |
|
3175 |
if( mustFree ) |
|
3176 |
free( points ); |
|
3177 |
%}. |
|
3178 |
self primitiveFailed |
|
3179 |
||
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3180 |
"Modified: / 13.6.1998 / 13:51:39 / cg" |
1978 | 3181 |
! |
3182 |
||
295 | 3183 |
displayPointX:x y:y in:aDrawableId with:aGCId |
3184 |
"draw a point. If x/y are not integers, an error is triggered." |
|
3185 |
||
3186 |
%{ /* NOCONTEXT */ |
|
3187 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3188 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3189 |
Window win; |
295 | 3190 |
|
1209 | 3191 |
if (ISCONNECTED |
3192 |
&& __isExternalAddress(aGCId) |
|
295 | 3193 |
&& __isExternalAddress(aDrawableId) |
3194 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 3195 |
gc = _GCVal(aGCId); |
3196 |
win = _WindowVal(aDrawableId); |
|
1974 | 3197 |
|
3198 |
ENTER_XLIB(); |
|
1344 | 3199 |
XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); |
1974 | 3200 |
LEAVE_XLIB(); |
3201 |
||
1344 | 3202 |
RETURN ( self ); |
295 | 3203 |
} |
3204 |
%}. |
|
3205 |
"badGC, badDrawable or x/y not integer" |
|
3206 |
self primitiveFailed |
|
3207 |
! |
|
3208 |
||
3209 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
3210 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
3211 |
define the polygon. |
|
3212 |
If any coordinate is not integer, an error is triggered." |
|
3213 |
||
3214 |
|numberOfPoints newPoints| |
|
3215 |
||
3216 |
numberOfPoints := aPolygon size. |
|
3217 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3218 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3219 |
Window win; |
295 | 3220 |
OBJ point, x, y; |
3221 |
int i, num; |
|
3222 |
XPoint *points; |
|
3223 |
XPoint qPoints[100]; |
|
377 | 3224 |
int mustFree = 0; |
295 | 3225 |
|
1209 | 3226 |
if (ISCONNECTED |
3227 |
&& __isExternalAddress(aGCId) |
|
295 | 3228 |
&& __isExternalAddress(aDrawableId) |
3229 |
&& __isSmallInteger(numberOfPoints)) { |
|
1344 | 3230 |
gc = _GCVal(aGCId); |
3231 |
win = _WindowVal(aDrawableId); |
|
3232 |
num = __intVal(numberOfPoints); |
|
3233 |
/* |
|
3234 |
* avoid a (slow) malloc, if the number of points is small |
|
3235 |
*/ |
|
3236 |
if (num > 100) { |
|
3237 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
|
3238 |
if (! points) goto fail; |
|
3239 |
mustFree = 1; |
|
3240 |
} else |
|
3241 |
points = qPoints; |
|
3242 |
||
3243 |
for (i=0; i<num; i++) { |
|
3244 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
3245 |
if (! __isPoint(point)) goto fail; |
|
3246 |
x = _point_X(point); |
|
3247 |
y = _point_Y(point); |
|
3248 |
if (! __bothSmallInteger(x, y)) |
|
3249 |
goto fail; |
|
3250 |
points[i].x = __intVal(x); |
|
3251 |
points[i].y = __intVal(y); |
|
3252 |
} |
|
1974 | 3253 |
|
3254 |
ENTER_XLIB(); |
|
1344 | 3255 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
1974 | 3256 |
LEAVE_XLIB(); |
3257 |
||
1344 | 3258 |
if (mustFree) |
3259 |
free(points); |
|
3260 |
RETURN ( self ); |
|
295 | 3261 |
} |
3262 |
fail: ; |
|
377 | 3263 |
if (mustFree) |
1344 | 3264 |
free(points); |
295 | 3265 |
%}. |
3266 |
"badGC, badDrawable or coordinates not integer" |
|
3267 |
self primitiveFailed |
|
3268 |
! |
|
3269 |
||
3270 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
3271 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
|
3272 |
||
3273 |
%{ /* NOCONTEXT */ |
|
3274 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3275 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3276 |
Window win; |
295 | 3277 |
int w, h; |
3278 |
||
1209 | 3279 |
if (ISCONNECTED |
3280 |
&& __isExternalAddress(aGCId) |
|
295 | 3281 |
&& __isExternalAddress(aDrawableId) |
3282 |
&& __bothSmallInteger(x, y) |
|
3283 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3284 |
gc = _GCVal(aGCId); |
3285 |
win = _WindowVal(aDrawableId); |
|
3286 |
w = __intVal(width); |
|
3287 |
h = __intVal(height); |
|
3288 |
/* |
|
3289 |
* need this check here: some servers simply dump core with bad args |
|
3290 |
*/ |
|
3291 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 3292 |
ENTER_XLIB(); |
1344 | 3293 |
XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h); |
1974 | 3294 |
LEAVE_XLIB(); |
1344 | 3295 |
} |
3296 |
RETURN ( self ); |
|
295 | 3297 |
} |
3298 |
%}. |
|
3299 |
"badGC, badDrawable or coordinates not integer" |
|
3300 |
self primitiveFailed |
|
3301 |
! |
|
3302 |
||
3303 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3304 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
|
3305 |
foreground and background characters. |
|
3306 |
If the coordinates are not integers, an error is triggered." |
|
3307 |
||
3308 |
%{ /* NOCONTEXT */ |
|
3309 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3310 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3311 |
Window win; |
1831 | 3312 |
char *cp; |
295 | 3313 |
OBJ cls; |
3314 |
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
|
3315 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3316 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3317 |
int nInstBytes; |
295 | 3318 |
|
1209 | 3319 |
if (ISCONNECTED |
3320 |
&& __isExternalAddress(aGCId) |
|
295 | 3321 |
&& __isExternalAddress(aDrawableId) |
3322 |
&& __isNonNilObject(aString) |
|
3323 |
&& __bothSmallInteger(index1, index2) |
|
3324 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 3325 |
gc = _GCVal(aGCId); |
3326 |
win = _WindowVal(aDrawableId); |
|
3327 |
cls = __qClass(aString); |
|
3328 |
||
3329 |
i1 = __intVal(index1) - 1; |
|
3330 |
if (i1 >= 0) { |
|
3331 |
i2 = __intVal(index2) - 1; |
|
3332 |
if (i2 < i1) { |
|
3333 |
RETURN (self); |
|
3334 |
} |
|
3335 |
||
1831 | 3336 |
cp = (char *) __stringVal(aString); |
1344 | 3337 |
l = i2 - i1 + 1; |
3338 |
||
3339 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
3340 |
n = __stringSize(aString); |
1344 | 3341 |
if (i2 < n) { |
3342 |
cp += i1; |
|
3343 |
if (l > 1000) l = 1000; |
|
1974 | 3344 |
ENTER_XLIB(); |
1344 | 3345 |
if (opaque == true) |
1831 | 3346 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1344 | 3347 |
else |
1831 | 3348 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1974 | 3349 |
LEAVE_XLIB(); |
1344 | 3350 |
RETURN ( self ); |
3351 |
} |
|
3352 |
} |
|
3353 |
||
3354 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3355 |
cp += nInstBytes; |
|
3356 |
||
3357 |
if (__isBytes(aString)) { |
|
3358 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3359 |
||
3360 |
if (i2 < n) { |
|
3361 |
cp += i1; |
|
3362 |
if (l > 1000) l = 1000; |
|
1974 | 3363 |
ENTER_XLIB(); |
1344 | 3364 |
if (opaque == true) |
1831 | 3365 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1344 | 3366 |
else |
1831 | 3367 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1974 | 3368 |
LEAVE_XLIB(); |
1344 | 3369 |
RETURN ( self ); |
3370 |
} |
|
3371 |
} |
|
3372 |
||
3373 |
/* TWOBYTESTRINGS */ |
|
3374 |
if (__isWords(aString)) { |
|
3375 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3376 |
||
3377 |
if (i2 < n) { |
|
3378 |
union { |
|
3379 |
char b[2]; |
|
3380 |
unsigned short s; |
|
3381 |
} u; |
|
3382 |
int i; |
|
3383 |
XChar2b *cp2 = (XChar2b *)0; |
|
3384 |
int mustFree = 0; |
|
3385 |
||
3386 |
cp += (i1 * 2); |
|
3387 |
if (l > 1000) l = 1000; |
|
3388 |
||
3389 |
/* |
|
3390 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3391 |
* X expects them MSB first |
|
3392 |
* convert as required |
|
3393 |
*/ |
|
3394 |
||
3395 |
u.s = 0x1234; |
|
3396 |
if (u.b[0] != 0x12) { |
|
3397 |
if (l <= NLOCALBUFFER) { |
|
3398 |
cp2 = xlatebuffer; |
|
3399 |
} else { |
|
3400 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
3401 |
mustFree = 1; |
|
3402 |
} |
|
3403 |
for (i=0; i<l; i++) { |
|
3404 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3405 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3406 |
} |
|
3407 |
cp = (char *) cp2; |
|
3408 |
} |
|
3409 |
||
1974 | 3410 |
ENTER_XLIB(); |
1344 | 3411 |
if (opaque == true) |
3412 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
3413 |
else |
|
3414 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
1974 | 3415 |
LEAVE_XLIB(); |
1344 | 3416 |
|
3417 |
if (mustFree) { |
|
3418 |
free(cp2); |
|
3419 |
} |
|
3420 |
||
3421 |
RETURN ( self ); |
|
3422 |
} |
|
3423 |
} |
|
3424 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3425 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3426 |
#undef NLOCALBUFFER |
295 | 3427 |
%}. |
3428 |
"x/y not integer, badGC or drawable, or not a string" |
|
3429 |
self primitiveFailed |
|
3430 |
! |
|
3431 |
||
3432 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3433 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
|
3434 |
foreground and background characters. |
|
3435 |
If the coordinates are not integers, an error is triggered." |
|
3436 |
||
3437 |
%{ /* NOCONTEXT */ |
|
3438 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3439 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3440 |
Window win; |
1831 | 3441 |
char *cp; |
295 | 3442 |
int n; |
3443 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3444 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3445 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3446 |
int nInstBytes; |
295 | 3447 |
|
1209 | 3448 |
if (ISCONNECTED |
3449 |
&& __isExternalAddress(aGCId) |
|
295 | 3450 |
&& __isExternalAddress(aDrawableId) |
3451 |
&& __isNonNilObject(aString) |
|
3452 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 3453 |
gc = _GCVal(aGCId); |
3454 |
win = _WindowVal(aDrawableId); |
|
3455 |
cls = __qClass(aString); |
|
3456 |
||
1831 | 3457 |
cp = (char *) __stringVal(aString); |
1344 | 3458 |
|
3459 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
3460 |
n = __stringSize(aString); |
1344 | 3461 |
if (n > 1000) n = 1000; |
1974 | 3462 |
ENTER_XLIB(); |
1344 | 3463 |
if (opaque == true) |
1831 | 3464 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1344 | 3465 |
else |
1831 | 3466 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1974 | 3467 |
LEAVE_XLIB(); |
1344 | 3468 |
RETURN ( self ); |
3469 |
} |
|
3470 |
||
3471 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3472 |
cp += nInstBytes; |
|
3473 |
||
3474 |
if (__isBytes(aString)) { |
|
3475 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3476 |
||
3477 |
if (n > 1000) n = 1000; |
|
1974 | 3478 |
ENTER_XLIB(); |
1344 | 3479 |
if (opaque == true) |
1831 | 3480 |
XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1344 | 3481 |
else |
1831 | 3482 |
XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1974 | 3483 |
LEAVE_XLIB(); |
1344 | 3484 |
RETURN ( self ); |
3485 |
} |
|
3486 |
||
3487 |
/* TWOBYTESTRINGS */ |
|
3488 |
if (__isWords(aString)) { |
|
3489 |
union { |
|
3490 |
char b[2]; |
|
3491 |
unsigned short s; |
|
3492 |
} u; |
|
3493 |
int i; |
|
3494 |
XChar2b *cp2; |
|
3495 |
int mustFree = 0; |
|
3496 |
||
3497 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3498 |
if (n > 1000) n = 1000; |
|
3499 |
||
3500 |
/* |
|
3501 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3502 |
* X expects them MSB first |
|
3503 |
* convert as required |
|
3504 |
*/ |
|
3505 |
||
3506 |
u.s = 0x1234; |
|
3507 |
if (u.b[0] != 0x12) { |
|
3508 |
if (n <= NLOCALBUFFER) { |
|
3509 |
cp2 = xlatebuffer; |
|
3510 |
} else { |
|
3511 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
3512 |
mustFree = 1; |
|
3513 |
} |
|
3514 |
||
3515 |
for (i=0; i<n; i++) { |
|
3516 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3517 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3518 |
} |
|
3519 |
cp = (char *) cp2; |
|
3520 |
} |
|
3521 |
||
1974 | 3522 |
ENTER_XLIB(); |
1344 | 3523 |
if (opaque == true) |
3524 |
XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
3525 |
else |
|
3526 |
XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
1974 | 3527 |
LEAVE_XLIB(); |
1344 | 3528 |
|
3529 |
||
3530 |
if (mustFree) { |
|
3531 |
free(cp2); |
|
3532 |
} |
|
3533 |
||
3534 |
RETURN ( self ); |
|
3535 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3536 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3537 |
#undef NLOCALBUFFER |
295 | 3538 |
%}. |
3539 |
"x/y not integer, badGC or drawable, or not a string" |
|
3540 |
self primitiveFailed |
|
3541 |
! |
|
3542 |
||
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3543 |
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:padding |
2003 | 3544 |
width:imageWidth height:imageHeight |
3545 |
x:srcx y:srcy |
|
3546 |
into:aDrawableId |
|
3547 |
x:dstx y:dsty |
|
3548 |
width:w height:h |
|
3549 |
with:aGCId |
|
295 | 3550 |
|
3551 |
"draw a bitImage which has depth id, width iw and height ih into |
|
3552 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3553 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
3554 |
depth and pixel-units to be different. |
|
3555 |
It has to be checked elsewhere, that the server can do it with the given |
|
3556 |
depth - otherwise, primitive failure will be signalled. |
|
3557 |
Also it is assumed, that the colormap is setup correctly and the |
|
3558 |
colors are allocated - otherwise the colors may be wrong." |
|
3559 |
||
3560 |
" |
|
3561 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
3562 |
an unlimited stack, and thus cannot send primitiveFailed |
|
3563 |
" |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3564 |
(self |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3565 |
primDrawBits:imageBits |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3566 |
bitsPerPixel:bitsPerPixel |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3567 |
depth:imageDepth |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3568 |
padding:padding |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3569 |
width:imageWidth height:imageHeight |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3570 |
x:srcx y:srcy |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3571 |
into:aDrawableId |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3572 |
x:dstx y:dsty |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3573 |
width:w height:h |
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3574 |
with:aGCId) |
295 | 3575 |
ifFalse:[ |
1344 | 3576 |
" |
3577 |
also happens, if a segmentation violation occurs in the |
|
3578 |
XPutImage ... |
|
3579 |
" |
|
3580 |
self primitiveFailed |
|
295 | 3581 |
]. |
3582 |
! |
|
3583 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
3584 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
1344 | 3585 |
in:aDrawableId with:aGCId |
90 | 3586 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
3587 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 3588 |
|
3589 |
%{ /* NOCONTEXT */ |
|
3590 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3591 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3592 |
Window win; |
0 | 3593 |
int w, h, angle1, angle2; |
3594 |
double f; |
|
3595 |
||
97 | 3596 |
if (__isSmallInteger(startAngle)) |
1344 | 3597 |
angle1 = __intVal(startAngle) * 64; |
36 | 3598 |
else if (__isFloat(startAngle)) { |
1344 | 3599 |
f = __floatVal(startAngle); |
3600 |
angle1 = f * 64; |
|
0 | 3601 |
} |
97 | 3602 |
if (__isSmallInteger(angle)) |
1344 | 3603 |
angle2 = __intVal(angle) * 64; |
36 | 3604 |
else if (__isFloat(angle)) { |
1344 | 3605 |
f = __floatVal(angle); |
3606 |
angle2 = f * 64; |
|
0 | 3607 |
} |
1209 | 3608 |
if (ISCONNECTED |
3609 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3610 |
&& __isExternalAddress(aDrawableId) |
97 | 3611 |
&& __bothSmallInteger(x, y) |
3612 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3613 |
gc = _GCVal(aGCId); |
3614 |
win = _WindowVal(aDrawableId); |
|
3615 |
w = __intVal(width); |
|
3616 |
h = __intVal(height); |
|
3617 |
/* |
|
3618 |
* need this check here: some servers simply dump core with bad args |
|
3619 |
*/ |
|
3620 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
1974 | 3621 |
ENTER_XLIB(); |
1344 | 3622 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3623 |
w, h, angle1, angle2); |
|
1974 | 3624 |
LEAVE_XLIB(); |
1344 | 3625 |
} |
3626 |
RETURN ( self ); |
|
0 | 3627 |
} |
73 | 3628 |
%}. |
3629 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 3630 |
self primitiveFailed |
3631 |
! |
|
3632 |
||
3633 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
118 | 3634 |
"fill a polygon given by its points. |
3635 |
If any coordinate is not integer, an error is triggered." |
|
73 | 3636 |
|
3637 |
|numberOfPoints| |
|
0 | 3638 |
|
3639 |
numberOfPoints := aPolygon size. |
|
3640 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3641 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3642 |
Window win; |
73 | 3643 |
OBJ point, x, y; |
3644 |
int i, num; |
|
3645 |
XPoint *points; |
|
3646 |
XPoint qPoints[100]; |
|
377 | 3647 |
int mustFree = 0; |
73 | 3648 |
|
1209 | 3649 |
if (ISCONNECTED |
3650 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3651 |
&& __isExternalAddress(aDrawableId) |
97 | 3652 |
&& __isSmallInteger(numberOfPoints)) { |
1344 | 3653 |
gc = _GCVal(aGCId); |
3654 |
win = _WindowVal(aDrawableId); |
|
3655 |
num = __intVal(numberOfPoints); |
|
3656 |
if (num < 3) { |
|
3657 |
RETURN ( self ); |
|
3658 |
} |
|
3659 |
/* |
|
3660 |
* avoid (slow) malloc, if not many points |
|
3661 |
*/ |
|
3662 |
if (num > 100) { |
|
3663 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
|
3664 |
if (! points) goto fail; |
|
3665 |
mustFree = 1; |
|
3666 |
} else |
|
3667 |
points = qPoints; |
|
3668 |
for (i=0; i<num; i++) { |
|
3669 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
3670 |
if (! __isPoint(point)) goto fail; |
|
3671 |
x = _point_X(point); |
|
3672 |
y = _point_Y(point); |
|
3673 |
if (! __bothSmallInteger(x, y)) |
|
3674 |
goto fail; |
|
3675 |
points[i].x = __intVal(x); |
|
3676 |
points[i].y = __intVal(y); |
|
3677 |
} |
|
1974 | 3678 |
ENTER_XLIB(); |
1344 | 3679 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
1974 | 3680 |
LEAVE_XLIB(); |
1344 | 3681 |
if (mustFree) |
3682 |
free(points); |
|
3683 |
RETURN ( self ); |
|
377 | 3684 |
|
0 | 3685 |
fail: ; |
1344 | 3686 |
if (mustFree) |
3687 |
free(points); |
|
0 | 3688 |
} |
73 | 3689 |
%}. |
3690 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 3691 |
self primitiveFailed |
3692 |
! |
|
3693 |
||
295 | 3694 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
3695 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
3696 |
||
3697 |
%{ /* NOCONTEXT */ |
|
3698 |
||
3699 |
int w, h; |
|
3700 |
||
1209 | 3701 |
if (ISCONNECTED |
3702 |
&& __isExternalAddress(aGCId) |
|
295 | 3703 |
&& __isExternalAddress(aDrawableId) |
3704 |
&& __bothSmallInteger(x, y) |
|
3705 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3706 |
w = __intVal(width); |
3707 |
h = __intVal(height); |
|
3708 |
/* |
|
3709 |
* need this check here: some servers simply dump core with bad args |
|
3710 |
*/ |
|
3711 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 3712 |
ENTER_XLIB(); |
1344 | 3713 |
XFillRectangle(myDpy, |
3714 |
(Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), |
|
3715 |
__intVal(x), __intVal(y), w, h); |
|
1974 | 3716 |
LEAVE_XLIB(); |
1344 | 3717 |
} |
3718 |
RETURN ( self ); |
|
295 | 3719 |
} |
3720 |
%}. |
|
3721 |
"badGC, badDrawable or coordinates not integer" |
|
3722 |
self primitiveFailed |
|
43 | 3723 |
! |
3724 |
||
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3725 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding |
2007 | 3726 |
width:imageWidth height:imageHeight |
3727 |
x:srcx y:srcy |
|
3728 |
into:aDrawableId |
|
3729 |
x:dstx y:dsty |
|
3730 |
width:w height:h |
|
3731 |
with:aGCId |
|
0 | 3732 |
|
132 | 3733 |
"since XPutImage may allocate huge amount of stack space |
3734 |
(some implementations use alloca), this must run with unlimited stack." |
|
3735 |
||
12 | 3736 |
%{ /* UNLIMITEDSTACK */ |
0 | 3737 |
|
43 | 3738 |
/* |
3739 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
3740 |
* XPutImage |
|
3741 |
*/ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3742 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3743 |
Window win; |
43 | 3744 |
XImage image; |
377 | 3745 |
int imgWdth; |
43 | 3746 |
|
1209 | 3747 |
if (ISCONNECTED |
3748 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3749 |
&& __isExternalAddress(aDrawableId) |
97 | 3750 |
&& __bothSmallInteger(srcx, srcy) |
3751 |
&& __bothSmallInteger(dstx, dsty) |
|
3752 |
&& __bothSmallInteger(w, h) |
|
3753 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
3754 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3755 |
&& __isSmallInteger(bitPadding) |
43 | 3756 |
&& __isByteArray(imageBits)) { |
2007 | 3757 |
Display *dpy = myDpy; |
3758 |
int pad = __intVal(bitPadding); |
|
3759 |
||
3760 |
gc = _GCVal(aGCId); |
|
3761 |
win = _WindowVal(aDrawableId); |
|
3762 |
if (! gc || !win) |
|
3763 |
goto fail; |
|
46 | 3764 |
#ifdef ARGDEBUG |
2007 | 3765 |
printf("args ok\n"); |
46 | 3766 |
#endif |
2007 | 3767 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
3768 |
image.width = imgWdth = __intVal(imageWidth); |
|
3769 |
image.height = __intVal(imageHeight); |
|
3770 |
image.xoffset = 0; |
|
3771 |
image.format = ZPixmap; |
|
3772 |
image.byte_order = MSBFirst; |
|
3773 |
image.bitmap_unit = 8; |
|
3774 |
image.bitmap_bit_order = MSBFirst; |
|
3775 |
image.bitmap_pad = pad; |
|
3776 |
image.depth = __intVal(imageDepth); |
|
3777 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
|
3778 |
||
2021 | 3779 |
/* |
3780 |
image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; |
|
3781 |
*/ |
|
3782 |
image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
|
2007 | 3783 |
|
3784 |
switch (image.bits_per_pixel) { |
|
3785 |
case 1: |
|
3786 |
case 2: |
|
3787 |
case 4: |
|
3788 |
case 8: |
|
3789 |
case 16: |
|
3790 |
case 24: |
|
3791 |
case 32: |
|
3792 |
break; |
|
3793 |
||
3794 |
default: |
|
46 | 3795 |
#ifdef ARGDEBUG |
2007 | 3796 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 3797 |
#endif |
2007 | 3798 |
goto fail; |
3799 |
} |
|
3800 |
||
3801 |
image.red_mask = 0xFFFF; |
|
3802 |
image.green_mask = 0xFFFF; |
|
3803 |
image.blue_mask = 0xFFFF; |
|
3804 |
||
3805 |
/* ENTER_XLIB(); */ |
|
3806 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
|
3807 |
__intVal(dstx), __intVal(dsty), |
|
3808 |
__intVal(w), __intVal(h)); |
|
3809 |
/* LEAVE_XLIB(); */ |
|
3810 |
||
3811 |
RETURN ( true ); |
|
43 | 3812 |
} |
46 | 3813 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3814 |
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
|
3815 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 3816 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
3817 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
3818 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
3819 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
3820 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
3821 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
3822 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
3823 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
3824 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
3825 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
3826 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 3827 |
#endif |
3828 |
||
0 | 3829 |
fail: ; |
3830 |
%} |
|
3831 |
. |
|
12 | 3832 |
^ false |
0 | 3833 |
! ! |
3834 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3835 |
!XWorkstation methodsFor:'event forwarding'! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3836 |
|
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3837 |
circulateNotifyView:aView |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3838 |
"sent, when the stacking order changes. |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3839 |
ignored for now." |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3840 |
|
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3841 |
! |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3842 |
|
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3843 |
circulateRequestView:aView |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3844 |
"sent, when the stacking order is about to change. |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3845 |
ignored for now." |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3846 |
! |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3847 |
|
1540 | 3848 |
clientMessage:event dataOffset:offs view:targetView |
1757 | 3849 |
self halt:'debug halt: unimplemented client message'. |
1540 | 3850 |
|
3851 |
"Created: 4.4.1997 / 17:23:12 / cg" |
|
1757 | 3852 |
"Modified: 17.6.1997 / 18:04:24 / cg" |
1540 | 3853 |
! |
3854 |
||
1543 | 3855 |
clientMessage:event type:type format:format dataOffset:offs view:targetView |
3856 |
|sensor data| |
|
3857 |
||
3858 |
data := event copyFrom:offs + 1. |
|
3859 |
||
3860 |
"/ DND drag&drop protocol |
|
3861 |
type == (self atomIDOf:'DndProtocol') ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3862 |
format == 32 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3863 |
self dndMessage:event data:data view:targetView. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3864 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3865 |
] |
1543 | 3866 |
]. |
3867 |
||
3868 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3869 |
sensor clientMessage:type format:format eventData:data view:targetView |
1543 | 3870 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3871 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3872 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3873 |
" |
1543 | 3874 |
] |
3875 |
||
3876 |
"Created: 4.4.1997 / 17:49:26 / cg" |
|
3877 |
"Modified: 4.4.1997 / 18:00:18 / cg" |
|
3878 |
! |
|
3879 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3880 |
colorMapChangeView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3881 |
"sent, when another colormap is installed. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3882 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3883 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3884 |
aView colorMapChange |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3885 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3886 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3887 |
configureRequestView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3888 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3889 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3890 |
"/ aView configureRequest |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3891 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3892 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3893 |
createdView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3894 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3895 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3896 |
"/ aView created |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3897 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3898 |
|
1543 | 3899 |
dndMessage:event data:data view:targetView |
3900 |
"handle a DND drag&drop protocol message" |
|
3901 |
||
1553 | 3902 |
|sensor dropType dropValue names i1 i2 t| |
1543 | 3903 |
|
3904 |
dropType := data doubleWordAt:1. |
|
3905 |
||
3906 |
"/ see def's in DragAndDropTypes.h |
|
1556 | 3907 |
dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. |
1543 | 3908 |
|
3909 |
self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3910 |
getProperty:(self atomIDOf:'DndSelection') |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3911 |
from:rootId |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3912 |
into:[:type :value | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3913 |
t := type. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3914 |
dropValue := value |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3915 |
]. |
1543 | 3916 |
|
1558 | 3917 |
"/ preconvert into a collection |
3918 |
"/ of fileNames, string or byteArray |
|
3919 |
"/ Notice: we do not yet convert into dropObjects |
|
3920 |
"/ here, to allow arbitrary data to be handled by |
|
3921 |
"/ redefined dropMessage methods in applications. |
|
3922 |
"/ Conversion is done for some well known types |
|
3923 |
"/ in the default dropMessage handling of SimpleView. |
|
3924 |
||
1543 | 3925 |
dropType == #DndFiles ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3926 |
"/ actually, a list of fileNames |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3927 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3928 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3929 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3930 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3931 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3932 |
names := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3933 |
i1 := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3934 |
[i1 ~~ 0] whileTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3935 |
i2 := dropValue indexOf:(Character value:0) startingAt:i1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3936 |
i2 ~~ 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3937 |
names add:(dropValue copyFrom:i1 to:(i2-1)). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3938 |
i1 := i2 + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3939 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3940 |
i1 := i2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3941 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3942 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3943 |
dropValue := names. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3944 |
dropValue := dropValue collect:[:nm | nm asFilename]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3945 |
dropType := #files. |
1558 | 3946 |
] ifFalse:[ (dropType == #DndFile) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3947 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3948 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3949 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3950 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3951 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3952 |
dropValue := dropValue asFilename. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3953 |
dropType := #file. |
1558 | 3954 |
] ifFalse:[ (dropType == #DndDir) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3955 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3956 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3957 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3958 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3959 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3960 |
dropValue := dropValue asFilename. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3961 |
dropType := #directory. |
1558 | 3962 |
] ifFalse:[ (dropType == #DndText) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3963 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3964 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3965 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3966 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3967 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3968 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3969 |
dropType := #text. |
1558 | 3970 |
] ifFalse:[ (dropType == #DndExe) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3971 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3972 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3973 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3974 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3975 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3976 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3977 |
dropType := #executable. |
1558 | 3978 |
] ifFalse:[ (dropType == #DndLink) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3979 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3980 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3981 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3982 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3983 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3984 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3985 |
dropType := #link. |
1558 | 3986 |
] ifFalse:[ (dropType == #DndRawData) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3987 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3988 |
dropType := #rawData. |
1552 | 3989 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3990 |
'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3991 |
'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3992 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3993 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3994 |
dropType := #unknown. |
1558 | 3995 |
]]]]]]]. |
1543 | 3996 |
|
3997 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3998 |
sensor dropMessage:dropType data:dropValue view:targetView |
1543 | 3999 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4000 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4001 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4002 |
" |
1543 | 4003 |
] |
4004 |
||
4005 |
"Created: 4.4.1997 / 17:59:37 / cg" |
|
1558 | 4006 |
"Modified: 6.4.1997 / 14:50:44 / cg" |
1543 | 4007 |
! |
4008 |
||
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4009 |
gravityNotifyView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4010 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4011 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4012 |
"/ aView gravityNotify |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4013 |
! |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4014 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4015 |
mapRequestView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4016 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4017 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4018 |
"/ aView mapRequest |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4019 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4020 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4021 |
propertyChangeView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4022 |
"sent when an X property changes. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4023 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4024 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4025 |
aView propertyChange |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4026 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4027 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4028 |
reparentedView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4029 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4030 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4031 |
"/ aView reparented |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4032 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4033 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4034 |
resizeRequestView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4035 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4036 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4037 |
"/ aView resizeRequest |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4038 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4039 |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4040 |
selectionClear:selectionID view:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4041 |
"sent when another X-client has created a selection. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4042 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4043 |
|
1344 | 4044 |
"/ |
4045 |
"/ workaround a bug in olvwm: it clears selections |
|
4046 |
"/ on window raise. |
|
4047 |
"/ In this case, keep my last own selection. |
|
4048 |
"/ |
|
4049 |
||
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4050 |
self setLastCopyBuffer:(self getCopyBuffer). |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4051 |
self setCopyBuffer:nil |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4052 |
|
1795 | 4053 |
"/ noone is interested in that ... |
1344 | 4054 |
"/ aView selectionClear:selectionID |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4055 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4056 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4057 |
selectionNotify:propertyID target:targetID selection:selectionID from:requestorID view:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4058 |
"sent when the server returns an answer from a request for a selection. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4059 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4060 |
|
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4061 |
|s sensor| |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4062 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4063 |
propertyID == 0 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4064 |
"invalid olvwm behavior" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4065 |
s := self getLastCopyBuffer |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4066 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4067 |
targetID == self atomIDOfSTRING ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4068 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4069 |
a returned string |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4070 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4071 |
s := self getTextProperty:propertyID from:requestorID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4072 |
s notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4073 |
(s endsWith:Character cr) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4074 |
s := s asStringCollection copyWith:'' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4075 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4076 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4077 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4078 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4079 |
a returned object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4080 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4081 |
s := self getObjectProperty:propertyID from:requestorID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4082 |
]. |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4083 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4084 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4085 |
s notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4086 |
(sensor := aView sensor) notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4087 |
sensor pasteFromClipBoard:s view:aView |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4088 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4089 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4090 |
if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4091 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4092 |
aView pasteFromClipBoard:s |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4093 |
] |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4094 |
] |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4095 |
! |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4096 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4097 |
selectionRequest:propertyID target:targetID selection:selectionID from:windowID view:aView |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4098 |
"sent by some other X-client to ask for the selection. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4099 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4100 |
|
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4101 |
|o s stream| |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4102 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4103 |
targetID == (self atomIDOfLENGTH) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4104 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4105 |
"/ the other one wants to know the size of our selection ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4106 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4107 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4108 |
s := self selectionAsString. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4109 |
self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4110 |
setLengthProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4111 |
value:s size |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4112 |
for:windowID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4113 |
self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4114 |
sendSelectionNotifySelection:selectionID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4115 |
property:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4116 |
target:targetID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4117 |
from:aView id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4118 |
to:windowID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4119 |
^ self |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4120 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4121 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4122 |
(targetID == self atomIDOfSTRING or:[ |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4123 |
targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4124 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4125 |
"/ the other view wants the selection as string |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4126 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4127 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4128 |
s := self selectionAsString. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4129 |
self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4130 |
sendSelection:s |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4131 |
property:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4132 |
target:targetID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4133 |
from:aView id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4134 |
to:windowID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4135 |
^ self |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4136 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4137 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4138 |
"/ |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4139 |
"/ send the seletion in binaryStore format |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4140 |
"/ (assuming, that the other view knows how to handle it) |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4141 |
"/ |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4142 |
o := self getCopyBuffer. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4143 |
stream := WriteStream on:(ByteArray new:200). |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4144 |
o storeBinaryOn:stream. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4145 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4146 |
self |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4147 |
sendSelection:(stream contents) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4148 |
property:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4149 |
target:(self atomIDOf:'ST_OBJECT' create:true) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4150 |
from:aView id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4151 |
to:windowID |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4152 |
! ! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4153 |
|
86 | 4154 |
!XWorkstation methodsFor:'event handling'! |
0 | 4155 |
|
4156 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
4157 |
"central event handling method: |
|
54 | 4158 |
get next event and send appropriate message to the sensor or view. |
0 | 4159 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
12 | 4160 |
otherwise only events for the view with given id are processed. |
4161 |
If the argument aMask is nonNil, only events for this eventMask are |
|
1871 | 4162 |
handled. |
4163 |
WARNING: this may block to wait for an event - you better check for a |
|
1906 | 4164 |
pending event before calling this." |
12 | 4165 |
|
54 | 4166 |
(self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[ |
1906 | 4167 |
AbortSignal handle:[:ex | |
4168 |
ex return |
|
4169 |
] do:[ |
|
4170 |
self dispatchLastEvent. |
|
4171 |
] |
|
54 | 4172 |
]. |
1489
f264f7852a8d
avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents:
1486
diff
changeset
|
4173 |
|
1871 | 4174 |
"Modified: 19.8.1997 / 17:10:42 / cg" |
12 | 4175 |
! |
4176 |
||
295 | 4177 |
dispatchExposeEventFor:aViewIdOrNil |
4178 |
"get next expose event and send appropriate message to the sensor or view. |
|
4179 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
1871 | 4180 |
otherwise only events for the view with given id are processed. |
4181 |
WARNING: this may block to wait for an event - you better check for a |
|
1906 | 4182 |
pending event before calling this." |
295 | 4183 |
|
4184 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
|
1871 | 4185 |
|
4186 |
"Modified: 19.8.1997 / 17:10:26 / cg" |
|
12 | 4187 |
! |
4188 |
||
4189 |
dispatchLastEvent |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4190 |
|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
|
4191 |
eventType| |
12 | 4192 |
|
4193 |
%{ /* STACK: 8000 */ |
|
4194 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
|
0 | 4195 |
|
1209 | 4196 |
Display *dpy; |
135 | 4197 |
OBJ eB; |
4198 |
XEvent *ev; |
|
1521
23aacd62bbac
care for GC before reaccessing the eventBuffer
Claus Gittinger <cg@exept.de>
parents:
1511
diff
changeset
|
4199 |
int ev_x, ev_y; |
135 | 4200 |
|
4201 |
# define ae ((XAnyEvent *)ev) |
|
4202 |
# define ee ((XExposeEvent *)ev) |
|
4203 |
# define ke ((XKeyPressedEvent *)ev) |
|
4204 |
# define be ((XButtonPressedEvent *)ev) |
|
4205 |
# define ce ((XConfigureEvent *)ev) |
|
4206 |
# define me ((XMotionEvent *)ev) |
|
4207 |
# define ewe ((XEnterWindowEvent *)ev) |
|
4208 |
# define lwe ((XLeaveWindowEvent *)ev) |
|
4209 |
# define de ((XDestroyWindowEvent *)ev) |
|
4210 |
# define ve ((XVisibilityEvent *)ev) |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4211 |
# define mape ((XMappingEvent *)ev) |
135 | 4212 |
|
0 | 4213 |
KeySym keySym; |
4214 |
unsigned char buffer[10]; |
|
4215 |
int i, nchars; |
|
4216 |
char *keySymString; |
|
4217 |
char keySymStringBuffer[32]; |
|
1832 | 4218 |
unsigned INT nextMultiClickTime; |
1223
09d8118c8031
keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
4219 |
OBJ upDown, t; |
115 | 4220 |
|
4221 |
struct inlineCache *ipS; |
|
0 | 4222 |
static struct inlineCache vid = _ILC1; |
12 | 4223 |
|
4224 |
static struct inlineCache expS = _ILC5; |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
4225 |
static struct inlineCache gexpS = _ILC6; |
12 | 4226 |
static struct inlineCache nexpS = _ILC1; |
4227 |
static struct inlineCache motS = _ILC4; |
|
4228 |
static struct inlineCache bpS = _ILC4; |
|
4229 |
static struct inlineCache bmpS = _ILC4; |
|
4230 |
static struct inlineCache bspS = _ILC4; |
|
4231 |
static struct inlineCache brS = _ILC4; |
|
4232 |
static struct inlineCache focInS = _ILC1; |
|
4233 |
static struct inlineCache focOutS = _ILC1; |
|
4234 |
static struct inlineCache peS = _ILC4; |
|
4235 |
static struct inlineCache plS = _ILC2; |
|
54 | 4236 |
static struct inlineCache termS = _ILC1; |
4237 |
static struct inlineCache savtermS = _ILC1; |
|
4238 |
static struct inlineCache destrS = _ILC1; |
|
4239 |
static struct inlineCache unmapS = _ILC1; |
|
4240 |
static struct inlineCache mapS = _ILC1; |
|
4241 |
static struct inlineCache confS = _ILC5; |
|
70 | 4242 |
static struct inlineCache coveredS = _ILC2; |
1543 | 4243 |
static struct inlineCache clientMsg = _ILC5; |
12 | 4244 |
|
4245 |
static struct inlineCache keymap = _ILC0; |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4246 |
static struct inlineCache created = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4247 |
static struct inlineCache mapReq = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4248 |
static struct inlineCache repar = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4249 |
static struct inlineCache confReq = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4250 |
static struct inlineCache resReq = _ILC1; |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
4251 |
static struct inlineCache circReq = _ILC1; |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
4252 |
static struct inlineCache circNotify = _ILC1; |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4253 |
static struct inlineCache gravNotify = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4254 |
static struct inlineCache prop = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4255 |
static struct inlineCache selClear = _ILC2; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4256 |
static struct inlineCache selReq = _ILC5; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4257 |
static struct inlineCache selNotify = _ILC5; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4258 |
static struct inlineCache colormap = _ILC1; |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4259 |
static struct inlineCache mapping = _ILC2; |
70 | 4260 |
static struct inlineCache vis = _ILC1; |
12 | 4261 |
|
4262 |
static struct inlineCache skpS = _ILC4; |
|
63 | 4263 |
static struct inlineCache skrS = _ILC4; |
12 | 4264 |
|
1209 | 4265 |
if (! ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4266 |
RETURN (false); |
1209 | 4267 |
} |
4268 |
||
4269 |
dpy = myDpy; |
|
4270 |
||
1210 | 4271 |
eB = __INST(eventBuffer); |
4272 |
||
135 | 4273 |
if (__isByteArray(eB)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4274 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
135 | 4275 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4276 |
printf("DISPLAY: no eventBuffer\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4277 |
RETURN (false); |
135 | 4278 |
} |
4279 |
||
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4280 |
/* |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4281 |
* very often, its another event for the same view ... |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4282 |
* avoid creation & lookup then. |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4283 |
*/ |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4284 |
if ((t = __INST(lastId)) != nil) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4285 |
if (__isExternalAddress(t)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4286 |
if (_WindowVal(t) == ae->window) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4287 |
theView = __INST(lastView); |
1610
8cbd780d9784
paranoia - check for collected lastView (should not happen)
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
4288 |
if (__isNonNilObject(theView)) { |
8cbd780d9784
paranoia - check for collected lastView (should not happen)
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
4289 |
if (__qClass(theView) == nil) { |
8cbd780d9784
paranoia - check for collected lastView (should not happen)
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
4290 |
theView = nil; |
8cbd780d9784
paranoia - check for collected lastView (should not happen)
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
4291 |
} |
8cbd780d9784
paranoia - check for collected lastView (should not happen)
Claus Gittinger <cg@exept.de>
parents:
1583
diff
changeset
|
4292 |
} |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4293 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4294 |
} |
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4295 |
} |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4296 |
|
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4297 |
if (theView == nil) { |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4298 |
windowID = __MKEXTERNALADDRESS(ae->window); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4299 |
theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4300 |
/* |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4301 |
* MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4302 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4303 |
eB = __INST(eventBuffer); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4304 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4305 |
} |
12 | 4306 |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4307 |
if ((theView == nil) && (ev->type != MappingNotify)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4308 |
RETURN (nil); |
12 | 4309 |
} |
4310 |
||
4311 |
/* |
|
4312 |
* key, button and pointer events are sent to the sensor, |
|
4313 |
* or (if there is none) to the delegate. |
|
4314 |
* or (if there is none) to the view. |
|
26 | 4315 |
* |
4316 |
* expose events are sent to the sensor, |
|
4317 |
* or (if there is none) to the view |
|
4318 |
* |
|
12 | 4319 |
* sensor and delegate get view as additional argument |
115 | 4320 |
* all of this has been taken out of here to corresponding methods |
4321 |
* in DeviceWorkstation. |
|
12 | 4322 |
*/ |
90 | 4323 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4324 |
#ifdef DEBUG |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4325 |
eventType = __MKSMALLINT(ev->type); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4326 |
#endif |
135 | 4327 |
switch (ev->type) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4328 |
case KeyRelease: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4329 |
symS = @symbol(keyRelease:x:y:view:); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4330 |
ipS = &skrS; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4331 |
upDown = false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4332 |
goto keyPressAndRelease; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4333 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4334 |
case KeyPress: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4335 |
symS = @symbol(keyPress:x:y:view:); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4336 |
ipS = &skpS; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4337 |
upDown = true; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4338 |
/* FALL INTO */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4339 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4340 |
keyPressAndRelease: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4341 |
__INST(eventRootX) = __MKSMALLINT(ke->x_root); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4342 |
__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
|
4343 |
#ifdef OLD |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4344 |
__INST(altDown) = (ke->state & Mod2Mask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4345 |
__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
|
4346 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4347 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4348 |
__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
|
4349 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4350 |
__INST(shiftDown) = (ke->state & ShiftMask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4351 |
__INST(ctrlDown) = (ke->state & ControlMask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4352 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4353 |
ev_x = ke->x; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4354 |
ev_y = ke->y; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4355 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4356 |
arg = nil; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4357 |
nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4358 |
if (nchars |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4359 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4360 |
|| (buffer[0] >= 0x80))) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4361 |
arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4362 |
keySymString = NULL; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4363 |
} else { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4364 |
#ifdef OLD |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4365 |
switch (keySym) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4366 |
case XK_Control_L: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4367 |
case XK_Control_R: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4368 |
__INST(ctrlDown) = upDown; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4369 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4370 |
case XK_Shift_L: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4371 |
case XK_Shift_R: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4372 |
__INST(shiftDown) = upDown; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4373 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4374 |
case XK_Meta_L: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4375 |
case XK_Meta_R: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4376 |
__INST(metaDown) = upDown; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4377 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4378 |
case XK_Alt_L: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4379 |
case XK_Alt_R: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4380 |
__INST(altDown) = upDown; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4381 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4382 |
} |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4383 |
#endif |
150 | 4384 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4385 |
keySymString = XKeysymToString(keySym); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4386 |
if (keySymString) { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4387 |
#ifdef OLD |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4388 |
if (keySymString[0] == 'D') { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4389 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4390 |
* remove underscore, dont want it in symbols |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4391 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4392 |
if (strcmp(keySymString, "Delete_line") == 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4393 |
keySymString = "DeleteLine"; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4394 |
} else if (strcmp(keySymString, "Delete_word") == 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4395 |
keySymString = "DeleteWord"; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4396 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4397 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4398 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4399 |
* make names compatible |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4400 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4401 |
if (strcmp(keySymString, "Down") == 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4402 |
keySymString = "CursorDown"; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4403 |
} else if (strcmp(keySymString, "Up") == 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4404 |
keySymString = "CursorUp"; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4405 |
} else if (strcmp(keySymString, "Left") == 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4406 |
keySymString = "CursorLeft"; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4407 |
} else if (strcmp(keySymString, "Right") == 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4408 |
keySymString = "CursorRight"; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4409 |
} |
1694 | 4410 |
arg = __MKSYMBOL(keySymString, (OBJ *)0); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4411 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4412 |
arg = __MKSTRING(keySymString); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4413 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4414 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4415 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4416 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4417 |
if (arg == nil) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4418 |
/* happens sometimes (alt-graph on sun has no keysym) */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4419 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4420 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4421 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4422 |
(*(*ipS).ilc_func)(self, symS, nil, ipS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4423 |
arg, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4424 |
__MKSMALLINT(ev_x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4425 |
__MKSMALLINT(ev_y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4426 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4427 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4428 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4429 |
case ButtonPress: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4430 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4431 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4432 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4433 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4434 |
if (__isSmallInteger(__INST(multiClickTimeDelta))) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4435 |
nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4436 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4437 |
nextMultiClickTime = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4438 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4439 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4440 |
if ((t = __INST(multiClickTime)) != nil) { |
1835 | 4441 |
INT _multiClickTime; |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4442 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4443 |
_multiClickTime = __longIntVal(t); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4444 |
if (be->time < _multiClickTime) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4445 |
__INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4446 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4447 |
* MKUINT could lead to a GC - refetch event ptr |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4448 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4449 |
eB = __INST(eventBuffer); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4450 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4451 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4452 |
ipS = &bmpS; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4453 |
symS = @symbol(buttonMultiPress:x:y:view:); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4454 |
goto sendButtonEvent; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4455 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4456 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4457 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4458 |
__INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4459 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4460 |
* MKUINT could lead to a GC - refetch event ptr |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4461 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4462 |
eB = __INST(eventBuffer); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4463 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1223
09d8118c8031
keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
4464 |
|
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
4465 |
#ifdef NO_LONGER |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4466 |
if (be->state & ShiftMask) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4467 |
ipS = &bspS; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4468 |
symS = @symbol(buttonShiftPress:x:y:view:); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4469 |
goto sendButtonEvent; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4470 |
} |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
4471 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4472 |
ipS = &bpS; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4473 |
symS = @symbol(buttonPress:x:y:view:); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4474 |
goto sendButtonEvent; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4475 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4476 |
/* NOT REACHED */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4477 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4478 |
case ButtonRelease: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4479 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4480 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4481 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4482 |
ipS = &brS; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4483 |
symS = @symbol(buttonRelease:x:y:view:); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4484 |
/* fall into */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4485 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4486 |
sendButtonEvent: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4487 |
butt = __MKSMALLINT(be->button); |
12 | 4488 |
#ifdef NOTDEF |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4489 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4490 |
* this allows operation with single button mouses: meta-click is always Button 2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4491 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4492 |
if (__INST(metaDown) == true) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4493 |
butt = __MKSMALLINT(2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4494 |
else |
0 | 4495 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4496 |
butt = __AT_(__INST(buttonTranslation), butt); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4497 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4498 |
* #at: could lead to a GC - refetch event ptr |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4499 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4500 |
eB = __INST(eventBuffer); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4501 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4502 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4503 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4504 |
(*(*ipS).ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4505 |
symS, nil, ipS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4506 |
butt, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4507 |
__MKSMALLINT(ke->x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4508 |
__MKSMALLINT(ke->y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4509 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4510 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4511 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4512 |
case MotionNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4513 |
if (__INST(motionEventCompression) != false) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4514 |
while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4515 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4516 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4517 |
__INST(eventRootX) = __MKSMALLINT(me->x_root); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4518 |
__INST(eventRootY) = __MKSMALLINT(me->y_root); |
70 | 4519 |
|
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4520 |
#ifdef OLD |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4521 |
__INST(altDown) = (me->state & Mod2Mask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4522 |
__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
|
4523 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4524 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4525 |
__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
|
4526 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4527 |
__INST(shiftDown) = (me->state & ShiftMask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4528 |
__INST(ctrlDown) = (me->state & ControlMask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4529 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4530 |
(*motS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4531 |
@symbol(buttonMotion:x:y:view:), nil, &motS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4532 |
__MKSMALLINT(me->state), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4533 |
__MKSMALLINT(me->x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4534 |
__MKSMALLINT(me->y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4535 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4536 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4537 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4538 |
case FocusIn: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4539 |
(*focInS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4540 |
@symbol(focusInView:), nil, &focInS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4541 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4542 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4543 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4544 |
case FocusOut: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4545 |
(*focOutS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4546 |
@symbol(focusOutView:), nil, &focOutS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4547 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4548 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4549 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4550 |
case EnterNotify: |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4551 |
#ifdef OLD |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4552 |
__INST(altDown) = (ewe->state & Mod2Mask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4553 |
__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
|
4554 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4555 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4556 |
__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
|
4557 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4558 |
__INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4559 |
__INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4560 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4561 |
(*peS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4562 |
@symbol(pointerEnter:x:y:view:), nil, &peS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4563 |
__MKSMALLINT(ewe->state), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4564 |
__MKSMALLINT(ewe->x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4565 |
__MKSMALLINT(ewe->y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4566 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4567 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4568 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4569 |
case LeaveNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4570 |
(*plS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4571 |
@symbol(pointerLeave:view:), nil, &plS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4572 |
__MKSMALLINT(lwe->state), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4573 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4574 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4575 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4576 |
case GraphicsExpose: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4577 |
(*gexpS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4578 |
@symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4579 |
__MKSMALLINT(ee->x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4580 |
__MKSMALLINT(ee->y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4581 |
__MKSMALLINT(ee->width), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4582 |
__MKSMALLINT(ee->height), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4583 |
ee->count == 0 ? true : false, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4584 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4585 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4586 |
if (ee->count != 0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4587 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4588 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4589 |
/* fall into */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4590 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4591 |
case NoExpose: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4592 |
(*nexpS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4593 |
@symbol(noExposeView:), nil, &nexpS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4594 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4595 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4596 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4597 |
case Expose: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4598 |
(*expS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4599 |
@symbol(exposeX:y:width:height:view:), nil, &expS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4600 |
__MKSMALLINT(ee->x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4601 |
__MKSMALLINT(ee->y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4602 |
__MKSMALLINT(ee->width), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4603 |
__MKSMALLINT(ee->height), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4604 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4605 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4606 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4607 |
case ConfigureNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4608 |
if (ce->above != None) { |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4609 |
siblingID = __MKEXTERNALADDRESS(ce->above); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4610 |
sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4611 |
/* |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4612 |
* MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4613 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4614 |
eB = __INST(eventBuffer); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4615 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4616 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4617 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4618 |
(*confS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4619 |
@symbol(configureX:y:width:height:view:), nil, &confS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4620 |
__MKSMALLINT(ce->x), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4621 |
__MKSMALLINT(ce->y), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4622 |
__MKSMALLINT(ce->width), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4623 |
__MKSMALLINT(ce->height), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4624 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4625 |
if (sibling != nil) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4626 |
(*coveredS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4627 |
@symbol(coveredBy:view:), nil, &coveredS, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4628 |
theView, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4629 |
sibling); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4630 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4631 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4632 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4633 |
case ClientMessage: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4634 |
if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4635 |
if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom))) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4636 |
|| (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4637 |
(*termS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4638 |
@symbol(terminateView:), nil, &termS, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4639 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4640 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4641 |
if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4642 |
(*savtermS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4643 |
@symbol(saveAndTerminateView:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4644 |
, nil, &savtermS, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4645 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4646 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4647 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4648 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4649 |
* any other client message |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4650 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4651 |
i = (char *)(&(ev->xclient.data)) - (char *)ev; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4652 |
(*clientMsg.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4653 |
@symbol(clientMessage:type:format:dataOffset:view:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4654 |
, nil, &clientMsg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4655 |
, __INST(eventBuffer) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4656 |
,__MKSMALLINT(ev->xclient.message_type) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4657 |
,__MKSMALLINT(ev->xclient.format) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4658 |
,__MKSMALLINT(i), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4659 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4660 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4661 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4662 |
case DestroyNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4663 |
(*destrS.ilc_func)(self, @symbol(destroyedView:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4664 |
, nil, &destrS, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4665 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4666 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4667 |
case UnmapNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4668 |
(*unmapS.ilc_func)(self, @symbol(unmappedView:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4669 |
, nil, &unmapS, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4670 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4671 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4672 |
case MapNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4673 |
(*mapS.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4674 |
@symbol(mappedView:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4675 |
, nil, &mapS, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4676 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4677 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4678 |
case KeymapNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4679 |
(*keymap.ilc_func)(theView, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4680 |
@symbol(keyMapChange) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4681 |
, nil, &keymap); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4682 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4683 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4684 |
case VisibilityNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4685 |
switch (ve->state) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4686 |
case VisibilityUnobscured: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4687 |
arg = @symbol(unobscured); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4688 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4689 |
case VisibilityPartiallyObscured: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4690 |
arg = @symbol(partiallyObscured); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4691 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4692 |
case VisibilityFullyObscured: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4693 |
arg = @symbol(fullyObscured); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4694 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4695 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4696 |
(*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4697 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4698 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4699 |
case CreateNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4700 |
(*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4701 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4702 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4703 |
case MapRequest: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4704 |
(*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4705 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4706 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4707 |
case ReparentNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4708 |
(*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4709 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4710 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4711 |
case ConfigureRequest: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4712 |
(*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4713 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4714 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4715 |
case GravityNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4716 |
(*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4717 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4718 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4719 |
case ResizeRequest: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4720 |
(*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4721 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4722 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4723 |
case CirculateNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4724 |
(*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4725 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4726 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4727 |
case CirculateRequest: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4728 |
(*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4729 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4730 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4731 |
case PropertyNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4732 |
(*prop.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4733 |
@symbol(propertyChangeView) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4734 |
, nil, &prop, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4735 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4736 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4737 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4738 |
case SelectionClear: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4739 |
selectionID = __MKATOMOBJ(ev->xselectionclear.selection); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4740 |
(*selClear.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4741 |
@symbol(selectionClear:view:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4742 |
, nil, &selClear, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4743 |
selectionID, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4744 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4745 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4746 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4747 |
case SelectionNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4748 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4749 |
* returned selection value (answer from SelectionRequest) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4750 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4751 |
DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4752 |
ev->xselection.property, ev->xselection.target, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4753 |
ev->xselection.selection, ev->xselection.requestor)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4754 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4755 |
propertyID = __MKATOMOBJ(ev->xselection.property); |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4756 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4757 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4758 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4759 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4760 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4761 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4762 |
targetID = __MKATOMOBJ(ev->xselection.target); |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4763 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4764 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4765 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4766 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4767 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4768 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4769 |
selectionID = __MKATOMOBJ(ev->xselection.selection); |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4770 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4771 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4772 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4773 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4774 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4775 |
|
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4776 |
requestorID = __MKEXTERNALADDRESS(ev->xselection.requestor); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4777 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4778 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4779 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4780 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4781 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4782 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4783 |
(*selNotify.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4784 |
@symbol(selectionNotify:target:selection:from:view:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4785 |
, nil, &selNotify, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4786 |
propertyID, targetID, selectionID, requestorID, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4787 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4788 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4789 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4790 |
case SelectionRequest: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4791 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4792 |
* someone wants the selection |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4793 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4794 |
DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4795 |
ev->xselectionrequest.property, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4796 |
ev->xselectionrequest.target, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4797 |
ev->xselectionrequest.selection, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4798 |
ev->xselectionrequest.requestor)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4799 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4800 |
propertyID = __MKATOMOBJ(ev->xselectionrequest.property); |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4801 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4802 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4803 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4804 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4805 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4806 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4807 |
targetID = __MKATOMOBJ(ev->xselectionrequest.target); |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4808 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4809 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4810 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4811 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4812 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4813 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4814 |
selectionID = __MKATOMOBJ(ev->xselectionrequest.selection); |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4815 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4816 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4817 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4818 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4819 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4820 |
|
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4821 |
requestorID = __MKEXTERNALADDRESS(ev->xselectionrequest.requestor); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4822 |
/* |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4823 |
* MKATOMOBJ could lead to a GC - refetch event ptr |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4824 |
*/ |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4825 |
eB = __INST(eventBuffer); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4826 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4827 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4828 |
(*selReq.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4829 |
@symbol(selectionRequest:target:selection:from:view:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4830 |
, nil, &selReq, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4831 |
propertyID, targetID, selectionID, requestorID, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4832 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4833 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4834 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4835 |
case ColormapNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4836 |
(*colormap.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4837 |
@symbol(colorMapChangeView:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4838 |
, nil, &colormap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4839 |
theView); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4840 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4841 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4842 |
case MappingNotify: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4843 |
switch(mape->request) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4844 |
case MappingModifier: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4845 |
arg = @symbol(mappingModifier); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4846 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4847 |
case MappingKeyboard: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4848 |
arg = @symbol(mappingKeyboard); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4849 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4850 |
case MappingPointer: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4851 |
arg = @symbol(mappingPointer); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4852 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4853 |
default: |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4854 |
arg = nil; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4855 |
break; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4856 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4857 |
(*mapping.ilc_func)(self, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4858 |
@symbol(mappingChanged:event:) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4859 |
, nil, &mapping, arg, eB); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4860 |
break; |
0 | 4861 |
} |
135 | 4862 |
#undef ae |
0 | 4863 |
#undef ee |
4864 |
#undef ke |
|
4865 |
#undef be |
|
4866 |
#undef ce |
|
4867 |
#undef me |
|
4868 |
#undef ewe |
|
4869 |
#undef lwe |
|
4870 |
#undef de |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4871 |
#undef mape |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
4872 |
%}. |
0 | 4873 |
^ true |
4874 |
! |
|
4875 |
||
1344 | 4876 |
dispatchPendingEvents |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4877 |
"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
|
4878 |
(i.e. this is now only used in the modal debugger) |
1871 | 4879 |
Dispatch any pending events; return when no more are pending. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4880 |
This code is somewhat special, since X has a concept of graphic |
295 | 4881 |
expose events (which are sent after a bitblt). After such a bitblt, |
4882 |
we only handle exposes until the graphicsExpose arrives. |
|
4883 |
Other systems may not need such a kludge" |
|
4884 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
4885 |
"interested in exposes only ?" |
295 | 4886 |
dispatchingExpose notNil ifTrue:[ |
1906 | 4887 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
4888 |
self dispatchExposeEventFor:dispatchingExpose |
|
4889 |
]. |
|
4890 |
^ self |
|
295 | 4891 |
]. |
4892 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4893 |
[self eventPendingWithSync:false] whileTrue:[ |
1906 | 4894 |
(self getEventFor:nil withMask:nil) ifTrue:[ |
4895 |
AbortSignal handle:[:ex | |
|
4896 |
ex return |
|
4897 |
] do:[ |
|
4898 |
self dispatchLastEvent |
|
4899 |
] |
|
4900 |
]. |
|
295 | 4901 |
] |
1489
f264f7852a8d
avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents:
1486
diff
changeset
|
4902 |
|
1871 | 4903 |
"Modified: 19.8.1997 / 17:11:18 / cg" |
295 | 4904 |
! |
4905 |
||
1344 | 4906 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
81 | 4907 |
"dispose (throw away) specific events. If aWindowId is nil, |
4908 |
events matching the mask are thrown away regardless of which |
|
4909 |
view they are for. Otherwise, only matching events for that |
|
4910 |
view are flushed." |
|
0 | 4911 |
|
4912 |
%{ /* NOCONTEXT */ |
|
4913 |
||
4914 |
XEvent ev; |
|
4915 |
Window win; |
|
4916 |
||
1209 | 4917 |
if (ISCONNECTED |
4918 |
&& __isSmallInteger(aMask)) { |
|
1344 | 4919 |
Display *dpy = myDpy; |
4920 |
||
1974 | 4921 |
ENTER_XLIB(); |
1344 | 4922 |
if (__isExternalAddress(aWindowIdOrNil)) { |
4923 |
win = _WindowVal(aWindowIdOrNil); |
|
4924 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
|
4925 |
} else { |
|
4926 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
|
4927 |
} |
|
1974 | 4928 |
LEAVE_XLIB(); |
1344 | 4929 |
RETURN ( self ); |
0 | 4930 |
} |
4931 |
%} |
|
4932 |
. |
|
4933 |
self primitiveFailed |
|
4934 |
! |
|
4935 |
||
1344 | 4936 |
eventMaskFor:anEventSymbol |
295 | 4937 |
"return the eventMask bit-constant corresponding to an event symbol" |
4938 |
||
4939 |
%{ /* NOCONTEXT */ |
|
4940 |
||
4941 |
int m = 0; |
|
4942 |
||
4943 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
|
4944 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
|
4945 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
|
4946 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
|
4947 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
|
4948 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
|
4949 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
|
4950 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
|
4951 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
|
4952 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
|
4953 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
|
4954 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
|
4955 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
|
4956 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
|
4957 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
|
4958 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
4959 |
RETURN (__MKSMALLINT(m)); |
295 | 4960 |
%} |
4961 |
! |
|
4962 |
||
1344 | 4963 |
eventPending |
310 | 4964 |
"return true, if any event is pending. |
4965 |
This looks for both the internal queue and the display connection." |
|
12 | 4966 |
|
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4967 |
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
|
4968 |
|
12 | 4969 |
dispatchingExpose notNil ifTrue:[ |
1344 | 4970 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
12 | 4971 |
]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4972 |
^ self eventPendingWithSync:false |
0 | 4973 |
! |
4974 |
||
1344 | 4975 |
eventPending:anEventSymbol for:aWindowIdOrNil |
295 | 4976 |
"return true, if a specific event is pending" |
4977 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4978 |
^ 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
|
4979 |
! |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
4980 |
|
1344 | 4981 |
eventPendingWithSync:doSync |
7 | 4982 |
"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
|
4983 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
310 | 4984 |
before checking." |
0 | 4985 |
|
12 | 4986 |
%{ /* UNLIMITEDSTACK */ |
1974 | 4987 |
OBJ rslt = false; |
0 | 4988 |
|
150 | 4989 |
if (ISCONNECTED) { |
1344 | 4990 |
Display *dpy = myDpy; |
4991 |
||
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
4992 |
if (XEventsQueued(dpy, QueuedAlready)) { |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
4993 |
RETURN (true); |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
4994 |
} |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
4995 |
|
1974 | 4996 |
ENTER_XLIB(); |
1344 | 4997 |
if (doSync == true) { |
4998 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
4999 |
} |
|
5000 |
if (XPending(dpy)) { |
|
1974 | 5001 |
rslt = true; |
5002 |
} |
|
5003 |
LEAVE_XLIB(); |
|
5004 |
} |
|
5005 |
RETURN ( rslt ); |
|
0 | 5006 |
%} |
5007 |
! |
|
5008 |
||
1344 | 5009 |
eventQueued |
341 | 5010 |
"return true, if any event is queued" |
5011 |
||
5012 |
dispatchingExpose notNil ifTrue:[ |
|
1344 | 5013 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
341 | 5014 |
]. |
5015 |
^ self eventQueuedAlready |
|
5016 |
||
5017 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
|
5018 |
! |
|
5019 |
||
1344 | 5020 |
eventQueuedAlready |
341 | 5021 |
"return true, if any event is queued internally. |
5022 |
(i.e. in X's internal event queue, which is both filled by explicit |
|
5023 |
nextEvent calls AND whenever drawing is done and events are pending on |
|
5024 |
the display connection)." |
|
5025 |
||
5026 |
%{ /* UNLIMITEDSTACK */ |
|
1974 | 5027 |
OBJ rslt = false; |
341 | 5028 |
|
5029 |
if (ISCONNECTED) { |
|
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5030 |
/* ENTER ... LEAVE not needed; XEventsQueued will not block */ |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5031 |
/* ENTER_XLIB(); */ |
1344 | 5032 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
1974 | 5033 |
rslt = true; |
5034 |
} |
|
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5035 |
/* LEAVE_XLIB(); */ |
341 | 5036 |
} |
5037 |
RETURN ( false ); |
|
5038 |
%} |
|
5039 |
! |
|
5040 |
||
1344 | 5041 |
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync |
295 | 5042 |
"return true, if any of the masked events is pending" |
5043 |
||
5044 |
%{ /* UNLIMITEDSTACK */ |
|
5045 |
||
5046 |
XEvent ev; |
|
5047 |
Window win; |
|
5048 |
int thereIsOne; |
|
1974 | 5049 |
OBJ rslt = false; |
295 | 5050 |
|
5051 |
if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
|
1344 | 5052 |
Display *dpy = myDpy; |
5053 |
||
1974 | 5054 |
ENTER_XLIB(); |
1344 | 5055 |
if (doSync == true) { |
5056 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5057 |
} |
|
5058 |
if (__isExternalAddress(aWindowIdOrNil)) { |
|
5059 |
win = _WindowVal(aWindowIdOrNil); |
|
5060 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
|
5061 |
} else { |
|
5062 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
|
5063 |
} |
|
5064 |
if (thereIsOne) { |
|
5065 |
XPutBackEvent(dpy, &ev); |
|
1974 | 5066 |
rslt = true; |
5067 |
} |
|
5068 |
LEAVE_XLIB(); |
|
5069 |
} |
|
5070 |
RETURN ( rslt ); |
|
295 | 5071 |
%} |
5072 |
! |
|
5073 |
||
1344 | 5074 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
310 | 5075 |
"return true, if any expose event is pending for a specific view, |
5076 |
or any view (if the arg is nil). |
|
5077 |
This is an X specific, only required after a scroll operation." |
|
7 | 5078 |
|
12 | 5079 |
%{ /* UNLIMITEDSTACK */ |
7 | 5080 |
|
5081 |
XEvent ev; |
|
5082 |
Window win; |
|
81 | 5083 |
int thereIsOne; |
1974 | 5084 |
OBJ rslt = false; |
81 | 5085 |
|
150 | 5086 |
if (ISCONNECTED) { |
1344 | 5087 |
Display *dpy = myDpy; |
5088 |
||
1974 | 5089 |
ENTER_XLIB(); |
1344 | 5090 |
if (doSync == true) { |
5091 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5092 |
} |
|
5093 |
if (__isExternalAddress(aWindowIdOrNil)) { |
|
5094 |
win = _WindowVal(aWindowIdOrNil); |
|
5095 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
|
5096 |
} else { |
|
5097 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
|
5098 |
} |
|
5099 |
if (thereIsOne) { |
|
5100 |
XPutBackEvent(dpy, &ev); |
|
1974 | 5101 |
rslt = true; |
5102 |
} |
|
5103 |
LEAVE_XLIB(); |
|
5104 |
} |
|
5105 |
RETURN ( rslt ); |
|
81 | 5106 |
%} |
5107 |
! |
|
5108 |
||
1344 | 5109 |
getEventFor:aViewIdOrNil withMask:eventMask |
295 | 5110 |
"read next event - put into local eventBuffer. |
5111 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
5112 |
otherwise only events for that specific view will be fetched. |
|
5113 |
Returns true, if there was an event, false otherwise. |
|
5114 |
This method may block - so you better check for pending events |
|
5115 |
before calling for it. |
|
5116 |
||
5117 |
Sorry I had to split dispatch into this fetch method and an extra |
|
5118 |
handle method to allow unlimitedstack here. |
|
5119 |
(some Xlibs do a big alloca there ...) which cannot be done in |
|
5120 |
dispatchLastEvent, since it dispatches out into ST-methods. |
|
5121 |
" |
|
81 | 5122 |
|
5123 |
%{ /* UNLIMITEDSTACK */ |
|
5124 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5125 |
Display *dpy; |
295 | 5126 |
Window win, wWanted; |
5127 |
int evMask; |
|
5128 |
OBJ eB; |
|
5129 |
XEvent *ev; |
|
5130 |
||
5131 |
if (! ISCONNECTED) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5132 |
RETURN (false); |
295 | 5133 |
} |
5134 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5135 |
dpy = myDpy; |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5136 |
|
555 | 5137 |
eB = __INST(eventBuffer); |
295 | 5138 |
if (__isByteArray(eB)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5139 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 5140 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5141 |
printf("DISPLAY: no eventBuffer\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5142 |
RETURN (false); |
295 | 5143 |
} |
5144 |
ev->type = 0; |
|
5145 |
||
5146 |
if (__isSmallInteger(eventMask)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5147 |
evMask = __intVal(eventMask); |
295 | 5148 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5149 |
evMask = ~0; |
295 | 5150 |
} |
5151 |
||
5152 |
if (__isExternalAddress(aViewIdOrNil)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5153 |
wWanted = _WindowVal(aViewIdOrNil); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5154 |
if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5155 |
RETURN ( true ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5156 |
} |
295 | 5157 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5158 |
if (evMask == ~0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5159 |
XNextEvent(dpy, ev); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5160 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5161 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5162 |
if (XCheckMaskEvent(dpy, evMask, ev)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5163 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5164 |
} |
295 | 5165 |
} |
5166 |
%}. |
|
5167 |
^ false |
|
5168 |
! |
|
5169 |
||
1344 | 5170 |
handleAllEvents |
295 | 5171 |
"from now on, handle any kind of event" |
5172 |
||
5173 |
dispatchingExpose := nil |
|
5174 |
! |
|
5175 |
||
1344 | 5176 |
handleExposeOnlyFor:aView |
295 | 5177 |
"from now on, handle expose events only" |
5178 |
||
5179 |
dispatchingExpose := aView id |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5180 |
! |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5181 |
|
1344 | 5182 |
mappingChanged:what event:eB |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5183 |
"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
|
5184 |
Tell xlib about the fact." |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5185 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5186 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
1344 | 5187 |
self refreshKeyboardMapping:eB. |
5188 |
"Maybe some of our modifiers have been changed" |
|
5189 |
self initializeModifierMappings. |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5190 |
]. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5191 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5192 |
"Created: 1.12.1995 / 16:28:23 / stefan" |
295 | 5193 |
! |
5194 |
||
1344 | 5195 |
setEventMask:aMask in:aWindowId |
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
5196 |
"tell X that we are only interested in events from aMask, which |
295 | 5197 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
5198 |
||
5199 |
%{ /* NOCONTEXT */ |
|
5200 |
||
5201 |
int mask; |
|
5202 |
||
1209 | 5203 |
if (ISCONNECTED |
5204 |
&& __isExternalAddress(aWindowId) |
|
295 | 5205 |
&& __isSmallInteger(aMask)) { |
1344 | 5206 |
mask = __intVal(aMask); |
295 | 5207 |
|
5208 |
#ifdef OLD |
|
1344 | 5209 |
/* these may not be disabled */ |
5210 |
mask |= ExposureMask | StructureNotifyMask | |
|
5211 |
KeyPressMask | KeyReleaseMask | |
|
5212 |
EnterWindowMask | LeaveWindowMask | |
|
5213 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
|
295 | 5214 |
#endif |
5215 |
||
1974 | 5216 |
ENTER_XLIB(); |
1344 | 5217 |
XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
1974 | 5218 |
LEAVE_XLIB(); |
1344 | 5219 |
RETURN ( self ); |
295 | 5220 |
} |
5221 |
%} |
|
5222 |
. |
|
5223 |
self primitiveFailed |
|
5224 |
! |
|
5225 |
||
1344 | 5226 |
startDispatch |
295 | 5227 |
"redefined to clear dispatchingExpose, which is a special X feature" |
5228 |
||
5229 |
dispatching ifTrue:[^ self]. |
|
5230 |
dispatchingExpose := nil. |
|
5231 |
super startDispatch |
|
0 | 5232 |
! ! |
295 | 5233 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5234 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5235 |
|
1567 | 5236 |
sendClientEvent:msgType format:msgFormat to:targetWindowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5 |
1556 | 5237 |
"send a ClientMessage to some other (possibly: non-ST/X) view. |
1567 | 5238 |
The client message gets message_type and msgFormat as specified by |
1556 | 5239 |
the arguments. The additional data arguments specify up to |
5240 |
5 longWords of user data; each may be an integer or nil. |
|
5241 |
It is passed transparently in the events data field. |
|
5242 |
See XProtocol specification for more details." |
|
5243 |
||
5244 |
"/ Event.xclient.type = ClientMessage; |
|
5245 |
"/ Event.xclient.display = dpy; |
|
5246 |
"/ Event.xclient.message_type = msgType; |
|
1567 | 5247 |
"/ Event.xclient.format = msgFormat; |
1556 | 5248 |
"/ Event.xclient.window = targetWindowID; |
5249 |
"/ Event.xclient.data.l[0] = d1 |
|
5250 |
"/ Event.xclient.data.l[1] = d2 |
|
5251 |
"/ Event.xclient.data.l[2] = d3 |
|
5252 |
"/ Event.xclient.data.l[3] = d4 |
|
5253 |
"/ Event.xclient.data.l[4] = d5 |
|
5254 |
"/ |
|
5255 |
"/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event); |
|
5256 |
||
5257 |
%{ /* NOCONTEXT */ |
|
5258 |
int type; |
|
5259 |
int state; |
|
5260 |
||
5261 |
if (ISCONNECTED |
|
5262 |
&& __isInteger(msgType) |
|
1567 | 5263 |
&& __isInteger(msgFormat) |
1556 | 5264 |
&& (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5265 |
Display *dpy = myDpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5266 |
XEvent ev; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5267 |
Status result; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5268 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5269 |
if (__isInteger(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5270 |
ev.xclient.data.l[0] = __longIntVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5271 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5272 |
if (__isExternalAddress(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5273 |
ev.xclient.data.l[0] = (int)__externalAddressVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5274 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5275 |
ev.xclient.data.l[0] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5276 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5277 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5278 |
if (__isInteger(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5279 |
ev.xclient.data.l[1] = __longIntVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5280 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5281 |
if (__isExternalAddress(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5282 |
ev.xclient.data.l[1] = (int)__externalAddressVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5283 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5284 |
ev.xclient.data.l[1] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5285 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5286 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5287 |
if (__isInteger(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5288 |
ev.xclient.data.l[2] = __longIntVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5289 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5290 |
if (__isExternalAddress(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5291 |
ev.xclient.data.l[2] = (int)__externalAddressVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5292 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5293 |
ev.xclient.data.l[2] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5294 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5295 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5296 |
if (__isInteger(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5297 |
ev.xclient.data.l[3] = __longIntVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5298 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5299 |
if (__isExternalAddress(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5300 |
ev.xclient.data.l[3] = (int)__externalAddressVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5301 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5302 |
ev.xclient.data.l[3] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5303 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5304 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5305 |
if (__isInteger(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5306 |
ev.xclient.data.l[4] = __longIntVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5307 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5308 |
if (__isExternalAddress(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5309 |
ev.xclient.data.l[4] = (int)__externalAddressVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5310 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5311 |
ev.xclient.data.l[4] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5312 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5313 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5314 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5315 |
if (__isExternalAddress(targetWindowID)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5316 |
ev.xclient.window = _WindowVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5317 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5318 |
ev.xclient.window = (Window)__longIntVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5319 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5320 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5321 |
ev.xclient.type = ClientMessage; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5322 |
ev.xclient.display = dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5323 |
ev.xclient.message_type = __longIntVal(msgType); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5324 |
ev.xclient.format = __longIntVal(msgFormat); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5325 |
|
1974 | 5326 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5327 |
result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev); |
1974 | 5328 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5329 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5330 |
if ((result == BadValue) || (result == BadWindow)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5331 |
DPRINTF(("bad status in sendClientEvent\n")); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5332 |
RETURN ( false ) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5333 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5334 |
RETURN (true) |
1556 | 5335 |
} |
5336 |
%}. |
|
5337 |
self primitiveFailed. |
|
5338 |
^ false |
|
5339 |
! |
|
5340 |
||
1344 | 5341 |
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5342 |
"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
|
5343 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5344 |
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
|
5345 |
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
|
5346 |
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
|
5347 |
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
|
5348 |
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
|
5349 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5350 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5351 |
%{ /* NOCONTEXT */ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5352 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5353 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5354 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5355 |
if (__isSmallInteger(stateMask)) { |
1344 | 5356 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5357 |
} else { |
1344 | 5358 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5359 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5360 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5361 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5362 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5363 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5364 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
1344 | 5365 |
Display *dpy = myDpy; |
5366 |
||
5367 |
XEvent ev; |
|
5368 |
Window target; |
|
5369 |
Status result; |
|
5370 |
KeySym keySym, *syms; |
|
5371 |
int screen = __intVal(__INST(screen)); |
|
5372 |
char s[2]; |
|
5373 |
int nSyms; |
|
5374 |
||
5375 |
if ((typeSymbol == @symbol(keyPress)) |
|
5376 |
|| (typeSymbol == @symbol(keyRelease))) { |
|
5377 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
|
5378 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
|
5379 |
} else { |
|
5380 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
|
5381 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
|
5382 |
s[1] = '\0'; |
|
5383 |
keySym = XStringToKeysym(s); |
|
5384 |
} else { |
|
5385 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
|
5386 |
} |
|
5387 |
} |
|
5388 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
|
5389 |
||
5390 |
if (stateMask == nil) { |
|
5391 |
/* |
|
5392 |
* get the modifier from the keySym |
|
5393 |
*/ |
|
5394 |
nSyms = 0; |
|
5395 |
syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
|
5396 |
if (syms) { |
|
5397 |
int i; |
|
5398 |
||
5399 |
for (i=0; i<nSyms; i++) { |
|
5400 |
if (syms[i] == keySym) { |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5401 |
#ifdef MODIFIERDEBUG |
1344 | 5402 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5403 |
#endif |
1344 | 5404 |
if (i) state = (1 << (i-1)); |
5405 |
break; |
|
5406 |
} |
|
5407 |
} |
|
5408 |
XFree(syms); |
|
5409 |
} |
|
5410 |
} |
|
5411 |
} else { |
|
5412 |
if ((typeSymbol == @symbol(buttonPress)) |
|
5413 |
|| (typeSymbol == @symbol(buttonRelease))) { |
|
5414 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
|
5415 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
|
5416 |
} else { |
|
5417 |
ev.xbutton.button = 1; |
|
5418 |
} |
|
5419 |
} else { |
|
5420 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
|
5421 |
RETURN (false); |
|
5422 |
} |
|
5423 |
} |
|
5424 |
||
5425 |
if (typeSymbol == @symbol(keyPress)) |
|
5426 |
ev.xany.type = KeyPress; |
|
5427 |
else if (typeSymbol == @symbol(keyRelease)) |
|
5428 |
ev.xany.type = KeyRelease; |
|
5429 |
else if (typeSymbol == @symbol(buttonPress)) |
|
5430 |
ev.xany.type = ButtonPress; |
|
5431 |
else if (typeSymbol == @symbol(buttonRelease)) |
|
5432 |
ev.xany.type = ButtonRelease; |
|
5433 |
||
5434 |
if (__isExternalAddress(targetId)) { |
|
5435 |
target = _WindowVal(targetId); |
|
5436 |
} else { |
|
5437 |
target = (Window) __longIntVal(targetId); |
|
5438 |
} |
|
5439 |
ev.xkey.window = target; |
|
5440 |
ev.xkey.same_screen = 1; |
|
5441 |
ev.xkey.subwindow = 0; |
|
5442 |
ev.xkey.root = RootWindow(myDpy, screen); |
|
5443 |
ev.xkey.x = __intVal(xPos); |
|
5444 |
ev.xkey.y = __intVal(yPos); |
|
5445 |
ev.xkey.state = state; |
|
5446 |
ev.xkey.time = CurrentTime; |
|
5447 |
||
1974 | 5448 |
ENTER_XLIB(); |
1344 | 5449 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
1974 | 5450 |
LEAVE_XLIB(); |
1344 | 5451 |
if ((result == BadValue) || (result == BadWindow)) { |
5452 |
DPRINTF(("bad status\n")); |
|
5453 |
RETURN ( false ) |
|
5454 |
} |
|
5455 |
RETURN (true) |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5456 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5457 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5458 |
self primitiveFailed. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5459 |
^ false |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5460 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5461 |
|
1344 | 5462 |
simulateKeyboardInput:aCharacterOrString inViewId:viewId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5463 |
"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
|
5464 |
events. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5465 |
Only a few control characters are supported. |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5466 |
Notice: not all alien views allow this kind of synthetic input; |
1344 | 5467 |
some simply ignore it." |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5468 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5469 |
|control code state| |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5470 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5471 |
aCharacterOrString isString ifTrue:[ |
1344 | 5472 |
aCharacterOrString do:[:char | |
5473 |
self simulateKeyboardInput:char inViewId:viewId |
|
5474 |
]. |
|
5475 |
^ self |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5476 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5477 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5478 |
control := false. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5479 |
code := aCharacterOrString asciiValue. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5480 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5481 |
(aCharacterOrString == Character cr) ifTrue:[ |
1344 | 5482 |
code := #Return |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5483 |
] ifFalse:[ |
1344 | 5484 |
(aCharacterOrString == Character tab) ifTrue:[ |
5485 |
code := #Tab |
|
5486 |
] ifFalse:[ |
|
5487 |
(aCharacterOrString == Character esc) ifTrue:[ |
|
5488 |
code := #Escape |
|
5489 |
] |
|
5490 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5491 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5492 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5493 |
control ifTrue:[ |
1344 | 5494 |
state := self controlMask |
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5495 |
]. |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5496 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5497 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5498 |
"/ the stuff below should not be needed |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5499 |
"/ (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
|
5500 |
"/ 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
|
5501 |
"/ Hopefully, this is correct ... |
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5502 |
|
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5503 |
code isNumber ifTrue:[ |
1344 | 5504 |
code >= $A asciiValue ifTrue:[ |
5505 |
code <= $Z asciiValue ifTrue:[ |
|
5506 |
state := self shiftMask |
|
5507 |
] |
|
5508 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5509 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5510 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5511 |
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
|
5512 |
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
|
5513 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5514 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5515 |
sending input to some (possibly alien) view: |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5516 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5517 |
|point id| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5518 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5519 |
point := Display pointFromUser. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5520 |
id := Display viewIdFromPoint:point. |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5521 |
Display simulateKeyboardInput:'Hello_world' inViewId:id |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5522 |
" |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5523 |
|
830
76fd3d86dd15
fix for stupid linux keyboardMapping bug (?)
Claus Gittinger <cg@exept.de>
parents:
823
diff
changeset
|
5524 |
"Modified: 11.6.1996 / 10:59:42 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5525 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5526 |
|
295 | 5527 |
!XWorkstation methodsFor:'font stuff'! |
5528 |
||
1344 | 5529 |
createFontFor:aFontName |
295 | 5530 |
"a basic method for X-font allocation; this method allows |
5531 |
any font to be aquired (even those not conforming to |
|
5532 |
standard naming conventions, such as cursor, fixed or k14)" |
|
5533 |
||
5534 |
%{ /* UNLIMITEDSTACK */ |
|
5535 |
/* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */ |
|
5536 |
||
5537 |
XFontStruct *newFont; |
|
5538 |
||
5539 |
if (ISCONNECTED) { |
|
1344 | 5540 |
if (__isString(aFontName) || __isSymbol(aFontName)) { |
5541 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 5542 |
ENTER_XLIB(); |
1344 | 5543 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
1974 | 5544 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5545 |
#ifdef COUNT_RESOURCES |
1344 | 5546 |
if (newFont) |
5547 |
__cnt_font++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5548 |
#endif |
1344 | 5549 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
5550 |
RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil ); |
1344 | 5551 |
} |
295 | 5552 |
} |
5553 |
%}. |
|
5554 |
^ nil |
|
5555 |
! |
|
5556 |
||
1344 | 5557 |
decomposeXFontName:aString into:aBlock |
295 | 5558 |
"extract family, face, style and size from an |
5559 |
X-font name |
|
5560 |
(-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); |
|
5561 |
evaluate aBlock with these" |
|
5562 |
||
5563 |
|origin family face style moreStyle skip fheight size |
|
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5564 |
resX resY x1 x2 registry encoding coding start end | |
295 | 5565 |
|
5566 |
aString isNil ifTrue:[^ false]. |
|
5567 |
(aString startsWith:'-') ifFalse:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5568 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5569 |
take care for ill-named fonts (i.e. pre Rel4 fonts) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5570 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5571 |
('*-*-[0-9]*' match:aString) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5572 |
end := aString indexOf:$- startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5573 |
family := aString copyFrom:1 to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5574 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5575 |
end := aString indexOf:$- startingAt:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5576 |
style := aString copyFrom:start to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5577 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5578 |
size := aString copyFrom:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5579 |
size := (Number readFromString:size onError:[^false]). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5580 |
aBlock value:family value:nil value:style value:size value:nil. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5581 |
^ true. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5582 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5583 |
('*-[0-9]*' match:aString) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5584 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5585 |
something like lucidasans-24 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5586 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5587 |
end := aString indexOf:$- startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5588 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5589 |
family := aString copyFrom:1 to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5590 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5591 |
size := aString copyFrom:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5592 |
size := (Number readFromString:size onError:[^false]). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5593 |
aBlock value:family value:nil value:nil value:size value:nil. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5594 |
^ true. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5595 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5596 |
aBlock value:aString value:nil value:nil value:nil value:nil. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5597 |
^ true. |
295 | 5598 |
]. |
5599 |
||
5600 |
end := aString indexOf:$- startingAt:2. |
|
5601 |
(end == 0) ifTrue:[^ false]. |
|
5602 |
origin := aString copyFrom:2 to:(end - 1). |
|
5603 |
||
5604 |
start := end + 1. |
|
5605 |
end := aString indexOf:$- startingAt:start. |
|
5606 |
(end == 0) ifTrue:[^ false]. |
|
5607 |
family := aString copyFrom:start to:(end - 1). |
|
5608 |
||
5609 |
start := end + 1. |
|
5610 |
end := aString indexOf:$- startingAt:start. |
|
5611 |
(end == 0) ifTrue:[^ false]. |
|
5612 |
face := aString copyFrom:start to:(end - 1). |
|
5613 |
||
5614 |
start := end + 1. |
|
5615 |
end := aString indexOf:$- startingAt:start. |
|
5616 |
(end == 0) ifTrue:[^ false]. |
|
5617 |
style := aString copyFrom:start to:(end - 1). |
|
5618 |
(style = 'o') ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5619 |
style := 'oblique' |
295 | 5620 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5621 |
(style = 'i') ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5622 |
style := 'italic' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5623 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5624 |
(style = 'r') ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5625 |
style := 'roman' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5626 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5627 |
] |
295 | 5628 |
]. |
5629 |
||
5630 |
start := end + 1. |
|
5631 |
end := aString indexOf:$- startingAt:start. |
|
5632 |
(end == 0) ifTrue:[^ false]. |
|
5633 |
moreStyle := aString copyFrom:start to:(end - 1). |
|
5634 |
||
5635 |
start := end + 1. |
|
5636 |
end := aString indexOf:$- startingAt:start. |
|
5637 |
(end == 0) ifTrue:[^ false]. |
|
5638 |
skip := aString copyFrom:start to:(end - 1). |
|
5639 |
||
5640 |
start := end + 1. |
|
5641 |
end := aString indexOf:$- startingAt:start. |
|
5642 |
(end == 0) ifTrue:[^ false]. |
|
5643 |
fheight := aString copyFrom:start to:(end - 1). |
|
5644 |
||
5645 |
start := end + 1. |
|
5646 |
end := aString indexOf:$- startingAt:start. |
|
5647 |
(end == 0) ifTrue:[^ false]. |
|
5648 |
size := aString copyFrom:start to:(end - 1). |
|
5649 |
size := (Number readFromString:size) / 10. |
|
5650 |
||
5651 |
start := end + 1. |
|
5652 |
end := aString indexOf:$- startingAt:start. |
|
5653 |
(end == 0) ifTrue:[^ false]. |
|
5654 |
resX := aString copyFrom:start to:(end - 1). |
|
5655 |
||
5656 |
start := end + 1. |
|
5657 |
end := aString indexOf:$- startingAt:start. |
|
5658 |
(end == 0) ifTrue:[^ false]. |
|
5659 |
resY := aString copyFrom:start to:(end - 1). |
|
5660 |
||
5661 |
start := end + 1. |
|
5662 |
end := aString indexOf:$- startingAt:start. |
|
5663 |
(end == 0) ifTrue:[^ false]. |
|
5664 |
x1 := aString copyFrom:start to:(end - 1). |
|
5665 |
||
5666 |
start := end + 1. |
|
5667 |
end := aString indexOf:$- startingAt:start. |
|
5668 |
(end == 0) ifTrue:[^ false]. |
|
5669 |
x2 := aString copyFrom:start to:(end - 1). |
|
5670 |
||
5671 |
start := end + 1. |
|
5672 |
end := aString indexOf:$- startingAt:start. |
|
5673 |
(end == 0) ifTrue:[^ false]. |
|
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5674 |
registry := aString copyFrom:start to:(end - 1). |
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5675 |
|
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5676 |
encoding := aString copyFrom:end + 1. |
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5677 |
|
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5678 |
coding := registry , '-' , encoding. |
295 | 5679 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5680 |
(moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5681 |
style := style, '-', moreStyle. |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5682 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5683 |
|
295 | 5684 |
aBlock value:family value:face value:style value:size value:coding. |
5685 |
^ true |
|
5686 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5687 |
"Modified: 4.7.1996 / 11:12:25 / stefan" |
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5688 |
"Modified: 10.4.1997 / 09:45:36 / cg" |
295 | 5689 |
! |
5690 |
||
1344 | 5691 |
encodingOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5692 |
"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
|
5693 |
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
|
5694 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5695 |
|enc fullName fontName registry encoding charSetCollections| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5696 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5697 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5698 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5699 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5700 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5701 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5702 |
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5703 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5704 |
if (ISCONNECTED) { |
1344 | 5705 |
Display *dpy = myDpy; |
5706 |
||
5707 |
registryAtom = XInternAtom(dpy, "CHARSET_REGISTRY", True); |
|
5708 |
encodingAtom = XInternAtom(dpy, "CHARSET_ENCODING", True); |
|
5709 |
charSetCollAtom = XInternAtom(dpy, "CHARSET_COLLECTIONS", True); |
|
5710 |
fontAtom = XInternAtom(dpy, "FONT", True); |
|
5711 |
||
5712 |
if (__isExternalAddress(aFontId)) { |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5713 |
|
1344 | 5714 |
f = _FontVal(aFontId); |
5715 |
if (f) { |
|
5716 |
n = f->n_properties; |
|
5717 |
prop = f->properties; |
|
5718 |
if (prop) { |
|
5719 |
while (n--) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5720 |
#ifdef SUPERDEBUG |
1344 | 5721 |
cp = XGetAtomName(dpy, prop->name); |
5722 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
5723 |
XFree(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5724 |
#endif |
1344 | 5725 |
if (prop->name == XA_FULL_NAME) { |
5726 |
cp = XGetAtomName(dpy, prop->card32); |
|
5727 |
if (cp) { |
|
5728 |
fullName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5729 |
#ifdef SUPERDEBUG |
1344 | 5730 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5731 |
#endif |
1344 | 5732 |
XFree(cp); |
5733 |
} |
|
5734 |
} else if (prop->name == fontAtom) { |
|
5735 |
cp = XGetAtomName(dpy, prop->card32); |
|
5736 |
if (cp) { |
|
5737 |
fontName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5738 |
#ifdef SUPERDEBUG |
1344 | 5739 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5740 |
#endif |
1344 | 5741 |
XFree(cp); |
5742 |
} |
|
5743 |
} else if (prop->name == encodingAtom) { |
|
5744 |
cp = XGetAtomName(dpy, prop->card32); |
|
5745 |
if (cp) { |
|
5746 |
encoding = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5747 |
#ifdef SUPERDEBUG |
1344 | 5748 |
printf(" ENCODING -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5749 |
#endif |
1344 | 5750 |
XFree(cp); |
5751 |
} |
|
5752 |
} else if (prop->name == registryAtom) { |
|
5753 |
cp = XGetAtomName(dpy, prop->card32); |
|
5754 |
if (cp) { |
|
5755 |
registry = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5756 |
#ifdef SUPERDEBUG |
1344 | 5757 |
printf(" REGISTRY -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5758 |
#endif |
1344 | 5759 |
XFree(cp); |
5760 |
} |
|
5761 |
} else if (prop->name == charSetCollAtom) { |
|
5762 |
cp = XGetAtomName(dpy, prop->card32); |
|
5763 |
if (cp) { |
|
5764 |
charSetCollections = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5765 |
#ifdef SUPERDEBUG |
1344 | 5766 |
printf(" CHARSET_COLLECTIONS -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5767 |
#endif |
1344 | 5768 |
XFree(cp); |
5769 |
} |
|
5770 |
} |
|
5771 |
prop++; |
|
5772 |
} |
|
5773 |
} |
|
5774 |
} |
|
5775 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5776 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5777 |
%}. |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5778 |
^ self |
1344 | 5779 |
extractEncodingFromRegistry:registry |
5780 |
encoding:encoding |
|
5781 |
charSetCollections:charSetCollections |
|
5782 |
! |
|
5783 |
||
5784 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
|
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5785 |
"this is pure magic ..." |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5786 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5787 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5788 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5789 |
(registry notNil and:[registry notEmpty]) ifTrue:[ |
1344 | 5790 |
enc := registry asLowercase asSymbol. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5791 |
] ifFalse:[ |
1344 | 5792 |
(encoding notNil and:[encoding notEmpty]) ifTrue:[ |
5793 |
enc := encoding asLowercase asSymbol |
|
5794 |
] ifFalse:[ |
|
5795 |
charSets := charSetCollections. |
|
5796 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
|
5797 |
charSets := charSets asUppercase asCollectionOfWords. |
|
5798 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
5799 |
enc := #iso8859 |
|
5800 |
] ifFalse:[ |
|
5801 |
(charSets includes:'ISO8859') ifTrue:[ |
|
5802 |
enc := #iso8859 |
|
5803 |
] ifFalse:[ |
|
5804 |
(charSets includes:'ASCII') ifTrue:[ |
|
5805 |
enc := #ascii |
|
5806 |
] ifFalse:[ |
|
5807 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
5808 |
enc := #iso8859 |
|
5809 |
] |
|
5810 |
] |
|
5811 |
] |
|
5812 |
] |
|
5813 |
] |
|
5814 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5815 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5816 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5817 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5818 |
"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
|
5819 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5820 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5821 |
|
1344 | 5822 |
flushListOfAvailableFonts |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5823 |
"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
|
5824 |
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
|
5825 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5826 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5827 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5828 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5829 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5830 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5831 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5832 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5833 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5834 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5835 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5836 |
|
1344 | 5837 |
fontMetricsOf:fontId into:aBlock |
991 | 5838 |
"evaluate aBlock, passing a fonts metrics as arguments" |
5839 |
||
5840 |
|encoding avgAscent avgDescent |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5841 |
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
|
5842 |
res resX resY| |
991 | 5843 |
|
994 | 5844 |
%{ |
991 | 5845 |
XFontStruct *f; |
5846 |
int len; |
|
5847 |
||
5848 |
if (ISCONNECTED) { |
|
1344 | 5849 |
if (__isExternalAddress(fontId)) { |
5850 |
f = _FontVal(fontId); |
|
5851 |
if (f) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5852 |
#ifdef NOTDEF |
1344 | 5853 |
char *cp; |
5854 |
XFontProp *prop; |
|
5855 |
||
5856 |
n = f->n_properties; |
|
5857 |
prop = f->properties; |
|
5858 |
||
5859 |
if (prop) { |
|
5860 |
while (n--) { |
|
5861 |
if (prop->name == RESOLUTION_X) { |
|
5862 |
resX = __MKSMALLINT(prop->card32); |
|
5863 |
} else if (prop->name == RESOLUTION_Y) { |
|
5864 |
resY = __MKSMALLINT(prop->card32); |
|
5865 |
} else if (prop->name == RESOLUTION) { |
|
5866 |
res = __MKSMALLINT(prop->card32); |
|
5867 |
} |
|
5868 |
prop++; |
|
5869 |
} |
|
5870 |
} |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5871 |
#endif |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5872 |
|
1344 | 5873 |
avgAscent = __MKSMALLINT(f->ascent); |
5874 |
avgDescent = __MKSMALLINT(f->descent); |
|
5875 |
maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
|
5876 |
maxDescent = __MKSMALLINT(f->max_bounds.descent); |
|
5877 |
minWidth = __MKSMALLINT(f->min_bounds.width); |
|
5878 |
maxWidth = __MKSMALLINT(f->max_bounds.width); |
|
5879 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 5880 |
ENTER_XLIB(); |
1344 | 5881 |
len = XTextWidth(f, " ", 1); |
1974 | 5882 |
LEAVE_XLIB(); |
1344 | 5883 |
END_INTERRUPTSBLOCKED |
5884 |
avgWidth = __MKSMALLINT( len ); |
|
5885 |
} |
|
5886 |
} |
|
991 | 5887 |
} |
5888 |
%}. |
|
5889 |
encoding := self encodingOf:fontId. |
|
5890 |
aBlock value:encoding |
|
1344 | 5891 |
value:avgAscent |
5892 |
value:avgDescent |
|
5893 |
value:maxAscent |
|
5894 |
value:maxDescent |
|
5895 |
value:minWidth |
|
5896 |
value:maxWidth |
|
5897 |
value:avgWidth |
|
5898 |
! |
|
5899 |
||
5900 |
fontResolutionOf:fontId |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5901 |
"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
|
5902 |
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
|
5903 |
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
|
5904 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5905 |
|res resX resY| |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5906 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5907 |
%{ |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5908 |
XFontStruct *f; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5909 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5910 |
if (ISCONNECTED) { |
1344 | 5911 |
Display *dpy = myDpy; |
5912 |
||
5913 |
if (__isExternalAddress(fontId)) { |
|
5914 |
f = _FontVal(fontId); |
|
5915 |
if (f) { |
|
5916 |
char *cp; |
|
5917 |
XFontProp *prop; |
|
5918 |
Atom resolutionXAtom, resolutionYAtom; |
|
5919 |
int n; |
|
5920 |
||
5921 |
n = f->n_properties; |
|
5922 |
prop = f->properties; |
|
5923 |
||
5924 |
if (prop) { |
|
5925 |
resolutionXAtom = XInternAtom(dpy, "RESOLUTION_X", True); |
|
5926 |
resolutionYAtom = XInternAtom(dpy, "RESOLUTION_Y", True); |
|
5927 |
||
5928 |
while (n--) { |
|
5929 |
if (prop->name == resolutionXAtom) { |
|
5930 |
resX = __MKSMALLINT(prop->card32); |
|
5931 |
} else if (prop->name == resolutionYAtom) { |
|
5932 |
resY = __MKSMALLINT(prop->card32); |
|
5933 |
} else if (prop->name == XA_RESOLUTION) { |
|
5934 |
res = __MKSMALLINT(prop->card32); |
|
5935 |
} |
|
5936 |
prop++; |
|
5937 |
} |
|
5938 |
} |
|
5939 |
} |
|
5940 |
} |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5941 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5942 |
%}. |
1046 | 5943 |
(resX notNil and:[resY notNil]) ifTrue:[ |
1344 | 5944 |
^ resX @ resY |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5945 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5946 |
res notNil ifTrue:[ |
1344 | 5947 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5948 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5949 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5950 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5951 |
|
1344 | 5952 |
fullNameOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5953 |
"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
|
5954 |
used for user feed-back (for example: in the fontPanel). |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5955 |
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
|
5956 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5957 |
|fullName fontName| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5958 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5959 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5960 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5961 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5962 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5963 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5964 |
Atom fontAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5965 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5966 |
if (ISCONNECTED) { |
1344 | 5967 |
Display *dpy = myDpy; |
5968 |
||
5969 |
fontAtom = XInternAtom(dpy, "FONT", True); |
|
5970 |
||
5971 |
if (__isExternalAddress(aFontId)) { |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5972 |
|
1344 | 5973 |
f = _FontVal(aFontId); |
5974 |
if (f) { |
|
5975 |
n = f->n_properties; |
|
5976 |
prop = f->properties; |
|
5977 |
if (prop) { |
|
5978 |
while (n--) { |
|
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
5979 |
#ifdef SUPERDEBUG |
1344 | 5980 |
cp = XGetAtomName(dpy, prop->name); |
5981 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
5982 |
XFree(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5983 |
#endif |
1344 | 5984 |
if (prop->name == XA_FULL_NAME) { |
5985 |
cp = XGetAtomName(dpy, prop->card32); |
|
5986 |
if (cp) { |
|
5987 |
fullName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5988 |
#ifdef SUPERDEBUG |
1344 | 5989 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5990 |
#endif |
1344 | 5991 |
XFree(cp); |
5992 |
} |
|
5993 |
} |
|
5994 |
if (prop->name == fontAtom) { |
|
5995 |
cp = XGetAtomName(dpy, prop->card32); |
|
5996 |
if (cp) { |
|
5997 |
fontName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5998 |
#ifdef SUPERDEBUG |
1344 | 5999 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6000 |
#endif |
1344 | 6001 |
XFree(cp); |
6002 |
} |
|
6003 |
} |
|
6004 |
prop++; |
|
6005 |
} |
|
6006 |
} |
|
6007 |
} |
|
6008 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6009 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6010 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6011 |
(fullName notNil and:[fullName notEmpty]) ifTrue:[ |
1344 | 6012 |
^ fullName |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6013 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6014 |
^ fontName |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6015 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6016 |
|
1344 | 6017 |
getAvailableFontsMatching:pattern |
295 | 6018 |
"return an Array filled with font names matching aPattern" |
6019 |
||
6020 |
%{ /* UNLIMITEDSTACK */ |
|
6021 |
||
6022 |
int nnames = 1500; |
|
6023 |
int available = nnames + 1; |
|
6024 |
char **fonts; |
|
6025 |
OBJ arr, str; |
|
6026 |
int i; |
|
6027 |
||
6028 |
if (ISCONNECTED) { |
|
1344 | 6029 |
if (__isString(pattern)) { |
6030 |
for (;;) { |
|
6031 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
6032 |
if ((fonts == NULL) || (available < nnames)) break; |
|
6033 |
XFreeFontNames(fonts); |
|
6034 |
nnames = available * 2; |
|
6035 |
} |
|
6036 |
if (fonts == NULL) { |
|
6037 |
RETURN ( nil ); |
|
6038 |
} |
|
6039 |
/* |
|
6040 |
* now, that we know the number of font names, |
|
6041 |
* create the array ... |
|
6042 |
*/ |
|
6043 |
arr = __ARRAY_NEW_INT(available); |
|
6044 |
if (! arr) { |
|
6045 |
RETURN (nil); |
|
6046 |
} |
|
6047 |
/* |
|
6048 |
* ... and fill it |
|
6049 |
*/ |
|
6050 |
for (i=0; i<available; i++) { |
|
6051 |
__PROTECT__(arr); |
|
6052 |
str = __MKSTRING(fonts[i]); |
|
6053 |
__UNPROTECT__(arr); |
|
6054 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
|
6055 |
} |
|
6056 |
RETURN (arr); |
|
6057 |
} |
|
295 | 6058 |
} |
6059 |
%}. |
|
6060 |
^ nil |
|
6061 |
! |
|
6062 |
||
1344 | 6063 |
getDefaultFont |
295 | 6064 |
"return a default font id - used when class Font cannot |
6065 |
find anything usable" |
|
6066 |
||
6067 |
^ self createFontFor:'fixed' |
|
6068 |
! |
|
6069 |
||
1344 | 6070 |
getFontWithFamily:familyString face:faceString |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6071 |
style:styleArgString size:sizeArg encoding:encoding |
295 | 6072 |
|
6073 |
"try to get the specified font, if not available, try next smaller |
|
6074 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
6075 |
as family and the other parameters as nil. For example, the cursor font |
|
6076 |
can be aquired that way." |
|
6077 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6078 |
|styleString theName theId xlatedStyle |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6079 |
id spacing encodingMatch registryMatch idx| |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6080 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6081 |
styleString := styleArgString. |
295 | 6082 |
|
6083 |
"special: if face is nil, allow access to X-fonts" |
|
6084 |
faceString isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6085 |
sizeArg notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6086 |
theName := familyString , '-' , sizeArg printString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6087 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6088 |
theName := familyString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6089 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6090 |
theName isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6091 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6092 |
mhmh - fall back to the default font |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6093 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6094 |
theName := 'fixed' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6095 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6096 |
theId := self createFontFor:theName. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6097 |
theId isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6098 |
theId := self getDefaultFont |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6099 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6100 |
^ theId |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6101 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6102 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6103 |
"/ 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
|
6104 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6105 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6106 |
(styleString notNil |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6107 |
and:[(styleString endsWith:'-narrow') |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6108 |
or:[styleString endsWith:'-semicondensed']]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6109 |
|i| |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6110 |
i := styleString lastIndexOf:$-. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6111 |
spacing := styleString copyFrom:(i+1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6112 |
styleString := styleString copyTo:(i-1). |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6113 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6114 |
spacing := 'normal'. |
295 | 6115 |
]. |
6116 |
||
6117 |
xlatedStyle := styleString. |
|
6118 |
xlatedStyle notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6119 |
xlatedStyle := xlatedStyle first asString |
295 | 6120 |
]. |
6121 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6122 |
encodingMatch := encoding. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6123 |
registryMatch := '*'. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6124 |
encoding isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6125 |
encodingMatch := '*'. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6126 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6127 |
idx := encoding indexOf:$-. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6128 |
idx ~~ 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6129 |
encodingMatch := encoding copyTo:idx - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6130 |
registryMatch := encoding copyFrom:idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6131 |
]. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6132 |
]. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6133 |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6134 |
id := self |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6135 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6136 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6137 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6138 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6139 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6140 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6141 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6142 |
registry:encodingMatch |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6143 |
encoding:registryMatch. |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6144 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6145 |
id isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6146 |
(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6147 |
"/ too stupid: encodings come in both cases |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6148 |
"/ and X does not ignore case |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6149 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6150 |
id := self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6151 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6152 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6153 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6154 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6155 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6156 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6157 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6158 |
registry:encodingMatch asUppercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6159 |
encoding:registryMatch. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6160 |
id isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6161 |
id := self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6162 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6163 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6164 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6165 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6166 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6167 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6168 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6169 |
registry:encodingMatch asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6170 |
encoding:registryMatch. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6171 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6172 |
] |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6173 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6174 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6175 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6176 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6177 |
"Modified: 10.4.1997 / 19:20:06 / cg" |
295 | 6178 |
! |
6179 |
||
1344 | 6180 |
getFontWithFoundry:foundry family:family weight:weight |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6181 |
slant:slant spacing:spc pixelSize:pSize size:size |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6182 |
registry:registry encoding:encoding |
295 | 6183 |
|
6184 |
"get the specified font, if not available, return nil. |
|
6185 |
This is the new font creation method - all others will be changed to |
|
6186 |
use this entry. |
|
6187 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
6188 |
||
6189 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
6190 |
family: 'helvetica' 'courier' 'times' ... |
|
6191 |
weight: 'bold' 'medium' 'demi' ... |
|
6192 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
6193 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
6194 |
pixelSize: 16,18 ... usually left empty |
|
6195 |
size: size in point (1/72th of an inch) |
|
6196 |
registry: iso8859, sgi ... '*' |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6197 |
encoding: registry specific encoding (usually '*') |
295 | 6198 |
" |
6199 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6200 |
|theName sizeMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6201 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
1099 | 6202 |
pSizeMatch registryMatch encodingMatch| |
295 | 6203 |
|
6204 |
"this works only on 'Release >= 3' - X-servers" |
|
6205 |
"name is: |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6206 |
-foundry-family -weight -slant- |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6207 |
sony helvetica bold r |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6208 |
adobe courier medium i |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6209 |
msic fixed o |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6210 |
... ... |
295 | 6211 |
" |
6212 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6213 |
size isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6214 |
sizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6215 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6216 |
sizeMatch := size printString , '0' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6217 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6218 |
foundry isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6219 |
foundryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6220 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6221 |
foundryMatch := foundry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6222 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6223 |
family isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6224 |
familyMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6225 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6226 |
familyMatch := family |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6227 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6228 |
weight isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6229 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6230 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6231 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6232 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6233 |
slant isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6234 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6235 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6236 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6237 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6238 |
spc isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6239 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6240 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6241 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6242 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6243 |
pSize isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6244 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6245 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6246 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6247 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6248 |
registry isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6249 |
registryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6250 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6251 |
registryMatch := registry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6252 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6253 |
encoding isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6254 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6255 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6256 |
encodingMatch := encoding |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6257 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6258 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6259 |
theName := ('-' , foundryMatch, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6260 |
'-' , familyMatch, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6261 |
'-' , weightMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6262 |
'-' , slantMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6263 |
'-' , spcMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6264 |
'-*' , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6265 |
'-' , pSizeMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6266 |
'-' , sizeMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6267 |
'-*-*-*-*' , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6268 |
'-' , registryMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6269 |
'-' , encodingMatch). |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6270 |
|
697 | 6271 |
"/ Transcript showCR:theName; endEntry. |
295 | 6272 |
|
6273 |
^ self createFontFor:theName. |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6274 |
|
295 | 6275 |
|
6276 |
" |
|
6277 |
Display getFontWithFoundry:'*' |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6278 |
family:'courier' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6279 |
weight:'medium' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6280 |
slant:'r' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6281 |
spacing:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6282 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6283 |
size:13 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6284 |
registry:'iso8859' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6285 |
encoding:'*' |
295 | 6286 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6287 |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6288 |
"Modified: 10.4.1997 / 19:15:44 / cg" |
295 | 6289 |
! |
6290 |
||
1344 | 6291 |
listOfAvailableFonts |
295 | 6292 |
"return a list with all available fonts on this display. |
6293 |
Since this takes a long time, keep the result of the query for the |
|
6294 |
next time. The elements of the returned collection are instances of |
|
6295 |
FontDescription." |
|
6296 |
||
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
6297 |
|"stream aName fntDescr" names| |
295 | 6298 |
|
6299 |
listOfXFonts isNil ifTrue:[ |
|
6300 |
"/ |
|
6301 |
"/ old code; using a pipe to xlsfonts |
|
6302 |
"/ |
|
6303 |
"/ stream := PipeStream readingFrom:'xlsfonts ''*'''. |
|
6304 |
"/ stream isNil ifTrue:[^ nil]. |
|
6305 |
"/ listOfXFonts := OrderedCollection new. |
|
6306 |
"/ [stream atEnd] whileFalse:[ |
|
6307 |
"/ aName := stream nextLine. |
|
6308 |
"/ aName notNil ifTrue:[ |
|
6309 |
"/ self decomposeXFontName:aName into: |
|
6310 |
"/ [:family :face :style :size :coding | |
|
6311 |
"/ family notNil ifTrue:[ |
|
6312 |
"/ fntDescr := FontDescription |
|
6313 |
"/ family:family |
|
6314 |
"/ face:face |
|
6315 |
"/ style:style |
|
6316 |
"/ size:size |
|
6317 |
"/ encoding:coding. |
|
6318 |
"/ listOfXFonts add:fntDescr |
|
6319 |
"/ ] |
|
6320 |
"/ ] |
|
6321 |
"/ ] |
|
6322 |
"/ ]. |
|
6323 |
"/ stream close. |
|
6324 |
"/ "if xlsfont is broken ... (hey sco)" |
|
6325 |
"/ (listOfXFonts size == 0) ifTrue:[ |
|
6326 |
"/ listOfXFonts := nil |
|
6327 |
"/ ] ifFalse:[ |
|
6328 |
"/ listOfXFonts sort:[:a :b | a family < b family]. |
|
6329 |
"/ ]. |
|
6330 |
||
1344 | 6331 |
"/ |
6332 |
"/ new code: |
|
6333 |
"/ use new primitive to get font names; |
|
6334 |
"/ this is much faster, and also works on systems where |
|
6335 |
"/ a) xlsfonts is broken (sco) |
|
6336 |
"/ b) xlsfonts is not available (aix) |
|
6337 |
"/ |
|
6338 |
names := self getAvailableFontsMatching:'*'. |
|
6339 |
names isNil ifTrue:[ |
|
6340 |
"no names returned ..." |
|
6341 |
^ nil |
|
6342 |
]. |
|
6343 |
listOfXFonts := names collect:[:aName | |
|
6344 |
|fntDescr| |
|
6345 |
||
6346 |
(self decomposeXFontName:aName into: |
|
6347 |
[:family :face :style :size :coding | |
|
6348 |
family notNil ifTrue:[ |
|
6349 |
fntDescr := FontDescription |
|
6350 |
family:family |
|
6351 |
face:face |
|
6352 |
style:style |
|
6353 |
size:size |
|
6354 |
encoding:coding. |
|
6355 |
] ifFalse:[ |
|
6356 |
fntDescr := FontDescription |
|
6357 |
name:aName |
|
6358 |
] |
|
6359 |
] |
|
6360 |
) ifFalse:[ |
|
6361 |
fntDescr := FontDescription name:aName. |
|
6362 |
]. |
|
6363 |
fntDescr |
|
6364 |
]. |
|
295 | 6365 |
|
6366 |
]. |
|
6367 |
^ listOfXFonts |
|
6368 |
||
6369 |
" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6370 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6371 |
|
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6372 |
Display getAvailableFontsMatching:'*'. |
295 | 6373 |
" |
6374 |
||
6375 |
"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
|
6376 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 6377 |
! |
6378 |
||
1344 | 6379 |
releaseFont:aFontId |
295 | 6380 |
|
6381 |
%{ /* NOCONTEXT */ |
|
6382 |
||
6383 |
XFontStruct *f; |
|
6384 |
||
1212 | 6385 |
if (! ISCONNECTED) { |
1344 | 6386 |
RETURN ( self ); |
1212 | 6387 |
} |
6388 |
||
6389 |
if (__isExternalAddress(aFontId)) { |
|
1344 | 6390 |
f = _FontVal(aFontId); |
6391 |
if (f) { |
|
6392 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6393 |
ENTER_XLIB(); |
1344 | 6394 |
XFreeFont(myDpy, f); |
1974 | 6395 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6396 |
#ifdef COUNT_RESOURCES |
1344 | 6397 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6398 |
#endif |
1344 | 6399 |
END_INTERRUPTSBLOCKED |
6400 |
RETURN ( self ); |
|
6401 |
} |
|
295 | 6402 |
} |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6403 |
%}. |
295 | 6404 |
self primitiveFailed |
6405 |
! |
|
6406 |
||
1344 | 6407 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 6408 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
6409 |
on this display. |
|
6410 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
6411 |
||
6412 |
|sizes| |
|
6413 |
||
466 | 6414 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 6415 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
1344 | 6416 |
"special: in X11R5 and above, size 0 means: |
6417 |
there are scaled versions in all sizes available" |
|
6418 |
||
6419 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64) |
|
295 | 6420 |
]. |
6421 |
^ sizes |
|
6422 |
||
6423 |
" |
|
6424 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
6425 |
" |
|
466 | 6426 |
|
6427 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 6428 |
! |
6429 |
||
1344 | 6430 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
295 | 6431 |
|
6432 |
%{ /* NOCONTEXT */ |
|
6433 |
||
6434 |
XFontStruct *f; |
|
6435 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6436 |
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
|
6437 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6438 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6439 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6440 |
int nInstBytes; |
295 | 6441 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6442 |
if (ISCONNECTED) { |
1344 | 6443 |
if (__bothSmallInteger(index1, index2) |
6444 |
&& __isExternalAddress(aFontId) |
|
6445 |
&& __isNonNilObject(aString)) { |
|
6446 |
f = _FontVal(aFontId); |
|
6447 |
if (! f) goto fail; |
|
6448 |
||
6449 |
i1 = __intVal(index1) - 1; |
|
6450 |
cls = __qClass(aString); |
|
6451 |
||
6452 |
if (i1 >= 0) { |
|
6453 |
i2 = __intVal(index2) - 1; |
|
6454 |
if (i2 < i1) { |
|
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6455 |
RETURN ( __MKSMALLINT(0) ); |
1344 | 6456 |
} |
6457 |
||
1831 | 6458 |
cp = (char *) __stringVal(aString); |
1344 | 6459 |
l = i2 - i1 + 1; |
6460 |
||
6461 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
6462 |
n = __stringSize(aString); |
1344 | 6463 |
if (i2 < n) { |
6464 |
cp += i1; |
|
6465 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6466 |
ENTER_XLIB(); |
1344 | 6467 |
len = XTextWidth(f, cp, l); |
1974 | 6468 |
LEAVE_XLIB(); |
1344 | 6469 |
END_INTERRUPTSBLOCKED |
6470 |
RETURN ( __MKSMALLINT(len) ); |
|
6471 |
} |
|
6472 |
} |
|
6473 |
||
6474 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6475 |
cp += nInstBytes; |
|
6476 |
||
6477 |
if (__isBytes(aString)) { |
|
6478 |
n = __byteArraySize(aString) - nInstBytes; |
|
6479 |
if (i2 < n) { |
|
6480 |
cp += i1; |
|
6481 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6482 |
ENTER_XLIB(); |
1344 | 6483 |
len = XTextWidth(f, cp, l); |
1974 | 6484 |
LEAVE_XLIB(); |
1344 | 6485 |
END_INTERRUPTSBLOCKED |
6486 |
RETURN ( __MKSMALLINT(len) ); |
|
6487 |
} |
|
6488 |
} |
|
6489 |
||
6490 |
/* TWOBYTESTRINGS */ |
|
6491 |
if (__isWords(aString)) { |
|
6492 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6493 |
||
6494 |
if (i2 < n) { |
|
6495 |
union { |
|
6496 |
char b[2]; |
|
6497 |
unsigned short s; |
|
6498 |
} u; |
|
6499 |
int i; |
|
6500 |
XChar2b *cp2 = (XChar2b *)0; |
|
6501 |
int mustFree = 0; |
|
6502 |
||
6503 |
cp += (i1 * 2); |
|
6504 |
if (l > 1000) l = 1000; |
|
6505 |
||
6506 |
/* |
|
6507 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6508 |
* X expects them MSB first |
|
6509 |
* convert as required |
|
6510 |
*/ |
|
6511 |
||
6512 |
u.s = 0x1234; |
|
6513 |
if (u.b[0] != 0x12) { |
|
6514 |
if (l <= NLOCALBUFFER) { |
|
6515 |
cp2 = xlatebuffer; |
|
6516 |
} else { |
|
6517 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
6518 |
mustFree = 1; |
|
6519 |
} |
|
6520 |
for (i=0; i<l; i++) { |
|
6521 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6522 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6523 |
} |
|
6524 |
cp = (char *) cp2; |
|
6525 |
} |
|
6526 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6527 |
ENTER_XLIB(); |
1344 | 6528 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
1974 | 6529 |
LEAVE_XLIB(); |
1344 | 6530 |
END_INTERRUPTSBLOCKED |
6531 |
||
6532 |
if (mustFree) { |
|
6533 |
free(cp2); |
|
6534 |
} |
|
6535 |
||
6536 |
RETURN ( __MKSMALLINT(len) ); |
|
6537 |
} |
|
6538 |
} |
|
6539 |
} |
|
6540 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6541 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6542 |
#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
|
6543 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6544 |
%}. |
295 | 6545 |
self primitiveFailed. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6546 |
^ 0 |
295 | 6547 |
! |
6548 |
||
1344 | 6549 |
widthOf:aString inFont:aFontId |
295 | 6550 |
|
6551 |
%{ /* NOCONTEXT */ |
|
6552 |
||
6553 |
XFontStruct *f; |
|
6554 |
char *cp; |
|
6555 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
6556 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6557 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6558 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6559 |
int nInstBytes; |
295 | 6560 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6561 |
if (ISCONNECTED) { |
1344 | 6562 |
if (__isExternalAddress(aFontId) |
6563 |
&& __isNonNilObject(aString)) { |
|
6564 |
f = _FontVal(aFontId); |
|
6565 |
if (! f) goto fail; |
|
6566 |
||
6567 |
cls = __qClass(aString); |
|
6568 |
||
1831 | 6569 |
cp = (char *) __stringVal(aString); |
1344 | 6570 |
|
6571 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
2011
47e72d42226b
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
2007
diff
changeset
|
6572 |
n = __stringSize(aString); |
1344 | 6573 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6574 |
ENTER_XLIB(); |
1344 | 6575 |
len = XTextWidth(f, cp, n); |
1974 | 6576 |
LEAVE_XLIB(); |
1344 | 6577 |
END_INTERRUPTSBLOCKED |
6578 |
RETURN ( __MKSMALLINT(len) ); |
|
6579 |
} |
|
6580 |
||
6581 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6582 |
cp += nInstBytes; |
|
6583 |
||
6584 |
if (__isBytes(aString)) { |
|
6585 |
n = __byteArraySize(aString) - nInstBytes; |
|
6586 |
||
6587 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6588 |
ENTER_XLIB(); |
1344 | 6589 |
len = XTextWidth(f, cp, n); |
1974 | 6590 |
LEAVE_XLIB(); |
1344 | 6591 |
END_INTERRUPTSBLOCKED |
6592 |
RETURN ( __MKSMALLINT(len) ); |
|
6593 |
} |
|
6594 |
||
6595 |
/* TWOBYTESTRINGS */ |
|
6596 |
if (__isWords(aString)) { |
|
6597 |
union { |
|
6598 |
char b[2]; |
|
6599 |
unsigned short s; |
|
6600 |
} u; |
|
6601 |
int i; |
|
6602 |
XChar2b *cp2; |
|
6603 |
int mustFree = 0; |
|
6604 |
||
6605 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6606 |
if (n > 1000) n = 1000; |
|
6607 |
||
6608 |
/* |
|
6609 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6610 |
* X expects them MSB first |
|
6611 |
* convert as required |
|
6612 |
*/ |
|
6613 |
||
6614 |
u.s = 0x1234; |
|
6615 |
if (u.b[0] != 0x12) { |
|
6616 |
if (n <= NLOCALBUFFER) { |
|
6617 |
cp2 = xlatebuffer; |
|
6618 |
} else { |
|
6619 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
6620 |
mustFree = 1; |
|
6621 |
} |
|
6622 |
||
6623 |
for (i=0; i<n; i++) { |
|
6624 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6625 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6626 |
} |
|
6627 |
cp = (char *) cp2; |
|
6628 |
} |
|
6629 |
||
6630 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6631 |
ENTER_XLIB(); |
1344 | 6632 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
1974 | 6633 |
LEAVE_XLIB(); |
1344 | 6634 |
END_INTERRUPTSBLOCKED |
6635 |
||
6636 |
if (mustFree) { |
|
6637 |
free(cp2); |
|
6638 |
} |
|
6639 |
||
6640 |
RETURN ( __MKSMALLINT(len) ); |
|
6641 |
} |
|
6642 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6643 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6644 |
#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
|
6645 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6646 |
%}. |
295 | 6647 |
self primitiveFailed. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6648 |
^ 0 |
295 | 6649 |
! ! |
6650 |
||
6651 |
!XWorkstation methodsFor:'grabbing '! |
|
6652 |
||
1344 | 6653 |
allowEvents:mode |
295 | 6654 |
%{ /* NOCONTEXT */ |
6655 |
||
6656 |
int _mode, ok = 1; |
|
6657 |
||
6658 |
if (mode == @symbol(asyncPointer)) |
|
1344 | 6659 |
_mode = AsyncPointer; |
295 | 6660 |
else if (mode == @symbol(syncPointer)) |
1344 | 6661 |
_mode = SyncPointer; |
295 | 6662 |
else if (mode == @symbol(asyncKeyboard)) |
1344 | 6663 |
_mode = AsyncKeyboard; |
295 | 6664 |
else if (mode == @symbol(syncKeyboard)) |
1344 | 6665 |
_mode = SyncKeyboard; |
295 | 6666 |
else if (mode == @symbol(syncBoth)) |
1344 | 6667 |
_mode = SyncBoth; |
295 | 6668 |
else if (mode == @symbol(asyncBoth)) |
1344 | 6669 |
_mode = AsyncBoth; |
295 | 6670 |
else if (mode == @symbol(replayPointer)) |
1344 | 6671 |
_mode = ReplayPointer; |
295 | 6672 |
else if (mode == @symbol(replayKeyboard)) |
1344 | 6673 |
_mode = ReplayKeyboard; |
295 | 6674 |
else |
1344 | 6675 |
ok = 0; |
295 | 6676 |
|
6677 |
if (ok) { |
|
1344 | 6678 |
if (ISCONNECTED) { |
6679 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6680 |
ENTER_XLIB(); |
1344 | 6681 |
XAllowEvents(myDpy, _mode, CurrentTime); |
1974 | 6682 |
LEAVE_XLIB(); |
1344 | 6683 |
END_INTERRUPTSBLOCKED |
6684 |
RETURN (self); |
|
6685 |
} |
|
295 | 6686 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6687 |
%}. |
295 | 6688 |
self primitiveFailed |
6689 |
! |
|
6690 |
||
1344 | 6691 |
grabKeyboardIn:aWindowId |
295 | 6692 |
"grab the keyboard" |
6693 |
||
6694 |
%{ /* NOCONTEXT */ |
|
6695 |
int result, ok; |
|
6696 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6697 |
if (ISCONNECTED) { |
1344 | 6698 |
if (__isExternalAddress(aWindowId)) { |
6699 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6700 |
ENTER_XLIB(); |
1344 | 6701 |
result = XGrabKeyboard(myDpy, |
6702 |
_WindowVal(aWindowId), |
|
6703 |
True /* False */, |
|
6704 |
GrabModeAsync, |
|
6705 |
GrabModeAsync, |
|
6706 |
CurrentTime); |
|
1974 | 6707 |
LEAVE_XLIB(); |
1344 | 6708 |
END_INTERRUPTSBLOCKED |
6709 |
ok = 0; |
|
6710 |
switch(result) { |
|
6711 |
case AlreadyGrabbed: |
|
6712 |
if (@global(ErrorPrinting) == true) { |
|
6713 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
|
6714 |
} |
|
6715 |
break; |
|
6716 |
case GrabNotViewable: |
|
6717 |
if (@global(ErrorPrinting) == true) { |
|
6718 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
|
6719 |
} |
|
6720 |
break; |
|
6721 |
case GrabInvalidTime: |
|
6722 |
if (@global(ErrorPrinting) == true) { |
|
6723 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
|
6724 |
} |
|
6725 |
break; |
|
6726 |
case GrabFrozen: |
|
6727 |
if (@global(ErrorPrinting) == true) { |
|
6728 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
|
6729 |
} |
|
6730 |
break; |
|
6731 |
default: |
|
6732 |
ok = 1; |
|
6733 |
break; |
|
6734 |
} |
|
6735 |
if (! ok) { |
|
1974 | 6736 |
ENTER_XLIB(); |
1344 | 6737 |
XUngrabKeyboard(myDpy, CurrentTime); |
1974 | 6738 |
LEAVE_XLIB(); |
1344 | 6739 |
RETURN (false); |
6740 |
} |
|
6741 |
||
6742 |
RETURN ( true ); |
|
6743 |
} |
|
295 | 6744 |
} |
1183 | 6745 |
%}. |
295 | 6746 |
self primitiveFailed |
6747 |
! |
|
6748 |
||
1344 | 6749 |
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
295 | 6750 |
"grap the pointer - return true if ok" |
6751 |
||
6752 |
%{ /* NOCONTEXT */ |
|
6753 |
||
6754 |
int result, ok; |
|
6755 |
Window confineWin; |
|
6756 |
Cursor curs; |
|
6757 |
int pointer_mode, keyboard_mode; |
|
6758 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6759 |
if (ISCONNECTED) { |
1344 | 6760 |
if (__isExternalAddress(aWindowId)) { |
6761 |
if (__isExternalAddress(confineId)) |
|
6762 |
confineWin = _WindowVal(confineId); |
|
6763 |
else |
|
6764 |
confineWin = (Window) None; |
|
6765 |
||
6766 |
if (__isExternalAddress(aCursorId)) |
|
6767 |
curs = _CursorVal(aCursorId); |
|
6768 |
else |
|
6769 |
curs = (Cursor) None; |
|
6770 |
||
6771 |
if (pMode == @symbol(sync)) |
|
6772 |
pointer_mode = GrabModeSync; |
|
6773 |
else |
|
6774 |
pointer_mode = GrabModeAsync; |
|
6775 |
||
6776 |
if (kMode == @symbol(sync)) |
|
6777 |
keyboard_mode = GrabModeSync; |
|
6778 |
else |
|
6779 |
keyboard_mode = GrabModeAsync; |
|
6780 |
||
6781 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6782 |
ENTER_XLIB(); |
1344 | 6783 |
result = XGrabPointer(myDpy, |
6784 |
_WindowVal(aWindowId), |
|
6785 |
False, |
|
6786 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask, |
|
6787 |
pointer_mode, keyboard_mode, |
|
6788 |
confineWin, |
|
6789 |
curs, |
|
6790 |
CurrentTime); |
|
1974 | 6791 |
LEAVE_XLIB(); |
1344 | 6792 |
END_INTERRUPTSBLOCKED |
6793 |
||
6794 |
ok = 0; |
|
6795 |
switch (result) { |
|
6796 |
case AlreadyGrabbed: |
|
6797 |
if (@global(ErrorPrinting) == true) { |
|
6798 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
|
6799 |
} |
|
6800 |
break; |
|
6801 |
case GrabNotViewable: |
|
6802 |
if (@global(ErrorPrinting) == true) { |
|
6803 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
|
6804 |
} |
|
6805 |
break; |
|
6806 |
case GrabInvalidTime: |
|
6807 |
if (@global(ErrorPrinting) == true) { |
|
6808 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
|
6809 |
} |
|
6810 |
break; |
|
6811 |
case GrabFrozen: |
|
6812 |
if (@global(ErrorPrinting) == true) { |
|
6813 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
|
6814 |
} |
|
6815 |
break; |
|
6816 |
default: |
|
6817 |
ok = 1; |
|
6818 |
break; |
|
6819 |
} |
|
6820 |
||
6821 |
if (! ok) { |
|
1974 | 6822 |
ENTER_XLIB(); |
1344 | 6823 |
XUngrabPointer(myDpy, CurrentTime); |
1974 | 6824 |
LEAVE_XLIB(); |
1344 | 6825 |
RETURN (false); |
6826 |
} |
|
6827 |
RETURN ( true ); |
|
6828 |
} |
|
295 | 6829 |
} |
1183 | 6830 |
%}. |
295 | 6831 |
self primitiveFailed |
6832 |
! |
|
6833 |
||
1344 | 6834 |
ungrabKeyboard |
295 | 6835 |
"release the keyboard" |
6836 |
||
6837 |
%{ /* NOCONTEXT */ |
|
6838 |
||
6839 |
if (ISCONNECTED) { |
|
1344 | 6840 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6841 |
ENTER_XLIB(); |
1344 | 6842 |
XUngrabKeyboard(myDpy, CurrentTime); |
6843 |
XSync(myDpy, 0); |
|
1974 | 6844 |
LEAVE_XLIB(); |
1344 | 6845 |
END_INTERRUPTSBLOCKED |
295 | 6846 |
} |
6847 |
%}. |
|
6848 |
activeKeyboardGrab := nil |
|
6849 |
! |
|
6850 |
||
1344 | 6851 |
ungrabPointer |
295 | 6852 |
"release the pointer" |
6853 |
||
6854 |
%{ /* NOCONTEXT */ |
|
6855 |
||
6856 |
if (ISCONNECTED) { |
|
1344 | 6857 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6858 |
ENTER_XLIB(); |
1344 | 6859 |
XUngrabPointer(myDpy, CurrentTime); |
6860 |
XSync(myDpy, 0); |
|
1974 | 6861 |
LEAVE_XLIB(); |
1344 | 6862 |
END_INTERRUPTSBLOCKED |
295 | 6863 |
} |
6864 |
%}. |
|
6865 |
activePointerGrab := nil |
|
6866 |
! ! |
|
6867 |
||
6868 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
6869 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
6870 |
noClipIn:aDrawableId gc:aGCId |
295 | 6871 |
"disable clipping rectangle" |
6872 |
||
6873 |
%{ /* NOCONTEXT */ |
|
6874 |
||
6875 |
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
|
6876 |
GC gc; |
295 | 6877 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6878 |
if (ISCONNECTED) { |
1344 | 6879 |
if (__isExternalAddress(aGCId)) { |
6880 |
gc = _GCVal(aGCId); |
|
6881 |
gcv.clip_mask = None; |
|
1974 | 6882 |
ENTER_XLIB(); |
1344 | 6883 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
1974 | 6884 |
LEAVE_XLIB(); |
1344 | 6885 |
RETURN ( self ); |
6886 |
} |
|
295 | 6887 |
} |
6888 |
%}. |
|
6889 |
self primitiveFailed |
|
6890 |
! |
|
6891 |
||
1344 | 6892 |
setBackground:bgColorIndex in:aGCId |
295 | 6893 |
"set background color to be drawn with" |
6894 |
||
6895 |
%{ /* NOCONTEXT */ |
|
6896 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6897 |
if (ISCONNECTED) { |
1344 | 6898 |
if (__isExternalAddress(aGCId) |
6899 |
&& __isSmallInteger(bgColorIndex)) { |
|
1974 | 6900 |
ENTER_XLIB(); |
1344 | 6901 |
XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); |
1974 | 6902 |
LEAVE_XLIB(); |
1344 | 6903 |
RETURN ( self ); |
6904 |
} |
|
295 | 6905 |
} |
6906 |
%}. |
|
6907 |
self primitiveFailed |
|
6908 |
! |
|
6909 |
||
1344 | 6910 |
setBitmapMask:aBitmapId in:aGCId |
295 | 6911 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
6912 |
||
6913 |
%{ /* NOCONTEXT */ |
|
6914 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
6915 |
GC gc; |
295 | 6916 |
Pixmap bitmap; |
6917 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6918 |
if (ISCONNECTED) { |
1344 | 6919 |
Display *dpy = myDpy; |
6920 |
||
6921 |
if (__isExternalAddress(aGCId)) { |
|
6922 |
gc = _GCVal(aGCId); |
|
6923 |
if (__isExternalAddress(aBitmapId)) { |
|
6924 |
bitmap = _PixmapVal(aBitmapId); |
|
1974 | 6925 |
ENTER_XLIB(); |
1344 | 6926 |
XSetStipple(dpy, gc, bitmap); |
6927 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
1974 | 6928 |
LEAVE_XLIB(); |
1344 | 6929 |
RETURN ( self ); |
6930 |
} |
|
6931 |
if (aBitmapId == nil) { |
|
1974 | 6932 |
ENTER_XLIB(); |
1344 | 6933 |
XSetFillStyle(dpy, gc, FillSolid); |
1974 | 6934 |
LEAVE_XLIB(); |
1344 | 6935 |
RETURN ( self ); |
6936 |
} |
|
6937 |
} |
|
295 | 6938 |
} |
6939 |
%}. |
|
6940 |
self primitiveFailed |
|
6941 |
! |
|
6942 |
||
1681
069ede63fb19
pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
6943 |
setClipByChildren:aBool in:aDrawableId gc:aGCId |
295 | 6944 |
"enable/disable drawing into child views" |
6945 |
||
6946 |
%{ /* NOCONTEXT */ |
|
6947 |
||
6948 |
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
|
6949 |
GC gc; |
295 | 6950 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6951 |
if (ISCONNECTED) { |
1694 | 6952 |
if (__isExternalAddress(aGCId)) { |
6953 |
gc = _GCVal(aGCId); |
|
6954 |
if (aBool == true) |
|
6955 |
gcv.subwindow_mode = ClipByChildren; |
|
6956 |
else |
|
6957 |
gcv.subwindow_mode = IncludeInferiors; |
|
6958 |
||
1974 | 6959 |
ENTER_XLIB(); |
1694 | 6960 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
1974 | 6961 |
LEAVE_XLIB(); |
1694 | 6962 |
RETURN ( self ); |
6963 |
} |
|
295 | 6964 |
} |
6965 |
%}. |
|
6966 |
self primitiveFailed |
|
6967 |
! |
|
6968 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
6969 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId |
295 | 6970 |
"clip to a rectangle" |
6971 |
||
6972 |
%{ /* NOCONTEXT */ |
|
6973 |
||
6974 |
XRectangle r; |
|
6975 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6976 |
if (ISCONNECTED) { |
1344 | 6977 |
if (__isExternalAddress(aGCId) |
6978 |
&& __bothSmallInteger(clipX, clipY) |
|
6979 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
6980 |
r.x = __intVal(clipX); |
|
6981 |
r.y = __intVal(clipY); |
|
6982 |
r.width = __intVal(clipWidth); |
|
6983 |
r.height = __intVal(clipHeight); |
|
1974 | 6984 |
ENTER_XLIB(); |
1344 | 6985 |
XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
1974 | 6986 |
LEAVE_XLIB(); |
1344 | 6987 |
RETURN ( self ); |
6988 |
} |
|
295 | 6989 |
} |
6990 |
%}. |
|
6991 |
self primitiveFailed |
|
6992 |
! |
|
6993 |
||
1344 | 6994 |
setDashes:dashList dashOffset:offset in:aGCId |
788 | 6995 |
"set line attributes" |
6996 |
||
6997 |
%{ /* NOCONTEXT */ |
|
6998 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6999 |
if (ISCONNECTED) { |
1344 | 7000 |
if (__isExternalAddress(aGCId) |
7001 |
&& __isSmallInteger(offset) |
|
7002 |
&& __isByteArray(dashList)) { |
|
1974 | 7003 |
ENTER_XLIB(); |
1344 | 7004 |
XSetDashes(myDpy, _GCVal(aGCId), |
7005 |
__intVal(offset), |
|
7006 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
7007 |
__byteArraySize(dashList)); |
|
1974 | 7008 |
LEAVE_XLIB(); |
1344 | 7009 |
RETURN ( self ); |
7010 |
} |
|
788 | 7011 |
} |
7012 |
bad: ; |
|
7013 |
%}. |
|
7014 |
" |
|
7015 |
either aGCId is invalid, |
|
7016 |
and/or dashList is not a byteArray |
|
7017 |
and/or offset is not a smallInteger |
|
7018 |
" |
|
7019 |
self primitiveFailed |
|
7020 |
! |
|
7021 |
||
1344 | 7022 |
setFont:aFontId in:aGCId |
295 | 7023 |
"set font to be drawn in" |
7024 |
||
7025 |
%{ /* NOCONTEXT */ |
|
7026 |
||
7027 |
XFontStruct *f; |
|
7028 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7029 |
if (ISCONNECTED) { |
1344 | 7030 |
if (__isExternalAddress(aFontId) |
7031 |
&& __isExternalAddress(aGCId)) { |
|
7032 |
f = (XFontStruct *) _FontVal(aFontId); |
|
1974 | 7033 |
ENTER_XLIB(); |
1344 | 7034 |
XSetFont(myDpy, _GCVal(aGCId), f->fid); |
1974 | 7035 |
LEAVE_XLIB(); |
1344 | 7036 |
RETURN ( self ); |
7037 |
} |
|
295 | 7038 |
} |
7039 |
%}. |
|
7040 |
" |
|
7041 |
aGCId and/or aFontId are invalid |
|
7042 |
" |
|
7043 |
self primitiveFailed |
|
7044 |
! |
|
7045 |
||
1344 | 7046 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
295 | 7047 |
"set foreground and background colors to be drawn with" |
7048 |
||
7049 |
%{ /* NOCONTEXT */ |
|
7050 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7051 |
GC gc; |
295 | 7052 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7053 |
if (ISCONNECTED) { |
1344 | 7054 |
Display *dpy = myDpy; |
7055 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
7056 |
&& __isExternalAddress(aGCId)) { |
|
7057 |
gc = _GCVal(aGCId); |
|
7058 |
||
1974 | 7059 |
ENTER_XLIB(); |
1344 | 7060 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
7061 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
1974 | 7062 |
LEAVE_XLIB(); |
1344 | 7063 |
RETURN ( self ); |
7064 |
} |
|
295 | 7065 |
} |
7066 |
%}. |
|
7067 |
self primitiveFailed |
|
7068 |
! |
|
7069 |
||
1344 | 7070 |
setForeground:fgColorIndex in:aGCId |
295 | 7071 |
"set foreground color to be drawn with" |
7072 |
||
7073 |
%{ /* NOCONTEXT */ |
|
7074 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7075 |
if (ISCONNECTED) { |
1344 | 7076 |
if (__isExternalAddress(aGCId) |
7077 |
&& __isSmallInteger(fgColorIndex)) { |
|
1974 | 7078 |
ENTER_XLIB(); |
1344 | 7079 |
XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); |
1974 | 7080 |
LEAVE_XLIB(); |
1344 | 7081 |
RETURN ( self ); |
7082 |
} |
|
295 | 7083 |
} |
7084 |
%}. |
|
7085 |
self primitiveFailed |
|
7086 |
! |
|
7087 |
||
1344 | 7088 |
setFunction:aFunctionSymbol in:aGCId |
295 | 7089 |
"set alu function to be drawn with" |
7090 |
||
7091 |
%{ /* NOCONTEXT */ |
|
7092 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7093 |
GC gc; |
295 | 7094 |
int fun = -1; |
7095 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7096 |
if (ISCONNECTED) { |
1344 | 7097 |
if (__isExternalAddress(aGCId)) { |
7098 |
gc = _GCVal(aGCId); |
|
7099 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
|
7100 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
|
7101 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
|
7102 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
|
7103 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
|
7104 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
|
7105 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
|
7106 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
|
7107 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
|
7108 |
if (fun != -1) { |
|
1974 | 7109 |
ENTER_XLIB(); |
1344 | 7110 |
XSetFunction(myDpy, gc, fun); |
1974 | 7111 |
LEAVE_XLIB(); |
1344 | 7112 |
RETURN ( self ); |
7113 |
} |
|
7114 |
} |
|
295 | 7115 |
} |
7116 |
%}. |
|
7117 |
" |
|
7118 |
either aGCId is not an integer, or an invalid symbol |
|
7119 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
7120 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
7121 |
" |
|
7122 |
self primitiveFailed |
|
7123 |
! |
|
7124 |
||
1344 | 7125 |
setGraphicsExposures:aBoolean in:aGCId |
295 | 7126 |
"set or clear the graphics exposures flag" |
7127 |
||
7128 |
%{ /* NOCONTEXT */ |
|
7129 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7130 |
if (ISCONNECTED) { |
1344 | 7131 |
if (__isExternalAddress(aGCId)) { |
1974 | 7132 |
ENTER_XLIB(); |
1344 | 7133 |
XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); |
1974 | 7134 |
LEAVE_XLIB(); |
1344 | 7135 |
RETURN ( self ); |
7136 |
} |
|
295 | 7137 |
} |
7138 |
%} |
|
7139 |
. |
|
7140 |
self primitiveFailed |
|
7141 |
! |
|
7142 |
||
1344 | 7143 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
1455 | 7144 |
"set line attributes; |
7145 |
lineStyle must be one of #solid, #dashed or #doubleDashed; |
|
7146 |
capStyle one of: #notLast, #butt, #round or #projecting; |
|
7147 |
joinStyle one of: #miter, #bevel or #round." |
|
295 | 7148 |
|
7149 |
%{ /* NOCONTEXT */ |
|
7150 |
||
7151 |
int x_style, x_cap, x_join; |
|
7152 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7153 |
if (ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7154 |
if (__isExternalAddress(aGCId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7155 |
&& __isSmallInteger(aNumber)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7156 |
if (lineStyle == @symbol(solid)) x_style = LineSolid; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7157 |
else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7158 |
else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7159 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7160 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7161 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7162 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7163 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7164 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7165 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7166 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7167 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7168 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7169 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7170 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7171 |
|
1974 | 7172 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7173 |
XSetLineAttributes(myDpy, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7174 |
_GCVal(aGCId), __intVal(aNumber), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7175 |
x_style, x_cap, x_join); |
1974 | 7176 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7177 |
RETURN ( self ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7178 |
} |
295 | 7179 |
} |
7180 |
bad: ; |
|
7181 |
%}. |
|
7182 |
" |
|
7183 |
either aGCId is invalid, |
|
1455 | 7184 |
and/or lineWidth is not a smallInteger, |
295 | 7185 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
7186 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
7187 |
and/or joinStyle is none of #miter, #bevel, #round |
|
7188 |
" |
|
7189 |
self primitiveFailed |
|
7190 |
! |
|
7191 |
||
1344 | 7192 |
setMaskOriginX:orgX y:orgY in:aGCid |
295 | 7193 |
"set the mask origin" |
7194 |
||
7195 |
%{ /* NOCONTEXT */ |
|
7196 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7197 |
if (ISCONNECTED) { |
1344 | 7198 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
1974 | 7199 |
ENTER_XLIB(); |
1344 | 7200 |
XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
1974 | 7201 |
LEAVE_XLIB(); |
1344 | 7202 |
RETURN ( self ); |
7203 |
} |
|
295 | 7204 |
} |
7205 |
%}. |
|
7206 |
self primitiveFailed |
|
7207 |
! |
|
7208 |
||
1344 | 7209 |
setPixmapMask:aPixmapId in:aGCId |
295 | 7210 |
"set or clear the drawing mask - a pixmap mask providing full color" |
7211 |
||
7212 |
%{ /* NOCONTEXT */ |
|
7213 |
||
7214 |
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
|
7215 |
GC gc; |
295 | 7216 |
Pixmap pixmap; |
7217 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7218 |
if (ISCONNECTED) { |
1344 | 7219 |
if (__isExternalAddress(aGCId)) { |
7220 |
gc = _GCVal(aGCId); |
|
7221 |
if (__isExternalAddress(aPixmapId)) { |
|
7222 |
pixmap = _PixmapVal(aPixmapId); |
|
1974 | 7223 |
ENTER_XLIB(); |
1344 | 7224 |
XSetTile(dpy, gc, pixmap); |
7225 |
XSetFillStyle(dpy, gc, FillTiled); |
|
1974 | 7226 |
LEAVE_XLIB(); |
1344 | 7227 |
RETURN ( self ); |
7228 |
} |
|
7229 |
if (aPixmapId == nil) { |
|
1974 | 7230 |
ENTER_XLIB(); |
1344 | 7231 |
XSetFillStyle(dpy, gc, FillSolid); |
1974 | 7232 |
LEAVE_XLIB(); |
1344 | 7233 |
RETURN ( self ); |
7234 |
} |
|
7235 |
} |
|
295 | 7236 |
} |
7237 |
%}. |
|
7238 |
self primitiveFailed |
|
7239 |
! ! |
|
7240 |
||
7241 |
!XWorkstation methodsFor:'initialize / release'! |
|
7242 |
||
1344 | 7243 |
closeConnection |
295 | 7244 |
"close down the connection to the X-server" |
7245 |
||
7246 |
%{ /* NOCONTEXT */ |
|
7247 |
||
7248 |
if (ISCONNECTED) { |
|
1344 | 7249 |
Display *dpy = myDpy; |
7250 |
||
7251 |
BEGIN_INTERRUPTSBLOCKED |
|
7252 |
__INST(displayId) = nil; |
|
1974 | 7253 |
ENTER_XLIB(); |
1344 | 7254 |
XCloseDisplay(dpy); |
1974 | 7255 |
LEAVE_XLIB(); |
1344 | 7256 |
END_INTERRUPTSBLOCKED |
295 | 7257 |
} |
7258 |
%} |
|
7259 |
! |
|
7260 |
||
1344 | 7261 |
initializeDefaultValues |
295 | 7262 |
buttonTranslation := ButtonTranslation. |
7263 |
multiClickTimeDelta := MultiClickTimeDelta. |
|
7264 |
||
7265 |
self initializeModifierMappings |
|
7266 |
! |
|
7267 |
||
1344 | 7268 |
initializeEventBuffer |
295 | 7269 |
|sz| |
7270 |
||
7271 |
%{ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
7272 |
sz = __MKSMALLINT(sizeof(XEvent) + 100); |
295 | 7273 |
%}. |
7274 |
eventBuffer isNil ifTrue:[ |
|
1344 | 7275 |
eventBuffer := ByteArray new:sz. |
295 | 7276 |
]. |
7277 |
! |
|
7278 |
||
1344 | 7279 |
initializeFor:aDisplayName |
295 | 7280 |
"initialize the receiver for a connection to an X-Server; |
7281 |
the argument, aDisplayName may be nil (for the default server from |
|
7282 |
DISPLAY-variable or command line argument) or the name of the server |
|
7283 |
as hostname:number" |
|
7284 |
||
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
7285 |
|dpyName index arguments| |
295 | 7286 |
|
7287 |
dpyName := aDisplayName. |
|
7288 |
dpyName isNil ifTrue:[ |
|
1344 | 7289 |
"look for a '-display xxx' argument" |
7290 |
(arguments := Smalltalk commandLineArguments) notNil ifTrue:[ |
|
7291 |
index := arguments indexOf:'-display'. |
|
7292 |
(index between:1 and:(arguments size - 1)) ifTrue:[ |
|
7293 |
dpyName := arguments at:index+1 |
|
7294 |
] |
|
7295 |
] |
|
295 | 7296 |
]. |
7297 |
%{ |
|
7298 |
int scr; |
|
7299 |
Display *dpy; |
|
7300 |
Visual *visual; |
|
7301 |
XVisualInfo viproto; |
|
7302 |
XVisualInfo *vip; /* retured info */ |
|
7303 |
int maxRGBDepth; |
|
7304 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
7305 |
int rgbVisualID; |
|
7306 |
int nvi, i; |
|
7307 |
char *type, *nm; |
|
7308 |
int dummy; |
|
7309 |
OBJ dpyID; |
|
7310 |
||
555 | 7311 |
if (__INST(displayId) != nil) { |
1344 | 7312 |
/* |
7313 |
* already connected - you bad guy try to |
|
7314 |
* trick me manually ? |
|
7315 |
*/ |
|
7316 |
RETURN ( self ); |
|
295 | 7317 |
} |
7318 |
||
7319 |
BEGIN_INTERRUPTSBLOCKED |
|
7320 |
||
7321 |
if (__isString(dpyName)) |
|
1831 | 7322 |
nm = (char *) __stringVal(dpyName); |
295 | 7323 |
else { |
1344 | 7324 |
dpyName = __MKSTRING((char *)getenv("DISPLAY")); |
7325 |
nm = NULL; |
|
295 | 7326 |
} |
7327 |
dpy = XOpenDisplay(nm); |
|
7328 |
||
7329 |
if (dpy) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7330 |
static int firstCall = 1; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7331 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
7332 |
__INST(displayId) = dpyID = __MKEXTERNALADDRESS(dpy); __STORE(self, dpyID); |
295 | 7333 |
|
7334 |
#ifdef SUPERDEBUG |
|
1344 | 7335 |
XSynchronize(dpy, 1); |
295 | 7336 |
#endif |
7337 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7338 |
if (firstCall) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7339 |
firstCall = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7340 |
XSetErrorHandler(__XErrorHandler__); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7341 |
XSetIOErrorHandler(__XIOErrorHandler__); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7342 |
} |
295 | 7343 |
} |
7344 |
||
7345 |
END_INTERRUPTSBLOCKED |
|
7346 |
%}. |
|
7347 |
displayId isNil ifTrue:[ |
|
1344 | 7348 |
'XWorkstation [warning]: cannot connect to Display.' errorPrintCR. |
7349 |
^ nil |
|
295 | 7350 |
]. |
7351 |
||
7352 |
dispatching := false. |
|
7353 |
dispatchingExpose := false. |
|
7354 |
isSlow := false. |
|
7355 |
shiftDown := false. |
|
7356 |
ctrlDown := false. |
|
7357 |
metaDown := false. |
|
7358 |
altDown := false. |
|
7359 |
motionEventCompression := true. |
|
7360 |
buttonsPressed := 0. |
|
7361 |
displayName := dpyName. |
|
7362 |
||
7363 |
protocolsAtom := nil. |
|
7364 |
deleteWindowAtom := nil. |
|
7365 |
saveYourselfAtom := nil. |
|
7366 |
quitAppAtom := nil. |
|
7367 |
||
7368 |
self initializeScreenProperties. |
|
1366 | 7369 |
self initializeDeviceResourceTables. |
295 | 7370 |
|
7371 |
self initializeDefaultValues. |
|
7372 |
self initializeEventBuffer. |
|
7373 |
self initializeSpecialFlags. |
|
7374 |
self initializeKeyboardMap. |
|
7375 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7376 |
deviceErrorSignal := DeviceErrorSignal newSignalMayProceed:false. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7377 |
deviceErrorSignal nameClass:self class message:#deviceErrorSignal. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7378 |
deviceIOErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7379 |
deviceIOErrorSignal nameClass:self class message:#deviceIOErrorSignal. |
1974 | 7380 |
deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignalMayProceed:false. |
7381 |
deviceIOTimeoutErrorSignal nameClass:self class message:#deviceIOTimeoutErrorSignal. |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7382 |
|
295 | 7383 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7384 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError. |
1974 | 7385 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError. |
295 | 7386 |
! |
7387 |
||
1344 | 7388 |
initializeModifierMappings |
295 | 7389 |
|map mod| |
7390 |
||
7391 |
"/ altModifiers := #(Alt_L Alt_R). |
|
7392 |
"/ metaModifiers := #(Meta_L Meta_R). |
|
7393 |
"/ ctrlModifiers := #(Control_L Control_R). |
|
7394 |
"/ shiftModifiers := #(Shift_L Shift_R). |
|
7395 |
||
7396 |
shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil. |
|
7397 |
altModifierMask := metaModifierMask := nil. |
|
7398 |
||
7399 |
map := self modifierMapping. |
|
342 | 7400 |
map isNil ifTrue:[ |
1344 | 7401 |
"/ |
7402 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
|
7403 |
"/ setup some reasonable default. If that is not sufficient, |
|
7404 |
"/ you have to change things from your display.rc file. |
|
7405 |
"/ |
|
7406 |
altModifierMask := self modifier1Mask. |
|
7407 |
metaModifierMask := self modifier2Mask. |
|
7408 |
||
7409 |
shiftModifiers := #(Shift_L Shift_R Shift). |
|
7410 |
ctrlModifiers := #(Control_L Control_R Control). |
|
7411 |
metaModifiers := #(Alt_L Meta_L Meta_R Meta). |
|
7412 |
altModifiers := #(Alt_R Alt). |
|
342 | 7413 |
] ifFalse:[ |
1344 | 7414 |
altModifierMask := 0. |
7415 |
metaModifierMask := 0. |
|
7416 |
||
7417 |
mod := map at:1. |
|
7418 |
mod notNil ifTrue:[ |
|
7419 |
shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
|
7420 |
]. |
|
7421 |
mod := map at:3. |
|
7422 |
mod notNil ifTrue:[ |
|
7423 |
ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
|
7424 |
]. |
|
7425 |
mod := map at:4. |
|
7426 |
mod notNil ifTrue:[ |
|
7427 |
metaModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
|
7428 |
metaModifierMask := 1 bitShift:(4-1). |
|
7429 |
]. |
|
7430 |
mod := map at:5. |
|
7431 |
mod notNil ifTrue:[ |
|
7432 |
altModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
|
7433 |
altModifierMask := 1 bitShift:(5-1). |
|
7434 |
] |
|
295 | 7435 |
]. |
7436 |
||
7437 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
7438 |
! |
|
7439 |
||
1344 | 7440 |
initializeScreenProperties |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7441 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7442 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
7443 |
%{ |
295 | 7444 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7445 |
Display *dpy; |
295 | 7446 |
int scr; |
7447 |
Visual *visual; |
|
7448 |
XVisualInfo viproto; |
|
7449 |
XVisualInfo *vip; /* retured info */ |
|
7450 |
int maxRGBDepth; |
|
7451 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
7452 |
int rgbVisualID; |
|
7453 |
int nvi, i; |
|
7454 |
int shapeEventBase, shapeErrorBase; |
|
7455 |
int shmEventBase, shmErrorBase; |
|
7456 |
char *type, *nm; |
|
7457 |
int dummy; |
|
7458 |
int mask, shift, nBits; |
|
7459 |
||
7460 |
if (ISCONNECTED) { |
|
1344 | 7461 |
dpy = myDpy; |
7462 |
||
7463 |
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask); |
|
7464 |
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask); |
|
7465 |
||
7466 |
BEGIN_INTERRUPTSBLOCKED |
|
7467 |
||
7468 |
__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy)); |
|
7469 |
__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr)); |
|
7470 |
__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr)); |
|
7471 |
__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr)); |
|
7472 |
__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr)); |
|
7473 |
__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr)); |
|
7474 |
__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr)); |
|
7475 |
__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr)); |
|
7476 |
__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr)); |
|
295 | 7477 |
|
7478 |
#ifdef SHAPE |
|
1344 | 7479 |
if (XShapeQueryExtension(dpy, &dummy, &dummy)) |
7480 |
__INST(hasShapeExtension) = true; |
|
7481 |
else |
|
295 | 7482 |
#endif |
1344 | 7483 |
__INST(hasShapeExtension) = false; |
295 | 7484 |
|
7485 |
#ifdef SHM |
|
1344 | 7486 |
if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) |
7487 |
__INST(hasShmExtension) = true; |
|
7488 |
else |
|
295 | 7489 |
#endif |
1344 | 7490 |
__INST(hasShmExtension) = false; |
295 | 7491 |
|
7492 |
#ifdef DPS |
|
1344 | 7493 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
7494 |
__INST(hasDPSExtension) = true; |
|
7495 |
else |
|
295 | 7496 |
#endif |
1344 | 7497 |
__INST(hasDPSExtension) = false; |
295 | 7498 |
|
7499 |
#ifdef XVIDEO |
|
1344 | 7500 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
7501 |
__INST(hasXVideoExtension) = true; |
|
7502 |
else |
|
295 | 7503 |
#endif |
1344 | 7504 |
__INST(hasXVideoExtension) = false; |
295 | 7505 |
|
7506 |
#ifdef MBUF |
|
1344 | 7507 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
7508 |
__INST(hasMbufExtension) = true; |
|
7509 |
else |
|
295 | 7510 |
#endif |
1344 | 7511 |
__INST(hasMbufExtension) = false; |
295 | 7512 |
|
7513 |
#ifdef PEX5 |
|
1344 | 7514 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) |
7515 |
__INST(hasPEXExtension) = true; |
|
7516 |
else |
|
295 | 7517 |
#endif |
1344 | 7518 |
__INST(hasPEXExtension) = false; |
295 | 7519 |
|
7520 |
#ifdef XIE |
|
1344 | 7521 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) |
7522 |
__INST(hasImageExtension) = true; |
|
7523 |
else |
|
295 | 7524 |
#endif |
1344 | 7525 |
__INST(hasImageExtension) = false; |
295 | 7526 |
|
7527 |
#ifdef XI |
|
1344 | 7528 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) |
7529 |
__INST(hasInputExtension) = true; |
|
7530 |
else |
|
295 | 7531 |
#endif |
1344 | 7532 |
__INST(hasInputExtension) = false; |
7533 |
||
7534 |
/* |
|
7535 |
* look for RGB visual |
|
7536 |
*/ |
|
7537 |
nvi = 0; |
|
7538 |
viproto.screen = scr; |
|
7539 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
|
7540 |
maxRGBDepth = 0; |
|
7541 |
for (i = 0; i < nvi; i++) { |
|
7542 |
switch (vip[i].class) { |
|
7543 |
case TrueColor: |
|
7544 |
if (vip[i].depth > maxRGBDepth) { |
|
7545 |
maxRGBDepth = vip[i].depth; |
|
7546 |
rgbRedMask = vip[i].red_mask; |
|
7547 |
rgbGreenMask = vip[i].green_mask; |
|
7548 |
rgbBlueMask = vip[i].blue_mask; |
|
7549 |
rgbVisualID = vip[i].visualid; |
|
7550 |
} |
|
7551 |
break; |
|
7552 |
} |
|
7553 |
} |
|
7554 |
if (vip) XFree ((char *) vip); |
|
7555 |
||
7556 |
if (maxRGBDepth) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
7557 |
__INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual); |
1344 | 7558 |
} |
7559 |
||
7560 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
7561 |
__INST(monitorType) = @symbol(unknown); |
|
7562 |
__INST(hasColors) = true; |
|
7563 |
__INST(hasGreyscales) = true; |
|
7564 |
switch (visual->class) { |
|
7565 |
case StaticGray: |
|
7566 |
__INST(visualType) = @symbol(StaticGray); |
|
7567 |
__INST(hasColors) = false; |
|
7568 |
__INST(monitorType) = @symbol(monochrome); |
|
7569 |
break; |
|
7570 |
case GrayScale: |
|
7571 |
__INST(visualType) = @symbol(GrayScale); |
|
7572 |
__INST(hasColors) = false; |
|
7573 |
__INST(monitorType) = @symbol(monochrome); |
|
7574 |
break; |
|
7575 |
case StaticColor: |
|
7576 |
__INST(visualType) = @symbol(StaticColor); |
|
7577 |
break; |
|
7578 |
case PseudoColor: |
|
7579 |
__INST(visualType) = @symbol(PseudoColor); |
|
7580 |
break; |
|
7581 |
case TrueColor: |
|
7582 |
__INST(visualType) = @symbol(TrueColor); |
|
7583 |
break; |
|
7584 |
case DirectColor: |
|
7585 |
__INST(visualType) = @symbol(DirectColor); |
|
7586 |
break; |
|
7587 |
} |
|
7588 |
if (DisplayCells(dpy, scr) == 2) { |
|
7589 |
__INST(hasColors) = false; |
|
7590 |
__INST(hasGreyscales) = false; |
|
7591 |
__INST(monitorType) = @symbol(monochrome); |
|
7592 |
} |
|
7593 |
__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb); |
|
7594 |
__INST(redMask) = __MKSMALLINT(visual->red_mask); |
|
7595 |
__INST(greenMask) = __MKSMALLINT(visual->green_mask); |
|
7596 |
__INST(blueMask) = __MKSMALLINT(visual->blue_mask); |
|
7597 |
switch (visual->class) { |
|
7598 |
case TrueColor: |
|
7599 |
/* extract number of bits and shift counts */ |
|
7600 |
mask = visual->red_mask; |
|
7601 |
shift = 0; |
|
7602 |
while (mask && ((mask & 1) == 0)) { |
|
7603 |
mask >>= 1; |
|
7604 |
shift++; |
|
7605 |
} |
|
7606 |
__INST(redShift) = __MKSMALLINT(shift); |
|
7607 |
nBits = 0; |
|
7608 |
while (mask) { |
|
7609 |
mask >>= 1; |
|
7610 |
nBits++; |
|
7611 |
} |
|
7612 |
__INST(bitsRed) = __MKSMALLINT(nBits); |
|
7613 |
||
7614 |
mask = visual->green_mask; |
|
7615 |
shift = 0; |
|
7616 |
while (mask && ((mask & 1) == 0)) { |
|
7617 |
mask >>= 1; |
|
7618 |
shift++; |
|
7619 |
} |
|
7620 |
__INST(greenShift) = __MKSMALLINT(shift); |
|
7621 |
nBits = 0; |
|
7622 |
while (mask) { |
|
7623 |
mask >>= 1; |
|
7624 |
nBits++; |
|
7625 |
} |
|
7626 |
__INST(bitsGreen) = __MKSMALLINT(nBits); |
|
7627 |
||
7628 |
mask = visual->blue_mask; |
|
7629 |
shift = 0; |
|
7630 |
while (mask && ((mask & 1) == 0)) { |
|
7631 |
mask >>= 1; |
|
7632 |
shift++; |
|
7633 |
} |
|
7634 |
__INST(blueShift) = __MKSMALLINT(shift); |
|
7635 |
nBits = 0; |
|
7636 |
while (mask) { |
|
7637 |
mask >>= 1; |
|
7638 |
nBits++; |
|
7639 |
} |
|
7640 |
__INST(bitsBlue) = __MKSMALLINT(nBits); |
|
7641 |
break; |
|
7642 |
} |
|
295 | 7643 |
|
7644 |
#ifndef XA_PRIMARY |
|
1344 | 7645 |
__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) ); |
295 | 7646 |
#else |
1344 | 7647 |
__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY ); |
295 | 7648 |
#endif |
7649 |
#ifndef XA_SECONDARY |
|
1344 | 7650 |
__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) ); |
295 | 7651 |
#else |
1344 | 7652 |
__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY ); |
295 | 7653 |
#endif |
7654 |
#ifndef XA_CUT_BUFFER0 |
|
1344 | 7655 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) ); |
295 | 7656 |
#else |
1344 | 7657 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 ); |
295 | 7658 |
#endif |
7659 |
#ifndef XA_STRING |
|
1344 | 7660 |
__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) ); |
295 | 7661 |
#else |
1344 | 7662 |
__INST(stringAtom) = __MKATOMOBJ( XA_STRING ); |
295 | 7663 |
#endif |
7664 |
#ifndef XA_LENGTH |
|
1344 | 7665 |
__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) ); |
295 | 7666 |
#else |
1344 | 7667 |
__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH ); |
295 | 7668 |
#endif |
1533 | 7669 |
#ifndef WM_STATE |
7670 |
__INST(wmStateAtom) = __MKATOMOBJ( XInternAtom(dpy, "WM_STATE", True) ); |
|
7671 |
#else |
|
7672 |
__INST(wmStateAtom) = __MKATOMOBJ( WM_STATE ); |
|
7673 |
#endif |
|
295 | 7674 |
|
1344 | 7675 |
END_INTERRUPTSBLOCKED |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7676 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7677 |
%}. |
295 | 7678 |
! |
7679 |
||
1344 | 7680 |
initializeSpecialFlags |
295 | 7681 |
"perform additional special server implementation flags" |
7682 |
||
7683 |
"/ |
|
7684 |
"/ assume we have it ... (should check) |
|
7685 |
"/ |
|
7686 |
hasSaveUnder := true. |
|
7687 |
ignoreBackingStore := false. |
|
7688 |
||
7689 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
1344 | 7690 |
"/ |
7691 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
7692 |
"/ which does not correctly handle saveUnder |
|
7693 |
"/ |
|
7694 |
hasSaveUnder := false. |
|
295 | 7695 |
]. |
7696 |
! |
|
7697 |
||
1344 | 7698 |
reinitialize |
295 | 7699 |
virtualRootId := rootId := nil. |
7700 |
super reinitialize. |
|
7701 |
dispatchingExpose := nil |
|
7702 |
! ! |
|
7703 |
||
7704 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
7705 |
||
1344 | 7706 |
altModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7707 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7708 |
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
|
7709 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7710 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7711 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7712 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7713 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7714 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7715 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7716 |
|
1344 | 7717 |
altModifierMask:aSmallInteger |
341 | 7718 |
"define which key takes the role of an alt-key. |
7719 |
By default, this is X's modifier1, which is the ALT key on |
|
7720 |
most keyboards. However, there may be exceptions to this, |
|
7721 |
and the setting can be changed with: |
|
1344 | 7722 |
Display altModifierMask:(Display modifier2Mask) |
341 | 7723 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
7724 |
" |
|
7725 |
||
7726 |
altModifierMask := aSmallInteger |
|
7727 |
! |
|
7728 |
||
1344 | 7729 |
metaModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7730 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7731 |
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
|
7732 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7733 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7734 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7735 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7736 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7737 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7738 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7739 |
|
1344 | 7740 |
metaModifierMask:aSmallInteger |
341 | 7741 |
"define which key takes the role of a meta key. |
7742 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
7743 |
most keyboards (if present at all). |
|
7744 |
However, there may be exceptions to this, and the setting can |
|
7745 |
be changed with: |
|
1344 | 7746 |
Display metaModifierMask:(Display modifier1Mask) |
341 | 7747 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
7748 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
7749 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
7750 |
all the time. On those, you should disable the meta key by setting |
|
7751 |
the mask to 0. |
|
7752 |
" |
|
7753 |
||
7754 |
metaModifierMask := aSmallInteger |
|
7755 |
! |
|
7756 |
||
1344 | 7757 |
modifier1Mask |
341 | 7758 |
"return the Xlib mask bit for the 1st modifier key. |
7759 |
See comment in altModifierMask: / metaModifierMask: for what |
|
7760 |
this could be used." |
|
7761 |
||
7762 |
%{ /* NOCONTEXT */ |
|
7763 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
7764 |
%} |
|
7765 |
! |
|
7766 |
||
1344 | 7767 |
modifier2Mask |
341 | 7768 |
"return the Xlib mask bit for the 2nd modifier key. |
7769 |
See comment in altModifierMask: / metaModifierMask: for what |
|
7770 |
this could be used." |
|
7771 |
||
7772 |
%{ /* NOCONTEXT */ |
|
7773 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
7774 |
%} |
|
7775 |
! |
|
7776 |
||
1344 | 7777 |
modifierMapping |
341 | 7778 |
"Get the Modifier Mapping. |
7779 |
We return an array of arrays of keycodes" |
|
7780 |
||
7781 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
7782 |
||
7783 |
%{ |
|
7784 |
XModifierKeymap *modmap; |
|
7785 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
7786 |
||
7787 |
if (ISCONNECTED) { |
|
1344 | 7788 |
Display *dpy = myDpy; |
7789 |
||
7790 |
if ((modmap = XGetModifierMapping(myDpy)) != 0) { |
|
7791 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
7792 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
|
7793 |
if (modifierKeyMap != nil) { |
|
7794 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
7795 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
|
7796 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
|
7797 |
} |
|
7798 |
XFreeModifiermap(modmap); |
|
7799 |
} |
|
341 | 7800 |
} |
7801 |
%}. |
|
7802 |
||
7803 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
7804 |
||
7805 |
ret := Array new:8. |
|
7806 |
nextKey := 1. |
|
7807 |
1 to:8 do:[ :i | |
|
1344 | 7808 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
7809 |
|mod| |
|
7810 |
||
7811 |
mod := OrderedCollection new:maxKeyPerMod. |
|
7812 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
7813 |
key ~= 0 ifTrue:[ |
|
7814 |
mod add:key |
|
7815 |
]. |
|
7816 |
]. |
|
7817 |
ret at:i put:mod. |
|
7818 |
]. |
|
7819 |
nextKey := nextKey+maxKeyPerMod. |
|
341 | 7820 |
]. |
7821 |
||
7822 |
^ ret |
|
7823 |
||
7824 |
" |
|
1344 | 7825 |
Display modifierMapping |
341 | 7826 |
" |
7827 |
! |
|
7828 |
||
1344 | 7829 |
stringFromKeycode:code |
341 | 7830 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
7831 |
||
7832 |
|str| |
|
7833 |
||
7834 |
%{ |
|
7835 |
KeySym keysym; |
|
7836 |
char *keystring; |
|
7837 |
||
7838 |
if (ISCONNECTED && __isSmallInteger(code)) { |
|
1344 | 7839 |
Display *dpy = myDpy; |
7840 |
||
7841 |
if ((keysym = XKeycodeToKeysym(myDpy, __intVal(code), 0)) != NoSymbol && |
|
7842 |
(keystring = XKeysymToString(keysym)) != 0) |
|
7843 |
str = __MKSTRING(keystring); |
|
341 | 7844 |
} |
7845 |
%}. |
|
7846 |
^ str |
|
7847 |
||
7848 |
" |
|
1344 | 7849 |
Display stringFromKeycode:28 |
341 | 7850 |
" |
7851 |
! |
|
7852 |
||
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7853 |
translateKey:untranslatedKey forView:aView |
295 | 7854 |
"Return the key translated via the translation table. |
7855 |
Here, we preTranslate the key into a common ST/X symbolic name, |
|
7856 |
which gets further processed in the superclasses translation method." |
|
7857 |
||
7858 |
|key| |
|
7859 |
||
7860 |
(key := untranslatedKey) isString ifTrue:[ |
|
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7861 |
key := RawKeysymTranslation at:key ifAbsent:key. |
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7862 |
key := key asSymbol. |
295 | 7863 |
]. |
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7864 |
^ super translateKey:key forView:aView |
295 | 7865 |
! ! |
7866 |
||
7867 |
!XWorkstation methodsFor:'misc'! |
|
7868 |
||
1344 | 7869 |
beep |
295 | 7870 |
"output an audible beep or bell" |
7871 |
||
1906 | 7872 |
NoBeep ~~ true ifTrue:[ |
7873 |
self beep:50 |
|
7874 |
] |
|
295 | 7875 |
! |
7876 |
||
1344 | 7877 |
beep:volumeInPercent |
295 | 7878 |
"output an audible beep" |
7879 |
%{ |
|
7880 |
int volume; |
|
7881 |
||
7882 |
if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
|
1344 | 7883 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
7884 |
volume = __intVal(volumeInPercent) * 2 - 100; |
|
7885 |
if (volume < -100) volume = -100; |
|
7886 |
else if (volume > 100) volume = 100; |
|
7887 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 7888 |
ENTER_XLIB(); |
1344 | 7889 |
XBell(myDpy, volume); |
1974 | 7890 |
LEAVE_XLIB(); |
1344 | 7891 |
END_INTERRUPTSBLOCKED |
295 | 7892 |
} |
7893 |
%} |
|
7894 |
! |
|
7895 |
||
1344 | 7896 |
buffered |
295 | 7897 |
"buffer drawing - do not send it immediately to the display. |
374 | 7898 |
This is the default anyway. |
7899 |
See #unBuffered for additional info." |
|
295 | 7900 |
|
7901 |
%{ /* NOCONTEXT */ |
|
7902 |
||
7903 |
if (ISCONNECTED) { |
|
1344 | 7904 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 7905 |
ENTER_XLIB(); |
1344 | 7906 |
XSynchronize(myDpy, 0); |
1974 | 7907 |
LEAVE_XLIB(); |
1344 | 7908 |
END_INTERRUPTSBLOCKED |
295 | 7909 |
} |
7910 |
%} |
|
374 | 7911 |
" |
7912 |
Display buffered |
|
7913 |
" |
|
295 | 7914 |
! |
7915 |
||
1344 | 7916 |
flush |
295 | 7917 |
"send all buffered drawing to the display. |
7918 |
This may be required to make certain, that all previous operations |
|
7919 |
are really sent to the display before continuing. For example, |
|
7920 |
after a cursor-change with a followup long computation. |
|
374 | 7921 |
(otherwise, the cursor change request may still be in the output buffer) |
7922 |
See also #sync, which even waits until the request has been processed." |
|
295 | 7923 |
|
7924 |
%{ /* NOCONTEXT */ |
|
7925 |
||
7926 |
if (ISCONNECTED) { |
|
1344 | 7927 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 7928 |
ENTER_XLIB(); |
1344 | 7929 |
XFlush(myDpy); |
1974 | 7930 |
LEAVE_XLIB(); |
1344 | 7931 |
END_INTERRUPTSBLOCKED |
310 | 7932 |
} |
7933 |
%} |
|
7934 |
! |
|
7935 |
||
1344 | 7936 |
flushDpsContext:aDPSContext |
295 | 7937 |
|
7938 |
%{ /* NOCONTEXT */ |
|
7939 |
#ifdef DPS |
|
7940 |
if (__isExternalAddress(aDPSContext)) { |
|
1344 | 7941 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 7942 |
ENTER_XLIB(); |
1344 | 7943 |
DPSFlushContext(MKDPSCONTEXT(aDPSContext)); |
1974 | 7944 |
LEAVE_XLIB(); |
1344 | 7945 |
END_INTERRUPTSBLOCKED |
7946 |
RETURN ( self ); |
|
295 | 7947 |
} |
7948 |
#endif |
|
374 | 7949 |
%}. |
295 | 7950 |
self primitiveFailed |
7951 |
! |
|
7952 |
||
1344 | 7953 |
refreshKeyboardMapping:eB |
295 | 7954 |
%{ |
7955 |
XMappingEvent *ev; |
|
7956 |
||
7957 |
if (__isByteArray(eB)) { |
|
1344 | 7958 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1974 | 7959 |
ENTER_XLIB(); |
1344 | 7960 |
XRefreshKeyboardMapping(ev); |
1974 | 7961 |
LEAVE_XLIB(); |
295 | 7962 |
} |
7963 |
%} |
|
7964 |
! |
|
7965 |
||
1344 | 7966 |
setInputFocusTo:aWindowId |
295 | 7967 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
7968 |
self setInputFocusTo:aWindowId revertTo:#root |
|
7969 |
! |
|
7970 |
||
1344 | 7971 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
295 | 7972 |
"set the focus to the view as defined by aWindowId. |
7973 |
Passing nil set the focus to no window and lets the display discard all |
|
7974 |
input until a new focus is set. |
|
7975 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
7976 |
passing one of #parent, #root or nil specifies that the focus should be |
|
7977 |
given to the parent view, the root view or no view." |
|
7978 |
||
7979 |
%{ /* NOCONTEXT */ |
|
7980 |
int arg; |
|
7981 |
Window focusWindow; |
|
7982 |
||
7983 |
if (ISCONNECTED) { |
|
1344 | 7984 |
if (__isExternalAddress(aWindowId)) { |
7985 |
focusWindow = _WindowVal(aWindowId); |
|
7986 |
} else { |
|
7987 |
focusWindow = None; |
|
7988 |
} |
|
7989 |
if (revertSymbol == @symbol(parent)) |
|
7990 |
arg = RevertToParent; |
|
7991 |
else if (revertSymbol == @symbol(root)) |
|
7992 |
arg = RevertToPointerRoot; |
|
7993 |
else |
|
7994 |
arg = RevertToNone; |
|
7995 |
||
7996 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 7997 |
ENTER_XLIB(); |
1344 | 7998 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
1974 | 7999 |
LEAVE_XLIB(); |
1344 | 8000 |
END_INTERRUPTSBLOCKED |
8001 |
RETURN ( self ); |
|
295 | 8002 |
} |
8003 |
%}. |
|
8004 |
self primitiveFailed |
|
8005 |
! |
|
8006 |
||
1344 | 8007 |
sync |
341 | 8008 |
"send all buffered drawing to the display AND wait until the display |
8009 |
has finished drawing it. |
|
8010 |
This is almost never needed, except if you are about to read previously |
|
374 | 8011 |
drawn pixels back from the display screen, or you want to wait for a beep |
8012 |
to be finished. See also #flush." |
|
341 | 8013 |
|
8014 |
%{ /* NOCONTEXT */ |
|
8015 |
||
8016 |
if (ISCONNECTED) { |
|
1344 | 8017 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8018 |
ENTER_XLIB(); |
1344 | 8019 |
XSync(myDpy, 0); |
1974 | 8020 |
LEAVE_XLIB(); |
1344 | 8021 |
END_INTERRUPTSBLOCKED |
341 | 8022 |
} |
8023 |
%} |
|
8024 |
! |
|
8025 |
||
1344 | 8026 |
unBuffered |
374 | 8027 |
"make all drawing be sent immediately to the display. |
8028 |
This makes all graphics synchronous and turns off any buffering |
|
8029 |
(i.e. each individual draw-request is sent immediately without |
|
8030 |
packing multiple requests into a larger message buffer). |
|
8031 |
Be prepared, that this slows down graphics considerably. |
|
8032 |
However, it allows display errors to be handled immediately and |
|
8033 |
may be useful if you get Xdisplay errors and want to find the request |
|
1813 | 8034 |
which was responsible for it. See also #buffered." |
295 | 8035 |
|
8036 |
%{ /* NOCONTEXT */ |
|
8037 |
||
8038 |
if (ISCONNECTED) { |
|
1344 | 8039 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8040 |
ENTER_XLIB(); |
1344 | 8041 |
XSynchronize(myDpy, 1); |
1974 | 8042 |
LEAVE_XLIB(); |
1344 | 8043 |
END_INTERRUPTSBLOCKED |
295 | 8044 |
} |
8045 |
%} |
|
1813 | 8046 |
" |
8047 |
Display unBuffered |
|
8048 |
" |
|
295 | 8049 |
! ! |
8050 |
||
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8051 |
!XWorkstation methodsFor:'pointer stuff'! |
295 | 8052 |
|
1344 | 8053 |
anyButtonStateMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8054 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8055 |
buttonStates value." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8056 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8057 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8058 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8059 |
^ 256 + 512 + 1024 |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8060 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8061 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8062 |
"Created: 23.3.1996 / 12:46:35 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8063 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8064 |
|
1344 | 8065 |
buttonStates |
295 | 8066 |
"return an integer representing the state of the pointer buttons; |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8067 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8068 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8069 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 8070 |
|
8071 |
%{ /* NOCONTEXT*/ |
|
8072 |
Window w; |
|
555 | 8073 |
int screen = __intVal(__INST(screen)); |
295 | 8074 |
Window rootRet, childRet; |
8075 |
int rootX, rootY, winX, winY; |
|
8076 |
unsigned int mask; |
|
8077 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8078 |
if (ISCONNECTED) { |
1906 | 8079 |
Display *dpy = myDpy; |
8080 |
||
8081 |
BEGIN_INTERRUPTSBLOCKED |
|
295 | 8082 |
#ifdef VIRTUAL_ROOT |
1906 | 8083 |
w = getRootWindow(myDpy, screen); |
295 | 8084 |
#else |
1906 | 8085 |
w = RootWindow(dpy, screen); |
295 | 8086 |
#endif |
1906 | 8087 |
END_INTERRUPTSBLOCKED |
8088 |
if (w) { |
|
8089 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8090 |
ENTER_XLIB(); |
1906 | 8091 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
8092 |
&rootX, &rootY, |
|
8093 |
&winX, &winY, |
|
8094 |
&mask); |
|
1974 | 8095 |
LEAVE_XLIB(); |
1906 | 8096 |
END_INTERRUPTSBLOCKED |
8097 |
RETURN (__MKSMALLINT(mask)); |
|
8098 |
} |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8099 |
} |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8100 |
%}. |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8101 |
self primitiveFailed |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8102 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8103 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8104 |
Display buttonStates |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8105 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8106 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8107 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8108 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8109 |
Display buttonStates bitTest:(Display controlMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8110 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8111 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8112 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8113 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8114 |
Display buttonStates bitTest:(Display altModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8115 |
Display buttonStates bitTest:(Display metaModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8116 |
" |
295 | 8117 |
! |
8118 |
||
1344 | 8119 |
leftButtonStateMask |
295 | 8120 |
"return an integer for masking out the left button from a |
8121 |
buttonStates value" |
|
8122 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8123 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8124 |
|
295 | 8125 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8126 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8127 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 8128 |
! |
8129 |
||
1344 | 8130 |
middleButtonStateMask |
295 | 8131 |
"return an integer for masking out the middle button from a |
8132 |
buttonStates value" |
|
8133 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8134 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8135 |
|
295 | 8136 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8137 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8138 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 8139 |
! |
8140 |
||
1344 | 8141 |
pointerPosition |
295 | 8142 |
"return the current pointer position in root-window coordinates" |
8143 |
||
8144 |
|xpos ypos| |
|
8145 |
||
8146 |
%{ |
|
8147 |
Window w; |
|
555 | 8148 |
int screen = __intVal(__INST(screen)); |
295 | 8149 |
Window rootRet, childRet; |
8150 |
int rootX, rootY, winX, winY; |
|
8151 |
unsigned int mask; |
|
8152 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8153 |
if (ISCONNECTED) { |
1344 | 8154 |
Display *dpy = myDpy; |
8155 |
||
8156 |
BEGIN_INTERRUPTSBLOCKED |
|
295 | 8157 |
#ifdef VIRTUAL_ROOT |
1344 | 8158 |
w = getRootWindow(myDpy, screen); |
295 | 8159 |
#else |
1344 | 8160 |
w = RootWindow(dpy, screen); |
295 | 8161 |
#endif |
1974 | 8162 |
ENTER_XLIB(); |
1344 | 8163 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
8164 |
&rootX, &rootY, |
|
8165 |
&winX, &winY, |
|
8166 |
&mask); |
|
1974 | 8167 |
LEAVE_XLIB(); |
1344 | 8168 |
xpos = __MKSMALLINT(rootX); |
8169 |
ypos = __MKSMALLINT(rootY); |
|
8170 |
END_INTERRUPTSBLOCKED |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8171 |
} |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8172 |
%}. |
295 | 8173 |
^ xpos @ ypos |
8174 |
! |
|
8175 |
||
1344 | 8176 |
rightButtonStateMask |
295 | 8177 |
"return an integer for masking out the right button from a |
8178 |
buttonStates value" |
|
8179 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8180 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8181 |
|
295 | 8182 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8183 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8184 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 8185 |
! |
8186 |
||
1344 | 8187 |
rootPositionOfLastEvent |
295 | 8188 |
"return the position in root-window coordinates |
8189 |
of the last button, key or pointer event" |
|
8190 |
||
8191 |
^ eventRootX @ eventRootY |
|
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8192 |
! |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8193 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8194 |
setPointerPosition:newPosition in:aWindowId |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8195 |
"change the pointer position to a new position relative to the |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8196 |
given windows origin (which may be the rootWindow). |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8197 |
Be careful with this - its usually not very ergonimically |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8198 |
to change the mousePointer position. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8199 |
This interface is provided for special applications (presentation |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8200 |
playback) and should not be used in normal applications." |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8201 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8202 |
|xpos ypos| |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8203 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8204 |
xpos := newPosition x. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8205 |
ypos := newPosition y. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8206 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8207 |
%{ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8208 |
if (ISCONNECTED |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8209 |
&& __isExternalAddress(aWindowId) |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8210 |
&& __bothSmallInteger(xpos, ypos)) { |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8211 |
Display *dpy = myDpy; |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8212 |
Window w = _WindowVal(aWindowId); |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8213 |
|
1974 | 8214 |
ENTER_XLIB(); |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8215 |
XWarpPointer(dpy, |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8216 |
None, /* src window */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8217 |
w, /* dst window */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8218 |
0, /* src_x */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8219 |
0, /* src_y */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8220 |
0, /* src_w */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8221 |
0, /* src_h */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8222 |
__intVal(xpos), /* dst_x */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8223 |
__intVal(ypos) /* dst_y */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8224 |
); |
1974 | 8225 |
LEAVE_XLIB(); |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8226 |
} |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8227 |
%}. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8228 |
^ self |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8229 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8230 |
" |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8231 |
Display setPointerPosition:1000@1000 |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8232 |
" |
295 | 8233 |
! ! |
8234 |
||
1556 | 8235 |
!XWorkstation methodsFor:'properties'! |
8236 |
||
8237 |
getObjectProperty:propertyID from:aWindowID |
|
8238 |
"get an object property from the server; return object or nil" |
|
8239 |
||
8240 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8241 |
type == stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8242 |
^ value |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8243 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8244 |
(value isMemberOf:ByteArray) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8245 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8246 |
] |
1556 | 8247 |
]. |
8248 |
^ nil |
|
8249 |
||
8250 |
"Modified: 6.4.1997 / 13:27:07 / cg" |
|
8251 |
! |
|
8252 |
||
8253 |
getProperty:propertyID from:aWindowID into:aTwoArgBlock |
|
8254 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
|
8255 |
||
8256 |
|val typeID cls| |
|
8257 |
||
8258 |
cls := ByteArray. |
|
8259 |
%{ |
|
8260 |
Window window; |
|
8261 |
Atom property; |
|
8262 |
char *cp, *cp2; |
|
8263 |
Atom actual_type; |
|
8264 |
int actual_format,i; |
|
8265 |
unsigned long nitems, bytes_after, nread; |
|
8266 |
unsigned char *data; |
|
8267 |
int ok = 1; |
|
8268 |
# define PROP_SIZE 2048 |
|
8269 |
||
8270 |
if (ISCONNECTED) { |
|
8271 |
Display *dpy = myDpy; |
|
8272 |
||
8273 |
if (__isAtomID(propertyID)) { |
|
8274 |
property = _AtomVal(propertyID); |
|
8275 |
if (__isExternalAddress(aWindowID)) { |
|
8276 |
window = _WindowVal(aWindowID); |
|
8277 |
} else { |
|
8278 |
window = DefaultRootWindow(dpy); |
|
8279 |
} |
|
8280 |
||
8281 |
nread = 0; |
|
8282 |
cp = 0; |
|
8283 |
/* |
|
8284 |
fprintf(stderr, "getProperty: "); |
|
8285 |
*/ |
|
8286 |
do { |
|
8287 |
if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False, |
|
8288 |
AnyPropertyType,&actual_type,&actual_format, |
|
8289 |
&nitems,&bytes_after,(unsigned char **)&data) |
|
8290 |
!= Success) { |
|
8291 |
ok = 0; |
|
8292 |
break; |
|
8293 |
} |
|
8294 |
typeID = __MKATOMOBJ(actual_type); |
|
8295 |
if (! cp) { |
|
8296 |
cp = cp2 = (char *)malloc(nitems+1); |
|
8297 |
} else { |
|
8298 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
8299 |
cp2 = cp + nread; |
|
8300 |
} |
|
8301 |
if (! cp) { |
|
8302 |
XFree(data); |
|
8303 |
goto fail; |
|
8304 |
} |
|
8305 |
||
8306 |
nread += nitems; |
|
8307 |
bcopy(data, cp2, nitems); |
|
8308 |
XFree(data); |
|
8309 |
/* |
|
8310 |
fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after); |
|
8311 |
*/ |
|
8312 |
} while (bytes_after > 0); |
|
8313 |
/* |
|
8314 |
fprintf(stderr, "\n"); |
|
8315 |
*/ |
|
8316 |
||
8317 |
if (ok) { |
|
8318 |
if (actual_type == XA_STRING) { |
|
8319 |
cp[nread] = '\0'; |
|
8320 |
val = __MKSTRING_L(cp, nread); |
|
8321 |
} else { |
|
8322 |
val = __new(nread + OHDR_SIZE); |
|
8323 |
val->o_class = cls; |
|
8324 |
bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread); |
|
8325 |
} |
|
8326 |
} |
|
8327 |
if (cp) |
|
8328 |
free(cp); |
|
8329 |
} |
|
8330 |
} |
|
8331 |
fail: ; |
|
8332 |
%}. |
|
8333 |
typeID isNil ifTrue:[ |
|
8334 |
^ false |
|
8335 |
]. |
|
8336 |
aTwoArgBlock value:typeID value:val. |
|
8337 |
^ true |
|
8338 |
! |
|
8339 |
||
8340 |
getTextProperty:propertyID from:aWindowID |
|
8341 |
"get a text property; return string or nil" |
|
8342 |
||
1798 | 8343 |
|stringClass| |
8344 |
||
1556 | 8345 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
1906 | 8346 |
type == stringAtom ifTrue:[ |
8347 |
clipBoardEncoding notNil ifTrue:[ |
|
8348 |
stringClass := (CharacterArray classForEncoding:clipBoardEncoding). |
|
8349 |
stringClass ~~ String ifTrue:[ |
|
8350 |
^ stringClass fromBytes:(value asByteArray) |
|
8351 |
]. |
|
8352 |
^ value decodeFrom:clipBoardEncoding |
|
8353 |
]. |
|
8354 |
^ value |
|
8355 |
] |
|
1556 | 8356 |
]. |
8357 |
^ nil |
|
1793 | 8358 |
|
1798 | 8359 |
"Modified: 30.6.1997 / 20:54:59 / cg" |
1556 | 8360 |
! |
8361 |
||
8362 |
setLengthProperty:propertyID value:aNumber for:aWindowID |
|
8363 |
"set a size property" |
|
8364 |
||
8365 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8366 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8367 |
type:(self atomIDOfLENGTH) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8368 |
value:aNumber |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8369 |
for:aWindowID |
1556 | 8370 |
|
8371 |
"Modified: 6.4.1997 / 13:27:26 / cg" |
|
8372 |
! |
|
8373 |
||
8374 |
setObjectProperty:propertyID value:anObject for:aWindowID |
|
8375 |
"set a property to a smalltalk object in the XServer. |
|
8376 |
Can only be retrieved by another ST/X smalltalk" |
|
8377 |
||
8378 |
|s| |
|
8379 |
||
8380 |
(anObject isMemberOf:String) ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8381 |
^ self setTextProperty:propertyID value:anObject for:aWindowID |
1556 | 8382 |
]. |
8383 |
s := WriteStream on:(ByteArray new:200). |
|
8384 |
anObject storeBinaryOn:s. |
|
8385 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8386 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8387 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8388 |
value:(s contents) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8389 |
for:aWindowID |
1556 | 8390 |
|
8391 |
"Modified: 6.4.1997 / 13:27:57 / cg" |
|
8392 |
! |
|
8393 |
||
8394 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
|
8395 |
"set a property in the XServer" |
|
8396 |
||
8397 |
%{ /* UNLIMITEDSTACK */ |
|
8398 |
||
8399 |
Atom prop, type; |
|
8400 |
Window window; |
|
1888 | 8401 |
unsigned INT value; |
1556 | 8402 |
|
8403 |
if (__isAtomID(propertyID) |
|
8404 |
&& __isAtomID(typeID) |
|
8405 |
&& ISCONNECTED |
|
8406 |
&& (__isString(anObject) |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8407 |
|| __isSmallInteger(anObject) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8408 |
|| __isSymbol(anObject) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8409 |
|| __isByteArray(anObject) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8410 |
|| __isWords(anObject))) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8411 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8412 |
Display *dpy = myDpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8413 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8414 |
prop = _AtomVal(propertyID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8415 |
type = _AtomVal(typeID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8416 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8417 |
if (__isExternalAddress(aWindowID)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8418 |
window = _WindowVal(aWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8419 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8420 |
window = DefaultRootWindow(dpy); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8421 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8422 |
if (__isSmallInteger(anObject)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8423 |
value = __intVal(anObject); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8424 |
XChangeProperty(dpy, window, prop, type, 32, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8425 |
PropModeReplace, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8426 |
(unsigned char *)(&value), sizeof(unsigned int)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8427 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8428 |
if (__isByteArray(anObject)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8429 |
XChangeProperty(dpy, window, prop, type, 8, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8430 |
PropModeReplace, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8431 |
__ByteArrayInstPtr(anObject)->ba_element, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8432 |
__byteArraySize(anObject)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8433 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8434 |
/* string or symbol or wordArray-like (16bit-string) object */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8435 |
type = _AtomVal(typeID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8436 |
if (__isWords(__qClass(anObject))) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8437 |
XChangeProperty(dpy, window, prop, type, 16, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8438 |
PropModeReplace, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8439 |
__stringVal(anObject), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8440 |
__wordArraySize(anObject)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8441 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8442 |
XChangeProperty(dpy, window, prop, type, 8, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8443 |
PropModeReplace, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8444 |
__stringVal(anObject), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8445 |
__stringSize(anObject)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8446 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8447 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8448 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8449 |
RETURN (true); |
1556 | 8450 |
} |
8451 |
%}. |
|
8452 |
^ false |
|
8453 |
! |
|
8454 |
||
8455 |
setTextProperty:propertyID value:aString for:aWindowID |
|
8456 |
"set a property to a stringValue in the XServer" |
|
8457 |
||
8458 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8459 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8460 |
type:(self atomIDOfSTRING) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8461 |
value:aString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8462 |
for:aWindowID |
1556 | 8463 |
|
8464 |
"Modified: 6.4.1997 / 13:26:32 / cg" |
|
8465 |
! ! |
|
8466 |
||
295 | 8467 |
!XWorkstation methodsFor:'resources'! |
8468 |
||
1344 | 8469 |
atomIDOf:aStringOrSymbol |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8470 |
"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
|
8471 |
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
|
8472 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8473 |
^ self atomIDOf:aStringOrSymbol create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8474 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8475 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8476 |
Display atomIDOf:'FACE_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8477 |
Display atomIDOf:'FULL_NAME' |
1535 | 8478 |
Display atomIDOf:'DndProtocol' |
8479 |
Display atomIDOf:'DndSelection' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8480 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8481 |
|
1535 | 8482 |
"Modified: 4.4.1997 / 13:38:48 / cg" |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8483 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8484 |
|
1344 | 8485 |
atomIDOf:aStringOrSymbol create:create |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8486 |
"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
|
8487 |
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
|
8488 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8489 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8490 |
Atom prop; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8491 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8492 |
if (ISCONNECTED) { |
1344 | 8493 |
if (__isString(aStringOrSymbol) |
8494 |
|| __isSymbol(aStringOrSymbol)) { |
|
1831 | 8495 |
prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), |
1344 | 8496 |
(create == true) ? False : True); |
8497 |
if (prop == None) { |
|
8498 |
RETURN (nil); |
|
8499 |
} |
|
8500 |
RETURN ( __MKATOMOBJ(prop) ); |
|
8501 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8502 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8503 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8504 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8505 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8506 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8507 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8508 |
Display atomIDOf:'VT_SELECTION' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8509 |
Display atomIDOf:'CUT_BUFFER0' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8510 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8511 |
Display atomIDOf:'PRIMARY' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8512 |
Display atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8513 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8514 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8515 |
|
1344 | 8516 |
atomIDOfCUTBUFFER0 |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8517 |
"return the CUTBUFFER0 AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8518 |
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
|
8519 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8520 |
^ cutBuffer0Atom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8521 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8522 |
"Modified: 2.3.1996 / 15:10:36 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8523 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8524 |
|
1344 | 8525 |
atomIDOfLENGTH |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8526 |
"return the LENGTH AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8527 |
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
|
8528 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8529 |
^ lengthAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8530 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8531 |
"Modified: 2.3.1996 / 15:10:41 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8532 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8533 |
|
1344 | 8534 |
atomIDOfPRIMARY |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8535 |
"return the PRIMARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8536 |
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
|
8537 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8538 |
^ primaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8539 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8540 |
"Modified: 2.3.1996 / 15:10:49 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8541 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8542 |
|
1344 | 8543 |
atomIDOfSECONDARY |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8544 |
"return the SECONDARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8545 |
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
|
8546 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8547 |
^ secondaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8548 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8549 |
"Modified: 2.3.1996 / 15:10:59 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8550 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8551 |
|
1344 | 8552 |
atomIDOfSTRING |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8553 |
"return the STRING AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8554 |
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
|
8555 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8556 |
^ stringAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8557 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8558 |
"Modified: 2.3.1996 / 15:11:08 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8559 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8560 |
|
1344 | 8561 |
atomName:anAtomID |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8562 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8563 |
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
|
8564 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8565 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8566 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8567 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8568 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8569 |
if (ISCONNECTED) { |
1344 | 8570 |
if (__isAtomID(anAtomID)) { |
8571 |
name = XGetAtomName(myDpy, _AtomVal(anAtomID)); |
|
8572 |
if (name == 0) { |
|
8573 |
RETURN (nil); |
|
8574 |
} |
|
8575 |
str = __MKSTRING(name); |
|
8576 |
XFree(name); |
|
8577 |
RETURN ( str ); |
|
8578 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8579 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8580 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8581 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8582 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8583 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8584 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8585 |
Display atomName:1 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8586 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8587 |
Display atomName:132 'FONTNAME_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8588 |
Display atomName:135 'FOUNDRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8589 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8590 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8591 |
Display atomName:152 'CHARSET_ENCODING' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8592 |
Display atomName:154 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8593 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8594 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8595 |
|
1344 | 8596 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8597 |
"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
|
8598 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8599 |
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
|
8600 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8601 |
Notice: |
1344 | 8602 |
we do not plan to use X's resources for ST/X's defaults, |
8603 |
styles or resources. This would make porting of applications |
|
8604 |
to different platforms much more difficult (Windows has no resource |
|
8605 |
database). If you stay within ST/X's resource files, these can be |
|
8606 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8607 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8608 |
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
|
8609 |
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
|
8610 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8611 |
|
295 | 8612 |
%{ |
8613 |
char *rslt; |
|
8614 |
||
8615 |
if ((__isString(name) || __isSymbol(name)) |
|
8616 |
&& (__isString(cls) || __isSymbol(cls)) |
|
8617 |
&& ISCONNECTED) { |
|
1344 | 8618 |
BEGIN_INTERRUPTSBLOCKED |
1831 | 8619 |
rslt = XGetDefault(myDpy, (char *) __stringVal(cls), |
8620 |
(char *) __stringVal(name)); |
|
1344 | 8621 |
END_INTERRUPTSBLOCKED |
8622 |
RETURN (rslt ? __MKSTRING(rslt) : nil ); |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8623 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8624 |
%}. |
295 | 8625 |
self primitiveFailed. |
8626 |
^ nil |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8627 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8628 |
"if your ~/.Xdefaults contains an entry such as: |
1344 | 8629 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8630 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8631 |
|
1344 | 8632 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8633 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8634 |
if your ~/.Xdefaults contains an entry such as: |
1344 | 8635 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8636 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8637 |
|
1344 | 8638 |
Display getResource:'beNiceToColormap' class:'any' |
8639 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8640 |
" |
295 | 8641 |
! ! |
8642 |
||
8643 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
8644 |
||
1462
f8b2909deb3c
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1455
diff
changeset
|
8645 |
getBitsFromId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
295 | 8646 |
"get bits from a drawable into the imageBits. The storage for the bits |
8647 |
must be big enough for the data to fit. If ok, returns an array with some |
|
8648 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
8649 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
8650 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
8651 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8652 |
|rawInfo info| |
295 | 8653 |
|
8654 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
1344 | 8655 |
self primitiveFailed. |
8656 |
^ nil |
|
295 | 8657 |
]. |
8658 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8659 |
rawInfo := Array new:8. |
1344 | 8660 |
"1 -> bit order" |
8661 |
"2 -> depth" |
|
8662 |
"3 -> bytes_per_line" |
|
8663 |
"4 -> byte_order" |
|
8664 |
"5 -> format" |
|
8665 |
"6 -> bitmap_unit" |
|
8666 |
"7 -> bitmap_pad" |
|
8667 |
"8 -> bits_per_pixel" |
|
295 | 8668 |
|
8669 |
"/ had to extract the getPixel call into a separate method, to specify |
|
8670 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
8671 |
"/ of temporary stack space |
|
8672 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8673 |
(self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
1344 | 8674 |
info := IdentityDictionary new. |
8675 |
info at:#bitOrder put:(rawInfo at:1). |
|
8676 |
info at:#depth put:(rawInfo at:2). |
|
8677 |
info at:#bytesPerLine put:(rawInfo at:3). |
|
8678 |
info at:#byteOrder put:(rawInfo at:4). |
|
8679 |
info at:#format put:(rawInfo at:5). |
|
8680 |
info at:#bitmapUnit put:(rawInfo at:6). |
|
8681 |
info at:#bitmapPad put:(rawInfo at:7). |
|
8682 |
info at:#bitsPerPixel put:(rawInfo at:8). |
|
8683 |
^ info |
|
295 | 8684 |
]. |
8685 |
" |
|
8686 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
8687 |
or is too small to hold the bits |
|
8688 |
" |
|
8689 |
^ self primitiveFailed |
|
8690 |
! |
|
8691 |
||
1344 | 8692 |
getPixelX:x y:y from:aDrawableId |
790
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
8693 |
"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
|
8694 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 8695 |
|
8696 |
%{ /* UNLIMITEDSTACK NOCONTEXT */ |
|
8697 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
8698 |
Window win; |
295 | 8699 |
XImage *img; |
8700 |
int ret; |
|
8701 |
int xpos, ypos; |
|
8702 |
||
1209 | 8703 |
if (ISCONNECTED |
8704 |
&& __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
1344 | 8705 |
win = _WindowVal(aDrawableId); |
8706 |
xpos = __intVal(x); |
|
8707 |
ypos = __intVal(y); |
|
8708 |
if ((xpos < 0) || (ypos < 0)) { |
|
8709 |
RETURN ( __MKSMALLINT(0) ); |
|
8710 |
} |
|
1974 | 8711 |
ENTER_XLIB(); |
1344 | 8712 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
1974 | 8713 |
LEAVE_XLIB(); |
1344 | 8714 |
if (img != 0) { |
8715 |
ret = XGetPixel(img, 0, 0); |
|
8716 |
XDestroyImage(img); |
|
8717 |
RETURN ( __MKSMALLINT(ret) ); |
|
8718 |
} |
|
295 | 8719 |
} |
8720 |
%}. |
|
8721 |
^ nil |
|
8722 |
! |
|
8723 |
||
1344 | 8724 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
295 | 8725 |
"since XGetImage may allocate huge amount of stack space |
8726 |
(some implementations use alloca), this must run with unlimited stack." |
|
8727 |
||
8728 |
%{ /* UNLIMITEDSTACK */ |
|
8729 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
8730 |
Window win; |
295 | 8731 |
XImage *image = (XImage *)0; |
8732 |
int pad, bytes_per_line, numBytes; |
|
8733 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8734 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8735 |
&& __isExternalAddress(aDrawableId) |
295 | 8736 |
&& __bothSmallInteger(srcx, srcy) |
8737 |
&& __bothSmallInteger(w, h) |
|
8738 |
&& __isArray(info) |
|
8739 |
&& __isByteArray(imageBits)) { |
|
1344 | 8740 |
Display *dpy = myDpy; |
8741 |
||
8742 |
win = _WindowVal(aDrawableId); |
|
1974 | 8743 |
ENTER_XLIB(); |
1344 | 8744 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
8745 |
__intVal(w), __intVal(h), |
|
8746 |
(unsigned)AllPlanes, ZPixmap); |
|
1974 | 8747 |
LEAVE_XLIB(); |
1344 | 8748 |
|
8749 |
if (! image) { |
|
8750 |
RETURN ( false ); |
|
8751 |
} |
|
8752 |
||
8753 |
pad = image->bitmap_pad; |
|
295 | 8754 |
#ifdef SUPERDEBUG |
1344 | 8755 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
295 | 8756 |
#endif |
1344 | 8757 |
switch (image->depth) { |
8758 |
case 1: |
|
8759 |
case 2: |
|
8760 |
case 4: |
|
8761 |
case 8: |
|
8762 |
case 16: |
|
8763 |
case 24: |
|
8764 |
case 32: |
|
8765 |
numBytes = image->bytes_per_line * image->height; |
|
8766 |
break; |
|
1728 | 8767 |
|
1344 | 8768 |
default: |
8769 |
/* unsupported depth ? */ |
|
8770 |
printf("possibly unsupported depth:%d in primGetBits\n", image->depth); |
|
8771 |
numBytes = image->bytes_per_line * image->height; |
|
8772 |
break; |
|
8773 |
} |
|
295 | 8774 |
|
8775 |
#ifdef SUPERDEBUG |
|
1344 | 8776 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 8777 |
#endif |
8778 |
||
1344 | 8779 |
if (numBytes > __byteArraySize(imageBits)) { |
8780 |
/* imageBits too small */ |
|
1728 | 8781 |
fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n"); |
8782 |
fprintf(stderr, " bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits)); |
|
8783 |
fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n", |
|
8784 |
image->bitmap_pad, image->depth, image->bytes_per_line); |
|
1344 | 8785 |
goto fail; |
8786 |
} |
|
8787 |
if (image->bitmap_bit_order == MSBFirst) |
|
8788 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
|
8789 |
else |
|
8790 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
|
8791 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
8792 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
8793 |
if (image->byte_order == MSBFirst) |
|
8794 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
|
8795 |
else |
|
8796 |
__ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
|
8797 |
if (image->format == XYBitmap) |
|
8798 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
|
8799 |
else if (image->format == XYPixmap) |
|
8800 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
|
8801 |
else if (image->format == ZPixmap) |
|
8802 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
8803 |
|
1344 | 8804 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
8805 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
8806 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
8807 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
8808 |
XDestroyImage(image); |
|
8809 |
RETURN ( true ); |
|
295 | 8810 |
} |
8811 |
fail: |
|
8812 |
if (image) { |
|
1344 | 8813 |
XDestroyImage(image); |
295 | 8814 |
} |
8815 |
%}. |
|
8816 |
^ false |
|
8817 |
! ! |
|
8818 |
||
8819 |
!XWorkstation methodsFor:'selections'! |
|
8820 |
||
1344 | 8821 |
getSelectionFor:drawableId |
295 | 8822 |
"get the object selection - either immediate, or asynchronous. |
8823 |
Returns nil, if async request is on its way" |
|
8824 |
||
8825 |
|selProp sel| |
|
8826 |
||
8827 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
1344 | 8828 |
"no primary selection - use cut buffer" |
8829 |
sel := self getObjectProperty:cutBuffer0Atom from:nil. |
|
8830 |
^ sel |
|
295 | 8831 |
]. |
8832 |
selProp := self atomIDOf:'ST_SELECTION' create:true. |
|
8833 |
self requestObjectSelection:primaryAtom property:selProp for:drawableId. |
|
8834 |
^ nil |
|
8835 |
! |
|
8836 |
||
1344 | 8837 |
getSelectionOwnerOf:selectionAtomID |
295 | 8838 |
"get the owner of a selection" |
8839 |
||
8840 |
%{ /* NOCONTEXT */ |
|
8841 |
Atom selection; |
|
8842 |
Window window; |
|
8843 |
||
8844 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
|
1344 | 8845 |
Display *dpy = myDpy; |
8846 |
||
8847 |
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
8848 |
RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); |
295 | 8849 |
} |
8850 |
%}. |
|
8851 |
self primitiveFailed. |
|
8852 |
^ nil |
|
8853 |
! |
|
8854 |
||
1344 | 8855 |
getTextSelectionFor:drawableId |
295 | 8856 |
"get the text selection - either immediate, or asynchronous. |
8857 |
Returns nil, if async request is on its way" |
|
8858 |
||
8859 |
|selProp sel| |
|
8860 |
||
8861 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
1344 | 8862 |
"no primary selection - use cut buffer" |
8863 |
sel := self getTextProperty:cutBuffer0Atom from:nil. |
|
8864 |
^ sel |
|
295 | 8865 |
]. |
8866 |
selProp := self atomIDOf:'VT_SELECTION' create:true. |
|
8867 |
self requestTextSelection:primaryAtom property:selProp for:drawableId. |
|
8868 |
^ nil |
|
8869 |
! |
|
8870 |
||
1344 | 8871 |
requestObjectSelection:selectionID property:propertyID for:aWindowId |
295 | 8872 |
"ask the server to send us the selection - the view with ID aWindowID |
8873 |
will later receive a SelectionNotify event for it." |
|
8874 |
||
8875 |
^ self requestSelection:selectionID |
|
1344 | 8876 |
property:propertyID |
8877 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
8878 |
for:aWindowId |
|
8879 |
! |
|
8880 |
||
8881 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
|
295 | 8882 |
"ask the server to send us the selection - the view with id aWindowID |
8883 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
8884 |
with the selections value)." |
|
8885 |
||
8886 |
%{ /* NOCONTEXT */ |
|
8887 |
Atom sel_prop; |
|
8888 |
char *cp; |
|
8889 |
||
8890 |
if (__isExternalAddress(aWindowId) |
|
8891 |
&& ISCONNECTED |
|
8892 |
&& __isSmallInteger(typeID) |
|
8893 |
&& __isAtomID(selectionID)) { |
|
1344 | 8894 |
Display *dpy = myDpy; |
8895 |
||
8896 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
|
8897 |
/* |
|
8898 |
* no owner of primary selection |
|
8899 |
*/ |
|
8900 |
RETURN (false); |
|
8901 |
} |
|
8902 |
/* |
|
8903 |
* PRIMARY selection |
|
8904 |
*/ |
|
8905 |
XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), |
|
8906 |
_AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); |
|
8907 |
RETURN (true); |
|
295 | 8908 |
} |
8909 |
%}. |
|
8910 |
self primitiveFailed. |
|
8911 |
^ false |
|
8912 |
||
8913 |
" |
|
8914 |
Display requestSelection:(Display atomIDOf:'PRIMARY') |
|
1344 | 8915 |
property:(Display atomIDOf:'VT_SELECTION') |
8916 |
for:0 |
|
295 | 8917 |
" |
8918 |
! |
|
8919 |
||
1344 | 8920 |
requestTextSelection:selectionID property:propertyID for:aWindowId |
295 | 8921 |
"ask the server to send us the selection - the view with ID aWindowID |
8922 |
will later receive a SelectionNotify event for it." |
|
8923 |
||
8924 |
^ self requestSelection:selectionID |
|
1344 | 8925 |
property:propertyID |
8926 |
type:stringAtom |
|
8927 |
for:aWindowId |
|
8928 |
! |
|
8929 |
||
8930 |
sendSelection:something property:propertyID target:targetID from:windowID to:requestorID |
|
295 | 8931 |
"send aString back from a SelectionRequest" |
8932 |
||
8933 |
self |
|
1344 | 8934 |
sendSelection:something |
8935 |
selection:primaryAtom |
|
8936 |
property:propertyID |
|
8937 |
target:targetID |
|
8938 |
from:windowID |
|
8939 |
to:requestorID |
|
8940 |
! |
|
8941 |
||
8942 |
sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
295 | 8943 |
"send aString back from a SelectionRequest" |
8944 |
||
8945 |
self |
|
1344 | 8946 |
setProperty:propertyID |
8947 |
type:targetID |
|
8948 |
value:something |
|
8949 |
for:requestorID. |
|
295 | 8950 |
self |
1344 | 8951 |
sendSelectionNotifySelection:selectionID |
8952 |
property:propertyID |
|
8953 |
target:targetID |
|
8954 |
from:requestorID |
|
8955 |
to:requestorID. |
|
8956 |
! |
|
8957 |
||
8958 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID |
|
295 | 8959 |
"send a selectionNotify back from a SelectionRequest" |
8960 |
||
8961 |
%{ /* NOCONTEXT */ |
|
8962 |
||
8963 |
if (__isAtomID(propertyID) |
|
8964 |
&& __isExternalAddress(requestorID) |
|
8965 |
&& ISCONNECTED |
|
8966 |
&& __isAtomID(targetID) |
|
8967 |
&& __isAtomID(selectionID)) { |
|
1916 | 8968 |
Display *dpy = myDpy; |
8969 |
XEvent ev; |
|
8970 |
Window requestor = _WindowVal(requestorID); |
|
8971 |
Atom property = _AtomVal(propertyID); |
|
8972 |
Atom target = _AtomVal(targetID); |
|
8973 |
Atom selection = _AtomVal(selectionID); |
|
8974 |
Status result; |
|
8975 |
||
8976 |
ev.xselection.type = SelectionNotify; |
|
8977 |
ev.xselection.display = dpy; |
|
8978 |
ev.xselection.selection = selection; |
|
8979 |
ev.xselection.target = target; |
|
8980 |
if (__isExternalAddress(windowID)) |
|
8981 |
ev.xselection.requestor = _WindowVal(windowID); |
|
8982 |
else |
|
8983 |
ev.xselection.requestor = DefaultRootWindow(dpy); |
|
8984 |
ev.xselection.time = CurrentTime; |
|
8985 |
if (property == None) |
|
8986 |
ev.xselection.property = target; |
|
8987 |
else |
|
8988 |
ev.xselection.property = property; |
|
8989 |
||
8990 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
|
8991 |
ev.xselection.selection, |
|
8992 |
ev.xselection.property, |
|
8993 |
ev.xselection.target, |
|
8994 |
ev.xselection.requestor, |
|
8995 |
requestor)); |
|
8996 |
||
1974 | 8997 |
ENTER_XLIB(); |
1916 | 8998 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
1974 | 8999 |
LEAVE_XLIB(); |
9000 |
||
1916 | 9001 |
if ((result == BadValue) || (result == BadWindow)) { |
9002 |
DPRINTF(("bad status\n")); |
|
9003 |
RETURN (false); |
|
9004 |
} |
|
1974 | 9005 |
ENTER_XLIB(); |
1916 | 9006 |
XFlush(dpy); |
1974 | 9007 |
LEAVE_XLIB(); |
1916 | 9008 |
RETURN (true) |
382 | 9009 |
} |
9010 |
%}. |
|
9011 |
self primitiveFailed. |
|
9012 |
^ false |
|
295 | 9013 |
! |
9014 |
||
1344 | 9015 |
setSelection:anObject owner:aWindowId |
295 | 9016 |
"set the object selection, and make aWindowId be the owner. |
9017 |
This can be used by other Smalltalk(X) applications only." |
|
9018 |
||
9019 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
1344 | 9020 |
^ false |
295 | 9021 |
]. |
9022 |
"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil |
|
9023 |
^ true |
|
9024 |
! |
|
9025 |
||
1344 | 9026 |
setSelectionOwner:aWindowId of:selectionID |
295 | 9027 |
"set the owner of a selection; return false if failed" |
9028 |
||
9029 |
%{ /* NOCONTEXT */ |
|
9030 |
Window win; |
|
9031 |
||
9032 |
if (__isExternalAddress(aWindowId) |
|
9033 |
&& __isAtomID(selectionID) |
|
9034 |
&& ISCONNECTED) { |
|
1344 | 9035 |
Display *dpy = myDpy; |
9036 |
||
9037 |
win = _WindowVal(aWindowId); |
|
9038 |
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); |
|
9039 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { |
|
9040 |
RETURN (false); |
|
9041 |
} |
|
9042 |
RETURN (true); |
|
295 | 9043 |
} |
9044 |
%} |
|
9045 |
. |
|
9046 |
self primitiveFailed. |
|
9047 |
^ nil |
|
9048 |
! |
|
9049 |
||
1344 | 9050 |
setTextSelection:aString owner:aWindowId |
295 | 9051 |
"set the text selection, and make aWindowId be the owner. |
9052 |
This can be used by any other X application." |
|
9053 |
||
9054 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
1344 | 9055 |
'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. |
295 | 9056 |
]. |
9057 |
^ self setTextProperty:cutBuffer0Atom value:aString for:nil |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
9058 |
|
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
9059 |
"Modified: 10.1.1997 / 18:18:00 / cg" |
295 | 9060 |
! ! |
9061 |
||
9062 |
!XWorkstation methodsFor:'window stuff'! |
|
9063 |
||
1344 | 9064 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
295 | 9065 |
"clear a rectangular area to viewbackground" |
9066 |
||
9067 |
%{ /* NOCONTEXT */ |
|
9068 |
||
9069 |
int w, h; |
|
9070 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9071 |
if (ISCONNECTED) { |
1344 | 9072 |
if (__isExternalAddress(aWindowId) |
9073 |
&& __bothSmallInteger(x, y) |
|
9074 |
&& __bothSmallInteger(width, height)) { |
|
9075 |
w = __intVal(width); |
|
9076 |
h = __intVal(height); |
|
9077 |
/* |
|
9078 |
* need this check here: some servers simply dump core with bad args |
|
9079 |
*/ |
|
9080 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 9081 |
ENTER_XLIB(); |
1344 | 9082 |
XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
1974 | 9083 |
LEAVE_XLIB(); |
1344 | 9084 |
} |
9085 |
RETURN ( self ); |
|
9086 |
} |
|
295 | 9087 |
} |
9088 |
%} |
|
9089 |
. |
|
9090 |
self primitiveFailed |
|
9091 |
! |
|
9092 |
||
1344 | 9093 |
clearWindow:aWindowId |
295 | 9094 |
"clear a window to viewbackground" |
9095 |
||
9096 |
%{ /* NOCONTEXT */ |
|
9097 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9098 |
if (ISCONNECTED) { |
1344 | 9099 |
if (__isExternalAddress(aWindowId)) { |
1974 | 9100 |
ENTER_XLIB(); |
1344 | 9101 |
XClearWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9102 |
LEAVE_XLIB(); |
1344 | 9103 |
RETURN ( self ); |
9104 |
} |
|
295 | 9105 |
} |
9106 |
%} |
|
9107 |
. |
|
9108 |
self primitiveFailed |
|
9109 |
! |
|
9110 |
||
1344 | 9111 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
295 | 9112 |
"configure stacking operation of aWindowId w.r.t siblingId" |
9113 |
||
9114 |
%{ /* NOCONTEXT */ |
|
9115 |
||
9116 |
XWindowChanges chg; |
|
9117 |
int mask = CWSibling | CWStackMode; |
|
9118 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9119 |
if (ISCONNECTED) { |
1344 | 9120 |
if (__isExternalAddress(aWindowId) |
9121 |
&& __isExternalAddress(siblingId)) { |
|
9122 |
if (modeSymbol == @symbol(above)) { |
|
9123 |
chg.stack_mode = Above; |
|
9124 |
} else if (modeSymbol == @symbol(below)) { |
|
9125 |
chg.stack_mode = Below; |
|
9126 |
} else if (modeSymbol == @symbol(topIf)) { |
|
9127 |
chg.stack_mode = TopIf; |
|
9128 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
9129 |
chg.stack_mode = BottomIf; |
|
9130 |
} else if (modeSymbol == @symbol(opposite)) { |
|
9131 |
chg.stack_mode = Opposite; |
|
9132 |
} else { |
|
9133 |
mask = CWSibling; |
|
9134 |
} |
|
9135 |
||
9136 |
chg.sibling = _WindowVal(siblingId); |
|
1974 | 9137 |
ENTER_XLIB(); |
1344 | 9138 |
XConfigureWindow(myDpy, _WindowVal(aWindowId), |
9139 |
mask, &chg); |
|
1974 | 9140 |
LEAVE_XLIB(); |
1344 | 9141 |
RETURN ( self ); |
9142 |
} |
|
295 | 9143 |
} |
9144 |
bad: ; |
|
9145 |
%} |
|
9146 |
. |
|
9147 |
self primitiveFailed |
|
9148 |
! |
|
9149 |
||
1344 | 9150 |
lowerWindow:aWindowId |
295 | 9151 |
"bring a window to back" |
9152 |
||
9153 |
%{ /* NOCONTEXT */ |
|
9154 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9155 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9156 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9157 |
ENTER_XLIB(); |
1344 | 9158 |
XLowerWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9159 |
LEAVE_XLIB(); |
1344 | 9160 |
RETURN ( self ); |
295 | 9161 |
} |
9162 |
%} |
|
9163 |
. |
|
9164 |
self primitiveFailed |
|
9165 |
! |
|
9166 |
||
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9167 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9168 |
width:w height:h minExtent:minExt maxExtent:maxExt |
295 | 9169 |
"make a window visible - either as icon or as a real view - needed for restart" |
9170 |
||
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9171 |
|wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH| |
295 | 9172 |
|
9173 |
aBoolean ifTrue:[ |
|
1344 | 9174 |
wicon := aView icon. |
9175 |
wicon notNil ifTrue:[ |
|
9176 |
wiconId := wicon id |
|
9177 |
]. |
|
9178 |
wiconView := aView iconView. |
|
9179 |
wiconView notNil ifTrue:[ |
|
9180 |
wiconViewId := wiconView id |
|
9181 |
]. |
|
9182 |
wlabel := aView label. |
|
295 | 9183 |
]. |
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9184 |
minExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9185 |
minW := minExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9186 |
minH := minExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9187 |
]. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9188 |
maxExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9189 |
maxW := maxExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9190 |
maxH := maxExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9191 |
]. |
295 | 9192 |
%{ |
9193 |
||
9194 |
XWMHints wmhints; |
|
9195 |
XSizeHints szhints; |
|
9196 |
Window win; |
|
9197 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9198 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9199 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9200 |
Display *dpy = myDpy; |
9201 |
||
9202 |
win = _WindowVal(aWindowId); |
|
9203 |
||
9204 |
szhints.flags = 0; |
|
9205 |
if (__bothSmallInteger(xPos, yPos)) { |
|
9206 |
szhints.x = __intVal(xPos); |
|
9207 |
szhints.y = __intVal(yPos); |
|
9208 |
szhints.flags |= USPosition; |
|
9209 |
} |
|
9210 |
if (__bothSmallInteger(w, h)) { |
|
9211 |
szhints.width = __intVal(w); |
|
9212 |
szhints.height = __intVal(h); |
|
9213 |
szhints.flags |= USSize; |
|
9214 |
} |
|
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9215 |
if (__bothSmallInteger(minW, minH)) { |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9216 |
szhints.flags |= PMinSize; |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9217 |
szhints.min_width = __intVal(minW); |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9218 |
szhints.min_height = __intVal(minH); |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9219 |
} |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9220 |
if (__bothSmallInteger(maxW, maxH)) { |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9221 |
szhints.flags |= PMaxSize; |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9222 |
szhints.max_width = __intVal(maxW); |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9223 |
szhints.max_height = __intVal(maxH); |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9224 |
} |
1344 | 9225 |
|
9226 |
if (aBoolean == true) { |
|
9227 |
char *windowName; |
|
9228 |
Pixmap iconBitmap = (Pixmap)0; |
|
9229 |
Window iconWindow; |
|
9230 |
||
9231 |
if (__isExternalAddress(wiconId)) |
|
9232 |
iconBitmap = _PixmapVal(wiconId); |
|
9233 |
else |
|
9234 |
iconBitmap = (Pixmap)0; |
|
9235 |
||
9236 |
if (__isExternalAddress(wiconViewId)) |
|
9237 |
iconWindow = _WindowVal(wiconViewId); |
|
9238 |
else |
|
9239 |
iconWindow = (Window)0; |
|
9240 |
||
9241 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1831 | 9242 |
windowName = (char *) __stringVal(wlabel); |
1344 | 9243 |
else |
9244 |
windowName = ""; |
|
9245 |
||
9246 |
if (iconBitmap || windowName) { |
|
1974 | 9247 |
ENTER_XLIB(); |
1344 | 9248 |
XSetStandardProperties(dpy, win, |
9249 |
windowName, windowName, |
|
9250 |
iconBitmap, |
|
9251 |
0, 0, &szhints); |
|
1974 | 9252 |
LEAVE_XLIB(); |
1344 | 9253 |
} |
9254 |
||
9255 |
wmhints.flags = 0; |
|
9256 |
if (iconBitmap) { |
|
9257 |
wmhints.flags |= IconPixmapHint; |
|
9258 |
wmhints.icon_pixmap = iconBitmap; |
|
9259 |
} |
|
9260 |
if (iconWindow) { |
|
9261 |
wmhints.flags |= IconWindowHint; |
|
9262 |
wmhints.icon_window = iconWindow; |
|
9263 |
} |
|
9264 |
||
9265 |
wmhints.initial_state = IconicState; |
|
9266 |
wmhints.flags |= StateHint; |
|
1974 | 9267 |
ENTER_XLIB(); |
1344 | 9268 |
XSetWMHints(dpy, win, &wmhints); |
1974 | 9269 |
LEAVE_XLIB(); |
1344 | 9270 |
} |
9271 |
||
9272 |
if (szhints.flags) { |
|
1974 | 9273 |
ENTER_XLIB(); |
1344 | 9274 |
XSetNormalHints(dpy, win, &szhints); |
1974 | 9275 |
LEAVE_XLIB(); |
9276 |
} |
|
9277 |
||
9278 |
ENTER_XLIB(); |
|
1344 | 9279 |
XMapWindow(dpy, win); |
1974 | 9280 |
LEAVE_XLIB(); |
1344 | 9281 |
RETURN ( self ); |
295 | 9282 |
} |
9283 |
%} |
|
9284 |
. |
|
9285 |
self primitiveFailed |
|
9286 |
! |
|
9287 |
||
1344 | 9288 |
mapWindow:aWindowId |
295 | 9289 |
"make a window visible" |
9290 |
||
9291 |
%{ /* NOCONTEXT */ |
|
9292 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9293 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9294 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9295 |
ENTER_XLIB(); |
1344 | 9296 |
XMapWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9297 |
LEAVE_XLIB(); |
1344 | 9298 |
RETURN ( self ); |
295 | 9299 |
} |
9300 |
%} |
|
9301 |
. |
|
9302 |
self primitiveFailed |
|
9303 |
! |
|
9304 |
||
1344 | 9305 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
295 | 9306 |
"move and resize a window" |
9307 |
||
9308 |
%{ /* NOCONTEXT */ |
|
9309 |
||
9310 |
int newWidth, newHeight; |
|
9311 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9312 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9313 |
&& __isExternalAddress(aWindowId) |
295 | 9314 |
&& __bothSmallInteger(w, h) |
9315 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 9316 |
newWidth = __intVal(w); |
9317 |
newHeight = __intVal(h); |
|
9318 |
if (newWidth < 1) newWidth = 1; |
|
9319 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 9320 |
ENTER_XLIB(); |
1344 | 9321 |
XMoveResizeWindow(myDpy, _WindowVal(aWindowId), |
9322 |
__intVal(x), __intVal(y), |
|
9323 |
newWidth, newHeight); |
|
1974 | 9324 |
LEAVE_XLIB(); |
1344 | 9325 |
RETURN ( self ); |
295 | 9326 |
} |
9327 |
%} |
|
9328 |
. |
|
9329 |
self primitiveFailed |
|
9330 |
! |
|
9331 |
||
1344 | 9332 |
moveWindow:aWindowId x:x y:y |
295 | 9333 |
"move a window" |
9334 |
||
9335 |
%{ /* NOCONTEXT */ |
|
9336 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9337 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9338 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
1974 | 9339 |
ENTER_XLIB(); |
1344 | 9340 |
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); |
1974 | 9341 |
LEAVE_XLIB(); |
1344 | 9342 |
RETURN ( self ); |
295 | 9343 |
} |
9344 |
%} |
|
9345 |
. |
|
9346 |
self primitiveFailed |
|
9347 |
! |
|
9348 |
||
1344 | 9349 |
raiseWindow:aWindowId |
295 | 9350 |
"bring a window to front" |
9351 |
||
9352 |
%{ /* NOCONTEXT */ |
|
9353 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9354 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9355 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9356 |
ENTER_XLIB(); |
1344 | 9357 |
XRaiseWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9358 |
LEAVE_XLIB(); |
1344 | 9359 |
RETURN ( self ); |
295 | 9360 |
} |
9361 |
%} |
|
9362 |
. |
|
9363 |
self primitiveFailed |
|
9364 |
! |
|
9365 |
||
1344 | 9366 |
resizeWindow:aWindowId width:w height:h |
295 | 9367 |
"resize a window" |
9368 |
||
9369 |
%{ /* NOCONTEXT */ |
|
9370 |
||
9371 |
int newWidth, newHeight; |
|
9372 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9373 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9374 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
1344 | 9375 |
newWidth = __intVal(w); |
9376 |
newHeight = __intVal(h); |
|
9377 |
if (newWidth < 1) newWidth = 1; |
|
9378 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 9379 |
ENTER_XLIB(); |
1344 | 9380 |
XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); |
1974 | 9381 |
LEAVE_XLIB(); |
1344 | 9382 |
RETURN ( self ); |
295 | 9383 |
} |
9384 |
%} |
|
9385 |
. |
|
9386 |
self primitiveFailed |
|
9387 |
! |
|
9388 |
||
1344 | 9389 |
setBackingStore:how in:aWindowId |
295 | 9390 |
"turn on/off backing-store for a window" |
9391 |
||
9392 |
%{ /* NOCONTEXT */ |
|
9393 |
||
9394 |
XSetWindowAttributes wa; |
|
9395 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9396 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9397 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9398 |
if (__INST(ignoreBackingStore) != true) { |
9399 |
if (how == @symbol(always)) wa.backing_store = Always; |
|
9400 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
9401 |
else if (how == true) wa.backing_store = Always; |
|
9402 |
else wa.backing_store = 0; |
|
9403 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9404 |
ENTER_XLIB(); |
1344 | 9405 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); |
1974 | 9406 |
LEAVE_XLIB(); |
1344 | 9407 |
END_INTERRUPTSBLOCKED |
9408 |
} |
|
9409 |
RETURN ( self ); |
|
295 | 9410 |
} |
9411 |
%}. |
|
9412 |
self primitiveFailed |
|
9413 |
! |
|
9414 |
||
1344 | 9415 |
setBitGravity:how in:aWindowId |
295 | 9416 |
"set bit gravity for a window" |
9417 |
||
9418 |
%{ /* NOCONTEXT */ |
|
9419 |
||
9420 |
XSetWindowAttributes wa; |
|
9421 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9422 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9423 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9424 |
if (how == @symbol(NorthWest)) { |
9425 |
wa.bit_gravity = NorthWestGravity; |
|
9426 |
} else if (how == @symbol(NorthEast)) { |
|
9427 |
wa.bit_gravity = NorthEastGravity; |
|
9428 |
} else if (how == @symbol(SouthWest)) { |
|
9429 |
wa.bit_gravity = SouthWestGravity; |
|
9430 |
} else if (how == @symbol(SouthEast)) { |
|
9431 |
wa.bit_gravity = SouthEastGravity; |
|
9432 |
} else if (how == @symbol(Center)) { |
|
9433 |
wa.bit_gravity = CenterGravity; |
|
9434 |
} else if (how == @symbol(North)) { |
|
9435 |
wa.bit_gravity = NorthGravity; |
|
9436 |
} else if (how == @symbol(South)) { |
|
9437 |
wa.bit_gravity = SouthGravity; |
|
9438 |
} else if (how == @symbol(West)) { |
|
9439 |
wa.bit_gravity = WestGravity; |
|
9440 |
} else if (how == @symbol(East)) { |
|
9441 |
wa.bit_gravity = EastGravity; |
|
9442 |
} else { |
|
9443 |
wa.bit_gravity = NorthWestGravity; |
|
9444 |
} |
|
9445 |
||
9446 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9447 |
ENTER_XLIB(); |
1344 | 9448 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); |
1974 | 9449 |
LEAVE_XLIB(); |
1344 | 9450 |
END_INTERRUPTSBLOCKED |
9451 |
RETURN ( self ); |
|
295 | 9452 |
} |
9453 |
%}. |
|
9454 |
self primitiveFailed |
|
9455 |
! |
|
9456 |
||
1344 | 9457 |
setCursor:aCursorId in:aWindowId |
295 | 9458 |
"define a windows cursor" |
9459 |
||
9460 |
%{ /* NOCONTEXT */ |
|
9461 |
||
9462 |
Display *dpy = myDpy; |
|
9463 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9464 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9465 |
&& __isExternalAddress(aWindowId) |
295 | 9466 |
&& __isExternalAddress(aCursorId)) { |
1974 | 9467 |
ENTER_XLIB(); |
1344 | 9468 |
XDefineCursor(dpy, _WindowVal(aWindowId), _CursorVal(aCursorId)); |
1974 | 9469 |
LEAVE_XLIB(); |
1344 | 9470 |
RETURN ( self ); |
295 | 9471 |
} |
9472 |
%}. |
|
9473 |
self primitiveFailed |
|
9474 |
! |
|
9475 |
||
1344 | 9476 |
setIconName:aString in:aWindowId |
295 | 9477 |
"define a windows iconname" |
9478 |
||
9479 |
%{ /* NOCONTEXT */ |
|
9480 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9481 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9482 |
&& __isExternalAddress(aWindowId) |
295 | 9483 |
&& (__isString(aString) || __isSymbol(aString))) { |
1974 | 9484 |
ENTER_XLIB(); |
1831 | 9485 |
XSetIconName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 9486 |
LEAVE_XLIB(); |
1344 | 9487 |
RETURN ( self ); |
295 | 9488 |
} |
9489 |
%}. |
|
9490 |
self primitiveFailed |
|
9491 |
! |
|
9492 |
||
1344 | 9493 |
setSaveUnder:yesOrNo in:aWindowId |
295 | 9494 |
"turn on/off save-under for a window" |
9495 |
||
9496 |
%{ /* NOCONTEXT */ |
|
9497 |
||
9498 |
XSetWindowAttributes wa; |
|
9499 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9500 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9501 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9502 |
if (__INST(hasSaveUnder) == true) { |
9503 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
|
1974 | 9504 |
ENTER_XLIB(); |
1344 | 9505 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); |
1974 | 9506 |
LEAVE_XLIB(); |
1344 | 9507 |
} |
9508 |
RETURN ( self ); |
|
295 | 9509 |
} |
9510 |
%}. |
|
9511 |
self primitiveFailed |
|
9512 |
! |
|
9513 |
||
1344 | 9514 |
setTransient:aWindowId for:aMainWindowId |
295 | 9515 |
"set aWindowId to be a transient of aMainWindow" |
9516 |
||
9517 |
%{ /* NOCONTEXT */ |
|
9518 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9519 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9520 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9521 |
Window w; |
9522 |
||
9523 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
|
9524 |
w = (Window) 0; |
|
9525 |
} else { |
|
9526 |
if (__isExternalAddress(aMainWindowId)) { |
|
9527 |
w = _WindowVal(aMainWindowId); |
|
9528 |
} else { |
|
9529 |
goto getOutOfHere; |
|
9530 |
} |
|
9531 |
} |
|
1974 | 9532 |
ENTER_XLIB(); |
1344 | 9533 |
XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); |
1974 | 9534 |
LEAVE_XLIB(); |
1344 | 9535 |
RETURN ( self ); |
295 | 9536 |
} |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
9537 |
getOutOfHere: ; |
295 | 9538 |
%}. |
9539 |
self primitiveFailed |
|
9540 |
! |
|
9541 |
||
1344 | 9542 |
setWindowBackground:aColorIndex in:aWindowId |
295 | 9543 |
"set the windows background color. This is the color with which |
9544 |
the view is filled whenever exposed. Do not confuse this with |
|
9545 |
the background drawing color, which is used with opaque drawing." |
|
9546 |
||
9547 |
%{ /* NOCONTEXT */ |
|
9548 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9549 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9550 |
&& __isExternalAddress(aWindowId) |
295 | 9551 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 9552 |
ENTER_XLIB(); |
1344 | 9553 |
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 9554 |
LEAVE_XLIB(); |
1344 | 9555 |
RETURN ( self ); |
295 | 9556 |
} |
9557 |
%}. |
|
9558 |
self primitiveFailed |
|
9559 |
! |
|
9560 |
||
1344 | 9561 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
295 | 9562 |
"set the windows background pattern to be a form. |
9563 |
This is the pattern with which the view is filled whenever exposed. |
|
9564 |
Do not confuse this with the background drawing color, which is used |
|
9565 |
with opaque drawing." |
|
9566 |
||
9567 |
%{ /* NOCONTEXT */ |
|
9568 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9569 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9570 |
&& __isExternalAddress(aWindowId) |
295 | 9571 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9572 |
ENTER_XLIB(); |
1344 | 9573 |
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
1974 | 9574 |
LEAVE_XLIB(); |
1344 | 9575 |
RETURN ( self ); |
295 | 9576 |
} |
9577 |
%}. |
|
9578 |
self primitiveFailed |
|
9579 |
! |
|
9580 |
||
1344 | 9581 |
setWindowBorderColor:aColorIndex in:aWindowId |
295 | 9582 |
"set the windows border color" |
9583 |
||
9584 |
%{ /* NOCONTEXT */ |
|
9585 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9586 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9587 |
&& __isExternalAddress(aWindowId) |
295 | 9588 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 9589 |
ENTER_XLIB(); |
1344 | 9590 |
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 9591 |
LEAVE_XLIB(); |
1344 | 9592 |
RETURN ( self ); |
295 | 9593 |
} |
9594 |
%}. |
|
9595 |
self primitiveFailed |
|
9596 |
! |
|
9597 |
||
1344 | 9598 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
295 | 9599 |
"set the windows border pattern" |
9600 |
||
9601 |
%{ /* NOCONTEXT */ |
|
9602 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9603 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9604 |
&& __isExternalAddress(aWindowId) |
295 | 9605 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9606 |
ENTER_XLIB(); |
1344 | 9607 |
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
1974 | 9608 |
LEAVE_XLIB(); |
1344 | 9609 |
RETURN ( self ); |
295 | 9610 |
} |
9611 |
%} |
|
9612 |
. |
|
9613 |
self primitiveFailed |
|
9614 |
! |
|
9615 |
||
1344 | 9616 |
setWindowBorderShape:aPixmapId in:aWindowId |
295 | 9617 |
"set the windows border shape" |
9618 |
||
9619 |
hasShapeExtension ifFalse:[^ self]. |
|
9620 |
||
9621 |
%{ /* NOCONTEXT */ |
|
9622 |
||
9623 |
#ifdef SHAPE |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9624 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9625 |
&& __isExternalAddress(aWindowId) |
295 | 9626 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9627 |
ENTER_XLIB(); |
1344 | 9628 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, |
9629 |
0, 0, _PixmapVal(aPixmapId), ShapeSet); |
|
1974 | 9630 |
LEAVE_XLIB(); |
1344 | 9631 |
RETURN ( self ); |
295 | 9632 |
} |
9633 |
#endif |
|
9634 |
%}. |
|
9635 |
self primitiveFailed |
|
9636 |
! |
|
9637 |
||
1344 | 9638 |
setWindowBorderWidth:aNumber in:aWindowId |
295 | 9639 |
"set the windows border width" |
9640 |
||
9641 |
%{ /* NOCONTEXT */ |
|
9642 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9643 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9644 |
&& __isExternalAddress(aWindowId) |
295 | 9645 |
&& __isSmallInteger(aNumber)) { |
1974 | 9646 |
ENTER_XLIB(); |
1344 | 9647 |
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); |
1974 | 9648 |
LEAVE_XLIB(); |
1344 | 9649 |
RETURN ( self ); |
295 | 9650 |
} |
9651 |
%}. |
|
9652 |
self primitiveFailed |
|
9653 |
! |
|
9654 |
||
1344 | 9655 |
setWindowClass:wClass name:wName in:aWindowId |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9656 |
"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
|
9657 |
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
|
9658 |
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
|
9659 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9660 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9661 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9662 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9663 |
XClassHint classhint; |
9664 |
||
9665 |
classhint.res_class = classhint.res_name = 0; |
|
9666 |
||
9667 |
if (__isString(wClass) || __isSymbol(wClass)) { |
|
1831 | 9668 |
classhint.res_class = (char *) __stringVal(wClass); |
1344 | 9669 |
} else if (wClass != nil) |
9670 |
goto error; |
|
9671 |
||
9672 |
if (__isString(wName) || __isSymbol(wName)) { |
|
1831 | 9673 |
classhint.res_name = (char *) __stringVal(wName); |
1344 | 9674 |
} else if (wName != nil) |
9675 |
goto error; |
|
9676 |
||
1974 | 9677 |
ENTER_XLIB(); |
1344 | 9678 |
XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); |
1974 | 9679 |
LEAVE_XLIB(); |
1344 | 9680 |
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
|
9681 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9682 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9683 |
%}. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9684 |
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
|
9685 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9686 |
|
1344 | 9687 |
setWindowGravity:how in:aWindowId |
295 | 9688 |
"set window gravity for a window" |
9689 |
||
9690 |
%{ /* NOCONTEXT */ |
|
9691 |
||
9692 |
XSetWindowAttributes wa; |
|
9693 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9694 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9695 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9696 |
if (how == @symbol(NorthWest)) { |
9697 |
wa.win_gravity = NorthWestGravity; |
|
9698 |
} else if (how == @symbol(NorthEast)) { |
|
9699 |
wa.win_gravity = NorthEastGravity; |
|
9700 |
} else if (how == @symbol(SouthWest)) { |
|
9701 |
wa.win_gravity = SouthWestGravity; |
|
9702 |
} else if (how == @symbol(SouthEast)) { |
|
9703 |
wa.win_gravity = SouthEastGravity; |
|
9704 |
} else if (how == @symbol(Center)) { |
|
9705 |
wa.win_gravity = CenterGravity; |
|
9706 |
} else if (how == @symbol(North)) { |
|
9707 |
wa.win_gravity = NorthGravity; |
|
9708 |
} else if (how == @symbol(South)) { |
|
9709 |
wa.win_gravity = SouthGravity; |
|
9710 |
} else if (how == @symbol(West)) { |
|
9711 |
wa.win_gravity = WestGravity; |
|
9712 |
} else if (how == @symbol(East)) { |
|
9713 |
wa.win_gravity = EastGravity; |
|
9714 |
} else { |
|
9715 |
wa.win_gravity = NorthWestGravity; |
|
9716 |
} |
|
9717 |
||
9718 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9719 |
ENTER_XLIB(); |
1344 | 9720 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); |
1974 | 9721 |
LEAVE_XLIB(); |
1344 | 9722 |
END_INTERRUPTSBLOCKED |
9723 |
RETURN ( self ); |
|
295 | 9724 |
} |
9725 |
%}. |
|
9726 |
self primitiveFailed |
|
9727 |
! |
|
9728 |
||
1344 | 9729 |
setWindowIcon:aForm in:aWindowId |
295 | 9730 |
"define a bitmap to be used as icon" |
9731 |
||
9732 |
|iconId| |
|
9733 |
||
9734 |
aForm notNil ifTrue:[ |
|
1344 | 9735 |
iconId := aForm id |
295 | 9736 |
]. |
9737 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9738 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9739 |
&& __isExternalAddress(iconId) |
295 | 9740 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9741 |
XWMHints hints; |
9742 |
||
9743 |
hints.icon_pixmap = _PixmapVal(iconId); |
|
9744 |
hints.flags = IconPixmapHint; |
|
1974 | 9745 |
ENTER_XLIB(); |
1344 | 9746 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
1974 | 9747 |
LEAVE_XLIB(); |
1344 | 9748 |
RETURN ( self ); |
295 | 9749 |
} |
9750 |
%}. |
|
9751 |
self primitiveFailed |
|
9752 |
! |
|
9753 |
||
1376 | 9754 |
setWindowIcon:aForm mask:aMaskForm in:aWindowId |
1535 | 9755 |
"define a windows icon and (optional) iconMask." |
9756 |
||
9757 |
|iconId maskId| |
|
9758 |
||
9759 |
aForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9760 |
iconId := aForm id |
1535 | 9761 |
]. |
9762 |
aMaskForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9763 |
maskId := aMaskForm id. |
1535 | 9764 |
]. |
9765 |
%{ |
|
9766 |
if (ISCONNECTED |
|
9767 |
&& __isExternalAddress(iconId) |
|
9768 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9769 |
XWMHints hints; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9770 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9771 |
hints.icon_pixmap = _PixmapVal(iconId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9772 |
hints.flags = IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9773 |
if ((maskId != nil) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9774 |
&& __isExternalAddress(maskId)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9775 |
hints.icon_mask = _PixmapVal(maskId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9776 |
hints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9777 |
} |
1974 | 9778 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9779 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
1974 | 9780 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9781 |
RETURN ( self ); |
1535 | 9782 |
} |
9783 |
%}. |
|
9784 |
self primitiveFailed |
|
9785 |
||
1376 | 9786 |
! |
9787 |
||
1344 | 9788 |
setWindowIconWindow:aView in:aWindowId |
295 | 9789 |
"define a window to be used as icon" |
9790 |
||
9791 |
|iconWindowId| |
|
9792 |
||
9793 |
aView notNil ifTrue:[ |
|
1344 | 9794 |
iconWindowId := aView id |
295 | 9795 |
]. |
9796 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9797 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9798 |
&& __isExternalAddress(iconWindowId) |
295 | 9799 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9800 |
XWMHints wmhints; |
9801 |
||
9802 |
wmhints.icon_window = _WindowVal(iconWindowId); |
|
9803 |
wmhints.flags = IconWindowHint; |
|
1974 | 9804 |
ENTER_XLIB(); |
1344 | 9805 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); |
1974 | 9806 |
LEAVE_XLIB(); |
1344 | 9807 |
RETURN ( self ); |
295 | 9808 |
} |
9809 |
%}. |
|
9810 |
self primitiveFailed |
|
9811 |
! |
|
9812 |
||
1344 | 9813 |
setWindowName:aString in:aWindowId |
295 | 9814 |
"define a windows name" |
9815 |
||
9816 |
%{ /* NOCONTEXT */ |
|
9817 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9818 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9819 |
&& __isExternalAddress(aWindowId) |
295 | 9820 |
&& (__isString(aString) || __isSymbol(aString))) { |
1974 | 9821 |
ENTER_XLIB(); |
1831 | 9822 |
XStoreName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 9823 |
LEAVE_XLIB(); |
1344 | 9824 |
RETURN ( self ); |
295 | 9825 |
} |
9826 |
%}. |
|
9827 |
self primitiveFailed |
|
9828 |
! |
|
9829 |
||
1344 | 9830 |
setWindowShape:aPixmapId in:aWindowId |
295 | 9831 |
"set the windows shape" |
9832 |
||
9833 |
hasShapeExtension ifFalse:[^ self]. |
|
9834 |
||
9835 |
%{ /* NOCONTEXT */ |
|
9836 |
||
9837 |
#ifdef SHAPE |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9838 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9839 |
&& __isExternalAddress(aWindowId) |
295 | 9840 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9841 |
ENTER_XLIB(); |
1344 | 9842 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, |
9843 |
0, 0, |
|
9844 |
_PixmapVal(aPixmapId), ShapeSet); |
|
1974 | 9845 |
LEAVE_XLIB(); |
1344 | 9846 |
RETURN ( self ); |
295 | 9847 |
} |
9848 |
#endif |
|
9849 |
%}. |
|
9850 |
self primitiveFailed |
|
9851 |
! |
|
9852 |
||
1344 | 9853 |
unmapWindow:aWindowId |
295 | 9854 |
"make a window invisible" |
9855 |
||
9856 |
%{ /* NOCONTEXT */ |
|
9857 |
||
1214 | 9858 |
if (!ISCONNECTED) { |
1344 | 9859 |
RETURN ( self ); |
1214 | 9860 |
} |
9861 |
||
9862 |
if (__isExternalAddress(aWindowId)) { |
|
1974 | 9863 |
ENTER_XLIB(); |
1344 | 9864 |
XUnmapWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9865 |
LEAVE_XLIB(); |
1344 | 9866 |
RETURN ( self ); |
9867 |
} |
|
9868 |
%}. |
|
295 | 9869 |
self primitiveFailed |
1535 | 9870 |
! |
9871 |
||
9872 |
windowIsIconified:aWindowId |
|
9873 |
"return true, if some window is iconified. |
|
9874 |
The passed windowID may be an alien windows id." |
|
9875 |
||
9876 |
%{ /* NOCONTEXT */ |
|
9877 |
||
9878 |
if (ISCONNECTED |
|
9879 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9880 |
Atom JunkAtom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9881 |
int JunkInt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9882 |
unsigned long WinState,JunkLong; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9883 |
unsigned char *Property; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9884 |
Atom WM_STATE_Atom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9885 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9886 |
if (__INST(wmStateAtom) != nil) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9887 |
WM_STATE_Atom = _AtomVal(__INST(wmStateAtom)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9888 |
|
1974 | 9889 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9890 |
XGetWindowProperty(myDpy, _WindowVal(aWindowId), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9891 |
WM_STATE_Atom, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9892 |
0L, 2L, False, AnyPropertyType, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9893 |
&JunkAtom,&JunkInt,&WinState,&JunkLong, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9894 |
&Property); |
1974 | 9895 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9896 |
WinState=(unsigned long)(*((long*)Property)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9897 |
if (WinState==3) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9898 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9899 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9900 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9901 |
RETURN (false); |
1535 | 9902 |
} |
9903 |
%}. |
|
9904 |
self primitiveFailed |
|
9905 |
||
9906 |
||
9907 |
||
295 | 9908 |
! ! |
9909 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
9910 |
!XWorkstation class methodsFor:'documentation'! |
295 | 9911 |
|
9912 |
version |
|
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
9913 |
^ '$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.283 1998-06-13 11:55:14 cg Exp $' |
295 | 9914 |
! ! |
9915 |
XWorkstation initialize! |