author | Claus Gittinger <cg@exept.de> |
Fri, 10 Sep 1999 18:16:27 +0200 | |
changeset 2896 | cad683a945dc |
parent 2871 | f33c75104fa9 |
child 2904 | 9a2c6cef065f |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
1344 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
DeviceWorkstation subclass:#XWorkstation |
|
1344 | 14 |
instanceVariableNames:'screen hasShapeExtension hasShmExtension hasDPSExtension |
15 |
hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
|
16 |
hasImageExtension hasInputExtension ignoreBackingStore blackpixel |
|
17 |
whitepixel protocolsAtom deleteWindowAtom saveYourselfAtom |
|
18 |
quitAppAtom primaryAtom secondaryAtom cutBuffer0Atom stringAtom |
|
1535 | 19 |
lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX |
20 |
eventRootY displayName eventTrace dispatchingExpose rgbVisual |
|
21 |
virtualRootId rootId eventBuffer altModifierMask metaModifierMask |
|
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
22 |
multiClickTime deviceIOTimeoutErrorSignal activateOnClick' |
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
23 |
classVariableNames:'RawKeysymTranslation ConservativeSync' |
1344 | 24 |
poolDictionaries:'' |
25 |
category:'Interface-Graphics' |
|
295 | 26 |
! |
0 | 27 |
|
78 | 28 |
!XWorkstation primitiveDefinitions! |
0 | 29 |
%{ |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
30 |
|
1062 | 31 |
#ifdef LINUX |
32 |
# define SHM |
|
33 |
#endif |
|
34 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
35 |
#define COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
36 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
37 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
38 |
static int __cnt_color = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
39 |
static int __cnt_bitmap = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
40 |
static int __cnt_view = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
41 |
static int __cnt_gc = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
42 |
static int __cnt_cursor = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
43 |
static int __cnt_font = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
44 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
45 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
46 |
|
46 | 47 |
/* |
48 |
* x does a typedef Time - I need Object Time ... |
|
49 |
*/ |
|
2791 | 50 |
#undef Time |
0 | 51 |
#define Time XTime |
52 |
||
391
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
53 |
/* |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
54 |
* x does a #define True / False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
55 |
* we are lucky - the ST/X True/False are not needed |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
56 |
*/ |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
57 |
#undef True |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
58 |
#undef False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
59 |
|
37 | 60 |
#ifdef memset |
61 |
# undef memset |
|
62 |
#endif |
|
63 |
||
1891 | 64 |
|
0 | 65 |
#include <stdio.h> |
66 |
#include <X11/Xlib.h> |
|
67 |
#include <X11/Xutil.h> |
|
68 |
#include <X11/Xatom.h> |
|
69 |
||
150 | 70 |
#define XK_MISCELLANY |
71 |
#include <X11/keysymdef.h> |
|
72 |
||
277
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
73 |
#include <X11/cursorfont.h> |
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
74 |
|
1974 | 75 |
#ifdef LINUX |
76 |
# include <sys/socket.h> |
|
77 |
#endif |
|
78 |
||
2422
6bffcb4c8360
changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents:
2386
diff
changeset
|
79 |
|
90 | 80 |
/* |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
81 |
* this define suppresses XAllocColor/XFreeColor on |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
82 |
* TrueColor systems - I am not certain, if this is |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
83 |
* always legal to do (it works with XFree servers). |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
84 |
*/ |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
85 |
#define QUICK_TRUE_COLORS |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
86 |
|
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
87 |
/* |
0 | 88 |
* shape support works; enabled by -DSHAPE in makefile |
89 |
* see RoundClock and RoundGlobe examples |
|
90 |
*/ |
|
91 |
#ifdef SHAPE |
|
92 |
# include <X11/extensions/shape.h> |
|
93 |
#endif |
|
94 |
||
95 |
/* |
|
150 | 96 |
* shared memory extension access is currently not supported |
0 | 97 |
* (only query is implemented) |
98 |
*/ |
|
99 |
#ifdef SHM |
|
100 |
# include <X11/extensions/XShm.h> |
|
101 |
#endif |
|
102 |
||
103 |
/* |
|
150 | 104 |
* multiBuffer extension access is currently not supported |
105 |
* (only query is implemented) |
|
106 |
*/ |
|
107 |
#ifdef MBUF |
|
108 |
# include <X11/extensions/multibuf.h> |
|
109 |
#endif |
|
110 |
||
111 |
/* |
|
112 |
* XVideo extension access is currently not supported |
|
113 |
* (only query is implemented) |
|
114 |
*/ |
|
115 |
#ifdef XVIDEO |
|
116 |
# include <X11/extensions/Xv.h> |
|
117 |
#endif |
|
118 |
||
119 |
/* |
|
186 | 120 |
* PEX extension - if available |
121 |
*/ |
|
122 |
#ifdef PEX5 |
|
123 |
# include <PEX5/PEX.h> |
|
124 |
#endif |
|
125 |
||
126 |
/* |
|
127 |
* XImage extension - if available |
|
128 |
*/ |
|
129 |
#ifdef XIE |
|
130 |
# include <X11/extensions/XIE.h> |
|
131 |
#endif |
|
132 |
||
133 |
/* |
|
90 | 134 |
* when I have more time to check it out, I will support display-PS |
0 | 135 |
*/ |
136 |
#ifdef DPS |
|
137 |
# ifdef sgi |
|
138 |
# include <X11/extensions/XDPS.h> |
|
139 |
# include <X11/extensions/XDPSlib.h> |
|
140 |
# include <X11/extensions/dpsXclient.h> |
|
141 |
# else |
|
142 |
# include <DPS/XDPS.h> |
|
143 |
# include <DPS/XDPSlib.h> |
|
144 |
# include <DPS/dpsXclient.h> |
|
145 |
# endif |
|
146 |
#endif |
|
147 |
||
1898 | 148 |
#if defined(someMachine) |
149 |
/* |
|
150 |
* if nformats cannot be found in the Display structure ... |
|
151 |
*/ |
|
152 |
# define NO_PRIVATE_DISPLAY_ACCESS |
|
153 |
#endif |
|
154 |
||
155 |
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6) |
|
90 | 156 |
/* |
157 |
* accessing private data in Display ... sorry |
|
158 |
*/ |
|
159 |
# define DISPLAYACCESS(d) ((_XPrivDisplay)d) |
|
160 |
#else |
|
161 |
# define DISPLAYACCESS(d) d |
|
162 |
#endif |
|
163 |
||
78 | 164 |
/* |
165 |
* some defines - tired of typing ... |
|
166 |
*/ |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
167 |
#define _DisplayVal(o) (Display *)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
168 |
#define _WindowVal(o) (Window)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
169 |
#define _PixmapVal(o) (Pixmap)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
170 |
#define _GCVal(o) (GC)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
171 |
#define _CursorVal(o) (Cursor)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
172 |
#define _FontVal(o) (XFontStruct *)(__externalAddressVal(o)) |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
173 |
#define _DPSContextVal(o) (DPSContext)(__externalAddressVal(o)) |
207
9124817bbb03
use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents:
206
diff
changeset
|
174 |
|
211 | 175 |
#define __MKATOMOBJ(a) __MKSMALLINT(a) |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
176 |
#define _AtomVal(o) __intVal(o) |
211 | 177 |
#define __isAtomID(o) __isSmallInteger(o) |
178 |
||
555 | 179 |
#define myDpy _DisplayVal(__INST(displayId)) |
180 |
#define ISCONNECTED (__INST(displayId) != nil) |
|
78 | 181 |
|
182 |
#ifndef THISCONTEXT_IN_REGISTER |
|
1098 | 183 |
|
78 | 184 |
# define BEGIN_INTERRUPTSBLOCKED /* */ |
185 |
# define END_INTERRUPTSBLOCKED /* */ |
|
1098 | 186 |
|
78 | 187 |
#else |
1098 | 188 |
|
78 | 189 |
# define BEGIN_INTERRUPTSBLOCKED \ |
190 |
{ \ |
|
1344 | 191 |
int needUnblock = 0; \ |
192 |
\ |
|
193 |
__BEGIN_PROTECT_REGISTERS__ \ |
|
194 |
if (!__interruptsBlocked) { \ |
|
195 |
__BLOCKINTERRUPTS(); \ |
|
196 |
needUnblock = 1; \ |
|
197 |
} |
|
78 | 198 |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
199 |
# define END_INTERRUPTSBLOCKED_NOW \ |
1344 | 200 |
__END_PROTECT_REGISTERS__ \ |
201 |
if (needUnblock) { \ |
|
202 |
__UNBLOCKINTERRUPTS(); \ |
|
203 |
} \ |
|
78 | 204 |
} |
205 |
||
1103
8378530a4e8d
XShmQueryExtension -> XQueryExtension
Claus Gittinger <cg@exept.de>
parents:
1099
diff
changeset
|
206 |
# define END_INTERRUPTSBLOCKED \ |
1344 | 207 |
__END_PROTECT_REGISTERS__ |
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
208 |
|
78 | 209 |
#endif |
1891 | 210 |
|
211 |
#ifdef __VMS__ |
|
1899 | 212 |
# include "vms_Xnames.h" |
1891 | 213 |
#endif |
214 |
||
1974 | 215 |
#ifdef LINUX |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
216 |
# define DEFAULT_XLIB_TIMEOUT 600 /* in 50ms ticks (30 seconds) */ |
1974 | 217 |
static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT; |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
218 |
# define ENTER_XLIB() \ |
1974 | 219 |
{ \ |
220 |
__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ |
|
221 |
__blockingPrimitiveTimeoutArg__ = (INT)self; \ |
|
222 |
__blockingPrimitiveTimeout__ = __xlibTimeout__; \ |
|
223 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
224 |
# define LEAVE_XLIB() \ |
1974 | 225 |
{ \ |
226 |
__blockingPrimitiveTimeout__ = 0; \ |
|
227 |
} |
|
228 |
#else |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
229 |
# define ENTER_XLIB() /* as nothing */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
230 |
# define LEAVE_XLIB() /* as nothing */ |
1974 | 231 |
#endif |
232 |
||
78 | 233 |
%} |
234 |
! ! |
|
235 |
||
236 |
!XWorkstation primitiveVariables! |
|
237 |
%{ |
|
0 | 238 |
/* |
146 | 239 |
* remembered info from private error handler |
0 | 240 |
*/ |
1974 | 241 |
static char lastErrorMsg[128] = ""; |
1888 | 242 |
static unsigned INT lastRequestCode = 0; |
243 |
static unsigned INT lastMinorCode = 0; |
|
244 |
static unsigned INT lastResource = 0; |
|
129 | 245 |
|
246 |
static int __debug__ = 0; |
|
247 |
#define DPRINTF(x) if (__debug__) { printf x; } |
|
78 | 248 |
%} |
249 |
! ! |
|
250 |
||
251 |
!XWorkstation primitiveFunctions! |
|
252 |
%{ |
|
1062 | 253 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
254 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
255 |
* some systems need a dummy reference to force the linker |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
256 |
* to include that stuff. Should be #ifdef'd ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
257 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
258 |
#ifndef ELF |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
259 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
260 |
# ifdef __GNUC__ |
1081 | 261 |
VOLATILE |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
262 |
# endif |
1081 | 263 |
static |
1062 | 264 |
dummyToForceLoading() { |
1344 | 265 |
XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
266 |
XCloseDisplay(0); |
|
267 |
XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
|
268 |
XSetWindowColormap(0, 0, 0); |
|
269 |
XQueryColors(0,0,0,0); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
270 |
# ifdef SHM |
1344 | 271 |
XShmAttach(0, 0); |
272 |
XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
|
273 |
XShmDetach(0, 0); |
|
274 |
XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
|
275 |
shmctl(0,0,0); |
|
276 |
fgetc(0); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
277 |
# endif |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
278 |
} |
1062 | 279 |
#endif |
280 |
||
18 | 281 |
/* |
144 | 282 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
283 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 284 |
* the implementation below is somewhat wrong: it will |
78 | 285 |
* report all errors for Display, even though there could be |
162 | 286 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
287 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 288 |
*/ |
1974 | 289 |
int |
12 | 290 |
__XErrorHandler__(dpy, event) |
0 | 291 |
Display *dpy; |
292 |
XErrorEvent *event; |
|
293 |
{ |
|
1974 | 294 |
XGetErrorText(dpy, event->error_code, lastErrorMsg, 127); |
295 |
lastErrorMsg[127] = '\0'; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
296 |
|
0 | 297 |
if (lastErrorMsg[0] == '\0') { |
1344 | 298 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 299 |
} |
2 | 300 |
lastRequestCode = event->request_code; |
301 |
lastMinorCode = event->minor_code; |
|
302 |
lastResource = event->resourceid; |
|
911 | 303 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
1344 | 304 |
/* |
305 |
* this is a BadWindow error for X_DestroyWindow. |
|
306 |
* ignore it here, since it results from the GC freeing windows |
|
307 |
* in non bottom-up window order. |
|
308 |
*/ |
|
309 |
return 0; |
|
911 | 310 |
} |
2 | 311 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
312 |
if (@global(ErrorPrinting) == true) { |
1753 | 313 |
fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n", |
1344 | 314 |
event->request_code, event->request_code, |
315 |
event->minor_code, event->minor_code, event->resourceid); |
|
1974 | 316 |
fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", |
317 |
event->error_code, lastErrorMsg); |
|
318 |
} |
|
319 |
||
1990 | 320 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy)); |
0 | 321 |
return 0; |
322 |
} |
|
323 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
324 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
325 |
* much like the above, but for IO Errors; |
1974 | 326 |
* forwarded as errorInterrupt:#DisplayIOError, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
327 |
* In single display apps, handling those here does not |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
328 |
* really make sense (except, for a controlled cleanup). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
329 |
* However, in multiDisplay apps, a single broken |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
330 |
* connection should not affect the other users. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
331 |
*/ |
1974 | 332 |
int |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
333 |
__XIOErrorHandler__(dpy) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
334 |
Display *dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
335 |
{ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
336 |
if (@global(ErrorPrinting) == true) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
337 |
fprintf(stderr, "XWorkstation [error]: I/O error\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
338 |
} |
1974 | 339 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError), |
340 |
__MKEXTERNALADDRESS(dpy)); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
341 |
__internalError("unhandled display I/O error"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
342 |
__terminateProcess(0); /* soft terminate */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
343 |
__terminateProcess(1); /* hard terminate */ |
1974 | 344 |
/* never reached */ |
345 |
return 0; |
|
346 |
} |
|
347 |
||
348 |
/* |
|
349 |
* timeout error in case of Xlib request timeout. |
|
350 |
* forwarded as errorInterrupt:#DisplayIOTimeoutError, |
|
351 |
* This is generated synthetically by the VM if the |
|
352 |
* timeoutHandler has been set. |
|
353 |
*/ |
|
354 |
void |
|
355 |
__XTimeoutErrorHandler(displayDeviceInst) |
|
356 |
OBJ displayDeviceInst; |
|
357 |
{ |
|
358 |
if (@global(ErrorPrinting) == true) { |
|
359 |
fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst); |
|
360 |
} |
|
2057
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
361 |
if (displayDeviceInst == @global(MainDisplay)) { |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
362 |
fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n"); |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
363 |
return; |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
364 |
} |
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
365 |
|
1974 | 366 |
/* |
367 |
* must immediately flush that displays deviceID - otherwise, |
|
368 |
* the scheduler may try to ask for pending events without a watchdog |
|
369 |
* timer ... |
|
370 |
*/ |
|
1990 | 371 |
__OINST(displayDeviceInst, displayId) = nil; |
372 |
||
373 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst); |
|
1974 | 374 |
__internalError("unhandled display Timeout error"); |
1990 | 375 |
|
1974 | 376 |
__terminateProcess(0); /* soft terminate */ |
377 |
__terminateProcess(1); /* hard terminate */ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
378 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
379 |
|
90 | 380 |
#ifdef VIRTUAL_ROOT |
0 | 381 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
382 |
* added since RootWindow-macro is not sufficient |
18 | 383 |
* when virtual root-windows are involved (i.e. tvtwm) |
384 |
*/ |
|
385 |
static Window |
|
386 |
getRootWindow(dpy, screen) |
|
387 |
Display *dpy; |
|
388 |
{ |
|
389 |
Window root; |
|
390 |
Atom vRootAtom = None; |
|
391 |
int i; |
|
392 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
393 |
Window* children = (Window *)0; |
18 | 394 |
unsigned int numChildren; |
395 |
||
396 |
root = RootWindow(dpy, screen); |
|
397 |
/* |
|
398 |
* on IRIS, this creates a badwindow error - why ? |
|
399 |
* children contains a funny window (000034) |
|
400 |
*/ |
|
90 | 401 |
# if !defined(IRIS) || defined(IRIX5) |
1887 | 402 |
if (root) { |
1906 | 403 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
1887 | 404 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
405 |
if (vRootAtom != None) { |
|
1906 | 406 |
for (i=0; i < numChildren; i++) { |
1887 | 407 |
Atom actual_type; |
408 |
int actual_format; |
|
409 |
unsigned long nitems, bytesafter; |
|
410 |
Window* newRoot = (Window*) 0; |
|
411 |
||
412 |
if (children[i]) { |
|
1906 | 413 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
1887 | 414 |
0L, 1L, False, XA_WINDOW, |
415 |
&actual_type, &actual_format, &nitems, &bytesafter, |
|
416 |
(unsigned char**) &newRoot) == Success && newRoot) { |
|
417 |
root = *newRoot; |
|
418 |
XFree(newRoot); /* XXX */ |
|
419 |
break; |
|
1906 | 420 |
} |
1344 | 421 |
} |
1906 | 422 |
} |
1344 | 423 |
} |
1887 | 424 |
if (children) XFree( children ); |
425 |
} |
|
18 | 426 |
} |
90 | 427 |
# endif |
18 | 428 |
return root; |
429 |
} |
|
90 | 430 |
#endif |
0 | 431 |
%} |
78 | 432 |
! ! |
0 | 433 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
434 |
!XWorkstation class methodsFor:'documentation'! |
295 | 435 |
|
436 |
copyright |
|
437 |
" |
|
438 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1344 | 439 |
All Rights Reserved |
295 | 440 |
|
441 |
This software is furnished under a license and may be used |
|
442 |
only in accordance with the terms of that license and with the |
|
443 |
inclusion of the above copyright notice. This software may not |
|
444 |
be provided or otherwise made available to, or used by, any |
|
445 |
other person. No title to or ownership of the software is |
|
446 |
hereby transferred. |
|
447 |
" |
|
448 |
! |
|
449 |
||
450 |
documentation |
|
451 |
" |
|
452 |
this class provides the interface to X11. It redefines all required methods |
|
453 |
from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically |
|
454 |
limited to one display - in theory, you can create Views on many displays |
|
455 |
simultanously. However, the default setup is for one display only. |
|
456 |
To support multiple displays, you will have to start another event dispatcher |
|
457 |
process for the other display(s) and create the other views with a slightly |
|
458 |
different protocol. However, 'normal' applications do not have to care for |
|
459 |
all of this ... |
|
460 |
||
461 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 462 |
|
463 |
[author:] |
|
1344 | 464 |
Claus Gittinger |
295 | 465 |
" |
466 |
! ! |
|
467 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
468 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
469 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
470 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
471 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
472 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
473 |
super initialize. |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
474 |
|
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
475 |
ConservativeSync := OperatingSystem platformName == #win32. |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
476 |
|
386 | 477 |
RawKeysymTranslation isNil ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
478 |
"/ the following table maps X-keyevents to ST/X |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
479 |
"/ device independed events. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
480 |
"/ It is NOT meant as a keyboardMap replacement. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
481 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
482 |
RawKeysymTranslation := d := Dictionary new. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
483 |
d at:'Delete_line' put:#DeleteLine. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
484 |
d at:'Delete_word' put:#DeleteWord. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
485 |
d at:'Down' put:#CursorDown. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
486 |
d at:'Up' put:#CursorUp. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
487 |
d at:'Left' put:#CursorLeft. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
488 |
d at:'Right' put:#CursorRight. |
386 | 489 |
] |
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
490 |
|
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
491 |
"Modified: / 27.4.1999 / 17:21:30 / cg" |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
492 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
493 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
494 |
!XWorkstation class methodsFor:'error handling'! |
2 | 495 |
|
129 | 496 |
debug:aBoolean |
497 |
%{ /* NOCONTEXT */ |
|
498 |
||
499 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
500 |
%} |
|
501 |
! |
|
502 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
503 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
504 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
505 |
#ifdef COUNT_RESOURCES |
1404 | 506 |
printf("colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n", |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
507 |
__cnt_color, __cnt_bitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
508 |
__cnt_view, __cnt_gc, __cnt_cursor, __cnt_font); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
509 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
510 |
%} |
1404 | 511 |
|
512 |
" |
|
513 |
XWorkstation debugResources |
|
514 |
" |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
515 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
516 |
|
78 | 517 |
errorStringOfLastError |
518 |
%{ |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
519 |
RETURN ( __MKSTRING(lastErrorMsg) ); |
78 | 520 |
%} |
521 |
! |
|
522 |
||
135 | 523 |
lastErrorString |
2 | 524 |
"return the last X-error string - |
525 |
when buffering is on, this may be |
|
526 |
an error for a long-ago operation" |
|
78 | 527 |
|
528 |
|string requestCode s match line| |
|
529 |
||
530 |
string := self errorStringOfLastError. |
|
531 |
requestCode := self requestCodeOfLastError. |
|
532 |
" |
|
533 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
534 |
and append the name of the corresponding X-request |
|
535 |
" |
|
536 |
s := '/usr/lib/X11/XErrorDB' asFilename readStream. |
|
537 |
s notNil ifTrue:[ |
|
1344 | 538 |
match := 'XRequest.' , requestCode printString. |
539 |
line := s peekForLineStartingWith:match. |
|
540 |
line notNil ifTrue:[ |
|
541 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
542 |
]. |
|
543 |
s close. |
|
78 | 544 |
]. |
545 |
^ string |
|
295 | 546 |
! |
547 |
||
548 |
minorCodeOfLastError |
|
549 |
%{ /* NOCONTEXT */ |
|
550 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
551 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 552 |
%} |
553 |
! |
|
554 |
||
555 |
requestCodeOfLastError |
|
152 | 556 |
%{ /* NOCONTEXT */ |
557 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
558 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 559 |
%} |
135 | 560 |
! |
561 |
||
295 | 562 |
resourceIdOfLastError |
0 | 563 |
%{ /* NOCONTEXT */ |
295 | 564 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
565 |
RETURN ( __MKEXTERNALADDRESS(lastResource) ); |
0 | 566 |
%} |
567 |
! ! |
|
568 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
569 |
!XWorkstation class methodsFor:'queries'! |
104 | 570 |
|
571 |
platformName |
|
133 | 572 |
"ST-80 compatibility. |
2777 | 573 |
Return a string describing the display systems platform. |
574 |
WinWorkstation always returns 'X11'." |
|
133 | 575 |
|
715 | 576 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
577 |
||
578 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 579 |
! ! |
580 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
581 |
!XWorkstation methodsFor:'Signal constants'! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
582 |
|
1974 | 583 |
deviceIOTimeoutErrorSignal |
584 |
"return the per-device signal, which is raised when a timeout |
|
585 |
IO error (i.e. broken connection) occurs." |
|
586 |
||
587 |
^ deviceIOTimeoutErrorSignal |
|
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
588 |
! ! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
589 |
|
0 | 590 |
!XWorkstation methodsFor:'accessing & queries'! |
591 |
||
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
592 |
activateOnClick:aBoolean |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
593 |
"set/clear the activateOnClick behavior. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
594 |
If on, a click into a window raises and activates |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
595 |
the (top) window. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
596 |
Windows users typically enable this; |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
597 |
in contrast, those used to the X-Window system typically prefer |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
598 |
it disabled. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
599 |
Returns the previous setting." |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
600 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
601 |
|prev| |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
602 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
603 |
prev := activateOnClick. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
604 |
activateOnClick := aBoolean. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
605 |
^ prev |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
606 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
607 |
" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
608 |
Display class activateOnClick:true |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
609 |
Display class activateOnClick:false |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
610 |
" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
611 |
! |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
612 |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
613 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
614 |
"return the state-mask for any button in motion events' state-field. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
615 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
616 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
617 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
618 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
619 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
620 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
621 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
622 |
|
295 | 623 |
blackpixel |
624 |
"return the colornumber of black" |
|
625 |
||
626 |
^ blackpixel |
|
627 |
! |
|
628 |
||
629 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
630 |
"return the state-mask for button1 in motion events' state-field. |
295 | 631 |
For backward compatibility." |
632 |
||
633 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
634 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
295 | 635 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
636 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
637 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
638 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
639 |
" |
295 | 640 |
! |
641 |
||
642 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
643 |
"return the state-mask for button2 in motion events' state-field |
295 | 644 |
For backward compatibility." |
645 |
||
646 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
647 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 648 |
%} |
649 |
! |
|
650 |
||
651 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
652 |
"return the state-mask for button3 in motion events' state-field |
295 | 653 |
For backward compatibility." |
654 |
||
655 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
656 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 657 |
%} |
658 |
! |
|
659 |
||
660 |
buttonMotionMask:aButton |
|
661 |
"return the state-mask for button1 in motion events state-field. |
|
662 |
This is the devices mask." |
|
663 |
||
664 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
665 |
if (aButton == __MKSMALLINT(1)) { |
1344 | 666 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
667 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
668 |
if (aButton == __MKSMALLINT(2)) { |
1344 | 669 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
670 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
671 |
if (aButton == __MKSMALLINT(3)) { |
1344 | 672 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 673 |
} |
674 |
%}. |
|
675 |
^ nil |
|
676 |
! |
|
677 |
||
382 | 678 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
679 |
"return the state-mask for the CTRL modified in motion events' state-field." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
680 |
|
382 | 681 |
%{ /* NOCONTEXT */ |
682 |
RETURN (__MKSMALLINT(ControlMask)); |
|
683 |
%} |
|
684 |
! |
|
685 |
||
295 | 686 |
defaultEventMask |
687 |
"return a mask to enable some events by default." |
|
688 |
||
689 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
690 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
1344 | 691 |
KeyPressMask | KeyReleaseMask | |
692 |
EnterWindowMask | LeaveWindowMask | |
|
693 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask )); |
|
295 | 694 |
%} |
695 |
! |
|
696 |
||
0 | 697 |
displayFileDescriptor |
698 |
"return the displays fileNumber - for select" |
|
699 |
||
700 |
%{ /* NOCONTEXT */ |
|
2231 | 701 |
#ifndef WIN32 |
150 | 702 |
if (ISCONNECTED) { |
1344 | 703 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 704 |
} |
2231 | 705 |
#endif |
150 | 706 |
RETURN (nil); |
0 | 707 |
%} |
708 |
! |
|
709 |
||
133 | 710 |
displayName |
711 |
"return the X-connections display name. |
|
712 |
This is (currently) nil for the default display, |
|
713 |
something like foo:0 for any other remote display. |
|
714 |
Future versions may return non-nil strings for the default display as well." |
|
715 |
||
716 |
^ displayName |
|
717 |
! |
|
718 |
||
341 | 719 |
protocolVersion |
720 |
"return the X-servers protocol version - should normally not be of |
|
721 |
any interest" |
|
722 |
||
723 |
%{ /* NOCONTEXT */ |
|
724 |
if (ISCONNECTED) { |
|
1344 | 725 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
341 | 726 |
} |
727 |
RETURN (nil); |
|
728 |
%} |
|
729 |
||
730 |
" |
|
731 |
Display protocolVersion |
|
732 |
" |
|
733 |
! |
|
734 |
||
735 |
serverVendor |
|
736 |
"return the X-server vendor string - this should normally not be of |
|
737 |
any interest, but can be for special cases |
|
738 |
(to avoid bugs in certain implementations)" |
|
739 |
%{ |
|
740 |
if (ISCONNECTED) { |
|
1344 | 741 |
RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
341 | 742 |
} |
743 |
RETURN (nil); |
|
744 |
%} |
|
745 |
||
746 |
" |
|
747 |
Display serverVendor |
|
748 |
" |
|
749 |
! |
|
750 |
||
382 | 751 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
752 |
"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
|
753 |
|
382 | 754 |
%{ /* NOCONTEXT */ |
755 |
RETURN (__MKSMALLINT(ShiftMask)); |
|
756 |
%} |
|
757 |
! |
|
758 |
||
341 | 759 |
translatePoint:aPoint from:windowId1 to:windowId2 |
760 |
"given a point in window1, return the coordinate in window2. |
|
761 |
This expects a device coordinate (relative to the first views origin) |
|
762 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
763 |
- use to xlate points from a window to rootwindow" |
|
764 |
||
765 |
|x1 y1 x2 y2| |
|
766 |
||
767 |
x1 := x2 := aPoint x truncated. |
|
768 |
y1 := y2 := aPoint y truncated. |
|
769 |
%{ |
|
770 |
int xpos, ypos; |
|
771 |
Window w1, w2, child_return; |
|
555 | 772 |
int screen = __intVal(__INST(screen)); |
1209 | 773 |
|
774 |
if (ISCONNECTED |
|
775 |
&& __isExternalAddress(windowId1) |
|
341 | 776 |
&& __isExternalAddress(windowId2) |
777 |
&& __bothSmallInteger(x1, y1)) { |
|
1344 | 778 |
Display *dpy = myDpy; |
1974 | 779 |
Window rootWin; |
1344 | 780 |
|
781 |
w1 = _WindowVal(windowId1); |
|
782 |
w2 = _WindowVal(windowId2); |
|
1974 | 783 |
|
341 | 784 |
#ifdef VIRTUAL_ROOT |
1974 | 785 |
rootWin = RootWindow(dpy, screen); |
786 |
if ((w1 == rootWin) || (w2 == rootWin)) { |
|
787 |
if (w1 == rootWin) { |
|
1344 | 788 |
w1 = getRootWindow(dpy, screen); |
789 |
} |
|
1974 | 790 |
if (w2 == rootWin) { |
1344 | 791 |
w2 = getRootWindow(dpy, screen); |
792 |
} |
|
793 |
} |
|
341 | 794 |
#endif |
1344 | 795 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 796 |
ENTER_XLIB(); |
1344 | 797 |
XTranslateCoordinates(dpy, w1, w2, |
798 |
__intVal(x1), __intVal(y1), |
|
799 |
&xpos, &ypos, &child_return); |
|
1974 | 800 |
LEAVE_XLIB(); |
1344 | 801 |
END_INTERRUPTSBLOCKED |
802 |
x2 = __MKSMALLINT(xpos); |
|
803 |
y2 = __MKSMALLINT(ypos); |
|
341 | 804 |
} |
805 |
%}. |
|
806 |
||
807 |
^ (x2 @ y2) |
|
808 |
! |
|
809 |
||
810 |
vendorRelease |
|
811 |
"return the X-servers vendor release - should normally not be of |
|
812 |
any interest, but can be for special cases. |
|
813 |
(to avoid bugs in certain implementations)" |
|
814 |
||
815 |
%{ /* NOCONTEXT */ |
|
816 |
if (ISCONNECTED) { |
|
1344 | 817 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
341 | 818 |
} |
819 |
RETURN (nil); |
|
820 |
%} |
|
821 |
||
822 |
" |
|
823 |
Display vendorRelease |
|
824 |
" |
|
825 |
! |
|
826 |
||
827 |
viewIdFromPoint:aPoint in:windowId |
|
828 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
829 |
hit by this coordinate. Return nil if no view was hit. |
|
830 |
The returned id may be the id of a non ST view. |
|
831 |
- used to find the window to drop objects after a cross-view drag." |
|
832 |
||
833 |
%{ /* NOCONTEXT */ |
|
834 |
||
555 | 835 |
int screen = __intVal(__INST(screen)); |
341 | 836 |
OBJ xp, yp; |
837 |
int xpos, ypos; |
|
838 |
Window child_return; |
|
839 |
||
1209 | 840 |
if (ISCONNECTED |
841 |
&& __isExternalAddress(windowId) |
|
341 | 842 |
&& __isPoint(aPoint)) { |
1344 | 843 |
Display *dpy = myDpy; |
844 |
||
845 |
xp = _point_X(aPoint); |
|
846 |
yp = _point_Y(aPoint); |
|
847 |
if (__bothSmallInteger(xp, yp)) { |
|
848 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 849 |
ENTER_XLIB(); |
1344 | 850 |
XTranslateCoordinates(dpy, |
851 |
RootWindow(dpy, screen), |
|
852 |
_WindowVal(windowId), |
|
853 |
__intVal(xp), __intVal(yp), |
|
854 |
&xpos, &ypos, &child_return); |
|
1974 | 855 |
LEAVE_XLIB(); |
1344 | 856 |
END_INTERRUPTSBLOCKED |
857 |
if (child_return) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
858 |
RETURN ( __MKEXTERNALADDRESS(child_return) ); |
1344 | 859 |
} |
860 |
RETURN ( nil ); |
|
861 |
} |
|
341 | 862 |
} |
863 |
%}. |
|
864 |
windowId notNil ifTrue:[ |
|
1344 | 865 |
aPoint isPoint ifTrue:[ |
866 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
867 |
] |
|
341 | 868 |
]. |
869 |
||
870 |
^ nil |
|
871 |
! |
|
872 |
||
873 |
virtualExtent |
|
874 |
"return the virtual extent of the display (in pixels). |
|
875 |
On most systems, this is the same as the physical width; |
|
876 |
except, if a window manager with a virtual desktop like olvwm |
|
877 |
(simulating a bigger screen) is running." |
|
878 |
||
879 |
%{ |
|
1209 | 880 |
if (ISCONNECTED |
881 |
&& (__INST(rootId) != __INST(virtualRootId)) |
|
555 | 882 |
&& __isExternalAddress(__INST(virtualRootId))) { |
1344 | 883 |
Window vRootWin; |
884 |
Window root; |
|
885 |
int x, y; |
|
886 |
unsigned int width, height; |
|
887 |
unsigned int dummy; |
|
1974 | 888 |
int ret; |
1344 | 889 |
|
890 |
vRootWin = _WindowVal(__INST(virtualRootId)); |
|
1974 | 891 |
ENTER_XLIB(); |
892 |
ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
|
893 |
&dummy, &dummy); |
|
894 |
LEAVE_XLIB(); |
|
895 |
if (ret) { |
|
1344 | 896 |
RETURN ( __MKPOINT_INT(width, height) ); |
897 |
} |
|
341 | 898 |
} |
899 |
%}. |
|
900 |
^ width @ height |
|
901 |
! |
|
902 |
||
903 |
whitepixel |
|
904 |
"return the colornumber of white" |
|
905 |
||
906 |
^ whitepixel |
|
907 |
! ! |
|
908 |
||
909 |
!XWorkstation methodsFor:'accessing display capabilities'! |
|
910 |
||
0 | 911 |
hasDPS |
186 | 912 |
"return true, if this workstation supports display postscript. |
913 |
Both the server must support it, and the feature must have been |
|
914 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 915 |
|
916 |
^ hasDPSExtension |
|
186 | 917 |
|
918 |
" |
|
919 |
Display hasDPS |
|
920 |
" |
|
921 |
! |
|
922 |
||
150 | 923 |
hasExtension:extensionString |
924 |
"query for an X extension. The argument, extensionString |
|
925 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 926 |
Return true, if that extension is available in the server. |
927 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 928 |
|
929 |
%{ |
|
930 |
int dummy; |
|
1974 | 931 |
OBJ rslt = false; |
150 | 932 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
933 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
934 |
&& __isNonNilObject(extensionString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
935 |
&& (__qIsString(extensionString) || __qIsSymbol(extensionString))) { |
1974 | 936 |
ENTER_XLIB(); |
1344 | 937 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
1974 | 938 |
rslt = true; |
939 |
} |
|
940 |
LEAVE_XLIB(); |
|
941 |
} |
|
942 |
RETURN (rslt); |
|
943 |
%} |
|
186 | 944 |
|
945 |
" |
|
946 |
Display hasExtension:'XVideo' |
|
947 |
Display hasExtension:'Input' |
|
948 |
Display hasExtension:'GLX' |
|
949 |
Display hasExtension:'X3D-PEX' |
|
950 |
Display hasExtension:'XInputExtension' |
|
951 |
Display hasExtension:'SHAPE' |
|
952 |
Display hasExtension:'MIT-SHM' |
|
953 |
Display hasExtension:'SGIFullScreenStereo' |
|
954 |
" |
|
150 | 955 |
! |
956 |
||
295 | 957 |
hasImageExtension |
958 |
"return true, if this workstation supports the X image extension. |
|
959 |
Both the server must support it, and the feature must have been |
|
960 |
enabled in the smalltalk system, for true to be returned." |
|
961 |
||
962 |
^ hasImageExtension |
|
963 |
||
964 |
" |
|
965 |
Display hasImageExtension |
|
966 |
" |
|
967 |
! |
|
968 |
||
969 |
hasInputExtension |
|
970 |
"return true, if this workstation supports the X input extension. |
|
971 |
Both the server must support it, and the feature must have been |
|
972 |
enabled in the smalltalk system, for true to be returned." |
|
973 |
||
974 |
^ hasInputExtension |
|
975 |
||
976 |
" |
|
977 |
Display hasInputExtension |
|
978 |
" |
|
979 |
! |
|
980 |
||
981 |
hasMultibuffer |
|
982 |
"return true, if this workstation supports the multibuffer extension. |
|
983 |
Both the server must support it, and the feature must have been |
|
984 |
enabled in the smalltalk system, for true to be returned." |
|
985 |
||
986 |
^ hasMbufExtension |
|
987 |
||
988 |
" |
|
989 |
Display hasMultibuffer |
|
990 |
" |
|
991 |
! |
|
992 |
||
993 |
hasPEX |
|
994 |
"return true, if this workstation supports PEX 3D graphics. |
|
995 |
Both the server must support it, and the feature must have been |
|
996 |
enabled in the smalltalk system, for true to be returned." |
|
997 |
||
998 |
^ hasPEXExtension |
|
999 |
||
1000 |
" |
|
1001 |
Display hasPEX |
|
1002 |
" |
|
1003 |
! |
|
1004 |
||
1005 |
hasShm |
|
1006 |
"return true, if this workstation supports the shared pixmap extension. |
|
1007 |
Both the server must support it, and the feature must have been |
|
1008 |
enabled in the smalltalk system, for true to be returned." |
|
1009 |
||
1010 |
^ hasShmExtension |
|
1011 |
||
1012 |
" |
|
1013 |
Display hasShm |
|
1014 |
" |
|
1015 |
! |
|
1016 |
||
1017 |
hasXVideo |
|
1018 |
"return true, if this workstation supports the XVideo extension. |
|
1019 |
Both the server must support it, and the feature must have been |
|
1020 |
enabled in the smalltalk system, for true to be returned." |
|
1021 |
||
1022 |
^ hasXVideoExtension |
|
1023 |
||
1024 |
" |
|
1025 |
Display hasXVideo |
|
1026 |
" |
|
1027 |
! |
|
1028 |
||
1029 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
1030 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 1031 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 1032 |
|
1033 |
|xIconSizes count ret| |
|
1034 |
||
1035 |
%{ |
|
555 | 1036 |
int screen = __intVal(__INST(screen)); |
295 | 1037 |
XIconSize *sizeList; |
1038 |
int cnt; |
|
1039 |
||
1040 |
if (ISCONNECTED) { |
|
1344 | 1041 |
Display *dpy = myDpy; |
1974 | 1042 |
int status; |
1043 |
||
1044 |
ENTER_XLIB(); |
|
2541 | 1045 |
status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt); |
1974 | 1046 |
LEAVE_XLIB(); |
1047 |
if (status > 0) { |
|
1344 | 1048 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
1049 |
count = __MKSMALLINT(cnt); |
|
1050 |
} |
|
295 | 1051 |
} |
1052 |
%}. |
|
1053 |
xIconSizes isNil ifTrue:[^ nil]. |
|
1054 |
||
1055 |
ret := OrderedCollection new:count. |
|
1056 |
1 to:count do:[ :i | |
|
1344 | 1057 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 1058 |
|
1059 |
%{ |
|
1344 | 1060 |
XIconSize *slp; |
1061 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1062 |
slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1]; |
1344 | 1063 |
minWidth = __MKSMALLINT(slp->min_width); |
1064 |
minHeight = __MKSMALLINT(slp->min_height); |
|
1065 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
1066 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
1067 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
1068 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 1069 |
%}. |
1344 | 1070 |
d := IdentityDictionary new. |
1071 |
d at:#minWidth put:minWidth. |
|
1072 |
d at:#maxWidth put:maxWidth. |
|
1073 |
d at:#widthStep put:widthStep. |
|
1074 |
d at:#minHeight put:minHeight. |
|
1075 |
d at:#maxHeight put:maxHeight. |
|
1076 |
d at:#heightStep put:heightStep. |
|
1077 |
||
1078 |
ret add:d |
|
295 | 1079 |
]. |
1080 |
||
1081 |
xIconSizes free. |
|
1082 |
^ ret |
|
1083 |
||
1084 |
" |
|
819 | 1085 |
Display iconSizes |
295 | 1086 |
" |
1087 |
! |
|
1088 |
||
341 | 1089 |
ignoreBackingStore:aBoolean |
1090 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
1091 |
no backing store used - this can be used on servers where backing store is |
|
1092 |
very slow or is broken (can be put into display-rc-file)" |
|
1093 |
||
1094 |
ignoreBackingStore := aBoolean |
|
295 | 1095 |
! |
1096 |
||
823 | 1097 |
preferredIconSize |
1098 |
"return the displays preferred size for icons. |
|
1099 |
Redefined to return a special value on SGI servers." |
|
1100 |
||
1101 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
1344 | 1102 |
^ 86@68 |
823 | 1103 |
]. |
1104 |
^ super preferredIconSize |
|
1105 |
||
1106 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
1107 |
! |
|
1108 |
||
1025 | 1109 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1110 |
"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
|
1111 |
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
|
1112 |
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
|
1113 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1114 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1115 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1116 |
|
43 | 1117 |
supportedImageFormats |
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1118 |
"return an array with supported image formats; |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1119 |
each array entry is an attribute dictionary, consisting of |
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1120 |
depth, bitsPerPixel and padding values." |
43 | 1121 |
|
150 | 1122 |
|nFormats "{ Class: SmallInteger }" |
1123 |
formatArray| |
|
43 | 1124 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1125 |
Display *dpy; |
150 | 1126 |
|
1127 |
if (! ISCONNECTED) { |
|
1344 | 1128 |
RETURN (nil); |
150 | 1129 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1130 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1131 |
dpy = myDpy; |
1898 | 1132 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1133 |
nFormats = __MKSMALLINT(1); |
1134 |
#else |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1135 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
1891 | 1136 |
#endif |
43 | 1137 |
%}. |
1138 |
formatArray := Array new:nFormats. |
|
150 | 1139 |
1 to:nFormats do:[:index | |
1344 | 1140 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
1141 |
||
1142 |
i := index. |
|
43 | 1143 |
%{ |
1344 | 1144 |
ScreenFormat *format; |
1145 |
Display *dpy = myDpy; |
|
1146 |
||
1898 | 1147 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1148 |
depthInfo = __MKSMALLINT(1); |
1149 |
bitsPerPixelInfo = __MKSMALLINT(1); |
|
1150 |
paddingInfo = __MKSMALLINT(8); |
|
1151 |
#else |
|
1344 | 1152 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
1153 |
format += (__intVal(i)-1); |
|
1154 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
|
1155 |
depthInfo = __MKSMALLINT(format->depth); |
|
1156 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
|
1891 | 1157 |
#endif |
43 | 1158 |
%}. |
1344 | 1159 |
info := IdentityDictionary new. |
1160 |
info at:#depth put:depthInfo. |
|
1161 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
|
1162 |
info at:#padding put:paddingInfo. |
|
1163 |
formatArray at:index put:info. |
|
43 | 1164 |
]. |
1165 |
^ formatArray |
|
1166 |
||
1167 |
" |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1168 |
Display supportedImageFormats |
43 | 1169 |
" |
1170 |
! |
|
1171 |
||
2635 | 1172 |
supportsAnyViewBackgroundPixmaps |
1173 |
"return true, if the device allows pixmaps as |
|
1174 |
viewBackground." |
|
1175 |
||
1176 |
^ true |
|
1177 |
||
1178 |
"Created: / 4.5.1999 / 18:41:07 / cg" |
|
1179 |
! |
|
1180 |
||
2745
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1181 |
supportsArbitraryShapedViews |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1182 |
"return true, if this workstation supports arbitrary shaped windows. |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1183 |
Both the server must support it (the shape-extension), |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1184 |
and the feature must have been enabled in the smalltalk system, |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1185 |
for true to be returned." |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1186 |
|
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1187 |
^ hasShapeExtension |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1188 |
|
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1189 |
" |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1190 |
Display supportsArbitraryShapedViews |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1191 |
" |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1192 |
! |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1193 |
|
2385 | 1194 |
supportsIconViews |
1195 |
"return true, if this device supports views as icons. |
|
1196 |
Only Xservers (currently) support this." |
|
1197 |
||
1198 |
^ true |
|
1199 |
||
1200 |
" |
|
1201 |
Display supportsIconViews |
|
1202 |
" |
|
1203 |
||
1204 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1205 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
1206 |
! |
|
1207 |
||
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1208 |
supportsMaskedDrawingWith:aForm |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1209 |
"return true, if the device allows the given form pixmap |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1210 |
to be used as paint color. |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1211 |
True returned here - X has no trouble with any mask." |
2330 | 1212 |
|
1213 |
^ true |
|
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1214 |
|
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1215 |
"Created: / 4.5.1999 / 12:16:43 / cg" |
2330 | 1216 |
! |
1217 |
||
2635 | 1218 |
supportsViewBackgroundPixmap:aForm |
1219 |
"return true, if the device allows the given pixmap as |
|
1220 |
viewBackground. |
|
1221 |
True returned here - X support any size." |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1222 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1223 |
^ true |
2635 | 1224 |
|
1225 |
"Created: / 4.5.1999 / 18:40:42 / cg" |
|
1226 |
"Modified: / 4.5.1999 / 18:44:25 / cg" |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1227 |
! |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1228 |
|
81 | 1229 |
supportsViewGravity |
1230 |
"return true, if this device supports gravity attributes. |
|
82 | 1231 |
We do not depend on it being implemented, but some resizing operations |
81 | 1232 |
are faster, it is is." |
1233 |
||
1234 |
^ true |
|
0 | 1235 |
! ! |
1236 |
||
1237 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1238 |
||
295 | 1239 |
createBitmapFromArray:anArray width:w height:h |
2896 | 1240 |
"create a monochrome, depth1 bitmap from a given (byte-)array. |
1241 |
The rows are aligned to a multiple of 8" |
|
1242 |
||
295 | 1243 |
|bitmapId| |
1244 |
||
1245 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1246 |
bitmapId isNil ifTrue:[ |
|
2896 | 1247 |
self primitiveFailed |
295 | 1248 |
]. |
1249 |
^ bitmapId |
|
1250 |
! |
|
1251 |
||
1252 |
createBitmapFromFile:aString for:aForm |
|
1253 |
|id w h| |
|
1254 |
||
1255 |
%{ |
|
555 | 1256 |
int screen = __intVal(__INST(screen)); |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1257 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1258 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1259 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1260 |
&& (__qIsString(aString) || __qIsSymbol(aString))) { |
1344 | 1261 |
Display *dpy = myDpy; |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1262 |
char *filename; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1263 |
int status; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1264 |
Pixmap newBitmap; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1265 |
unsigned b_width, b_height; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1266 |
int b_x_hot, b_y_hot; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1267 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1268 |
filename = (char *) __stringVal(aString); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1269 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1270 |
BEGIN_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1271 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1272 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1273 |
filename, &b_width, &b_height, &newBitmap, |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1274 |
&b_x_hot, &b_y_hot); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1275 |
LEAVE_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1276 |
END_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1277 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1278 |
if ((status == BitmapSuccess) && newBitmap) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1279 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1280 |
__cnt_bitmap++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1281 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1282 |
w = __MKSMALLINT(b_width); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1283 |
h = __MKSMALLINT(b_height); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1284 |
id = __MKEXTERNALADDRESS(newBitmap); |
1344 | 1285 |
} |
295 | 1286 |
} |
1287 |
%}. |
|
1288 |
id notNil ifTrue:[ |
|
1344 | 1289 |
aForm setWidth:w height:h |
295 | 1290 |
]. |
1291 |
^ id |
|
1292 |
! |
|
1293 |
||
1294 |
createBitmapWidth:w height:h |
|
1295 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1296 |
(i.e. random). Return a bitmap id or nil" |
|
1297 |
||
1298 |
%{ /* NOCONTEXT */ |
|
1299 |
||
555 | 1300 |
int screen = __intVal(__INST(screen)); |
295 | 1301 |
Pixmap newBitmap; |
1302 |
||
1303 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1344 | 1304 |
Display *dpy = myDpy; |
1305 |
||
1306 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1307 |
ENTER_XLIB(); |
1344 | 1308 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1309 |
__intVal(w), __intVal(h), 1); |
|
1974 | 1310 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1311 |
#ifdef COUNT_RESOURCES |
1344 | 1312 |
if (newBitmap) |
1313 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1314 |
#endif |
1344 | 1315 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1316 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
295 | 1317 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1318 |
%}. |
295 | 1319 |
self primitiveFailed. |
1320 |
^ nil |
|
1321 |
! |
|
1322 |
||
0 | 1323 |
createPixmapWidth:w height:h depth:d |
1324 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1325 |
(i.e. random). Return a bitmap id or nil" |
|
1326 |
||
1327 |
%{ /* NOCONTEXT */ |
|
1328 |
||
555 | 1329 |
int screen = __intVal(__INST(screen)); |
0 | 1330 |
Pixmap newBitmap; |
1331 |
||
150 | 1332 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1344 | 1333 |
Display *dpy = myDpy; |
1334 |
||
1335 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 1336 |
ENTER_XLIB(); |
1344 | 1337 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1338 |
__intVal(w), __intVal(h), __intVal(d)); |
|
1974 | 1339 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1340 |
#ifdef COUNT_RESOURCES |
1344 | 1341 |
if (newBitmap) |
1342 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1343 |
#endif |
1344 | 1344 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1345 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1346 |
} |
1424 | 1347 |
%}. |
43 | 1348 |
self primitiveFailed. |
1349 |
^ nil |
|
0 | 1350 |
! |
1351 |
||
1468
9832c4017a70
added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
1352 |
createWindowFor:aView type:typeSymbol |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1353 |
origin:origin |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1354 |
extent:extent |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1355 |
minExtent:minExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1356 |
maxExtent:maxExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1357 |
borderWidth:bWidth |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1358 |
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
|
1359 |
style:wStyle |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1360 |
inputOnly:winputOnly |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1361 |
label:wlabel |
1960 | 1362 |
owner:wowner |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1363 |
icon:wicon iconMask:wiconMask |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1364 |
iconView:wiconView |
46 | 1365 |
|
1366 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
|
1960 | 1367 |
bColorId wsuperViewId wiconId wiconMaskId windowId |
46 | 1368 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
150 | 1369 |
vBgForm deepForm preferredVisual preferredDepth| |
1370 |
||
1371 |
displayId isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1372 |
self primitiveFailed. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1373 |
^ nil |
150 | 1374 |
]. |
0 | 1375 |
|
46 | 1376 |
origin notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1377 |
xpos := origin x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1378 |
ypos := origin y. |
46 | 1379 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1380 |
xpos := ypos := 0. |
0 | 1381 |
]. |
46 | 1382 |
extent notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1383 |
wwidth := extent x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1384 |
wheight := extent y. |
46 | 1385 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1386 |
wwidth := wheight := 100. |
46 | 1387 |
]. |
1388 |
minExt notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1389 |
minWidth := minExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1390 |
minHeight := minExt y |
0 | 1391 |
]. |
46 | 1392 |
maxExt notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1393 |
maxWidth := maxExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1394 |
maxHeight := maxExt y |
46 | 1395 |
]. |
1396 |
||
0 | 1397 |
wsuperView notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1398 |
wsuperViewId := wsuperView id |
0 | 1399 |
]. |
1400 |
||
1401 |
wicon notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1402 |
wiconId := wicon id. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1403 |
wiconMask notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1404 |
wiconMaskId := wiconMask id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1405 |
] |
0 | 1406 |
]. |
1407 |
wiconView notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1408 |
wiconViewId := wiconView id |
0 | 1409 |
]. |
1410 |
weventMask := aView eventMask. |
|
1411 |
||
150 | 1412 |
preferredVisual := aView preferredVisual. |
1413 |
preferredDepth := aView preferredDepth. |
|
23 | 1414 |
|
1898 | 1415 |
%{ /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */ |
0 | 1416 |
Display *dpy = myDpy; |
555 | 1417 |
int screen = __intVal(__INST(screen)); |
0 | 1418 |
Visual visual; |
1419 |
XGCValues xgcv; |
|
1420 |
XSetWindowAttributes xswa; |
|
1421 |
XSizeHints sizehints; |
|
1422 |
XWMHints wmhints; |
|
46 | 1423 |
int bw, bd, bg; |
0 | 1424 |
Window newWindow, parentWindow; |
1425 |
char *windowName; |
|
1426 |
XFontStruct *f; |
|
1537 | 1427 |
Pixmap backPixmap = (Pixmap)0, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1428 |
iconBitmap = (Pixmap)0, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1429 |
iconMask = (Pixmap)0; |
0 | 1430 |
int flags = 0, depth, ioClass; |
1431 |
Window iconWindow; |
|
1432 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
1433 |
Atom WmQuitAppAtom; |
|
1434 |
Atom atoms[3]; |
|
1435 |
int atomCount = 0, isTopWindow = 0; |
|
1436 |
||
1437 |
sizehints.flags = 0; |
|
1438 |
sizehints.width = 100; |
|
1439 |
sizehints.height = 100; |
|
1440 |
sizehints.x = 0; |
|
1441 |
sizehints.y = 0; |
|
1442 |
||
97 | 1443 |
if (__bothSmallInteger(wwidth, wheight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1444 |
sizehints.flags |= PSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1445 |
sizehints.width = __intVal(wwidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1446 |
sizehints.height = __intVal(wheight); |
0 | 1447 |
} |
97 | 1448 |
if (__bothSmallInteger(xpos, ypos)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1449 |
sizehints.flags |= PPosition; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1450 |
sizehints.x = __intVal(xpos); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1451 |
sizehints.y = __intVal(ypos); |
0 | 1452 |
} |
97 | 1453 |
if (__bothSmallInteger(minWidth, minHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1454 |
sizehints.flags |= PMinSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1455 |
sizehints.min_width = __intVal(minWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1456 |
sizehints.min_height = __intVal(minHeight); |
0 | 1457 |
} |
97 | 1458 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1459 |
sizehints.flags |= PMaxSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1460 |
sizehints.max_width = __intVal(maxWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1461 |
sizehints.max_height = __intVal(maxHeight); |
0 | 1462 |
} |
1463 |
||
37 | 1464 |
bg = WhitePixel(dpy, screen); |
0 | 1465 |
|
97 | 1466 |
if (__isSmallInteger(bWidth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1467 |
bw = __intVal(bWidth); |
46 | 1468 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1469 |
bw = 0; |
0 | 1470 |
} |
1471 |
||
72 | 1472 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1473 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1474 |
if (__isExternalAddress(wsuperViewId)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1475 |
parentWindow = _WindowVal(wsuperViewId); |
0 | 1476 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1477 |
parentWindow = RootWindow(dpy, screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1478 |
isTopWindow = 1; |
0 | 1479 |
} |
1480 |
||
1695
46d9101e4bee
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
1481 |
if (wStyle == @symbol(popUp)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1482 |
xswa.override_redirect = 1; |
0 | 1483 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1484 |
xswa.override_redirect = 0; |
0 | 1485 |
|
1486 |
if (winputOnly == true) |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1487 |
ioClass = InputOnly; |
0 | 1488 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1489 |
ioClass = InputOutput; |
0 | 1490 |
|
97 | 1491 |
if (__isSmallInteger(weventMask)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1492 |
xswa.event_mask = __intVal(weventMask); |
0 | 1493 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1494 |
xswa.event_mask = 0; |
0 | 1495 |
} |
1496 |
||
1497 |
if (ioClass == InputOnly) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1498 |
bw = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1499 |
depth = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1500 |
flags |= CWEventMask; |
0 | 1501 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1502 |
depth = DefaultDepth(dpy,screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1503 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1504 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1505 |
if (backPixmap != (Pixmap)0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1506 |
xswa.background_pixmap = backPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1507 |
flags |= CWBackPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1508 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1509 |
xswa.background_pixel = bg; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1510 |
flags |= CWBackPixel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1511 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1512 |
xswa.border_pixel = bd; |
0 | 1513 |
} |
23 | 1514 |
|
0 | 1515 |
visual.visualid = CopyFromParent; |
150 | 1516 |
if (__isSmallInteger(preferredDepth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1517 |
depth = __intVal(preferredDepth); |
23 | 1518 |
} |
54 | 1519 |
|
1520 |
BEGIN_INTERRUPTSBLOCKED |
|
150 | 1521 |
if (preferredVisual != nil) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1522 |
XVisualInfo vi; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1523 |
int cls; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1524 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1525 |
if (preferredVisual == @symbol(StaticGray)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1526 |
cls = StaticGray; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1527 |
else if (preferredVisual == @symbol(GrayScale)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1528 |
cls = GrayScale; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1529 |
else if (preferredVisual == @symbol(StaticColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1530 |
cls = StaticColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1531 |
else if (preferredVisual == @symbol(PseudoColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1532 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1533 |
else if (preferredVisual == @symbol(TrueColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1534 |
cls = TrueColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1535 |
else if (preferredVisual == @symbol(DirectColor)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1536 |
cls = DirectColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1537 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1538 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1539 |
|
1974 | 1540 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1541 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1542 |
visual.visualid = vi.visualid; |
163 | 1543 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1544 |
printf("visualId=%x\n", vi.visualid); |
163 | 1545 |
*/ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1546 |
} |
1974 | 1547 |
LEAVE_XLIB(); |
1548 |
} |
|
1549 |
||
1550 |
ENTER_XLIB(); |
|
0 | 1551 |
newWindow = XCreateWindow(dpy, parentWindow, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1552 |
sizehints.x, sizehints.y, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1553 |
sizehints.width, sizehints.height, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1554 |
bw, depth, ioClass, &visual, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1555 |
flags, &xswa); |
1974 | 1556 |
LEAVE_XLIB(); |
54 | 1557 |
END_INTERRUPTSBLOCKED |
0 | 1558 |
|
1559 |
if (! newWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1560 |
RETURN ( nil ); |
0 | 1561 |
} |
1562 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1563 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1564 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1565 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1566 |
|
54 | 1567 |
BEGIN_INTERRUPTSBLOCKED |
0 | 1568 |
|
1569 |
/* |
|
1570 |
* define its icon and name |
|
1571 |
* (only makes sense for topWindows) |
|
1572 |
*/ |
|
1573 |
if (isTopWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1574 |
if (__isExternalAddress(wiconId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1575 |
iconBitmap = _PixmapVal(wiconId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1576 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1577 |
iconBitmap = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1578 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1579 |
if (__isExternalAddress(wiconMaskId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1580 |
iconMask = _PixmapVal(wiconMaskId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1581 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1582 |
iconMask = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1583 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1584 |
if (__isExternalAddress(wiconViewId)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1585 |
iconWindow = _WindowVal(wiconViewId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1586 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1587 |
iconWindow = (Window)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1588 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1589 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
1831 | 1590 |
windowName = (char *) __stringVal(wlabel); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1591 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1592 |
windowName = ""; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1593 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1594 |
if (iconBitmap || windowName) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1595 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1596 |
XSetStandardProperties(dpy, newWindow, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1597 |
windowName, windowName, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1598 |
iconBitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1599 |
0, 0, &sizehints); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1600 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1601 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1602 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1603 |
wmhints.flags = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1604 |
if (iconBitmap) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1605 |
wmhints.flags |= IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1606 |
wmhints.icon_pixmap = iconBitmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1607 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1608 |
if (iconMask) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1609 |
wmhints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1610 |
wmhints.icon_mask = iconMask; |
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 |
if (iconWindow) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1613 |
wmhints.flags |= IconWindowHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1614 |
wmhints.icon_window = iconWindow; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1615 |
} |
0 | 1616 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1617 |
wmhints.flags |= InputHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1618 |
wmhints.input = True; |
0 | 1619 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1620 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1621 |
XSetWMHints(dpy, newWindow, &wmhints); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1622 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1623 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1624 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1625 |
* 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
|
1626 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1627 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1628 |
* get atoms first (if not already known) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1629 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1630 |
if (__INST(protocolsAtom) == nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1631 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1632 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1633 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
0 | 1634 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1635 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1636 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
0 | 1637 |
#endif |
1638 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1639 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1640 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
0 | 1641 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1642 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1643 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1644 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1645 |
} else { |
0 | 1646 |
#ifdef USE_QUIT_APP_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1647 |
WmQuitAppAtom = _AtomVal(__INST(quitAppAtom)); |
0 | 1648 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1649 |
WmQuitAppAtom = 0; |
0 | 1650 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1651 |
WmProtocolsAtom = _AtomVal(__INST(protocolsAtom)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1652 |
WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom)); |
0 | 1653 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1654 |
WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom)); |
0 | 1655 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1656 |
WmSaveYourselfAtom = 0; |
0 | 1657 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1658 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1659 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1660 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
0 | 1661 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1662 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1663 |
#endif |
1664 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1665 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1666 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1667 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1668 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1669 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1670 |
LEAVE_XLIB(); |
0 | 1671 |
} |
1672 |
||
54 | 1673 |
END_INTERRUPTSBLOCKED |
1674 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1675 |
windowId = __MKEXTERNALADDRESS(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1676 |
%}. |
0 | 1677 |
self addKnownView:aView withId:windowId. |
1678 |
^ windowId |
|
1679 |
! |
|
1680 |
||
1681 |
destroyGC:aGCId |
|
1682 |
||
1683 |
%{ /* NOCONTEXT */ |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1684 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1685 |
if (! ISCONNECTED) { |
1344 | 1686 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1687 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1688 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1689 |
if (__isExternalAddress(aGCId)) { |
1344 | 1690 |
GC gc = _GCVal(aGCId); |
1691 |
||
1692 |
if (gc) { |
|
1693 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1694 |
ENTER_XLIB(); |
1344 | 1695 |
XFreeGC(myDpy, gc); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1696 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1697 |
#ifdef COUNT_RESOURCES |
1344 | 1698 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1699 |
#endif |
1344 | 1700 |
END_INTERRUPTSBLOCKED |
1701 |
} |
|
1702 |
RETURN ( self ); |
|
0 | 1703 |
} |
118 | 1704 |
%}. |
0 | 1705 |
self primitiveFailed |
1706 |
! |
|
1707 |
||
295 | 1708 |
destroyPixmap:aDrawableId |
0 | 1709 |
|
1710 |
%{ /* NOCONTEXT */ |
|
1711 |
||
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1712 |
if (! ISCONNECTED) { |
1344 | 1713 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1714 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1715 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1716 |
if (__isExternalAddress(aDrawableId)) { |
1344 | 1717 |
Pixmap pix = _PixmapVal(aDrawableId); |
1718 |
||
1719 |
if (pix) { |
|
1720 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1721 |
ENTER_XLIB(); |
1344 | 1722 |
XFreePixmap(myDpy, pix); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1723 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1724 |
#ifdef COUNT_RESOURCES |
1344 | 1725 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1726 |
#endif |
1344 | 1727 |
END_INTERRUPTSBLOCKED |
1728 |
} |
|
1729 |
RETURN ( self ); |
|
0 | 1730 |
} |
118 | 1731 |
%}. |
295 | 1732 |
self primitiveFailed |
1733 |
! |
|
1734 |
||
1735 |
destroyView:aView withId:aWindowId |
|
1736 |
%{ |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1737 |
if (! ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1738 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1739 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1740 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1741 |
if (__isExternalAddress(aWindowId)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1742 |
Window win = _WindowVal(aWindowId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1743 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1744 |
if (win) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1745 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1746 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1747 |
XDestroyWindow(myDpy, win); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1748 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1749 |
#ifdef COUNT_RESOURCES |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1750 |
__cnt_view--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1751 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1752 |
END_INTERRUPTSBLOCKED |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1753 |
} |
295 | 1754 |
} |
1755 |
%}. |
|
1480
7fd8dff4cfc3
pass view + id to removeKnownView
Claus Gittinger <cg@exept.de>
parents:
1468
diff
changeset
|
1756 |
self removeKnownView:aView withId:aWindowId |
0 | 1757 |
! |
1758 |
||
1759 |
dpsContextFor:aDrawableId and:aGCId |
|
1760 |
||
1761 |
%{ /* NOCONTEXT */ |
|
1762 |
#ifdef XXDPS |
|
555 | 1763 |
int screen = __intVal(__INST(screen)); |
0 | 1764 |
DPSContext dps; |
1765 |
int height; |
|
1766 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1767 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1768 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1769 |
&& ISCONNECTED) { |
1344 | 1770 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1771 |
ENTER_XLIB(); |
1344 | 1772 |
dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId), |
1773 |
_GCVal(aGCId), |
|
1774 |
0, height, 0, colormap, NULL, 0, |
|
1775 |
XDPSDefaultTextBackstop, |
|
1776 |
XDPSDefaultErrorProc, |
|
1777 |
NULL); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1778 |
LEAVE_XLIB(); |
1344 | 1779 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1780 |
RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); |
0 | 1781 |
} |
1782 |
#endif |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1783 |
%}. |
43 | 1784 |
self primitiveFailed. |
1785 |
^ nil |
|
295 | 1786 |
! |
1787 |
||
1788 |
gcFor:aDrawableId |
|
132 | 1789 |
|
1790 |
%{ /* NOCONTEXT */ |
|
555 | 1791 |
int screen = __intVal(__INST(screen)); |
295 | 1792 |
GC gc; |
1793 |
||
1794 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
1344 | 1795 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1796 |
ENTER_XLIB(); |
1344 | 1797 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1798 |
0L, (XGCValues *)0); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1799 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1800 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1801 |
#ifdef COUNT_RESOURCES |
1344 | 1802 |
if (gc) |
1803 |
__cnt_gc++; |
|
1089 | 1804 |
#endif |
1805 |
||
1344 | 1806 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1807 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1808 |
} |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1809 |
%}. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1810 |
self primitiveFailed. |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1811 |
^ nil |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1812 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1813 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1814 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1815 |
"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
|
1816 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1817 |
%{ /* NOCONTEXT */ |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1818 |
int screen = __intVal(__INST(screen)); |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1819 |
GC gc; |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1820 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1821 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
1344 | 1822 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1823 |
ENTER_XLIB(); |
1344 | 1824 |
gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId), |
1825 |
0L, (XGCValues *)0); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1826 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1827 |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1828 |
#ifdef COUNT_RESOURCES |
1344 | 1829 |
if (gc) |
1830 |
__cnt_gc++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1831 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1832 |
|
1344 | 1833 |
END_INTERRUPTSBLOCKED |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1834 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
200 | 1835 |
} |
1836 |
%}. |
|
1837 |
^ nil |
|
295 | 1838 |
! |
1839 |
||
1840 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 1841 |
|
1842 |
%{ /* UNLIMITEDSTACK */ |
|
1843 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1844 |
Display *dpy; |
555 | 1845 |
int screen = __intVal(__INST(screen)); |
295 | 1846 |
Pixmap newBitmap; |
1847 |
unsigned int b_width, b_height; |
|
1848 |
REGISTER unsigned char *cp; |
|
1849 |
REGISTER unsigned char *pBits; |
|
1850 |
unsigned char *b_bits, *allocatedBits; |
|
1851 |
int index, row; |
|
1852 |
REGISTER int col; |
|
1853 |
unsigned bits; |
|
1854 |
static char reverseBitTable[256]; |
|
1855 |
static firstCall = 1; |
|
1856 |
int nBytes; |
|
1857 |
unsigned char fastBits[10000]; |
|
1858 |
OBJ num, *op; |
|
1859 |
int bytesPerRow; |
|
1860 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1861 |
if (! ISCONNECTED) { |
1344 | 1862 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1863 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1864 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1865 |
dpy = myDpy; |
295 | 1866 |
if (firstCall) { |
1344 | 1867 |
for (index=0; index < 256; index++) { |
1868 |
reverseBitTable[index] = 0; |
|
1869 |
if (index & 128) reverseBitTable[index] |= 1; |
|
1870 |
if (index & 64) reverseBitTable[index] |= 2; |
|
1871 |
if (index & 32) reverseBitTable[index] |= 4; |
|
1872 |
if (index & 16) reverseBitTable[index] |= 8; |
|
1873 |
if (index & 8) reverseBitTable[index] |= 16; |
|
1874 |
if (index & 4) reverseBitTable[index] |= 32; |
|
1875 |
if (index & 2) reverseBitTable[index] |= 64; |
|
1876 |
if (index & 1) reverseBitTable[index] |= 128; |
|
1877 |
} |
|
1878 |
firstCall = 0; |
|
295 | 1879 |
} |
1880 |
||
1881 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
1344 | 1882 |
newBitmap = (Pixmap)0; |
1883 |
b_width = __intVal(w); |
|
1884 |
b_height = __intVal(h); |
|
1885 |
bytesPerRow = (b_width + 7) / 8; |
|
1886 |
nBytes = b_height * bytesPerRow; |
|
1887 |
if (nBytes < sizeof(fastBits)) { |
|
1888 |
cp = b_bits = fastBits; |
|
1889 |
allocatedBits = 0; |
|
1890 |
} else { |
|
1891 |
cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
|
1892 |
if (! cp) goto fail; |
|
1893 |
} |
|
1894 |
||
1895 |
if (__qClass(anArray) == @global(Array)) { |
|
1896 |
index = 1; |
|
1897 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
|
1898 |
for (row = b_height; row; row--) { |
|
1899 |
for (col = bytesPerRow; col; col--) { |
|
1900 |
num = *op++; |
|
2791 | 1901 |
if (__isSmallInteger(num)) { |
1902 |
bits = __intVal(num); |
|
1903 |
} else { |
|
1904 |
bits = __longIntVal(num); |
|
1905 |
if (bits == 0) { |
|
1906 |
goto fail; |
|
1907 |
} |
|
1908 |
} |
|
1909 |
*cp++ = reverseBitTable[bits & 0xFF]; |
|
1344 | 1910 |
} |
1911 |
} |
|
1912 |
} else { |
|
1913 |
if (__qClass(anArray) == @global(ByteArray)) { |
|
1914 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
|
1915 |
for (col = b_height*bytesPerRow; col; col--) { |
|
1916 |
*cp++ = reverseBitTable[*pBits++]; |
|
1917 |
} |
|
1918 |
} else { |
|
1919 |
goto fail; |
|
1920 |
} |
|
1921 |
} |
|
1922 |
||
1923 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1924 |
ENTER_XLIB(); |
1344 | 1925 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
1926 |
(char *)b_bits, |
|
1927 |
b_width, b_height); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1928 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1929 |
#ifdef COUNT_RESOURCES |
1344 | 1930 |
if (newBitmap) |
1931 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1932 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1933 |
|
1344 | 1934 |
END_INTERRUPTSBLOCKED |
295 | 1935 |
fail: ; |
1344 | 1936 |
if (allocatedBits) |
1937 |
free(allocatedBits); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1938 |
RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1939 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1940 |
%}. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1941 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1942 |
^ nil |
295 | 1943 |
! |
1944 |
||
1945 |
realRootWindowFor:aView |
|
1946 |
"the name of this method is historic; |
|
1947 |
- it will vanish" |
|
1948 |
||
1949 |
|id| |
|
1950 |
||
1951 |
id := self realRootWindowId. |
|
1952 |
self addKnownView:aView withId:id. |
|
1953 |
^ id |
|
1954 |
! |
|
1955 |
||
1956 |
realRootWindowId |
|
1957 |
"return the id of the real root window. |
|
1958 |
This may not be the window you see as background, |
|
1959 |
since some window managers install a virtual root window on top |
|
1960 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
1961 |
care of any virtual root." |
|
0 | 1962 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
1963 |
%{ |
555 | 1964 |
int screen = __intVal(__INST(screen)); |
295 | 1965 |
Window root; |
1966 |
OBJ id; |
|
1967 |
||
555 | 1968 |
if (__INST(rootId) != nil) { |
1344 | 1969 |
RETURN (__INST(rootId)); |
295 | 1970 |
} |
0 | 1971 |
|
150 | 1972 |
if (ISCONNECTED) { |
1344 | 1973 |
root = RootWindow(myDpy, screen); |
1974 |
if (! root) { |
|
1975 |
id = nil; |
|
1976 |
} else { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1977 |
__INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id); |
1344 | 1978 |
} |
1979 |
RETURN (id); |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1980 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1981 |
%}. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1982 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1983 |
^ nil |
295 | 1984 |
! |
1985 |
||
1986 |
rootWindowFor:aView |
|
1987 |
|id| |
|
1988 |
||
1989 |
id := self rootWindowId. |
|
1990 |
self addKnownView:aView withId:id. |
|
0 | 1991 |
^ id |
1992 |
! |
|
1993 |
||
295 | 1994 |
rootWindowId |
1995 |
"return the id of the root window. |
|
1996 |
This is the window you see as background, |
|
1997 |
however, it may or may not be the real physical root window, |
|
1998 |
since some window managers install a virtual root window on top |
|
1999 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 2000 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
2001 |
%{ |
555 | 2002 |
int screen = __intVal(__INST(screen)); |
295 | 2003 |
Window rootWin, vRootWin; |
2004 |
OBJ id; |
|
2005 |
||
555 | 2006 |
if (__INST(virtualRootId) != nil) { |
1344 | 2007 |
RETURN (__INST(virtualRootId)); |
295 | 2008 |
} |
0 | 2009 |
|
169 | 2010 |
if (ISCONNECTED) { |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
2011 |
Display *dpy = myDpy; |
2541 | 2012 |
|
2013 |
vRootWin = rootWin = RootWindow(dpy, screen); |
|
295 | 2014 |
#ifndef IRIS |
1344 | 2015 |
BEGIN_INTERRUPTSBLOCKED |
2016 |
/* |
|
2017 |
* on IRIS, this creates a badwindow error - why ? |
|
2018 |
* children contains a funny window (000034) |
|
2019 |
*/ |
|
2020 |
||
2021 |
/* |
|
2022 |
* care for virtual root windows (tvtwm & friends) |
|
2023 |
*/ |
|
2024 |
{ |
|
2025 |
Atom vRootAtom = None; |
|
2026 |
int i; |
|
2027 |
Window rootReturn, parentReturn; |
|
2028 |
Window* children = (Window *)0; |
|
2029 |
unsigned int numChildren; |
|
2030 |
||
2541 | 2031 |
if (XQueryTree(dpy, rootWin, |
1344 | 2032 |
&rootReturn, &parentReturn, |
2033 |
&children, &numChildren)) { |
|
2541 | 2034 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True ); |
1344 | 2035 |
if (vRootAtom != None) { |
2036 |
for (i=0; i < numChildren; i++) { |
|
2037 |
Atom actual_type; |
|
2038 |
int actual_format; |
|
2039 |
unsigned long nitems, bytesafter; |
|
2040 |
Window* newRoot = (Window*) 0; |
|
2041 |
||
2042 |
if (children[i]) { |
|
2541 | 2043 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
2044 |
0L, 1L, False, XA_WINDOW, |
|
2045 |
&actual_type, &actual_format, |
|
2046 |
&nitems, &bytesafter, |
|
2047 |
(unsigned char**) &newRoot |
|
2048 |
) == Success && newRoot) { |
|
1344 | 2049 |
vRootWin = *newRoot; |
2050 |
XFree(newRoot); /* XXX */ |
|
2051 |
break; |
|
2052 |
} |
|
2053 |
} |
|
2054 |
} |
|
2055 |
} |
|
2056 |
if (children) XFree( children ); |
|
2057 |
} |
|
2058 |
} |
|
2059 |
END_INTERRUPTSBLOCKED |
|
295 | 2060 |
#endif |
2061 |
} |
|
2062 |
||
2063 |
/* cannot happen */ |
|
2064 |
if (! vRootWin) { |
|
1344 | 2065 |
vRootWin = rootWin; |
2066 |
if (! rootWin) { |
|
2067 |
RETURN ( nil ); |
|
2068 |
} |
|
295 | 2069 |
} |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2070 |
__INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2071 |
__INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id); |
295 | 2072 |
RETURN ( id ); |
63 | 2073 |
%} |
0 | 2074 |
! ! |
2075 |
||
2076 |
!XWorkstation methodsFor:'color stuff'! |
|
2077 |
||
295 | 2078 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2079 |
"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
|
2080 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2081 |
|
2082 |
%{ /* NOCONTEXT */ |
|
2083 |
||
555 | 2084 |
int screen = __intVal(__INST(screen)); |
295 | 2085 |
XColor color; |
2086 |
unsigned long dummy; |
|
2087 |
Status ok; |
|
2088 |
||
1209 | 2089 |
if (ISCONNECTED) { |
1344 | 2090 |
Display *dpy = myDpy; |
2091 |
||
2092 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2093 |
ENTER_XLIB(); |
1344 | 2094 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
2095 |
&dummy, 0, &color.pixel, 1); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2096 |
LEAVE_XLIB(); |
1344 | 2097 |
END_INTERRUPTSBLOCKED |
2098 |
if (ok) { |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2099 |
#ifdef COUNT_RESOURCES |
1344 | 2100 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2101 |
#endif |
1344 | 2102 |
RETURN ( __MKSMALLINT(color.pixel) ); |
2103 |
} |
|
0 | 2104 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2105 |
%}. |
43 | 2106 |
^ nil |
0 | 2107 |
! |
2108 |
||
2109 |
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
|
2110 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 2111 |
Dont use this method, colornames are mostly X specific" |
2112 |
||
2113 |
%{ /* NOCONTEXT */ |
|
2114 |
||
2115 |
char *colorname; |
|
2116 |
XColor scolor, ecolor; |
|
555 | 2117 |
int screen = __intVal(__INST(screen)); |
850 | 2118 |
int id; |
54 | 2119 |
Status ok; |
0 | 2120 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2121 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2122 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2123 |
&& (__qIsString(aString) || __qIsSymbol(aString))) { |
1344 | 2124 |
Display *dpy = myDpy; |
2125 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2126 |
colorname = (char *) __stringVal(aString); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2127 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2128 |
BEGIN_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2129 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2130 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2131 |
LEAVE_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2132 |
if (ok) { |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
2133 |
#ifdef QUICK_TRUE_COLORS |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2134 |
if (__INST(visualType) == @symbol(TrueColor)) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2135 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2136 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2137 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2138 |
RETURN ( __MKSMALLINT(id) ); |
1344 | 2139 |
} |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2140 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2141 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2142 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2143 |
LEAVE_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2144 |
} |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2145 |
END_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2146 |
if (! ok) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2147 |
RETURN ( nil ); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2148 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2149 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2150 |
__cnt_color++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2151 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2152 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
0 | 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 |
%}. |
43 | 2155 |
self primitiveFailed. |
2156 |
^ nil |
|
0 | 2157 |
! |
2158 |
||
295 | 2159 |
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
|
2160 |
"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
|
2161 |
This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:" |
295 | 2162 |
|
2163 |
|r g b| |
|
2164 |
||
2165 |
r := self percentToXColorValue:redVal. |
|
2166 |
g := self percentToXColorValue:greenVal. |
|
2167 |
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
|
2168 |
^ 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
|
2169 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2170 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2171 |
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
|
2172 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
295 | 2173 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2174 |
Display *dpy; |
295 | 2175 |
XColor ecolor; |
555 | 2176 |
int screen = __intVal(__INST(screen)); |
295 | 2177 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2178 |
int id; |
295 | 2179 |
|
2180 |
if (__bothSmallInteger(r, g) |
|
2181 |
&& __isSmallInteger(b) |
|
2182 |
&& ISCONNECTED) { |
|
1344 | 2183 |
ecolor.red = __intVal(r); |
2184 |
ecolor.green= __intVal(g); |
|
2185 |
ecolor.blue = __intVal(b); |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2186 |
#ifdef QUICK_TRUE_COLORS |
1344 | 2187 |
if (__INST(visualType) == @symbol(TrueColor)) { |
2188 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
|
2189 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
|
2190 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
|
2191 |
RETURN ( __MKSMALLINT(id) ); |
|
2192 |
} |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2193 |
#endif |
1344 | 2194 |
dpy = myDpy; |
2195 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2196 |
ENTER_XLIB(); |
1344 | 2197 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2198 |
LEAVE_XLIB(); |
1344 | 2199 |
END_INTERRUPTSBLOCKED |
2200 |
if (! ok) { |
|
2201 |
RETURN ( nil ); |
|
2202 |
} |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2203 |
#ifdef COUNT_RESOURCES |
1344 | 2204 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2205 |
#endif |
1344 | 2206 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
295 | 2207 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2208 |
%}. |
295 | 2209 |
self primitiveFailed. |
2210 |
^ nil |
|
2211 |
! |
|
2212 |
||
2213 |
freeColor:colorIndex |
|
2214 |
"free a display color when its no longer needed" |
|
0 | 2215 |
|
2216 |
%{ /* NOCONTEXT */ |
|
2217 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2218 |
Display *dpy; |
295 | 2219 |
unsigned long color; |
555 | 2220 |
int screen = __intVal(__INST(screen)); |
295 | 2221 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2222 |
#ifdef QUICK_TRUE_COLORS |
555 | 2223 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1344 | 2224 |
/* no need to do anything on TrueColor displays ... */ |
2225 |
RETURN (self); |
|
295 | 2226 |
} |
2227 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2228 |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2229 |
if (! ISCONNECTED) { |
1344 | 2230 |
RETURN (self); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2231 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2232 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2233 |
if (__isSmallInteger(colorIndex)) { |
1344 | 2234 |
dpy = myDpy; |
2235 |
color = (long) __intVal(colorIndex); |
|
2236 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2237 |
ENTER_XLIB(); |
1344 | 2238 |
XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2239 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2240 |
#ifdef COUNT_RESOURCES |
1344 | 2241 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2242 |
#endif |
1344 | 2243 |
END_INTERRUPTSBLOCKED |
2244 |
RETURN ( self ); |
|
0 | 2245 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2246 |
%}. |
295 | 2247 |
self primitiveFailed |
2248 |
! |
|
2249 |
||
2250 |
getRGBFrom:index into:aBlock |
|
2251 |
"get rgb components (0..100) of color in map at:index, |
|
2252 |
and evaluate the 3-arg block, aBlock with them" |
|
2253 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2254 |
|val| |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2255 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2256 |
self getScaledRGBFrom:index into:[:r :g :b | |
1344 | 2257 |
val := aBlock |
2258 |
value:(r * 100.0 / 16rFFFF) |
|
2259 |
value:(g * 100.0 / 16rFFFF) |
|
2260 |
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
|
2261 |
]. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2262 |
^ val |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2263 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2264 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2265 |
getRGBFromName:colorName into:aBlock |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2266 |
"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
|
2267 |
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
|
2268 |
|val| |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2269 |
|
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2270 |
self getScaledRGBFromName:colorName into:[:r :g :b | |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2271 |
r isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2272 |
^ nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2273 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2274 |
val := aBlock |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2275 |
value:(r * 100.0 / 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2276 |
value:(g * 100.0 / 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2277 |
value:(b * 100.0 / 16rFFFF) |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2278 |
]. |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2279 |
^ val |
1056 | 2280 |
|
1430 | 2281 |
"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
|
2282 |
! |
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2283 |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2284 |
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
|
2285 |
"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
|
2286 |
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
|
2287 |
|
295 | 2288 |
|r g b| |
2289 |
%{ |
|
555 | 2290 |
int screen = __intVal(__INST(screen)); |
295 | 2291 |
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
|
2292 |
int sr, sg, sb; |
295 | 2293 |
int bits, scale, shift; |
2294 |
||
1209 | 2295 |
if (ISCONNECTED |
2296 |
&& __isSmallInteger(index)) { |
|
1344 | 2297 |
Display *dpy = myDpy; |
2298 |
||
2299 |
color.pixel = __intVal(index); |
|
2300 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2301 |
ENTER_XLIB(); |
1344 | 2302 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2303 |
LEAVE_XLIB(); |
1344 | 2304 |
END_INTERRUPTSBLOCKED |
2305 |
||
2306 |
/* |
|
2307 |
* have to compensate for an error in X ?, which does not scale |
|
2308 |
* colors correctly if lesser than 16bits are valid in a color, |
|
2748 | 2309 |
* (for example, color white on a 4bitsPerRGB server will Return |
1344 | 2310 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
2311 |
*/ |
|
2312 |
bits = __intVal(__INST(bitsPerRGB)); |
|
2313 |
scale = (1<<bits) - 1; |
|
2314 |
shift = 16 - bits; |
|
2315 |
||
2316 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
|
2317 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
|
2318 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
|
2319 |
r = __MKSMALLINT(sr); |
|
2320 |
g = __MKSMALLINT(sg); |
|
2321 |
b = __MKSMALLINT(sb); |
|
295 | 2322 |
} |
2323 |
%}. |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2324 |
^ aBlock value:r value:g value:b |
295 | 2325 |
! |
2326 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2327 |
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
|
2328 |
"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
|
2329 |
and evaluate the 3-arg block, aBlock with them" |
295 | 2330 |
|
2331 |
|r g b| |
|
2332 |
||
2333 |
displayId isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2334 |
self pimitiveFailed. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2335 |
^ nil |
295 | 2336 |
]. |
2337 |
%{ |
|
555 | 2338 |
int screen = __intVal(__INST(screen)); |
295 | 2339 |
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
|
2340 |
int sr, sg, sb; |
295 | 2341 |
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
|
2342 |
int bits, scale, shift; |
295 | 2343 |
|
1209 | 2344 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2345 |
&& __isNonNilObject(colorName) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2346 |
&& (__qIsString(colorName) || __qIsSymbol(colorName))) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2347 |
Display *dpy = myDpy; |
1209 | 2348 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2349 |
BEGIN_INTERRUPTSBLOCKED |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2350 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
1831 | 2351 |
(char *) __stringVal(colorName), &color)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2352 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2353 |
* 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
|
2354 |
* colors correctly if lesser than 16bits are valid in a color, |
2748 | 2355 |
* (for example, color white on a 4bitsPerRGB server will Return |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2356 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2357 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2358 |
bits = __intVal(__INST(bitsPerRGB)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2359 |
scale = (1<<bits) - 1; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2360 |
shift = 16 - bits; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2361 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2362 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2363 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2364 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2365 |
r = __MKSMALLINT(sr); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2366 |
g = __MKSMALLINT(sg); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2367 |
b = __MKSMALLINT(sb); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2368 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2369 |
END_INTERRUPTSBLOCKED |
295 | 2370 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2371 |
%}. |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2372 |
^ aBlock value:r value:g value:b |
295 | 2373 |
! |
2374 |
||
2375 |
listOfAvailableColors |
|
2376 |
"return a list of all available colornames. |
|
2377 |
This should not be used, since colornames are very |
|
2378 |
display-specific (here X-specific)." |
|
2379 |
||
2380 |
|aStream list line index colorName| |
|
2381 |
||
2382 |
aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'. |
|
2383 |
aStream isNil ifTrue:[^ nil]. |
|
2384 |
list := OrderedCollection new. |
|
2385 |
[aStream atEnd] whileFalse:[ |
|
1344 | 2386 |
line := aStream nextLine. |
2387 |
line notNil ifTrue:[ |
|
2388 |
"skip the r/g/b numbers" |
|
2389 |
index := 1. |
|
2390 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2391 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2392 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2393 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2394 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2395 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2396 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2397 |
colorName := line copyFrom:index. |
|
2398 |
((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
|
2399 |
list add:colorName |
|
2400 |
] |
|
2401 |
] |
|
295 | 2402 |
]. |
2403 |
aStream close. |
|
2404 |
^ list sort |
|
1047 | 2405 |
|
2406 |
" |
|
2407 |
Screen current listOfAvailableColors |
|
2408 |
" |
|
2409 |
||
2410 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2411 |
! |
2412 |
||
2413 |
percentToXColorValue:aPercentage |
|
2414 |
"given a color-component value in percent (0..100), return the corresponding |
|
2415 |
x-component value (0..65k) as an integer" |
|
2416 |
||
2417 |
%{ /* NOCONTEXT */ |
|
2418 |
||
2419 |
if (__isSmallInteger(aPercentage)) { |
|
1344 | 2420 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2421 |
} |
2422 |
if (__isFloat(aPercentage)) { |
|
1344 | 2423 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2424 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2425 |
%}. |
295 | 2426 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2427 |
! |
2428 |
||
892 | 2429 |
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
|
2430 |
"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
|
2431 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2432 |
|
2433 |
%{ /* NOCONTEXT */ |
|
2434 |
||
2435 |
char *colorname; |
|
2436 |
XColor color; |
|
555 | 2437 |
int screen = __intVal(__INST(screen)); |
0 | 2438 |
int r, g, b; |
2439 |
int ok = 1; |
|
2440 |
||
892 | 2441 |
if (__isSmallInteger(sred)) |
1344 | 2442 |
r = __intVal(sred); |
0 | 2443 |
else ok = 0; |
2444 |
||
892 | 2445 |
if (__isSmallInteger(sgreen)) |
1344 | 2446 |
g = __intVal(sgreen); |
0 | 2447 |
else ok = 0; |
2448 |
||
892 | 2449 |
if (__isSmallInteger(sblue)) |
1344 | 2450 |
b = __intVal(sblue); |
0 | 2451 |
else ok = 0; |
2452 |
||
1209 | 2453 |
if (ISCONNECTED |
2454 |
&& __isSmallInteger(index) && ok) { |
|
1344 | 2455 |
Display *dpy = myDpy; |
2456 |
||
2457 |
color.pixel = __intVal(index); |
|
2458 |
color.red = r; |
|
2459 |
color.green = g; |
|
2460 |
color.blue = b; |
|
2461 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2462 |
||
2463 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2464 |
ENTER_XLIB(); |
1344 | 2465 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2466 |
LEAVE_XLIB(); |
1344 | 2467 |
END_INTERRUPTSBLOCKED |
2468 |
RETURN ( self ); |
|
0 | 2469 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2470 |
%}. |
0 | 2471 |
self primitiveFailed |
295 | 2472 |
! ! |
2473 |
||
2474 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2475 |
||
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2476 |
builtInCursorShapes |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2477 |
"return a collection of standard cursor names. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2478 |
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
|
2479 |
user cursors. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2480 |
(actually, there are more than those below ...)" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2481 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2482 |
"/ 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
|
2483 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2484 |
^ #( |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2485 |
#upLeftArrow "/ XC_top_left_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2486 |
#upRightHand "/ XC_hand1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2487 |
#upDownArrow "/ XC_sb_v_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2488 |
#leftRightArrow "/ XC_sb_h_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2489 |
#upLimitArrow "/ XC_top_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2490 |
#downLimitArrow "/ XC_bottom_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2491 |
#leftLimitArrow "/ XC_left_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2492 |
#rightLimitArrow "/ XC_right_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2493 |
#text "/ XC_xterm |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2494 |
#upRightArrow "/ XC_draft_large |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2495 |
#leftHand "/ XC_hand2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2496 |
#questionMark "/ XC_question_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2497 |
#cross "/ XC_X_cursor |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2498 |
#wait "/ XC_watch |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2499 |
#crossHair "/ XC_tcross |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2500 |
#origin "/ XC_ul_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2501 |
#topLeft "/ XC_ul_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2502 |
#corner "/ XC_lr_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2503 |
#bottomRight "/ XC_lr_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2504 |
#topRight "/ XC_ur_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2505 |
#bottomLeft "/ XC_ll_angle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2506 |
#square "/ XC_dotbox |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2507 |
#fourWay "/ XC_fleur |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2508 |
#crossCursor "/ XC_X_cursor |
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2509 |
) |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2510 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2511 |
"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
|
2512 |
"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
|
2513 |
! |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2514 |
|
295 | 2515 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
2516 |
"change a cursors colors" |
|
2517 |
||
2518 |
|fgR fgG fgB bgR bgG bgB| |
|
2519 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2520 |
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
|
2521 |
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
|
2522 |
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
|
2523 |
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
|
2524 |
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
|
2525 |
bgB := bgColor scaledBlue. |
0 | 2526 |
%{ |
295 | 2527 |
XColor fgcolor, bgcolor; |
2528 |
||
1209 | 2529 |
if (ISCONNECTED |
2530 |
&& __isExternalAddress(aCursorId) |
|
295 | 2531 |
&& __bothSmallInteger(fgG, fgB) |
2532 |
&& __bothSmallInteger(bgR, bgG) |
|
2533 |
&& __bothSmallInteger(bgB, fgR)) { |
|
2534 |
||
1344 | 2535 |
fgcolor.red = __intVal(fgR); |
2536 |
fgcolor.green= __intVal(fgG); |
|
2537 |
fgcolor.blue = __intVal(fgB); |
|
2538 |
bgcolor.red = __intVal(bgR); |
|
2539 |
bgcolor.green= __intVal(bgG); |
|
2540 |
bgcolor.blue = __intVal(bgB); |
|
2541 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2542 |
ENTER_XLIB(); |
1344 | 2543 |
XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2544 |
LEAVE_XLIB(); |
1344 | 2545 |
END_INTERRUPTSBLOCKED |
2546 |
RETURN ( self ); |
|
72 | 2547 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2548 |
%}. |
0 | 2549 |
self primitiveFailed |
70 | 2550 |
! |
2551 |
||
295 | 2552 |
createCursorShape:aShape |
974 | 2553 |
"create a cursor given a shape-symbol. This only works |
2554 |
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
|
2555 |
Senders must always care for a fallBack, in case of a nil return." |
295 | 2556 |
|
2557 |
|number id| |
|
2558 |
||
2559 |
number := self shapeNumberFromSymbol:aShape. |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2560 |
number isNil ifTrue:[^ nil]. |
295 | 2561 |
%{ |
2562 |
Cursor newCursor; |
|
2563 |
||
1209 | 2564 |
if (ISCONNECTED |
2565 |
&& __isSmallInteger(number)) { |
|
1344 | 2566 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2567 |
ENTER_XLIB(); |
1344 | 2568 |
newCursor = XCreateFontCursor(myDpy, __intVal(number)); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2569 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2570 |
#ifdef COUNT_RESOURCES |
1344 | 2571 |
if (newCursor) |
2572 |
__cnt_cursor++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2573 |
#endif |
1344 | 2574 |
END_INTERRUPTSBLOCKED |
2575 |
if (newCursor != (Cursor)0) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2576 |
id = __MKEXTERNALADDRESS(newCursor); |
1344 | 2577 |
} |
0 | 2578 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2579 |
%}. |
295 | 2580 |
^ id |
2581 |
! |
|
2582 |
||
974 | 2583 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2584 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2585 |
||
2586 |
|id sourceId maskId| |
|
2587 |
||
2588 |
sourceId := sourceForm id. |
|
2589 |
maskId := maskForm id. |
|
2590 |
%{ |
|
2591 |
Cursor newCursor; |
|
2592 |
XColor fgColor, bgColor; |
|
2593 |
||
1209 | 2594 |
if (ISCONNECTED |
2595 |
&& __isExternalAddress(sourceId) |
|
295 | 2596 |
&& __isExternalAddress(maskId) |
2597 |
&& __bothSmallInteger(hx, hy)) { |
|
1344 | 2598 |
fgColor.red = 0; /* fg is black */ |
2599 |
fgColor.green = 0; |
|
2600 |
fgColor.blue = 0; |
|
2601 |
bgColor.red = 0xFFFF; /* bg is white */ |
|
2602 |
bgColor.green = 0xFFFF; |
|
2603 |
bgColor.blue = 0xFFFF; |
|
2604 |
||
2605 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2606 |
ENTER_XLIB(); |
1344 | 2607 |
newCursor = XCreatePixmapCursor(myDpy, |
2608 |
_PixmapVal(sourceId), |
|
2609 |
_PixmapVal(maskId), |
|
2610 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2611 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2612 |
#ifdef COUNT_RESOURCES |
1344 | 2613 |
if (newCursor) |
2614 |
__cnt_cursor++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2615 |
#endif |
1344 | 2616 |
END_INTERRUPTSBLOCKED |
2617 |
if (newCursor != (Cursor)0) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2618 |
id = __MKEXTERNALADDRESS(newCursor); |
1344 | 2619 |
} |
0 | 2620 |
} |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
2621 |
%}. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2622 |
id isNil ifTrue:[ |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2623 |
self primitiveFailed. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2624 |
]. |
295 | 2625 |
^ id |
2626 |
! |
|
2627 |
||
2628 |
destroyCursor:aCursorId |
|
974 | 2629 |
"release a cursor - frees any device resources" |
0 | 2630 |
|
2631 |
%{ /* NOCONTEXT */ |
|
2632 |
||
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2633 |
if (! ISCONNECTED) { |
1344 | 2634 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2635 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2636 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2637 |
if (__isExternalAddress(aCursorId)) { |
1344 | 2638 |
Cursor curs = _CursorVal(aCursorId); |
2639 |
||
2640 |
if (curs) { |
|
2641 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2642 |
ENTER_XLIB(); |
1344 | 2643 |
XFreeCursor(myDpy, curs); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2644 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2645 |
#ifdef COUNT_RESOURCES |
1344 | 2646 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2647 |
#endif |
1344 | 2648 |
END_INTERRUPTSBLOCKED |
2649 |
} |
|
2650 |
RETURN ( self ); |
|
0 | 2651 |
} |
974 | 2652 |
%}. |
0 | 2653 |
self primitiveFailed |
295 | 2654 |
! |
2655 |
||
974 | 2656 |
needDeviceFormsForCursor |
2657 |
^ true |
|
2658 |
! |
|
2659 |
||
295 | 2660 |
shapeNumberFromSymbol:shape |
974 | 2661 |
"given a shape-symbol, return the corresponding cursor-number, |
2662 |
or nil if no such standard cursor exists." |
|
295 | 2663 |
|
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2664 |
"/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
|
2665 |
"/ 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
|
2666 |
|
295 | 2667 |
|
2668 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2669 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2670 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2671 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2672 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2673 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2674 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2675 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2676 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2677 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2678 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2679 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2680 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2681 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2682 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2683 |
((shape == #origin) |
|
2684 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2685 |
((shape == #corner) |
|
2686 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2687 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2688 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2689 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2690 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2691 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
1183 | 2692 |
|
2693 |
"/ ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL. |
|
974 | 2694 |
^ nil |
0 | 2695 |
! ! |
2696 |
||
1543 | 2697 |
!XWorkstation methodsFor:'drag & drop'! |
2698 |
||
1556 | 2699 |
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
2700 |
"drop something in some alien view, using the DND protocol. |
|
2701 |
Returns false, if the drop could not be performed." |
|
2702 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2703 |
|msgType dropColl dropCollSize anyFile anyDir anyText anyOther |
1556 | 2704 |
dropType dropTypeCode strings sz idx val| |
2705 |
||
2706 |
(msgType := self atomIDOf:'DndProtocol') notNil ifTrue:[ |
|
2707 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2708 |
"/ 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
|
2709 |
"/ check for this. |
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 |
dropObjects isCollection ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2712 |
dropColl := Array with:dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2713 |
] ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2714 |
dropColl := dropObjects |
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 |
anyFile := anyDir := anyText := anyOther := false. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2717 |
dropColl do:[:aDropObject | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2718 |
aDropObject isFileObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2719 |
aDropObject theObject isDirectory ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2720 |
anyDir := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2721 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2722 |
anyFile := true |
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 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2725 |
aDropObject isTextObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2726 |
anyText := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2727 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2728 |
anyOther := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2729 |
] |
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 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2732 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2733 |
anyOther ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2734 |
"/ DND does not support this ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2735 |
'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
|
2736 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2737 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2738 |
anyText ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2739 |
(anyFile or:[anyDir]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2740 |
"/ DND does not support mixed types |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2741 |
'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
|
2742 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2743 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2744 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2745 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2746 |
dropCollSize := dropColl size. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2747 |
anyFile ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2748 |
dropType := #DndFiles. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2749 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2750 |
dropType := #DndFile |
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 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2753 |
anyDir ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2754 |
dropType := #DndFiles. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2755 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2756 |
dropType := #DndDir |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2757 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2758 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2759 |
anyText ifTrue:[ |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2760 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2761 |
dropType := #DndText |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2762 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2763 |
"/ can only drop a single text object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2764 |
'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
|
2765 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2766 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2767 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2768 |
"/ mhmh ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2769 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2770 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2771 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2772 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2773 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2774 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2775 |
dropTypeCode := self dndDropTypes indexOf:dropType. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2776 |
dropTypeCode == 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2777 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2778 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2779 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2780 |
dropTypeCode := dropTypeCode - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2781 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2782 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2783 |
"/ place the selection inTo the DndSelection property |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2784 |
"/ of the rootView ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2785 |
"/ ... need a single string, with 0-terminated parts. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2786 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2787 |
strings := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2788 |
sz := 0. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2789 |
dropColl do:[:anObject | |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2790 |
|s o| |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2791 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2792 |
o := anObject theObject. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2793 |
anObject isFileObject ifTrue:[ |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2794 |
o := o pathName |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2795 |
]. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2796 |
s := o asString. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2797 |
strings add:s. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2798 |
sz := sz + (s size) + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2799 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2800 |
val := String new:sz. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2801 |
idx := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2802 |
strings do:[:aString | |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2803 |
|sz| |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2804 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2805 |
sz := aString size. |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2806 |
val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1. |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2807 |
idx := idx + sz. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2808 |
val at:idx put:(Character value:0). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2809 |
idx := idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2810 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2811 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2812 |
self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2813 |
setProperty:(self atomIDOf:'DndSelection') |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2814 |
type:(stringAtom) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2815 |
value:val |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2816 |
for:rootId. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2817 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2818 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2819 |
sendClientEvent:msgType |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2820 |
format:32 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2821 |
to:destinationId |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2822 |
data1:dropTypeCode |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2823 |
data2:0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2824 |
data3:(destinationId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2825 |
data4:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2826 |
data5:nil. |
1556 | 2827 |
]. |
2828 |
||
2829 |
^ false |
|
2830 |
||
2831 |
"Created: 6.4.1997 / 13:39:37 / cg" |
|
1558 | 2832 |
"Modified: 6.4.1997 / 14:30:43 / cg" |
1556 | 2833 |
! |
2834 |
||
2835 |
dndDropTypes |
|
2836 |
"return the dropTypes as supported by DND" |
|
2837 |
||
2838 |
^ #( |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2839 |
DndUnknown "/ 0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2840 |
DndRawData "/ 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2841 |
DndFile "/ 2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2842 |
DndFiles "/ 3 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2843 |
DndText "/ 4 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2844 |
DndDir "/ 5 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2845 |
DndLink "/ 6 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2846 |
DndExe "/ 7 |
1556 | 2847 |
) |
2848 |
||
2849 |
"Created: 6.4.1997 / 12:57:56 / cg" |
|
2850 |
"Modified: 6.4.1997 / 13:38:52 / cg" |
|
2851 |
! |
|
2852 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
2853 |
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
1556 | 2854 |
"drop something in some alien view. |
2855 |
Returns false, if the drop could not be performed." |
|
2856 |
||
2857 |
"/ |
|
1543 | 2858 |
"/ see, if the display supports the DND protocol ... |
1556 | 2859 |
"/ |
1543 | 2860 |
(self atomIDOf:'DndProtocol') notNil ifTrue:[ |
1694 | 2861 |
^ self |
2862 |
dndDrop:aCollectionOfDropObjects |
|
2863 |
inWindowID:destinationId |
|
2864 |
position:destinationPoint |
|
2865 |
rootPosition:rootPoint |
|
1543 | 2866 |
]. |
2867 |
||
1556 | 2868 |
"/ add more drag&drop protocols here. |
2869 |
||
2870 |
^ false |
|
2871 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
2872 |
"Modified: 11.4.1997 / 12:44:50 / cg" |
1543 | 2873 |
! ! |
2874 |
||
0 | 2875 |
!XWorkstation methodsFor:'drawing'! |
2876 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2877 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2878 |
"do a bit-blt; copy bits from the rectangle defined by |
2879 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2880 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2881 |
argument is not integer." |
|
0 | 2882 |
|
2883 |
%{ /* NOCONTEXT */ |
|
2884 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2885 |
GC gc; |
0 | 2886 |
Drawable source, dest; |
2887 |
||
1209 | 2888 |
if (ISCONNECTED |
2889 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2890 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2891 |
&& __isExternalAddress(destId) |
97 | 2892 |
&& __bothSmallInteger(w, h) |
2893 |
&& __bothSmallInteger(srcX, srcY) |
|
2894 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1848 | 2895 |
int _sX, _sY, _w, _h, _dX, _dY; |
2896 |
||
2897 |
_sX = __intVal(srcX); |
|
2898 |
_sY = __intVal(srcY); |
|
2899 |
_w = __intVal(w); |
|
2900 |
_h = __intVal(h); |
|
2901 |
_dX = __intVal(dstX); |
|
2902 |
_dY = __intVal(dstY); |
|
2903 |
||
1344 | 2904 |
gc = _GCVal(dstGCId); |
2905 |
source = (Drawable) _WindowVal(sourceId); |
|
2906 |
dest = (Drawable) _WindowVal(destId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2907 |
ENTER_XLIB(); |
1848 | 2908 |
XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2909 |
LEAVE_XLIB(); |
1344 | 2910 |
RETURN ( self ); |
0 | 2911 |
} |
118 | 2912 |
%}. |
2913 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2914 |
or any non integer coordinate" |
|
2915 |
||
0 | 2916 |
self primitiveFailed |
2917 |
! |
|
2918 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2919 |
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
|
2920 |
"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
|
2921 |
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
|
2922 |
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
|
2923 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2924 |
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
|
2925 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2926 |
%{ /* NOCONTEXT */ |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2927 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2928 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2929 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2930 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2931 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2932 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2933 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2934 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2935 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2936 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2937 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 2938 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2939 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2940 |
gc = _GCVal(dstGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2941 |
source = (Drawable) _WindowVal(sourceId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2942 |
dest = (Drawable) _WindowVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2943 |
ENTER_XLIB(); |
1344 | 2944 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2945 |
XCopyArea(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2946 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2947 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2948 |
__intVal(dstX), __intVal(dstY)); |
1344 | 2949 |
XSetGraphicsExposures(dpy, gc, 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2950 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2951 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2952 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2953 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2954 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2955 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2956 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2957 |
self primitiveFailed |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2958 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2959 |
|
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
2960 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 2961 |
"do a bit-blt, but only copy the low-bit plane; |
2962 |
copy bits from the rectangle defined by |
|
2963 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
2964 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
2965 |
argument is not integer." |
|
0 | 2966 |
|
2967 |
%{ /* NOCONTEXT */ |
|
2968 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
2969 |
GC gc; |
0 | 2970 |
Drawable source, dest; |
2971 |
||
1209 | 2972 |
if (ISCONNECTED |
2973 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2974 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2975 |
&& __isExternalAddress(destId) |
97 | 2976 |
&& __bothSmallInteger(w, h) |
2977 |
&& __bothSmallInteger(srcX, srcY) |
|
2978 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1344 | 2979 |
gc = _GCVal(dstGCId); |
2980 |
source = (Drawable) _WindowVal(sourceId); |
|
2981 |
dest = (Drawable) _WindowVal(destId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2982 |
ENTER_XLIB(); |
1344 | 2983 |
XCopyPlane(myDpy, source, dest, gc, |
2984 |
__intVal(srcX), __intVal(srcY), |
|
2985 |
__intVal(w), __intVal(h), |
|
2986 |
__intVal(dstX), __intVal(dstY), 1); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2987 |
LEAVE_XLIB(); |
1344 | 2988 |
RETURN ( self ); |
0 | 2989 |
} |
118 | 2990 |
%}. |
2991 |
"badGC, bad sourceDrawableId or destDrawableID |
|
2992 |
or any non integer coordinate" |
|
2993 |
||
0 | 2994 |
self primitiveFailed |
2995 |
! |
|
2996 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
2997 |
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
|
2998 |
"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
|
2999 |
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
|
3000 |
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
|
3001 |
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
|
3002 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3003 |
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
|
3004 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3005 |
%{ /* NOCONTEXT */ |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3006 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3007 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3008 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3009 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3010 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3011 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3012 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3013 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3014 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3015 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3016 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 3017 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3018 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3019 |
gc = _GCVal(dstGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3020 |
source = (Drawable) _WindowVal(sourceId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3021 |
dest = (Drawable) _WindowVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3022 |
ENTER_XLIB(); |
1344 | 3023 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3024 |
XCopyPlane(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3025 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3026 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3027 |
__intVal(dstX), __intVal(dstY), 1); |
1344 | 3028 |
XSetGraphicsExposures(dpy, gc, 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3029 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3030 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3031 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3032 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3033 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3034 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3035 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3036 |
self primitiveFailed |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3037 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3038 |
|
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
3039 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 3040 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
3041 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 3042 |
|
3043 |
%{ /* NOCONTEXT */ |
|
3044 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3045 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3046 |
Window win; |
0 | 3047 |
int w, h, angle1, angle2; |
3048 |
double f; |
|
3049 |
||
97 | 3050 |
if (__isSmallInteger(startAngle)) |
1344 | 3051 |
angle1 = __intVal(startAngle) * 64; |
36 | 3052 |
else if (__isFloat(startAngle)) { |
1344 | 3053 |
f = __floatVal(startAngle); |
3054 |
angle1 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3055 |
} else if (__isShortFloat(startAngle)) { |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3056 |
f = __shortFloatVal(startAngle); |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3057 |
angle1 = f * 64; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3058 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3059 |
|
97 | 3060 |
if (__isSmallInteger(angle)) |
1344 | 3061 |
angle2 = __intVal(angle) * 64; |
36 | 3062 |
else if (__isFloat(angle)) { |
1344 | 3063 |
f = __floatVal(angle); |
3064 |
angle2 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3065 |
} else if (__isShortFloat(angle)) { |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3066 |
f = __shortFloatVal(angle); |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3067 |
angle2 = f * 64; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3068 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3069 |
|
1209 | 3070 |
if (ISCONNECTED |
3071 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3072 |
&& __isExternalAddress(aDrawableId) |
97 | 3073 |
&& __bothSmallInteger(x, y) |
3074 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3075 |
win = _WindowVal(aDrawableId); |
3076 |
gc = _GCVal(aGCId); |
|
3077 |
w = __intVal(width); |
|
3078 |
h = __intVal(height); |
|
3079 |
/* |
|
3080 |
* need this check here: some servers simply dump core with bad args |
|
3081 |
*/ |
|
3082 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3083 |
ENTER_XLIB(); |
1344 | 3084 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3085 |
w, h, angle1, angle2); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3086 |
LEAVE_XLIB(); |
1344 | 3087 |
} |
3088 |
RETURN ( self ); |
|
0 | 3089 |
} |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3090 |
bad: ; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3091 |
%}. |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3092 |
"badGC, badDrawable or coordinates not integer |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3093 |
or angle(s) not integer or float." |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3094 |
|
0 | 3095 |
self primitiveFailed |
3096 |
! |
|
3097 |
||
295 | 3098 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
3099 |
"draw a line. If the coordinates are not integers, an error is triggered." |
|
3100 |
||
3101 |
%{ /* NOCONTEXT */ |
|
3102 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3103 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3104 |
Window win; |
295 | 3105 |
|
1209 | 3106 |
if (ISCONNECTED |
3107 |
&& __isExternalAddress(aGCId) |
|
295 | 3108 |
&& __isExternalAddress(aDrawableId) |
3109 |
&& __bothSmallInteger(x0, y0) |
|
3110 |
&& __bothSmallInteger(x1, y1)) { |
|
2541 | 3111 |
Display *dpy = myDpy; |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3112 |
gc = _GCVal(aGCId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3113 |
win = _WindowVal(aDrawableId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3114 |
|
1974 | 3115 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3116 |
if ((x0 == x1) && (y0 == y1)) { |
2541 | 3117 |
XDrawPoint(dpy, win, gc, __intVal(x0), __intVal(y0)); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3118 |
} else { |
2541 | 3119 |
XDrawLine(dpy, win, gc, __intVal(x0), __intVal(y0), |
3120 |
__intVal(x1), __intVal(y1)); |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3121 |
} |
1974 | 3122 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3123 |
RETURN ( self ); |
295 | 3124 |
} |
3125 |
%}. |
|
3126 |
"badGC, badDrawable or coordinates not integer" |
|
3127 |
self primitiveFailed |
|
3128 |
! |
|
3129 |
||
1978 | 3130 |
displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
3131 |
"draw a polygon starting at x; the y values derives from the collection yValues. |
|
3132 |
The associated x is a multiple of step. Each y value will be scaled and translated |
|
3133 |
" |
|
3134 |
||
3135 |
|noY| |
|
3136 |
||
3137 |
(noY := yValues size) < 2 ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3138 |
^ self |
1978 | 3139 |
]. |
3140 |
||
3141 |
%{ |
|
3142 |
OBJ yA, t; |
|
3143 |
int i, num; |
|
3144 |
float y, x, sY, tY, step; |
|
3145 |
GC gc; |
|
3146 |
XPoint * points; |
|
3147 |
XPoint qPoints[200]; |
|
3148 |
int mustFree = 0; |
|
3149 |
||
3150 |
Window win; |
|
3151 |
||
3152 |
if (ISCONNECTED |
|
3153 |
&& __isExternalAddress(aGCId) |
|
3154 |
&& __isExternalAddress(aDrawableId) ) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3155 |
gc = _GCVal(aGCId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3156 |
win = _WindowVal(aDrawableId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3157 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3158 |
if( __isSmallInteger(scaleY) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3159 |
sY = (float) __intVal( scaleY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3160 |
else if (__isFloat(scaleY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3161 |
sY = __floatVal( scaleY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3162 |
else if (__isShortFloat(scaleY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3163 |
sY = __shortFloatVal( scaleY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3164 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3165 |
t = __SSEND0(scaleY, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3166 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3167 |
sY = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3168 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3169 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3170 |
if( __isSmallInteger(transY) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3171 |
tY = (float) __intVal( transY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3172 |
else if (__isFloat(transY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3173 |
tY = __floatVal( transY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3174 |
else if (__isShortFloat(transY)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3175 |
tY = __shortFloatVal( transY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3176 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3177 |
t = __SSEND0(transY, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3178 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3179 |
tY = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3180 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3181 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3182 |
if( __isSmallInteger(startX) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3183 |
x = (float) __intVal( startX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3184 |
else if (__isFloat(startX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3185 |
x = __floatVal( startX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3186 |
else if (__isShortFloat(startX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3187 |
x = __shortFloatVal( startX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3188 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3189 |
t = __SSEND0(startX, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3190 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3191 |
x = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3192 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3193 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3194 |
if( __isSmallInteger(stepX) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3195 |
step = (float) __intVal( stepX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3196 |
else if (__isFloat(stepX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3197 |
step = __floatVal( stepX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3198 |
else if (__isShortFloat(stepX)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3199 |
step = __shortFloatVal( stepX ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3200 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3201 |
t = __SSEND0(stepX, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3202 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3203 |
step = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3204 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3205 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3206 |
num = __intVal( noY ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3207 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3208 |
if( num > 200 ) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3209 |
if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3210 |
goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3211 |
mustFree = 1; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3212 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3213 |
points = qPoints; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3214 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3215 |
for( i = 0; i < num; ++i ) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3216 |
yA = __AT_(yValues, __MKSMALLINT(i+1) ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3217 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3218 |
if( __isFloat(yA) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3219 |
y = __floatVal( yA ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3220 |
else if( __isSmallInteger(yA) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3221 |
y = (float) __intVal( yA ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3222 |
else if( __isShortFloat( yA) ) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3223 |
y = __shortFloatVal( yA ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3224 |
else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3225 |
t = __SSEND0(yA, @symbol(asFloat), 0); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3226 |
if (! __isFloat(t)) goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3227 |
y = __floatVal( t ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3228 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3229 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3230 |
points[i].x = (int) (x + 0.5); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3231 |
points[i].y = (int) ((y * sY) + tY + 0.5); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3232 |
x = x + step; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3233 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3234 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3235 |
ENTER_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3236 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3237 |
LEAVE_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3238 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3239 |
if( mustFree ) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3240 |
free( points ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3241 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3242 |
RETURN ( self ); |
1978 | 3243 |
} |
3244 |
||
3245 |
fail: |
|
3246 |
if( mustFree ) |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3247 |
free( points ); |
1978 | 3248 |
%}. |
3249 |
self primitiveFailed |
|
3250 |
||
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3251 |
"Modified: / 13.6.1998 / 13:51:39 / cg" |
1978 | 3252 |
! |
3253 |
||
295 | 3254 |
displayPointX:x y:y in:aDrawableId with:aGCId |
3255 |
"draw a point. If x/y are not integers, an error is triggered." |
|
3256 |
||
3257 |
%{ /* NOCONTEXT */ |
|
3258 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3259 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3260 |
Window win; |
295 | 3261 |
|
1209 | 3262 |
if (ISCONNECTED |
3263 |
&& __isExternalAddress(aGCId) |
|
295 | 3264 |
&& __isExternalAddress(aDrawableId) |
3265 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 3266 |
gc = _GCVal(aGCId); |
3267 |
win = _WindowVal(aDrawableId); |
|
1974 | 3268 |
|
3269 |
ENTER_XLIB(); |
|
1344 | 3270 |
XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y)); |
1974 | 3271 |
LEAVE_XLIB(); |
3272 |
||
1344 | 3273 |
RETURN ( self ); |
295 | 3274 |
} |
3275 |
%}. |
|
3276 |
"badGC, badDrawable or x/y not integer" |
|
3277 |
self primitiveFailed |
|
3278 |
! |
|
3279 |
||
3280 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
3281 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
3282 |
define the polygon. |
|
3283 |
If any coordinate is not integer, an error is triggered." |
|
3284 |
||
3285 |
|numberOfPoints newPoints| |
|
3286 |
||
3287 |
numberOfPoints := aPolygon size. |
|
3288 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3289 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3290 |
Window win; |
295 | 3291 |
OBJ point, x, y; |
3292 |
int i, num; |
|
3293 |
XPoint *points; |
|
3294 |
XPoint qPoints[100]; |
|
377 | 3295 |
int mustFree = 0; |
295 | 3296 |
|
1209 | 3297 |
if (ISCONNECTED |
3298 |
&& __isExternalAddress(aGCId) |
|
295 | 3299 |
&& __isExternalAddress(aDrawableId) |
3300 |
&& __isSmallInteger(numberOfPoints)) { |
|
1344 | 3301 |
gc = _GCVal(aGCId); |
3302 |
win = _WindowVal(aDrawableId); |
|
3303 |
num = __intVal(numberOfPoints); |
|
3304 |
/* |
|
3305 |
* avoid a (slow) malloc, if the number of points is small |
|
3306 |
*/ |
|
3307 |
if (num > 100) { |
|
3308 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
|
3309 |
if (! points) goto fail; |
|
3310 |
mustFree = 1; |
|
3311 |
} else |
|
3312 |
points = qPoints; |
|
3313 |
||
3314 |
for (i=0; i<num; i++) { |
|
3315 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
3316 |
if (! __isPoint(point)) goto fail; |
|
3317 |
x = _point_X(point); |
|
3318 |
y = _point_Y(point); |
|
3319 |
if (! __bothSmallInteger(x, y)) |
|
3320 |
goto fail; |
|
3321 |
points[i].x = __intVal(x); |
|
3322 |
points[i].y = __intVal(y); |
|
3323 |
} |
|
1974 | 3324 |
|
3325 |
ENTER_XLIB(); |
|
1344 | 3326 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
1974 | 3327 |
LEAVE_XLIB(); |
3328 |
||
1344 | 3329 |
if (mustFree) |
3330 |
free(points); |
|
3331 |
RETURN ( self ); |
|
295 | 3332 |
} |
3333 |
fail: ; |
|
377 | 3334 |
if (mustFree) |
1344 | 3335 |
free(points); |
295 | 3336 |
%}. |
3337 |
"badGC, badDrawable or coordinates not integer" |
|
3338 |
self primitiveFailed |
|
3339 |
! |
|
3340 |
||
3341 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
3342 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
|
3343 |
||
3344 |
%{ /* NOCONTEXT */ |
|
3345 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3346 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3347 |
Window win; |
295 | 3348 |
int w, h; |
3349 |
||
1209 | 3350 |
if (ISCONNECTED |
3351 |
&& __isExternalAddress(aGCId) |
|
295 | 3352 |
&& __isExternalAddress(aDrawableId) |
3353 |
&& __bothSmallInteger(x, y) |
|
3354 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3355 |
gc = _GCVal(aGCId); |
3356 |
win = _WindowVal(aDrawableId); |
|
3357 |
w = __intVal(width); |
|
3358 |
h = __intVal(height); |
|
3359 |
/* |
|
3360 |
* need this check here: some servers simply dump core with bad args |
|
3361 |
*/ |
|
3362 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 3363 |
ENTER_XLIB(); |
1344 | 3364 |
XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h); |
1974 | 3365 |
LEAVE_XLIB(); |
1344 | 3366 |
} |
3367 |
RETURN ( self ); |
|
295 | 3368 |
} |
3369 |
%}. |
|
3370 |
"badGC, badDrawable or coordinates not integer" |
|
3371 |
self primitiveFailed |
|
3372 |
! |
|
3373 |
||
3374 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3375 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
|
3376 |
foreground and background characters. |
|
3377 |
If the coordinates are not integers, an error is triggered." |
|
3378 |
||
3379 |
%{ /* NOCONTEXT */ |
|
3380 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3381 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3382 |
Window win; |
1831 | 3383 |
char *cp; |
295 | 3384 |
OBJ cls; |
3385 |
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
|
3386 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3387 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3388 |
int nInstBytes; |
295 | 3389 |
|
1209 | 3390 |
if (ISCONNECTED |
3391 |
&& __isExternalAddress(aGCId) |
|
295 | 3392 |
&& __isExternalAddress(aDrawableId) |
3393 |
&& __isNonNilObject(aString) |
|
3394 |
&& __bothSmallInteger(index1, index2) |
|
3395 |
&& __bothSmallInteger(x, y)) { |
|
2541 | 3396 |
Display *dpy = myDpy; |
1344 | 3397 |
gc = _GCVal(aGCId); |
3398 |
win = _WindowVal(aDrawableId); |
|
3399 |
cls = __qClass(aString); |
|
3400 |
||
3401 |
i1 = __intVal(index1) - 1; |
|
3402 |
if (i1 >= 0) { |
|
3403 |
i2 = __intVal(index2) - 1; |
|
3404 |
if (i2 < i1) { |
|
3405 |
RETURN (self); |
|
3406 |
} |
|
3407 |
||
1831 | 3408 |
cp = (char *) __stringVal(aString); |
1344 | 3409 |
l = i2 - i1 + 1; |
3410 |
||
3411 |
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
|
3412 |
n = __stringSize(aString); |
1344 | 3413 |
if (i2 < n) { |
3414 |
cp += i1; |
|
3415 |
if (l > 1000) l = 1000; |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3416 |
ENTER_XLIB(); |
1344 | 3417 |
if (opaque == true) |
2541 | 3418 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1344 | 3419 |
else |
2541 | 3420 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3421 |
LEAVE_XLIB(); |
1344 | 3422 |
RETURN ( self ); |
3423 |
} |
|
3424 |
} |
|
3425 |
||
3426 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3427 |
cp += nInstBytes; |
|
3428 |
||
3429 |
if (__isBytes(aString)) { |
|
3430 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3431 |
||
3432 |
if (i2 < n) { |
|
3433 |
cp += i1; |
|
3434 |
if (l > 1000) l = 1000; |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3435 |
ENTER_XLIB(); |
1344 | 3436 |
if (opaque == true) |
2541 | 3437 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
1344 | 3438 |
else |
2541 | 3439 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3440 |
LEAVE_XLIB(); |
1344 | 3441 |
RETURN ( self ); |
3442 |
} |
|
3443 |
} |
|
3444 |
||
3445 |
/* TWOBYTESTRINGS */ |
|
3446 |
if (__isWords(aString)) { |
|
3447 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3448 |
||
3449 |
if (i2 < n) { |
|
3450 |
union { |
|
3451 |
char b[2]; |
|
3452 |
unsigned short s; |
|
3453 |
} u; |
|
3454 |
int i; |
|
3455 |
XChar2b *cp2 = (XChar2b *)0; |
|
3456 |
int mustFree = 0; |
|
3457 |
||
3458 |
cp += (i1 * 2); |
|
3459 |
if (l > 1000) l = 1000; |
|
3460 |
||
3461 |
/* |
|
3462 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3463 |
* X expects them MSB first |
|
3464 |
* convert as required |
|
3465 |
*/ |
|
3466 |
||
3467 |
u.s = 0x1234; |
|
3468 |
if (u.b[0] != 0x12) { |
|
3469 |
if (l <= NLOCALBUFFER) { |
|
3470 |
cp2 = xlatebuffer; |
|
3471 |
} else { |
|
3472 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
3473 |
mustFree = 1; |
|
3474 |
} |
|
3475 |
for (i=0; i<l; i++) { |
|
3476 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3477 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3478 |
} |
|
3479 |
cp = (char *) cp2; |
|
3480 |
} |
|
3481 |
||
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3482 |
ENTER_XLIB(); |
1344 | 3483 |
if (opaque == true) |
2541 | 3484 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
1344 | 3485 |
else |
2541 | 3486 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3487 |
LEAVE_XLIB(); |
1344 | 3488 |
|
3489 |
if (mustFree) { |
|
3490 |
free(cp2); |
|
3491 |
} |
|
3492 |
||
3493 |
RETURN ( self ); |
|
3494 |
} |
|
3495 |
} |
|
3496 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3497 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3498 |
#undef NLOCALBUFFER |
295 | 3499 |
%}. |
3500 |
"x/y not integer, badGC or drawable, or not a string" |
|
3501 |
self primitiveFailed |
|
3502 |
! |
|
3503 |
||
3504 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
|
3505 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
|
3506 |
foreground and background characters. |
|
3507 |
If the coordinates are not integers, an error is triggered." |
|
3508 |
||
3509 |
%{ /* NOCONTEXT */ |
|
3510 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3511 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3512 |
Window win; |
1831 | 3513 |
char *cp; |
295 | 3514 |
int n; |
3515 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3516 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3517 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3518 |
int nInstBytes; |
295 | 3519 |
|
1209 | 3520 |
if (ISCONNECTED |
3521 |
&& __isExternalAddress(aGCId) |
|
295 | 3522 |
&& __isExternalAddress(aDrawableId) |
3523 |
&& __isNonNilObject(aString) |
|
3524 |
&& __bothSmallInteger(x, y)) { |
|
2541 | 3525 |
Display *dpy = myDpy; |
1344 | 3526 |
gc = _GCVal(aGCId); |
3527 |
win = _WindowVal(aDrawableId); |
|
3528 |
cls = __qClass(aString); |
|
3529 |
||
1831 | 3530 |
cp = (char *) __stringVal(aString); |
1344 | 3531 |
|
3532 |
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
|
3533 |
n = __stringSize(aString); |
1344 | 3534 |
if (n > 1000) n = 1000; |
1974 | 3535 |
ENTER_XLIB(); |
1344 | 3536 |
if (opaque == true) |
2541 | 3537 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1344 | 3538 |
else |
2541 | 3539 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1974 | 3540 |
LEAVE_XLIB(); |
1344 | 3541 |
RETURN ( self ); |
3542 |
} |
|
3543 |
||
3544 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3545 |
cp += nInstBytes; |
|
3546 |
||
3547 |
if (__isBytes(aString)) { |
|
3548 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3549 |
||
3550 |
if (n > 1000) n = 1000; |
|
1974 | 3551 |
ENTER_XLIB(); |
1344 | 3552 |
if (opaque == true) |
2541 | 3553 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1344 | 3554 |
else |
2541 | 3555 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
1974 | 3556 |
LEAVE_XLIB(); |
1344 | 3557 |
RETURN ( self ); |
3558 |
} |
|
3559 |
||
3560 |
/* TWOBYTESTRINGS */ |
|
3561 |
if (__isWords(aString)) { |
|
3562 |
union { |
|
3563 |
char b[2]; |
|
3564 |
unsigned short s; |
|
3565 |
} u; |
|
3566 |
int i; |
|
3567 |
XChar2b *cp2; |
|
3568 |
int mustFree = 0; |
|
3569 |
||
3570 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3571 |
if (n > 1000) n = 1000; |
|
3572 |
||
3573 |
/* |
|
3574 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3575 |
* X expects them MSB first |
|
3576 |
* convert as required |
|
3577 |
*/ |
|
3578 |
||
3579 |
u.s = 0x1234; |
|
3580 |
if (u.b[0] != 0x12) { |
|
3581 |
if (n <= NLOCALBUFFER) { |
|
3582 |
cp2 = xlatebuffer; |
|
3583 |
} else { |
|
3584 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
3585 |
mustFree = 1; |
|
3586 |
} |
|
3587 |
||
3588 |
for (i=0; i<n; i++) { |
|
3589 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3590 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3591 |
} |
|
3592 |
cp = (char *) cp2; |
|
3593 |
} |
|
3594 |
||
1974 | 3595 |
ENTER_XLIB(); |
1344 | 3596 |
if (opaque == true) |
2541 | 3597 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
1344 | 3598 |
else |
2541 | 3599 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
1974 | 3600 |
LEAVE_XLIB(); |
1344 | 3601 |
|
3602 |
||
3603 |
if (mustFree) { |
|
3604 |
free(cp2); |
|
3605 |
} |
|
3606 |
||
3607 |
RETURN ( self ); |
|
3608 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3609 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3610 |
#undef NLOCALBUFFER |
295 | 3611 |
%}. |
3612 |
"x/y not integer, badGC or drawable, or not a string" |
|
3613 |
self primitiveFailed |
|
3614 |
! |
|
3615 |
||
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3616 |
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3617 |
width:imageWidth height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3618 |
x:srcx y:srcy |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3619 |
into:aDrawableId |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3620 |
x:dstx y:dsty |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3621 |
width:w height:h |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3622 |
with:aGCId |
295 | 3623 |
|
3624 |
"draw a bitImage which has depth id, width iw and height ih into |
|
3625 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3626 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
3627 |
depth and pixel-units to be different. |
|
3628 |
It has to be checked elsewhere, that the server can do it with the given |
|
3629 |
depth - otherwise, primitive failure will be signalled. |
|
3630 |
Also it is assumed, that the colormap is setup correctly and the |
|
3631 |
colors are allocated - otherwise the colors may be wrong." |
|
3632 |
||
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3633 |
|fmt padding bits wantedPadding| |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3634 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3635 |
padding := givenPadding. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3636 |
bits := givenBits. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3637 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3638 |
"/ the XF86_VGA16 server seems to report an error when we pass it an |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3639 |
"/ 8-bit padded image. (it wants it 32bit padded). |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3640 |
"/ as a workaround, repad it here (although, the server and/or Xlib should |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3641 |
"/ care for that. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3642 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3643 |
((imageDepth == 4) and:[depth == 4]) ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3644 |
fmt := self supportedImageFormatForDepth:4. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3645 |
fmt isNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3646 |
self primitiveFailed. "/ cannot represent this image |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3647 |
^ nil |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3648 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3649 |
wantedPadding := fmt at:#padding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3650 |
wantedPadding > givenPadding ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3651 |
bits := self |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3652 |
repadBits:givenBits |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3653 |
width:imageWidth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3654 |
height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3655 |
depth:imageDepth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3656 |
from:givenPadding |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3657 |
to:wantedPadding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3658 |
padding := wantedPadding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3659 |
] |
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3660 |
]. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3661 |
|
295 | 3662 |
" |
3663 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
3664 |
an unlimited stack, and thus cannot send primitiveFailed |
|
3665 |
" |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3666 |
(self |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3667 |
primDrawBits:bits |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3668 |
bitsPerPixel:bitsPerPixel |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3669 |
depth:imageDepth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3670 |
padding:padding |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3671 |
width:imageWidth height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3672 |
x:srcx y:srcy |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3673 |
into:aDrawableId |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3674 |
x:dstx y:dsty |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3675 |
width:w height:h |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3676 |
with:aGCId) |
295 | 3677 |
ifFalse:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3678 |
" |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3679 |
also happens, if a segmentation violation occurs in the |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3680 |
XPutImage ... |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3681 |
" |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3682 |
self primitiveFailed |
295 | 3683 |
]. |
3684 |
! |
|
3685 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
3686 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
1344 | 3687 |
in:aDrawableId with:aGCId |
90 | 3688 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
3689 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 3690 |
|
3691 |
%{ /* NOCONTEXT */ |
|
3692 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3693 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3694 |
Window win; |
0 | 3695 |
int w, h, angle1, angle2; |
3696 |
double f; |
|
3697 |
||
97 | 3698 |
if (__isSmallInteger(startAngle)) |
1344 | 3699 |
angle1 = __intVal(startAngle) * 64; |
36 | 3700 |
else if (__isFloat(startAngle)) { |
1344 | 3701 |
f = __floatVal(startAngle); |
3702 |
angle1 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3703 |
} else if (__isShortFloat(startAngle)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3704 |
f = __shortFloatVal(startAngle); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3705 |
angle1 = f * 64; |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3706 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3707 |
|
97 | 3708 |
if (__isSmallInteger(angle)) |
1344 | 3709 |
angle2 = __intVal(angle) * 64; |
36 | 3710 |
else if (__isFloat(angle)) { |
1344 | 3711 |
f = __floatVal(angle); |
3712 |
angle2 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3713 |
} else if (__isShortFloat(angle)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3714 |
f = __shortFloatVal(angle); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3715 |
angle2 = f * 64; |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3716 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3717 |
|
1209 | 3718 |
if (ISCONNECTED |
3719 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3720 |
&& __isExternalAddress(aDrawableId) |
97 | 3721 |
&& __bothSmallInteger(x, y) |
3722 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3723 |
gc = _GCVal(aGCId); |
3724 |
win = _WindowVal(aDrawableId); |
|
3725 |
w = __intVal(width); |
|
3726 |
h = __intVal(height); |
|
3727 |
/* |
|
3728 |
* need this check here: some servers simply dump core with bad args |
|
3729 |
*/ |
|
3730 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
1974 | 3731 |
ENTER_XLIB(); |
1344 | 3732 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3733 |
w, h, angle1, angle2); |
|
1974 | 3734 |
LEAVE_XLIB(); |
1344 | 3735 |
} |
3736 |
RETURN ( self ); |
|
0 | 3737 |
} |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3738 |
bad: ; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3739 |
%}. |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3740 |
"badGC, badDrawable or coordinates not integer |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3741 |
or non float angle(s)" |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3742 |
|
0 | 3743 |
self primitiveFailed |
3744 |
! |
|
3745 |
||
3746 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
118 | 3747 |
"fill a polygon given by its points. |
3748 |
If any coordinate is not integer, an error is triggered." |
|
73 | 3749 |
|
3750 |
|numberOfPoints| |
|
0 | 3751 |
|
3752 |
numberOfPoints := aPolygon size. |
|
3753 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3754 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3755 |
Window win; |
73 | 3756 |
OBJ point, x, y; |
3757 |
int i, num; |
|
3758 |
XPoint *points; |
|
3759 |
XPoint qPoints[100]; |
|
377 | 3760 |
int mustFree = 0; |
73 | 3761 |
|
1209 | 3762 |
if (ISCONNECTED |
3763 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3764 |
&& __isExternalAddress(aDrawableId) |
97 | 3765 |
&& __isSmallInteger(numberOfPoints)) { |
1344 | 3766 |
gc = _GCVal(aGCId); |
3767 |
win = _WindowVal(aDrawableId); |
|
3768 |
num = __intVal(numberOfPoints); |
|
3769 |
if (num < 3) { |
|
3770 |
RETURN ( self ); |
|
3771 |
} |
|
3772 |
/* |
|
3773 |
* avoid (slow) malloc, if not many points |
|
3774 |
*/ |
|
3775 |
if (num > 100) { |
|
3776 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
|
3777 |
if (! points) goto fail; |
|
3778 |
mustFree = 1; |
|
3779 |
} else |
|
3780 |
points = qPoints; |
|
3781 |
for (i=0; i<num; i++) { |
|
3782 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
3783 |
if (! __isPoint(point)) goto fail; |
|
3784 |
x = _point_X(point); |
|
3785 |
y = _point_Y(point); |
|
3786 |
if (! __bothSmallInteger(x, y)) |
|
3787 |
goto fail; |
|
3788 |
points[i].x = __intVal(x); |
|
3789 |
points[i].y = __intVal(y); |
|
3790 |
} |
|
1974 | 3791 |
ENTER_XLIB(); |
1344 | 3792 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
1974 | 3793 |
LEAVE_XLIB(); |
1344 | 3794 |
if (mustFree) |
3795 |
free(points); |
|
3796 |
RETURN ( self ); |
|
377 | 3797 |
|
0 | 3798 |
fail: ; |
1344 | 3799 |
if (mustFree) |
3800 |
free(points); |
|
0 | 3801 |
} |
73 | 3802 |
%}. |
3803 |
"badGC, badDrawable or coordinates not integer" |
|
0 | 3804 |
self primitiveFailed |
3805 |
! |
|
3806 |
||
295 | 3807 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
3808 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
3809 |
||
3810 |
%{ /* NOCONTEXT */ |
|
3811 |
||
3812 |
int w, h; |
|
3813 |
||
1209 | 3814 |
if (ISCONNECTED |
3815 |
&& __isExternalAddress(aGCId) |
|
295 | 3816 |
&& __isExternalAddress(aDrawableId) |
3817 |
&& __bothSmallInteger(x, y) |
|
3818 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 3819 |
w = __intVal(width); |
3820 |
h = __intVal(height); |
|
3821 |
/* |
|
3822 |
* need this check here: some servers simply dump core with bad args |
|
3823 |
*/ |
|
3824 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 3825 |
ENTER_XLIB(); |
1344 | 3826 |
XFillRectangle(myDpy, |
3827 |
(Drawable)_WindowVal(aDrawableId), _GCVal(aGCId), |
|
3828 |
__intVal(x), __intVal(y), w, h); |
|
1974 | 3829 |
LEAVE_XLIB(); |
1344 | 3830 |
} |
3831 |
RETURN ( self ); |
|
295 | 3832 |
} |
3833 |
%}. |
|
3834 |
"badGC, badDrawable or coordinates not integer" |
|
3835 |
self primitiveFailed |
|
43 | 3836 |
! |
3837 |
||
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3838 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3839 |
width:imageWidth height:imageHeight |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3840 |
x:srcx y:srcy |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3841 |
into:aDrawableId |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3842 |
x:dstx y:dsty |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3843 |
width:w height:h |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3844 |
with:aGCId |
0 | 3845 |
|
132 | 3846 |
"since XPutImage may allocate huge amount of stack space |
3847 |
(some implementations use alloca), this must run with unlimited stack." |
|
3848 |
||
12 | 3849 |
%{ /* UNLIMITEDSTACK */ |
0 | 3850 |
|
43 | 3851 |
/* |
3852 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
3853 |
* XPutImage |
|
3854 |
*/ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3855 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3856 |
Window win; |
43 | 3857 |
XImage image; |
377 | 3858 |
int imgWdth; |
43 | 3859 |
|
1209 | 3860 |
if (ISCONNECTED |
3861 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3862 |
&& __isExternalAddress(aDrawableId) |
97 | 3863 |
&& __bothSmallInteger(srcx, srcy) |
3864 |
&& __bothSmallInteger(dstx, dsty) |
|
3865 |
&& __bothSmallInteger(w, h) |
|
3866 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
3867 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
3868 |
&& __isSmallInteger(bitPadding) |
43 | 3869 |
&& __isByteArray(imageBits)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3870 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3871 |
int pad = __intVal(bitPadding); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3872 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3873 |
gc = _GCVal(aGCId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3874 |
win = _WindowVal(aDrawableId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3875 |
if (! gc || !win) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3876 |
goto fail; |
46 | 3877 |
#ifdef ARGDEBUG |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3878 |
printf("args ok\n"); |
46 | 3879 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3880 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3881 |
image.width = imgWdth = __intVal(imageWidth); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3882 |
image.height = __intVal(imageHeight); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3883 |
image.xoffset = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3884 |
image.format = ZPixmap; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3885 |
image.byte_order = MSBFirst; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3886 |
image.bitmap_unit = 8; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3887 |
image.bitmap_bit_order = MSBFirst; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3888 |
image.bitmap_pad = pad; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3889 |
image.depth = __intVal(imageDepth); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3890 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3891 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3892 |
/* |
2021 | 3893 |
image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; |
3894 |
*/ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3895 |
image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3896 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3897 |
switch (image.bits_per_pixel) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3898 |
case 1: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3899 |
case 2: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3900 |
case 4: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3901 |
case 8: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3902 |
case 16: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3903 |
case 24: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3904 |
case 32: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3905 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3906 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3907 |
default: |
46 | 3908 |
#ifdef ARGDEBUG |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3909 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 3910 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3911 |
goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3912 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3913 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3914 |
image.red_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3915 |
image.green_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3916 |
image.blue_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3917 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3918 |
/* ENTER_XLIB(); */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3919 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3920 |
__intVal(dstx), __intVal(dsty), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3921 |
__intVal(w), __intVal(h)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3922 |
/* LEAVE_XLIB(); */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3923 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3924 |
RETURN ( true ); |
43 | 3925 |
} |
46 | 3926 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3927 |
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
|
3928 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 3929 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
3930 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
3931 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
3932 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
3933 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
3934 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
3935 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
3936 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
3937 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
3938 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
3939 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 3940 |
#endif |
3941 |
||
0 | 3942 |
fail: ; |
3943 |
%} |
|
3944 |
. |
|
12 | 3945 |
^ false |
0 | 3946 |
! ! |
3947 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3948 |
!XWorkstation methodsFor:'event forwarding'! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
3949 |
|
2385 | 3950 |
buttonPress:button x:x y:y view:aView |
3951 |
"forward a button-press event for some view" |
|
3952 |
||
3953 |
button == 1 ifTrue:[ |
|
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
3954 |
activateOnClick == true ifTrue:[ |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3955 |
"/ dont raise above an active popup view. |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3956 |
(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3957 |
aView topView raise. |
2386 | 3958 |
"/ ] ifFalse:[ |
3959 |
"/ activeKeyboardGrab printCR. |
|
3960 |
"/ activePointerGrab printCR. |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3961 |
] |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
3962 |
]. |
2385 | 3963 |
]. |
3964 |
super buttonPress:button x:x y:y view:aView |
|
3965 |
||
3966 |
||
3967 |
||
3968 |
! |
|
3969 |
||
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3970 |
circulateNotifyView:aView |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3971 |
"sent, when the stacking order changes. |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3972 |
ignored for now." |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3973 |
|
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3974 |
! |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3975 |
|
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3976 |
circulateRequestView:aView |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3977 |
"sent, when the stacking order is about to change. |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3978 |
ignored for now." |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3979 |
! |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
3980 |
|
1540 | 3981 |
clientMessage:event dataOffset:offs view:targetView |
1757 | 3982 |
self halt:'debug halt: unimplemented client message'. |
1540 | 3983 |
|
3984 |
"Created: 4.4.1997 / 17:23:12 / cg" |
|
1757 | 3985 |
"Modified: 17.6.1997 / 18:04:24 / cg" |
1540 | 3986 |
! |
3987 |
||
1543 | 3988 |
clientMessage:event type:type format:format dataOffset:offs view:targetView |
3989 |
|sensor data| |
|
3990 |
||
3991 |
data := event copyFrom:offs + 1. |
|
3992 |
||
3993 |
"/ DND drag&drop protocol |
|
3994 |
type == (self atomIDOf:'DndProtocol') ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3995 |
format == 32 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3996 |
self dndMessage:event data:data view:targetView. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3997 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3998 |
] |
1543 | 3999 |
]. |
4000 |
||
4001 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4002 |
sensor clientMessage:type format:format eventData:data view:targetView |
1543 | 4003 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4004 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4005 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4006 |
" |
1543 | 4007 |
] |
4008 |
||
4009 |
"Created: 4.4.1997 / 17:49:26 / cg" |
|
4010 |
"Modified: 4.4.1997 / 18:00:18 / cg" |
|
4011 |
! |
|
4012 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4013 |
colorMapChangeView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4014 |
"sent, when another colormap is installed. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4015 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4016 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4017 |
aView colorMapChange |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4018 |
! |
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 |
configureRequestView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4021 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4022 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4023 |
"/ aView configureRequest |
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 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4026 |
createdView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4027 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4028 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4029 |
"/ aView created |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4030 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4031 |
|
1543 | 4032 |
dndMessage:event data:data view:targetView |
4033 |
"handle a DND drag&drop protocol message" |
|
4034 |
||
1553 | 4035 |
|sensor dropType dropValue names i1 i2 t| |
1543 | 4036 |
|
4037 |
dropType := data doubleWordAt:1. |
|
4038 |
||
4039 |
"/ see def's in DragAndDropTypes.h |
|
1556 | 4040 |
dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. |
1543 | 4041 |
|
4042 |
self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4043 |
getProperty:(self atomIDOf:'DndSelection') |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4044 |
from:rootId |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4045 |
into:[:type :value | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4046 |
t := type. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4047 |
dropValue := value |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4048 |
]. |
1543 | 4049 |
|
1558 | 4050 |
"/ preconvert into a collection |
4051 |
"/ of fileNames, string or byteArray |
|
4052 |
"/ Notice: we do not yet convert into dropObjects |
|
4053 |
"/ here, to allow arbitrary data to be handled by |
|
4054 |
"/ redefined dropMessage methods in applications. |
|
4055 |
"/ Conversion is done for some well known types |
|
4056 |
"/ in the default dropMessage handling of SimpleView. |
|
4057 |
||
1543 | 4058 |
dropType == #DndFiles ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4059 |
"/ actually, a list of fileNames |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4060 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4061 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4062 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4063 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4064 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4065 |
names := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4066 |
i1 := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4067 |
[i1 ~~ 0] whileTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4068 |
i2 := dropValue indexOf:(Character value:0) startingAt:i1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4069 |
i2 ~~ 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4070 |
names add:(dropValue copyFrom:i1 to:(i2-1)). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4071 |
i1 := i2 + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4072 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4073 |
i1 := i2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4074 |
]. |
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 |
dropValue := names. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4077 |
dropValue := dropValue collect:[:nm | nm asFilename]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4078 |
dropType := #files. |
1558 | 4079 |
] ifFalse:[ (dropType == #DndFile) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4080 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4081 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4082 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4083 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4084 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4085 |
dropValue := dropValue asFilename. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4086 |
dropType := #file. |
1558 | 4087 |
] ifFalse:[ (dropType == #DndDir) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4088 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4089 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4090 |
^ self |
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 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4093 |
dropValue := dropValue asFilename. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4094 |
dropType := #directory. |
1558 | 4095 |
] ifFalse:[ (dropType == #DndText) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4096 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4097 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4098 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4099 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4100 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4101 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4102 |
dropType := #text. |
1558 | 4103 |
] ifFalse:[ (dropType == #DndExe) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4104 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4105 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4106 |
^ self |
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 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4109 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4110 |
dropType := #executable. |
1558 | 4111 |
] ifFalse:[ (dropType == #DndLink) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4112 |
t ~~ stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4113 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4114 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4115 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4116 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4117 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4118 |
dropType := #link. |
1558 | 4119 |
] ifFalse:[ (dropType == #DndRawData) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4120 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4121 |
dropType := #rawData. |
1552 | 4122 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4123 |
'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4124 |
'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4125 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4126 |
dropValue := dropValue. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4127 |
dropType := #unknown. |
1558 | 4128 |
]]]]]]]. |
1543 | 4129 |
|
4130 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4131 |
sensor dropMessage:dropType data:dropValue view:targetView |
1543 | 4132 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4133 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4134 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4135 |
" |
1543 | 4136 |
] |
4137 |
||
4138 |
"Created: 4.4.1997 / 17:59:37 / cg" |
|
1558 | 4139 |
"Modified: 6.4.1997 / 14:50:44 / cg" |
1543 | 4140 |
! |
4141 |
||
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4142 |
gravityNotifyView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4143 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4144 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4145 |
"/ aView gravityNotify |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4146 |
! |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4147 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4148 |
mapRequestView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4149 |
"ignored for now" |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4150 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4151 |
"/ aView mapRequest |
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 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4154 |
propertyChangeView:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4155 |
"sent when an X property changes. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4156 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4157 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4158 |
aView propertyChange |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4159 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4160 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4161 |
reparentedView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4162 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4163 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4164 |
"/ aView reparented |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4165 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4166 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4167 |
resizeRequestView:aView |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4168 |
"ignored for now" |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4169 |
|
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4170 |
"/ aView resizeRequest |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4171 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4172 |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4173 |
selectionClear:selectionID view:aView |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4174 |
"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
|
4175 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4176 |
|
1344 | 4177 |
"/ |
4178 |
"/ workaround a bug in olvwm: it clears selections |
|
4179 |
"/ on window raise. |
|
4180 |
"/ In this case, keep my last own selection. |
|
4181 |
"/ |
|
4182 |
||
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4183 |
self setLastCopyBuffer:(self getCopyBuffer). |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4184 |
self setCopyBuffer:nil |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4185 |
|
1795 | 4186 |
"/ noone is interested in that ... |
1344 | 4187 |
"/ aView selectionClear:selectionID |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4188 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4189 |
|
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4190 |
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
|
4191 |
"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
|
4192 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4193 |
|
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4194 |
|s sensor| |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4195 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4196 |
propertyID == 0 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4197 |
"invalid olvwm behavior" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4198 |
s := self getLastCopyBuffer |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4199 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4200 |
targetID == self atomIDOfSTRING ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4201 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4202 |
a returned string |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4203 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4204 |
s := self getTextProperty:propertyID from:requestorID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4205 |
s notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4206 |
(s endsWith:Character cr) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4207 |
s := s asStringCollection copyWith:'' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4208 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4209 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4210 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4211 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4212 |
a returned object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4213 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4214 |
s := self getObjectProperty:propertyID from:requestorID. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4215 |
]. |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4216 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4217 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4218 |
s notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4219 |
(sensor := aView sensor) notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4220 |
sensor pasteFromClipBoard:s view:aView |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4221 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4222 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4223 |
if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4224 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4225 |
aView pasteFromClipBoard:s |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4226 |
] |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4227 |
] |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4228 |
! |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4229 |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4230 |
selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4231 |
"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
|
4232 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4233 |
|
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4234 |
|o s stream| |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4235 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4236 |
targetID == (self atomIDOfLENGTH) ifTrue:[ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4237 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4238 |
"/ the other one wants to know the size of our selection ... |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4239 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4240 |
s := self selectionAsString. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4241 |
self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4242 |
setLengthProperty:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4243 |
value:s size |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4244 |
for:windowID. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4245 |
self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4246 |
sendSelectionNotifySelection:selectionID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4247 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4248 |
target:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4249 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4250 |
from:aView id |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4251 |
to:windowID. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4252 |
^ self |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4253 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4254 |
|
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4255 |
(targetID == self atomIDOfSTRING or:[ |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4256 |
targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4257 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4258 |
"/ the other view wants the selection as string |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4259 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4260 |
s := self selectionAsString. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4261 |
self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4262 |
sendSelection:s |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4263 |
selection:primaryAtom |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4264 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4265 |
target:self atomIDOfSTRING "/ targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4266 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4267 |
from:windowID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4268 |
to:windowID. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4269 |
^ self |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4270 |
]. |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4271 |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4272 |
"/ (targetID == (self atomIDOf:'TARGETS')) ifTrue:[ |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4273 |
"/"/ TODO: implement this to avoid netscape paste-delay. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4274 |
"/"/ |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4275 |
"/ ^ self |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4276 |
"/ ]. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4277 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4278 |
(targetID == (self atomIDOf:'ST_OBJECT')) ifTrue:[ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4279 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4280 |
"/ send the selection in binaryStore format |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4281 |
"/ (assuming, that the other view knows how to handle it) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4282 |
"/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4283 |
o := self getCopyBuffer. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4284 |
stream := WriteStream on:(ByteArray new:200). |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4285 |
o storeBinaryOn:stream. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4286 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4287 |
^ self |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4288 |
sendSelection:(stream contents) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4289 |
selection:primaryAtom |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4290 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4291 |
target:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4292 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4293 |
from:windowID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4294 |
to:windowID |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4295 |
]. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4296 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4297 |
"Created: / 17.6.1998 / 19:33:10 / cg" |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4298 |
"Modified: / 17.6.1998 / 20:24:40 / cg" |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4299 |
! ! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4300 |
|
86 | 4301 |
!XWorkstation methodsFor:'event handling'! |
0 | 4302 |
|
4303 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
|
4304 |
"central event handling method: |
|
54 | 4305 |
get next event and send appropriate message to the sensor or view. |
0 | 4306 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
12 | 4307 |
otherwise only events for the view with given id are processed. |
4308 |
If the argument aMask is nonNil, only events for this eventMask are |
|
1871 | 4309 |
handled. |
4310 |
WARNING: this may block to wait for an event - you better check for a |
|
1906 | 4311 |
pending event before calling this." |
12 | 4312 |
|
54 | 4313 |
(self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[ |
1906 | 4314 |
AbortSignal handle:[:ex | |
4315 |
ex return |
|
4316 |
] do:[ |
|
4317 |
self dispatchLastEvent. |
|
4318 |
] |
|
54 | 4319 |
]. |
1489
f264f7852a8d
avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents:
1486
diff
changeset
|
4320 |
|
1871 | 4321 |
"Modified: 19.8.1997 / 17:10:42 / cg" |
12 | 4322 |
! |
4323 |
||
295 | 4324 |
dispatchExposeEventFor:aViewIdOrNil |
4325 |
"get next expose event and send appropriate message to the sensor or view. |
|
4326 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
|
1871 | 4327 |
otherwise only events for the view with given id are processed. |
4328 |
WARNING: this may block to wait for an event - you better check for a |
|
1906 | 4329 |
pending event before calling this." |
295 | 4330 |
|
4331 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
|
1871 | 4332 |
|
4333 |
"Modified: 19.8.1997 / 17:10:26 / cg" |
|
12 | 4334 |
! |
4335 |
||
4336 |
dispatchLastEvent |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4337 |
|theView symS arg butt sibling |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4338 |
windowID siblingID propertyID selectionID targetID requestorID |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4339 |
evTime |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4340 |
eventType| |
12 | 4341 |
|
4342 |
%{ /* STACK: 8000 */ |
|
4343 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
|
0 | 4344 |
|
1209 | 4345 |
Display *dpy; |
135 | 4346 |
OBJ eB; |
4347 |
XEvent *ev; |
|
1521
23aacd62bbac
care for GC before reaccessing the eventBuffer
Claus Gittinger <cg@exept.de>
parents:
1511
diff
changeset
|
4348 |
int ev_x, ev_y; |
135 | 4349 |
|
4350 |
# define ae ((XAnyEvent *)ev) |
|
4351 |
# define ee ((XExposeEvent *)ev) |
|
4352 |
# define ke ((XKeyPressedEvent *)ev) |
|
4353 |
# define be ((XButtonPressedEvent *)ev) |
|
4354 |
# define ce ((XConfigureEvent *)ev) |
|
4355 |
# define me ((XMotionEvent *)ev) |
|
4356 |
# define ewe ((XEnterWindowEvent *)ev) |
|
4357 |
# define lwe ((XLeaveWindowEvent *)ev) |
|
4358 |
# define de ((XDestroyWindowEvent *)ev) |
|
4359 |
# define ve ((XVisibilityEvent *)ev) |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4360 |
# define mape ((XMappingEvent *)ev) |
135 | 4361 |
|
0 | 4362 |
KeySym keySym; |
4363 |
unsigned char buffer[10]; |
|
4364 |
int i, nchars; |
|
4365 |
char *keySymString; |
|
4366 |
char keySymStringBuffer[32]; |
|
1832 | 4367 |
unsigned INT nextMultiClickTime; |
1223
09d8118c8031
keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
4368 |
OBJ upDown, t; |
115 | 4369 |
|
4370 |
struct inlineCache *ipS; |
|
0 | 4371 |
static struct inlineCache vid = _ILC1; |
12 | 4372 |
|
4373 |
static struct inlineCache expS = _ILC5; |
|
1295
ef93ded3c030
renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents:
1246
diff
changeset
|
4374 |
static struct inlineCache gexpS = _ILC6; |
12 | 4375 |
static struct inlineCache nexpS = _ILC1; |
4376 |
static struct inlineCache motS = _ILC4; |
|
4377 |
static struct inlineCache bpS = _ILC4; |
|
4378 |
static struct inlineCache bmpS = _ILC4; |
|
4379 |
static struct inlineCache bspS = _ILC4; |
|
4380 |
static struct inlineCache brS = _ILC4; |
|
4381 |
static struct inlineCache focInS = _ILC1; |
|
4382 |
static struct inlineCache focOutS = _ILC1; |
|
4383 |
static struct inlineCache peS = _ILC4; |
|
4384 |
static struct inlineCache plS = _ILC2; |
|
54 | 4385 |
static struct inlineCache termS = _ILC1; |
4386 |
static struct inlineCache savtermS = _ILC1; |
|
4387 |
static struct inlineCache destrS = _ILC1; |
|
4388 |
static struct inlineCache unmapS = _ILC1; |
|
4389 |
static struct inlineCache mapS = _ILC1; |
|
4390 |
static struct inlineCache confS = _ILC5; |
|
70 | 4391 |
static struct inlineCache coveredS = _ILC2; |
1543 | 4392 |
static struct inlineCache clientMsg = _ILC5; |
12 | 4393 |
|
4394 |
static struct inlineCache keymap = _ILC0; |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4395 |
static struct inlineCache created = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4396 |
static struct inlineCache mapReq = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4397 |
static struct inlineCache repar = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4398 |
static struct inlineCache confReq = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4399 |
static struct inlineCache resReq = _ILC1; |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
4400 |
static struct inlineCache circReq = _ILC1; |
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
4401 |
static struct inlineCache circNotify = _ILC1; |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4402 |
static struct inlineCache gravNotify = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4403 |
static struct inlineCache prop = _ILC1; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4404 |
static struct inlineCache selClear = _ILC2; |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4405 |
static struct inlineCache selReq = _ILC6; |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4406 |
static struct inlineCache selNotify = _ILC5; |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4407 |
static struct inlineCache colormap = _ILC1; |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4408 |
static struct inlineCache mapping = _ILC2; |
70 | 4409 |
static struct inlineCache vis = _ILC1; |
12 | 4410 |
|
4411 |
static struct inlineCache skpS = _ILC4; |
|
63 | 4412 |
static struct inlineCache skrS = _ILC4; |
12 | 4413 |
|
1209 | 4414 |
if (! ISCONNECTED) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4415 |
RETURN (false); |
1209 | 4416 |
} |
4417 |
||
4418 |
dpy = myDpy; |
|
4419 |
||
1210 | 4420 |
eB = __INST(eventBuffer); |
4421 |
||
135 | 4422 |
if (__isByteArray(eB)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4423 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
135 | 4424 |
} else { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4425 |
printf("DISPLAY: no eventBuffer\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4426 |
RETURN (false); |
135 | 4427 |
} |
4428 |
||
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4429 |
/* |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4430 |
* 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
|
4431 |
* avoid creation & lookup then. |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4432 |
*/ |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4433 |
if ((t = __INST(lastId)) != nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4434 |
if (__isExternalAddress(t)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4435 |
if (_WindowVal(t) == ae->window) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4436 |
theView = __INST(lastView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4437 |
if (__isNonNilObject(theView)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4438 |
if (__qClass(theView) == nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4439 |
theView = nil; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4440 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4441 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4442 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4443 |
} |
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4444 |
} |
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4445 |
|
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4446 |
if (theView == nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4447 |
windowID = __MKEXTERNALADDRESS(ae->window); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4448 |
theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4449 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4450 |
* MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4451 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4452 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4453 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1486
638558d89c66
inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents:
1480
diff
changeset
|
4454 |
} |
12 | 4455 |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4456 |
if ((theView == nil) && (ev->type != MappingNotify)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4457 |
RETURN (nil); |
12 | 4458 |
} |
4459 |
||
4460 |
/* |
|
4461 |
* key, button and pointer events are sent to the sensor, |
|
4462 |
* or (if there is none) to the delegate. |
|
4463 |
* or (if there is none) to the view. |
|
26 | 4464 |
* |
4465 |
* expose events are sent to the sensor, |
|
4466 |
* or (if there is none) to the view |
|
4467 |
* |
|
12 | 4468 |
* sensor and delegate get view as additional argument |
115 | 4469 |
* all of this has been taken out of here to corresponding methods |
4470 |
* in DeviceWorkstation. |
|
12 | 4471 |
*/ |
90 | 4472 |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4473 |
#ifdef DEBUG |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4474 |
eventType = __MKSMALLINT(ev->type); |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4475 |
#endif |
135 | 4476 |
switch (ev->type) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4477 |
case KeyRelease: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4478 |
symS = @symbol(keyRelease:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4479 |
ipS = &skrS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4480 |
upDown = false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4481 |
goto keyPressAndRelease; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4482 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4483 |
case KeyPress: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4484 |
symS = @symbol(keyPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4485 |
ipS = &skpS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4486 |
upDown = true; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4487 |
/* FALL INTO */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4488 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4489 |
keyPressAndRelease: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4490 |
__INST(eventRootX) = __MKSMALLINT(ke->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4491 |
__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
|
4492 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4493 |
__INST(altDown) = (ke->state & Mod2Mask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4494 |
__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
|
4495 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4496 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4497 |
__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
|
4498 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4499 |
__INST(shiftDown) = (ke->state & ShiftMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4500 |
__INST(ctrlDown) = (ke->state & ControlMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4501 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4502 |
ev_x = ke->x; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4503 |
ev_y = ke->y; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4504 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4505 |
arg = nil; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4506 |
nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4507 |
if (nchars |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4508 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4509 |
|| (buffer[0] >= 0x80))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4510 |
arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4511 |
keySymString = NULL; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4512 |
} else { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4513 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4514 |
switch (keySym) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4515 |
case XK_Control_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4516 |
case XK_Control_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4517 |
__INST(ctrlDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4518 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4519 |
case XK_Shift_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4520 |
case XK_Shift_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4521 |
__INST(shiftDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4522 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4523 |
case XK_Meta_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4524 |
case XK_Meta_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4525 |
__INST(metaDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4526 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4527 |
case XK_Alt_L: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4528 |
case XK_Alt_R: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4529 |
__INST(altDown) = upDown; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4530 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4531 |
} |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4532 |
#endif |
150 | 4533 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4534 |
keySymString = XKeysymToString(keySym); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4535 |
if (keySymString) { |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4536 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4537 |
if (keySymString[0] == 'D') { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4538 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4539 |
* remove underscore, dont want it in symbols |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4540 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4541 |
if (strcmp(keySymString, "Delete_line") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4542 |
keySymString = "DeleteLine"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4543 |
} else if (strcmp(keySymString, "Delete_word") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4544 |
keySymString = "DeleteWord"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4545 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4546 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4547 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4548 |
* make names compatible |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4549 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4550 |
if (strcmp(keySymString, "Down") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4551 |
keySymString = "CursorDown"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4552 |
} else if (strcmp(keySymString, "Up") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4553 |
keySymString = "CursorUp"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4554 |
} else if (strcmp(keySymString, "Left") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4555 |
keySymString = "CursorLeft"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4556 |
} else if (strcmp(keySymString, "Right") == 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4557 |
keySymString = "CursorRight"; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4558 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4559 |
arg = __MKSYMBOL(keySymString, (OBJ *)0); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4560 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4561 |
arg = __MKSTRING(keySymString); |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
4562 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4563 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4564 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4565 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4566 |
if (arg == nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4567 |
/* happens sometimes (alt-graph on sun has no keysym) */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4568 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4569 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4570 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4571 |
(*(*ipS).ilc_func)(self, symS, nil, ipS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4572 |
arg, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4573 |
__MKSMALLINT(ev_x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4574 |
__MKSMALLINT(ev_y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4575 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4576 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4577 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4578 |
case ButtonPress: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4579 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4580 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4581 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4582 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4583 |
if (__isSmallInteger(__INST(multiClickTimeDelta))) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4584 |
nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4585 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4586 |
nextMultiClickTime = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4587 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4588 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4589 |
if ((t = __INST(multiClickTime)) != nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4590 |
INT _multiClickTime; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4591 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4592 |
_multiClickTime = __longIntVal(t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4593 |
if (be->time < _multiClickTime) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4594 |
__INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4595 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4596 |
* MKUINT could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4597 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4598 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4599 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4600 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4601 |
ipS = &bmpS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4602 |
symS = @symbol(buttonMultiPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4603 |
goto sendButtonEvent; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4604 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4605 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4606 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4607 |
__INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4608 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4609 |
* MKUINT could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4610 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4611 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4612 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1223
09d8118c8031
keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents:
1214
diff
changeset
|
4613 |
|
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
4614 |
#ifdef NO_LONGER |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4615 |
if (be->state & ShiftMask) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4616 |
ipS = &bspS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4617 |
symS = @symbol(buttonShiftPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4618 |
goto sendButtonEvent; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4619 |
} |
1010
b8576573e6aa
no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
4620 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4621 |
ipS = &bpS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4622 |
symS = @symbol(buttonPress:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4623 |
goto sendButtonEvent; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4624 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4625 |
/* NOT REACHED */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4626 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4627 |
case ButtonRelease: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4628 |
__INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4629 |
__INST(eventRootX) = __MKSMALLINT(be->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4630 |
__INST(eventRootY) = __MKSMALLINT(be->y_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4631 |
ipS = &brS; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4632 |
symS = @symbol(buttonRelease:x:y:view:); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4633 |
/* fall into */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4634 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4635 |
sendButtonEvent: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4636 |
butt = __MKSMALLINT(be->button); |
12 | 4637 |
#ifdef NOTDEF |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4638 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4639 |
* this allows operation with single button mouses: meta-click is always Button 2 |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4640 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4641 |
if (__INST(metaDown) == true) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4642 |
butt = __MKSMALLINT(2); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4643 |
else |
0 | 4644 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4645 |
butt = __AT_(__INST(buttonTranslation), butt); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4646 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4647 |
* #at: could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4648 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4649 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4650 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4651 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4652 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4653 |
(*(*ipS).ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4654 |
symS, nil, ipS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4655 |
butt, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4656 |
__MKSMALLINT(ke->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4657 |
__MKSMALLINT(ke->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4658 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4659 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4660 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4661 |
case MotionNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4662 |
if (__INST(motionEventCompression) != false) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4663 |
while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4664 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4665 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4666 |
__INST(eventRootX) = __MKSMALLINT(me->x_root); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4667 |
__INST(eventRootY) = __MKSMALLINT(me->y_root); |
70 | 4668 |
|
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4669 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4670 |
__INST(altDown) = (me->state & Mod2Mask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4671 |
__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
|
4672 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4673 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4674 |
__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
|
4675 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4676 |
__INST(shiftDown) = (me->state & ShiftMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4677 |
__INST(ctrlDown) = (me->state & ControlMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4678 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4679 |
(*motS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4680 |
@symbol(buttonMotion:x:y:view:), nil, &motS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4681 |
__MKSMALLINT(me->state), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4682 |
__MKSMALLINT(me->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4683 |
__MKSMALLINT(me->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4684 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4685 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4686 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4687 |
case FocusIn: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4688 |
(*focInS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4689 |
@symbol(focusInView:), nil, &focInS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4690 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4691 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4692 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4693 |
case FocusOut: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4694 |
(*focOutS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4695 |
@symbol(focusOutView:), nil, &focOutS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4696 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4697 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4698 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4699 |
case EnterNotify: |
240
bdbab643c0e7
allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
4700 |
#ifdef OLD |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4701 |
__INST(altDown) = (ewe->state & Mod2Mask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4702 |
__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
|
4703 |
#else |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4704 |
__INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4705 |
__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
|
4706 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4707 |
__INST(shiftDown) = (ewe->state & ShiftMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4708 |
__INST(ctrlDown) = (ewe->state & ControlMask) ? true : false; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4709 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4710 |
(*peS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4711 |
@symbol(pointerEnter:x:y:view:), nil, &peS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4712 |
__MKSMALLINT(ewe->state), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4713 |
__MKSMALLINT(ewe->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4714 |
__MKSMALLINT(ewe->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4715 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4716 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4717 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4718 |
case LeaveNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4719 |
(*plS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4720 |
@symbol(pointerLeave:view:), nil, &plS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4721 |
__MKSMALLINT(lwe->state), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4722 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4723 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4724 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4725 |
case GraphicsExpose: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4726 |
(*gexpS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4727 |
@symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4728 |
__MKSMALLINT(ee->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4729 |
__MKSMALLINT(ee->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4730 |
__MKSMALLINT(ee->width), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4731 |
__MKSMALLINT(ee->height), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4732 |
ee->count == 0 ? true : false, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4733 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4734 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4735 |
if (ee->count != 0) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4736 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4737 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4738 |
/* fall into */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4739 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4740 |
case NoExpose: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4741 |
(*nexpS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4742 |
@symbol(noExposeView:), nil, &nexpS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4743 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4744 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4745 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4746 |
case Expose: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4747 |
(*expS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4748 |
@symbol(exposeX:y:width:height:view:), nil, &expS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4749 |
__MKSMALLINT(ee->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4750 |
__MKSMALLINT(ee->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4751 |
__MKSMALLINT(ee->width), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4752 |
__MKSMALLINT(ee->height), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4753 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4754 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4755 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4756 |
case ConfigureNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4757 |
if (ce->above != None) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4758 |
siblingID = __MKEXTERNALADDRESS(ce->above); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4759 |
sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4760 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4761 |
* MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4762 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4763 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4764 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4765 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4766 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4767 |
(*confS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4768 |
@symbol(configureX:y:width:height:view:), nil, &confS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4769 |
__MKSMALLINT(ce->x), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4770 |
__MKSMALLINT(ce->y), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4771 |
__MKSMALLINT(ce->width), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4772 |
__MKSMALLINT(ce->height), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4773 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4774 |
if (sibling != nil) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4775 |
(*coveredS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4776 |
@symbol(coveredBy:view:), nil, &coveredS, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4777 |
theView, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4778 |
sibling); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4779 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4780 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4781 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4782 |
case ClientMessage: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4783 |
if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4784 |
if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom))) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4785 |
|| (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4786 |
(*termS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4787 |
@symbol(terminateView:), nil, &termS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4788 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4789 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4790 |
if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4791 |
(*savtermS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4792 |
@symbol(saveAndTerminateView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4793 |
, nil, &savtermS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4794 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4795 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4796 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4797 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4798 |
* any other client message |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4799 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4800 |
i = (char *)(&(ev->xclient.data)) - (char *)ev; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4801 |
(*clientMsg.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4802 |
@symbol(clientMessage:type:format:dataOffset:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4803 |
, nil, &clientMsg |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4804 |
, __INST(eventBuffer) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4805 |
,__MKSMALLINT(ev->xclient.message_type) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4806 |
,__MKSMALLINT(ev->xclient.format) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4807 |
,__MKSMALLINT(i), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4808 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4809 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4810 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4811 |
case DestroyNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4812 |
(*destrS.ilc_func)(self, @symbol(destroyedView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4813 |
, nil, &destrS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4814 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4815 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4816 |
case UnmapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4817 |
(*unmapS.ilc_func)(self, @symbol(unmappedView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4818 |
, nil, &unmapS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4819 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4820 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4821 |
case MapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4822 |
(*mapS.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4823 |
@symbol(mappedView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4824 |
, nil, &mapS, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4825 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4826 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4827 |
case KeymapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4828 |
(*keymap.ilc_func)(theView, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4829 |
@symbol(keyMapChange) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4830 |
, nil, &keymap); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4831 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4832 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4833 |
case VisibilityNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4834 |
switch (ve->state) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4835 |
case VisibilityUnobscured: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4836 |
arg = @symbol(unobscured); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4837 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4838 |
case VisibilityPartiallyObscured: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4839 |
arg = @symbol(partiallyObscured); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4840 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4841 |
case VisibilityFullyObscured: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4842 |
arg = @symbol(fullyObscured); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4843 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4844 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4845 |
(*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4846 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4847 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4848 |
case CreateNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4849 |
(*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4850 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4851 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4852 |
case MapRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4853 |
(*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4854 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4855 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4856 |
case ReparentNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4857 |
(*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4858 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4859 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4860 |
case ConfigureRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4861 |
(*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4862 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4863 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4864 |
case GravityNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4865 |
(*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4866 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4867 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4868 |
case ResizeRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4869 |
(*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4870 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4871 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4872 |
case CirculateNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4873 |
(*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4874 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4875 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4876 |
case CirculateRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4877 |
(*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4878 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4879 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4880 |
case PropertyNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4881 |
(*prop.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4882 |
@symbol(propertyChangeView) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4883 |
, nil, &prop, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4884 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4885 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4886 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4887 |
case SelectionClear: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4888 |
selectionID = __MKATOMOBJ(ev->xselectionclear.selection); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4889 |
(*selClear.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4890 |
@symbol(selectionClear:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4891 |
, nil, &selClear, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4892 |
selectionID, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4893 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4894 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4895 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4896 |
case SelectionNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4897 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4898 |
* returned selection value (answer from SelectionRequest) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4899 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4900 |
DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4901 |
ev->xselection.property, ev->xselection.target, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4902 |
ev->xselection.selection, ev->xselection.requestor)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4903 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4904 |
{ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4905 |
INT _property = ev->xselection.property; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4906 |
INT _target = ev->xselection.target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4907 |
INT _selection = ev->xselection.selection; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4908 |
INT _requestor = ev->xselection.requestor; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4909 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4910 |
propertyID = __MKATOMOBJ(_property); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4911 |
targetID = __MKATOMOBJ(_target); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4912 |
selectionID = __MKATOMOBJ(_selection); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4913 |
requestorID = __MKEXTERNALADDRESS(_requestor); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4914 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4915 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4916 |
* MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4917 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4918 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4919 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4920 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4921 |
(*selNotify.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4922 |
@symbol(selectionNotify:target:selection:from:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4923 |
, nil, &selNotify, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4924 |
propertyID, targetID, selectionID, requestorID, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4925 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4926 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4927 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4928 |
case SelectionRequest: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4929 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4930 |
* someone wants the selection |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4931 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4932 |
DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4933 |
ev->xselectionrequest.property, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4934 |
ev->xselectionrequest.target, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4935 |
ev->xselectionrequest.selection, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4936 |
ev->xselectionrequest.requestor)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4937 |
{ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4938 |
INT _property = ev->xselectionrequest.property; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4939 |
INT _target = ev->xselectionrequest.target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4940 |
INT _selection = ev->xselectionrequest.selection; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4941 |
INT _requestor = ev->xselectionrequest.requestor; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4942 |
INT _t = ev->xselectionrequest.time; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4943 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4944 |
propertyID = __MKATOMOBJ(_property); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4945 |
targetID = __MKATOMOBJ(_target); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4946 |
selectionID = __MKATOMOBJ(_selection); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4947 |
requestorID = __MKEXTERNALADDRESS(_requestor); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4948 |
evTime = __MKEXTERNALADDRESS(_t); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4949 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4950 |
/* |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4951 |
* MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4952 |
*/ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4953 |
eB = __INST(eventBuffer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4954 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4955 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4956 |
(*selReq.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4957 |
@symbol(selectionRequest:target:selection:time:from:view:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4958 |
, nil, &selReq, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4959 |
propertyID, targetID, selectionID, evTime, requestorID, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4960 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4961 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4962 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4963 |
case ColormapNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4964 |
(*colormap.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4965 |
@symbol(colorMapChangeView:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4966 |
, nil, &colormap, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4967 |
theView); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4968 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4969 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4970 |
case MappingNotify: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4971 |
switch(mape->request) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4972 |
case MappingModifier: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4973 |
arg = @symbol(mappingModifier); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4974 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4975 |
case MappingKeyboard: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4976 |
arg = @symbol(mappingKeyboard); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4977 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4978 |
case MappingPointer: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4979 |
arg = @symbol(mappingPointer); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4980 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4981 |
default: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4982 |
arg = nil; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4983 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4984 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4985 |
(*mapping.ilc_func)(self, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4986 |
@symbol(mappingChanged:event:) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4987 |
, nil, &mapping, arg, eB); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4988 |
break; |
0 | 4989 |
} |
135 | 4990 |
#undef ae |
0 | 4991 |
#undef ee |
4992 |
#undef ke |
|
4993 |
#undef be |
|
4994 |
#undef ce |
|
4995 |
#undef me |
|
4996 |
#undef ewe |
|
4997 |
#undef lwe |
|
4998 |
#undef de |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
4999 |
#undef mape |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
5000 |
%}. |
0 | 5001 |
^ true |
5002 |
! |
|
5003 |
||
1344 | 5004 |
dispatchPendingEvents |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5005 |
"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
|
5006 |
(i.e. this is now only used in the modal debugger) |
1871 | 5007 |
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
|
5008 |
This code is somewhat special, since X has a concept of graphic |
295 | 5009 |
expose events (which are sent after a bitblt). After such a bitblt, |
5010 |
we only handle exposes until the graphicsExpose arrives. |
|
5011 |
Other systems may not need such a kludge" |
|
5012 |
||
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
5013 |
"interested in exposes only ?" |
295 | 5014 |
dispatchingExpose notNil ifTrue:[ |
1906 | 5015 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
5016 |
self dispatchExposeEventFor:dispatchingExpose |
|
5017 |
]. |
|
5018 |
^ self |
|
295 | 5019 |
]. |
5020 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5021 |
[self eventPendingWithSync:false] whileTrue:[ |
1906 | 5022 |
(self getEventFor:nil withMask:nil) ifTrue:[ |
5023 |
AbortSignal handle:[:ex | |
|
5024 |
ex return |
|
5025 |
] do:[ |
|
5026 |
self dispatchLastEvent |
|
5027 |
] |
|
5028 |
]. |
|
295 | 5029 |
] |
1489
f264f7852a8d
avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents:
1486
diff
changeset
|
5030 |
|
1871 | 5031 |
"Modified: 19.8.1997 / 17:11:18 / cg" |
295 | 5032 |
! |
5033 |
||
1344 | 5034 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
81 | 5035 |
"dispose (throw away) specific events. If aWindowId is nil, |
5036 |
events matching the mask are thrown away regardless of which |
|
5037 |
view they are for. Otherwise, only matching events for that |
|
5038 |
view are flushed." |
|
0 | 5039 |
|
5040 |
%{ /* NOCONTEXT */ |
|
5041 |
||
5042 |
XEvent ev; |
|
5043 |
Window win; |
|
5044 |
||
1209 | 5045 |
if (ISCONNECTED |
5046 |
&& __isSmallInteger(aMask)) { |
|
1344 | 5047 |
Display *dpy = myDpy; |
5048 |
||
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5049 |
ENTER_XLIB(); |
1344 | 5050 |
if (__isExternalAddress(aWindowIdOrNil)) { |
5051 |
win = _WindowVal(aWindowIdOrNil); |
|
5052 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
|
5053 |
} else { |
|
5054 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
|
5055 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5056 |
LEAVE_XLIB(); |
1344 | 5057 |
RETURN ( self ); |
0 | 5058 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
5059 |
%}. |
0 | 5060 |
self primitiveFailed |
5061 |
! |
|
5062 |
||
1344 | 5063 |
eventMaskFor:anEventSymbol |
295 | 5064 |
"return the eventMask bit-constant corresponding to an event symbol" |
5065 |
||
5066 |
%{ /* NOCONTEXT */ |
|
5067 |
||
5068 |
int m = 0; |
|
5069 |
||
5070 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
|
5071 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
|
5072 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
|
5073 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
|
5074 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
|
5075 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
|
5076 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
|
5077 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
|
5078 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
|
5079 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
|
5080 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
|
5081 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
|
5082 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
|
5083 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
|
5084 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
|
5085 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
5086 |
RETURN (__MKSMALLINT(m)); |
295 | 5087 |
%} |
5088 |
! |
|
5089 |
||
1344 | 5090 |
eventPending |
310 | 5091 |
"return true, if any event is pending. |
5092 |
This looks for both the internal queue and the display connection." |
|
12 | 5093 |
|
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5094 |
"/ ConservativeSync is required for some Xlib implementation, |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5095 |
"/ where eventPending returns wrong if we do not flush the buffer. |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5096 |
"/ (especially Win32 & Xlib) |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5097 |
|
2594
0b1a2d11b658
oops - win32 ConservativeSync
Claus Gittinger <cg@exept.de>
parents:
2592
diff
changeset
|
5098 |
ConservativeSync == true ifTrue:[self sync]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5099 |
|
12 | 5100 |
dispatchingExpose notNil ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
5101 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
12 | 5102 |
]. |
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5103 |
^ self eventPendingWithSync:false |
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
5104 |
|
2594
0b1a2d11b658
oops - win32 ConservativeSync
Claus Gittinger <cg@exept.de>
parents:
2592
diff
changeset
|
5105 |
"Modified: / 28.4.1999 / 11:08:12 / cg" |
0 | 5106 |
! |
5107 |
||
1344 | 5108 |
eventPending:anEventSymbol for:aWindowIdOrNil |
295 | 5109 |
"return true, if a specific event is pending" |
5110 |
||
404
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5111 |
^ 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
|
5112 |
! |
0db38d8283a4
removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents:
402
diff
changeset
|
5113 |
|
1344 | 5114 |
eventPendingWithSync:doSync |
7 | 5115 |
"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
|
5116 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
310 | 5117 |
before checking." |
0 | 5118 |
|
12 | 5119 |
%{ /* UNLIMITEDSTACK */ |
1974 | 5120 |
OBJ rslt = false; |
0 | 5121 |
|
150 | 5122 |
if (ISCONNECTED) { |
1344 | 5123 |
Display *dpy = myDpy; |
5124 |
||
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5125 |
if (XEventsQueued(dpy, QueuedAlready)) { |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5126 |
RETURN (true); |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5127 |
} |
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5128 |
|
1974 | 5129 |
ENTER_XLIB(); |
1344 | 5130 |
if (doSync == true) { |
5131 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5132 |
} |
|
5133 |
if (XPending(dpy)) { |
|
1974 | 5134 |
rslt = true; |
5135 |
} |
|
5136 |
LEAVE_XLIB(); |
|
5137 |
} |
|
5138 |
RETURN ( rslt ); |
|
0 | 5139 |
%} |
5140 |
! |
|
5141 |
||
1344 | 5142 |
eventQueued |
341 | 5143 |
"return true, if any event is queued" |
5144 |
||
5145 |
dispatchingExpose notNil ifTrue:[ |
|
1344 | 5146 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
341 | 5147 |
]. |
5148 |
^ self eventQueuedAlready |
|
5149 |
||
5150 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
|
5151 |
! |
|
5152 |
||
1344 | 5153 |
eventQueuedAlready |
341 | 5154 |
"return true, if any event is queued internally. |
5155 |
(i.e. in X's internal event queue, which is both filled by explicit |
|
5156 |
nextEvent calls AND whenever drawing is done and events are pending on |
|
5157 |
the display connection)." |
|
5158 |
||
5159 |
%{ /* UNLIMITEDSTACK */ |
|
1974 | 5160 |
OBJ rslt = false; |
341 | 5161 |
|
5162 |
if (ISCONNECTED) { |
|
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5163 |
/* 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
|
5164 |
/* ENTER_XLIB(); */ |
1344 | 5165 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
1974 | 5166 |
rslt = true; |
5167 |
} |
|
2132
7be8ef8e6f2d
XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents:
2105
diff
changeset
|
5168 |
/* LEAVE_XLIB(); */ |
341 | 5169 |
} |
5170 |
RETURN ( false ); |
|
5171 |
%} |
|
5172 |
! |
|
5173 |
||
1344 | 5174 |
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync |
295 | 5175 |
"return true, if any of the masked events is pending" |
5176 |
||
5177 |
%{ /* UNLIMITEDSTACK */ |
|
5178 |
||
5179 |
XEvent ev; |
|
5180 |
Window win; |
|
5181 |
int thereIsOne; |
|
1974 | 5182 |
OBJ rslt = false; |
295 | 5183 |
|
5184 |
if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
|
1344 | 5185 |
Display *dpy = myDpy; |
5186 |
||
1974 | 5187 |
ENTER_XLIB(); |
1344 | 5188 |
if (doSync == true) { |
5189 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5190 |
} |
|
5191 |
if (__isExternalAddress(aWindowIdOrNil)) { |
|
5192 |
win = _WindowVal(aWindowIdOrNil); |
|
5193 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
|
5194 |
} else { |
|
5195 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
|
5196 |
} |
|
5197 |
if (thereIsOne) { |
|
5198 |
XPutBackEvent(dpy, &ev); |
|
1974 | 5199 |
rslt = true; |
5200 |
} |
|
5201 |
LEAVE_XLIB(); |
|
5202 |
} |
|
5203 |
RETURN ( rslt ); |
|
295 | 5204 |
%} |
5205 |
! |
|
5206 |
||
1344 | 5207 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
310 | 5208 |
"return true, if any expose event is pending for a specific view, |
5209 |
or any view (if the arg is nil). |
|
5210 |
This is an X specific, only required after a scroll operation." |
|
7 | 5211 |
|
12 | 5212 |
%{ /* UNLIMITEDSTACK */ |
7 | 5213 |
|
5214 |
XEvent ev; |
|
5215 |
Window win; |
|
81 | 5216 |
int thereIsOne; |
1974 | 5217 |
OBJ rslt = false; |
81 | 5218 |
|
150 | 5219 |
if (ISCONNECTED) { |
1344 | 5220 |
Display *dpy = myDpy; |
5221 |
||
1974 | 5222 |
ENTER_XLIB(); |
1344 | 5223 |
if (doSync == true) { |
5224 |
XSync(dpy, 0); /* make certain everything is flushed */ |
|
5225 |
} |
|
5226 |
if (__isExternalAddress(aWindowIdOrNil)) { |
|
5227 |
win = _WindowVal(aWindowIdOrNil); |
|
5228 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
|
5229 |
} else { |
|
5230 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
|
5231 |
} |
|
5232 |
if (thereIsOne) { |
|
5233 |
XPutBackEvent(dpy, &ev); |
|
1974 | 5234 |
rslt = true; |
5235 |
} |
|
5236 |
LEAVE_XLIB(); |
|
5237 |
} |
|
5238 |
RETURN ( rslt ); |
|
81 | 5239 |
%} |
5240 |
! |
|
5241 |
||
1344 | 5242 |
getEventFor:aViewIdOrNil withMask:eventMask |
295 | 5243 |
"read next event - put into local eventBuffer. |
5244 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
5245 |
otherwise only events for that specific view will be fetched. |
|
5246 |
Returns true, if there was an event, false otherwise. |
|
5247 |
This method may block - so you better check for pending events |
|
5248 |
before calling for it. |
|
5249 |
||
5250 |
Sorry I had to split dispatch into this fetch method and an extra |
|
5251 |
handle method to allow unlimitedstack here. |
|
5252 |
(some Xlibs do a big alloca there ...) which cannot be done in |
|
5253 |
dispatchLastEvent, since it dispatches out into ST-methods. |
|
5254 |
" |
|
81 | 5255 |
|
5256 |
%{ /* UNLIMITEDSTACK */ |
|
5257 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5258 |
Display *dpy; |
295 | 5259 |
Window win, wWanted; |
5260 |
int evMask; |
|
5261 |
OBJ eB; |
|
5262 |
XEvent *ev; |
|
5263 |
||
5264 |
if (! ISCONNECTED) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5265 |
RETURN (false); |
295 | 5266 |
} |
5267 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5268 |
dpy = myDpy; |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
5269 |
|
555 | 5270 |
eB = __INST(eventBuffer); |
295 | 5271 |
if (__isByteArray(eB)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5272 |
ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
295 | 5273 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5274 |
printf("DISPLAY: no eventBuffer\n"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5275 |
RETURN (false); |
295 | 5276 |
} |
5277 |
ev->type = 0; |
|
5278 |
||
5279 |
if (__isSmallInteger(eventMask)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5280 |
evMask = __intVal(eventMask); |
295 | 5281 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5282 |
evMask = ~0; |
295 | 5283 |
} |
5284 |
||
5285 |
if (__isExternalAddress(aViewIdOrNil)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5286 |
wWanted = _WindowVal(aViewIdOrNil); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5287 |
if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5288 |
RETURN ( true ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5289 |
} |
295 | 5290 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5291 |
if (evMask == ~0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5292 |
XNextEvent(dpy, ev); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5293 |
RETURN (true); |
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 |
if (XCheckMaskEvent(dpy, evMask, ev)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5296 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5297 |
} |
295 | 5298 |
} |
5299 |
%}. |
|
5300 |
^ false |
|
5301 |
! |
|
5302 |
||
1344 | 5303 |
handleAllEvents |
295 | 5304 |
"from now on, handle any kind of event" |
5305 |
||
5306 |
dispatchingExpose := nil |
|
5307 |
! |
|
5308 |
||
1344 | 5309 |
handleExposeOnlyFor:aView |
295 | 5310 |
"from now on, handle expose events only" |
5311 |
||
5312 |
dispatchingExpose := aView id |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5313 |
! |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5314 |
|
1344 | 5315 |
mappingChanged:what event:eB |
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5316 |
"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
|
5317 |
Tell xlib about the fact." |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5318 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5319 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
1344 | 5320 |
self refreshKeyboardMapping:eB. |
5321 |
"Maybe some of our modifiers have been changed" |
|
5322 |
self initializeModifierMappings. |
|
288
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5323 |
]. |
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5324 |
|
5d49b00f2bad
changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents:
277
diff
changeset
|
5325 |
"Created: 1.12.1995 / 16:28:23 / stefan" |
295 | 5326 |
! |
5327 |
||
1344 | 5328 |
setEventMask:aMask in:aWindowId |
320
b7b8dc88fe9f
interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents:
315
diff
changeset
|
5329 |
"tell X that we are only interested in events from aMask, which |
295 | 5330 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
5331 |
||
5332 |
%{ /* NOCONTEXT */ |
|
5333 |
||
5334 |
int mask; |
|
5335 |
||
1209 | 5336 |
if (ISCONNECTED |
5337 |
&& __isExternalAddress(aWindowId) |
|
295 | 5338 |
&& __isSmallInteger(aMask)) { |
1344 | 5339 |
mask = __intVal(aMask); |
295 | 5340 |
|
5341 |
#ifdef OLD |
|
1344 | 5342 |
/* these may not be disabled */ |
5343 |
mask |= ExposureMask | StructureNotifyMask | |
|
5344 |
KeyPressMask | KeyReleaseMask | |
|
5345 |
EnterWindowMask | LeaveWindowMask | |
|
5346 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
|
295 | 5347 |
#endif |
5348 |
||
1974 | 5349 |
ENTER_XLIB(); |
1344 | 5350 |
XSelectInput(myDpy, _WindowVal(aWindowId), mask); |
1974 | 5351 |
LEAVE_XLIB(); |
1344 | 5352 |
RETURN ( self ); |
295 | 5353 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
5354 |
%}. |
295 | 5355 |
self primitiveFailed |
5356 |
! |
|
5357 |
||
1344 | 5358 |
startDispatch |
295 | 5359 |
"redefined to clear dispatchingExpose, which is a special X feature" |
5360 |
||
5361 |
dispatching ifTrue:[^ self]. |
|
5362 |
dispatchingExpose := nil. |
|
5363 |
super startDispatch |
|
0 | 5364 |
! ! |
295 | 5365 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5366 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5367 |
|
1567 | 5368 |
sendClientEvent:msgType format:msgFormat to:targetWindowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5 |
1556 | 5369 |
"send a ClientMessage to some other (possibly: non-ST/X) view. |
1567 | 5370 |
The client message gets message_type and msgFormat as specified by |
1556 | 5371 |
the arguments. The additional data arguments specify up to |
5372 |
5 longWords of user data; each may be an integer or nil. |
|
5373 |
It is passed transparently in the events data field. |
|
5374 |
See XProtocol specification for more details." |
|
5375 |
||
5376 |
"/ Event.xclient.type = ClientMessage; |
|
5377 |
"/ Event.xclient.display = dpy; |
|
5378 |
"/ Event.xclient.message_type = msgType; |
|
1567 | 5379 |
"/ Event.xclient.format = msgFormat; |
1556 | 5380 |
"/ Event.xclient.window = targetWindowID; |
5381 |
"/ Event.xclient.data.l[0] = d1 |
|
5382 |
"/ Event.xclient.data.l[1] = d2 |
|
5383 |
"/ Event.xclient.data.l[2] = d3 |
|
5384 |
"/ Event.xclient.data.l[3] = d4 |
|
5385 |
"/ Event.xclient.data.l[4] = d5 |
|
5386 |
"/ |
|
5387 |
"/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event); |
|
5388 |
||
5389 |
%{ /* NOCONTEXT */ |
|
5390 |
int type; |
|
5391 |
int state; |
|
5392 |
||
5393 |
if (ISCONNECTED |
|
5394 |
&& __isInteger(msgType) |
|
1567 | 5395 |
&& __isInteger(msgFormat) |
1556 | 5396 |
&& (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5397 |
Display *dpy = myDpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5398 |
XEvent ev; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5399 |
Status result; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5400 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5401 |
if (__isInteger(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5402 |
ev.xclient.data.l[0] = __longIntVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5403 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5404 |
if (__isExternalAddress(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5405 |
ev.xclient.data.l[0] = (int)__externalAddressVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5406 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5407 |
ev.xclient.data.l[0] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5408 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5409 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5410 |
if (__isInteger(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5411 |
ev.xclient.data.l[1] = __longIntVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5412 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5413 |
if (__isExternalAddress(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5414 |
ev.xclient.data.l[1] = (int)__externalAddressVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5415 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5416 |
ev.xclient.data.l[1] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5417 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5418 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5419 |
if (__isInteger(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5420 |
ev.xclient.data.l[2] = __longIntVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5421 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5422 |
if (__isExternalAddress(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5423 |
ev.xclient.data.l[2] = (int)__externalAddressVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5424 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5425 |
ev.xclient.data.l[2] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5426 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5427 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5428 |
if (__isInteger(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5429 |
ev.xclient.data.l[3] = __longIntVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5430 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5431 |
if (__isExternalAddress(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5432 |
ev.xclient.data.l[3] = (int)__externalAddressVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5433 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5434 |
ev.xclient.data.l[3] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5435 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5436 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5437 |
if (__isInteger(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5438 |
ev.xclient.data.l[4] = __longIntVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5439 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5440 |
if (__isExternalAddress(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5441 |
ev.xclient.data.l[4] = (int)__externalAddressVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5442 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5443 |
ev.xclient.data.l[4] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5444 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5445 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5446 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5447 |
if (__isExternalAddress(targetWindowID)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5448 |
ev.xclient.window = _WindowVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5449 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5450 |
ev.xclient.window = (Window)__longIntVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5451 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5452 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5453 |
ev.xclient.type = ClientMessage; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5454 |
ev.xclient.display = dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5455 |
ev.xclient.message_type = __longIntVal(msgType); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5456 |
ev.xclient.format = __longIntVal(msgFormat); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5457 |
|
1974 | 5458 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5459 |
result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev); |
1974 | 5460 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5461 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5462 |
if ((result == BadValue) || (result == BadWindow)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5463 |
DPRINTF(("bad status in sendClientEvent\n")); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5464 |
RETURN ( false ) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5465 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5466 |
RETURN (true) |
1556 | 5467 |
} |
5468 |
%}. |
|
5469 |
self primitiveFailed. |
|
5470 |
^ false |
|
5471 |
! |
|
5472 |
||
1344 | 5473 |
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
|
5474 |
"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
|
5475 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5476 |
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
|
5477 |
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
|
5478 |
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
|
5479 |
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
|
5480 |
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
|
5481 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5482 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5483 |
%{ /* NOCONTEXT */ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5484 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5485 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5486 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5487 |
if (__isSmallInteger(stateMask)) { |
1344 | 5488 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5489 |
} else { |
1344 | 5490 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5491 |
} |
440
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 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5494 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5495 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5496 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
1344 | 5497 |
Display *dpy = myDpy; |
5498 |
||
5499 |
XEvent ev; |
|
5500 |
Window target; |
|
5501 |
Status result; |
|
5502 |
KeySym keySym, *syms; |
|
5503 |
int screen = __intVal(__INST(screen)); |
|
5504 |
char s[2]; |
|
5505 |
int nSyms; |
|
5506 |
||
5507 |
if ((typeSymbol == @symbol(keyPress)) |
|
5508 |
|| (typeSymbol == @symbol(keyRelease))) { |
|
5509 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
|
5510 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
|
5511 |
} else { |
|
5512 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
|
5513 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
|
5514 |
s[1] = '\0'; |
|
5515 |
keySym = XStringToKeysym(s); |
|
5516 |
} else { |
|
5517 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
|
5518 |
} |
|
5519 |
} |
|
5520 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
|
5521 |
||
5522 |
if (stateMask == nil) { |
|
5523 |
/* |
|
5524 |
* get the modifier from the keySym |
|
5525 |
*/ |
|
5526 |
nSyms = 0; |
|
5527 |
syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
|
5528 |
if (syms) { |
|
5529 |
int i; |
|
5530 |
||
5531 |
for (i=0; i<nSyms; i++) { |
|
5532 |
if (syms[i] == keySym) { |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5533 |
#ifdef MODIFIERDEBUG |
1344 | 5534 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5535 |
#endif |
1344 | 5536 |
if (i) state = (1 << (i-1)); |
5537 |
break; |
|
5538 |
} |
|
5539 |
} |
|
5540 |
XFree(syms); |
|
5541 |
} |
|
5542 |
} |
|
5543 |
} else { |
|
5544 |
if ((typeSymbol == @symbol(buttonPress)) |
|
5545 |
|| (typeSymbol == @symbol(buttonRelease))) { |
|
5546 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
|
5547 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
|
5548 |
} else { |
|
5549 |
ev.xbutton.button = 1; |
|
5550 |
} |
|
5551 |
} else { |
|
5552 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
|
5553 |
RETURN (false); |
|
5554 |
} |
|
5555 |
} |
|
5556 |
||
5557 |
if (typeSymbol == @symbol(keyPress)) |
|
5558 |
ev.xany.type = KeyPress; |
|
5559 |
else if (typeSymbol == @symbol(keyRelease)) |
|
5560 |
ev.xany.type = KeyRelease; |
|
5561 |
else if (typeSymbol == @symbol(buttonPress)) |
|
5562 |
ev.xany.type = ButtonPress; |
|
5563 |
else if (typeSymbol == @symbol(buttonRelease)) |
|
5564 |
ev.xany.type = ButtonRelease; |
|
5565 |
||
5566 |
if (__isExternalAddress(targetId)) { |
|
5567 |
target = _WindowVal(targetId); |
|
5568 |
} else { |
|
5569 |
target = (Window) __longIntVal(targetId); |
|
5570 |
} |
|
5571 |
ev.xkey.window = target; |
|
5572 |
ev.xkey.same_screen = 1; |
|
5573 |
ev.xkey.subwindow = 0; |
|
2541 | 5574 |
ev.xkey.root = RootWindow(dpy, screen); |
1344 | 5575 |
ev.xkey.x = __intVal(xPos); |
5576 |
ev.xkey.y = __intVal(yPos); |
|
5577 |
ev.xkey.state = state; |
|
5578 |
ev.xkey.time = CurrentTime; |
|
5579 |
||
1974 | 5580 |
ENTER_XLIB(); |
1344 | 5581 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
1974 | 5582 |
LEAVE_XLIB(); |
1344 | 5583 |
if ((result == BadValue) || (result == BadWindow)) { |
5584 |
DPRINTF(("bad status\n")); |
|
5585 |
RETURN ( false ) |
|
5586 |
} |
|
5587 |
RETURN (true) |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5588 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5589 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5590 |
self primitiveFailed. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5591 |
^ false |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5592 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5593 |
|
295 | 5594 |
!XWorkstation methodsFor:'font stuff'! |
5595 |
||
1344 | 5596 |
createFontFor:aFontName |
295 | 5597 |
"a basic method for X-font allocation; this method allows |
5598 |
any font to be aquired (even those not conforming to |
|
5599 |
standard naming conventions, such as cursor, fixed or k14)" |
|
5600 |
||
5601 |
%{ /* UNLIMITEDSTACK */ |
|
5602 |
/* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */ |
|
5603 |
||
5604 |
XFontStruct *newFont; |
|
5605 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5606 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5607 |
&& __isNonNilObject(aFontName) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5608 |
&& (__qIsString(aFontName) || __qIsSymbol(aFontName))) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5609 |
BEGIN_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5610 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5611 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5612 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
5613 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5614 |
if (newFont) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5615 |
__cnt_font++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5616 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5617 |
END_INTERRUPTSBLOCKED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
5618 |
RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil ); |
295 | 5619 |
} |
5620 |
%}. |
|
5621 |
^ nil |
|
5622 |
! |
|
5623 |
||
1344 | 5624 |
decomposeXFontName:aString into:aBlock |
295 | 5625 |
"extract family, face, style and size from an |
5626 |
X-font name |
|
5627 |
(-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); |
|
5628 |
evaluate aBlock with these" |
|
5629 |
||
5630 |
|origin family face style moreStyle skip fheight size |
|
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5631 |
resX resY x1 x2 registry encoding coding start end | |
295 | 5632 |
|
5633 |
aString isNil ifTrue:[^ false]. |
|
5634 |
(aString startsWith:'-') ifFalse:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5635 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5636 |
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
|
5637 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5638 |
('*-*-[0-9]*' match:aString) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5639 |
end := aString indexOf:$- startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5640 |
family := aString copyFrom:1 to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5641 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5642 |
end := aString indexOf:$- startingAt:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5643 |
style := aString copyFrom:start to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5644 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5645 |
size := aString copyFrom:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5646 |
size := (Number readFromString:size onError:[^false]). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5647 |
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
|
5648 |
^ true. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5649 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5650 |
('*-[0-9]*' match:aString) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5651 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5652 |
something like lucidasans-24 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5653 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5654 |
end := aString indexOf:$- startingAt:1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5655 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5656 |
family := aString copyFrom:1 to:(end - 1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5657 |
start := end + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5658 |
size := aString copyFrom:start. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5659 |
size := (Number readFromString:size onError:[^false]). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5660 |
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
|
5661 |
^ true. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5662 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5663 |
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
|
5664 |
^ true. |
295 | 5665 |
]. |
5666 |
||
5667 |
end := aString indexOf:$- startingAt:2. |
|
5668 |
(end == 0) ifTrue:[^ false]. |
|
5669 |
origin := aString copyFrom:2 to:(end - 1). |
|
5670 |
||
5671 |
start := end + 1. |
|
5672 |
end := aString indexOf:$- startingAt:start. |
|
5673 |
(end == 0) ifTrue:[^ false]. |
|
5674 |
family := aString copyFrom:start to:(end - 1). |
|
5675 |
||
5676 |
start := end + 1. |
|
5677 |
end := aString indexOf:$- startingAt:start. |
|
5678 |
(end == 0) ifTrue:[^ false]. |
|
5679 |
face := aString copyFrom:start to:(end - 1). |
|
5680 |
||
5681 |
start := end + 1. |
|
5682 |
end := aString indexOf:$- startingAt:start. |
|
5683 |
(end == 0) ifTrue:[^ false]. |
|
5684 |
style := aString copyFrom:start to:(end - 1). |
|
5685 |
(style = 'o') ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5686 |
style := 'oblique' |
295 | 5687 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5688 |
(style = 'i') ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5689 |
style := 'italic' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5690 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5691 |
(style = 'r') ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5692 |
style := 'roman' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5693 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5694 |
] |
295 | 5695 |
]. |
5696 |
||
5697 |
start := end + 1. |
|
5698 |
end := aString indexOf:$- startingAt:start. |
|
5699 |
(end == 0) ifTrue:[^ false]. |
|
5700 |
moreStyle := aString copyFrom:start to:(end - 1). |
|
5701 |
||
5702 |
start := end + 1. |
|
5703 |
end := aString indexOf:$- startingAt:start. |
|
5704 |
(end == 0) ifTrue:[^ false]. |
|
5705 |
skip := aString copyFrom:start to:(end - 1). |
|
5706 |
||
5707 |
start := end + 1. |
|
5708 |
end := aString indexOf:$- startingAt:start. |
|
5709 |
(end == 0) ifTrue:[^ false]. |
|
5710 |
fheight := aString copyFrom:start to:(end - 1). |
|
5711 |
||
5712 |
start := end + 1. |
|
5713 |
end := aString indexOf:$- startingAt:start. |
|
5714 |
(end == 0) ifTrue:[^ false]. |
|
5715 |
size := aString copyFrom:start to:(end - 1). |
|
5716 |
size := (Number readFromString:size) / 10. |
|
5717 |
||
5718 |
start := end + 1. |
|
5719 |
end := aString indexOf:$- startingAt:start. |
|
5720 |
(end == 0) ifTrue:[^ false]. |
|
5721 |
resX := aString copyFrom:start to:(end - 1). |
|
5722 |
||
5723 |
start := end + 1. |
|
5724 |
end := aString indexOf:$- startingAt:start. |
|
5725 |
(end == 0) ifTrue:[^ false]. |
|
5726 |
resY := aString copyFrom:start to:(end - 1). |
|
5727 |
||
5728 |
start := end + 1. |
|
5729 |
end := aString indexOf:$- startingAt:start. |
|
5730 |
(end == 0) ifTrue:[^ false]. |
|
5731 |
x1 := aString copyFrom:start to:(end - 1). |
|
5732 |
||
5733 |
start := end + 1. |
|
5734 |
end := aString indexOf:$- startingAt:start. |
|
5735 |
(end == 0) ifTrue:[^ false]. |
|
5736 |
x2 := aString copyFrom:start to:(end - 1). |
|
5737 |
||
5738 |
start := end + 1. |
|
5739 |
end := aString indexOf:$- startingAt:start. |
|
5740 |
(end == 0) ifTrue:[^ false]. |
|
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5741 |
registry := aString copyFrom:start to:(end - 1). |
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5742 |
|
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5743 |
encoding := aString copyFrom:end + 1. |
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5744 |
|
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5745 |
coding := registry , '-' , encoding. |
295 | 5746 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5747 |
(moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5748 |
style := style, '-', moreStyle. |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5749 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5750 |
|
295 | 5751 |
aBlock value:family value:face value:style value:size value:coding. |
5752 |
^ true |
|
5753 |
||
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
5754 |
"Modified: 4.7.1996 / 11:12:25 / stefan" |
1566
d6280c6d470a
care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents:
1563
diff
changeset
|
5755 |
"Modified: 10.4.1997 / 09:45:36 / cg" |
295 | 5756 |
! |
5757 |
||
1344 | 5758 |
encodingOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5759 |
"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
|
5760 |
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
|
5761 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5762 |
|enc fullName fontName registry encoding charSetCollections| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5763 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5764 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5765 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5766 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5767 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5768 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5769 |
Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5770 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5771 |
if (ISCONNECTED) { |
1344 | 5772 |
Display *dpy = myDpy; |
5773 |
||
5774 |
registryAtom = XInternAtom(dpy, "CHARSET_REGISTRY", True); |
|
5775 |
encodingAtom = XInternAtom(dpy, "CHARSET_ENCODING", True); |
|
5776 |
charSetCollAtom = XInternAtom(dpy, "CHARSET_COLLECTIONS", True); |
|
5777 |
fontAtom = XInternAtom(dpy, "FONT", True); |
|
5778 |
||
5779 |
if (__isExternalAddress(aFontId)) { |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5780 |
|
1344 | 5781 |
f = _FontVal(aFontId); |
5782 |
if (f) { |
|
5783 |
n = f->n_properties; |
|
5784 |
prop = f->properties; |
|
5785 |
if (prop) { |
|
5786 |
while (n--) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5787 |
#ifdef SUPERDEBUG |
1344 | 5788 |
cp = XGetAtomName(dpy, prop->name); |
5789 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
5790 |
XFree(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5791 |
#endif |
1344 | 5792 |
if (prop->name == XA_FULL_NAME) { |
5793 |
cp = XGetAtomName(dpy, prop->card32); |
|
5794 |
if (cp) { |
|
5795 |
fullName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5796 |
#ifdef SUPERDEBUG |
1344 | 5797 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5798 |
#endif |
1344 | 5799 |
XFree(cp); |
5800 |
} |
|
5801 |
} else if (prop->name == fontAtom) { |
|
5802 |
cp = XGetAtomName(dpy, prop->card32); |
|
5803 |
if (cp) { |
|
5804 |
fontName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5805 |
#ifdef SUPERDEBUG |
1344 | 5806 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5807 |
#endif |
1344 | 5808 |
XFree(cp); |
5809 |
} |
|
5810 |
} else if (prop->name == encodingAtom) { |
|
5811 |
cp = XGetAtomName(dpy, prop->card32); |
|
5812 |
if (cp) { |
|
5813 |
encoding = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5814 |
#ifdef SUPERDEBUG |
1344 | 5815 |
printf(" ENCODING -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5816 |
#endif |
1344 | 5817 |
XFree(cp); |
5818 |
} |
|
5819 |
} else if (prop->name == registryAtom) { |
|
5820 |
cp = XGetAtomName(dpy, prop->card32); |
|
5821 |
if (cp) { |
|
5822 |
registry = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5823 |
#ifdef SUPERDEBUG |
1344 | 5824 |
printf(" REGISTRY -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5825 |
#endif |
1344 | 5826 |
XFree(cp); |
5827 |
} |
|
5828 |
} else if (prop->name == charSetCollAtom) { |
|
5829 |
cp = XGetAtomName(dpy, prop->card32); |
|
5830 |
if (cp) { |
|
5831 |
charSetCollections = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5832 |
#ifdef SUPERDEBUG |
1344 | 5833 |
printf(" CHARSET_COLLECTIONS -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5834 |
#endif |
1344 | 5835 |
XFree(cp); |
5836 |
} |
|
5837 |
} |
|
5838 |
prop++; |
|
5839 |
} |
|
5840 |
} |
|
5841 |
} |
|
5842 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5843 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5844 |
%}. |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5845 |
^ self |
1344 | 5846 |
extractEncodingFromRegistry:registry |
5847 |
encoding:encoding |
|
5848 |
charSetCollections:charSetCollections |
|
5849 |
! |
|
5850 |
||
5851 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
|
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5852 |
"this is pure magic ..." |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5853 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5854 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5855 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5856 |
(registry notNil and:[registry notEmpty]) ifTrue:[ |
1344 | 5857 |
enc := registry asLowercase asSymbol. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5858 |
] ifFalse:[ |
1344 | 5859 |
(encoding notNil and:[encoding notEmpty]) ifTrue:[ |
5860 |
enc := encoding asLowercase asSymbol |
|
5861 |
] ifFalse:[ |
|
5862 |
charSets := charSetCollections. |
|
5863 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
|
5864 |
charSets := charSets asUppercase asCollectionOfWords. |
|
5865 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
5866 |
enc := #iso8859 |
|
5867 |
] ifFalse:[ |
|
5868 |
(charSets includes:'ISO8859') ifTrue:[ |
|
5869 |
enc := #iso8859 |
|
5870 |
] ifFalse:[ |
|
5871 |
(charSets includes:'ASCII') ifTrue:[ |
|
5872 |
enc := #ascii |
|
5873 |
] ifFalse:[ |
|
5874 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
5875 |
enc := #iso8859 |
|
5876 |
] |
|
5877 |
] |
|
5878 |
] |
|
5879 |
] |
|
5880 |
] |
|
5881 |
] |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5882 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5883 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5884 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
5885 |
"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
|
5886 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5887 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5888 |
|
1344 | 5889 |
flushListOfAvailableFonts |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5890 |
"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
|
5891 |
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
|
5892 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5893 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5894 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5895 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5896 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5897 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5898 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5899 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5900 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5901 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5902 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5903 |
|
1344 | 5904 |
fontMetricsOf:fontId into:aBlock |
991 | 5905 |
"evaluate aBlock, passing a fonts metrics as arguments" |
5906 |
||
5907 |
|encoding avgAscent avgDescent |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5908 |
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
|
5909 |
res resX resY| |
991 | 5910 |
|
994 | 5911 |
%{ |
991 | 5912 |
XFontStruct *f; |
5913 |
int len; |
|
5914 |
||
5915 |
if (ISCONNECTED) { |
|
1344 | 5916 |
if (__isExternalAddress(fontId)) { |
5917 |
f = _FontVal(fontId); |
|
5918 |
if (f) { |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5919 |
#ifdef NOTDEF |
1344 | 5920 |
char *cp; |
5921 |
XFontProp *prop; |
|
5922 |
||
5923 |
n = f->n_properties; |
|
5924 |
prop = f->properties; |
|
5925 |
||
5926 |
if (prop) { |
|
5927 |
while (n--) { |
|
5928 |
if (prop->name == RESOLUTION_X) { |
|
5929 |
resX = __MKSMALLINT(prop->card32); |
|
5930 |
} else if (prop->name == RESOLUTION_Y) { |
|
5931 |
resY = __MKSMALLINT(prop->card32); |
|
5932 |
} else if (prop->name == RESOLUTION) { |
|
5933 |
res = __MKSMALLINT(prop->card32); |
|
5934 |
} |
|
5935 |
prop++; |
|
5936 |
} |
|
5937 |
} |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5938 |
#endif |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5939 |
|
1344 | 5940 |
avgAscent = __MKSMALLINT(f->ascent); |
5941 |
avgDescent = __MKSMALLINT(f->descent); |
|
5942 |
maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
|
5943 |
maxDescent = __MKSMALLINT(f->max_bounds.descent); |
|
5944 |
minWidth = __MKSMALLINT(f->min_bounds.width); |
|
5945 |
maxWidth = __MKSMALLINT(f->max_bounds.width); |
|
5946 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5947 |
ENTER_XLIB(); |
1344 | 5948 |
len = XTextWidth(f, " ", 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
5949 |
LEAVE_XLIB(); |
1344 | 5950 |
END_INTERRUPTSBLOCKED |
5951 |
avgWidth = __MKSMALLINT( len ); |
|
5952 |
} |
|
5953 |
} |
|
991 | 5954 |
} |
5955 |
%}. |
|
5956 |
encoding := self encodingOf:fontId. |
|
5957 |
aBlock value:encoding |
|
1344 | 5958 |
value:avgAscent |
5959 |
value:avgDescent |
|
5960 |
value:maxAscent |
|
5961 |
value:maxDescent |
|
5962 |
value:minWidth |
|
5963 |
value:maxWidth |
|
5964 |
value:avgWidth |
|
5965 |
! |
|
5966 |
||
5967 |
fontResolutionOf:fontId |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5968 |
"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
|
5969 |
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
|
5970 |
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
|
5971 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5972 |
|res resX resY| |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5973 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5974 |
%{ |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5975 |
XFontStruct *f; |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5976 |
|
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
5977 |
if (ISCONNECTED) { |
1344 | 5978 |
Display *dpy = myDpy; |
5979 |
||
5980 |
if (__isExternalAddress(fontId)) { |
|
5981 |
f = _FontVal(fontId); |
|
5982 |
if (f) { |
|
5983 |
char *cp; |
|
5984 |
XFontProp *prop; |
|
5985 |
Atom resolutionXAtom, resolutionYAtom; |
|
5986 |
int n; |
|
5987 |
||
5988 |
n = f->n_properties; |
|
5989 |
prop = f->properties; |
|
5990 |
||
5991 |
if (prop) { |
|
5992 |
resolutionXAtom = XInternAtom(dpy, "RESOLUTION_X", True); |
|
5993 |
resolutionYAtom = XInternAtom(dpy, "RESOLUTION_Y", True); |
|
5994 |
||
5995 |
while (n--) { |
|
5996 |
if (prop->name == resolutionXAtom) { |
|
5997 |
resX = __MKSMALLINT(prop->card32); |
|
5998 |
} else if (prop->name == resolutionYAtom) { |
|
5999 |
resY = __MKSMALLINT(prop->card32); |
|
6000 |
} else if (prop->name == XA_RESOLUTION) { |
|
6001 |
res = __MKSMALLINT(prop->card32); |
|
6002 |
} |
|
6003 |
prop++; |
|
6004 |
} |
|
6005 |
} |
|
6006 |
} |
|
6007 |
} |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6008 |
} |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6009 |
%}. |
1046 | 6010 |
(resX notNil and:[resY notNil]) ifTrue:[ |
1344 | 6011 |
^ resX @ resY |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6012 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6013 |
res notNil ifTrue:[ |
1344 | 6014 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6015 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6016 |
^ self resolution |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6017 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6018 |
|
1344 | 6019 |
fullNameOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6020 |
"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
|
6021 |
used for user feed-back (for example: in the fontPanel). |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6022 |
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
|
6023 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6024 |
|fullName fontName| |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6025 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6026 |
%{ |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6027 |
XFontStruct *f; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6028 |
XFontProp *prop; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6029 |
int n; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6030 |
char *cp; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6031 |
Atom fontAtom; |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6032 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6033 |
if (ISCONNECTED) { |
1344 | 6034 |
Display *dpy = myDpy; |
6035 |
||
6036 |
fontAtom = XInternAtom(dpy, "FONT", True); |
|
6037 |
||
6038 |
if (__isExternalAddress(aFontId)) { |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6039 |
|
1344 | 6040 |
f = _FontVal(aFontId); |
6041 |
if (f) { |
|
6042 |
n = f->n_properties; |
|
6043 |
prop = f->properties; |
|
6044 |
if (prop) { |
|
6045 |
while (n--) { |
|
1049
59cc92776676
oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents:
1047
diff
changeset
|
6046 |
#ifdef SUPERDEBUG |
1344 | 6047 |
cp = XGetAtomName(dpy, prop->name); |
6048 |
printf("%s (%d) -> %d\n", cp, prop->name, prop->card32); |
|
6049 |
XFree(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6050 |
#endif |
1344 | 6051 |
if (prop->name == XA_FULL_NAME) { |
6052 |
cp = XGetAtomName(dpy, prop->card32); |
|
6053 |
if (cp) { |
|
6054 |
fullName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6055 |
#ifdef SUPERDEBUG |
1344 | 6056 |
printf(" FULL_NAME -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6057 |
#endif |
1344 | 6058 |
XFree(cp); |
6059 |
} |
|
6060 |
} |
|
6061 |
if (prop->name == fontAtom) { |
|
6062 |
cp = XGetAtomName(dpy, prop->card32); |
|
6063 |
if (cp) { |
|
6064 |
fontName = __MKSTRING(cp); |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6065 |
#ifdef SUPERDEBUG |
1344 | 6066 |
printf(" FONT -> %s\n", cp); |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6067 |
#endif |
1344 | 6068 |
XFree(cp); |
6069 |
} |
|
6070 |
} |
|
6071 |
prop++; |
|
6072 |
} |
|
6073 |
} |
|
6074 |
} |
|
6075 |
} |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6076 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6077 |
%}. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6078 |
(fullName notNil and:[fullName notEmpty]) ifTrue:[ |
1344 | 6079 |
^ fullName |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6080 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6081 |
^ fontName |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6082 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6083 |
|
1344 | 6084 |
getAvailableFontsMatching:pattern |
295 | 6085 |
"return an Array filled with font names matching aPattern" |
6086 |
||
6087 |
%{ /* UNLIMITEDSTACK */ |
|
6088 |
||
6089 |
int nnames = 1500; |
|
6090 |
int available = nnames + 1; |
|
6091 |
char **fonts; |
|
6092 |
OBJ arr, str; |
|
6093 |
int i; |
|
6094 |
||
6095 |
if (ISCONNECTED) { |
|
1344 | 6096 |
if (__isString(pattern)) { |
6097 |
for (;;) { |
|
6098 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
6099 |
if ((fonts == NULL) || (available < nnames)) break; |
|
6100 |
XFreeFontNames(fonts); |
|
6101 |
nnames = available * 2; |
|
6102 |
} |
|
6103 |
if (fonts == NULL) { |
|
6104 |
RETURN ( nil ); |
|
6105 |
} |
|
6106 |
/* |
|
6107 |
* now, that we know the number of font names, |
|
6108 |
* create the array ... |
|
6109 |
*/ |
|
6110 |
arr = __ARRAY_NEW_INT(available); |
|
6111 |
if (! arr) { |
|
6112 |
RETURN (nil); |
|
6113 |
} |
|
6114 |
/* |
|
6115 |
* ... and fill it |
|
6116 |
*/ |
|
6117 |
for (i=0; i<available; i++) { |
|
6118 |
__PROTECT__(arr); |
|
6119 |
str = __MKSTRING(fonts[i]); |
|
6120 |
__UNPROTECT__(arr); |
|
6121 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
|
6122 |
} |
|
6123 |
RETURN (arr); |
|
6124 |
} |
|
295 | 6125 |
} |
6126 |
%}. |
|
6127 |
^ nil |
|
6128 |
! |
|
6129 |
||
1344 | 6130 |
getDefaultFont |
295 | 6131 |
"return a default font id - used when class Font cannot |
6132 |
find anything usable" |
|
6133 |
||
6134 |
^ self createFontFor:'fixed' |
|
6135 |
! |
|
6136 |
||
1344 | 6137 |
getFontWithFamily:familyString face:faceString |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6138 |
style:styleArgString size:sizeArg encoding:encoding |
295 | 6139 |
|
6140 |
"try to get the specified font, if not available, try next smaller |
|
6141 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
6142 |
as family and the other parameters as nil. For example, the cursor font |
|
6143 |
can be aquired that way." |
|
6144 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6145 |
|styleString theName theId xlatedStyle |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6146 |
id spacing encodingMatch registryMatch idx| |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6147 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6148 |
styleString := styleArgString. |
295 | 6149 |
|
6150 |
"special: if face is nil, allow access to X-fonts" |
|
6151 |
faceString isNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6152 |
sizeArg notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6153 |
theName := familyString , '-' , sizeArg printString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6154 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6155 |
theName := familyString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6156 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6157 |
theName isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6158 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6159 |
mhmh - fall back to the default font |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6160 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6161 |
theName := 'fixed' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6162 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6163 |
theId := self createFontFor:theName. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6164 |
theId isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6165 |
theId := self getDefaultFont |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6166 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6167 |
^ theId |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6168 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6169 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6170 |
"/ 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
|
6171 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6172 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6173 |
(styleString notNil |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6174 |
and:[(styleString endsWith:'-narrow') |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6175 |
or:[styleString endsWith:'-semicondensed']]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6176 |
|i| |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6177 |
i := styleString lastIndexOf:$-. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6178 |
spacing := styleString copyFrom:(i+1). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6179 |
styleString := styleString copyTo:(i-1). |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6180 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6181 |
spacing := 'normal'. |
295 | 6182 |
]. |
6183 |
||
6184 |
xlatedStyle := styleString. |
|
6185 |
xlatedStyle notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6186 |
xlatedStyle := xlatedStyle first asString |
295 | 6187 |
]. |
6188 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6189 |
encodingMatch := encoding. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6190 |
registryMatch := '*'. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6191 |
encoding isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6192 |
encodingMatch := '*'. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6193 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6194 |
idx := encoding indexOf:$-. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6195 |
idx ~~ 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6196 |
encodingMatch := encoding copyTo:idx - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6197 |
registryMatch := encoding copyFrom:idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6198 |
]. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6199 |
]. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6200 |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6201 |
id := self |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6202 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6203 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6204 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6205 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6206 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6207 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6208 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6209 |
registry:encodingMatch |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6210 |
encoding:registryMatch. |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6211 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6212 |
id isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6213 |
(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6214 |
"/ too stupid: encodings come in both cases |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6215 |
"/ and X does not ignore case |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6216 |
"/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6217 |
id := self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6218 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6219 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6220 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6221 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6222 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6223 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6224 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6225 |
registry:encodingMatch asUppercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6226 |
encoding:registryMatch. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6227 |
id isNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6228 |
id := self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6229 |
getFontWithFoundry:'*' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6230 |
family:familyString asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6231 |
weight:faceString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6232 |
slant:xlatedStyle |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6233 |
spacing:spacing |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6234 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6235 |
size:sizeArg |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6236 |
registry:encodingMatch asLowercase |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6237 |
encoding:registryMatch. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6238 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6239 |
] |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6240 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6241 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6242 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6243 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6244 |
"Modified: 10.4.1997 / 19:20:06 / cg" |
295 | 6245 |
! |
6246 |
||
1344 | 6247 |
getFontWithFoundry:foundry family:family weight:weight |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6248 |
slant:slant spacing:spc pixelSize:pSize size:size |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6249 |
registry:registry encoding:encoding |
295 | 6250 |
|
6251 |
"get the specified font, if not available, return nil. |
|
6252 |
This is the new font creation method - all others will be changed to |
|
6253 |
use this entry. |
|
6254 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
6255 |
||
6256 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
6257 |
family: 'helvetica' 'courier' 'times' ... |
|
6258 |
weight: 'bold' 'medium' 'demi' ... |
|
6259 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
6260 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
6261 |
pixelSize: 16,18 ... usually left empty |
|
6262 |
size: size in point (1/72th of an inch) |
|
6263 |
registry: iso8859, sgi ... '*' |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6264 |
encoding: registry specific encoding (usually '*') |
295 | 6265 |
" |
6266 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6267 |
|theName sizeMatch |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6268 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
1099 | 6269 |
pSizeMatch registryMatch encodingMatch| |
295 | 6270 |
|
6271 |
"this works only on 'Release >= 3' - X-servers" |
|
6272 |
"name is: |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6273 |
-foundry-family -weight -slant- |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6274 |
sony helvetica bold r |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6275 |
adobe courier medium i |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6276 |
msic fixed o |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6277 |
... ... |
295 | 6278 |
" |
6279 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6280 |
size isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6281 |
sizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6282 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6283 |
sizeMatch := size printString , '0' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6284 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6285 |
foundry isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6286 |
foundryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6287 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6288 |
foundryMatch := foundry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6289 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6290 |
family isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6291 |
familyMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6292 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6293 |
familyMatch := family |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6294 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6295 |
weight isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6296 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6297 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6298 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6299 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6300 |
slant isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6301 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6302 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6303 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6304 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6305 |
spc isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6306 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6307 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6308 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6309 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6310 |
pSize isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6311 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6312 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6313 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6314 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6315 |
registry isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6316 |
registryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6317 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6318 |
registryMatch := registry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6319 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6320 |
encoding isNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6321 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6322 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6323 |
encodingMatch := encoding |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6324 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6325 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6326 |
theName := ('-' , foundryMatch, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6327 |
'-' , familyMatch, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6328 |
'-' , weightMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6329 |
'-' , slantMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6330 |
'-' , spcMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6331 |
'-*' , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6332 |
'-' , pSizeMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6333 |
'-' , sizeMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6334 |
'-*-*-*-*' , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6335 |
'-' , registryMatch , |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6336 |
'-' , encodingMatch). |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6337 |
|
697 | 6338 |
"/ Transcript showCR:theName; endEntry. |
295 | 6339 |
|
6340 |
^ self createFontFor:theName. |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6341 |
|
295 | 6342 |
|
6343 |
" |
|
6344 |
Display getFontWithFoundry:'*' |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6345 |
family:'courier' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6346 |
weight:'medium' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6347 |
slant:'r' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6348 |
spacing:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6349 |
pixelSize:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6350 |
size:13 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6351 |
registry:'iso8859' |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
6352 |
encoding:'*' |
295 | 6353 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6354 |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6355 |
"Modified: 10.4.1997 / 19:15:44 / cg" |
295 | 6356 |
! |
6357 |
||
1344 | 6358 |
listOfAvailableFonts |
295 | 6359 |
"return a list with all available fonts on this display. |
6360 |
Since this takes a long time, keep the result of the query for the |
|
6361 |
next time. The elements of the returned collection are instances of |
|
6362 |
FontDescription." |
|
6363 |
||
392
caf4452ec3dd
merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents:
391
diff
changeset
|
6364 |
|"stream aName fntDescr" names| |
295 | 6365 |
|
6366 |
listOfXFonts isNil ifTrue:[ |
|
6367 |
"/ |
|
6368 |
"/ old code; using a pipe to xlsfonts |
|
6369 |
"/ |
|
6370 |
"/ stream := PipeStream readingFrom:'xlsfonts ''*'''. |
|
6371 |
"/ stream isNil ifTrue:[^ nil]. |
|
6372 |
"/ listOfXFonts := OrderedCollection new. |
|
6373 |
"/ [stream atEnd] whileFalse:[ |
|
6374 |
"/ aName := stream nextLine. |
|
6375 |
"/ aName notNil ifTrue:[ |
|
6376 |
"/ self decomposeXFontName:aName into: |
|
6377 |
"/ [:family :face :style :size :coding | |
|
6378 |
"/ family notNil ifTrue:[ |
|
6379 |
"/ fntDescr := FontDescription |
|
6380 |
"/ family:family |
|
6381 |
"/ face:face |
|
6382 |
"/ style:style |
|
6383 |
"/ size:size |
|
6384 |
"/ encoding:coding. |
|
6385 |
"/ listOfXFonts add:fntDescr |
|
6386 |
"/ ] |
|
6387 |
"/ ] |
|
6388 |
"/ ] |
|
6389 |
"/ ]. |
|
6390 |
"/ stream close. |
|
6391 |
"/ "if xlsfont is broken ... (hey sco)" |
|
6392 |
"/ (listOfXFonts size == 0) ifTrue:[ |
|
6393 |
"/ listOfXFonts := nil |
|
6394 |
"/ ] ifFalse:[ |
|
6395 |
"/ listOfXFonts sort:[:a :b | a family < b family]. |
|
6396 |
"/ ]. |
|
6397 |
||
1344 | 6398 |
"/ |
6399 |
"/ new code: |
|
6400 |
"/ use new primitive to get font names; |
|
6401 |
"/ this is much faster, and also works on systems where |
|
6402 |
"/ a) xlsfonts is broken (sco) |
|
6403 |
"/ b) xlsfonts is not available (aix) |
|
6404 |
"/ |
|
6405 |
names := self getAvailableFontsMatching:'*'. |
|
6406 |
names isNil ifTrue:[ |
|
6407 |
"no names returned ..." |
|
6408 |
^ nil |
|
6409 |
]. |
|
6410 |
listOfXFonts := names collect:[:aName | |
|
6411 |
|fntDescr| |
|
6412 |
||
6413 |
(self decomposeXFontName:aName into: |
|
6414 |
[:family :face :style :size :coding | |
|
6415 |
family notNil ifTrue:[ |
|
6416 |
fntDescr := FontDescription |
|
6417 |
family:family |
|
6418 |
face:face |
|
6419 |
style:style |
|
6420 |
size:size |
|
6421 |
encoding:coding. |
|
6422 |
] ifFalse:[ |
|
6423 |
fntDescr := FontDescription |
|
6424 |
name:aName |
|
6425 |
] |
|
6426 |
] |
|
6427 |
) ifFalse:[ |
|
6428 |
fntDescr := FontDescription name:aName. |
|
6429 |
]. |
|
6430 |
fntDescr |
|
6431 |
]. |
|
295 | 6432 |
|
6433 |
]. |
|
6434 |
^ listOfXFonts |
|
6435 |
||
6436 |
" |
|
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6437 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6438 |
|
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6439 |
Display getAvailableFontsMatching:'*'. |
295 | 6440 |
" |
6441 |
||
6442 |
"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
|
6443 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 6444 |
! |
6445 |
||
1344 | 6446 |
releaseFont:aFontId |
295 | 6447 |
|
6448 |
%{ /* NOCONTEXT */ |
|
6449 |
||
6450 |
XFontStruct *f; |
|
6451 |
||
1212 | 6452 |
if (! ISCONNECTED) { |
1344 | 6453 |
RETURN ( self ); |
1212 | 6454 |
} |
6455 |
||
6456 |
if (__isExternalAddress(aFontId)) { |
|
1344 | 6457 |
f = _FontVal(aFontId); |
6458 |
if (f) { |
|
6459 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6460 |
ENTER_XLIB(); |
1344 | 6461 |
XFreeFont(myDpy, f); |
1974 | 6462 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6463 |
#ifdef COUNT_RESOURCES |
1344 | 6464 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6465 |
#endif |
1344 | 6466 |
END_INTERRUPTSBLOCKED |
6467 |
RETURN ( self ); |
|
6468 |
} |
|
295 | 6469 |
} |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6470 |
%}. |
295 | 6471 |
self primitiveFailed |
6472 |
! |
|
6473 |
||
1344 | 6474 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 6475 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
6476 |
on this display. |
|
6477 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
6478 |
||
6479 |
|sizes| |
|
6480 |
||
466 | 6481 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 6482 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
1344 | 6483 |
"special: in X11R5 and above, size 0 means: |
6484 |
there are scaled versions in all sizes available" |
|
6485 |
||
6486 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64) |
|
295 | 6487 |
]. |
6488 |
^ sizes |
|
6489 |
||
6490 |
" |
|
6491 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
6492 |
" |
|
466 | 6493 |
|
6494 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 6495 |
! |
6496 |
||
1344 | 6497 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
295 | 6498 |
|
6499 |
%{ /* NOCONTEXT */ |
|
6500 |
||
6501 |
XFontStruct *f; |
|
6502 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6503 |
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
|
6504 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6505 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6506 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6507 |
int nInstBytes; |
295 | 6508 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6509 |
if (ISCONNECTED) { |
1344 | 6510 |
if (__bothSmallInteger(index1, index2) |
6511 |
&& __isExternalAddress(aFontId) |
|
6512 |
&& __isNonNilObject(aString)) { |
|
6513 |
f = _FontVal(aFontId); |
|
6514 |
if (! f) goto fail; |
|
6515 |
||
6516 |
i1 = __intVal(index1) - 1; |
|
6517 |
cls = __qClass(aString); |
|
6518 |
||
6519 |
if (i1 >= 0) { |
|
6520 |
i2 = __intVal(index2) - 1; |
|
6521 |
if (i2 < i1) { |
|
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6522 |
RETURN ( __MKSMALLINT(0) ); |
1344 | 6523 |
} |
6524 |
||
1831 | 6525 |
cp = (char *) __stringVal(aString); |
1344 | 6526 |
l = i2 - i1 + 1; |
6527 |
||
6528 |
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
|
6529 |
n = __stringSize(aString); |
1344 | 6530 |
if (i2 < n) { |
6531 |
cp += i1; |
|
6532 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6533 |
ENTER_XLIB(); |
1344 | 6534 |
len = XTextWidth(f, cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6535 |
LEAVE_XLIB(); |
1344 | 6536 |
END_INTERRUPTSBLOCKED |
6537 |
RETURN ( __MKSMALLINT(len) ); |
|
6538 |
} |
|
6539 |
} |
|
6540 |
||
6541 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6542 |
cp += nInstBytes; |
|
6543 |
||
6544 |
if (__isBytes(aString)) { |
|
6545 |
n = __byteArraySize(aString) - nInstBytes; |
|
6546 |
if (i2 < n) { |
|
6547 |
cp += i1; |
|
6548 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6549 |
ENTER_XLIB(); |
1344 | 6550 |
len = XTextWidth(f, cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6551 |
LEAVE_XLIB(); |
1344 | 6552 |
END_INTERRUPTSBLOCKED |
6553 |
RETURN ( __MKSMALLINT(len) ); |
|
6554 |
} |
|
6555 |
} |
|
6556 |
||
6557 |
/* TWOBYTESTRINGS */ |
|
6558 |
if (__isWords(aString)) { |
|
6559 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6560 |
||
6561 |
if (i2 < n) { |
|
6562 |
union { |
|
6563 |
char b[2]; |
|
6564 |
unsigned short s; |
|
6565 |
} u; |
|
6566 |
int i; |
|
6567 |
XChar2b *cp2 = (XChar2b *)0; |
|
6568 |
int mustFree = 0; |
|
6569 |
||
6570 |
cp += (i1 * 2); |
|
6571 |
if (l > 1000) l = 1000; |
|
6572 |
||
6573 |
/* |
|
6574 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6575 |
* X expects them MSB first |
|
6576 |
* convert as required |
|
6577 |
*/ |
|
6578 |
||
6579 |
u.s = 0x1234; |
|
6580 |
if (u.b[0] != 0x12) { |
|
6581 |
if (l <= NLOCALBUFFER) { |
|
6582 |
cp2 = xlatebuffer; |
|
6583 |
} else { |
|
6584 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
6585 |
mustFree = 1; |
|
6586 |
} |
|
6587 |
for (i=0; i<l; i++) { |
|
6588 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6589 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6590 |
} |
|
6591 |
cp = (char *) cp2; |
|
6592 |
} |
|
6593 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6594 |
ENTER_XLIB(); |
1344 | 6595 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6596 |
LEAVE_XLIB(); |
1344 | 6597 |
END_INTERRUPTSBLOCKED |
6598 |
||
6599 |
if (mustFree) { |
|
6600 |
free(cp2); |
|
6601 |
} |
|
6602 |
||
6603 |
RETURN ( __MKSMALLINT(len) ); |
|
6604 |
} |
|
6605 |
} |
|
6606 |
} |
|
6607 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6608 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6609 |
#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
|
6610 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6611 |
%}. |
295 | 6612 |
self primitiveFailed. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6613 |
^ 0 |
295 | 6614 |
! |
6615 |
||
1344 | 6616 |
widthOf:aString inFont:aFontId |
295 | 6617 |
|
6618 |
%{ /* NOCONTEXT */ |
|
6619 |
||
6620 |
XFontStruct *f; |
|
6621 |
char *cp; |
|
6622 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
6623 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6624 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6625 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6626 |
int nInstBytes; |
295 | 6627 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6628 |
if (ISCONNECTED) { |
1344 | 6629 |
if (__isExternalAddress(aFontId) |
6630 |
&& __isNonNilObject(aString)) { |
|
6631 |
f = _FontVal(aFontId); |
|
6632 |
if (! f) goto fail; |
|
6633 |
||
6634 |
cls = __qClass(aString); |
|
6635 |
||
1831 | 6636 |
cp = (char *) __stringVal(aString); |
1344 | 6637 |
|
6638 |
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
|
6639 |
n = __stringSize(aString); |
1344 | 6640 |
BEGIN_INTERRUPTSBLOCKED |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6641 |
ENTER_XLIB(); |
1344 | 6642 |
len = XTextWidth(f, cp, n); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6643 |
LEAVE_XLIB(); |
1344 | 6644 |
END_INTERRUPTSBLOCKED |
6645 |
RETURN ( __MKSMALLINT(len) ); |
|
6646 |
} |
|
6647 |
||
6648 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6649 |
cp += nInstBytes; |
|
6650 |
||
6651 |
if (__isBytes(aString)) { |
|
6652 |
n = __byteArraySize(aString) - nInstBytes; |
|
6653 |
||
6654 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6655 |
ENTER_XLIB(); |
1344 | 6656 |
len = XTextWidth(f, cp, n); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6657 |
LEAVE_XLIB(); |
1344 | 6658 |
END_INTERRUPTSBLOCKED |
6659 |
RETURN ( __MKSMALLINT(len) ); |
|
6660 |
} |
|
6661 |
||
6662 |
/* TWOBYTESTRINGS */ |
|
6663 |
if (__isWords(aString)) { |
|
6664 |
union { |
|
6665 |
char b[2]; |
|
6666 |
unsigned short s; |
|
6667 |
} u; |
|
6668 |
int i; |
|
6669 |
XChar2b *cp2; |
|
6670 |
int mustFree = 0; |
|
6671 |
||
6672 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6673 |
if (n > 1000) n = 1000; |
|
6674 |
||
6675 |
/* |
|
6676 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6677 |
* X expects them MSB first |
|
6678 |
* convert as required |
|
6679 |
*/ |
|
6680 |
||
6681 |
u.s = 0x1234; |
|
6682 |
if (u.b[0] != 0x12) { |
|
6683 |
if (n <= NLOCALBUFFER) { |
|
6684 |
cp2 = xlatebuffer; |
|
6685 |
} else { |
|
6686 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
6687 |
mustFree = 1; |
|
6688 |
} |
|
6689 |
||
6690 |
for (i=0; i<n; i++) { |
|
6691 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6692 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6693 |
} |
|
6694 |
cp = (char *) cp2; |
|
6695 |
} |
|
6696 |
||
6697 |
BEGIN_INTERRUPTSBLOCKED |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6698 |
ENTER_XLIB(); |
1344 | 6699 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6700 |
LEAVE_XLIB(); |
1344 | 6701 |
END_INTERRUPTSBLOCKED |
6702 |
||
6703 |
if (mustFree) { |
|
6704 |
free(cp2); |
|
6705 |
} |
|
6706 |
||
6707 |
RETURN ( __MKSMALLINT(len) ); |
|
6708 |
} |
|
6709 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6710 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6711 |
#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
|
6712 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6713 |
%}. |
295 | 6714 |
self primitiveFailed. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
6715 |
^ 0 |
295 | 6716 |
! ! |
6717 |
||
6718 |
!XWorkstation methodsFor:'grabbing '! |
|
6719 |
||
1344 | 6720 |
allowEvents:mode |
295 | 6721 |
%{ /* NOCONTEXT */ |
6722 |
||
6723 |
int _mode, ok = 1; |
|
6724 |
||
6725 |
if (mode == @symbol(asyncPointer)) |
|
1344 | 6726 |
_mode = AsyncPointer; |
295 | 6727 |
else if (mode == @symbol(syncPointer)) |
1344 | 6728 |
_mode = SyncPointer; |
295 | 6729 |
else if (mode == @symbol(asyncKeyboard)) |
1344 | 6730 |
_mode = AsyncKeyboard; |
295 | 6731 |
else if (mode == @symbol(syncKeyboard)) |
1344 | 6732 |
_mode = SyncKeyboard; |
295 | 6733 |
else if (mode == @symbol(syncBoth)) |
1344 | 6734 |
_mode = SyncBoth; |
295 | 6735 |
else if (mode == @symbol(asyncBoth)) |
1344 | 6736 |
_mode = AsyncBoth; |
295 | 6737 |
else if (mode == @symbol(replayPointer)) |
1344 | 6738 |
_mode = ReplayPointer; |
295 | 6739 |
else if (mode == @symbol(replayKeyboard)) |
1344 | 6740 |
_mode = ReplayKeyboard; |
295 | 6741 |
else |
1344 | 6742 |
ok = 0; |
295 | 6743 |
|
6744 |
if (ok) { |
|
1344 | 6745 |
if (ISCONNECTED) { |
6746 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6747 |
ENTER_XLIB(); |
1344 | 6748 |
XAllowEvents(myDpy, _mode, CurrentTime); |
1974 | 6749 |
LEAVE_XLIB(); |
1344 | 6750 |
END_INTERRUPTSBLOCKED |
6751 |
RETURN (self); |
|
6752 |
} |
|
295 | 6753 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6754 |
%}. |
295 | 6755 |
self primitiveFailed |
6756 |
! |
|
6757 |
||
1344 | 6758 |
grabKeyboardIn:aWindowId |
295 | 6759 |
"grab the keyboard" |
6760 |
||
6761 |
%{ /* NOCONTEXT */ |
|
6762 |
int result, ok; |
|
6763 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6764 |
if (ISCONNECTED) { |
1344 | 6765 |
if (__isExternalAddress(aWindowId)) { |
6766 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 6767 |
ENTER_XLIB(); |
1344 | 6768 |
result = XGrabKeyboard(myDpy, |
6769 |
_WindowVal(aWindowId), |
|
6770 |
True /* False */, |
|
6771 |
GrabModeAsync, |
|
6772 |
GrabModeAsync, |
|
6773 |
CurrentTime); |
|
1974 | 6774 |
LEAVE_XLIB(); |
1344 | 6775 |
END_INTERRUPTSBLOCKED |
6776 |
ok = 0; |
|
6777 |
switch(result) { |
|
6778 |
case AlreadyGrabbed: |
|
6779 |
if (@global(ErrorPrinting) == true) { |
|
6780 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
|
6781 |
} |
|
6782 |
break; |
|
6783 |
case GrabNotViewable: |
|
6784 |
if (@global(ErrorPrinting) == true) { |
|
6785 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
|
6786 |
} |
|
6787 |
break; |
|
6788 |
case GrabInvalidTime: |
|
6789 |
if (@global(ErrorPrinting) == true) { |
|
6790 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
|
6791 |
} |
|
6792 |
break; |
|
6793 |
case GrabFrozen: |
|
6794 |
if (@global(ErrorPrinting) == true) { |
|
6795 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
|
6796 |
} |
|
6797 |
break; |
|
6798 |
default: |
|
6799 |
ok = 1; |
|
6800 |
break; |
|
6801 |
} |
|
6802 |
if (! ok) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6803 |
ENTER_XLIB(); |
1344 | 6804 |
XUngrabKeyboard(myDpy, CurrentTime); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6805 |
LEAVE_XLIB(); |
1344 | 6806 |
RETURN (false); |
6807 |
} |
|
6808 |
||
6809 |
RETURN ( true ); |
|
6810 |
} |
|
295 | 6811 |
} |
1183 | 6812 |
%}. |
295 | 6813 |
self primitiveFailed |
6814 |
! |
|
6815 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6816 |
grabPointerIn:aWindowId withCursor:aCursorId eventMask:eventMask pointerMode:pMode keyboardMode:kMode confineTo:confineId |
295 | 6817 |
"grap the pointer - return true if ok" |
6818 |
||
6819 |
%{ /* NOCONTEXT */ |
|
6820 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6821 |
int result, ok, evMask; |
295 | 6822 |
Window confineWin; |
6823 |
Cursor curs; |
|
6824 |
int pointer_mode, keyboard_mode; |
|
6825 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6826 |
if (ISCONNECTED) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6827 |
if (__isExternalAddress(aWindowId)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6828 |
if (__isExternalAddress(confineId)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6829 |
confineWin = _WindowVal(confineId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6830 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6831 |
confineWin = (Window) None; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6832 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6833 |
if (__isExternalAddress(aCursorId)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6834 |
curs = _CursorVal(aCursorId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6835 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6836 |
curs = (Cursor) None; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6837 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6838 |
if (pMode == @symbol(sync)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6839 |
pointer_mode = GrabModeSync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6840 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6841 |
pointer_mode = GrabModeAsync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6842 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6843 |
if (kMode == @symbol(sync)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6844 |
keyboard_mode = GrabModeSync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6845 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6846 |
keyboard_mode = GrabModeAsync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6847 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6848 |
if (__isSmallInteger(eventMask)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6849 |
evMask = __intVal(eventMask); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6850 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6851 |
evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6852 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6853 |
BEGIN_INTERRUPTSBLOCKED |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6854 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6855 |
ENTER_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6856 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6857 |
result = XGrabPointer(myDpy, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6858 |
_WindowVal(aWindowId), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6859 |
False, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6860 |
evMask, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6861 |
pointer_mode, keyboard_mode, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6862 |
confineWin, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6863 |
curs, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6864 |
CurrentTime); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6865 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6866 |
LEAVE_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6867 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6868 |
END_INTERRUPTSBLOCKED |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6869 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6870 |
ok = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6871 |
switch (result) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6872 |
case AlreadyGrabbed: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6873 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6874 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6875 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6876 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6877 |
case GrabNotViewable: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6878 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6879 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6880 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6881 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6882 |
case GrabInvalidTime: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6883 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6884 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6885 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6886 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6887 |
case GrabFrozen: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6888 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6889 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6890 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6891 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6892 |
default: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6893 |
ok = 1; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6894 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6895 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6896 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6897 |
if (! ok) { |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6898 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6899 |
ENTER_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6900 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6901 |
XUngrabPointer(myDpy, CurrentTime); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6902 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6903 |
LEAVE_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6904 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6905 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6906 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6907 |
RETURN ( true ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6908 |
} |
295 | 6909 |
} |
1183 | 6910 |
%}. |
295 | 6911 |
self primitiveFailed |
6912 |
! |
|
6913 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6914 |
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6915 |
"grap the pointer - return true if ok" |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6916 |
|
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6917 |
^ self |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6918 |
grabPointerIn:aWindowId |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6919 |
withCursor:aCursorId |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6920 |
eventMask:nil |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6921 |
pointerMode:pMode |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6922 |
keyboardMode:kMode |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
6923 |
confineTo:confineId |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6924 |
|
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6925 |
"Modified: / 28.7.1998 / 02:47:51 / cg" |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6926 |
! |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
6927 |
|
1344 | 6928 |
ungrabKeyboard |
295 | 6929 |
"release the keyboard" |
6930 |
||
6931 |
%{ /* NOCONTEXT */ |
|
6932 |
||
6933 |
if (ISCONNECTED) { |
|
2541 | 6934 |
Display *dpy = myDpy; |
6935 |
||
1344 | 6936 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6937 |
ENTER_XLIB(); |
2541 | 6938 |
XUngrabKeyboard(dpy, CurrentTime); |
6939 |
XSync(dpy, 0); |
|
1974 | 6940 |
LEAVE_XLIB(); |
1344 | 6941 |
END_INTERRUPTSBLOCKED |
295 | 6942 |
} |
6943 |
%}. |
|
6944 |
activeKeyboardGrab := nil |
|
6945 |
! |
|
6946 |
||
1344 | 6947 |
ungrabPointer |
295 | 6948 |
"release the pointer" |
6949 |
||
6950 |
%{ /* NOCONTEXT */ |
|
6951 |
||
6952 |
if (ISCONNECTED) { |
|
2541 | 6953 |
Display *dpy = myDpy; |
6954 |
||
1344 | 6955 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 6956 |
ENTER_XLIB(); |
2541 | 6957 |
XUngrabPointer(dpy, CurrentTime); |
6958 |
XSync(dpy, 0); |
|
1974 | 6959 |
LEAVE_XLIB(); |
1344 | 6960 |
END_INTERRUPTSBLOCKED |
295 | 6961 |
} |
6962 |
%}. |
|
6963 |
activePointerGrab := nil |
|
6964 |
! ! |
|
6965 |
||
6966 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
6967 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
6968 |
noClipIn:aDrawableId gc:aGCId |
295 | 6969 |
"disable clipping rectangle" |
6970 |
||
6971 |
%{ /* NOCONTEXT */ |
|
6972 |
||
6973 |
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
|
6974 |
GC gc; |
295 | 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 |
gc = _GCVal(aGCId); |
|
6979 |
gcv.clip_mask = None; |
|
1974 | 6980 |
ENTER_XLIB(); |
1344 | 6981 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
1974 | 6982 |
LEAVE_XLIB(); |
1344 | 6983 |
RETURN ( self ); |
6984 |
} |
|
295 | 6985 |
} |
6986 |
%}. |
|
6987 |
self primitiveFailed |
|
6988 |
! |
|
6989 |
||
1344 | 6990 |
setBackground:bgColorIndex in:aGCId |
295 | 6991 |
"set background color to be drawn with" |
6992 |
||
6993 |
%{ /* NOCONTEXT */ |
|
6994 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
6995 |
if (ISCONNECTED) { |
1344 | 6996 |
if (__isExternalAddress(aGCId) |
6997 |
&& __isSmallInteger(bgColorIndex)) { |
|
1974 | 6998 |
ENTER_XLIB(); |
1344 | 6999 |
XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex)); |
1974 | 7000 |
LEAVE_XLIB(); |
1344 | 7001 |
RETURN ( self ); |
7002 |
} |
|
295 | 7003 |
} |
7004 |
%}. |
|
7005 |
self primitiveFailed |
|
7006 |
! |
|
7007 |
||
1344 | 7008 |
setBitmapMask:aBitmapId in:aGCId |
295 | 7009 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
7010 |
||
7011 |
%{ /* NOCONTEXT */ |
|
7012 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7013 |
GC gc; |
295 | 7014 |
Pixmap bitmap; |
7015 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7016 |
if (ISCONNECTED) { |
1344 | 7017 |
Display *dpy = myDpy; |
7018 |
||
7019 |
if (__isExternalAddress(aGCId)) { |
|
7020 |
gc = _GCVal(aGCId); |
|
7021 |
if (__isExternalAddress(aBitmapId)) { |
|
7022 |
bitmap = _PixmapVal(aBitmapId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7023 |
ENTER_XLIB(); |
1344 | 7024 |
XSetStipple(dpy, gc, bitmap); |
7025 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7026 |
LEAVE_XLIB(); |
1344 | 7027 |
RETURN ( self ); |
7028 |
} |
|
7029 |
if (aBitmapId == nil) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7030 |
ENTER_XLIB(); |
1344 | 7031 |
XSetFillStyle(dpy, gc, FillSolid); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7032 |
LEAVE_XLIB(); |
1344 | 7033 |
RETURN ( self ); |
7034 |
} |
|
7035 |
} |
|
295 | 7036 |
} |
7037 |
%}. |
|
7038 |
self primitiveFailed |
|
7039 |
! |
|
7040 |
||
1681
069ede63fb19
pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
7041 |
setClipByChildren:aBool in:aDrawableId gc:aGCId |
295 | 7042 |
"enable/disable drawing into child views" |
7043 |
||
7044 |
%{ /* NOCONTEXT */ |
|
7045 |
||
7046 |
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
|
7047 |
GC gc; |
295 | 7048 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7049 |
if (ISCONNECTED) { |
1694 | 7050 |
if (__isExternalAddress(aGCId)) { |
7051 |
gc = _GCVal(aGCId); |
|
7052 |
if (aBool == true) |
|
7053 |
gcv.subwindow_mode = ClipByChildren; |
|
7054 |
else |
|
7055 |
gcv.subwindow_mode = IncludeInferiors; |
|
7056 |
||
1974 | 7057 |
ENTER_XLIB(); |
1694 | 7058 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
1974 | 7059 |
LEAVE_XLIB(); |
1694 | 7060 |
RETURN ( self ); |
7061 |
} |
|
295 | 7062 |
} |
7063 |
%}. |
|
7064 |
self primitiveFailed |
|
7065 |
! |
|
7066 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
7067 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId |
295 | 7068 |
"clip to a rectangle" |
7069 |
||
7070 |
%{ /* NOCONTEXT */ |
|
7071 |
||
7072 |
XRectangle r; |
|
7073 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7074 |
if (ISCONNECTED) { |
1344 | 7075 |
if (__isExternalAddress(aGCId) |
7076 |
&& __bothSmallInteger(clipX, clipY) |
|
7077 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
7078 |
r.x = __intVal(clipX); |
|
7079 |
r.y = __intVal(clipY); |
|
7080 |
r.width = __intVal(clipWidth); |
|
7081 |
r.height = __intVal(clipHeight); |
|
1974 | 7082 |
ENTER_XLIB(); |
1344 | 7083 |
XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
1974 | 7084 |
LEAVE_XLIB(); |
1344 | 7085 |
RETURN ( self ); |
7086 |
} |
|
295 | 7087 |
} |
7088 |
%}. |
|
7089 |
self primitiveFailed |
|
7090 |
! |
|
7091 |
||
1344 | 7092 |
setDashes:dashList dashOffset:offset in:aGCId |
788 | 7093 |
"set line attributes" |
7094 |
||
7095 |
%{ /* NOCONTEXT */ |
|
7096 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7097 |
if (ISCONNECTED) { |
1344 | 7098 |
if (__isExternalAddress(aGCId) |
7099 |
&& __isSmallInteger(offset) |
|
7100 |
&& __isByteArray(dashList)) { |
|
1974 | 7101 |
ENTER_XLIB(); |
1344 | 7102 |
XSetDashes(myDpy, _GCVal(aGCId), |
7103 |
__intVal(offset), |
|
7104 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
7105 |
__byteArraySize(dashList)); |
|
1974 | 7106 |
LEAVE_XLIB(); |
1344 | 7107 |
RETURN ( self ); |
7108 |
} |
|
788 | 7109 |
} |
7110 |
bad: ; |
|
7111 |
%}. |
|
7112 |
" |
|
7113 |
either aGCId is invalid, |
|
7114 |
and/or dashList is not a byteArray |
|
7115 |
and/or offset is not a smallInteger |
|
7116 |
" |
|
7117 |
self primitiveFailed |
|
7118 |
! |
|
7119 |
||
1344 | 7120 |
setFont:aFontId in:aGCId |
295 | 7121 |
"set font to be drawn in" |
7122 |
||
7123 |
%{ /* NOCONTEXT */ |
|
7124 |
||
7125 |
XFontStruct *f; |
|
7126 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7127 |
if (ISCONNECTED) { |
1344 | 7128 |
if (__isExternalAddress(aFontId) |
7129 |
&& __isExternalAddress(aGCId)) { |
|
7130 |
f = (XFontStruct *) _FontVal(aFontId); |
|
1974 | 7131 |
ENTER_XLIB(); |
1344 | 7132 |
XSetFont(myDpy, _GCVal(aGCId), f->fid); |
1974 | 7133 |
LEAVE_XLIB(); |
1344 | 7134 |
RETURN ( self ); |
7135 |
} |
|
295 | 7136 |
} |
7137 |
%}. |
|
7138 |
" |
|
7139 |
aGCId and/or aFontId are invalid |
|
7140 |
" |
|
7141 |
self primitiveFailed |
|
7142 |
! |
|
7143 |
||
1344 | 7144 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
295 | 7145 |
"set foreground and background colors to be drawn with" |
7146 |
||
7147 |
%{ /* NOCONTEXT */ |
|
7148 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7149 |
GC gc; |
295 | 7150 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7151 |
if (ISCONNECTED) { |
1344 | 7152 |
Display *dpy = myDpy; |
7153 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
7154 |
&& __isExternalAddress(aGCId)) { |
|
7155 |
gc = _GCVal(aGCId); |
|
7156 |
||
1974 | 7157 |
ENTER_XLIB(); |
1344 | 7158 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
7159 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
1974 | 7160 |
LEAVE_XLIB(); |
1344 | 7161 |
RETURN ( self ); |
7162 |
} |
|
295 | 7163 |
} |
7164 |
%}. |
|
7165 |
self primitiveFailed |
|
7166 |
! |
|
7167 |
||
1344 | 7168 |
setForeground:fgColorIndex in:aGCId |
295 | 7169 |
"set foreground color to be drawn with" |
7170 |
||
7171 |
%{ /* NOCONTEXT */ |
|
7172 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7173 |
if (ISCONNECTED) { |
1344 | 7174 |
if (__isExternalAddress(aGCId) |
7175 |
&& __isSmallInteger(fgColorIndex)) { |
|
1974 | 7176 |
ENTER_XLIB(); |
1344 | 7177 |
XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex)); |
1974 | 7178 |
LEAVE_XLIB(); |
1344 | 7179 |
RETURN ( self ); |
7180 |
} |
|
295 | 7181 |
} |
7182 |
%}. |
|
7183 |
self primitiveFailed |
|
7184 |
! |
|
7185 |
||
1344 | 7186 |
setFunction:aFunctionSymbol in:aGCId |
295 | 7187 |
"set alu function to be drawn with" |
7188 |
||
7189 |
%{ /* NOCONTEXT */ |
|
7190 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7191 |
GC gc; |
295 | 7192 |
int fun = -1; |
7193 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7194 |
if (ISCONNECTED) { |
1344 | 7195 |
if (__isExternalAddress(aGCId)) { |
7196 |
gc = _GCVal(aGCId); |
|
7197 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
|
7198 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
|
7199 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
|
7200 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
|
7201 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
|
7202 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
|
7203 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
|
7204 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
|
7205 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
|
7206 |
if (fun != -1) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7207 |
ENTER_XLIB(); |
1344 | 7208 |
XSetFunction(myDpy, gc, fun); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7209 |
LEAVE_XLIB(); |
1344 | 7210 |
RETURN ( self ); |
7211 |
} |
|
7212 |
} |
|
295 | 7213 |
} |
7214 |
%}. |
|
7215 |
" |
|
7216 |
either aGCId is not an integer, or an invalid symbol |
|
7217 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
7218 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
7219 |
" |
|
7220 |
self primitiveFailed |
|
7221 |
! |
|
7222 |
||
1344 | 7223 |
setGraphicsExposures:aBoolean in:aGCId |
295 | 7224 |
"set or clear the graphics exposures flag" |
7225 |
||
7226 |
%{ /* NOCONTEXT */ |
|
7227 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7228 |
if (ISCONNECTED) { |
1344 | 7229 |
if (__isExternalAddress(aGCId)) { |
1974 | 7230 |
ENTER_XLIB(); |
1344 | 7231 |
XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0); |
1974 | 7232 |
LEAVE_XLIB(); |
1344 | 7233 |
RETURN ( self ); |
7234 |
} |
|
295 | 7235 |
} |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7236 |
%}. |
295 | 7237 |
self primitiveFailed |
7238 |
! |
|
7239 |
||
1344 | 7240 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
1455 | 7241 |
"set line attributes; |
7242 |
lineStyle must be one of #solid, #dashed or #doubleDashed; |
|
7243 |
capStyle one of: #notLast, #butt, #round or #projecting; |
|
7244 |
joinStyle one of: #miter, #bevel or #round." |
|
295 | 7245 |
|
7246 |
%{ /* NOCONTEXT */ |
|
7247 |
||
7248 |
int x_style, x_cap, x_join; |
|
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7249 |
static char dashList[2] = { 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7250 |
static char dotList[2] = { 4,4 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7251 |
static char dashDotList[4] = { 4,1 , 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7252 |
static char dashDotDotList[6] = { 4,1 , 1,1 , 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7253 |
char *x_dashes = 0; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7254 |
int x_nDash; |
295 | 7255 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7256 |
if (ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7257 |
if (__isExternalAddress(aGCId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7258 |
&& __isSmallInteger(aNumber)) { |
2541 | 7259 |
Display *dpy = myDpy; |
7260 |
||
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7261 |
if (lineStyle == @symbol(solid)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7262 |
x_dashes = (char *)0; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7263 |
x_style = LineSolid; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7264 |
} else if (lineStyle == @symbol(dashed)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7265 |
x_dashes = dashList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7266 |
x_nDash = sizeof(dashList); |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
7267 |
x_style = LineOnOffDash; |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7268 |
} else if (lineStyle == @symbol(doubleDashed)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7269 |
x_dashes = dashList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7270 |
x_nDash = sizeof(dashList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7271 |
x_style = LineDoubleDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7272 |
} else if (lineStyle == @symbol(dotted)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7273 |
x_dashes = dotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7274 |
x_nDash = sizeof(dotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7275 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7276 |
} else if (lineStyle == @symbol(dashDot)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7277 |
x_dashes = dashDotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7278 |
x_nDash = sizeof(dashDotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7279 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7280 |
} else if (lineStyle == @symbol(dashDotDot)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7281 |
x_dashes = dashDotDotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7282 |
x_nDash = sizeof(dashDotDotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7283 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7284 |
} else goto bad; |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7285 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7286 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7287 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7288 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7289 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7290 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7291 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7292 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7293 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7294 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7295 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7296 |
|
1974 | 7297 |
ENTER_XLIB(); |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7298 |
if (x_dashes) { |
2541 | 7299 |
XSetDashes(dpy, _GCVal(aGCId), 0, x_dashes, x_nDash); |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7300 |
} |
2541 | 7301 |
XSetLineAttributes(dpy, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7302 |
_GCVal(aGCId), __intVal(aNumber), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7303 |
x_style, x_cap, x_join); |
1974 | 7304 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7305 |
RETURN ( self ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7306 |
} |
295 | 7307 |
} |
7308 |
bad: ; |
|
7309 |
%}. |
|
7310 |
" |
|
7311 |
either aGCId is invalid, |
|
1455 | 7312 |
and/or lineWidth is not a smallInteger, |
295 | 7313 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
7314 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
7315 |
and/or joinStyle is none of #miter, #bevel, #round |
|
7316 |
" |
|
7317 |
self primitiveFailed |
|
7318 |
! |
|
7319 |
||
1344 | 7320 |
setMaskOriginX:orgX y:orgY in:aGCid |
295 | 7321 |
"set the mask origin" |
7322 |
||
7323 |
%{ /* NOCONTEXT */ |
|
7324 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7325 |
if (ISCONNECTED) { |
1344 | 7326 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
1974 | 7327 |
ENTER_XLIB(); |
1344 | 7328 |
XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
1974 | 7329 |
LEAVE_XLIB(); |
1344 | 7330 |
RETURN ( self ); |
7331 |
} |
|
295 | 7332 |
} |
7333 |
%}. |
|
7334 |
self primitiveFailed |
|
7335 |
! |
|
7336 |
||
1344 | 7337 |
setPixmapMask:aPixmapId in:aGCId |
295 | 7338 |
"set or clear the drawing mask - a pixmap mask providing full color" |
7339 |
||
7340 |
%{ /* NOCONTEXT */ |
|
7341 |
||
7342 |
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
|
7343 |
GC gc; |
295 | 7344 |
Pixmap pixmap; |
7345 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7346 |
if (ISCONNECTED) { |
1344 | 7347 |
if (__isExternalAddress(aGCId)) { |
7348 |
gc = _GCVal(aGCId); |
|
7349 |
if (__isExternalAddress(aPixmapId)) { |
|
7350 |
pixmap = _PixmapVal(aPixmapId); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7351 |
ENTER_XLIB(); |
1344 | 7352 |
XSetTile(dpy, gc, pixmap); |
7353 |
XSetFillStyle(dpy, gc, FillTiled); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7354 |
LEAVE_XLIB(); |
1344 | 7355 |
RETURN ( self ); |
7356 |
} |
|
7357 |
if (aPixmapId == nil) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7358 |
ENTER_XLIB(); |
1344 | 7359 |
XSetFillStyle(dpy, gc, FillSolid); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7360 |
LEAVE_XLIB(); |
1344 | 7361 |
RETURN ( self ); |
7362 |
} |
|
7363 |
} |
|
295 | 7364 |
} |
7365 |
%}. |
|
7366 |
self primitiveFailed |
|
7367 |
! ! |
|
7368 |
||
7369 |
!XWorkstation methodsFor:'initialize / release'! |
|
7370 |
||
1344 | 7371 |
closeConnection |
295 | 7372 |
"close down the connection to the X-server" |
7373 |
||
7374 |
%{ /* NOCONTEXT */ |
|
7375 |
||
7376 |
if (ISCONNECTED) { |
|
1344 | 7377 |
Display *dpy = myDpy; |
7378 |
||
7379 |
BEGIN_INTERRUPTSBLOCKED |
|
7380 |
__INST(displayId) = nil; |
|
1974 | 7381 |
ENTER_XLIB(); |
1344 | 7382 |
XCloseDisplay(dpy); |
1974 | 7383 |
LEAVE_XLIB(); |
1344 | 7384 |
END_INTERRUPTSBLOCKED |
295 | 7385 |
} |
7386 |
%} |
|
7387 |
! |
|
7388 |
||
1344 | 7389 |
initializeDefaultValues |
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
7390 |
activateOnClick := false. |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7391 |
super initializeDefaultValues. |
295 | 7392 |
! |
7393 |
||
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7394 |
initializeDeviceSignals |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7395 |
super initializeDeviceSignals. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7396 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7397 |
deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignalMayProceed:false. |
2856 | 7398 |
deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7399 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7400 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7401 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7402 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7403 |
! |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7404 |
|
1344 | 7405 |
initializeEventBuffer |
295 | 7406 |
|sz| |
7407 |
||
7408 |
%{ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
7409 |
sz = __MKSMALLINT(sizeof(XEvent) + 100); |
295 | 7410 |
%}. |
7411 |
eventBuffer isNil ifTrue:[ |
|
1344 | 7412 |
eventBuffer := ByteArray new:sz. |
295 | 7413 |
]. |
7414 |
! |
|
7415 |
||
1344 | 7416 |
initializeFor:aDisplayName |
295 | 7417 |
"initialize the receiver for a connection to an X-Server; |
7418 |
the argument, aDisplayName may be nil (for the default server from |
|
7419 |
DISPLAY-variable or command line argument) or the name of the server |
|
7420 |
as hostname:number" |
|
7421 |
||
334
8c851e8a0b05
access comandline args via access method
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
7422 |
|dpyName index arguments| |
295 | 7423 |
|
2286 | 7424 |
displayId notNil ifTrue:[ |
7425 |
"/ already connected - you bad guy try to trick me manually ? |
|
7426 |
^ self |
|
7427 |
]. |
|
7428 |
||
295 | 7429 |
dpyName := aDisplayName. |
7430 |
dpyName isNil ifTrue:[ |
|
1344 | 7431 |
"look for a '-display xxx' argument" |
7432 |
(arguments := Smalltalk commandLineArguments) notNil ifTrue:[ |
|
7433 |
index := arguments indexOf:'-display'. |
|
7434 |
(index between:1 and:(arguments size - 1)) ifTrue:[ |
|
7435 |
dpyName := arguments at:index+1 |
|
7436 |
] |
|
7437 |
] |
|
295 | 7438 |
]. |
2286 | 7439 |
|
7440 |
self openConnectionTo:dpyName. |
|
7441 |
||
295 | 7442 |
displayId isNil ifTrue:[ |
2286 | 7443 |
"/ could not connect. |
2287 | 7444 |
"/ only output a message, if running under X |
7445 |
||
2289 | 7446 |
((OperatingSystem isMSWINDOWSlike not) or:[WinWorkstation isNil]) ifTrue:[ |
2286 | 7447 |
'XWorkstation [warning]: cannot connect to Display.' errorPrintCR. |
7448 |
]. |
|
1344 | 7449 |
^ nil |
295 | 7450 |
]. |
7451 |
||
7452 |
dispatching := false. |
|
7453 |
dispatchingExpose := false. |
|
7454 |
isSlow := false. |
|
7455 |
shiftDown := false. |
|
7456 |
ctrlDown := false. |
|
7457 |
metaDown := false. |
|
7458 |
altDown := false. |
|
7459 |
motionEventCompression := true. |
|
7460 |
buttonsPressed := 0. |
|
7461 |
displayName := dpyName. |
|
7462 |
||
7463 |
protocolsAtom := nil. |
|
7464 |
deleteWindowAtom := nil. |
|
7465 |
saveYourselfAtom := nil. |
|
7466 |
quitAppAtom := nil. |
|
7467 |
||
7468 |
self initializeScreenProperties. |
|
1366 | 7469 |
self initializeDeviceResourceTables. |
295 | 7470 |
|
7471 |
self initializeDefaultValues. |
|
7472 |
self initializeEventBuffer. |
|
7473 |
self initializeSpecialFlags. |
|
7474 |
self initializeKeyboardMap. |
|
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7475 |
self initializeDeviceSignals. |
295 | 7476 |
! |
7477 |
||
1344 | 7478 |
initializeModifierMappings |
295 | 7479 |
|map mod| |
7480 |
||
7481 |
"/ altModifiers := #(Alt_L Alt_R). |
|
7482 |
"/ metaModifiers := #(Meta_L Meta_R). |
|
7483 |
"/ ctrlModifiers := #(Control_L Control_R). |
|
7484 |
"/ shiftModifiers := #(Shift_L Shift_R). |
|
7485 |
||
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7486 |
super initializeModifierMappings. |
295 | 7487 |
altModifierMask := metaModifierMask := nil. |
7488 |
||
7489 |
map := self modifierMapping. |
|
342 | 7490 |
map isNil ifTrue:[ |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7491 |
"/ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7492 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7493 |
"/ setup some reasonable default. If that is not sufficient, |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7494 |
"/ you have to change things from your display.rc file. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7495 |
"/ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7496 |
altModifierMask := self modifier1Mask. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7497 |
metaModifierMask := self modifier2Mask. |
342 | 7498 |
] ifFalse:[ |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7499 |
altModifierMask := 0. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7500 |
metaModifierMask := 0. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7501 |
|
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7502 |
mod := map at:1. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7503 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7504 |
shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7505 |
]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7506 |
mod := map at:3. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7507 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7508 |
ctrlModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7509 |
]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7510 |
mod := map at:4. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7511 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7512 |
metaModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7513 |
metaModifierMask := 1 bitShift:(4-1). |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7514 |
]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7515 |
mod := map at:5. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7516 |
mod notNil ifTrue:[ |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7517 |
altModifiers := mod collect:[ :key | self stringFromKeycode:key ]. |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7518 |
altModifierMask := 1 bitShift:(5-1). |
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7519 |
] |
295 | 7520 |
]. |
7521 |
||
7522 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
7523 |
! |
|
7524 |
||
1344 | 7525 |
initializeScreenProperties |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7526 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7527 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
7528 |
%{ |
295 | 7529 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7530 |
Display *dpy; |
295 | 7531 |
int scr; |
7532 |
Visual *visual; |
|
7533 |
XVisualInfo viproto; |
|
7534 |
XVisualInfo *vip; /* retured info */ |
|
7535 |
int maxRGBDepth; |
|
7536 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
7537 |
int rgbVisualID; |
|
7538 |
int nvi, i; |
|
7539 |
int shapeEventBase, shapeErrorBase; |
|
7540 |
int shmEventBase, shmErrorBase; |
|
7541 |
char *type, *nm; |
|
7542 |
int dummy; |
|
7543 |
int mask, shift, nBits; |
|
7544 |
||
7545 |
if (ISCONNECTED) { |
|
1344 | 7546 |
dpy = myDpy; |
7547 |
||
7548 |
__INST(altModifierMask) = __MKSMALLINT(Mod2Mask); |
|
7549 |
__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask); |
|
7550 |
||
7551 |
BEGIN_INTERRUPTSBLOCKED |
|
7552 |
||
7553 |
__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy)); |
|
7554 |
__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr)); |
|
7555 |
__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr)); |
|
7556 |
__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr)); |
|
7557 |
__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr)); |
|
7558 |
__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr)); |
|
7559 |
__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr)); |
|
7560 |
__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr)); |
|
7561 |
__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr)); |
|
295 | 7562 |
|
7563 |
#ifdef SHAPE |
|
1344 | 7564 |
if (XShapeQueryExtension(dpy, &dummy, &dummy)) |
7565 |
__INST(hasShapeExtension) = true; |
|
7566 |
else |
|
295 | 7567 |
#endif |
1344 | 7568 |
__INST(hasShapeExtension) = false; |
295 | 7569 |
|
7570 |
#ifdef SHM |
|
1344 | 7571 |
if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) |
7572 |
__INST(hasShmExtension) = true; |
|
7573 |
else |
|
295 | 7574 |
#endif |
1344 | 7575 |
__INST(hasShmExtension) = false; |
295 | 7576 |
|
7577 |
#ifdef DPS |
|
1344 | 7578 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) |
7579 |
__INST(hasDPSExtension) = true; |
|
7580 |
else |
|
295 | 7581 |
#endif |
1344 | 7582 |
__INST(hasDPSExtension) = false; |
295 | 7583 |
|
7584 |
#ifdef XVIDEO |
|
1344 | 7585 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) |
7586 |
__INST(hasXVideoExtension) = true; |
|
7587 |
else |
|
295 | 7588 |
#endif |
1344 | 7589 |
__INST(hasXVideoExtension) = false; |
295 | 7590 |
|
7591 |
#ifdef MBUF |
|
1344 | 7592 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) |
7593 |
__INST(hasMbufExtension) = true; |
|
7594 |
else |
|
295 | 7595 |
#endif |
1344 | 7596 |
__INST(hasMbufExtension) = false; |
295 | 7597 |
|
7598 |
#ifdef PEX5 |
|
1344 | 7599 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) |
7600 |
__INST(hasPEXExtension) = true; |
|
7601 |
else |
|
295 | 7602 |
#endif |
1344 | 7603 |
__INST(hasPEXExtension) = false; |
295 | 7604 |
|
7605 |
#ifdef XIE |
|
1344 | 7606 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) |
7607 |
__INST(hasImageExtension) = true; |
|
7608 |
else |
|
295 | 7609 |
#endif |
1344 | 7610 |
__INST(hasImageExtension) = false; |
295 | 7611 |
|
7612 |
#ifdef XI |
|
1344 | 7613 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) |
7614 |
__INST(hasInputExtension) = true; |
|
7615 |
else |
|
295 | 7616 |
#endif |
1344 | 7617 |
__INST(hasInputExtension) = false; |
7618 |
||
7619 |
/* |
|
7620 |
* look for RGB visual |
|
7621 |
*/ |
|
7622 |
nvi = 0; |
|
7623 |
viproto.screen = scr; |
|
7624 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
|
7625 |
maxRGBDepth = 0; |
|
7626 |
for (i = 0; i < nvi; i++) { |
|
7627 |
switch (vip[i].class) { |
|
7628 |
case TrueColor: |
|
7629 |
if (vip[i].depth > maxRGBDepth) { |
|
7630 |
maxRGBDepth = vip[i].depth; |
|
7631 |
rgbRedMask = vip[i].red_mask; |
|
7632 |
rgbGreenMask = vip[i].green_mask; |
|
7633 |
rgbBlueMask = vip[i].blue_mask; |
|
7634 |
rgbVisualID = vip[i].visualid; |
|
7635 |
} |
|
7636 |
break; |
|
7637 |
} |
|
7638 |
} |
|
7639 |
if (vip) XFree ((char *) vip); |
|
7640 |
||
7641 |
if (maxRGBDepth) { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
7642 |
__INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual); |
1344 | 7643 |
} |
7644 |
||
7645 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
7646 |
__INST(monitorType) = @symbol(unknown); |
|
7647 |
__INST(hasColors) = true; |
|
7648 |
__INST(hasGreyscales) = true; |
|
7649 |
switch (visual->class) { |
|
7650 |
case StaticGray: |
|
7651 |
__INST(visualType) = @symbol(StaticGray); |
|
7652 |
__INST(hasColors) = false; |
|
7653 |
__INST(monitorType) = @symbol(monochrome); |
|
7654 |
break; |
|
7655 |
case GrayScale: |
|
7656 |
__INST(visualType) = @symbol(GrayScale); |
|
7657 |
__INST(hasColors) = false; |
|
7658 |
__INST(monitorType) = @symbol(monochrome); |
|
7659 |
break; |
|
7660 |
case StaticColor: |
|
7661 |
__INST(visualType) = @symbol(StaticColor); |
|
7662 |
break; |
|
7663 |
case PseudoColor: |
|
7664 |
__INST(visualType) = @symbol(PseudoColor); |
|
7665 |
break; |
|
7666 |
case TrueColor: |
|
7667 |
__INST(visualType) = @symbol(TrueColor); |
|
7668 |
break; |
|
7669 |
case DirectColor: |
|
7670 |
__INST(visualType) = @symbol(DirectColor); |
|
7671 |
break; |
|
7672 |
} |
|
7673 |
if (DisplayCells(dpy, scr) == 2) { |
|
7674 |
__INST(hasColors) = false; |
|
7675 |
__INST(hasGreyscales) = false; |
|
7676 |
__INST(monitorType) = @symbol(monochrome); |
|
7677 |
} |
|
7678 |
__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb); |
|
7679 |
__INST(redMask) = __MKSMALLINT(visual->red_mask); |
|
7680 |
__INST(greenMask) = __MKSMALLINT(visual->green_mask); |
|
7681 |
__INST(blueMask) = __MKSMALLINT(visual->blue_mask); |
|
7682 |
switch (visual->class) { |
|
7683 |
case TrueColor: |
|
7684 |
/* extract number of bits and shift counts */ |
|
7685 |
mask = visual->red_mask; |
|
7686 |
shift = 0; |
|
7687 |
while (mask && ((mask & 1) == 0)) { |
|
7688 |
mask >>= 1; |
|
7689 |
shift++; |
|
7690 |
} |
|
7691 |
__INST(redShift) = __MKSMALLINT(shift); |
|
7692 |
nBits = 0; |
|
7693 |
while (mask) { |
|
7694 |
mask >>= 1; |
|
7695 |
nBits++; |
|
7696 |
} |
|
7697 |
__INST(bitsRed) = __MKSMALLINT(nBits); |
|
7698 |
||
7699 |
mask = visual->green_mask; |
|
7700 |
shift = 0; |
|
7701 |
while (mask && ((mask & 1) == 0)) { |
|
7702 |
mask >>= 1; |
|
7703 |
shift++; |
|
7704 |
} |
|
7705 |
__INST(greenShift) = __MKSMALLINT(shift); |
|
7706 |
nBits = 0; |
|
7707 |
while (mask) { |
|
7708 |
mask >>= 1; |
|
7709 |
nBits++; |
|
7710 |
} |
|
7711 |
__INST(bitsGreen) = __MKSMALLINT(nBits); |
|
7712 |
||
7713 |
mask = visual->blue_mask; |
|
7714 |
shift = 0; |
|
7715 |
while (mask && ((mask & 1) == 0)) { |
|
7716 |
mask >>= 1; |
|
7717 |
shift++; |
|
7718 |
} |
|
7719 |
__INST(blueShift) = __MKSMALLINT(shift); |
|
7720 |
nBits = 0; |
|
7721 |
while (mask) { |
|
7722 |
mask >>= 1; |
|
7723 |
nBits++; |
|
7724 |
} |
|
7725 |
__INST(bitsBlue) = __MKSMALLINT(nBits); |
|
7726 |
break; |
|
7727 |
} |
|
295 | 7728 |
|
7729 |
#ifndef XA_PRIMARY |
|
1344 | 7730 |
__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) ); |
295 | 7731 |
#else |
1344 | 7732 |
__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY ); |
295 | 7733 |
#endif |
7734 |
#ifndef XA_SECONDARY |
|
1344 | 7735 |
__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) ); |
295 | 7736 |
#else |
1344 | 7737 |
__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY ); |
295 | 7738 |
#endif |
7739 |
#ifndef XA_CUT_BUFFER0 |
|
1344 | 7740 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) ); |
295 | 7741 |
#else |
1344 | 7742 |
__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 ); |
295 | 7743 |
#endif |
7744 |
#ifndef XA_STRING |
|
1344 | 7745 |
__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) ); |
295 | 7746 |
#else |
1344 | 7747 |
__INST(stringAtom) = __MKATOMOBJ( XA_STRING ); |
295 | 7748 |
#endif |
7749 |
#ifndef XA_LENGTH |
|
1344 | 7750 |
__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) ); |
295 | 7751 |
#else |
1344 | 7752 |
__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH ); |
295 | 7753 |
#endif |
1533 | 7754 |
#ifndef WM_STATE |
7755 |
__INST(wmStateAtom) = __MKATOMOBJ( XInternAtom(dpy, "WM_STATE", True) ); |
|
7756 |
#else |
|
7757 |
__INST(wmStateAtom) = __MKATOMOBJ( WM_STATE ); |
|
7758 |
#endif |
|
295 | 7759 |
|
1344 | 7760 |
END_INTERRUPTSBLOCKED |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7761 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
7762 |
%}. |
295 | 7763 |
! |
7764 |
||
1344 | 7765 |
initializeSpecialFlags |
295 | 7766 |
"perform additional special server implementation flags" |
7767 |
||
7768 |
"/ |
|
7769 |
"/ assume we have it ... (should check) |
|
7770 |
"/ |
|
7771 |
hasSaveUnder := true. |
|
7772 |
ignoreBackingStore := false. |
|
7773 |
||
7774 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
1344 | 7775 |
"/ |
7776 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
7777 |
"/ which does not correctly handle saveUnder |
|
7778 |
"/ |
|
7779 |
hasSaveUnder := false. |
|
295 | 7780 |
]. |
7781 |
! |
|
7782 |
||
2286 | 7783 |
openConnectionTo:dpyName |
7784 |
"open a connection to some display; |
|
7785 |
set my displayId if ok; leaves it as nil of not ok" |
|
7786 |
||
7787 |
%{ |
|
7788 |
Display *dpy; |
|
7789 |
int i; |
|
7790 |
char *nm; |
|
7791 |
||
7792 |
if (__INST(displayId) != nil) { |
|
7793 |
/* |
|
7794 |
* already connected - you bad guy try to |
|
7795 |
* trick me manually ? |
|
7796 |
*/ |
|
7797 |
RETURN ( self ); |
|
7798 |
} |
|
7799 |
||
7800 |
BEGIN_INTERRUPTSBLOCKED |
|
7801 |
||
7802 |
if (__isString(dpyName)) |
|
7803 |
nm = (char *) __stringVal(dpyName); |
|
7804 |
else { |
|
7805 |
dpyName = __MKSTRING((char *)getenv("DISPLAY")); |
|
7806 |
nm = NULL; |
|
7807 |
} |
|
7808 |
dpy = XOpenDisplay(nm); |
|
7809 |
||
7810 |
if (dpy) { |
|
7811 |
static int firstCall = 1; |
|
7812 |
OBJ dpyID; |
|
7813 |
||
7814 |
__INST(displayId) = dpyID = __MKEXTERNALADDRESS(dpy); __STORE(self, dpyID); |
|
7815 |
||
7816 |
if (firstCall) { |
|
7817 |
firstCall = 0; |
|
7818 |
XSetErrorHandler(__XErrorHandler__); |
|
7819 |
XSetIOErrorHandler(__XIOErrorHandler__); |
|
7820 |
} |
|
7821 |
} |
|
7822 |
||
7823 |
END_INTERRUPTSBLOCKED |
|
7824 |
%} |
|
7825 |
! |
|
7826 |
||
1344 | 7827 |
reinitialize |
295 | 7828 |
virtualRootId := rootId := nil. |
7829 |
super reinitialize. |
|
7830 |
dispatchingExpose := nil |
|
7831 |
! ! |
|
7832 |
||
7833 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
7834 |
||
1344 | 7835 |
altModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7836 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7837 |
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
|
7838 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7839 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7840 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7841 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7842 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7843 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7844 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7845 |
|
1344 | 7846 |
altModifierMask:aSmallInteger |
341 | 7847 |
"define which key takes the role of an alt-key. |
7848 |
By default, this is X's modifier1, which is the ALT key on |
|
7849 |
most keyboards. However, there may be exceptions to this, |
|
7850 |
and the setting can be changed with: |
|
1344 | 7851 |
Display altModifierMask:(Display modifier2Mask) |
341 | 7852 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
7853 |
" |
|
7854 |
||
7855 |
altModifierMask := aSmallInteger |
|
7856 |
! |
|
7857 |
||
1344 | 7858 |
metaModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7859 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7860 |
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
|
7861 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7862 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7863 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7864 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7865 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7866 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7867 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
7868 |
|
1344 | 7869 |
metaModifierMask:aSmallInteger |
341 | 7870 |
"define which key takes the role of a meta key. |
7871 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
7872 |
most keyboards (if present at all). |
|
7873 |
However, there may be exceptions to this, and the setting can |
|
7874 |
be changed with: |
|
1344 | 7875 |
Display metaModifierMask:(Display modifier1Mask) |
341 | 7876 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
7877 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
7878 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
7879 |
all the time. On those, you should disable the meta key by setting |
|
7880 |
the mask to 0. |
|
7881 |
" |
|
7882 |
||
7883 |
metaModifierMask := aSmallInteger |
|
7884 |
! |
|
7885 |
||
1344 | 7886 |
modifier1Mask |
341 | 7887 |
"return the Xlib mask bit for the 1st modifier key. |
7888 |
See comment in altModifierMask: / metaModifierMask: for what |
|
7889 |
this could be used." |
|
7890 |
||
7891 |
%{ /* NOCONTEXT */ |
|
7892 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
7893 |
%} |
|
7894 |
! |
|
7895 |
||
1344 | 7896 |
modifier2Mask |
341 | 7897 |
"return the Xlib mask bit for the 2nd modifier key. |
7898 |
See comment in altModifierMask: / metaModifierMask: for what |
|
7899 |
this could be used." |
|
7900 |
||
7901 |
%{ /* NOCONTEXT */ |
|
7902 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
7903 |
%} |
|
7904 |
! |
|
7905 |
||
1344 | 7906 |
modifierMapping |
341 | 7907 |
"Get the Modifier Mapping. |
7908 |
We return an array of arrays of keycodes" |
|
7909 |
||
7910 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
7911 |
||
7912 |
%{ |
|
7913 |
XModifierKeymap *modmap; |
|
7914 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
7915 |
||
7916 |
if (ISCONNECTED) { |
|
1344 | 7917 |
Display *dpy = myDpy; |
7918 |
||
2541 | 7919 |
if ((modmap = XGetModifierMapping(dpy)) != 0) { |
1344 | 7920 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
7921 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
|
7922 |
if (modifierKeyMap != nil) { |
|
7923 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
|
7924 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
|
7925 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
|
7926 |
} |
|
7927 |
XFreeModifiermap(modmap); |
|
7928 |
} |
|
341 | 7929 |
} |
7930 |
%}. |
|
7931 |
||
7932 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
7933 |
||
7934 |
ret := Array new:8. |
|
7935 |
nextKey := 1. |
|
7936 |
1 to:8 do:[ :i | |
|
1344 | 7937 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
7938 |
|mod| |
|
7939 |
||
7940 |
mod := OrderedCollection new:maxKeyPerMod. |
|
7941 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
7942 |
key ~= 0 ifTrue:[ |
|
7943 |
mod add:key |
|
7944 |
]. |
|
7945 |
]. |
|
7946 |
ret at:i put:mod. |
|
7947 |
]. |
|
7948 |
nextKey := nextKey+maxKeyPerMod. |
|
341 | 7949 |
]. |
7950 |
||
7951 |
^ ret |
|
7952 |
||
7953 |
" |
|
1344 | 7954 |
Display modifierMapping |
341 | 7955 |
" |
7956 |
! |
|
7957 |
||
1344 | 7958 |
stringFromKeycode:code |
341 | 7959 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
7960 |
||
7961 |
|str| |
|
7962 |
||
7963 |
%{ |
|
7964 |
KeySym keysym; |
|
7965 |
char *keystring; |
|
7966 |
||
7967 |
if (ISCONNECTED && __isSmallInteger(code)) { |
|
1344 | 7968 |
Display *dpy = myDpy; |
7969 |
||
2541 | 7970 |
if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol && |
1344 | 7971 |
(keystring = XKeysymToString(keysym)) != 0) |
7972 |
str = __MKSTRING(keystring); |
|
341 | 7973 |
} |
7974 |
%}. |
|
7975 |
^ str |
|
7976 |
||
7977 |
" |
|
1344 | 7978 |
Display stringFromKeycode:28 |
341 | 7979 |
" |
7980 |
! |
|
7981 |
||
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7982 |
translateKey:untranslatedKey forView:aView |
295 | 7983 |
"Return the key translated via the translation table. |
7984 |
Here, we preTranslate the key into a common ST/X symbolic name, |
|
7985 |
which gets further processed in the superclasses translation method." |
|
7986 |
||
7987 |
|key| |
|
7988 |
||
7989 |
(key := untranslatedKey) isString ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7990 |
key := RawKeysymTranslation at:key ifAbsent:key. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7991 |
key := key asSymbol. |
295 | 7992 |
]. |
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
7993 |
^ super translateKey:key forView:aView |
295 | 7994 |
! ! |
7995 |
||
7996 |
!XWorkstation methodsFor:'misc'! |
|
7997 |
||
1344 | 7998 |
beep |
295 | 7999 |
"output an audible beep or bell" |
8000 |
||
1906 | 8001 |
NoBeep ~~ true ifTrue:[ |
8002 |
self beep:50 |
|
8003 |
] |
|
295 | 8004 |
! |
8005 |
||
1344 | 8006 |
beep:volumeInPercent |
295 | 8007 |
"output an audible beep" |
8008 |
%{ |
|
8009 |
int volume; |
|
8010 |
||
8011 |
if (__isSmallInteger(volumeInPercent) && ISCONNECTED) { |
|
1344 | 8012 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
8013 |
volume = __intVal(volumeInPercent) * 2 - 100; |
|
8014 |
if (volume < -100) volume = -100; |
|
8015 |
else if (volume > 100) volume = 100; |
|
8016 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8017 |
ENTER_XLIB(); |
1344 | 8018 |
XBell(myDpy, volume); |
1974 | 8019 |
LEAVE_XLIB(); |
1344 | 8020 |
END_INTERRUPTSBLOCKED |
295 | 8021 |
} |
8022 |
%} |
|
8023 |
! |
|
8024 |
||
1344 | 8025 |
buffered |
295 | 8026 |
"buffer drawing - do not send it immediately to the display. |
374 | 8027 |
This is the default anyway. |
8028 |
See #unBuffered for additional info." |
|
295 | 8029 |
|
8030 |
%{ /* NOCONTEXT */ |
|
8031 |
||
8032 |
if (ISCONNECTED) { |
|
1344 | 8033 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8034 |
ENTER_XLIB(); |
1344 | 8035 |
XSynchronize(myDpy, 0); |
1974 | 8036 |
LEAVE_XLIB(); |
1344 | 8037 |
END_INTERRUPTSBLOCKED |
295 | 8038 |
} |
8039 |
%} |
|
374 | 8040 |
" |
8041 |
Display buffered |
|
8042 |
" |
|
295 | 8043 |
! |
8044 |
||
1344 | 8045 |
flush |
295 | 8046 |
"send all buffered drawing to the display. |
8047 |
This may be required to make certain, that all previous operations |
|
8048 |
are really sent to the display before continuing. For example, |
|
8049 |
after a cursor-change with a followup long computation. |
|
374 | 8050 |
(otherwise, the cursor change request may still be in the output buffer) |
8051 |
See also #sync, which even waits until the request has been processed." |
|
295 | 8052 |
|
8053 |
%{ /* NOCONTEXT */ |
|
8054 |
||
8055 |
if (ISCONNECTED) { |
|
1344 | 8056 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8057 |
ENTER_XLIB(); |
1344 | 8058 |
XFlush(myDpy); |
1974 | 8059 |
LEAVE_XLIB(); |
1344 | 8060 |
END_INTERRUPTSBLOCKED |
310 | 8061 |
} |
8062 |
%} |
|
8063 |
! |
|
8064 |
||
1344 | 8065 |
flushDpsContext:aDPSContext |
295 | 8066 |
|
8067 |
%{ /* NOCONTEXT */ |
|
8068 |
#ifdef DPS |
|
8069 |
if (__isExternalAddress(aDPSContext)) { |
|
1344 | 8070 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8071 |
ENTER_XLIB(); |
1344 | 8072 |
DPSFlushContext(MKDPSCONTEXT(aDPSContext)); |
1974 | 8073 |
LEAVE_XLIB(); |
1344 | 8074 |
END_INTERRUPTSBLOCKED |
8075 |
RETURN ( self ); |
|
295 | 8076 |
} |
8077 |
#endif |
|
374 | 8078 |
%}. |
295 | 8079 |
self primitiveFailed |
8080 |
! |
|
8081 |
||
1344 | 8082 |
refreshKeyboardMapping:eB |
295 | 8083 |
%{ |
8084 |
XMappingEvent *ev; |
|
8085 |
||
8086 |
if (__isByteArray(eB)) { |
|
1344 | 8087 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1974 | 8088 |
ENTER_XLIB(); |
1344 | 8089 |
XRefreshKeyboardMapping(ev); |
1974 | 8090 |
LEAVE_XLIB(); |
295 | 8091 |
} |
8092 |
%} |
|
8093 |
! |
|
8094 |
||
1344 | 8095 |
setInputFocusTo:aWindowId |
2871 | 8096 |
"set the focus to the view as defined by aWindowId. |
8097 |
When released, return the focus to the root window" |
|
8098 |
||
295 | 8099 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
8100 |
self setInputFocusTo:aWindowId revertTo:#root |
|
8101 |
! |
|
8102 |
||
1344 | 8103 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
295 | 8104 |
"set the focus to the view as defined by aWindowId. |
8105 |
Passing nil set the focus to no window and lets the display discard all |
|
8106 |
input until a new focus is set. |
|
8107 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
8108 |
passing one of #parent, #root or nil specifies that the focus should be |
|
8109 |
given to the parent view, the root view or no view." |
|
8110 |
||
8111 |
%{ /* NOCONTEXT */ |
|
8112 |
int arg; |
|
8113 |
Window focusWindow; |
|
8114 |
||
8115 |
if (ISCONNECTED) { |
|
1344 | 8116 |
if (__isExternalAddress(aWindowId)) { |
8117 |
focusWindow = _WindowVal(aWindowId); |
|
8118 |
} else { |
|
8119 |
focusWindow = None; |
|
8120 |
} |
|
8121 |
if (revertSymbol == @symbol(parent)) |
|
8122 |
arg = RevertToParent; |
|
8123 |
else if (revertSymbol == @symbol(root)) |
|
8124 |
arg = RevertToPointerRoot; |
|
8125 |
else |
|
8126 |
arg = RevertToNone; |
|
8127 |
||
8128 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8129 |
ENTER_XLIB(); |
1344 | 8130 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
1974 | 8131 |
LEAVE_XLIB(); |
1344 | 8132 |
END_INTERRUPTSBLOCKED |
8133 |
RETURN ( self ); |
|
295 | 8134 |
} |
8135 |
%}. |
|
8136 |
self primitiveFailed |
|
8137 |
! |
|
8138 |
||
1344 | 8139 |
sync |
341 | 8140 |
"send all buffered drawing to the display AND wait until the display |
8141 |
has finished drawing it. |
|
8142 |
This is almost never needed, except if you are about to read previously |
|
374 | 8143 |
drawn pixels back from the display screen, or you want to wait for a beep |
8144 |
to be finished. See also #flush." |
|
341 | 8145 |
|
8146 |
%{ /* NOCONTEXT */ |
|
8147 |
||
8148 |
if (ISCONNECTED) { |
|
1344 | 8149 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8150 |
ENTER_XLIB(); |
1344 | 8151 |
XSync(myDpy, 0); |
1974 | 8152 |
LEAVE_XLIB(); |
1344 | 8153 |
END_INTERRUPTSBLOCKED |
341 | 8154 |
} |
8155 |
%} |
|
8156 |
! |
|
8157 |
||
1344 | 8158 |
unBuffered |
374 | 8159 |
"make all drawing be sent immediately to the display. |
8160 |
This makes all graphics synchronous and turns off any buffering |
|
8161 |
(i.e. each individual draw-request is sent immediately without |
|
8162 |
packing multiple requests into a larger message buffer). |
|
8163 |
Be prepared, that this slows down graphics considerably. |
|
8164 |
However, it allows display errors to be handled immediately and |
|
8165 |
may be useful if you get Xdisplay errors and want to find the request |
|
1813 | 8166 |
which was responsible for it. See also #buffered." |
295 | 8167 |
|
8168 |
%{ /* NOCONTEXT */ |
|
8169 |
||
8170 |
if (ISCONNECTED) { |
|
1344 | 8171 |
BEGIN_INTERRUPTSBLOCKED |
1974 | 8172 |
ENTER_XLIB(); |
1344 | 8173 |
XSynchronize(myDpy, 1); |
1974 | 8174 |
LEAVE_XLIB(); |
1344 | 8175 |
END_INTERRUPTSBLOCKED |
295 | 8176 |
} |
8177 |
%} |
|
1813 | 8178 |
" |
8179 |
Display unBuffered |
|
8180 |
" |
|
295 | 8181 |
! ! |
8182 |
||
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8183 |
!XWorkstation methodsFor:'pointer stuff'! |
295 | 8184 |
|
1344 | 8185 |
anyButtonStateMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8186 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8187 |
buttonStates value." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8188 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8189 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8190 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8191 |
^ 256 + 512 + 1024 |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8192 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8193 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8194 |
"Created: 23.3.1996 / 12:46:35 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8195 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8196 |
|
1344 | 8197 |
buttonStates |
295 | 8198 |
"return an integer representing the state of the pointer buttons; |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8199 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8200 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8201 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 8202 |
|
8203 |
%{ /* NOCONTEXT*/ |
|
8204 |
Window w; |
|
555 | 8205 |
int screen = __intVal(__INST(screen)); |
295 | 8206 |
Window rootRet, childRet; |
8207 |
int rootX, rootY, winX, winY; |
|
8208 |
unsigned int mask; |
|
8209 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8210 |
if (ISCONNECTED) { |
1906 | 8211 |
Display *dpy = myDpy; |
8212 |
||
8213 |
BEGIN_INTERRUPTSBLOCKED |
|
295 | 8214 |
#ifdef VIRTUAL_ROOT |
2541 | 8215 |
w = getRootWindow(dpy, screen); |
295 | 8216 |
#else |
1906 | 8217 |
w = RootWindow(dpy, screen); |
295 | 8218 |
#endif |
1906 | 8219 |
END_INTERRUPTSBLOCKED |
8220 |
if (w) { |
|
8221 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 8222 |
ENTER_XLIB(); |
1906 | 8223 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
8224 |
&rootX, &rootY, |
|
8225 |
&winX, &winY, |
|
8226 |
&mask); |
|
1974 | 8227 |
LEAVE_XLIB(); |
1906 | 8228 |
END_INTERRUPTSBLOCKED |
8229 |
RETURN (__MKSMALLINT(mask)); |
|
8230 |
} |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8231 |
} |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8232 |
%}. |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8233 |
self primitiveFailed |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8234 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8235 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8236 |
Display buttonStates |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8237 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8238 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8239 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8240 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8241 |
Display buttonStates bitTest:(Display controlMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8242 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8243 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8244 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8245 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8246 |
Display buttonStates bitTest:(Display altModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8247 |
Display buttonStates bitTest:(Display metaModifierMask) |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8248 |
" |
295 | 8249 |
! |
8250 |
||
1344 | 8251 |
leftButtonStateMask |
295 | 8252 |
"return an integer for masking out the left button from a |
8253 |
buttonStates value" |
|
8254 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8255 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8256 |
|
295 | 8257 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8258 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8259 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 8260 |
! |
8261 |
||
1344 | 8262 |
middleButtonStateMask |
295 | 8263 |
"return an integer for masking out the middle button from a |
8264 |
buttonStates value" |
|
8265 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8266 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8267 |
|
295 | 8268 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8269 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8270 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 8271 |
! |
8272 |
||
1344 | 8273 |
pointerPosition |
295 | 8274 |
"return the current pointer position in root-window coordinates" |
8275 |
||
8276 |
|xpos ypos| |
|
8277 |
||
8278 |
%{ |
|
8279 |
Window w; |
|
555 | 8280 |
int screen = __intVal(__INST(screen)); |
295 | 8281 |
Window rootRet, childRet; |
8282 |
int rootX, rootY, winX, winY; |
|
8283 |
unsigned int mask; |
|
8284 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8285 |
if (ISCONNECTED) { |
1344 | 8286 |
Display *dpy = myDpy; |
8287 |
||
8288 |
BEGIN_INTERRUPTSBLOCKED |
|
295 | 8289 |
#ifdef VIRTUAL_ROOT |
2541 | 8290 |
w = getRootWindow(dpy, screen); |
295 | 8291 |
#else |
1344 | 8292 |
w = RootWindow(dpy, screen); |
295 | 8293 |
#endif |
1974 | 8294 |
ENTER_XLIB(); |
1344 | 8295 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
8296 |
&rootX, &rootY, |
|
8297 |
&winX, &winY, |
|
8298 |
&mask); |
|
1974 | 8299 |
LEAVE_XLIB(); |
1344 | 8300 |
xpos = __MKSMALLINT(rootX); |
8301 |
ypos = __MKSMALLINT(rootY); |
|
8302 |
END_INTERRUPTSBLOCKED |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8303 |
} |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8304 |
%}. |
295 | 8305 |
^ xpos @ ypos |
8306 |
! |
|
8307 |
||
1344 | 8308 |
rightButtonStateMask |
295 | 8309 |
"return an integer for masking out the right button from a |
8310 |
buttonStates value" |
|
8311 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8312 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8313 |
|
295 | 8314 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8315 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8316 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 8317 |
! |
8318 |
||
1344 | 8319 |
rootPositionOfLastEvent |
295 | 8320 |
"return the position in root-window coordinates |
8321 |
of the last button, key or pointer event" |
|
8322 |
||
8323 |
^ eventRootX @ eventRootY |
|
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8324 |
! |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8325 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8326 |
setPointerPosition:newPosition in:aWindowId |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8327 |
"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
|
8328 |
given windows origin (which may be the rootWindow). |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8329 |
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
|
8330 |
to change the mousePointer position. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8331 |
This interface is provided for special applications (presentation |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8332 |
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
|
8333 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8334 |
|xpos ypos| |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8335 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8336 |
xpos := newPosition x. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8337 |
ypos := newPosition y. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8338 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8339 |
%{ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8340 |
if (ISCONNECTED |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8341 |
&& __isExternalAddress(aWindowId) |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8342 |
&& __bothSmallInteger(xpos, ypos)) { |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8343 |
Display *dpy = myDpy; |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8344 |
Window w = _WindowVal(aWindowId); |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8345 |
|
1974 | 8346 |
ENTER_XLIB(); |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8347 |
XWarpPointer(dpy, |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8348 |
None, /* src window */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8349 |
w, /* dst window */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8350 |
0, /* src_x */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8351 |
0, /* src_y */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8352 |
0, /* src_w */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8353 |
0, /* src_h */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8354 |
__intVal(xpos), /* dst_x */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8355 |
__intVal(ypos) /* dst_y */ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8356 |
); |
1974 | 8357 |
LEAVE_XLIB(); |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8358 |
} |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8359 |
%}. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8360 |
^ self |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8361 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8362 |
" |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8363 |
Display setPointerPosition:1000@1000 |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
8364 |
" |
295 | 8365 |
! ! |
8366 |
||
1556 | 8367 |
!XWorkstation methodsFor:'properties'! |
8368 |
||
8369 |
getObjectProperty:propertyID from:aWindowID |
|
8370 |
"get an object property from the server; return object or nil" |
|
8371 |
||
8372 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8373 |
type == stringAtom ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8374 |
^ value |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8375 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8376 |
(value isMemberOf:ByteArray) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8377 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8378 |
] |
1556 | 8379 |
]. |
8380 |
^ nil |
|
8381 |
||
8382 |
"Modified: 6.4.1997 / 13:27:07 / cg" |
|
8383 |
! |
|
8384 |
||
8385 |
getProperty:propertyID from:aWindowID into:aTwoArgBlock |
|
8386 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
|
8387 |
||
8388 |
|val typeID cls| |
|
8389 |
||
8390 |
cls := ByteArray. |
|
8391 |
%{ |
|
8392 |
Window window; |
|
8393 |
Atom property; |
|
8394 |
char *cp, *cp2; |
|
8395 |
Atom actual_type; |
|
8396 |
int actual_format,i; |
|
8397 |
unsigned long nitems, bytes_after, nread; |
|
8398 |
unsigned char *data; |
|
8399 |
int ok = 1; |
|
8400 |
# define PROP_SIZE 2048 |
|
8401 |
||
8402 |
if (ISCONNECTED) { |
|
8403 |
Display *dpy = myDpy; |
|
8404 |
||
8405 |
if (__isAtomID(propertyID)) { |
|
8406 |
property = _AtomVal(propertyID); |
|
8407 |
if (__isExternalAddress(aWindowID)) { |
|
8408 |
window = _WindowVal(aWindowID); |
|
8409 |
} else { |
|
8410 |
window = DefaultRootWindow(dpy); |
|
8411 |
} |
|
8412 |
||
8413 |
nread = 0; |
|
8414 |
cp = 0; |
|
8415 |
/* |
|
8416 |
fprintf(stderr, "getProperty: "); |
|
8417 |
*/ |
|
8418 |
do { |
|
8419 |
if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False, |
|
8420 |
AnyPropertyType,&actual_type,&actual_format, |
|
8421 |
&nitems,&bytes_after,(unsigned char **)&data) |
|
8422 |
!= Success) { |
|
8423 |
ok = 0; |
|
8424 |
break; |
|
8425 |
} |
|
8426 |
typeID = __MKATOMOBJ(actual_type); |
|
8427 |
if (! cp) { |
|
8428 |
cp = cp2 = (char *)malloc(nitems+1); |
|
8429 |
} else { |
|
8430 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
8431 |
cp2 = cp + nread; |
|
8432 |
} |
|
8433 |
if (! cp) { |
|
8434 |
XFree(data); |
|
8435 |
goto fail; |
|
8436 |
} |
|
8437 |
||
8438 |
nread += nitems; |
|
8439 |
bcopy(data, cp2, nitems); |
|
8440 |
XFree(data); |
|
8441 |
/* |
|
8442 |
fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after); |
|
8443 |
*/ |
|
8444 |
} while (bytes_after > 0); |
|
8445 |
/* |
|
8446 |
fprintf(stderr, "\n"); |
|
8447 |
*/ |
|
8448 |
||
8449 |
if (ok) { |
|
8450 |
if (actual_type == XA_STRING) { |
|
8451 |
cp[nread] = '\0'; |
|
8452 |
val = __MKSTRING_L(cp, nread); |
|
8453 |
} else { |
|
2449
5fdfb68d0bcc
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
2428
diff
changeset
|
8454 |
val = __STX___new(nread + OHDR_SIZE); |
1556 | 8455 |
val->o_class = cls; |
8456 |
bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread); |
|
8457 |
} |
|
8458 |
} |
|
8459 |
if (cp) |
|
8460 |
free(cp); |
|
8461 |
} |
|
8462 |
} |
|
8463 |
fail: ; |
|
8464 |
%}. |
|
8465 |
typeID isNil ifTrue:[ |
|
8466 |
^ false |
|
8467 |
]. |
|
8468 |
aTwoArgBlock value:typeID value:val. |
|
8469 |
^ true |
|
8470 |
! |
|
8471 |
||
8472 |
getTextProperty:propertyID from:aWindowID |
|
8473 |
"get a text property; return string or nil" |
|
8474 |
||
1798 | 8475 |
|stringClass| |
8476 |
||
1556 | 8477 |
self getProperty:propertyID from:aWindowID into:[:type :value | |
1906 | 8478 |
type == stringAtom ifTrue:[ |
8479 |
clipBoardEncoding notNil ifTrue:[ |
|
8480 |
stringClass := (CharacterArray classForEncoding:clipBoardEncoding). |
|
8481 |
stringClass ~~ String ifTrue:[ |
|
8482 |
^ stringClass fromBytes:(value asByteArray) |
|
8483 |
]. |
|
8484 |
^ value decodeFrom:clipBoardEncoding |
|
8485 |
]. |
|
8486 |
^ value |
|
8487 |
] |
|
1556 | 8488 |
]. |
8489 |
^ nil |
|
1793 | 8490 |
|
1798 | 8491 |
"Modified: 30.6.1997 / 20:54:59 / cg" |
1556 | 8492 |
! |
8493 |
||
8494 |
setLengthProperty:propertyID value:aNumber for:aWindowID |
|
8495 |
"set a size property" |
|
8496 |
||
8497 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8498 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8499 |
type:(self atomIDOfLENGTH) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8500 |
value:aNumber |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8501 |
for:aWindowID |
1556 | 8502 |
|
8503 |
"Modified: 6.4.1997 / 13:27:26 / cg" |
|
8504 |
! |
|
8505 |
||
8506 |
setObjectProperty:propertyID value:anObject for:aWindowID |
|
8507 |
"set a property to a smalltalk object in the XServer. |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8508 |
Non-strings can only be retrieved by another ST/X smalltalk" |
1556 | 8509 |
|
8510 |
|s| |
|
8511 |
||
8512 |
(anObject isMemberOf:String) ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8513 |
^ self setTextProperty:propertyID value:anObject for:aWindowID |
1556 | 8514 |
]. |
8515 |
s := WriteStream on:(ByteArray new:200). |
|
8516 |
anObject storeBinaryOn:s. |
|
8517 |
^ self |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8518 |
setProperty:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8519 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8520 |
value:(s contents) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8521 |
for:aWindowID |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8522 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8523 |
"Modified: / 17.6.1998 / 17:23:49 / cg" |
1556 | 8524 |
! |
8525 |
||
8526 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
|
8527 |
"set a property in the XServer" |
|
8528 |
||
8529 |
%{ /* UNLIMITEDSTACK */ |
|
8530 |
if (__isAtomID(propertyID) |
|
8531 |
&& __isAtomID(typeID) |
|
8532 |
&& ISCONNECTED |
|
8533 |
&& (__isString(anObject) |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8534 |
|| __isSmallInteger(anObject) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8535 |
|| __isSymbol(anObject) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8536 |
|| __isByteArray(anObject) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8537 |
|| __isWords(anObject))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8538 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8539 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8540 |
Atom prop, type; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8541 |
Window window; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8542 |
unsigned INT value; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8543 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8544 |
prop = _AtomVal(propertyID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8545 |
type = _AtomVal(typeID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8546 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8547 |
if (__isExternalAddress(aWindowID)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8548 |
window = _WindowVal(aWindowID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8549 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8550 |
window = DefaultRootWindow(dpy); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8551 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8552 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8553 |
if (__isSmallInteger(anObject)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8554 |
value = __intVal(anObject); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8555 |
XChangeProperty(dpy, window, prop, type, 32, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8556 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8557 |
(unsigned char *)(&value), sizeof(unsigned int)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8558 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8559 |
if (__isByteArray(anObject)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8560 |
XChangeProperty(dpy, window, prop, type, 8, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8561 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8562 |
__ByteArrayInstPtr(anObject)->ba_element, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8563 |
__byteArraySize(anObject)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8564 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8565 |
/* string or symbol or wordArray-like (16bit-string) object */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8566 |
if (__isWords(__qClass(anObject))) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8567 |
XChangeProperty(dpy, window, prop, type, 16, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8568 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8569 |
__stringVal(anObject), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8570 |
__wordArraySize(anObject)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8571 |
} else { |
2176 | 8572 |
/* must be string or symbol */ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8573 |
XChangeProperty(dpy, window, prop, type, 8, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8574 |
PropModeReplace, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8575 |
__stringVal(anObject), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8576 |
__stringSize(anObject)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8577 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8578 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8579 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8580 |
DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8581 |
RETURN (true); |
1556 | 8582 |
} |
8583 |
%}. |
|
8584 |
^ false |
|
8585 |
! |
|
8586 |
||
8587 |
setTextProperty:propertyID value:aString for:aWindowID |
|
8588 |
"set a property to a stringValue in the XServer" |
|
8589 |
||
8590 |
^ self |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8591 |
setProperty:propertyID |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8592 |
type:(self atomIDOfSTRING) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8593 |
value:aString |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
8594 |
for:aWindowID |
1556 | 8595 |
|
8596 |
"Modified: 6.4.1997 / 13:26:32 / cg" |
|
8597 |
! ! |
|
8598 |
||
295 | 8599 |
!XWorkstation methodsFor:'resources'! |
8600 |
||
1344 | 8601 |
atomIDOf:aStringOrSymbol |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8602 |
"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
|
8603 |
This is highly X specific and only for local use (with selections)." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8604 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8605 |
^ self atomIDOf:aStringOrSymbol create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8606 |
|
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 |
Display atomIDOf:'FACE_NAME' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8609 |
Display atomIDOf:'FULL_NAME' |
1535 | 8610 |
Display atomIDOf:'DndProtocol' |
8611 |
Display atomIDOf:'DndSelection' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8612 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8613 |
|
1535 | 8614 |
"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
|
8615 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8616 |
|
1344 | 8617 |
atomIDOf:aStringOrSymbol create:create |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8618 |
"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
|
8619 |
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
|
8620 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8621 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8622 |
Atom prop; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8623 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8624 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8625 |
&& __isNonNilObject(aStringOrSymbol) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8626 |
&& (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8627 |
prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8628 |
(create == true) ? False : True); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8629 |
if (prop == None) { |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8630 |
RETURN (nil); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8631 |
} |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8632 |
RETURN ( __MKATOMOBJ(prop) ); |
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 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8635 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8636 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8637 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8638 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8639 |
Display atomIDOf:'VT_SELECTION' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8640 |
Display atomIDOf:'CUT_BUFFER0' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8641 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8642 |
Display atomIDOf:'PRIMARY' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8643 |
Display atomIDOfPRIMARY |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8644 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8645 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8646 |
|
1344 | 8647 |
atomIDOfCUTBUFFER0 |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8648 |
"return the CUTBUFFER0 AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8649 |
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
|
8650 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8651 |
^ cutBuffer0Atom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8652 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8653 |
"Modified: 2.3.1996 / 15:10:36 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8654 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8655 |
|
1344 | 8656 |
atomIDOfLENGTH |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8657 |
"return the LENGTH AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8658 |
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
|
8659 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8660 |
^ lengthAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8661 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8662 |
"Modified: 2.3.1996 / 15:10:41 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8663 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8664 |
|
1344 | 8665 |
atomIDOfPRIMARY |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8666 |
"return the PRIMARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8667 |
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
|
8668 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8669 |
^ primaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8670 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8671 |
"Modified: 2.3.1996 / 15:10:49 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8672 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8673 |
|
1344 | 8674 |
atomIDOfSECONDARY |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8675 |
"return the SECONDARY AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8676 |
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
|
8677 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8678 |
^ secondaryAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8679 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8680 |
"Modified: 2.3.1996 / 15:10:59 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8681 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8682 |
|
1344 | 8683 |
atomIDOfSTRING |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8684 |
"return the STRING AtomID. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8685 |
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
|
8686 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8687 |
^ stringAtom |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8688 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8689 |
"Modified: 2.3.1996 / 15:11:08 / cg" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8690 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8691 |
|
1344 | 8692 |
atomName:anAtomID |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8693 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8694 |
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
|
8695 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8696 |
%{ /* NOCONTEXT */ |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8697 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8698 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8699 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8700 |
if (ISCONNECTED) { |
1344 | 8701 |
if (__isAtomID(anAtomID)) { |
8702 |
name = XGetAtomName(myDpy, _AtomVal(anAtomID)); |
|
8703 |
if (name == 0) { |
|
8704 |
RETURN (nil); |
|
8705 |
} |
|
8706 |
str = __MKSTRING(name); |
|
8707 |
XFree(name); |
|
8708 |
RETURN ( str ); |
|
8709 |
} |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8710 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8711 |
%}. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8712 |
self primitiveFailed. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8713 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8714 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8715 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8716 |
Display atomName:1 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8717 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8718 |
Display atomName:132 'FONTNAME_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8719 |
Display atomName:135 'FOUNDRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8720 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8721 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8722 |
Display atomName:152 'CHARSET_ENCODING' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8723 |
Display atomName:154 |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8724 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8725 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8726 |
|
1344 | 8727 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8728 |
"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
|
8729 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8730 |
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
|
8731 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8732 |
Notice: |
1344 | 8733 |
we do not plan to use X's resources for ST/X's defaults, |
8734 |
styles or resources. This would make porting of applications |
|
8735 |
to different platforms much more difficult (Windows has no resource |
|
8736 |
database). If you stay within ST/X's resource files, these can be |
|
8737 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8738 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8739 |
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
|
8740 |
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
|
8741 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8742 |
|
295 | 8743 |
%{ |
8744 |
char *rslt; |
|
8745 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8746 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8747 |
&& __isNonNilObject(name) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8748 |
&& (__qIsString(name) || __qIsSymbol(name)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8749 |
&& __isNonNilObject(cls) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
8750 |
&& (__qIsString(cls) || __qIsSymbol(cls))) { |
1344 | 8751 |
BEGIN_INTERRUPTSBLOCKED |
1831 | 8752 |
rslt = XGetDefault(myDpy, (char *) __stringVal(cls), |
8753 |
(char *) __stringVal(name)); |
|
1344 | 8754 |
END_INTERRUPTSBLOCKED |
8755 |
RETURN (rslt ? __MKSTRING(rslt) : nil ); |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8756 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8757 |
%}. |
295 | 8758 |
self primitiveFailed. |
8759 |
^ nil |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8760 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8761 |
"if your ~/.Xdefaults contains an entry such as: |
1344 | 8762 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8763 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8764 |
|
1344 | 8765 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8766 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8767 |
if your ~/.Xdefaults contains an entry such as: |
1344 | 8768 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8769 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8770 |
|
1344 | 8771 |
Display getResource:'beNiceToColormap' class:'any' |
8772 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
8773 |
" |
295 | 8774 |
! ! |
8775 |
||
8776 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
8777 |
||
1462
f8b2909deb3c
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1455
diff
changeset
|
8778 |
getBitsFromId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
295 | 8779 |
"get bits from a drawable into the imageBits. The storage for the bits |
8780 |
must be big enough for the data to fit. If ok, returns an array with some |
|
8781 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
8782 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
8783 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
8784 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8785 |
|rawInfo info| |
295 | 8786 |
|
8787 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
1344 | 8788 |
self primitiveFailed. |
8789 |
^ nil |
|
295 | 8790 |
]. |
8791 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8792 |
rawInfo := Array new:8. |
1344 | 8793 |
"1 -> bit order" |
8794 |
"2 -> depth" |
|
8795 |
"3 -> bytes_per_line" |
|
8796 |
"4 -> byte_order" |
|
8797 |
"5 -> format" |
|
8798 |
"6 -> bitmap_unit" |
|
8799 |
"7 -> bitmap_pad" |
|
8800 |
"8 -> bits_per_pixel" |
|
295 | 8801 |
|
8802 |
"/ had to extract the getPixel call into a separate method, to specify |
|
8803 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
8804 |
"/ of temporary stack space |
|
8805 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
8806 |
(self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
1344 | 8807 |
info := IdentityDictionary new. |
8808 |
info at:#bitOrder put:(rawInfo at:1). |
|
8809 |
info at:#depth put:(rawInfo at:2). |
|
8810 |
info at:#bytesPerLine put:(rawInfo at:3). |
|
8811 |
info at:#byteOrder put:(rawInfo at:4). |
|
8812 |
info at:#format put:(rawInfo at:5). |
|
8813 |
info at:#bitmapUnit put:(rawInfo at:6). |
|
8814 |
info at:#bitmapPad put:(rawInfo at:7). |
|
8815 |
info at:#bitsPerPixel put:(rawInfo at:8). |
|
8816 |
^ info |
|
295 | 8817 |
]. |
8818 |
" |
|
8819 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
8820 |
or is too small to hold the bits |
|
8821 |
" |
|
8822 |
^ self primitiveFailed |
|
8823 |
! |
|
8824 |
||
2713
1aef3acb4e04
need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents:
2685
diff
changeset
|
8825 |
getPixelX:x y:y from:aDrawableId with:dummyGCId |
790
05ea637c94c3
care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents:
788
diff
changeset
|
8826 |
"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
|
8827 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 8828 |
|
8829 |
%{ /* UNLIMITEDSTACK NOCONTEXT */ |
|
8830 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
8831 |
Window win; |
295 | 8832 |
XImage *img; |
8833 |
int ret; |
|
8834 |
int xpos, ypos; |
|
8835 |
||
1209 | 8836 |
if (ISCONNECTED |
8837 |
&& __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
1344 | 8838 |
win = _WindowVal(aDrawableId); |
8839 |
xpos = __intVal(x); |
|
8840 |
ypos = __intVal(y); |
|
8841 |
if ((xpos < 0) || (ypos < 0)) { |
|
8842 |
RETURN ( __MKSMALLINT(0) ); |
|
8843 |
} |
|
1974 | 8844 |
ENTER_XLIB(); |
1344 | 8845 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
1974 | 8846 |
LEAVE_XLIB(); |
1344 | 8847 |
if (img != 0) { |
8848 |
ret = XGetPixel(img, 0, 0); |
|
8849 |
XDestroyImage(img); |
|
8850 |
RETURN ( __MKSMALLINT(ret) ); |
|
8851 |
} |
|
295 | 8852 |
} |
8853 |
%}. |
|
8854 |
^ nil |
|
8855 |
! |
|
8856 |
||
1344 | 8857 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
295 | 8858 |
"since XGetImage may allocate huge amount of stack space |
8859 |
(some implementations use alloca), this must run with unlimited stack." |
|
8860 |
||
8861 |
%{ /* UNLIMITEDSTACK */ |
|
8862 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
8863 |
Window win; |
295 | 8864 |
XImage *image = (XImage *)0; |
8865 |
int pad, bytes_per_line, numBytes; |
|
8866 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8867 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8868 |
&& __isExternalAddress(aDrawableId) |
295 | 8869 |
&& __bothSmallInteger(srcx, srcy) |
8870 |
&& __bothSmallInteger(w, h) |
|
8871 |
&& __isArray(info) |
|
8872 |
&& __isByteArray(imageBits)) { |
|
1344 | 8873 |
Display *dpy = myDpy; |
8874 |
||
8875 |
win = _WindowVal(aDrawableId); |
|
1974 | 8876 |
ENTER_XLIB(); |
1344 | 8877 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
8878 |
__intVal(w), __intVal(h), |
|
8879 |
(unsigned)AllPlanes, ZPixmap); |
|
1974 | 8880 |
LEAVE_XLIB(); |
1344 | 8881 |
|
8882 |
if (! image) { |
|
8883 |
RETURN ( false ); |
|
8884 |
} |
|
8885 |
||
8886 |
pad = image->bitmap_pad; |
|
295 | 8887 |
#ifdef SUPERDEBUG |
1344 | 8888 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
295 | 8889 |
#endif |
1344 | 8890 |
switch (image->depth) { |
8891 |
case 1: |
|
8892 |
case 2: |
|
8893 |
case 4: |
|
8894 |
case 8: |
|
8895 |
case 16: |
|
8896 |
case 24: |
|
8897 |
case 32: |
|
8898 |
numBytes = image->bytes_per_line * image->height; |
|
8899 |
break; |
|
1728 | 8900 |
|
1344 | 8901 |
default: |
8902 |
/* unsupported depth ? */ |
|
8903 |
printf("possibly unsupported depth:%d in primGetBits\n", image->depth); |
|
8904 |
numBytes = image->bytes_per_line * image->height; |
|
8905 |
break; |
|
8906 |
} |
|
295 | 8907 |
|
8908 |
#ifdef SUPERDEBUG |
|
1344 | 8909 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 8910 |
#endif |
8911 |
||
1344 | 8912 |
if (numBytes > __byteArraySize(imageBits)) { |
8913 |
/* imageBits too small */ |
|
1728 | 8914 |
fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n"); |
8915 |
fprintf(stderr, " bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits)); |
|
8916 |
fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n", |
|
8917 |
image->bitmap_pad, image->depth, image->bytes_per_line); |
|
1344 | 8918 |
goto fail; |
8919 |
} |
|
8920 |
if (image->bitmap_bit_order == MSBFirst) |
|
8921 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
|
8922 |
else |
|
8923 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
|
8924 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
8925 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
8926 |
if (image->byte_order == MSBFirst) |
|
8927 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
|
8928 |
else |
|
8929 |
__ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
|
8930 |
if (image->format == XYBitmap) |
|
8931 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
|
8932 |
else if (image->format == XYPixmap) |
|
8933 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
|
8934 |
else if (image->format == ZPixmap) |
|
8935 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
8936 |
|
1344 | 8937 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
8938 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
8939 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
8940 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
8941 |
XDestroyImage(image); |
|
8942 |
RETURN ( true ); |
|
295 | 8943 |
} |
8944 |
fail: |
|
8945 |
if (image) { |
|
1344 | 8946 |
XDestroyImage(image); |
295 | 8947 |
} |
8948 |
%}. |
|
8949 |
^ false |
|
8950 |
! ! |
|
8951 |
||
8952 |
!XWorkstation methodsFor:'selections'! |
|
8953 |
||
1344 | 8954 |
getSelectionFor:drawableId |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8955 |
"get the object selection - either immediate, or asynchronous. |
295 | 8956 |
Returns nil, if async request is on its way" |
8957 |
||
8958 |
|selProp sel| |
|
8959 |
||
8960 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8961 |
"no primary selection - use cut buffer" |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8962 |
sel := self getObjectProperty:cutBuffer0Atom from:nil. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8963 |
^ sel |
295 | 8964 |
]. |
8965 |
selProp := self atomIDOf:'ST_SELECTION' create:true. |
|
8966 |
self requestObjectSelection:primaryAtom property:selProp for:drawableId. |
|
8967 |
^ nil |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8968 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
8969 |
"Modified: / 17.6.1998 / 17:11:15 / cg" |
295 | 8970 |
! |
8971 |
||
1344 | 8972 |
getSelectionOwnerOf:selectionAtomID |
295 | 8973 |
"get the owner of a selection" |
8974 |
||
8975 |
%{ /* NOCONTEXT */ |
|
8976 |
Atom selection; |
|
8977 |
Window window; |
|
8978 |
||
8979 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
|
1344 | 8980 |
Display *dpy = myDpy; |
8981 |
||
8982 |
window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID)); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
8983 |
RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); |
295 | 8984 |
} |
8985 |
%}. |
|
8986 |
self primitiveFailed. |
|
8987 |
^ nil |
|
8988 |
! |
|
8989 |
||
1344 | 8990 |
getTextSelectionFor:drawableId |
295 | 8991 |
"get the text selection - either immediate, or asynchronous. |
8992 |
Returns nil, if async request is on its way" |
|
8993 |
||
8994 |
|selProp sel| |
|
8995 |
||
8996 |
(self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8997 |
"no primary selection - use cut buffer" |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8998 |
sel := self getTextProperty:cutBuffer0Atom from:nil. |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
8999 |
^ sel |
295 | 9000 |
]. |
9001 |
selProp := self atomIDOf:'VT_SELECTION' create:true. |
|
9002 |
self requestTextSelection:primaryAtom property:selProp for:drawableId. |
|
9003 |
^ nil |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9004 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9005 |
"Modified: / 17.6.1998 / 17:12:05 / cg" |
295 | 9006 |
! |
9007 |
||
1344 | 9008 |
requestObjectSelection:selectionID property:propertyID for:aWindowId |
295 | 9009 |
"ask the server to send us the selection - the view with ID aWindowID |
9010 |
will later receive a SelectionNotify event for it." |
|
9011 |
||
9012 |
^ self requestSelection:selectionID |
|
1344 | 9013 |
property:propertyID |
9014 |
type:(self atomIDOf:'ST_OBJECT' create:true) |
|
9015 |
for:aWindowId |
|
9016 |
! |
|
9017 |
||
9018 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
|
295 | 9019 |
"ask the server to send us the selection - the view with id aWindowID |
9020 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
9021 |
with the selections value)." |
|
9022 |
||
9023 |
%{ /* NOCONTEXT */ |
|
9024 |
Atom sel_prop; |
|
9025 |
char *cp; |
|
9026 |
||
9027 |
if (__isExternalAddress(aWindowId) |
|
9028 |
&& ISCONNECTED |
|
9029 |
&& __isSmallInteger(typeID) |
|
9030 |
&& __isAtomID(selectionID)) { |
|
1344 | 9031 |
Display *dpy = myDpy; |
9032 |
||
9033 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) { |
|
9034 |
/* |
|
9035 |
* no owner of primary selection |
|
9036 |
*/ |
|
9037 |
RETURN (false); |
|
9038 |
} |
|
9039 |
/* |
|
9040 |
* PRIMARY selection |
|
9041 |
*/ |
|
9042 |
XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), |
|
9043 |
_AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime); |
|
9044 |
RETURN (true); |
|
295 | 9045 |
} |
9046 |
%}. |
|
9047 |
self primitiveFailed. |
|
9048 |
^ false |
|
9049 |
||
9050 |
" |
|
9051 |
Display requestSelection:(Display atomIDOf:'PRIMARY') |
|
1344 | 9052 |
property:(Display atomIDOf:'VT_SELECTION') |
9053 |
for:0 |
|
295 | 9054 |
" |
9055 |
! |
|
9056 |
||
1344 | 9057 |
requestTextSelection:selectionID property:propertyID for:aWindowId |
295 | 9058 |
"ask the server to send us the selection - the view with ID aWindowID |
9059 |
will later receive a SelectionNotify event for it." |
|
9060 |
||
9061 |
^ self requestSelection:selectionID |
|
1344 | 9062 |
property:propertyID |
9063 |
type:stringAtom |
|
9064 |
for:aWindowId |
|
9065 |
! |
|
9066 |
||
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9067 |
sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID |
295 | 9068 |
"send aString back from a SelectionRequest" |
9069 |
||
9070 |
self |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9071 |
setProperty:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9072 |
type:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9073 |
value:something |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9074 |
for:requestorID. |
295 | 9075 |
self |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9076 |
sendSelectionNotifySelection:selectionID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9077 |
property:propertyID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9078 |
target:targetID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9079 |
time:t |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9080 |
from:windowID |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9081 |
to:requestorID. |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9082 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9083 |
"Modified: / 17.6.1998 / 17:03:20 / cg" |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9084 |
"Created: / 17.6.1998 / 19:44:03 / cg" |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9085 |
! |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9086 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9087 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID |
295 | 9088 |
"send a selectionNotify back from a SelectionRequest" |
9089 |
||
9090 |
%{ /* NOCONTEXT */ |
|
9091 |
if (__isAtomID(propertyID) |
|
9092 |
&& __isExternalAddress(requestorID) |
|
9093 |
&& ISCONNECTED |
|
9094 |
&& __isAtomID(targetID) |
|
9095 |
&& __isAtomID(selectionID)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9096 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9097 |
XEvent ev; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9098 |
Window requestor = _WindowVal(requestorID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9099 |
Atom property = _AtomVal(propertyID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9100 |
Atom target = _AtomVal(targetID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9101 |
Atom selection = _AtomVal(selectionID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9102 |
Status result; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9103 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9104 |
ev.xselection.type = SelectionNotify; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9105 |
ev.xselection.display = dpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9106 |
ev.xselection.selection = selection; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9107 |
ev.xselection.target = target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9108 |
if (__isExternalAddress(windowID)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9109 |
ev.xselection.requestor = _WindowVal(windowID); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9110 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9111 |
ev.xselection.requestor = DefaultRootWindow(dpy); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9112 |
if (__isExternalAddress(t)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9113 |
ev.xselection.time = (INT)(__externalAddressVal(t)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9114 |
} else { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9115 |
ev.xselection.time = CurrentTime; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9116 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9117 |
if (property == None) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9118 |
ev.xselection.property = target; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9119 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9120 |
ev.xselection.property = property; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9121 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9122 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9123 |
ev.xselection.selection, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9124 |
ev.xselection.property, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9125 |
ev.xselection.target, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9126 |
ev.xselection.requestor, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9127 |
requestor)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9128 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9129 |
ENTER_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9130 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9131 |
LEAVE_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9132 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9133 |
if ((result == BadValue) || (result == BadWindow)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9134 |
DPRINTF(("bad status\n")); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9135 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9136 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9137 |
ENTER_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9138 |
XFlush(dpy); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9139 |
LEAVE_XLIB(); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9140 |
RETURN (true) |
382 | 9141 |
} |
9142 |
%}. |
|
9143 |
self primitiveFailed. |
|
9144 |
^ false |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9145 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9146 |
"Modified: / 17.6.1998 / 20:23:20 / cg" |
295 | 9147 |
! |
9148 |
||
1344 | 9149 |
setSelection:anObject owner:aWindowId |
295 | 9150 |
"set the object selection, and make aWindowId be the owner. |
9151 |
This can be used by other Smalltalk(X) applications only." |
|
9152 |
||
9153 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
1344 | 9154 |
^ false |
295 | 9155 |
]. |
9156 |
"/ ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil |
|
9157 |
^ true |
|
9158 |
! |
|
9159 |
||
1344 | 9160 |
setSelectionOwner:aWindowId of:selectionID |
295 | 9161 |
"set the owner of a selection; return false if failed" |
9162 |
||
9163 |
%{ /* NOCONTEXT */ |
|
9164 |
Window win; |
|
9165 |
||
9166 |
if (__isExternalAddress(aWindowId) |
|
9167 |
&& __isAtomID(selectionID) |
|
9168 |
&& ISCONNECTED) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9169 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9170 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9171 |
win = _WindowVal(aWindowId); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9172 |
XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9173 |
DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9174 |
if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9175 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9176 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9177 |
RETURN (true); |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9178 |
} |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9179 |
%}. |
295 | 9180 |
self primitiveFailed. |
9181 |
^ nil |
|
9182 |
! |
|
9183 |
||
1344 | 9184 |
setTextSelection:aString owner:aWindowId |
295 | 9185 |
"set the text selection, and make aWindowId be the owner. |
9186 |
This can be used by any other X application." |
|
9187 |
||
9188 |
(self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9189 |
'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. |
295 | 9190 |
]. |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9191 |
^ self setTextProperty:cutBuffer0Atom value:aString for:rootId. |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9192 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
9193 |
"Modified: / 17.6.1998 / 19:48:54 / cg" |
295 | 9194 |
! ! |
9195 |
||
9196 |
!XWorkstation methodsFor:'window stuff'! |
|
9197 |
||
1344 | 9198 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
295 | 9199 |
"clear a rectangular area to viewbackground" |
9200 |
||
9201 |
%{ /* NOCONTEXT */ |
|
9202 |
||
9203 |
int w, h; |
|
9204 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9205 |
if (ISCONNECTED) { |
1344 | 9206 |
if (__isExternalAddress(aWindowId) |
9207 |
&& __bothSmallInteger(x, y) |
|
9208 |
&& __bothSmallInteger(width, height)) { |
|
9209 |
w = __intVal(width); |
|
9210 |
h = __intVal(height); |
|
9211 |
/* |
|
9212 |
* need this check here: some servers simply dump core with bad args |
|
9213 |
*/ |
|
9214 |
if ((w >= 0) && (h >= 0)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9215 |
ENTER_XLIB(); |
1344 | 9216 |
XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9217 |
LEAVE_XLIB(); |
1344 | 9218 |
} |
9219 |
RETURN ( self ); |
|
9220 |
} |
|
295 | 9221 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9222 |
%}. |
295 | 9223 |
self primitiveFailed |
9224 |
! |
|
9225 |
||
1344 | 9226 |
clearWindow:aWindowId |
295 | 9227 |
"clear a window to viewbackground" |
9228 |
||
9229 |
%{ /* NOCONTEXT */ |
|
9230 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9231 |
if (ISCONNECTED) { |
1344 | 9232 |
if (__isExternalAddress(aWindowId)) { |
1974 | 9233 |
ENTER_XLIB(); |
1344 | 9234 |
XClearWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9235 |
LEAVE_XLIB(); |
1344 | 9236 |
RETURN ( self ); |
9237 |
} |
|
295 | 9238 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9239 |
%}. |
295 | 9240 |
self primitiveFailed |
9241 |
! |
|
9242 |
||
1344 | 9243 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
295 | 9244 |
"configure stacking operation of aWindowId w.r.t siblingId" |
9245 |
||
9246 |
%{ /* NOCONTEXT */ |
|
9247 |
||
9248 |
XWindowChanges chg; |
|
9249 |
int mask = CWSibling | CWStackMode; |
|
9250 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9251 |
if (ISCONNECTED) { |
1344 | 9252 |
if (__isExternalAddress(aWindowId) |
9253 |
&& __isExternalAddress(siblingId)) { |
|
9254 |
if (modeSymbol == @symbol(above)) { |
|
9255 |
chg.stack_mode = Above; |
|
9256 |
} else if (modeSymbol == @symbol(below)) { |
|
9257 |
chg.stack_mode = Below; |
|
9258 |
} else if (modeSymbol == @symbol(topIf)) { |
|
9259 |
chg.stack_mode = TopIf; |
|
9260 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
9261 |
chg.stack_mode = BottomIf; |
|
9262 |
} else if (modeSymbol == @symbol(opposite)) { |
|
9263 |
chg.stack_mode = Opposite; |
|
9264 |
} else { |
|
9265 |
mask = CWSibling; |
|
9266 |
} |
|
9267 |
||
9268 |
chg.sibling = _WindowVal(siblingId); |
|
1974 | 9269 |
ENTER_XLIB(); |
1344 | 9270 |
XConfigureWindow(myDpy, _WindowVal(aWindowId), |
9271 |
mask, &chg); |
|
1974 | 9272 |
LEAVE_XLIB(); |
1344 | 9273 |
RETURN ( self ); |
9274 |
} |
|
295 | 9275 |
} |
9276 |
bad: ; |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9277 |
%}. |
295 | 9278 |
self primitiveFailed |
9279 |
! |
|
9280 |
||
2457 | 9281 |
isValidWindowId:aWindowId |
9282 |
"return true, if the given window ID is (still) valid. |
|
9283 |
Especially useful, if the passed windowID is |
|
9284 |
an alien (external) windows id." |
|
9285 |
||
9286 |
|ret| |
|
9287 |
||
9288 |
%{ |
|
9289 |
||
9290 |
if (ISCONNECTED |
|
9291 |
&& __isExternalAddress(aWindowId)) { |
|
9292 |
char *name = NULL; |
|
9293 |
Status ok; |
|
9294 |
Window root, parent, *children = NULL; |
|
9295 |
int nChildren; |
|
9296 |
||
9297 |
/* ENTER_XLIB(); */ |
|
9298 |
ok = XQueryTree(myDpy, _WindowVal(aWindowId), |
|
9299 |
&root, &parent, &children, &nChildren); |
|
9300 |
if (children) { |
|
9301 |
XFree(children); |
|
9302 |
} |
|
9303 |
/* LEAVE_XLIB(); */ |
|
9304 |
if (ok) { |
|
9305 |
RETURN (true); |
|
9306 |
} |
|
9307 |
RETURN (false); |
|
9308 |
} |
|
9309 |
%}. |
|
9310 |
self primitiveFailed |
|
9311 |
||
9312 |
" |
|
9313 |
|v aWindowId ok| |
|
9314 |
||
9315 |
v := StandardSystemView new. |
|
9316 |
v label:'hello'. |
|
9317 |
v openAndWait. |
|
9318 |
aWindowId := v id. |
|
9319 |
ok := Display isValidWindowId:aWindowId. |
|
9320 |
Transcript showCR:'ok is: ' , ok printString. |
|
9321 |
Delay waitForSeconds:1. |
|
9322 |
v destroy. |
|
9323 |
ok := Display isValidWindowId:aWindowId. |
|
9324 |
Transcript showCR:'ok is: ' , ok printString. |
|
9325 |
" |
|
9326 |
! |
|
9327 |
||
1344 | 9328 |
lowerWindow:aWindowId |
295 | 9329 |
"bring a window to back" |
9330 |
||
9331 |
%{ /* NOCONTEXT */ |
|
9332 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9333 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9334 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9335 |
ENTER_XLIB(); |
1344 | 9336 |
XLowerWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9337 |
LEAVE_XLIB(); |
1344 | 9338 |
RETURN ( self ); |
295 | 9339 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9340 |
%}. |
295 | 9341 |
self primitiveFailed |
9342 |
! |
|
9343 |
||
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9344 |
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
|
9345 |
width:w height:h minExtent:minExt maxExtent:maxExt |
2650 | 9346 |
|
9347 |
"make a window visible - either as icon or as a real view |
|
9348 |
in addition, allow change of extend, position, minExtend and maxExtent. |
|
9349 |
Needed for restart, to allow recreating a view as iconified, |
|
9350 |
and to collaps/expand windows." |
|
295 | 9351 |
|
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9352 |
|wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH| |
295 | 9353 |
|
9354 |
aBoolean ifTrue:[ |
|
1344 | 9355 |
wicon := aView icon. |
9356 |
wicon notNil ifTrue:[ |
|
9357 |
wiconId := wicon id |
|
9358 |
]. |
|
9359 |
wiconView := aView iconView. |
|
9360 |
wiconView notNil ifTrue:[ |
|
9361 |
wiconViewId := wiconView id |
|
9362 |
]. |
|
9363 |
wlabel := aView label. |
|
295 | 9364 |
]. |
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9365 |
minExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9366 |
minW := minExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9367 |
minH := minExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9368 |
]. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9369 |
maxExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9370 |
maxW := maxExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9371 |
maxH := maxExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
9372 |
]. |
295 | 9373 |
%{ |
9374 |
||
9375 |
XWMHints wmhints; |
|
9376 |
XSizeHints szhints; |
|
9377 |
Window win; |
|
9378 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9379 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9380 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9381 |
Display *dpy = myDpy; |
9382 |
||
9383 |
win = _WindowVal(aWindowId); |
|
9384 |
||
9385 |
szhints.flags = 0; |
|
9386 |
if (__bothSmallInteger(xPos, yPos)) { |
|
9387 |
szhints.x = __intVal(xPos); |
|
9388 |
szhints.y = __intVal(yPos); |
|
9389 |
szhints.flags |= USPosition; |
|
9390 |
} |
|
9391 |
if (__bothSmallInteger(w, h)) { |
|
9392 |
szhints.width = __intVal(w); |
|
9393 |
szhints.height = __intVal(h); |
|
9394 |
szhints.flags |= USSize; |
|
9395 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9396 |
if (__bothSmallInteger(minW, minH)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9397 |
szhints.flags |= PMinSize; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9398 |
szhints.min_width = __intVal(minW); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9399 |
szhints.min_height = __intVal(minH); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9400 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9401 |
if (__bothSmallInteger(maxW, maxH)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9402 |
szhints.flags |= PMaxSize; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9403 |
szhints.max_width = __intVal(maxW); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9404 |
szhints.max_height = __intVal(maxH); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9405 |
} |
1344 | 9406 |
|
9407 |
if (aBoolean == true) { |
|
9408 |
char *windowName; |
|
9409 |
Pixmap iconBitmap = (Pixmap)0; |
|
9410 |
Window iconWindow; |
|
9411 |
||
9412 |
if (__isExternalAddress(wiconId)) |
|
9413 |
iconBitmap = _PixmapVal(wiconId); |
|
9414 |
else |
|
9415 |
iconBitmap = (Pixmap)0; |
|
9416 |
||
9417 |
if (__isExternalAddress(wiconViewId)) |
|
9418 |
iconWindow = _WindowVal(wiconViewId); |
|
9419 |
else |
|
9420 |
iconWindow = (Window)0; |
|
9421 |
||
9422 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1831 | 9423 |
windowName = (char *) __stringVal(wlabel); |
1344 | 9424 |
else |
9425 |
windowName = ""; |
|
9426 |
||
9427 |
if (iconBitmap || windowName) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9428 |
ENTER_XLIB(); |
1344 | 9429 |
XSetStandardProperties(dpy, win, |
9430 |
windowName, windowName, |
|
9431 |
iconBitmap, |
|
9432 |
0, 0, &szhints); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
9433 |
LEAVE_XLIB(); |
1344 | 9434 |
} |
9435 |
||
9436 |
wmhints.flags = 0; |
|
9437 |
if (iconBitmap) { |
|
9438 |
wmhints.flags |= IconPixmapHint; |
|
9439 |
wmhints.icon_pixmap = iconBitmap; |
|
9440 |
} |
|
9441 |
if (iconWindow) { |
|
9442 |
wmhints.flags |= IconWindowHint; |
|
9443 |
wmhints.icon_window = iconWindow; |
|
9444 |
} |
|
9445 |
||
9446 |
wmhints.initial_state = IconicState; |
|
9447 |
wmhints.flags |= StateHint; |
|
1974 | 9448 |
ENTER_XLIB(); |
1344 | 9449 |
XSetWMHints(dpy, win, &wmhints); |
1974 | 9450 |
LEAVE_XLIB(); |
1344 | 9451 |
} |
9452 |
||
9453 |
if (szhints.flags) { |
|
1974 | 9454 |
ENTER_XLIB(); |
1344 | 9455 |
XSetNormalHints(dpy, win, &szhints); |
1974 | 9456 |
LEAVE_XLIB(); |
9457 |
} |
|
9458 |
||
9459 |
ENTER_XLIB(); |
|
1344 | 9460 |
XMapWindow(dpy, win); |
1974 | 9461 |
LEAVE_XLIB(); |
1344 | 9462 |
RETURN ( self ); |
295 | 9463 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9464 |
%}. |
295 | 9465 |
self primitiveFailed |
9466 |
! |
|
9467 |
||
1344 | 9468 |
mapWindow:aWindowId |
295 | 9469 |
"make a window visible" |
9470 |
||
9471 |
%{ /* NOCONTEXT */ |
|
9472 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9473 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9474 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9475 |
ENTER_XLIB(); |
1344 | 9476 |
XMapWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9477 |
LEAVE_XLIB(); |
1344 | 9478 |
RETURN ( self ); |
295 | 9479 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9480 |
%}. |
295 | 9481 |
self primitiveFailed |
9482 |
! |
|
9483 |
||
1344 | 9484 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
295 | 9485 |
"move and resize a window" |
9486 |
||
9487 |
%{ /* NOCONTEXT */ |
|
9488 |
||
9489 |
int newWidth, newHeight; |
|
9490 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9491 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9492 |
&& __isExternalAddress(aWindowId) |
295 | 9493 |
&& __bothSmallInteger(w, h) |
9494 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 9495 |
newWidth = __intVal(w); |
9496 |
newHeight = __intVal(h); |
|
9497 |
if (newWidth < 1) newWidth = 1; |
|
9498 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 9499 |
ENTER_XLIB(); |
1344 | 9500 |
XMoveResizeWindow(myDpy, _WindowVal(aWindowId), |
9501 |
__intVal(x), __intVal(y), |
|
9502 |
newWidth, newHeight); |
|
1974 | 9503 |
LEAVE_XLIB(); |
1344 | 9504 |
RETURN ( self ); |
295 | 9505 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9506 |
%}. |
295 | 9507 |
self primitiveFailed |
9508 |
! |
|
9509 |
||
1344 | 9510 |
moveWindow:aWindowId x:x y:y |
295 | 9511 |
"move a window" |
9512 |
||
9513 |
%{ /* NOCONTEXT */ |
|
9514 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9515 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9516 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
1974 | 9517 |
ENTER_XLIB(); |
1344 | 9518 |
XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y)); |
1974 | 9519 |
LEAVE_XLIB(); |
1344 | 9520 |
RETURN ( self ); |
295 | 9521 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9522 |
%}. |
295 | 9523 |
self primitiveFailed |
9524 |
! |
|
9525 |
||
1344 | 9526 |
raiseWindow:aWindowId |
295 | 9527 |
"bring a window to front" |
9528 |
||
9529 |
%{ /* NOCONTEXT */ |
|
9530 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9531 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9532 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9533 |
ENTER_XLIB(); |
1344 | 9534 |
XRaiseWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 9535 |
LEAVE_XLIB(); |
1344 | 9536 |
RETURN ( self ); |
295 | 9537 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9538 |
%}. |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9539 |
self primitiveFailed |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9540 |
! |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9541 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9542 |
reparentWindow:windowId to:newParentWindowId |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9543 |
"change a windows parent (an optional interface)" |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9544 |
%{ |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9545 |
Display *dpy = myDpy; |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9546 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9547 |
if (ISCONNECTED |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9548 |
&& __isExternalAddress(windowId) |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9549 |
&& __isExternalAddress(newParentWindowId)) { |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9550 |
Window _child, _newParent; |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9551 |
int i; |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9552 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9553 |
_child = _WindowVal(windowId); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9554 |
_newParent = _WindowVal(newParentWindowId); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9555 |
ENTER_XLIB(); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9556 |
|
2428 | 9557 |
#if 0 |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9558 |
XWithdrawWindow (dpy, _child, DefaultScreen(dpy)); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9559 |
XSync (dpy, 0); |
2428 | 9560 |
#endif |
9561 |
/* |
|
9562 |
* Code 'stolen' from xswallow source ... |
|
9563 |
* ... mhmh - what is this loop for ? |
|
9564 |
*/ |
|
9565 |
for (i=0; i<5; i++) { |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9566 |
XReparentWindow (dpy, _child, _newParent, 0, 0); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9567 |
XSync (dpy, 0); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9568 |
} |
2428 | 9569 |
#if 0 |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9570 |
XMapWindow (dpy, _child); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9571 |
XSync (dpy, 0); |
2428 | 9572 |
#endif |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9573 |
LEAVE_XLIB(); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9574 |
RETURN ( true ); |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9575 |
} |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9576 |
%}. |
295 | 9577 |
self primitiveFailed |
9578 |
! |
|
9579 |
||
1344 | 9580 |
resizeWindow:aWindowId width:w height:h |
295 | 9581 |
"resize a window" |
9582 |
||
9583 |
%{ /* NOCONTEXT */ |
|
9584 |
||
9585 |
int newWidth, newHeight; |
|
9586 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9587 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9588 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
1344 | 9589 |
newWidth = __intVal(w); |
9590 |
newHeight = __intVal(h); |
|
9591 |
if (newWidth < 1) newWidth = 1; |
|
9592 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 9593 |
ENTER_XLIB(); |
1344 | 9594 |
XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight); |
1974 | 9595 |
LEAVE_XLIB(); |
1344 | 9596 |
RETURN ( self ); |
295 | 9597 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9598 |
%}. |
295 | 9599 |
self primitiveFailed |
9600 |
! |
|
9601 |
||
1344 | 9602 |
setBackingStore:how in:aWindowId |
295 | 9603 |
"turn on/off backing-store for a window" |
9604 |
||
9605 |
%{ /* NOCONTEXT */ |
|
9606 |
||
9607 |
XSetWindowAttributes wa; |
|
9608 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9609 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9610 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9611 |
if (__INST(ignoreBackingStore) != true) { |
9612 |
if (how == @symbol(always)) wa.backing_store = Always; |
|
9613 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
9614 |
else if (how == true) wa.backing_store = Always; |
|
9615 |
else wa.backing_store = 0; |
|
9616 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9617 |
ENTER_XLIB(); |
1344 | 9618 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa); |
1974 | 9619 |
LEAVE_XLIB(); |
1344 | 9620 |
END_INTERRUPTSBLOCKED |
9621 |
} |
|
9622 |
RETURN ( self ); |
|
295 | 9623 |
} |
9624 |
%}. |
|
9625 |
self primitiveFailed |
|
9626 |
! |
|
9627 |
||
1344 | 9628 |
setBitGravity:how in:aWindowId |
295 | 9629 |
"set bit gravity for a window" |
9630 |
||
9631 |
%{ /* NOCONTEXT */ |
|
9632 |
||
9633 |
XSetWindowAttributes wa; |
|
9634 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9635 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9636 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9637 |
if (how == @symbol(NorthWest)) { |
9638 |
wa.bit_gravity = NorthWestGravity; |
|
9639 |
} else if (how == @symbol(NorthEast)) { |
|
9640 |
wa.bit_gravity = NorthEastGravity; |
|
9641 |
} else if (how == @symbol(SouthWest)) { |
|
9642 |
wa.bit_gravity = SouthWestGravity; |
|
9643 |
} else if (how == @symbol(SouthEast)) { |
|
9644 |
wa.bit_gravity = SouthEastGravity; |
|
9645 |
} else if (how == @symbol(Center)) { |
|
9646 |
wa.bit_gravity = CenterGravity; |
|
9647 |
} else if (how == @symbol(North)) { |
|
9648 |
wa.bit_gravity = NorthGravity; |
|
9649 |
} else if (how == @symbol(South)) { |
|
9650 |
wa.bit_gravity = SouthGravity; |
|
9651 |
} else if (how == @symbol(West)) { |
|
9652 |
wa.bit_gravity = WestGravity; |
|
9653 |
} else if (how == @symbol(East)) { |
|
9654 |
wa.bit_gravity = EastGravity; |
|
9655 |
} else { |
|
9656 |
wa.bit_gravity = NorthWestGravity; |
|
9657 |
} |
|
9658 |
||
9659 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9660 |
ENTER_XLIB(); |
1344 | 9661 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa); |
1974 | 9662 |
LEAVE_XLIB(); |
1344 | 9663 |
END_INTERRUPTSBLOCKED |
9664 |
RETURN ( self ); |
|
295 | 9665 |
} |
9666 |
%}. |
|
9667 |
self primitiveFailed |
|
9668 |
! |
|
9669 |
||
1344 | 9670 |
setCursor:aCursorId in:aWindowId |
295 | 9671 |
"define a windows cursor" |
9672 |
||
9673 |
%{ /* NOCONTEXT */ |
|
9674 |
||
9675 |
Display *dpy = myDpy; |
|
9676 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9677 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9678 |
&& __isExternalAddress(aWindowId) |
295 | 9679 |
&& __isExternalAddress(aCursorId)) { |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9680 |
Window w = _WindowVal(aWindowId); |
2501 | 9681 |
Cursor c = _CursorVal(aCursorId); |
9682 |
||
9683 |
if (w && c) { |
|
9684 |
ENTER_XLIB(); |
|
9685 |
XDefineCursor(dpy, w, c); |
|
9686 |
LEAVE_XLIB(); |
|
9687 |
} |
|
1344 | 9688 |
RETURN ( self ); |
295 | 9689 |
} |
9690 |
%}. |
|
9691 |
self primitiveFailed |
|
9692 |
! |
|
9693 |
||
1344 | 9694 |
setIconName:aString in:aWindowId |
295 | 9695 |
"define a windows iconname" |
9696 |
||
9697 |
%{ /* NOCONTEXT */ |
|
9698 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9699 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9700 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9701 |
&& (__qIsString(aString) || __qIsSymbol(aString)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9702 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9703 |
ENTER_XLIB(); |
1831 | 9704 |
XSetIconName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 9705 |
LEAVE_XLIB(); |
1344 | 9706 |
RETURN ( self ); |
295 | 9707 |
} |
9708 |
%}. |
|
9709 |
self primitiveFailed |
|
9710 |
! |
|
9711 |
||
1344 | 9712 |
setSaveUnder:yesOrNo in:aWindowId |
295 | 9713 |
"turn on/off save-under for a window" |
9714 |
||
9715 |
%{ /* NOCONTEXT */ |
|
9716 |
||
9717 |
XSetWindowAttributes wa; |
|
9718 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9719 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9720 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9721 |
if (__INST(hasSaveUnder) == true) { |
9722 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
|
1974 | 9723 |
ENTER_XLIB(); |
1344 | 9724 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa); |
1974 | 9725 |
LEAVE_XLIB(); |
1344 | 9726 |
} |
9727 |
RETURN ( self ); |
|
295 | 9728 |
} |
9729 |
%}. |
|
9730 |
self primitiveFailed |
|
9731 |
! |
|
9732 |
||
1344 | 9733 |
setTransient:aWindowId for:aMainWindowId |
295 | 9734 |
"set aWindowId to be a transient of aMainWindow" |
9735 |
||
9736 |
%{ /* NOCONTEXT */ |
|
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(aWindowId)) { |
1344 | 9740 |
Window w; |
9741 |
||
9742 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
|
9743 |
w = (Window) 0; |
|
9744 |
} else { |
|
9745 |
if (__isExternalAddress(aMainWindowId)) { |
|
9746 |
w = _WindowVal(aMainWindowId); |
|
9747 |
} else { |
|
9748 |
goto getOutOfHere; |
|
9749 |
} |
|
9750 |
} |
|
1974 | 9751 |
ENTER_XLIB(); |
1344 | 9752 |
XSetTransientForHint(myDpy, _WindowVal(aWindowId), w); |
1974 | 9753 |
LEAVE_XLIB(); |
1344 | 9754 |
RETURN ( self ); |
295 | 9755 |
} |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
9756 |
getOutOfHere: ; |
295 | 9757 |
%}. |
9758 |
self primitiveFailed |
|
9759 |
! |
|
9760 |
||
1344 | 9761 |
setWindowBackground:aColorIndex in:aWindowId |
295 | 9762 |
"set the windows background color. This is the color with which |
9763 |
the view is filled whenever exposed. Do not confuse this with |
|
9764 |
the background drawing color, which is used with opaque drawing." |
|
9765 |
||
9766 |
%{ /* NOCONTEXT */ |
|
9767 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9768 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9769 |
&& __isExternalAddress(aWindowId) |
295 | 9770 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 9771 |
ENTER_XLIB(); |
1344 | 9772 |
XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 9773 |
LEAVE_XLIB(); |
1344 | 9774 |
RETURN ( self ); |
295 | 9775 |
} |
9776 |
%}. |
|
9777 |
self primitiveFailed |
|
9778 |
! |
|
9779 |
||
1344 | 9780 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
295 | 9781 |
"set the windows background pattern to be a form. |
9782 |
This is the pattern with which the view is filled whenever exposed. |
|
9783 |
Do not confuse this with the background drawing color, which is used |
|
9784 |
with opaque drawing." |
|
9785 |
||
9786 |
%{ /* NOCONTEXT */ |
|
9787 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9788 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9789 |
&& __isExternalAddress(aWindowId) |
295 | 9790 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9791 |
ENTER_XLIB(); |
1344 | 9792 |
XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
1974 | 9793 |
LEAVE_XLIB(); |
1344 | 9794 |
RETURN ( self ); |
295 | 9795 |
} |
9796 |
%}. |
|
9797 |
self primitiveFailed |
|
9798 |
! |
|
9799 |
||
1344 | 9800 |
setWindowBorderColor:aColorIndex in:aWindowId |
295 | 9801 |
"set the windows border color" |
9802 |
||
9803 |
%{ /* NOCONTEXT */ |
|
9804 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9805 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9806 |
&& __isExternalAddress(aWindowId) |
295 | 9807 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 9808 |
ENTER_XLIB(); |
1344 | 9809 |
XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 9810 |
LEAVE_XLIB(); |
1344 | 9811 |
RETURN ( self ); |
295 | 9812 |
} |
9813 |
%}. |
|
9814 |
self primitiveFailed |
|
9815 |
! |
|
9816 |
||
1344 | 9817 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
295 | 9818 |
"set the windows border pattern" |
9819 |
||
9820 |
%{ /* NOCONTEXT */ |
|
9821 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9822 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9823 |
&& __isExternalAddress(aWindowId) |
295 | 9824 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 9825 |
ENTER_XLIB(); |
1344 | 9826 |
XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId)); |
1974 | 9827 |
LEAVE_XLIB(); |
1344 | 9828 |
RETURN ( self ); |
295 | 9829 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
9830 |
%}. |
295 | 9831 |
self primitiveFailed |
9832 |
! |
|
9833 |
||
1344 | 9834 |
setWindowBorderShape:aPixmapId in:aWindowId |
295 | 9835 |
"set the windows border shape" |
9836 |
||
9837 |
hasShapeExtension ifFalse:[^ self]. |
|
9838 |
||
9839 |
%{ /* NOCONTEXT */ |
|
9840 |
||
9841 |
#ifdef SHAPE |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9842 |
Pixmap shapeBitmap; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9843 |
|
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9844 |
if (__isExternalAddress(aPixmapId)) |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9845 |
shapeBitmap = _PixmapVal(aPixmapId); |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9846 |
else |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9847 |
shapeBitmap = (Pixmap)0; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9848 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9849 |
if (ISCONNECTED |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9850 |
&& __isExternalAddress(aWindowId)) { |
1974 | 9851 |
ENTER_XLIB(); |
1344 | 9852 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding, |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
9853 |
0, 0, shapeBitmap, ShapeSet); |
1974 | 9854 |
LEAVE_XLIB(); |
1344 | 9855 |
RETURN ( self ); |
295 | 9856 |
} |
9857 |
#endif |
|
9858 |
%}. |
|
9859 |
self primitiveFailed |
|
9860 |
! |
|
9861 |
||
1344 | 9862 |
setWindowBorderWidth:aNumber in:aWindowId |
295 | 9863 |
"set the windows border width" |
9864 |
||
9865 |
%{ /* NOCONTEXT */ |
|
9866 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9867 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9868 |
&& __isExternalAddress(aWindowId) |
295 | 9869 |
&& __isSmallInteger(aNumber)) { |
1974 | 9870 |
ENTER_XLIB(); |
1344 | 9871 |
XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber)); |
1974 | 9872 |
LEAVE_XLIB(); |
1344 | 9873 |
RETURN ( self ); |
295 | 9874 |
} |
9875 |
%}. |
|
9876 |
self primitiveFailed |
|
9877 |
! |
|
9878 |
||
1344 | 9879 |
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
|
9880 |
"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
|
9881 |
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
|
9882 |
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
|
9883 |
|
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9884 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9885 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9886 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9887 |
XClassHint classhint; |
9888 |
||
9889 |
classhint.res_class = classhint.res_name = 0; |
|
9890 |
||
9891 |
if (__isString(wClass) || __isSymbol(wClass)) { |
|
1831 | 9892 |
classhint.res_class = (char *) __stringVal(wClass); |
1344 | 9893 |
} else if (wClass != nil) |
9894 |
goto error; |
|
9895 |
||
9896 |
if (__isString(wName) || __isSymbol(wName)) { |
|
1831 | 9897 |
classhint.res_name = (char *) __stringVal(wName); |
1344 | 9898 |
} else if (wName != nil) |
9899 |
goto error; |
|
9900 |
||
1974 | 9901 |
ENTER_XLIB(); |
1344 | 9902 |
XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint); |
1974 | 9903 |
LEAVE_XLIB(); |
1344 | 9904 |
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
|
9905 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9906 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9907 |
%}. |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9908 |
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
|
9909 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
9910 |
|
1344 | 9911 |
setWindowGravity:how in:aWindowId |
295 | 9912 |
"set window gravity for a window" |
9913 |
||
9914 |
%{ /* NOCONTEXT */ |
|
9915 |
||
9916 |
XSetWindowAttributes wa; |
|
9917 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9918 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9919 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9920 |
if (how == @symbol(NorthWest)) { |
9921 |
wa.win_gravity = NorthWestGravity; |
|
9922 |
} else if (how == @symbol(NorthEast)) { |
|
9923 |
wa.win_gravity = NorthEastGravity; |
|
9924 |
} else if (how == @symbol(SouthWest)) { |
|
9925 |
wa.win_gravity = SouthWestGravity; |
|
9926 |
} else if (how == @symbol(SouthEast)) { |
|
9927 |
wa.win_gravity = SouthEastGravity; |
|
9928 |
} else if (how == @symbol(Center)) { |
|
9929 |
wa.win_gravity = CenterGravity; |
|
9930 |
} else if (how == @symbol(North)) { |
|
9931 |
wa.win_gravity = NorthGravity; |
|
9932 |
} else if (how == @symbol(South)) { |
|
9933 |
wa.win_gravity = SouthGravity; |
|
9934 |
} else if (how == @symbol(West)) { |
|
9935 |
wa.win_gravity = WestGravity; |
|
9936 |
} else if (how == @symbol(East)) { |
|
9937 |
wa.win_gravity = EastGravity; |
|
9938 |
} else { |
|
9939 |
wa.win_gravity = NorthWestGravity; |
|
9940 |
} |
|
9941 |
||
9942 |
BEGIN_INTERRUPTSBLOCKED |
|
1974 | 9943 |
ENTER_XLIB(); |
1344 | 9944 |
XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa); |
1974 | 9945 |
LEAVE_XLIB(); |
1344 | 9946 |
END_INTERRUPTSBLOCKED |
9947 |
RETURN ( self ); |
|
295 | 9948 |
} |
9949 |
%}. |
|
9950 |
self primitiveFailed |
|
9951 |
! |
|
9952 |
||
1344 | 9953 |
setWindowIcon:aForm in:aWindowId |
295 | 9954 |
"define a bitmap to be used as icon" |
9955 |
||
9956 |
|iconId| |
|
9957 |
||
9958 |
aForm notNil ifTrue:[ |
|
1344 | 9959 |
iconId := aForm id |
295 | 9960 |
]. |
9961 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9962 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9963 |
&& __isExternalAddress(iconId) |
295 | 9964 |
&& __isExternalAddress(aWindowId)) { |
1344 | 9965 |
XWMHints hints; |
9966 |
||
9967 |
hints.icon_pixmap = _PixmapVal(iconId); |
|
9968 |
hints.flags = IconPixmapHint; |
|
1974 | 9969 |
ENTER_XLIB(); |
1344 | 9970 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
1974 | 9971 |
LEAVE_XLIB(); |
1344 | 9972 |
RETURN ( self ); |
295 | 9973 |
} |
9974 |
%}. |
|
9975 |
self primitiveFailed |
|
9976 |
! |
|
9977 |
||
1376 | 9978 |
setWindowIcon:aForm mask:aMaskForm in:aWindowId |
1535 | 9979 |
"define a windows icon and (optional) iconMask." |
9980 |
||
9981 |
|iconId maskId| |
|
9982 |
||
9983 |
aForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9984 |
iconId := aForm id |
1535 | 9985 |
]. |
9986 |
aMaskForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9987 |
maskId := aMaskForm id. |
1535 | 9988 |
]. |
9989 |
%{ |
|
9990 |
if (ISCONNECTED |
|
9991 |
&& __isExternalAddress(iconId) |
|
9992 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9993 |
XWMHints hints; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9994 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9995 |
hints.icon_pixmap = _PixmapVal(iconId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9996 |
hints.flags = IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9997 |
if ((maskId != nil) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9998 |
&& __isExternalAddress(maskId)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
9999 |
hints.icon_mask = _PixmapVal(maskId); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10000 |
hints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10001 |
} |
1974 | 10002 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10003 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &hints); |
1974 | 10004 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10005 |
RETURN ( self ); |
1535 | 10006 |
} |
10007 |
%}. |
|
10008 |
self primitiveFailed |
|
10009 |
||
1376 | 10010 |
! |
10011 |
||
1344 | 10012 |
setWindowIconWindow:aView in:aWindowId |
295 | 10013 |
"define a window to be used as icon" |
10014 |
||
10015 |
|iconWindowId| |
|
10016 |
||
10017 |
aView notNil ifTrue:[ |
|
1344 | 10018 |
iconWindowId := aView id |
295 | 10019 |
]. |
10020 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10021 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10022 |
&& __isExternalAddress(iconWindowId) |
295 | 10023 |
&& __isExternalAddress(aWindowId)) { |
1344 | 10024 |
XWMHints wmhints; |
10025 |
||
10026 |
wmhints.icon_window = _WindowVal(iconWindowId); |
|
10027 |
wmhints.flags = IconWindowHint; |
|
1974 | 10028 |
ENTER_XLIB(); |
1344 | 10029 |
XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints); |
1974 | 10030 |
LEAVE_XLIB(); |
1344 | 10031 |
RETURN ( self ); |
295 | 10032 |
} |
10033 |
%}. |
|
10034 |
self primitiveFailed |
|
10035 |
! |
|
10036 |
||
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10037 |
setWindowMinExtent:minExt maxExtent:maxExt in:aWindowId |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10038 |
"set a windows minimum & max extents. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10039 |
nil arguments are ignored." |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10040 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10041 |
|minW minH maxW maxH| |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10042 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10043 |
minExt notNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10044 |
minW := minExt x. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10045 |
minH := minExt y. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10046 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10047 |
maxExt notNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10048 |
maxW := maxExt x. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10049 |
maxH := maxExt y. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10050 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10051 |
%{ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10052 |
if (ISCONNECTED |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10053 |
&& __isExternalAddress(aWindowId)) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10054 |
Display *dpy = myDpy; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10055 |
XSizeHints szhints; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10056 |
Window win; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10057 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10058 |
win = _WindowVal(aWindowId); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10059 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10060 |
szhints.flags = 0; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10061 |
if (__bothSmallInteger(minW, minH)) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10062 |
szhints.flags |= PMinSize; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10063 |
szhints.min_width = __intVal(minW); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10064 |
szhints.min_height = __intVal(minH); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10065 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10066 |
if (__bothSmallInteger(maxW, maxH)) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10067 |
szhints.flags |= PMaxSize; |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10068 |
szhints.max_width = __intVal(maxW); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10069 |
szhints.max_height = __intVal(maxH); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10070 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10071 |
|
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10072 |
if (szhints.flags) { |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10073 |
ENTER_XLIB(); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10074 |
XSetNormalHints(dpy, win, &szhints); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10075 |
LEAVE_XLIB(); |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10076 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10077 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10078 |
%}. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10079 |
! |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10080 |
|
1344 | 10081 |
setWindowName:aString in:aWindowId |
295 | 10082 |
"define a windows name" |
10083 |
||
10084 |
%{ /* NOCONTEXT */ |
|
10085 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10086 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
10087 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
10088 |
&& (__qIsString(aString) || __qIsSymbol(aString)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
10089 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10090 |
ENTER_XLIB(); |
1831 | 10091 |
XStoreName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 10092 |
LEAVE_XLIB(); |
1344 | 10093 |
RETURN ( self ); |
295 | 10094 |
} |
10095 |
%}. |
|
10096 |
self primitiveFailed |
|
10097 |
! |
|
10098 |
||
1344 | 10099 |
setWindowShape:aPixmapId in:aWindowId |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10100 |
"set the windows shape. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10101 |
Returns false, if the display does not support the |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
10102 |
X shape extension." |
295 | 10103 |
|
10104 |
hasShapeExtension ifFalse:[^ self]. |
|
10105 |
||
10106 |
%{ /* NOCONTEXT */ |
|
10107 |
||
10108 |
#ifdef SHAPE |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10109 |
Pixmap shapeBitmap; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10110 |
|
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10111 |
if (__isExternalAddress(aPixmapId)) |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10112 |
shapeBitmap = _PixmapVal(aPixmapId); |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10113 |
else |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10114 |
shapeBitmap = (Pixmap)0; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10115 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10116 |
if (ISCONNECTED |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10117 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10118 |
ENTER_XLIB(); |
1344 | 10119 |
XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip, |
10120 |
0, 0, |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
10121 |
shapeBitmap, ShapeSet); |
1974 | 10122 |
LEAVE_XLIB(); |
1344 | 10123 |
RETURN ( self ); |
295 | 10124 |
} |
10125 |
#endif |
|
10126 |
%}. |
|
10127 |
self primitiveFailed |
|
10128 |
! |
|
10129 |
||
1344 | 10130 |
unmapWindow:aWindowId |
295 | 10131 |
"make a window invisible" |
10132 |
||
10133 |
%{ /* NOCONTEXT */ |
|
10134 |
||
1214 | 10135 |
if (!ISCONNECTED) { |
1344 | 10136 |
RETURN ( self ); |
1214 | 10137 |
} |
10138 |
||
10139 |
if (__isExternalAddress(aWindowId)) { |
|
1974 | 10140 |
ENTER_XLIB(); |
1344 | 10141 |
XUnmapWindow(myDpy, _WindowVal(aWindowId)); |
1974 | 10142 |
LEAVE_XLIB(); |
1344 | 10143 |
RETURN ( self ); |
10144 |
} |
|
10145 |
%}. |
|
295 | 10146 |
self primitiveFailed |
1535 | 10147 |
! |
10148 |
||
10149 |
windowIsIconified:aWindowId |
|
10150 |
"return true, if some window is iconified. |
|
10151 |
The passed windowID may be an alien windows id." |
|
10152 |
||
10153 |
%{ /* NOCONTEXT */ |
|
10154 |
||
10155 |
if (ISCONNECTED |
|
10156 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10157 |
Atom JunkAtom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10158 |
int JunkInt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10159 |
unsigned long WinState,JunkLong; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10160 |
unsigned char *Property; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10161 |
Atom WM_STATE_Atom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10162 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10163 |
if (__INST(wmStateAtom) != nil) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10164 |
WM_STATE_Atom = _AtomVal(__INST(wmStateAtom)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10165 |
|
1974 | 10166 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10167 |
XGetWindowProperty(myDpy, _WindowVal(aWindowId), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10168 |
WM_STATE_Atom, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10169 |
0L, 2L, False, AnyPropertyType, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10170 |
&JunkAtom,&JunkInt,&WinState,&JunkLong, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10171 |
&Property); |
1974 | 10172 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10173 |
WinState=(unsigned long)(*((long*)Property)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10174 |
if (WinState==3) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10175 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10176 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10177 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
10178 |
RETURN (false); |
1535 | 10179 |
} |
10180 |
%}. |
|
10181 |
self primitiveFailed |
|
295 | 10182 |
! ! |
10183 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
10184 |
!XWorkstation class methodsFor:'documentation'! |
295 | 10185 |
|
10186 |
version |
|
2896 | 10187 |
^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.325 1999-09-10 16:16:27 cg Exp $' |
295 | 10188 |
! ! |
10189 |
XWorkstation initialize! |