author | Claus Gittinger <cg@exept.de> |
Tue, 14 Sep 2004 14:30:34 +0200 | |
changeset 4245 | d28b613dfc06 |
parent 4169 | 35c1ee146ffb |
child 4252 | 9dca820cd786 |
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 |
||
3200
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
13 |
"{ Package: 'stx:libview' }" |
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
14 |
|
0 | 15 |
DeviceWorkstation subclass:#XWorkstation |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
16 |
instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension |
1344 | 17 |
hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension |
18 |
hasImageExtension hasInputExtension ignoreBackingStore blackpixel |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
19 |
whitepixel atoms protocolsAtom deleteWindowAtom saveYourselfAtom |
3790 | 20 |
quitAppAtom primaryAtom clipboardAtom stringAtom wmStateAtom |
4106 | 21 |
motifWMHintsAtom listOfXFonts buttonsPressed eventRootX |
22 |
eventRootY displayName eventTrace dispatchingExpose rgbVisual |
|
23 |
virtualRootId rootId altModifierMask metaModifierMask |
|
24 |
multiClickTime deviceIOTimeoutErrorSignal activateOnClick |
|
4245 | 25 |
rawKeySymTranslation selectionOwner xlibTimeout xlibTimeoutForWindowCreation' |
3758 | 26 |
classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength |
4245 | 27 |
SelectionHandlers DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation' |
1344 | 28 |
poolDictionaries:'' |
29 |
category:'Interface-Graphics' |
|
295 | 30 |
! |
0 | 31 |
|
78 | 32 |
!XWorkstation primitiveDefinitions! |
0 | 33 |
%{ |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
34 |
|
4090 | 35 |
#define SUPPORT_MOTIF_WM_HINTS |
36 |
||
1062 | 37 |
#ifdef LINUX |
38 |
# define SHM |
|
39 |
#endif |
|
40 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
41 |
#define COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
42 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
43 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
44 |
static int __cnt_color = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
45 |
static int __cnt_bitmap = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
46 |
static int __cnt_view = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
47 |
static int __cnt_gc = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
48 |
static int __cnt_cursor = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
49 |
static int __cnt_font = 0; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
50 |
|
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
51 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
52 |
|
46 | 53 |
/* |
54 |
* x does a typedef Time - I need Object Time ... |
|
55 |
*/ |
|
2791 | 56 |
#undef Time |
0 | 57 |
#define Time XTime |
58 |
||
391
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
59 |
/* |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
60 |
* x does a #define True / False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
61 |
* 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
|
62 |
*/ |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
63 |
#undef True |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
64 |
#undef False |
d3cad7c15ae2
well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents:
386
diff
changeset
|
65 |
|
37 | 66 |
#ifdef memset |
67 |
# undef memset |
|
68 |
#endif |
|
69 |
||
1891 | 70 |
|
0 | 71 |
#include <stdio.h> |
72 |
#include <X11/Xlib.h> |
|
73 |
#include <X11/Xutil.h> |
|
74 |
#include <X11/Xatom.h> |
|
75 |
||
150 | 76 |
#define XK_MISCELLANY |
77 |
#include <X11/keysymdef.h> |
|
78 |
||
277
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
79 |
#include <X11/cursorfont.h> |
eb67c44da084
testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
80 |
|
1974 | 81 |
#ifdef LINUX |
82 |
# include <sys/socket.h> |
|
83 |
#endif |
|
84 |
||
2422
6bffcb4c8360
changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents:
2386
diff
changeset
|
85 |
|
90 | 86 |
/* |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
87 |
* this define suppresses XAllocColor/XFreeColor on |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
88 |
* 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
|
89 |
* 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
|
90 |
*/ |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
91 |
#define QUICK_TRUE_COLORS |
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
92 |
|
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
93 |
/* |
0 | 94 |
* shape support works; enabled by -DSHAPE in makefile |
95 |
* see RoundClock and RoundGlobe examples |
|
96 |
*/ |
|
97 |
#ifdef SHAPE |
|
98 |
# include <X11/extensions/shape.h> |
|
99 |
#endif |
|
100 |
||
101 |
/* |
|
150 | 102 |
* shared memory extension access is currently not supported |
0 | 103 |
* (only query is implemented) |
104 |
*/ |
|
105 |
#ifdef SHM |
|
106 |
# include <X11/extensions/XShm.h> |
|
107 |
#endif |
|
108 |
||
109 |
/* |
|
150 | 110 |
* multiBuffer extension access is currently not supported |
111 |
* (only query is implemented) |
|
112 |
*/ |
|
113 |
#ifdef MBUF |
|
114 |
# include <X11/extensions/multibuf.h> |
|
115 |
#endif |
|
116 |
||
117 |
/* |
|
118 |
* XVideo extension access is currently not supported |
|
119 |
* (only query is implemented) |
|
120 |
*/ |
|
121 |
#ifdef XVIDEO |
|
122 |
# include <X11/extensions/Xv.h> |
|
123 |
#endif |
|
124 |
||
125 |
/* |
|
186 | 126 |
* PEX extension - if available |
127 |
*/ |
|
128 |
#ifdef PEX5 |
|
129 |
# include <PEX5/PEX.h> |
|
130 |
#endif |
|
131 |
||
132 |
/* |
|
133 |
* XImage extension - if available |
|
134 |
*/ |
|
135 |
#ifdef XIE |
|
136 |
# include <X11/extensions/XIE.h> |
|
137 |
#endif |
|
138 |
||
139 |
/* |
|
90 | 140 |
* when I have more time to check it out, I will support display-PS |
0 | 141 |
*/ |
142 |
#ifdef DPS |
|
143 |
# ifdef sgi |
|
144 |
# include <X11/extensions/XDPS.h> |
|
145 |
# include <X11/extensions/XDPSlib.h> |
|
146 |
# include <X11/extensions/dpsXclient.h> |
|
147 |
# else |
|
148 |
# include <DPS/XDPS.h> |
|
149 |
# include <DPS/XDPSlib.h> |
|
150 |
# include <DPS/dpsXclient.h> |
|
151 |
# endif |
|
152 |
#endif |
|
153 |
||
1898 | 154 |
#if defined(someMachine) |
155 |
/* |
|
156 |
* if nformats cannot be found in the Display structure ... |
|
157 |
*/ |
|
158 |
# define NO_PRIVATE_DISPLAY_ACCESS |
|
159 |
#endif |
|
160 |
||
161 |
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6) |
|
90 | 162 |
/* |
163 |
* accessing private data in Display ... sorry |
|
164 |
*/ |
|
165 |
# define DISPLAYACCESS(d) ((_XPrivDisplay)d) |
|
166 |
#else |
|
167 |
# define DISPLAYACCESS(d) d |
|
168 |
#endif |
|
169 |
||
78 | 170 |
/* |
171 |
* some defines - tired of typing ... |
|
172 |
*/ |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
173 |
#define __DisplayVal(o) (Display *)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
174 |
#define __DrawableVal(o) (Drawable)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
175 |
#define __WindowVal(o) (Window)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
176 |
#define __PixmapVal(o) (Pixmap)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
177 |
#define __GCVal(o) (GC)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
178 |
#define __CursorVal(o) (Cursor)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
179 |
#define __FontVal(o) (XFontStruct *)(__externalAddressVal(o)) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
180 |
#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
|
181 |
|
3693 | 182 |
#define __MKATOMOBJ(a) __MKSMALLINT(a) /* add STORE macro if ever changed */ |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
183 |
#define __AtomVal(o) __intVal(o) |
211 | 184 |
#define __isAtomID(o) __isSmallInteger(o) |
185 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
186 |
#define myDpy __DisplayVal(__INST(displayId)) |
555 | 187 |
#define ISCONNECTED (__INST(displayId) != nil) |
78 | 188 |
|
1891 | 189 |
#ifdef __VMS__ |
1899 | 190 |
# include "vms_Xnames.h" |
1891 | 191 |
#endif |
192 |
||
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
193 |
void __XTimeoutErrorHandler(); |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
194 |
int __XErrorHandler__(); |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
195 |
int __XIOErrorHandler__(); |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
196 |
|
4245 | 197 |
/* |
198 |
* these two macros should be placed around X-lib calls, |
|
199 |
* which may block due to a broken connection. |
|
200 |
* They setup/remove a VM-timeout which raises an exception |
|
201 |
* after xlibTimeout seconds. |
|
202 |
* This exception will shutDown the connection. |
|
203 |
* Q: is this a good idea for the local display ? |
|
204 |
*/ |
|
205 |
#define __ENTER_XLIB(whichTimeout) \ |
|
1974 | 206 |
{ \ |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
207 |
__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
208 |
__blockingPrimitiveTimeoutArg__ = (INT)self; \ |
4245 | 209 |
__blockingPrimitiveTimeout__ = __intVal(__INST(whichTimeout)) * 50; \ |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
210 |
} { |
4245 | 211 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
212 |
#define LEAVE_XLIB() \ |
1974 | 213 |
{ \ |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
214 |
__blockingPrimitiveTimeout__ = 0; \ |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
215 |
} } |
1974 | 216 |
|
4245 | 217 |
#define ENTER_XLIB() __ENTER_XLIB(xlibTimeout) |
218 |
#define ENTER_XLIB2() __ENTER_XLIB(xlibTimeoutForWindowCreation) |
|
219 |
||
4090 | 220 |
#ifdef SUPPORT_MOTIF_WM_HINTS |
221 |
# ifdef SOME_MACHINE |
|
222 |
# include <anIncludeFileWhichDefinesTheStuffBelow> |
|
223 |
# endif |
|
224 |
||
225 |
# ifndef MWM_HINTS_FUNCTIONS |
|
226 |
# define MWM_HINTS_FUNCTIONS (1L << 0) |
|
227 |
# define MWM_HINTS_DECORATIONS (1L << 1) |
|
228 |
# define MWM_HINTS_INPUT_MODE (1L << 2) |
|
229 |
# define MWM_HINTS_STATUS (1L << 3) |
|
230 |
||
231 |
# define MWM_FUNC_ALL (1L << 0) |
|
232 |
# define MWM_FUNC_RESIZE (1L << 1) |
|
233 |
# define MWM_FUNC_MOVE (1L << 2) |
|
234 |
# define MWM_FUNC_MINIMIZE (1L << 3) |
|
235 |
# define MWM_FUNC_MAXIMIZE (1L << 4) |
|
236 |
# define MWM_FUNC_CLOSE (1L << 5) |
|
237 |
||
238 |
# define MWM_INPUT_MODELESS 0 |
|
239 |
# define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 |
|
240 |
# define MWM_INPUT_SYSTEM_MODAL 2 |
|
241 |
# define MWM_INPUT_FULL_APPLICATION_MODAL 3 |
|
242 |
||
243 |
# define MWM_DECOR_NONE 0 |
|
244 |
# define MWM_DECOR_ALL (1L << 0) |
|
245 |
# define MWM_DECOR_BORDER (1L << 1) |
|
246 |
# define MWM_DECOR_RESIZEH (1L << 2) |
|
247 |
# define MWM_DECOR_TITLE (1L << 3) |
|
248 |
# define MWM_DECOR_MENU (1L << 4) |
|
249 |
# define MWM_DECOR_MINIMIZE (1L << 5) |
|
250 |
# define MWM_DECOR_MAXIMIZE (1L << 6) |
|
251 |
# endif |
|
252 |
#endif /* SUPPORT_MOTIF_WM_HINTS */ |
|
253 |
||
254 |
/* |
|
255 |
* openlook hints are not supported yet |
|
256 |
* - noone needs them anymore ;-( |
|
257 |
*/ |
|
258 |
#ifdef SUPPORT_OPENLOOCK_WM_HINTS |
|
259 |
# ifdef SOME_MACHINE |
|
260 |
# include <anIncludeFileWhichDefinesTheStuffBelow> |
|
261 |
# endif |
|
262 |
||
263 |
# ifndef OL_DECOR_CLOSE |
|
264 |
# define OL_DECOR_CLOSE (1L << 0) |
|
265 |
# define OL_DECOR_RESIZEH (1L << 1) |
|
266 |
# define OL_DECOR_HEADER (1L << 2) |
|
267 |
# define OL_DECOR_ICON_NAME (1L << 3) |
|
268 |
# define OL_DECOR_ALL (OL_DECOR_CLOSE | OL_DECOR_RESIZEH | OL_DECOR_HEADER | OL_DECOR_ICON_NAME) |
|
269 |
# define OL_ANY_HINTS (1L << 7) |
|
270 |
# endif |
|
271 |
#endif /* SUPPORT_OPENLOOCK_WM_HINTS */ |
|
272 |
||
4082 | 273 |
|
78 | 274 |
%} |
275 |
! ! |
|
276 |
||
277 |
!XWorkstation primitiveVariables! |
|
278 |
%{ |
|
0 | 279 |
/* |
146 | 280 |
* remembered info from private error handler |
0 | 281 |
*/ |
1974 | 282 |
static char lastErrorMsg[128] = ""; |
1888 | 283 |
static unsigned INT lastRequestCode = 0; |
284 |
static unsigned INT lastMinorCode = 0; |
|
285 |
static unsigned INT lastResource = 0; |
|
129 | 286 |
|
287 |
static int __debug__ = 0; |
|
3468 | 288 |
|
129 | 289 |
#define DPRINTF(x) if (__debug__) { printf x; } |
3468 | 290 |
|
78 | 291 |
%} |
292 |
! ! |
|
293 |
||
294 |
!XWorkstation primitiveFunctions! |
|
295 |
%{ |
|
1062 | 296 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
297 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
298 |
* 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
|
299 |
* to include that stuff. Should be #ifdef'd ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
300 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
301 |
#ifndef ELF |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
302 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
303 |
# ifdef __GNUC__ |
4245 | 304 |
VOLATILE |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
305 |
# endif |
1081 | 306 |
static |
1062 | 307 |
dummyToForceLoading() { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
308 |
XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
309 |
XCloseDisplay(0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
310 |
XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
311 |
XSetWindowColormap(0, 0, 0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
312 |
XQueryColors(0,0,0,0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
313 |
# ifdef SHM |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
314 |
XShmAttach(0, 0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
315 |
XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
316 |
XShmDetach(0, 0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
317 |
XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
318 |
shmctl(0,0,0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
319 |
fgetc(0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
320 |
# endif |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
321 |
} |
1062 | 322 |
#endif |
323 |
||
18 | 324 |
/* |
144 | 325 |
* catch X-errors and forward as errorInterrupt:#DisplayError, |
326 |
* (which itself invokes my handler and optionally raises an exceptionSignal) |
|
90 | 327 |
* the implementation below is somewhat wrong: it will |
78 | 328 |
* report all errors for Display, even though there could be |
162 | 329 |
* more than one display connection. (being fixed, new errorInterrupt mechanism |
330 |
* allows passing an additional argument, which is the displayID ...) |
|
18 | 331 |
*/ |
1974 | 332 |
int |
12 | 333 |
__XErrorHandler__(dpy, event) |
0 | 334 |
Display *dpy; |
335 |
XErrorEvent *event; |
|
336 |
{ |
|
1974 | 337 |
XGetErrorText(dpy, event->error_code, lastErrorMsg, 127); |
338 |
lastErrorMsg[127] = '\0'; |
|
1060
bc581886fe8f
dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
339 |
|
0 | 340 |
if (lastErrorMsg[0] == '\0') { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
341 |
sprintf(lastErrorMsg, "code: %d", event->error_code); |
0 | 342 |
} |
2 | 343 |
lastRequestCode = event->request_code; |
344 |
lastMinorCode = event->minor_code; |
|
345 |
lastResource = event->resourceid; |
|
911 | 346 |
if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) { |
4245 | 347 |
/* |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
348 |
* this is a BadWindow error for X_DestroyWindow. |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
349 |
* ignore it here, since it results from the GC freeing windows |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
350 |
* in non bottom-up window order. |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
351 |
*/ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
352 |
return 0; |
911 | 353 |
} |
2 | 354 |
|
254
d6f12ecd7767
ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents:
250
diff
changeset
|
355 |
if (@global(ErrorPrinting) == true) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
356 |
fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n", |
4245 | 357 |
event->request_code, event->request_code, |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
358 |
event->minor_code, event->minor_code, event->resourceid); |
4245 | 359 |
fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
360 |
event->error_code, lastErrorMsg); |
1974 | 361 |
} |
362 |
||
1990 | 363 |
__errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy)); |
0 | 364 |
return 0; |
365 |
} |
|
366 |
||
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
367 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
368 |
* much like the above, but for IO Errors; |
1974 | 369 |
* forwarded as errorInterrupt:#DisplayIOError, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
370 |
* In single display apps, handling those here does not |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
371 |
* really make sense (except, for a controlled cleanup). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
372 |
* However, in multiDisplay apps, a single broken |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
373 |
* connection should not affect the other users. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
374 |
*/ |
1974 | 375 |
int |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
376 |
__XIOErrorHandler__(dpy) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
377 |
Display *dpy; |
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 |
if (@global(ErrorPrinting) == true) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
380 |
fprintf(stderr, "XWorkstation [error]: I/O error\n"); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
381 |
} |
1974 | 382 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError), |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
383 |
__MKEXTERNALADDRESS(dpy)); |
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
384 |
|
3207 | 385 |
#if 0 |
386 |
/* |
|
387 |
* don't do this. |
|
388 |
* This error is called asynchronously, and the wrong process may be terminated |
|
389 |
*/ |
|
390 |
||
391 |
||
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
392 |
/* |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
393 |
* if we return from the error interrupt ... |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
394 |
*/ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
395 |
__internalError("unhandled display I/O error"); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
396 |
__terminateProcess(0); /* soft terminate */ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
397 |
__terminateProcess(1); /* hard terminate */ |
1974 | 398 |
/* never reached */ |
3207 | 399 |
#endif |
400 |
||
1974 | 401 |
return 0; |
402 |
} |
|
403 |
||
404 |
/* |
|
405 |
* timeout error in case of Xlib request timeout. |
|
406 |
* forwarded as errorInterrupt:#DisplayIOTimeoutError, |
|
407 |
* This is generated synthetically by the VM if the |
|
408 |
* timeoutHandler has been set. |
|
409 |
*/ |
|
410 |
void |
|
411 |
__XTimeoutErrorHandler(displayDeviceInst) |
|
412 |
OBJ displayDeviceInst; |
|
413 |
{ |
|
4245 | 414 |
extern OBJ __GLOBAL_GET_BY_NAME(); |
415 |
||
1974 | 416 |
if (@global(ErrorPrinting) == true) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
417 |
fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst); |
1974 | 418 |
} |
4245 | 419 |
if ((displayDeviceInst == @global(MainDisplay)) |
420 |
|| (displayDeviceInst == __GLOBAL_GET_BY_NAME("Display"))) { /* cannot use global(Display), because Display is a typedef in Xlib */ |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
421 |
fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n"); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
422 |
return; |
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
423 |
} |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
424 |
|
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
425 |
#if 0 |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
426 |
|
4245 | 427 |
This is litter: |
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
428 |
1. How should I ever close the display without a displayId? |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
429 |
|
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
430 |
2. This may loop for ever, if there is some data in the socket, but #eventPending returns |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
431 |
false because displayId is nil. |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
432 |
|
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
433 |
3. The problem is not the EventListener, which is reading (and waiting in #eventPending), |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
434 |
but maybe other processes writing to the Display and blocking the system again (for 30 Seconds). |
2057
ff2964f2bd9d
increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents:
2021
diff
changeset
|
435 |
|
1974 | 436 |
/* |
437 |
* must immediately flush that displays deviceID - otherwise, |
|
438 |
* the scheduler may try to ask for pending events without a watchdog |
|
439 |
* timer ... |
|
440 |
*/ |
|
1990 | 441 |
__OINST(displayDeviceInst, displayId) = nil; |
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
442 |
#endif |
1990 | 443 |
__immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst); |
3205
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
444 |
|
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
445 |
/* |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
446 |
* if we return from the error interrupt ... |
8648fa72c0af
Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents:
3203
diff
changeset
|
447 |
*/ |
3206 | 448 |
if (__OINST(displayDeviceInst, displayId) != nil) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
449 |
__internalError("unhandled display Timeout error"); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
450 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
451 |
__terminateProcess(0); /* soft terminate */ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
452 |
__terminateProcess(1); /* hard terminate */ |
3206 | 453 |
} |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
454 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
455 |
|
90 | 456 |
#ifdef VIRTUAL_ROOT |
0 | 457 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
458 |
* added since RootWindow-macro is not sufficient |
18 | 459 |
* when virtual root-windows are involved (i.e. tvtwm) |
460 |
*/ |
|
461 |
static Window |
|
462 |
getRootWindow(dpy, screen) |
|
463 |
Display *dpy; |
|
464 |
{ |
|
465 |
Window root; |
|
466 |
Atom vRootAtom = None; |
|
467 |
int i; |
|
468 |
Window rootReturn, parentReturn; |
|
1050
b2c03e24d56c
another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents:
1049
diff
changeset
|
469 |
Window* children = (Window *)0; |
18 | 470 |
unsigned int numChildren; |
471 |
||
472 |
root = RootWindow(dpy, screen); |
|
473 |
/* |
|
474 |
* on IRIS, this creates a badwindow error - why ? |
|
475 |
* children contains a funny window (000034) |
|
476 |
*/ |
|
90 | 477 |
# if !defined(IRIS) || defined(IRIX5) |
1887 | 478 |
if (root) { |
3920 | 479 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True); |
480 |
if (vRootAtom != None) { |
|
481 |
if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) { |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
482 |
for (i=0; i < numChildren; i++) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
483 |
Atom actual_type; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
484 |
int actual_format; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
485 |
unsigned long nitems, bytesafter; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
486 |
Window* newRoot = (Window*) 0; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
487 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
488 |
if (children[i]) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
489 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
490 |
0L, 1L, False, XA_WINDOW, |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
491 |
&actual_type, &actual_format, &nitems, &bytesafter, |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
492 |
(unsigned char**) &newRoot) == Success && newRoot) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
493 |
root = *newRoot; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
494 |
XFree(newRoot); /* XXX */ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
495 |
break; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
496 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
497 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
498 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
499 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
500 |
if (children) XFree( children ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
501 |
} |
18 | 502 |
} |
90 | 503 |
# endif |
18 | 504 |
return root; |
505 |
} |
|
90 | 506 |
#endif |
0 | 507 |
%} |
78 | 508 |
! ! |
0 | 509 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
510 |
!XWorkstation class methodsFor:'documentation'! |
295 | 511 |
|
512 |
copyright |
|
513 |
" |
|
514 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1344 | 515 |
All Rights Reserved |
295 | 516 |
|
517 |
This software is furnished under a license and may be used |
|
518 |
only in accordance with the terms of that license and with the |
|
519 |
inclusion of the above copyright notice. This software may not |
|
520 |
be provided or otherwise made available to, or used by, any |
|
521 |
other person. No title to or ownership of the software is |
|
522 |
hereby transferred. |
|
523 |
" |
|
524 |
! |
|
525 |
||
526 |
documentation |
|
527 |
" |
|
528 |
this class provides the interface to X11. It redefines all required methods |
|
4245 | 529 |
from DeviceWorkstation. |
530 |
Notice, that in Smalltalk/X you are not technically limited to one display; |
|
531 |
in theory (and in our practice), you can create Views on many displays |
|
295 | 532 |
simultanously. However, the default setup is for one display only. |
533 |
To support multiple displays, you will have to start another event dispatcher |
|
534 |
process for the other display(s) and create the other views with a slightly |
|
4245 | 535 |
different protocol (ApplicationModel openOnDevice:) or by temporarily answering |
536 |
the other device to the currentScreen query. |
|
537 |
Therefore, 'normal' applications do not have to care for all of this, as the currentScreen |
|
538 |
query is answered by the launcher when opening its applications. |
|
539 |
||
540 |
Timeouts: |
|
541 |
sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by |
|
542 |
default, this would lead to a locked ST/X system. |
|
543 |
Therefore, this class defines a timeOut, whenever doing an Xlib call. |
|
544 |
The default for this timeout is 30seconds. |
|
545 |
This may be a problem with windowmanagers which show a rubber-band rectangle |
|
546 |
when creating windows. |
|
547 |
If the user does not specify the rectangle within 30 seconds, the device assumes |
|
548 |
a timeout and closes the connection. |
|
549 |
As a (kludgy) workaround, a second timeout value is used for window-creation. |
|
550 |
This secondary timeout value defaults to 60*5 seconds (5 minutes). |
|
295 | 551 |
|
552 |
See more documentation in my superclass, DeviceWorkstation. |
|
613 | 553 |
|
554 |
[author:] |
|
1344 | 555 |
Claus Gittinger |
295 | 556 |
" |
557 |
! ! |
|
558 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
559 |
!XWorkstation class methodsFor:'initialization'! |
250
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
560 |
|
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
561 |
initialize |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
562 |
|d| |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
563 |
|
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
564 |
ConservativeSync := OperatingSystem platformName == #win32. |
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
565 |
|
3267 | 566 |
"/ some XServers crash, when given too long strings in XDrawString/XDrawInageString. |
567 |
"/ the following is an adjustable soft-limit. |
|
568 |
MaxStringLength := 4096. |
|
569 |
||
4245 | 570 |
"/ shutdown the X-connection, when no response is received after that many seconds. |
571 |
DefaultXLibTimeout := 30. |
|
572 |
DefaultXLibTimeoutForWindowCreation := 5*60. |
|
573 |
||
3321 | 574 |
RawKeySymTranslation isNil ifTrue:[ |
3693 | 575 |
"/ the following table maps X-keyevents to ST/X |
4245 | 576 |
"/ device independend events. |
3693 | 577 |
"/ It is NOT meant as a keyboardMap replacement. |
578 |
||
579 |
RawKeySymTranslation := d := Dictionary new. |
|
580 |
d at:'Delete_line' put:#DeleteLine. |
|
581 |
d at:'Delete_word' put:#DeleteWord. |
|
582 |
d at:'Down' put:#CursorDown. |
|
583 |
d at:'Up' put:#CursorUp. |
|
584 |
d at:'Left' put:#CursorLeft. |
|
585 |
d at:'Right' put:#CursorRight. |
|
386 | 586 |
] |
2592
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
587 |
|
43cd99949614
need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents:
2541
diff
changeset
|
588 |
"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
|
589 |
! ! |
eaa532ebcad7
modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents:
240
diff
changeset
|
590 |
|
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
591 |
!XWorkstation class methodsFor:'error handling'! |
2 | 592 |
|
129 | 593 |
debug:aBoolean |
594 |
%{ /* NOCONTEXT */ |
|
595 |
||
596 |
__debug__ = (aBoolean == true) ? 1 : 0; |
|
597 |
%} |
|
598 |
! |
|
599 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
600 |
debugResources |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
601 |
%{ |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
602 |
#ifdef COUNT_RESOURCES |
3468 | 603 |
fprintf(stderr, "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
|
604 |
__cnt_color, __cnt_bitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
605 |
__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
|
606 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
607 |
%} |
1404 | 608 |
|
609 |
" |
|
610 |
XWorkstation debugResources |
|
611 |
" |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
612 |
! |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
613 |
|
78 | 614 |
errorStringOfLastError |
615 |
%{ |
|
1065
fdc5b9059d82
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1062
diff
changeset
|
616 |
RETURN ( __MKSTRING(lastErrorMsg) ); |
78 | 617 |
%} |
618 |
! |
|
619 |
||
3036 | 620 |
getConnectionTimeOut |
4245 | 621 |
"returns the default connectionTimeOut (seconds)" |
622 |
||
623 |
^ DefaultXLibTimeout |
|
624 |
! |
|
625 |
||
626 |
getConnectionTimeOutForWindowCreation |
|
627 |
"returns the default connectionTimeOut (seconds)" |
|
628 |
||
629 |
^ DefaultXLibTimeoutForWindowCreation |
|
3036 | 630 |
! |
631 |
||
135 | 632 |
lastErrorString |
4245 | 633 |
"return the last X-error string - |
2 | 634 |
when buffering is on, this may be |
635 |
an error for a long-ago operation" |
|
78 | 636 |
|
637 |
|string requestCode s match line| |
|
638 |
||
639 |
string := self errorStringOfLastError. |
|
640 |
requestCode := self requestCodeOfLastError. |
|
641 |
" |
|
642 |
X specific: search the requestCode in '/usr/lib/X11/XErrorDB', |
|
643 |
and append the name of the corresponding X-request |
|
644 |
" |
|
3814
0d856538e64f
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
3806
diff
changeset
|
645 |
s := '/usr/lib/X11/XErrorDB' asFilename readStreamOrNil. |
78 | 646 |
s notNil ifTrue:[ |
3920 | 647 |
match := 'XRequest.' , requestCode printString. |
648 |
line := s peekForLineStartingWith:match. |
|
649 |
line notNil ifTrue:[ |
|
650 |
string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1) |
|
651 |
]. |
|
652 |
s close. |
|
78 | 653 |
]. |
654 |
^ string |
|
295 | 655 |
! |
656 |
||
657 |
minorCodeOfLastError |
|
658 |
%{ /* NOCONTEXT */ |
|
659 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
660 |
RETURN ( __MKSMALLINT(lastMinorCode) ); |
295 | 661 |
%} |
662 |
! |
|
663 |
||
664 |
requestCodeOfLastError |
|
152 | 665 |
%{ /* NOCONTEXT */ |
666 |
||
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
667 |
RETURN ( __MKSMALLINT(lastRequestCode) ); |
0 | 668 |
%} |
135 | 669 |
! |
670 |
||
295 | 671 |
resourceIdOfLastError |
4169
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
672 |
%{ /* NOCONTEXT */ |
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
673 |
|
4245 | 674 |
if (lastResource != 0) { |
675 |
RETURN ( __MKEXTERNALADDRESS(lastResource) ); |
|
676 |
} |
|
4169
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
677 |
%}. |
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
678 |
|
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
679 |
^ nil |
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
680 |
|
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
681 |
|
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
682 |
" |
4245 | 683 |
Screen resourceIdOfLastError |
4169
35c1ee146ffb
Distinguish no-resource when handling display errors.
Stefan Vogel <sv@exept.de>
parents:
4153
diff
changeset
|
684 |
" |
3016 | 685 |
! |
686 |
||
687 |
setConnectionTimeOut:seconds |
|
4245 | 688 |
"set the default connection timeout (seconds)" |
689 |
||
690 |
DefaultXLibTimeout := seconds |
|
691 |
! |
|
692 |
||
693 |
setConnectionTimeOutForWindowCreation:seconds |
|
694 |
"set the default connection timeout (seconds)" |
|
695 |
||
696 |
DefaultXLibTimeoutForWindowCreation := seconds |
|
0 | 697 |
! ! |
698 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
699 |
!XWorkstation class methodsFor:'queries'! |
104 | 700 |
|
701 |
platformName |
|
133 | 702 |
"ST-80 compatibility. |
2777 | 703 |
Return a string describing the display systems platform. |
704 |
WinWorkstation always returns 'X11'." |
|
133 | 705 |
|
715 | 706 |
^ 'X11' "I don't know what ST-80 returns for X ..." |
707 |
||
708 |
"Modified: 26.5.1996 / 15:32:46 / cg" |
|
104 | 709 |
! ! |
710 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
711 |
!XWorkstation methodsFor:'Signal constants'! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
712 |
|
1974 | 713 |
deviceIOTimeoutErrorSignal |
714 |
"return the per-device signal, which is raised when a timeout |
|
715 |
IO error (i.e. broken connection) occurs." |
|
716 |
||
717 |
^ deviceIOTimeoutErrorSignal |
|
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
718 |
! ! |
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
719 |
|
0 | 720 |
!XWorkstation methodsFor:'accessing & queries'! |
721 |
||
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
722 |
activateOnClick:aBoolean |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
723 |
"set/clear the activateOnClick behavior. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
724 |
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
|
725 |
the (top) window. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
726 |
Windows users typically enable this; |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
727 |
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
|
728 |
it disabled. |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
729 |
Returns the previous setting." |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
730 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
731 |
|prev| |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
732 |
|
3245 | 733 |
prev := activateOnClick ? false. |
734 |
aBoolean notNil ifTrue:[ |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
735 |
activateOnClick := aBoolean. |
3245 | 736 |
]. |
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
737 |
^ prev |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
738 |
|
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
739 |
" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
740 |
Display class activateOnClick:true |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
741 |
Display class activateOnClick:false |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
742 |
" |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
743 |
! |
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
744 |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
745 |
anyButtonMotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
746 |
"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
|
747 |
This is the devices mask." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
748 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
749 |
%{ /* NOCONTEXT */ |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
750 |
RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask)); |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
751 |
%}. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
752 |
^ nil |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
753 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
754 |
|
295 | 755 |
blackpixel |
756 |
"return the colornumber of black" |
|
757 |
||
758 |
^ blackpixel |
|
759 |
! |
|
760 |
||
761 |
button1MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
762 |
"return the state-mask for button1 in motion events' state-field. |
295 | 763 |
For backward compatibility." |
764 |
||
765 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
766 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
295 | 767 |
%} |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
768 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
769 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
770 |
Display button1MotionMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
771 |
" |
295 | 772 |
! |
773 |
||
774 |
button2MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
775 |
"return the state-mask for button2 in motion events' state-field |
295 | 776 |
For backward compatibility." |
777 |
||
778 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
779 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
295 | 780 |
%} |
781 |
! |
|
782 |
||
783 |
button3MotionMask |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
784 |
"return the state-mask for button3 in motion events' state-field |
295 | 785 |
For backward compatibility." |
786 |
||
787 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
788 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 789 |
%} |
790 |
! |
|
791 |
||
792 |
buttonMotionMask:aButton |
|
793 |
"return the state-mask for button1 in motion events state-field. |
|
794 |
This is the devices mask." |
|
795 |
||
796 |
%{ /* NOCONTEXT */ |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
797 |
if (aButton == __MKSMALLINT(1)) { |
1344 | 798 |
RETURN (__MKSMALLINT(Button1MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
799 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
800 |
if (aButton == __MKSMALLINT(2)) { |
1344 | 801 |
RETURN (__MKSMALLINT(Button2MotionMask)); |
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
802 |
} |
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
803 |
if (aButton == __MKSMALLINT(3)) { |
1344 | 804 |
RETURN (__MKSMALLINT(Button3MotionMask)); |
295 | 805 |
} |
806 |
%}. |
|
807 |
^ nil |
|
808 |
! |
|
809 |
||
382 | 810 |
controlMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
811 |
"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
|
812 |
|
3245 | 813 |
"/ obsolete |
814 |
^ self ctrlModifierMask |
|
815 |
||
816 |
||
382 | 817 |
! |
818 |
||
0 | 819 |
displayFileDescriptor |
820 |
"return the displays fileNumber - for select" |
|
821 |
||
822 |
%{ /* NOCONTEXT */ |
|
2231 | 823 |
#ifndef WIN32 |
150 | 824 |
if (ISCONNECTED) { |
1344 | 825 |
RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) ); |
150 | 826 |
} |
2231 | 827 |
#endif |
150 | 828 |
RETURN (nil); |
0 | 829 |
%} |
830 |
! |
|
831 |
||
133 | 832 |
displayName |
833 |
"return the X-connections display name. |
|
4245 | 834 |
This is (currently) nil for the default display, |
133 | 835 |
something like foo:0 for any other remote display. |
836 |
Future versions may return non-nil strings for the default display as well." |
|
837 |
||
838 |
^ displayName |
|
839 |
! |
|
840 |
||
4153 | 841 |
displayName: something |
842 |
||
843 |
displayName := something |
|
844 |
! |
|
845 |
||
341 | 846 |
protocolVersion |
847 |
"return the X-servers protocol version - should normally not be of |
|
848 |
any interest" |
|
849 |
||
850 |
%{ /* NOCONTEXT */ |
|
851 |
if (ISCONNECTED) { |
|
1344 | 852 |
RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) ); |
341 | 853 |
} |
854 |
RETURN (nil); |
|
855 |
%} |
|
856 |
||
857 |
" |
|
858 |
Display protocolVersion |
|
859 |
" |
|
860 |
! |
|
861 |
||
862 |
serverVendor |
|
863 |
"return the X-server vendor string - this should normally not be of |
|
864 |
any interest, but can be for special cases |
|
865 |
(to avoid bugs in certain implementations)" |
|
866 |
%{ |
|
867 |
if (ISCONNECTED) { |
|
1344 | 868 |
RETURN ( __MKSTRING(XServerVendor(myDpy)) ); |
341 | 869 |
} |
870 |
RETURN (nil); |
|
871 |
%} |
|
872 |
||
873 |
" |
|
874 |
Display serverVendor |
|
875 |
" |
|
876 |
! |
|
877 |
||
382 | 878 |
shiftMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
879 |
"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
|
880 |
|
3245 | 881 |
"/ obsolete |
882 |
^ self shiftModifierMask |
|
382 | 883 |
! |
884 |
||
341 | 885 |
translatePoint:aPoint from:windowId1 to:windowId2 |
886 |
"given a point in window1, return the coordinate in window2. |
|
887 |
This expects a device coordinate (relative to the first views origin) |
|
888 |
in aPoint and returns a device coordinate relative to the 2nd views origin. |
|
889 |
- use to xlate points from a window to rootwindow" |
|
890 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
891 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
892 |
|
341 | 893 |
|x1 y1 x2 y2| |
894 |
||
895 |
x1 := x2 := aPoint x truncated. |
|
896 |
y1 := y2 := aPoint y truncated. |
|
897 |
%{ |
|
898 |
int xpos, ypos; |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
899 |
Window w1, w2, child_ret; |
555 | 900 |
int screen = __intVal(__INST(screen)); |
1209 | 901 |
|
902 |
if (ISCONNECTED |
|
903 |
&& __isExternalAddress(windowId1) |
|
341 | 904 |
&& __isExternalAddress(windowId2) |
905 |
&& __bothSmallInteger(x1, y1)) { |
|
1344 | 906 |
Display *dpy = myDpy; |
1974 | 907 |
Window rootWin; |
1344 | 908 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
909 |
w1 = __WindowVal(windowId1); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
910 |
w2 = __WindowVal(windowId2); |
1974 | 911 |
|
4245 | 912 |
#ifdef VIRTUAL_ROOT |
1974 | 913 |
rootWin = RootWindow(dpy, screen); |
3920 | 914 |
if (w1 == rootWin) { |
915 |
ENTER_XLIB(); |
|
916 |
w1 = getRootWindow(dpy, screen); |
|
917 |
LEAVE_XLIB(); |
|
918 |
} |
|
919 |
if (w2 == rootWin) { |
|
920 |
ENTER_XLIB(); |
|
921 |
w2 = getRootWindow(dpy, screen); |
|
922 |
LEAVE_XLIB(); |
|
1344 | 923 |
} |
341 | 924 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
925 |
|
1974 | 926 |
ENTER_XLIB(); |
1344 | 927 |
XTranslateCoordinates(dpy, w1, w2, |
4245 | 928 |
__intVal(x1), __intVal(y1), |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
929 |
&xpos, &ypos, &child_ret); |
1974 | 930 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
931 |
|
1344 | 932 |
x2 = __MKSMALLINT(xpos); |
933 |
y2 = __MKSMALLINT(ypos); |
|
341 | 934 |
} |
935 |
%}. |
|
936 |
||
937 |
^ (x2 @ y2) |
|
938 |
! |
|
939 |
||
940 |
vendorRelease |
|
941 |
"return the X-servers vendor release - should normally not be of |
|
942 |
any interest, but can be for special cases. |
|
943 |
(to avoid bugs in certain implementations)" |
|
944 |
||
945 |
%{ /* NOCONTEXT */ |
|
946 |
if (ISCONNECTED) { |
|
1344 | 947 |
RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) ); |
341 | 948 |
} |
949 |
RETURN (nil); |
|
950 |
%} |
|
951 |
||
952 |
" |
|
953 |
Display vendorRelease |
|
954 |
" |
|
955 |
! |
|
956 |
||
957 |
viewIdFromPoint:aPoint in:windowId |
|
958 |
"given a point in rootWindow, return the viewId of the subview of windowId |
|
959 |
hit by this coordinate. Return nil if no view was hit. |
|
960 |
The returned id may be the id of a non ST view. |
|
961 |
- used to find the window to drop objects after a cross-view drag." |
|
962 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
963 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
964 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
965 |
%{ |
555 | 966 |
int screen = __intVal(__INST(screen)); |
341 | 967 |
OBJ xp, yp; |
968 |
int xpos, ypos; |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
969 |
Window child_ret; |
341 | 970 |
|
1209 | 971 |
if (ISCONNECTED |
972 |
&& __isExternalAddress(windowId) |
|
341 | 973 |
&& __isPoint(aPoint)) { |
3424 | 974 |
Display *dpy = myDpy; |
975 |
||
976 |
xp = _point_X(aPoint); |
|
977 |
yp = _point_Y(aPoint); |
|
978 |
if (__bothSmallInteger(xp, yp)) { |
|
979 |
||
980 |
ENTER_XLIB(); |
|
981 |
XTranslateCoordinates(dpy, |
|
982 |
RootWindow(dpy, screen), |
|
983 |
__WindowVal(windowId), |
|
4245 | 984 |
__intVal(xp), __intVal(yp), |
3424 | 985 |
&xpos, &ypos, &child_ret); |
986 |
LEAVE_XLIB(); |
|
987 |
||
988 |
if (child_ret) { |
|
989 |
RETURN ( __MKEXTERNALADDRESS(child_ret) ); |
|
990 |
} |
|
991 |
RETURN ( nil ); |
|
992 |
} |
|
341 | 993 |
} |
994 |
%}. |
|
995 |
windowId notNil ifTrue:[ |
|
3424 | 996 |
aPoint isPoint ifTrue:[ |
997 |
^ self viewIdFromPoint:aPoint asPoint truncated in:windowId |
|
998 |
] |
|
341 | 999 |
]. |
1000 |
||
1001 |
^ nil |
|
3412
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
1002 |
|
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
1003 |
" |
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
1004 |
Display viewIdFromPoint:100@100 in:Display realRootWindowId |
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
1005 |
" |
341 | 1006 |
! |
1007 |
||
1008 |
virtualExtent |
|
1009 |
"return the virtual extent of the display (in pixels). |
|
1010 |
On most systems, this is the same as the physical width; |
|
1011 |
except, if a window manager with a virtual desktop like olvwm |
|
1012 |
(simulating a bigger screen) is running." |
|
1013 |
||
1014 |
%{ |
|
1209 | 1015 |
if (ISCONNECTED |
4245 | 1016 |
&& (__INST(rootId) != __INST(virtualRootId)) |
555 | 1017 |
&& __isExternalAddress(__INST(virtualRootId))) { |
1344 | 1018 |
Window vRootWin; |
1019 |
Window root; |
|
1020 |
int x, y; |
|
1021 |
unsigned int width, height; |
|
1022 |
unsigned int dummy; |
|
1974 | 1023 |
int ret; |
1344 | 1024 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1025 |
vRootWin = __WindowVal(__INST(virtualRootId)); |
1974 | 1026 |
ENTER_XLIB(); |
1027 |
ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height, |
|
1028 |
&dummy, &dummy); |
|
1029 |
LEAVE_XLIB(); |
|
1030 |
if (ret) { |
|
1344 | 1031 |
RETURN ( __MKPOINT_INT(width, height) ); |
1032 |
} |
|
341 | 1033 |
} |
1034 |
%}. |
|
1035 |
^ width @ height |
|
1036 |
! |
|
1037 |
||
1038 |
whitepixel |
|
1039 |
"return the colornumber of white" |
|
1040 |
||
1041 |
^ whitepixel |
|
4245 | 1042 |
! |
1043 |
||
1044 |
xlibTimeout |
|
1045 |
^ xlibTimeout |
|
1046 |
! |
|
1047 |
||
1048 |
xlibTimeout:seconds |
|
1049 |
xlibTimeout := seconds |
|
1050 |
! |
|
1051 |
||
1052 |
xlibTimeoutForWindowCreation |
|
1053 |
^ xlibTimeoutForWindowCreation |
|
1054 |
! |
|
1055 |
||
1056 |
xlibTimeoutForWindowCreation:seconds |
|
1057 |
xlibTimeoutForWindowCreation := seconds |
|
341 | 1058 |
! ! |
1059 |
||
3263 | 1060 |
!XWorkstation methodsFor:'accessing-display capabilities'! |
341 | 1061 |
|
0 | 1062 |
hasDPS |
186 | 1063 |
"return true, if this workstation supports display postscript. |
1064 |
Both the server must support it, and the feature must have been |
|
1065 |
enabled in the smalltalk system, for true to be returned." |
|
0 | 1066 |
|
1067 |
^ hasDPSExtension |
|
186 | 1068 |
|
1069 |
" |
|
4245 | 1070 |
Display hasDPS |
186 | 1071 |
" |
1072 |
! |
|
1073 |
||
150 | 1074 |
hasExtension:extensionString |
1075 |
"query for an X extension. The argument, extensionString |
|
1076 |
should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc). |
|
186 | 1077 |
Return true, if that extension is available in the server. |
1078 |
(which does not imply, that there is support in smalltalk for it." |
|
150 | 1079 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1080 |
<context: #return> |
150 | 1081 |
%{ |
1082 |
int dummy; |
|
1974 | 1083 |
OBJ rslt = false; |
150 | 1084 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1085 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1086 |
&& __isNonNilObject(extensionString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1087 |
&& (__qIsString(extensionString) || __qIsSymbol(extensionString))) { |
1974 | 1088 |
ENTER_XLIB(); |
1344 | 1089 |
if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) { |
1974 | 1090 |
rslt = true; |
1091 |
} |
|
1092 |
LEAVE_XLIB(); |
|
1093 |
} |
|
1094 |
RETURN (rslt); |
|
1095 |
%} |
|
186 | 1096 |
|
1097 |
" |
|
4245 | 1098 |
Display hasExtension:'XVideo' |
1099 |
Display hasExtension:'Input' |
|
1100 |
Display hasExtension:'GLX' |
|
1101 |
Display hasExtension:'X3D-PEX' |
|
1102 |
Display hasExtension:'XInputExtension' |
|
1103 |
Display hasExtension:'SHAPE' |
|
1104 |
Display hasExtension:'MIT-SHM' |
|
1105 |
Display hasExtension:'SGIFullScreenStereo' |
|
186 | 1106 |
" |
150 | 1107 |
! |
1108 |
||
295 | 1109 |
hasImageExtension |
1110 |
"return true, if this workstation supports the X image extension. |
|
1111 |
Both the server must support it, and the feature must have been |
|
1112 |
enabled in the smalltalk system, for true to be returned." |
|
1113 |
||
1114 |
^ hasImageExtension |
|
1115 |
||
1116 |
" |
|
4245 | 1117 |
Display hasImageExtension |
295 | 1118 |
" |
1119 |
! |
|
1120 |
||
1121 |
hasInputExtension |
|
1122 |
"return true, if this workstation supports the X input extension. |
|
1123 |
Both the server must support it, and the feature must have been |
|
1124 |
enabled in the smalltalk system, for true to be returned." |
|
1125 |
||
1126 |
^ hasInputExtension |
|
1127 |
||
1128 |
" |
|
4245 | 1129 |
Display hasInputExtension |
295 | 1130 |
" |
1131 |
! |
|
1132 |
||
1133 |
hasMultibuffer |
|
1134 |
"return true, if this workstation supports the multibuffer extension. |
|
1135 |
Both the server must support it, and the feature must have been |
|
1136 |
enabled in the smalltalk system, for true to be returned." |
|
1137 |
||
1138 |
^ hasMbufExtension |
|
1139 |
||
1140 |
" |
|
4245 | 1141 |
Display hasMultibuffer |
295 | 1142 |
" |
1143 |
! |
|
1144 |
||
1145 |
hasPEX |
|
1146 |
"return true, if this workstation supports PEX 3D graphics. |
|
1147 |
Both the server must support it, and the feature must have been |
|
1148 |
enabled in the smalltalk system, for true to be returned." |
|
1149 |
||
1150 |
^ hasPEXExtension |
|
1151 |
||
1152 |
" |
|
4245 | 1153 |
Display hasPEX |
295 | 1154 |
" |
1155 |
! |
|
1156 |
||
1157 |
hasShm |
|
1158 |
"return true, if this workstation supports the shared pixmap extension. |
|
1159 |
Both the server must support it, and the feature must have been |
|
1160 |
enabled in the smalltalk system, for true to be returned." |
|
1161 |
||
1162 |
^ hasShmExtension |
|
1163 |
||
1164 |
" |
|
4245 | 1165 |
Display hasShm |
295 | 1166 |
" |
1167 |
! |
|
1168 |
||
1169 |
hasXVideo |
|
1170 |
"return true, if this workstation supports the XVideo extension. |
|
1171 |
Both the server must support it, and the feature must have been |
|
1172 |
enabled in the smalltalk system, for true to be returned." |
|
1173 |
||
1174 |
^ hasXVideoExtension |
|
1175 |
||
1176 |
" |
|
4245 | 1177 |
Display hasXVideo |
295 | 1178 |
" |
1179 |
! |
|
1180 |
||
1181 |
iconSizes |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
1182 |
"Get the preferred/supported icon sizes. These are set by the window manager. |
819 | 1183 |
We return nil (if not set) or an OrderedCollection of iconSize specs." |
295 | 1184 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1185 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1186 |
|
295 | 1187 |
|xIconSizes count ret| |
1188 |
||
1189 |
%{ |
|
555 | 1190 |
int screen = __intVal(__INST(screen)); |
295 | 1191 |
XIconSize *sizeList; |
1192 |
int cnt; |
|
1193 |
||
1194 |
if (ISCONNECTED) { |
|
1344 | 1195 |
Display *dpy = myDpy; |
1974 | 1196 |
int status; |
1197 |
||
1198 |
ENTER_XLIB(); |
|
2541 | 1199 |
status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt); |
1974 | 1200 |
LEAVE_XLIB(); |
1201 |
if (status > 0) { |
|
1344 | 1202 |
xIconSizes = __MKEXTERNALBYTES(sizeList); |
1203 |
count = __MKSMALLINT(cnt); |
|
1204 |
} |
|
295 | 1205 |
} |
1206 |
%}. |
|
1207 |
xIconSizes isNil ifTrue:[^ nil]. |
|
1208 |
||
1209 |
ret := OrderedCollection new:count. |
|
1210 |
1 to:count do:[ :i | |
|
1344 | 1211 |
|minWidth minHeight maxWidth maxHeight widthStep heightStep d| |
295 | 1212 |
|
1213 |
%{ |
|
1344 | 1214 |
XIconSize *slp; |
1215 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1216 |
slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1]; |
1344 | 1217 |
minWidth = __MKSMALLINT(slp->min_width); |
1218 |
minHeight = __MKSMALLINT(slp->min_height); |
|
1219 |
maxWidth = __MKSMALLINT(slp->max_width); |
|
1220 |
maxHeight = __MKSMALLINT(slp->max_height); |
|
1221 |
widthStep = __MKSMALLINT(slp->width_inc); |
|
1222 |
heightStep = __MKSMALLINT(slp->height_inc); |
|
295 | 1223 |
%}. |
1344 | 1224 |
d := IdentityDictionary new. |
1225 |
d at:#minWidth put:minWidth. |
|
1226 |
d at:#maxWidth put:maxWidth. |
|
1227 |
d at:#widthStep put:widthStep. |
|
1228 |
d at:#minHeight put:minHeight. |
|
1229 |
d at:#maxHeight put:maxHeight. |
|
1230 |
d at:#heightStep put:heightStep. |
|
1231 |
||
1232 |
ret add:d |
|
295 | 1233 |
]. |
1234 |
||
1235 |
xIconSizes free. |
|
1236 |
^ ret |
|
1237 |
||
1238 |
" |
|
819 | 1239 |
Display iconSizes |
295 | 1240 |
" |
1241 |
! |
|
1242 |
||
341 | 1243 |
ignoreBackingStore:aBoolean |
1244 |
"if the argument is true, the views backingStore setting will be ignored, and |
|
1245 |
no backing store used - this can be used on servers where backing store is |
|
1246 |
very slow or is broken (can be put into display-rc-file)" |
|
1247 |
||
1248 |
ignoreBackingStore := aBoolean |
|
295 | 1249 |
! |
1250 |
||
823 | 1251 |
preferredIconSize |
1252 |
"return the displays preferred size for icons. |
|
1253 |
Redefined to return a special value on SGI servers." |
|
1254 |
||
1255 |
self serverVendor = 'Silicon Graphics' ifTrue:[ |
|
1344 | 1256 |
^ 86@68 |
823 | 1257 |
]. |
1258 |
^ super preferredIconSize |
|
1259 |
||
1260 |
"Created: 10.6.1996 / 21:06:48 / cg" |
|
1261 |
! |
|
1262 |
||
1025 | 1263 |
scrollsAsynchronous |
1008
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1264 |
"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
|
1265 |
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
|
1266 |
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
|
1267 |
|
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1268 |
^ true |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1269 |
! |
ca0a38a11bdc
support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents:
995
diff
changeset
|
1270 |
|
43 | 1271 |
supportedImageFormats |
4245 | 1272 |
"return an array with supported image formats; |
1273 |
each array entry is an attribute dictionary, consisting of |
|
235
579f3f804a46
padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents:
233
diff
changeset
|
1274 |
depth, bitsPerPixel and padding values." |
43 | 1275 |
|
150 | 1276 |
|nFormats "{ Class: SmallInteger }" |
1277 |
formatArray| |
|
43 | 1278 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1279 |
Display *dpy; |
150 | 1280 |
|
1281 |
if (! ISCONNECTED) { |
|
1344 | 1282 |
RETURN (nil); |
150 | 1283 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1284 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
1285 |
dpy = myDpy; |
1898 | 1286 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1287 |
nFormats = __MKSMALLINT(1); |
1288 |
#else |
|
315
2abc494f0c45
_-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents:
310
diff
changeset
|
1289 |
nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats); |
1891 | 1290 |
#endif |
43 | 1291 |
%}. |
1292 |
formatArray := Array new:nFormats. |
|
150 | 1293 |
1 to:nFormats do:[:index | |
1344 | 1294 |
|info bitsPerPixelInfo depthInfo paddingInfo i| |
1295 |
||
1296 |
i := index. |
|
43 | 1297 |
%{ |
1344 | 1298 |
ScreenFormat *format; |
1299 |
Display *dpy = myDpy; |
|
1300 |
||
1898 | 1301 |
#ifdef NO_PRIVATE_DISPLAY_ACCESS |
1891 | 1302 |
depthInfo = __MKSMALLINT(1); |
1303 |
bitsPerPixelInfo = __MKSMALLINT(1); |
|
1304 |
paddingInfo = __MKSMALLINT(8); |
|
1305 |
#else |
|
1344 | 1306 |
format = DISPLAYACCESS(dpy)->pixmap_format; |
1307 |
format += (__intVal(i)-1); |
|
1308 |
bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel); |
|
1309 |
depthInfo = __MKSMALLINT(format->depth); |
|
1310 |
paddingInfo = __MKSMALLINT(format->scanline_pad); |
|
1891 | 1311 |
#endif |
43 | 1312 |
%}. |
1344 | 1313 |
info := IdentityDictionary new. |
1314 |
info at:#depth put:depthInfo. |
|
1315 |
info at:#bitsPerPixel put:bitsPerPixelInfo. |
|
1316 |
info at:#padding put:paddingInfo. |
|
1317 |
formatArray at:index put:info. |
|
43 | 1318 |
]. |
1319 |
^ formatArray |
|
1320 |
||
1321 |
" |
|
4245 | 1322 |
Display supportedImageFormats |
43 | 1323 |
" |
1324 |
! |
|
1325 |
||
2635 | 1326 |
supportsAnyViewBackgroundPixmaps |
1327 |
"return true, if the device allows pixmaps as |
|
1328 |
viewBackground." |
|
1329 |
||
1330 |
^ true |
|
1331 |
||
1332 |
"Created: / 4.5.1999 / 18:41:07 / cg" |
|
1333 |
! |
|
1334 |
||
2745
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1335 |
supportsArbitraryShapedViews |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1336 |
"return true, if this workstation supports arbitrary shaped windows. |
4245 | 1337 |
Both the server must support it (the shape-extension), |
1338 |
and the feature must have been enabled in the smalltalk system, |
|
2745
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1339 |
for true to be returned." |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1340 |
|
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1341 |
^ hasShapeExtension |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1342 |
|
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1343 |
" |
4245 | 1344 |
Display supportsArbitraryShapedViews |
2745
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1345 |
" |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1346 |
! |
55edb7d63d29
#hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents:
2713
diff
changeset
|
1347 |
|
2385 | 1348 |
supportsIconViews |
1349 |
"return true, if this device supports views as icons. |
|
1350 |
Only Xservers (currently) support this." |
|
1351 |
||
1352 |
^ true |
|
1353 |
||
1354 |
" |
|
4245 | 1355 |
Display supportsIconViews |
2385 | 1356 |
" |
1357 |
||
1358 |
"Modified: 10.6.1996 / 20:11:48 / cg" |
|
1359 |
"Created: 10.6.1996 / 21:08:18 / cg" |
|
1360 |
! |
|
1361 |
||
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1362 |
supportsMaskedDrawingWith:aForm |
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1363 |
"return true, if the device allows the given form pixmap |
4245 | 1364 |
to be used as paint color. |
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1365 |
True returned here - X has no trouble with any mask." |
2330 | 1366 |
|
1367 |
^ true |
|
2632
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1368 |
|
e18b55db3e1e
replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents:
2594
diff
changeset
|
1369 |
"Created: / 4.5.1999 / 12:16:43 / cg" |
2330 | 1370 |
! |
1371 |
||
2635 | 1372 |
supportsViewBackgroundPixmap:aForm |
1373 |
"return true, if the device allows the given pixmap as |
|
4245 | 1374 |
viewBackground. |
2635 | 1375 |
True returned here - X support any size." |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1376 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1377 |
^ true |
2635 | 1378 |
|
1379 |
"Created: / 4.5.1999 / 18:40:42 / cg" |
|
1380 |
"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
|
1381 |
! |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1382 |
|
81 | 1383 |
supportsViewGravity |
1384 |
"return true, if this device supports gravity attributes. |
|
82 | 1385 |
We do not depend on it being implemented, but some resizing operations |
81 | 1386 |
are faster, it is is." |
1387 |
||
1388 |
^ true |
|
0 | 1389 |
! ! |
1390 |
||
1391 |
!XWorkstation methodsFor:'bitmap/window creation'! |
|
1392 |
||
295 | 1393 |
createBitmapFromArray:anArray width:w height:h |
2896 | 1394 |
"create a monochrome, depth1 bitmap from a given (byte-)array. |
1395 |
The rows are aligned to a multiple of 8" |
|
1396 |
||
295 | 1397 |
|bitmapId| |
1398 |
||
1399 |
bitmapId := self primCreateBitmapFromArray:anArray width:w height:h. |
|
1400 |
bitmapId isNil ifTrue:[ |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1401 |
self primitiveFailedOrClosedConnection |
295 | 1402 |
]. |
1403 |
^ bitmapId |
|
1404 |
! |
|
1405 |
||
1406 |
createBitmapFromFile:aString for:aForm |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1407 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1408 |
|
295 | 1409 |
|id w h| |
1410 |
||
1411 |
%{ |
|
555 | 1412 |
int screen = __intVal(__INST(screen)); |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1413 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1414 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1415 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1416 |
&& (__qIsString(aString) || __qIsSymbol(aString))) { |
1344 | 1417 |
Display *dpy = myDpy; |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1418 |
char *filename; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1419 |
int status; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1420 |
Pixmap newBitmap; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1421 |
unsigned b_width, b_height; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1422 |
int b_x_hot, b_y_hot; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1423 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1424 |
filename = (char *) __stringVal(aString); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1425 |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1426 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1427 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1428 |
status = XReadBitmapFile(dpy, RootWindow(dpy, screen), |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1429 |
filename, &b_width, &b_height, &newBitmap, |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1430 |
&b_x_hot, &b_y_hot); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1431 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1432 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1433 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1434 |
if ((status == BitmapSuccess) && newBitmap) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1435 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1436 |
__cnt_bitmap++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1437 |
#endif |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1438 |
w = __MKSMALLINT(b_width); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1439 |
h = __MKSMALLINT(b_height); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
1440 |
id = __MKEXTERNALADDRESS(newBitmap); |
1344 | 1441 |
} |
295 | 1442 |
} |
1443 |
%}. |
|
1444 |
id notNil ifTrue:[ |
|
1344 | 1445 |
aForm setWidth:w height:h |
295 | 1446 |
]. |
1447 |
^ id |
|
1448 |
! |
|
1449 |
||
1450 |
createBitmapWidth:w height:h |
|
1451 |
"allocate a bitmap on the Xserver, the contents is undefined |
|
1452 |
(i.e. random). Return a bitmap id or nil" |
|
1453 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1454 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1455 |
|
4245 | 1456 |
%{ |
555 | 1457 |
int screen = __intVal(__INST(screen)); |
295 | 1458 |
Pixmap newBitmap; |
1459 |
||
1460 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
|
1344 | 1461 |
Display *dpy = myDpy; |
1462 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1463 |
|
1974 | 1464 |
ENTER_XLIB(); |
1344 | 1465 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1466 |
__intVal(w), __intVal(h), 1); |
|
1974 | 1467 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1468 |
#ifdef COUNT_RESOURCES |
1344 | 1469 |
if (newBitmap) |
1470 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1471 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1472 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1473 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
295 | 1474 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1475 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1476 |
self primitiveFailedOrClosedConnection. |
295 | 1477 |
^ nil |
1478 |
! |
|
1479 |
||
0 | 1480 |
createPixmapWidth:w height:h depth:d |
1481 |
"allocate a pixmap on the Xserver, the contents is undefined |
|
1482 |
(i.e. random). Return a bitmap id or nil" |
|
1483 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1484 |
<context: #return> |
4245 | 1485 |
%{ |
0 | 1486 |
|
555 | 1487 |
int screen = __intVal(__INST(screen)); |
0 | 1488 |
Pixmap newBitmap; |
1489 |
||
150 | 1490 |
if (__bothSmallInteger(w, h) && ISCONNECTED) { |
1344 | 1491 |
Display *dpy = myDpy; |
1492 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1493 |
|
1974 | 1494 |
ENTER_XLIB(); |
1344 | 1495 |
newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen), |
1496 |
__intVal(w), __intVal(h), __intVal(d)); |
|
1974 | 1497 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1498 |
#ifdef COUNT_RESOURCES |
1344 | 1499 |
if (newBitmap) |
1500 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1501 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1502 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1503 |
RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 1504 |
} |
1424 | 1505 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1506 |
self primitiveFailedOrClosedConnection. |
43 | 1507 |
^ nil |
0 | 1508 |
! |
1509 |
||
1468
9832c4017a70
added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents:
1462
diff
changeset
|
1510 |
createWindowFor:aView type:typeSymbol |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1511 |
origin:origin |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1512 |
extent:extent |
4245 | 1513 |
minExtent:minExt |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1514 |
maxExtent:maxExt |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1515 |
borderWidth:bWidth |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1516 |
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
|
1517 |
style:wStyle |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1518 |
inputOnly:winputOnly |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1519 |
label:wlabel |
1960 | 1520 |
owner:wowner |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1521 |
icon:wicon iconMask:wiconMask |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1522 |
iconView:wiconView |
46 | 1523 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1524 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1525 |
|
4245 | 1526 |
|xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight |
1960 | 1527 |
bColorId wsuperViewId wiconId wiconMaskId windowId |
46 | 1528 |
weventMask wiconViewId bitGravity viewGravity vBgColor |
150 | 1529 |
vBgForm deepForm preferredVisual preferredDepth| |
1530 |
||
1531 |
displayId isNil ifTrue:[ |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1532 |
self primitiveFailedOrClosedConnection. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1533 |
^ nil |
150 | 1534 |
]. |
0 | 1535 |
|
46 | 1536 |
origin notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1537 |
xpos := origin x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1538 |
ypos := origin y. |
46 | 1539 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1540 |
xpos := ypos := 0. |
0 | 1541 |
]. |
46 | 1542 |
extent notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1543 |
wwidth := extent x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1544 |
wheight := extent y. |
46 | 1545 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1546 |
wwidth := wheight := 100. |
46 | 1547 |
]. |
1548 |
minExt notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1549 |
minWidth := minExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1550 |
minHeight := minExt y |
0 | 1551 |
]. |
46 | 1552 |
maxExt notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1553 |
maxWidth := maxExt x. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1554 |
maxHeight := maxExt y |
46 | 1555 |
]. |
1556 |
||
0 | 1557 |
wsuperView notNil ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1558 |
wsuperViewId := wsuperView id |
0 | 1559 |
]. |
1560 |
||
1561 |
wicon notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1562 |
wiconId := wicon id. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1563 |
wiconMask notNil ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1564 |
wiconMaskId := wiconMask id |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1565 |
] |
0 | 1566 |
]. |
1567 |
wiconView notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1568 |
wiconViewId := wiconView id |
0 | 1569 |
]. |
1570 |
weventMask := aView eventMask. |
|
1571 |
||
150 | 1572 |
preferredVisual := aView preferredVisual. |
1573 |
preferredDepth := aView preferredDepth. |
|
23 | 1574 |
|
1898 | 1575 |
%{ /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */ |
0 | 1576 |
Display *dpy = myDpy; |
555 | 1577 |
int screen = __intVal(__INST(screen)); |
0 | 1578 |
Visual visual; |
1579 |
XGCValues xgcv; |
|
1580 |
XSetWindowAttributes xswa; |
|
1581 |
XSizeHints sizehints; |
|
1582 |
XWMHints wmhints; |
|
46 | 1583 |
int bw, bd, bg; |
0 | 1584 |
Window newWindow, parentWindow; |
1585 |
char *windowName; |
|
1586 |
XFontStruct *f; |
|
4245 | 1587 |
Pixmap backPixmap = (Pixmap)0, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1588 |
iconBitmap = (Pixmap)0, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1589 |
iconMask = (Pixmap)0; |
0 | 1590 |
int flags = 0, depth, ioClass; |
1591 |
Window iconWindow; |
|
1592 |
Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom; |
|
4082 | 1593 |
Atom WmQuitAppAtom, MotifWMHintsAtom; |
0 | 1594 |
Atom atoms[3]; |
1595 |
int atomCount = 0, isTopWindow = 0; |
|
1596 |
||
1597 |
sizehints.flags = 0; |
|
1598 |
sizehints.width = 100; |
|
1599 |
sizehints.height = 100; |
|
1600 |
sizehints.x = 0; |
|
1601 |
sizehints.y = 0; |
|
1602 |
||
97 | 1603 |
if (__bothSmallInteger(wwidth, wheight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1604 |
sizehints.flags |= PSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1605 |
sizehints.width = __intVal(wwidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1606 |
sizehints.height = __intVal(wheight); |
0 | 1607 |
} |
97 | 1608 |
if (__bothSmallInteger(xpos, ypos)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1609 |
sizehints.flags |= PPosition; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1610 |
sizehints.x = __intVal(xpos); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1611 |
sizehints.y = __intVal(ypos); |
0 | 1612 |
} |
97 | 1613 |
if (__bothSmallInteger(minWidth, minHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1614 |
sizehints.flags |= PMinSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1615 |
sizehints.min_width = __intVal(minWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1616 |
sizehints.min_height = __intVal(minHeight); |
0 | 1617 |
} |
97 | 1618 |
if (__bothSmallInteger(maxWidth, maxHeight)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1619 |
sizehints.flags |= PMaxSize; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1620 |
sizehints.max_width = __intVal(maxWidth); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1621 |
sizehints.max_height = __intVal(maxHeight); |
0 | 1622 |
} |
1623 |
||
37 | 1624 |
bg = WhitePixel(dpy, screen); |
0 | 1625 |
|
97 | 1626 |
if (__isSmallInteger(bWidth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1627 |
bw = __intVal(bWidth); |
46 | 1628 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1629 |
bw = 0; |
0 | 1630 |
} |
1631 |
||
72 | 1632 |
bd = BlackPixel(dpy, screen); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1633 |
|
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1634 |
if (__isExternalAddress(wsuperViewId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1635 |
parentWindow = __WindowVal(wsuperViewId); |
0 | 1636 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1637 |
parentWindow = RootWindow(dpy, screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1638 |
isTopWindow = 1; |
0 | 1639 |
} |
1640 |
||
1695
46d9101e4bee
replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
1641 |
if (wStyle == @symbol(popUp)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1642 |
xswa.override_redirect = 1; |
4245 | 1643 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1644 |
xswa.override_redirect = 0; |
0 | 1645 |
|
4245 | 1646 |
if (winputOnly == true) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1647 |
ioClass = InputOnly; |
4245 | 1648 |
else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1649 |
ioClass = InputOutput; |
0 | 1650 |
|
97 | 1651 |
if (__isSmallInteger(weventMask)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1652 |
xswa.event_mask = __intVal(weventMask); |
0 | 1653 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1654 |
xswa.event_mask = 0; |
0 | 1655 |
} |
1656 |
||
1657 |
if (ioClass == InputOnly) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1658 |
bw = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1659 |
depth = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1660 |
flags |= CWEventMask; |
0 | 1661 |
} else { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1662 |
depth = DefaultDepth(dpy,screen); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1663 |
flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1664 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1665 |
if (backPixmap != (Pixmap)0) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1666 |
xswa.background_pixmap = backPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1667 |
flags |= CWBackPixmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1668 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1669 |
xswa.background_pixel = bg; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1670 |
flags |= CWBackPixel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1671 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1672 |
xswa.border_pixel = bd; |
0 | 1673 |
} |
23 | 1674 |
|
0 | 1675 |
visual.visualid = CopyFromParent; |
150 | 1676 |
if (__isSmallInteger(preferredDepth)) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1677 |
depth = __intVal(preferredDepth); |
23 | 1678 |
} |
54 | 1679 |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1680 |
|
150 | 1681 |
if (preferredVisual != nil) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1682 |
XVisualInfo vi; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1683 |
int cls; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1684 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1685 |
if (preferredVisual == @symbol(StaticGray)) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1686 |
cls = StaticGray; |
4245 | 1687 |
else if (preferredVisual == @symbol(GrayScale)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1688 |
cls = GrayScale; |
4245 | 1689 |
else if (preferredVisual == @symbol(StaticColor)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1690 |
cls = StaticColor; |
4245 | 1691 |
else if (preferredVisual == @symbol(PseudoColor)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1692 |
cls = PseudoColor; |
4245 | 1693 |
else if (preferredVisual == @symbol(TrueColor)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1694 |
cls = TrueColor; |
4245 | 1695 |
else if (preferredVisual == @symbol(DirectColor)) |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1696 |
cls = DirectColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1697 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1698 |
cls = PseudoColor; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1699 |
|
1974 | 1700 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1701 |
if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1702 |
visual.visualid = vi.visualid; |
163 | 1703 |
/* |
3468 | 1704 |
fprintf(stderr, "visualId=%x\n", vi.visualid); |
163 | 1705 |
*/ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1706 |
} |
1974 | 1707 |
LEAVE_XLIB(); |
1708 |
} |
|
1709 |
||
4245 | 1710 |
ENTER_XLIB2(); |
0 | 1711 |
newWindow = XCreateWindow(dpy, parentWindow, |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1712 |
sizehints.x, sizehints.y, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1713 |
sizehints.width, sizehints.height, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1714 |
bw, depth, ioClass, &visual, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1715 |
flags, &xswa); |
1974 | 1716 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1717 |
|
0 | 1718 |
|
1719 |
if (! newWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1720 |
RETURN ( nil ); |
0 | 1721 |
} |
1722 |
||
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1723 |
#ifdef COUNT_RESOURCES |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1724 |
__cnt_view++; |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1725 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1726 |
|
0 | 1727 |
/* |
1728 |
* define its icon and name |
|
1729 |
* (only makes sense for topWindows) |
|
1730 |
*/ |
|
1731 |
if (isTopWindow) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1732 |
if (__isExternalAddress(wiconId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1733 |
iconBitmap = __PixmapVal(wiconId); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1734 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1735 |
iconBitmap = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1736 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1737 |
if (__isExternalAddress(wiconMaskId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1738 |
iconMask = __PixmapVal(wiconMaskId); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1739 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1740 |
iconMask = (Pixmap)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1741 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1742 |
if (__isExternalAddress(wiconViewId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1743 |
iconWindow = __WindowVal(wiconViewId); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1744 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1745 |
iconWindow = (Window)0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1746 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1747 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
1831 | 1748 |
windowName = (char *) __stringVal(wlabel); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1749 |
else |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1750 |
windowName = ""; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1751 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1752 |
if (iconBitmap || windowName) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1753 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1754 |
XSetStandardProperties(dpy, newWindow, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1755 |
windowName, windowName, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1756 |
iconBitmap, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1757 |
0, 0, &sizehints); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1758 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1759 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1760 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1761 |
wmhints.flags = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1762 |
if (iconBitmap) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1763 |
wmhints.flags |= IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1764 |
wmhints.icon_pixmap = iconBitmap; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1765 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1766 |
if (iconMask) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1767 |
wmhints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1768 |
wmhints.icon_mask = iconMask; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1769 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1770 |
if (iconWindow) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1771 |
wmhints.flags |= IconWindowHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1772 |
wmhints.icon_window = iconWindow; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1773 |
} |
0 | 1774 |
/* |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1775 |
wmhints.flags |= InputHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1776 |
wmhints.input = True; |
0 | 1777 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1778 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1779 |
XSetWMHints(dpy, newWindow, &wmhints); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1780 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1781 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1782 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1783 |
* 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
|
1784 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1785 |
/* |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1786 |
* get atoms first (if not already known) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1787 |
*/ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1788 |
if (__INST(protocolsAtom) == nil) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1789 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1790 |
WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1791 |
__INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom); |
0 | 1792 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1793 |
WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1794 |
__INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom); |
0 | 1795 |
#endif |
1796 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1797 |
WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1798 |
__INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom); |
0 | 1799 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1800 |
WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1801 |
__INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1802 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1803 |
} else { |
0 | 1804 |
#ifdef USE_QUIT_APP_ATOM |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1805 |
WmQuitAppAtom = __AtomVal(__INST(quitAppAtom)); |
0 | 1806 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1807 |
WmQuitAppAtom = 0; |
0 | 1808 |
#endif |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1809 |
WmProtocolsAtom = __AtomVal(__INST(protocolsAtom)); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1810 |
WmDeleteWindowAtom = __AtomVal(__INST(deleteWindowAtom)); |
0 | 1811 |
#ifdef USE_SAVEYOURSELF_ATOM |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1812 |
WmSaveYourselfAtom = __AtomVal(__INST(saveYourselfAtom)); |
0 | 1813 |
#else |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1814 |
WmSaveYourselfAtom = 0; |
0 | 1815 |
#endif |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1816 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1817 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1818 |
atoms[0] = WmDeleteWindowAtom; atomCount++; |
0 | 1819 |
#ifdef USE_SAVEYOURSELF_ATOM |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1820 |
atoms[atomCount] = WmSaveYourselfAtom; atomCount++; |
0 | 1821 |
#endif |
1822 |
#ifdef USE_QUIT_APP_ATOM |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1823 |
atoms[atomCount] = WmQuitAppAtom; atomCount++; |
0 | 1824 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1825 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1826 |
XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
1827 |
32, PropModeReplace, (unsigned char *)atoms, atomCount); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1828 |
LEAVE_XLIB(); |
4082 | 1829 |
|
4090 | 1830 |
if ((wStyle == @symbol(undecorated)) |
1831 |
|| (wStyle == @symbol(dialog2)) |
|
1832 |
|| (wStyle == @symbol(notitle)) |
|
1833 |
) { |
|
1834 |
#ifdef SUPPORT_MOTIF_WM_HINTS |
|
4082 | 1835 |
if (__INST(motifWMHintsAtom) == nil) { |
1836 |
ENTER_XLIB(); |
|
1837 |
MotifWMHintsAtom = XInternAtom(dpy, "_MOTIF_WM_HINTS", False); |
|
1838 |
__INST(motifWMHintsAtom) = __MKATOMOBJ(MotifWMHintsAtom); |
|
1839 |
LEAVE_XLIB(); |
|
1840 |
} else { |
|
1841 |
MotifWMHintsAtom = __AtomVal(__INST(motifWMHintsAtom)); |
|
1842 |
} |
|
1843 |
||
1844 |
{ |
|
4086 | 1845 |
struct hints { |
1846 |
unsigned long flags; |
|
1847 |
unsigned long functions; |
|
1848 |
unsigned long decorations; |
|
4082 | 1849 |
long input_mode; |
4086 | 1850 |
unsigned long status; |
4090 | 1851 |
} mvm_hints; |
1852 |
||
1853 |
if (wStyle == @symbol(undecorated)) { |
|
1854 |
mvm_hints.decorations = MWM_DECOR_NONE; |
|
1855 |
} |
|
1856 |
if (wStyle == @symbol(dialog2)) { |
|
1857 |
mvm_hints.decorations = MWM_DECOR_BORDER |
|
1858 |
| MWM_DECOR_RESIZEH |
|
1859 |
| MWM_DECOR_TITLE |
|
1860 |
/* | MWM_DECOR_MENU */ |
|
1861 |
/* | MWM_DECOR_MINIMIZE */ |
|
1862 |
/* | MWM_DECOR_MAXIMIZE */ |
|
1863 |
; |
|
1864 |
} |
|
1865 |
if (wStyle == @symbol(notitle)) { |
|
1866 |
mvm_hints.decorations = MWM_DECOR_BORDER |
|
1867 |
/* | MWM_DECOR_RESIZEH */ |
|
1868 |
/* | MWM_DECOR_TITLE */ |
|
1869 |
/* | MWM_DECOR_MENU */ |
|
1870 |
/* | MWM_DECOR_MINIMIZE */ |
|
1871 |
/* | MWM_DECOR_MAXIMIZE */ |
|
1872 |
; |
|
1873 |
} |
|
1874 |
mvm_hints.flags = MWM_HINTS_DECORATIONS; |
|
4082 | 1875 |
ENTER_XLIB(); |
1876 |
XChangeProperty (dpy, newWindow, MotifWMHintsAtom, |
|
1877 |
MotifWMHintsAtom, 32, PropModeReplace, |
|
4090 | 1878 |
(unsigned char*)&mvm_hints, 5 ); |
4082 | 1879 |
LEAVE_XLIB(); |
1880 |
} |
|
4090 | 1881 |
#endif /* SUPPORT_MOTIF_WM_HINTS */ |
4082 | 1882 |
} |
1883 |
} |
|
54 | 1884 |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1885 |
windowId = __MKEXTERNALADDRESS(newWindow); |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1886 |
%}. |
0 | 1887 |
self addKnownView:aView withId:windowId. |
1888 |
^ windowId |
|
1889 |
! |
|
1890 |
||
1891 |
destroyGC:aGCId |
|
1892 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1893 |
<context: #return> |
4245 | 1894 |
%{ |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1895 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1896 |
if (! ISCONNECTED) { |
1344 | 1897 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1898 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1899 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1900 |
if (__isExternalAddress(aGCId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1901 |
GC gc = __GCVal(aGCId); |
1344 | 1902 |
|
1903 |
if (gc) { |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1904 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1905 |
ENTER_XLIB(); |
1344 | 1906 |
XFreeGC(myDpy, gc); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1907 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1908 |
#ifdef COUNT_RESOURCES |
1344 | 1909 |
__cnt_gc--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1910 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1911 |
|
1344 | 1912 |
} |
1913 |
RETURN ( self ); |
|
0 | 1914 |
} |
118 | 1915 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1916 |
self primitiveFailedOrClosedConnection |
0 | 1917 |
! |
1918 |
||
295 | 1919 |
destroyPixmap:aDrawableId |
0 | 1920 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1921 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1922 |
%{ |
0 | 1923 |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1924 |
if (! ISCONNECTED) { |
1344 | 1925 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1926 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1927 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
1928 |
if (__isExternalAddress(aDrawableId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1929 |
Pixmap pix = __PixmapVal(aDrawableId); |
1344 | 1930 |
|
1931 |
if (pix) { |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1932 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1933 |
ENTER_XLIB(); |
1344 | 1934 |
XFreePixmap(myDpy, pix); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1935 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1936 |
#ifdef COUNT_RESOURCES |
1344 | 1937 |
__cnt_bitmap--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
1938 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1939 |
|
1344 | 1940 |
} |
1941 |
RETURN ( self ); |
|
0 | 1942 |
} |
118 | 1943 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1944 |
self primitiveFailedOrClosedConnection |
295 | 1945 |
! |
1946 |
||
1947 |
destroyView:aView withId:aWindowId |
|
3250 | 1948 |
self primDestroyView:aView withId:aWindowId. |
1949 |
self removeKnownView:aView withId:aWindowId. |
|
0 | 1950 |
! |
1951 |
||
1952 |
dpsContextFor:aDrawableId and:aGCId |
|
1953 |
||
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
1954 |
<context: #return> |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
1955 |
|
4245 | 1956 |
%{ |
0 | 1957 |
#ifdef XXDPS |
555 | 1958 |
int screen = __intVal(__INST(screen)); |
0 | 1959 |
DPSContext dps; |
1960 |
int height; |
|
1961 |
||
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1962 |
if (__isExternalAddress(aDrawableId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1963 |
&& __isExternalAddress(aGCId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
1964 |
&& ISCONNECTED) { |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1965 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1966 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1967 |
dps = XDPSCreateContext(myDpy, __DrawableVal(aDrawableId), |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1968 |
__GCVal(aGCId), |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1969 |
0, height, 0, colormap, NULL, 0, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1970 |
XDPSDefaultTextBackstop, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1971 |
XDPSDefaultErrorProc, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1972 |
NULL); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1973 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1974 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
1975 |
RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil ); |
0 | 1976 |
} |
1977 |
#endif |
|
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
1978 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1979 |
self primitiveFailedOrClosedConnection. |
43 | 1980 |
^ nil |
295 | 1981 |
! |
1982 |
||
1983 |
gcFor:aDrawableId |
|
132 | 1984 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
1985 |
<context: #return> |
4245 | 1986 |
%{ |
555 | 1987 |
int screen = __intVal(__INST(screen)); |
295 | 1988 |
GC gc; |
1989 |
||
1990 |
if (__isExternalAddress(aDrawableId) && ISCONNECTED) { |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
1991 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1992 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
1993 |
gc = XCreateGC(myDpy, __DrawableVal(aDrawableId), 0L, (XGCValues *)0); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
1994 |
LEAVE_XLIB(); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1995 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
1996 |
#ifdef COUNT_RESOURCES |
1344 | 1997 |
if (gc) |
1998 |
__cnt_gc++; |
|
1089 | 1999 |
#endif |
2000 |
||
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2001 |
RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil ); |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2002 |
} |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2003 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2004 |
self primitiveFailedOrClosedConnection. |
1138
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2005 |
^ nil |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2006 |
! |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2007 |
|
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2008 |
gcForBitmap:aDrawableId |
4a2b3b407cae
need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents:
1103
diff
changeset
|
2009 |
"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
|
2010 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2011 |
^ self gcFor:aDrawableId |
295 | 2012 |
! |
2013 |
||
2014 |
primCreateBitmapFromArray:anArray width:w height:h |
|
154 | 2015 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2016 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2017 |
|
154 | 2018 |
%{ /* UNLIMITEDSTACK */ |
2019 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2020 |
Display *dpy; |
555 | 2021 |
int screen = __intVal(__INST(screen)); |
295 | 2022 |
Pixmap newBitmap; |
2023 |
unsigned int b_width, b_height; |
|
2024 |
REGISTER unsigned char *cp; |
|
2025 |
REGISTER unsigned char *pBits; |
|
2026 |
unsigned char *b_bits, *allocatedBits; |
|
2027 |
int index, row; |
|
2028 |
REGISTER int col; |
|
2029 |
unsigned bits; |
|
2030 |
static char reverseBitTable[256]; |
|
2031 |
static firstCall = 1; |
|
2032 |
int nBytes; |
|
2033 |
unsigned char fastBits[10000]; |
|
2034 |
OBJ num, *op; |
|
2035 |
int bytesPerRow; |
|
2036 |
||
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2037 |
if (! ISCONNECTED) { |
1344 | 2038 |
RETURN (nil); |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2039 |
} |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2040 |
|
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2041 |
dpy = myDpy; |
295 | 2042 |
if (firstCall) { |
1344 | 2043 |
for (index=0; index < 256; index++) { |
2044 |
reverseBitTable[index] = 0; |
|
2045 |
if (index & 128) reverseBitTable[index] |= 1; |
|
2046 |
if (index & 64) reverseBitTable[index] |= 2; |
|
2047 |
if (index & 32) reverseBitTable[index] |= 4; |
|
2048 |
if (index & 16) reverseBitTable[index] |= 8; |
|
2049 |
if (index & 8) reverseBitTable[index] |= 16; |
|
2050 |
if (index & 4) reverseBitTable[index] |= 32; |
|
2051 |
if (index & 2) reverseBitTable[index] |= 64; |
|
2052 |
if (index & 1) reverseBitTable[index] |= 128; |
|
2053 |
} |
|
2054 |
firstCall = 0; |
|
295 | 2055 |
} |
2056 |
||
2057 |
if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) { |
|
1344 | 2058 |
newBitmap = (Pixmap)0; |
2059 |
b_width = __intVal(w); |
|
2060 |
b_height = __intVal(h); |
|
2061 |
bytesPerRow = (b_width + 7) / 8; |
|
2062 |
nBytes = b_height * bytesPerRow; |
|
2063 |
if (nBytes < sizeof(fastBits)) { |
|
2064 |
cp = b_bits = fastBits; |
|
2065 |
allocatedBits = 0; |
|
2066 |
} else { |
|
2067 |
cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes); |
|
2068 |
if (! cp) goto fail; |
|
2069 |
} |
|
2070 |
||
2071 |
if (__qClass(anArray) == @global(Array)) { |
|
2072 |
index = 1; |
|
2073 |
op = &(__ArrayInstPtr(anArray)->a_element[index - 1]); |
|
2074 |
for (row = b_height; row; row--) { |
|
2075 |
for (col = bytesPerRow; col; col--) { |
|
2076 |
num = *op++; |
|
2791 | 2077 |
if (__isSmallInteger(num)) { |
2078 |
bits = __intVal(num); |
|
2079 |
} else { |
|
2080 |
bits = __longIntVal(num); |
|
2081 |
if (bits == 0) { |
|
2082 |
goto fail; |
|
2083 |
} |
|
2084 |
} |
|
2085 |
*cp++ = reverseBitTable[bits & 0xFF]; |
|
1344 | 2086 |
} |
2087 |
} |
|
2088 |
} else { |
|
2089 |
if (__qClass(anArray) == @global(ByteArray)) { |
|
2090 |
pBits = __ByteArrayInstPtr(anArray)->ba_element; |
|
2091 |
for (col = b_height*bytesPerRow; col; col--) { |
|
2092 |
*cp++ = reverseBitTable[*pBits++]; |
|
2093 |
} |
|
2094 |
} else { |
|
2095 |
goto fail; |
|
2096 |
} |
|
2097 |
} |
|
2098 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2099 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2100 |
ENTER_XLIB(); |
1344 | 2101 |
newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen), |
4245 | 2102 |
(char *)b_bits, |
1344 | 2103 |
b_width, b_height); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2104 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2105 |
#ifdef COUNT_RESOURCES |
1344 | 2106 |
if (newBitmap) |
2107 |
__cnt_bitmap++; |
|
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2108 |
#endif |
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2109 |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2110 |
|
295 | 2111 |
fail: ; |
1344 | 2112 |
if (allocatedBits) |
2113 |
free(allocatedBits); |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2114 |
RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil ); |
0 | 2115 |
} |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2116 |
%}. |
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2117 |
^ nil |
295 | 2118 |
! |
2119 |
||
3228 | 2120 |
primCreateWindowType:t origin:o extent:e minExtent:minE maxExtent:maxE borderWidth:bw superViewId:sv style:st inputOnly:i label:l ownerId:oId iconId:ic iconMaskId:im iconViewId:iv |
2121 |
"for rel5 only" |
|
2122 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2123 |
^ self primitiveFailedOrClosedConnection |
3228 | 2124 |
|
2125 |
! |
|
2126 |
||
3250 | 2127 |
primDestroyView:aView withId:aWindowId |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2128 |
<context: #return> |
3250 | 2129 |
%{ |
2130 |
if (! ISCONNECTED) { |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2131 |
RETURN ( self ); |
3250 | 2132 |
} |
2133 |
||
2134 |
if (__isExternalAddress(aWindowId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
2135 |
Window win = __WindowVal(aWindowId); |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2136 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2137 |
if (win) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2138 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2139 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2140 |
XDestroyWindow(myDpy, win); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2141 |
LEAVE_XLIB(); |
3250 | 2142 |
#ifdef COUNT_RESOURCES |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2143 |
__cnt_view--; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2144 |
#endif |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2145 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2146 |
} |
3250 | 2147 |
} |
2148 |
%} |
|
2149 |
! |
|
2150 |
||
295 | 2151 |
realRootWindowId |
2152 |
"return the id of the real root window. |
|
2153 |
This may not be the window you see as background, |
|
2154 |
since some window managers install a virtual root window on top |
|
2155 |
of it. Except for very special cases, use #rootWindowId, which takes |
|
2156 |
care of any virtual root." |
|
0 | 2157 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
2158 |
%{ |
555 | 2159 |
int screen = __intVal(__INST(screen)); |
295 | 2160 |
Window root; |
2161 |
OBJ id; |
|
2162 |
||
555 | 2163 |
if (__INST(rootId) != nil) { |
1344 | 2164 |
RETURN (__INST(rootId)); |
295 | 2165 |
} |
0 | 2166 |
|
150 | 2167 |
if (ISCONNECTED) { |
1344 | 2168 |
root = RootWindow(myDpy, screen); |
2169 |
if (! root) { |
|
2170 |
id = nil; |
|
2171 |
} else { |
|
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2172 |
__INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id); |
1344 | 2173 |
} |
2174 |
RETURN (id); |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2175 |
} |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
2176 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2177 |
self primitiveFailedOrClosedConnection. |
1838
040e4689dfcd
oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents:
1835
diff
changeset
|
2178 |
^ nil |
295 | 2179 |
! |
2180 |
||
2181 |
rootWindowId |
|
2182 |
"return the id of the root window. |
|
4245 | 2183 |
This is the window you see as background, |
295 | 2184 |
however, it may or may not be the real physical root window, |
2185 |
since some window managers install a virtual root window on top |
|
2186 |
of the real one. If this is the case, that views id is returned here." |
|
23 | 2187 |
|
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
2188 |
%{ |
555 | 2189 |
int screen = __intVal(__INST(screen)); |
3412
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2190 |
Window rootWin, vRootWin = 0; |
295 | 2191 |
OBJ id; |
2192 |
||
555 | 2193 |
if (__INST(virtualRootId) != nil) { |
3424 | 2194 |
RETURN (__INST(virtualRootId)); |
295 | 2195 |
} |
0 | 2196 |
|
169 | 2197 |
if (ISCONNECTED) { |
3424 | 2198 |
Display *dpy = myDpy; |
2199 |
||
2200 |
rootWin = RootWindow(dpy, screen); |
|
295 | 2201 |
#ifndef IRIS |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2202 |
|
3424 | 2203 |
/* |
2204 |
* on IRIS, this creates a badwindow error - why ? |
|
2205 |
* children contains a funny window (000034) |
|
2206 |
*/ |
|
2207 |
||
2208 |
/* |
|
2209 |
* care for virtual root windows (tvtwm & friends) |
|
2210 |
*/ |
|
2211 |
{ |
|
2212 |
Atom vRootAtom, kwinAtom; |
|
2213 |
int i; |
|
2214 |
Window rootReturn, parentReturn; |
|
2215 |
Window* children = (Window *)0; |
|
2216 |
unsigned int numChildren; |
|
2217 |
int ignoreVRoot = 0; |
|
2218 |
||
2219 |
/* |
|
2220 |
* Take care of KDE 2.1. |
|
2221 |
* they define _SWM_ROOT but this is not the parent of |
|
2222 |
* the application windows. |
|
2223 |
* Instead it is used for background painting |
|
2224 |
*/ |
|
2225 |
||
2226 |
kwinAtom = XInternAtom(dpy, "KWIN_RUNNING", True); |
|
2227 |
if (kwinAtom != None) { |
|
2228 |
Atom actual_type; |
|
2229 |
int actual_format; |
|
2230 |
unsigned long nitems, bytesafter; |
|
2231 |
unsigned char *retVal = 0; |
|
2232 |
||
4245 | 2233 |
ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom, |
3424 | 2234 |
0L, 1L, False, kwinAtom, |
4245 | 2235 |
&actual_type, &actual_format, |
2236 |
&nitems, &bytesafter, &retVal) == Success |
|
3424 | 2237 |
&& actual_type != 0; |
2238 |
if (retVal) |
|
2239 |
XFree(retVal); |
|
2240 |
} |
|
2241 |
||
2242 |
if (!ignoreVRoot) { |
|
2243 |
vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True); |
|
2244 |
if (vRootAtom != None) { |
|
4245 | 2245 |
if (XQueryTree(dpy, rootWin, |
2246 |
&rootReturn, &parentReturn, |
|
3424 | 2247 |
&children, &numChildren)) { |
2248 |
for (i=0; i < numChildren; i++) { |
|
2249 |
Atom actual_type; |
|
2250 |
int actual_format; |
|
2251 |
unsigned long nitems, bytesafter; |
|
2252 |
Window* newRoot = (Window*) 0; |
|
2253 |
||
2254 |
if (children[i]) { |
|
4245 | 2255 |
if (XGetWindowProperty(dpy, children[i], vRootAtom, |
3424 | 2256 |
0L, 1L, False, XA_WINDOW, |
4245 | 2257 |
&actual_type, &actual_format, |
3424 | 2258 |
&nitems, &bytesafter, |
2259 |
(unsigned char**) &newRoot |
|
2260 |
) == Success && newRoot) { |
|
2261 |
vRootWin = *newRoot; |
|
2262 |
XFree(newRoot); /* XXX */ |
|
4245 | 2263 |
break; |
3424 | 2264 |
} |
2265 |
} |
|
2266 |
} |
|
2267 |
if (children) XFree(children); |
|
2268 |
} |
|
2269 |
} |
|
2270 |
} |
|
2271 |
} |
|
3412
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2272 |
#endif |
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2273 |
} |
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2274 |
|
295 | 2275 |
if (! vRootWin) { |
3424 | 2276 |
vRootWin = rootWin; |
2277 |
if (! vRootWin) { |
|
2278 |
RETURN ( nil ); |
|
2279 |
} |
|
295 | 2280 |
} |
1913
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2281 |
__INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id); |
cd9259612040
eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
2282 |
__INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id); |
295 | 2283 |
RETURN ( id ); |
63 | 2284 |
%} |
3412
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2285 |
|
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2286 |
" |
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2287 |
Display rootWindowId |
91fe6c42822d
Fix for KDE 2.1 windowmanager (virtual root view)
Stefan Vogel <sv@exept.de>
parents:
3333
diff
changeset
|
2288 |
" |
0 | 2289 |
! ! |
2290 |
||
2291 |
!XWorkstation methodsFor:'color stuff'! |
|
2292 |
||
295 | 2293 |
colorCell |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2294 |
"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
|
2295 |
This method will return nil for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2296 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2297 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2298 |
%{ |
0 | 2299 |
|
555 | 2300 |
int screen = __intVal(__INST(screen)); |
295 | 2301 |
XColor color; |
2302 |
unsigned long dummy; |
|
2303 |
Status ok; |
|
2304 |
||
1209 | 2305 |
if (ISCONNECTED) { |
1344 | 2306 |
Display *dpy = myDpy; |
2307 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2308 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2309 |
ENTER_XLIB(); |
1344 | 2310 |
ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0, |
2311 |
&dummy, 0, &color.pixel, 1); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2312 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2313 |
|
1344 | 2314 |
if (ok) { |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2315 |
#ifdef COUNT_RESOURCES |
1344 | 2316 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2317 |
#endif |
1344 | 2318 |
RETURN ( __MKSMALLINT(color.pixel) ); |
2319 |
} |
|
0 | 2320 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2321 |
%}. |
43 | 2322 |
^ nil |
0 | 2323 |
! |
2324 |
||
2325 |
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
|
2326 |
"allocate a color with color name - return the color index (i.e. colorID). |
0 | 2327 |
Dont use this method, colornames are mostly X specific" |
2328 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2329 |
<context: #return> |
4245 | 2330 |
%{ |
0 | 2331 |
|
2332 |
char *colorname; |
|
2333 |
XColor scolor, ecolor; |
|
555 | 2334 |
int screen = __intVal(__INST(screen)); |
850 | 2335 |
int id; |
54 | 2336 |
Status ok; |
0 | 2337 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2338 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2339 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2340 |
&& (__qIsString(aString) || __qIsSymbol(aString))) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2341 |
Display *dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2342 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2343 |
colorname = (char *) __stringVal(aString); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2344 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2345 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2346 |
ENTER_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2347 |
ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2348 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2349 |
if (ok) { |
847
f7c402bc5983
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
846
diff
changeset
|
2350 |
#ifdef QUICK_TRUE_COLORS |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2351 |
if (__INST(visualType) == @symbol(TrueColor)) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2352 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2353 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2354 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2355 |
RETURN ( __MKSMALLINT(id) ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2356 |
} |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2357 |
#endif |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2358 |
ENTER_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2359 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2360 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2361 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2362 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2363 |
if (! ok) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2364 |
RETURN ( nil ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2365 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2366 |
#ifdef COUNT_RESOURCES |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2367 |
__cnt_color++; |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2368 |
#endif |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2369 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
3220 | 2370 |
} |
2371 |
%}. |
|
2372 |
^ super 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
|
2373 |
! |
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2374 |
|
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2375 |
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
|
2376 |
"allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)" |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2377 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2378 |
<context: #return> |
295 | 2379 |
%{ |
898
677e010d0cf8
exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2380 |
Display *dpy; |
295 | 2381 |
XColor ecolor; |
555 | 2382 |
int screen = __intVal(__INST(screen)); |
295 | 2383 |
Status ok; |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2384 |
int id; |
295 | 2385 |
|
4245 | 2386 |
if (__bothSmallInteger(r, g) |
295 | 2387 |
&& __isSmallInteger(b) |
2388 |
&& ISCONNECTED) { |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2389 |
ecolor.red = __intVal(r); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2390 |
ecolor.green= __intVal(g); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2391 |
ecolor.blue = __intVal(b); |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2392 |
#ifdef QUICK_TRUE_COLORS |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2393 |
if (__INST(visualType) == @symbol(TrueColor)) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2394 |
id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2395 |
id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2396 |
id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2397 |
RETURN ( __MKSMALLINT(id) ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2398 |
} |
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2399 |
#endif |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2400 |
dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2401 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2402 |
ENTER_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2403 |
ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2404 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2405 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2406 |
if (! ok) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2407 |
RETURN ( nil ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2408 |
} |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2409 |
#ifdef COUNT_RESOURCES |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2410 |
__cnt_color++; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2411 |
#endif |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2412 |
RETURN ( __MKSMALLINT(ecolor.pixel) ); |
3220 | 2413 |
} |
2414 |
%}. |
|
2415 |
^ super colorScaledRed:r scaledGreen:g scaledBlue:b |
|
2416 |
! |
|
2417 |
||
2418 |
deviceColorValueToPercent:aDeviceValue |
|
2419 |
"given a color-component value in percent (0..65k), return the corresponding |
|
2420 |
x-component value (0..100)" |
|
2421 |
||
2422 |
^ (100.0 * aDeviceValue / 16rFFFF) |
|
2423 |
||
2424 |
" |
|
4245 | 2425 |
Display deviceColorValueToPercent:0 |
2426 |
Display deviceColorValueToPercent:16r8000 |
|
3220 | 2427 |
Display deviceColorValueToPercent:16rFFFF |
2428 |
" |
|
295 | 2429 |
! |
2430 |
||
2431 |
freeColor:colorIndex |
|
2432 |
"free a display color when its no longer needed" |
|
0 | 2433 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2434 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2435 |
%{ |
0 | 2436 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
2437 |
Display *dpy; |
295 | 2438 |
unsigned long color; |
555 | 2439 |
int screen = __intVal(__INST(screen)); |
295 | 2440 |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2441 |
#ifdef QUICK_TRUE_COLORS |
555 | 2442 |
if (__INST(visualType) == @symbol(TrueColor)) { |
1344 | 2443 |
/* no need to do anything on TrueColor displays ... */ |
2444 |
RETURN (self); |
|
295 | 2445 |
} |
2446 |
#endif |
|
846
49a4732dec95
dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents:
834
diff
changeset
|
2447 |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2448 |
if (! ISCONNECTED) { |
1344 | 2449 |
RETURN (self); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2450 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2451 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2452 |
if (__isSmallInteger(colorIndex)) { |
1344 | 2453 |
dpy = myDpy; |
2454 |
color = (long) __intVal(colorIndex); |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2455 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2456 |
ENTER_XLIB(); |
1344 | 2457 |
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
|
2458 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2459 |
#ifdef COUNT_RESOURCES |
1344 | 2460 |
__cnt_color--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2461 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2462 |
|
1344 | 2463 |
RETURN ( self ); |
0 | 2464 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2465 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2466 |
self primitiveFailedOrClosedConnection |
295 | 2467 |
! |
2468 |
||
3220 | 2469 |
getScaledRGBFrom:index |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2470 |
"get rgb components (0 .. 16rFFFF) of color in map at:index, |
3220 | 2471 |
and return a 3-element array containing them" |
2472 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2473 |
<context: #return> |
295 | 2474 |
%{ |
555 | 2475 |
int screen = __intVal(__INST(screen)); |
295 | 2476 |
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
|
2477 |
int sr, sg, sb; |
295 | 2478 |
int bits, scale, shift; |
2479 |
||
1209 | 2480 |
if (ISCONNECTED |
2481 |
&& __isSmallInteger(index)) { |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2482 |
Display *dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2483 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2484 |
color.pixel = __intVal(index); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2485 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2486 |
ENTER_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2487 |
XQueryColor(dpy, DefaultColormap(dpy, screen), &color); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2488 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2489 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2490 |
|
4245 | 2491 |
/* |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2492 |
* have to compensate for an error in X ?, which does not scale |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2493 |
* colors correctly if lesser than 16bits are valid in a color, |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2494 |
* (for example, color white on a 4bitsPerRGB server will Return |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2495 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2496 |
*/ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2497 |
bits = __intVal(__INST(bitsPerRGB)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2498 |
scale = (1<<bits) - 1; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2499 |
shift = 16 - bits; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2500 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2501 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2502 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2503 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2504 |
RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb))); |
3220 | 2505 |
} |
2506 |
%}. |
|
2507 |
^ super getScaledRGBFrom:index |
|
2508 |
! |
|
2509 |
||
2510 |
getScaledRGBFromName:colorName |
|
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2511 |
"get rgb components (0..16rFFFF) of color named colorName, |
3220 | 2512 |
and return a 3-element array containing them" |
2513 |
||
295 | 2514 |
%{ |
555 | 2515 |
int screen = __intVal(__INST(screen)); |
295 | 2516 |
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
|
2517 |
int sr, sg, sb; |
295 | 2518 |
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
|
2519 |
int bits, scale, shift; |
295 | 2520 |
|
1209 | 2521 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2522 |
&& __isNonNilObject(colorName) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2523 |
&& (__qIsString(colorName) || __qIsSymbol(colorName))) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2524 |
Display *dpy = myDpy; |
4245 | 2525 |
|
2526 |
||
2527 |
if (XParseColor(dpy, DefaultColormap(dpy, screen), |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2528 |
(char *) __stringVal(colorName), &color)) { |
4245 | 2529 |
/* |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2530 |
* have to compensate for an error in X ?, which does not scale |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2531 |
* colors correctly if lesser than 16bits are valid in a color, |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2532 |
* (for example, color white on a 4bitsPerRGB server will Return |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2533 |
* (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF) |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2534 |
*/ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2535 |
bits = __intVal(__INST(bitsPerRGB)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2536 |
scale = (1<<bits) - 1; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2537 |
shift = 16 - bits; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2538 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2539 |
sr = ((double)(color.red>>shift) / scale) * 0xFFFF; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2540 |
sg = ((double)(color.green>>shift) / scale) * 0xFFFF; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2541 |
sb = ((double)(color.blue>>shift) / scale) * 0xFFFF; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2542 |
RETURN ( __ARRAY_WITH3(__MKSMALLINT(sr), __MKSMALLINT(sg), __MKSMALLINT(sb))); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2543 |
} |
3220 | 2544 |
|
2545 |
} |
|
2546 |
%}. |
|
2547 |
^ super getScaledRGBFromName:colorName |
|
295 | 2548 |
! |
2549 |
||
2550 |
listOfAvailableColors |
|
2551 |
"return a list of all available colornames. |
|
2552 |
This should not be used, since colornames are very |
|
2553 |
display-specific (here X-specific)." |
|
2554 |
||
2555 |
|aStream list line index colorName| |
|
2556 |
||
3814
0d856538e64f
Handle openErrorSignal in preparition for change openErrorSignal
Stefan Vogel <sv@exept.de>
parents:
3806
diff
changeset
|
2557 |
aStream := '/usr/lib/X11/rgb.txt' asFilename readStreamOrNil. |
295 | 2558 |
aStream isNil ifTrue:[^ nil]. |
2559 |
list := OrderedCollection new. |
|
2560 |
[aStream atEnd] whileFalse:[ |
|
3920 | 2561 |
line := aStream nextLine. |
2562 |
line notNil ifTrue:[ |
|
2563 |
"skip the r/g/b numbers" |
|
2564 |
index := 1. |
|
2565 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2566 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2567 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2568 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2569 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2570 |
[(line at:index) isDigit] whileTrue:[index := index + 1]. |
|
2571 |
[(line at:index) isSeparator] whileTrue:[index := index + 1]. |
|
2572 |
colorName := line copyFrom:index. |
|
2573 |
((colorName occurrencesOf:(Character space)) == 0) ifTrue:[ |
|
2574 |
list add:colorName |
|
2575 |
] |
|
2576 |
] |
|
295 | 2577 |
]. |
2578 |
aStream close. |
|
2579 |
^ list sort |
|
1047 | 2580 |
|
2581 |
" |
|
2582 |
Screen current listOfAvailableColors |
|
2583 |
" |
|
2584 |
||
2585 |
"Modified: 11.9.1996 / 15:26:28 / stefan" |
|
295 | 2586 |
! |
2587 |
||
3220 | 2588 |
percentToDeviceColorValue:aPercentage |
295 | 2589 |
"given a color-component value in percent (0..100), return the corresponding |
2590 |
x-component value (0..65k) as an integer" |
|
2591 |
||
3220 | 2592 |
|
295 | 2593 |
%{ /* NOCONTEXT */ |
2594 |
||
2595 |
if (__isSmallInteger(aPercentage)) { |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2596 |
RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) ); |
295 | 2597 |
} |
2598 |
if (__isFloat(aPercentage)) { |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
2599 |
RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) ); |
295 | 2600 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2601 |
%}. |
295 | 2602 |
^ (16rFFFF * aPercentage / 100) rounded |
0 | 2603 |
! |
2604 |
||
892 | 2605 |
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
|
2606 |
"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
|
2607 |
This method is a noop for StaticGrey, StaticGrey and TrueColor displays." |
0 | 2608 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2609 |
<context: #return> |
4245 | 2610 |
%{ |
0 | 2611 |
|
2612 |
char *colorname; |
|
2613 |
XColor color; |
|
555 | 2614 |
int screen = __intVal(__INST(screen)); |
0 | 2615 |
int r, g, b; |
2616 |
int ok = 1; |
|
2617 |
||
892 | 2618 |
if (__isSmallInteger(sred)) |
1344 | 2619 |
r = __intVal(sred); |
0 | 2620 |
else ok = 0; |
2621 |
||
892 | 2622 |
if (__isSmallInteger(sgreen)) |
1344 | 2623 |
g = __intVal(sgreen); |
0 | 2624 |
else ok = 0; |
2625 |
||
892 | 2626 |
if (__isSmallInteger(sblue)) |
1344 | 2627 |
b = __intVal(sblue); |
0 | 2628 |
else ok = 0; |
2629 |
||
1209 | 2630 |
if (ISCONNECTED |
2631 |
&& __isSmallInteger(index) && ok) { |
|
1344 | 2632 |
Display *dpy = myDpy; |
2633 |
||
2634 |
color.pixel = __intVal(index); |
|
2635 |
color.red = r; |
|
2636 |
color.green = g; |
|
2637 |
color.blue = b; |
|
2638 |
color.flags = DoRed | DoGreen | DoBlue; |
|
2639 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2640 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2641 |
ENTER_XLIB(); |
1344 | 2642 |
XStoreColor(dpy, DefaultColormap(dpy, screen), &color); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2643 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2644 |
|
1344 | 2645 |
RETURN ( self ); |
0 | 2646 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2647 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2648 |
self primitiveFailedOrClosedConnection |
295 | 2649 |
! ! |
2650 |
||
2651 |
!XWorkstation methodsFor:'cursor stuff'! |
|
2652 |
||
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2653 |
builtInCursorShapes |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2654 |
"return a collection of standard cursor names. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2655 |
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
|
2656 |
user cursors. |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2657 |
(actually, there are more than those below ...)" |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2658 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2659 |
"/ 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
|
2660 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2661 |
^ #( |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2662 |
#upLeftArrow "/ XC_top_left_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2663 |
#upRightHand "/ XC_hand1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2664 |
#upDownArrow "/ XC_sb_v_double_arrow |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2665 |
#leftRightArrow "/ XC_sb_h_double_arrow |
4245 | 2666 |
#upLimitArrow "/ XC_top_side |
2667 |
#downLimitArrow "/ XC_bottom_side |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2668 |
#leftLimitArrow "/ XC_left_side |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2669 |
#rightLimitArrow "/ XC_right_side |
4245 | 2670 |
#text "/ XC_xterm |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2671 |
#upRightArrow "/ XC_draft_large |
4245 | 2672 |
#leftHand "/ XC_hand2 |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2673 |
#questionMark "/ XC_question_arrow |
4245 | 2674 |
#cross "/ XC_X_cursor |
2675 |
#wait "/ XC_watch |
|
2676 |
#crossHair "/ XC_tcross |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2677 |
#origin "/ XC_ul_angle |
4245 | 2678 |
#topLeft "/ XC_ul_angle |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2679 |
#corner "/ XC_lr_angle |
4245 | 2680 |
#bottomRight "/ XC_lr_angle |
2681 |
#topRight "/ XC_ur_angle |
|
2682 |
#bottomLeft "/ XC_ll_angle |
|
2683 |
#square "/ XC_dotbox |
|
2684 |
#fourWay "/ XC_fleur |
|
2685 |
#crossCursor "/ XC_X_cursor |
|
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2686 |
) |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2687 |
|
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2688 |
"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
|
2689 |
"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
|
2690 |
! |
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2691 |
|
295 | 2692 |
colorCursor:aCursorId foreground:fgColor background:bgColor |
2693 |
"change a cursors colors" |
|
2694 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2695 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2696 |
|
295 | 2697 |
|fgR fgG fgB bgR bgG bgB| |
2698 |
||
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2699 |
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
|
2700 |
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
|
2701 |
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
|
2702 |
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
|
2703 |
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
|
2704 |
bgB := bgColor scaledBlue. |
0 | 2705 |
%{ |
295 | 2706 |
XColor fgcolor, bgcolor; |
2707 |
||
1209 | 2708 |
if (ISCONNECTED |
2709 |
&& __isExternalAddress(aCursorId) |
|
295 | 2710 |
&& __bothSmallInteger(fgG, fgB) |
4245 | 2711 |
&& __bothSmallInteger(bgR, bgG) |
295 | 2712 |
&& __bothSmallInteger(bgB, fgR)) { |
2713 |
||
1344 | 2714 |
fgcolor.red = __intVal(fgR); |
2715 |
fgcolor.green= __intVal(fgG); |
|
2716 |
fgcolor.blue = __intVal(fgB); |
|
2717 |
bgcolor.red = __intVal(bgR); |
|
2718 |
bgcolor.green= __intVal(bgG); |
|
2719 |
bgcolor.blue = __intVal(bgB); |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2720 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2721 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
2722 |
XRecolorCursor(myDpy, __CursorVal(aCursorId), &fgcolor, &bgcolor); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2723 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2724 |
|
1344 | 2725 |
RETURN ( self ); |
72 | 2726 |
} |
834
f71ba674da2a
Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents:
830
diff
changeset
|
2727 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2728 |
self primitiveFailedOrClosedConnection |
70 | 2729 |
! |
2730 |
||
295 | 2731 |
createCursorShape:aShape |
974 | 2732 |
"create a cursor given a shape-symbol. This only works |
2733 |
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
|
2734 |
Senders must always care for a fallBack, in case of a nil return." |
295 | 2735 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2736 |
|shapeNumber| |
3226 | 2737 |
|
2738 |
shapeNumber := self shapeNumberFromSymbol:aShape. |
|
2739 |
shapeNumber isNil ifTrue:[^ nil]. |
|
2740 |
^ self primCreateCursorShapeNumber:shapeNumber |
|
295 | 2741 |
! |
2742 |
||
974 | 2743 |
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h |
295 | 2744 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
2745 |
||
3227 | 2746 |
^ self |
4245 | 2747 |
primCreateCursorSourceFormId:sourceForm id |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2748 |
maskFormId:maskForm id |
4245 | 2749 |
hotX:hx hotY:hy |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2750 |
width:w height:h |
295 | 2751 |
! |
2752 |
||
2753 |
destroyCursor:aCursorId |
|
974 | 2754 |
"release a cursor - frees any device resources" |
0 | 2755 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2756 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2757 |
%{ |
0 | 2758 |
|
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2759 |
if (! ISCONNECTED) { |
1344 | 2760 |
RETURN ( self ); |
1211
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2761 |
} |
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2762 |
|
06d63d128bde
allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents:
1210
diff
changeset
|
2763 |
if (__isExternalAddress(aCursorId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
2764 |
Cursor curs = __CursorVal(aCursorId); |
1344 | 2765 |
|
2766 |
if (curs) { |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2767 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2768 |
ENTER_XLIB(); |
1344 | 2769 |
XFreeCursor(myDpy, curs); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
2770 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2771 |
#ifdef COUNT_RESOURCES |
1344 | 2772 |
__cnt_cursor--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
2773 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
2774 |
|
1344 | 2775 |
} |
2776 |
RETURN ( self ); |
|
0 | 2777 |
} |
974 | 2778 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2779 |
self primitiveFailedOrClosedConnection |
295 | 2780 |
! |
2781 |
||
974 | 2782 |
needDeviceFormsForCursor |
2783 |
^ true |
|
2784 |
! |
|
2785 |
||
3226 | 2786 |
primCreateCursorShapeNumber:aShapeNumber |
2787 |
"create a cursor given a shape-number." |
|
2788 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2789 |
<context: #return> |
3226 | 2790 |
%{ |
2791 |
Cursor newCursor; |
|
2792 |
||
2793 |
if (ISCONNECTED |
|
2794 |
&& __isSmallInteger(aShapeNumber)) { |
|
2795 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2796 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2797 |
newCursor = XCreateFontCursor(myDpy, __intVal(aShapeNumber)); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2798 |
LEAVE_XLIB(); |
3226 | 2799 |
#ifdef COUNT_RESOURCES |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2800 |
if (newCursor) |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2801 |
__cnt_cursor++; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2802 |
#endif |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2803 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2804 |
if (newCursor != (Cursor)0) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2805 |
RETURN (__MKEXTERNALADDRESS(newCursor)); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2806 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2807 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2808 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2809 |
self primitiveFailedOrClosedConnection. |
3226 | 2810 |
^ nil |
2811 |
! |
|
2812 |
||
3227 | 2813 |
primCreateCursorSourceFormId:sourceId maskFormId:maskId hotX:hx hotY:hy width:w height:h |
2814 |
"create a cursor given 2 bitmaps (source, mask) and a hotspot" |
|
2815 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2816 |
<context: #return> |
3227 | 2817 |
%{ |
2818 |
Cursor newCursor; |
|
2819 |
XColor fgColor, bgColor; |
|
2820 |
||
2821 |
if (ISCONNECTED |
|
2822 |
&& __isExternalAddress(sourceId) |
|
2823 |
&& __isExternalAddress(maskId) |
|
2824 |
&& __bothSmallInteger(hx, hy)) { |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2825 |
fgColor.red = 0; /* fg is black */ |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2826 |
fgColor.green = 0; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2827 |
fgColor.blue = 0; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2828 |
bgColor.red = 0xFFFF; /* bg is white */ |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2829 |
bgColor.green = 0xFFFF; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2830 |
bgColor.blue = 0xFFFF; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2831 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2832 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2833 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2834 |
newCursor = XCreatePixmapCursor(myDpy, |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
2835 |
__PixmapVal(sourceId), |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
2836 |
__PixmapVal(maskId), |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2837 |
&fgColor, &bgColor, __intVal(hx), __intVal(hy)); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2838 |
LEAVE_XLIB(); |
3227 | 2839 |
#ifdef COUNT_RESOURCES |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2840 |
if (newCursor) |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2841 |
__cnt_cursor++; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2842 |
#endif |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2843 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2844 |
if (newCursor != (Cursor)0) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2845 |
RETURN (__MKEXTERNALADDRESS(newCursor)); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2846 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2847 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2848 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
2849 |
self primitiveFailedOrClosedConnection. |
3227 | 2850 |
^ nil |
2851 |
! |
|
2852 |
||
295 | 2853 |
shapeNumberFromSymbol:shape |
974 | 2854 |
"given a shape-symbol, return the corresponding cursor-number, |
2855 |
or nil if no such standard cursor exists." |
|
295 | 2856 |
|
1563
5a634cfaffad
allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents:
1558
diff
changeset
|
2857 |
"/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
|
2858 |
"/ 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
|
2859 |
|
295 | 2860 |
|
2861 |
(shape == #upLeftArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow) %} "132" ]. |
|
2862 |
(shape == #upRightHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1) %} "58" ]. |
|
2863 |
(shape == #upDownArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ]. |
|
2864 |
(shape == #leftRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ]. |
|
2865 |
(shape == #upLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side) %} "138" ]. |
|
2866 |
(shape == #downLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side) %} "16" ]. |
|
2867 |
(shape == #leftLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side) %} "70" ]. |
|
2868 |
(shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side) %} "96" ]. |
|
2869 |
(shape == #text) ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm) %} "152" ]. |
|
2870 |
(shape == #upRightArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large) %} "44" ]. |
|
2871 |
(shape == #leftHand) ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2) %} "60" ]. |
|
2872 |
(shape == #questionMark) ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow) %} "92" ]. |
|
2873 |
(shape == #cross) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
2874 |
(shape == #wait) ifTrue:[ ^ %{ __MKSMALLINT(XC_watch) %} "150" ]. |
|
2875 |
(shape == #crossHair) ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross) %} "130" ]. |
|
2876 |
((shape == #origin) |
|
2877 |
or:[shape == #topLeft]) ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle) %} "144" ]. |
|
2878 |
((shape == #corner) |
|
2879 |
or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle) %} "78" ]. |
|
2880 |
(shape == #topRight) ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle) %} "148" ]. |
|
2881 |
(shape == #bottomLeft) ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle) %} "76" ]. |
|
2882 |
(shape == #square) ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox) %} "40" ]. |
|
2883 |
(shape == #fourWay) ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur) %} "52" ]. |
|
2884 |
(shape == #crossCursor) ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor) %} "0" ]. |
|
1183 | 2885 |
|
2886 |
"/ ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL. |
|
974 | 2887 |
^ nil |
0 | 2888 |
! ! |
2889 |
||
1543 | 2890 |
!XWorkstation methodsFor:'drag & drop'! |
2891 |
||
1556 | 2892 |
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
2893 |
"drop something in some alien view, using the DND protocol. |
|
2894 |
Returns false, if the drop could not be performed." |
|
2895 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2896 |
|msgType dropColl dropCollSize anyFile anyDir anyText anyOther |
1556 | 2897 |
dropType dropTypeCode strings sz idx val| |
2898 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
2899 |
(msgType := self atomIDOf:#DndProtocol) notNil ifTrue:[ |
1556 | 2900 |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2901 |
"/ 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
|
2902 |
"/ check for this. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2903 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2904 |
dropObjects isCollection ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2905 |
dropColl := Array with:dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2906 |
] ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2907 |
dropColl := dropObjects |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2908 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2909 |
anyFile := anyDir := anyText := anyOther := false. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2910 |
dropColl do:[:aDropObject | |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2911 |
aDropObject isFileObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2912 |
aDropObject theObject isDirectory ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2913 |
anyDir := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2914 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2915 |
anyFile := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2916 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2917 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2918 |
aDropObject isTextObject ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2919 |
anyText := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2920 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2921 |
anyOther := true |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2922 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2923 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2924 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2925 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2926 |
anyOther ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2927 |
"/ DND does not support this ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2928 |
'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
|
2929 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2930 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2931 |
anyText ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2932 |
(anyFile or:[anyDir]) ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2933 |
"/ DND does not support mixed types |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2934 |
'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
|
2935 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2936 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2937 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2938 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2939 |
dropCollSize := dropColl size. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2940 |
anyFile ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2941 |
dropType := #DndFiles. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2942 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2943 |
dropType := #DndFile |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2944 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2945 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2946 |
anyDir ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2947 |
dropType := #DndFiles. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2948 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2949 |
dropType := #DndDir |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2950 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2951 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2952 |
anyText ifTrue:[ |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2953 |
dropCollSize == 1 ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2954 |
dropType := #DndText |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2955 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2956 |
"/ can only drop a single text object |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2957 |
'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
|
2958 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2959 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2960 |
] ifFalse:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2961 |
"/ mhmh ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2962 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2963 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2964 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2965 |
] |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2966 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2967 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2968 |
dropTypeCode := self dndDropTypes indexOf:dropType. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2969 |
dropTypeCode == 0 ifTrue:[ |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2970 |
'XWorkstation [info]: DND cannot drop this' infoPrintCR. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2971 |
^ false |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2972 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2973 |
dropTypeCode := dropTypeCode - 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2974 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2975 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2976 |
"/ place the selection inTo the DndSelection property |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2977 |
"/ of the rootView ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2978 |
"/ ... need a single string, with 0-terminated parts. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2979 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2980 |
strings := OrderedCollection new. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2981 |
sz := 0. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2982 |
dropColl do:[:anObject | |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2983 |
|s o| |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2984 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2985 |
o := anObject theObject. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2986 |
anObject isFileObject ifTrue:[ |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2987 |
o := o pathName |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2988 |
]. |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2989 |
s := o asString. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2990 |
strings add:s. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2991 |
sz := sz + (s size) + 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2992 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2993 |
val := String new:sz. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2994 |
idx := 1. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
2995 |
strings do:[:aString | |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2996 |
|sz| |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2997 |
|
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2998 |
sz := aString size. |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
2999 |
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
|
3000 |
idx := idx + sz. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3001 |
val at:idx put:(Character value:0). |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3002 |
idx := idx + 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3003 |
]. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3004 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3005 |
self |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3006 |
setProperty:(self atomIDOf:#DndSelection) |
4245 | 3007 |
type:(self atomIDOf:#STRING) |
3008 |
value:val |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3009 |
for:rootId. |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3010 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3011 |
^ self |
4245 | 3012 |
sendClientEvent:msgType |
3013 |
format:32 |
|
3014 |
to:destinationId |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3015 |
data1:dropTypeCode |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3016 |
data2:0 |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3017 |
data3:destinationId |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3018 |
data4:nil |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3019 |
data5:nil. |
1556 | 3020 |
]. |
3021 |
||
3022 |
^ false |
|
3023 |
||
3024 |
"Created: 6.4.1997 / 13:39:37 / cg" |
|
1558 | 3025 |
"Modified: 6.4.1997 / 14:30:43 / cg" |
1556 | 3026 |
! |
3027 |
||
3028 |
dndDropTypes |
|
3029 |
"return the dropTypes as supported by DND" |
|
3030 |
||
4245 | 3031 |
^ #( |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3032 |
DndUnknown "/ 0 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3033 |
DndRawData "/ 1 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3034 |
DndFile "/ 2 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3035 |
DndFiles "/ 3 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3036 |
DndText "/ 4 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3037 |
DndDir "/ 5 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3038 |
DndLink "/ 6 |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3039 |
DndExe "/ 7 |
1556 | 3040 |
) |
3041 |
||
3042 |
"Created: 6.4.1997 / 12:57:56 / cg" |
|
3043 |
"Modified: 6.4.1997 / 13:38:52 / cg" |
|
3044 |
! |
|
3045 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
3046 |
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint |
1556 | 3047 |
"drop something in some alien view. |
3048 |
Returns false, if the drop could not be performed." |
|
3049 |
||
3050 |
"/ |
|
1543 | 3051 |
"/ see, if the display supports the DND protocol ... |
1556 | 3052 |
"/ |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3053 |
(self atomIDOf:#DndProtocol) notNil ifTrue:[ |
1694 | 3054 |
^ self |
4245 | 3055 |
dndDrop:aCollectionOfDropObjects |
3056 |
inWindowID:destinationId |
|
3057 |
position:destinationPoint |
|
3058 |
rootPosition:rootPoint |
|
1543 | 3059 |
]. |
3060 |
||
1556 | 3061 |
"/ add more drag&drop protocols here. |
3062 |
||
3063 |
^ false |
|
3064 |
||
1583
ca6e6732dc29
drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents:
1579
diff
changeset
|
3065 |
"Modified: 11.4.1997 / 12:44:50 / cg" |
1543 | 3066 |
! ! |
3067 |
||
0 | 3068 |
!XWorkstation methodsFor:'drawing'! |
3069 |
||
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
3070 |
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
118 | 3071 |
"do a bit-blt; copy bits from the rectangle defined by |
3072 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
3073 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
3074 |
argument is not integer." |
|
0 | 3075 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3076 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3077 |
%{ |
0 | 3078 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3079 |
GC gc; |
0 | 3080 |
Drawable source, dest; |
3081 |
||
1209 | 3082 |
if (ISCONNECTED |
3083 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3084 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3085 |
&& __isExternalAddress(destId) |
97 | 3086 |
&& __bothSmallInteger(w, h) |
3087 |
&& __bothSmallInteger(srcX, srcY) |
|
3088 |
&& __bothSmallInteger(dstX, dstY)) { |
|
1848 | 3089 |
int _sX, _sY, _w, _h, _dX, _dY; |
3090 |
||
3091 |
_sX = __intVal(srcX); |
|
3092 |
_sY = __intVal(srcY); |
|
3093 |
_w = __intVal(w); |
|
3094 |
_h = __intVal(h); |
|
3095 |
_dX = __intVal(dstX); |
|
3096 |
_dY = __intVal(dstY); |
|
3097 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3098 |
gc = __GCVal(dstGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3099 |
source = __DrawableVal(sourceId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3100 |
dest = __DrawableVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3101 |
ENTER_XLIB(); |
1848 | 3102 |
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
|
3103 |
LEAVE_XLIB(); |
1344 | 3104 |
RETURN ( self ); |
0 | 3105 |
} |
118 | 3106 |
%}. |
3107 |
"badGC, bad sourceDrawableId or destDrawableID |
|
3108 |
or any non integer coordinate" |
|
3109 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3110 |
self primitiveFailedOrClosedConnection |
0 | 3111 |
! |
3112 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3113 |
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
|
3114 |
"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
|
3115 |
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
|
3116 |
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
|
3117 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3118 |
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
|
3119 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3120 |
<context: #return> |
4245 | 3121 |
%{ |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3122 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3123 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3124 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3125 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3126 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3127 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3128 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3129 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3130 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3131 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3132 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 3133 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3134 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3135 |
gc = __GCVal(dstGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3136 |
source = __DrawableVal(sourceId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3137 |
dest = __DrawableVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3138 |
ENTER_XLIB(); |
1344 | 3139 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3140 |
XCopyArea(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3141 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3142 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3143 |
__intVal(dstX), __intVal(dstY)); |
1344 | 3144 |
XSetGraphicsExposures(dpy, gc, 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3145 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3146 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3147 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3148 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3149 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3150 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3151 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3152 |
self primitiveFailedOrClosedConnection |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3153 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3154 |
|
1030
ca9d23090688
pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents:
1025
diff
changeset
|
3155 |
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
4245 | 3156 |
"do a bit-blt, but only copy the low-bit plane; |
118 | 3157 |
copy bits from the rectangle defined by |
3158 |
srcX/srcY and w/h from the sourceId drawable to the rectangle |
|
3159 |
below dstX/dstY in the destId drawable. Trigger an error if any |
|
3160 |
argument is not integer." |
|
0 | 3161 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3162 |
<context: #return> |
4245 | 3163 |
%{ |
0 | 3164 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3165 |
GC gc; |
0 | 3166 |
Drawable source, dest; |
3167 |
||
1209 | 3168 |
if (ISCONNECTED |
3169 |
&& __isExternalAddress(dstGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3170 |
&& __isExternalAddress(sourceId) |
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3171 |
&& __isExternalAddress(destId) |
97 | 3172 |
&& __bothSmallInteger(w, h) |
3173 |
&& __bothSmallInteger(srcX, srcY) |
|
3174 |
&& __bothSmallInteger(dstX, dstY)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3175 |
gc = __GCVal(dstGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3176 |
source = __DrawableVal(sourceId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3177 |
dest = __DrawableVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3178 |
ENTER_XLIB(); |
1344 | 3179 |
XCopyPlane(myDpy, source, dest, gc, |
3180 |
__intVal(srcX), __intVal(srcY), |
|
3181 |
__intVal(w), __intVal(h), |
|
3182 |
__intVal(dstX), __intVal(dstY), 1); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3183 |
LEAVE_XLIB(); |
1344 | 3184 |
RETURN ( self ); |
0 | 3185 |
} |
118 | 3186 |
%}. |
3187 |
"badGC, bad sourceDrawableId or destDrawableID |
|
3188 |
or any non integer coordinate" |
|
3189 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3190 |
self primitiveFailedOrClosedConnection |
0 | 3191 |
! |
3192 |
||
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3193 |
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h |
4245 | 3194 |
"do a bit-blt from a pix- or bitmap, but only copy the low-bit plane; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3195 |
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
|
3196 |
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
|
3197 |
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
|
3198 |
argument is not integer. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3199 |
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
|
3200 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3201 |
<context: #return> |
4245 | 3202 |
%{ |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3203 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3204 |
GC gc; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3205 |
Drawable source, dest; |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3206 |
|
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3207 |
if (ISCONNECTED |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3208 |
&& __isExternalAddress(dstGCId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3209 |
&& __isExternalAddress(sourceId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3210 |
&& __isExternalAddress(destId) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3211 |
&& __bothSmallInteger(w, h) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3212 |
&& __bothSmallInteger(srcX, srcY) |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3213 |
&& __bothSmallInteger(dstX, dstY)) { |
1344 | 3214 |
Display *dpy = myDpy; |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3215 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3216 |
gc = __GCVal(dstGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3217 |
source = __DrawableVal(sourceId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3218 |
dest = __DrawableVal(destId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3219 |
ENTER_XLIB(); |
1344 | 3220 |
XSetGraphicsExposures(dpy, gc, 0); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3221 |
XCopyPlane(dpy, source, dest, gc, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3222 |
__intVal(srcX), __intVal(srcY), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3223 |
__intVal(w), __intVal(h), |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3224 |
__intVal(dstX), __intVal(dstY), 1); |
1344 | 3225 |
XSetGraphicsExposures(dpy, gc, 1); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3226 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
3227 |
RETURN ( self ); |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3228 |
} |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3229 |
%}. |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3230 |
"badGC, bad sourceDrawableId or destDrawableID |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3231 |
or any non integer coordinate" |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3232 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3233 |
self primitiveFailedOrClosedConnection |
1246
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3234 |
! |
f8835fc41467
added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents:
1227
diff
changeset
|
3235 |
|
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
3236 |
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId |
90 | 3237 |
"draw an arc. If any of x,y, w or h is not an integer, an error is triggered. |
3238 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 3239 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3240 |
<context: #return> |
4245 | 3241 |
%{ |
0 | 3242 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3243 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3244 |
Window win; |
0 | 3245 |
int w, h, angle1, angle2; |
3246 |
double f; |
|
3247 |
||
97 | 3248 |
if (__isSmallInteger(startAngle)) |
1344 | 3249 |
angle1 = __intVal(startAngle) * 64; |
36 | 3250 |
else if (__isFloat(startAngle)) { |
1344 | 3251 |
f = __floatVal(startAngle); |
3252 |
angle1 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3253 |
} else if (__isShortFloat(startAngle)) { |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3254 |
f = __shortFloatVal(startAngle); |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3255 |
angle1 = f * 64; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3256 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3257 |
|
97 | 3258 |
if (__isSmallInteger(angle)) |
1344 | 3259 |
angle2 = __intVal(angle) * 64; |
36 | 3260 |
else if (__isFloat(angle)) { |
1344 | 3261 |
f = __floatVal(angle); |
3262 |
angle2 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
3263 |
} else if (__isShortFloat(angle)) { |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3264 |
f = __shortFloatVal(angle); |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3265 |
angle2 = f * 64; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3266 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3267 |
|
1209 | 3268 |
if (ISCONNECTED |
3269 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
3270 |
&& __isExternalAddress(aDrawableId) |
97 | 3271 |
&& __bothSmallInteger(x, y) |
3272 |
&& __bothSmallInteger(width, height)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3273 |
win = __WindowVal(aDrawableId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
3274 |
gc = __GCVal(aGCId); |
1344 | 3275 |
w = __intVal(width); |
3276 |
h = __intVal(height); |
|
3277 |
/* |
|
3278 |
* need this check here: some servers simply dump core with bad args |
|
3279 |
*/ |
|
3280 |
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
|
3281 |
ENTER_XLIB(); |
1344 | 3282 |
XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y), |
3283 |
w, h, angle1, angle2); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
3284 |
LEAVE_XLIB(); |
1344 | 3285 |
} |
3286 |
RETURN ( self ); |
|
0 | 3287 |
} |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3288 |
bad: ; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3289 |
%}. |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
3290 |
"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
|
3291 |
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
|
3292 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3293 |
self primitiveFailedOrClosedConnection |
0 | 3294 |
! |
3295 |
||
295 | 3296 |
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId |
4245 | 3297 |
"draw a line. If the coordinates are not integers, an error is triggered." |
295 | 3298 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3299 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3300 |
%{ |
295 | 3301 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3302 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3303 |
Window win; |
295 | 3304 |
|
1209 | 3305 |
if (ISCONNECTED |
3306 |
&& __isExternalAddress(aGCId) |
|
295 | 3307 |
&& __isExternalAddress(aDrawableId) |
3308 |
&& __bothSmallInteger(x0, y0) |
|
3309 |
&& __bothSmallInteger(x1, y1)) { |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3310 |
Display *dpy = myDpy; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3311 |
int ix0, iy0, ix1, iy1; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3312 |
gc = __GCVal(aGCId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3313 |
win = __WindowVal(aDrawableId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3314 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3315 |
ix0 = __intVal(x0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3316 |
iy0 = __intVal(y0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3317 |
ix1 = __intVal(x1); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3318 |
iy1 = __intVal(y1); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3319 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3320 |
/* attention: coordinates in X are shorts and wrap; clamp here. */ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3321 |
if (ix0 > 0x7FFF) ix0 = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3322 |
else if (ix0 < -0x8000) ix0 = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3323 |
if (iy0 > 0x7FFF) iy0 = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3324 |
else if (iy0 < -0x8000) iy0 = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3325 |
if (ix1 > 0x7FFF) ix1 = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3326 |
else if (ix1 < -0x8000) ix1 = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3327 |
if (iy1 > 0x7FFF) iy1 = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3328 |
else if (iy1 < -0x8000) iy1 = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3329 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3330 |
ENTER_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3331 |
if ((ix0 == ix1) && (iy0 == iy1)) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3332 |
/* little bit shorter X-lib message (better with slow connections...) */ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3333 |
XDrawPoint(dpy, win, gc, ix0, iy0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3334 |
} else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3335 |
XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3336 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3337 |
LEAVE_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3338 |
RETURN ( self ); |
295 | 3339 |
} |
3340 |
%}. |
|
3341 |
"badGC, badDrawable or coordinates not integer" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3342 |
self primitiveFailedOrClosedConnection |
295 | 3343 |
! |
3344 |
||
1978 | 3345 |
displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
3346 |
"draw a polygon starting at x; the y values derives from the collection yValues. |
|
3347 |
The associated x is a multiple of step. Each y value will be scaled and translated |
|
3348 |
" |
|
3349 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3350 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3351 |
|
1978 | 3352 |
|noY| |
3353 |
||
3354 |
(noY := yValues size) < 2 ifTrue:[ |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3355 |
^ self |
1978 | 3356 |
]. |
3357 |
||
3358 |
%{ |
|
3359 |
OBJ yA, t; |
|
3360 |
int i, num; |
|
3361 |
float y, x, sY, tY, step; |
|
3362 |
GC gc; |
|
3363 |
XPoint * points; |
|
3364 |
XPoint qPoints[200]; |
|
3365 |
int mustFree = 0; |
|
3366 |
||
3367 |
Window win; |
|
3368 |
||
3369 |
if (ISCONNECTED |
|
3370 |
&& __isExternalAddress(aGCId) |
|
3371 |
&& __isExternalAddress(aDrawableId) ) { |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3372 |
gc = __GCVal(aGCId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3373 |
win = __WindowVal(aDrawableId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3374 |
|
4245 | 3375 |
if( __isSmallInteger(scaleY) ) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3376 |
sY = (float) __intVal( scaleY ); |
4245 | 3377 |
else if (__isFloat(scaleY)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3378 |
sY = __floatVal( scaleY ); |
4245 | 3379 |
else if (__isShortFloat(scaleY)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3380 |
sY = __shortFloatVal( scaleY ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3381 |
else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3382 |
t = __SSEND0(scaleY, @symbol(asFloat), 0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3383 |
if (! __isFloat(t)) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3384 |
sY = __floatVal( t ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3385 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3386 |
|
4245 | 3387 |
if( __isSmallInteger(transY) ) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3388 |
tY = (float) __intVal( transY ); |
4245 | 3389 |
else if (__isFloat(transY)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3390 |
tY = __floatVal( transY ); |
4245 | 3391 |
else if (__isShortFloat(transY)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3392 |
tY = __shortFloatVal( transY ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3393 |
else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3394 |
t = __SSEND0(transY, @symbol(asFloat), 0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3395 |
if (! __isFloat(t)) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3396 |
tY = __floatVal( t ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3397 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3398 |
|
4245 | 3399 |
if( __isSmallInteger(startX) ) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3400 |
x = (float) __intVal( startX ); |
4245 | 3401 |
else if (__isFloat(startX)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3402 |
x = __floatVal( startX ); |
4245 | 3403 |
else if (__isShortFloat(startX)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3404 |
x = __shortFloatVal( startX ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3405 |
else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3406 |
t = __SSEND0(startX, @symbol(asFloat), 0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3407 |
if (! __isFloat(t)) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3408 |
x = __floatVal( t ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3409 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3410 |
|
4245 | 3411 |
if( __isSmallInteger(stepX) ) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3412 |
step = (float) __intVal( stepX ); |
4245 | 3413 |
else if (__isFloat(stepX)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3414 |
step = __floatVal( stepX ); |
4245 | 3415 |
else if (__isShortFloat(stepX)) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3416 |
step = __shortFloatVal( stepX ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3417 |
else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3418 |
t = __SSEND0(stepX, @symbol(asFloat), 0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3419 |
if (! __isFloat(t)) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3420 |
step = __floatVal( t ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3421 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3422 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3423 |
num = __intVal( noY ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3424 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3425 |
if( num > 200 ) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3426 |
if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) ) |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3427 |
goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3428 |
mustFree = 1; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3429 |
} else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3430 |
points = qPoints; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3431 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3432 |
for( i = 0; i < num; ++i ) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3433 |
int px, py; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3434 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3435 |
yA = __AT_(yValues, __MKSMALLINT(i+1) ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3436 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3437 |
if( __isFloat(yA) ) |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3438 |
y = __floatVal( yA ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3439 |
else if( __isSmallInteger(yA) ) |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3440 |
y = (float) __intVal( yA ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3441 |
else if( __isShortFloat( yA) ) |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3442 |
y = __shortFloatVal( yA ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3443 |
else { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3444 |
t = __SSEND0(yA, @symbol(asFloat), 0); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3445 |
if (! __isFloat(t)) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3446 |
y = __floatVal( t ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3447 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3448 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3449 |
px = (int) (x + 0.5); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3450 |
py = (int) ((y * sY) + tY + 0.5); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3451 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3452 |
/* attention: coordinates in X are shorts and wrap; clamp here. */ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3453 |
if (px > 0x7FFF) px = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3454 |
else if (px < -0x8000) px = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3455 |
if (py > 0x7FFF) py = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3456 |
else if (py < -0x8000) py = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3457 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3458 |
points[i].x = px; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3459 |
points[i].y = py; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3460 |
x = x + step; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3461 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3462 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3463 |
ENTER_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3464 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3465 |
LEAVE_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3466 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3467 |
if( mustFree ) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3468 |
free( points ); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3469 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3470 |
RETURN ( self ); |
1978 | 3471 |
} |
3472 |
||
3473 |
fail: |
|
3474 |
if( mustFree ) |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3475 |
free( points ); |
3229 | 3476 |
%}. |
3477 |
^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId |
|
1978 | 3478 |
|
2146
1c13fdc62a9f
displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents:
2140
diff
changeset
|
3479 |
"Modified: / 13.6.1998 / 13:51:39 / cg" |
1978 | 3480 |
! |
3481 |
||
295 | 3482 |
displayPointX:x y:y in:aDrawableId with:aGCId |
4245 | 3483 |
"draw a point. If x/y are not integers, an error is triggered." |
3484 |
||
3485 |
<context: #return> |
|
3486 |
%{ |
|
295 | 3487 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3488 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3489 |
Window win; |
295 | 3490 |
|
1209 | 3491 |
if (ISCONNECTED |
3492 |
&& __isExternalAddress(aGCId) |
|
295 | 3493 |
&& __isExternalAddress(aDrawableId) |
3494 |
&& __bothSmallInteger(x, y)) { |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3495 |
int px, py; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3496 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3497 |
gc = __GCVal(aGCId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3498 |
win = __WindowVal(aDrawableId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3499 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3500 |
px = __intVal(x); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3501 |
py = __intVal(y); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3502 |
if (px > 0x7FFF) px = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3503 |
else if (px < -0x8000) px = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3504 |
if (py > 0x7FFF) py = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3505 |
else if (py < -0x8000) py = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3506 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3507 |
ENTER_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3508 |
XDrawPoint(myDpy, win, gc, px, py); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3509 |
LEAVE_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3510 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3511 |
RETURN ( self ); |
295 | 3512 |
} |
3513 |
%}. |
|
3514 |
"badGC, badDrawable or x/y not integer" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3515 |
self primitiveFailedOrClosedConnection |
295 | 3516 |
! |
3517 |
||
3518 |
displayPolygon:aPolygon in:aDrawableId with:aGCId |
|
3519 |
"draw a polygon, the argument aPolygon is a Collection of individual points, which |
|
3520 |
define the polygon. |
|
3521 |
If any coordinate is not integer, an error is triggered." |
|
3522 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3523 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3524 |
|
295 | 3525 |
|numberOfPoints newPoints| |
3526 |
||
3527 |
numberOfPoints := aPolygon size. |
|
3528 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3529 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3530 |
Window win; |
295 | 3531 |
OBJ point, x, y; |
3532 |
int i, num; |
|
3533 |
XPoint *points; |
|
3534 |
XPoint qPoints[100]; |
|
377 | 3535 |
int mustFree = 0; |
295 | 3536 |
|
1209 | 3537 |
if (ISCONNECTED |
3538 |
&& __isExternalAddress(aGCId) |
|
295 | 3539 |
&& __isExternalAddress(aDrawableId) |
3540 |
&& __isSmallInteger(numberOfPoints)) { |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3541 |
gc = __GCVal(aGCId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3542 |
win = __WindowVal(aDrawableId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3543 |
num = __intVal(numberOfPoints); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3544 |
/* |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3545 |
* avoid a (slow) malloc, if the number of points is small |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3546 |
*/ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3547 |
if (num > 100) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3548 |
points = (XPoint *)malloc(sizeof(XPoint) * num); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3549 |
if (! points) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3550 |
mustFree = 1; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3551 |
} else |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3552 |
points = qPoints; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3553 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3554 |
for (i=0; i<num; i++) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3555 |
int px, py; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3556 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3557 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3558 |
if (! __isPoint(point)) goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3559 |
x = _point_X(point); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3560 |
y = _point_Y(point); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3561 |
if (! __bothSmallInteger(x, y)) |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3562 |
goto fail; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3563 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3564 |
px = __intVal(x); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3565 |
py = __intVal(y); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3566 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3567 |
/* attention: coordinates in X are shorts and wrap; clamp here. */ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3568 |
if (px > 0x7FFF) px = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3569 |
else if (px < -0x8000) px = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3570 |
if (py > 0x7FFF) py = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3571 |
else if (py < -0x8000) py = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3572 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3573 |
points[i].x = px; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3574 |
points[i].y = py; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3575 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3576 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3577 |
ENTER_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3578 |
XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3579 |
LEAVE_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3580 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3581 |
if (mustFree) |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3582 |
free(points); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3583 |
RETURN ( self ); |
295 | 3584 |
} |
3585 |
fail: ; |
|
377 | 3586 |
if (mustFree) |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3587 |
free(points); |
295 | 3588 |
%}. |
3589 |
"badGC, badDrawable or coordinates not integer" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3590 |
self primitiveFailedOrClosedConnection |
295 | 3591 |
! |
3592 |
||
3593 |
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
|
4245 | 3594 |
"draw a rectangle. If the coordinates are not integers, an error is triggered." |
3595 |
||
3596 |
<context: #return> |
|
3597 |
%{ |
|
295 | 3598 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3599 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3600 |
Window win; |
295 | 3601 |
int w, h; |
3602 |
||
1209 | 3603 |
if (ISCONNECTED |
3604 |
&& __isExternalAddress(aGCId) |
|
295 | 3605 |
&& __isExternalAddress(aDrawableId) |
3606 |
&& __bothSmallInteger(x, y) |
|
3607 |
&& __bothSmallInteger(width, height)) { |
|
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3608 |
int px, py; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3609 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3610 |
gc = __GCVal(aGCId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3611 |
win = __WindowVal(aDrawableId); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3612 |
w = __intVal(width); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3613 |
h = __intVal(height); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3614 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3615 |
/* |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3616 |
* need this check here: some servers simply dump core with bad args |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3617 |
*/ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3618 |
if ((w >= 0) && (h >= 0)) { |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3619 |
px = __intVal(x); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3620 |
py = __intVal(y); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3621 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3622 |
/* attention: coordinates in X are shorts and wrap; clamp here. */ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3623 |
if (px > 0x7FFF) px = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3624 |
else if (px < -0x8000) px = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3625 |
if (py > 0x7FFF) py = 0x7FFF; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3626 |
else if (py < -0x8000) py = -0x8000; |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3627 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3628 |
ENTER_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3629 |
XDrawRectangle(myDpy, win, gc, px, py, w, h); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3630 |
LEAVE_XLIB(); |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3631 |
} |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
3632 |
RETURN ( self ); |
295 | 3633 |
} |
3634 |
%}. |
|
3635 |
"badGC, badDrawable or coordinates not integer" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3636 |
self primitiveFailedOrClosedConnection |
295 | 3637 |
! |
3638 |
||
4245 | 3639 |
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque |
295 | 3640 |
"draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both |
3641 |
foreground and background characters. |
|
3642 |
If the coordinates are not integers, an error is triggered." |
|
3643 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3644 |
<context: #return> |
4245 | 3645 |
%{ |
295 | 3646 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3647 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3648 |
Window win; |
1831 | 3649 |
char *cp; |
295 | 3650 |
OBJ cls; |
3651 |
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
|
3652 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3653 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3654 |
int nInstBytes; |
295 | 3655 |
|
1209 | 3656 |
if (ISCONNECTED |
3657 |
&& __isExternalAddress(aGCId) |
|
295 | 3658 |
&& __isExternalAddress(aDrawableId) |
3659 |
&& __isNonNilObject(aString) |
|
3660 |
&& __bothSmallInteger(index1, index2) |
|
3661 |
&& __bothSmallInteger(x, y)) { |
|
4082 | 3662 |
int lMax = __intVal(@global(MaxStringLength)); |
3663 |
Display *dpy = myDpy; |
|
3664 |
gc = __GCVal(aGCId); |
|
3665 |
win = __WindowVal(aDrawableId); |
|
3666 |
cls = __qClass(aString); |
|
3667 |
||
3668 |
i1 = __intVal(index1) - 1; |
|
3669 |
if (i1 >= 0) { |
|
3670 |
i2 = __intVal(index2) - 1; |
|
3671 |
if (i2 < i1) { |
|
3672 |
RETURN (self); |
|
3673 |
} |
|
3674 |
||
3675 |
cp = (char *) __stringVal(aString); |
|
3676 |
l = i2 - i1 + 1; |
|
3677 |
||
3678 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
3679 |
n = __stringSize(aString); |
|
3680 |
if (i2 < n) { |
|
3681 |
cp += i1; |
|
3682 |
if (l > lMax) l = lMax; |
|
3683 |
ENTER_XLIB(); |
|
3684 |
if (opaque == true) |
|
3685 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
|
3686 |
else |
|
3687 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
|
3688 |
LEAVE_XLIB(); |
|
3689 |
RETURN ( self ); |
|
3690 |
} |
|
3691 |
} |
|
3692 |
||
3693 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3694 |
cp += nInstBytes; |
|
3695 |
||
3696 |
if (__isBytes(aString)) { |
|
3697 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3698 |
||
3699 |
if (i2 < n) { |
|
3700 |
cp += i1; |
|
3701 |
if (l > lMax) l = lMax; |
|
3702 |
ENTER_XLIB(); |
|
3703 |
if (opaque == true) |
|
3704 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
|
3705 |
else |
|
3706 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l); |
|
3707 |
LEAVE_XLIB(); |
|
3708 |
RETURN ( self ); |
|
3709 |
} |
|
3710 |
} |
|
3711 |
||
3712 |
/* TWOBYTESTRINGS */ |
|
3713 |
if (__isWords(aString)) { |
|
3714 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3715 |
if (i2 < n) { |
|
3716 |
union { |
|
3717 |
char b[2]; |
|
3718 |
unsigned short s; |
|
3719 |
} u; |
|
3720 |
int i; |
|
3721 |
XChar2b *cp2 = (XChar2b *)0; |
|
3722 |
int mustFree = 0; |
|
3723 |
||
3724 |
cp += (i1 * 2); |
|
3725 |
if (l > lMax) l = lMax; |
|
3990 | 3726 |
|
4029 | 3727 |
#if defined(MSBFIRST) || defined(__MSBFIRST) |
3728 |
/* |
|
3729 |
* chars already in correct order |
|
3730 |
*/ |
|
3731 |
#else |
|
3732 |
# if ! (defined(LSBFIRST) || defined(__LSBFIRST)) |
|
4082 | 3733 |
/* |
3734 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3735 |
* X expects them MSB first |
|
3736 |
* convert as required |
|
3737 |
*/ |
|
3738 |
u.s = 0x1234; |
|
4245 | 3739 |
if (u.b[0] != 0x12) |
4029 | 3740 |
# endif |
3741 |
{ |
|
4082 | 3742 |
if (l <= NLOCALBUFFER) { |
3743 |
cp2 = xlatebuffer; |
|
3744 |
} else { |
|
3745 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
3746 |
mustFree = 1; |
|
3747 |
} |
|
3748 |
for (i=0; i<l; i++) { |
|
3749 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3750 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3751 |
} |
|
3752 |
cp = (char *) cp2; |
|
3753 |
} |
|
4029 | 3754 |
#endif |
4245 | 3755 |
ENTER_XLIB(); |
4082 | 3756 |
if (opaque == true) |
3757 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
3758 |
else |
|
3759 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
4245 | 3760 |
LEAVE_XLIB(); |
4082 | 3761 |
|
3762 |
if (mustFree) { |
|
3763 |
free(cp2); |
|
3764 |
} |
|
3765 |
||
3766 |
RETURN ( self ); |
|
3767 |
} |
|
3768 |
} |
|
3769 |
||
3770 |
/* FOURBYTESTRINGS */ |
|
3771 |
if (__isLongs(aString)) { |
|
3772 |
n = (__byteArraySize(aString) - nInstBytes) / 4; |
|
3773 |
if (i2 < n) { |
|
3774 |
union { |
|
3775 |
char b[2]; |
|
3776 |
unsigned short s; |
|
3777 |
} u; |
|
3778 |
int i; |
|
3779 |
XChar2b *cp2 = (XChar2b *)0; |
|
4029 | 3780 |
int32 *ip; |
4082 | 3781 |
int mustFree = 0; |
3782 |
||
3783 |
cp += (i1 * 4); |
|
3784 |
if (l > lMax) l = lMax; |
|
3785 |
||
3786 |
/* |
|
3787 |
* all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF. |
|
3788 |
*/ |
|
3789 |
if (l <= NLOCALBUFFER) { |
|
3790 |
cp2 = xlatebuffer; |
|
3791 |
} else { |
|
3792 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
3793 |
mustFree = 1; |
|
3794 |
} |
|
3795 |
for (i=0; i<l; i++) { |
|
4029 | 3796 |
int32 codePoint = ((int32 *)cp)[i]; |
3797 |
||
3798 |
if (codePoint > 0xFFFF) { |
|
3799 |
codePoint = 0xFFFF; |
|
3800 |
} |
|
4082 | 3801 |
cp2[i].byte1 = (codePoint >> 8) & 0xFF; |
3802 |
cp2[i].byte2 = codePoint & 0xFF; |
|
3803 |
} |
|
3804 |
cp = (char *) cp2; |
|
3805 |
||
4245 | 3806 |
ENTER_XLIB(); |
4082 | 3807 |
if (opaque == true) |
3808 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
3809 |
else |
|
3810 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l); |
|
4245 | 3811 |
LEAVE_XLIB(); |
4082 | 3812 |
|
3813 |
if (mustFree) { |
|
3814 |
free(cp2); |
|
3815 |
} |
|
3816 |
||
3817 |
RETURN ( self ); |
|
3818 |
} |
|
3819 |
} |
|
3820 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3821 |
} |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3822 |
#undef NLOCALBUFFER |
295 | 3823 |
%}. |
4029 | 3824 |
(aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[ |
4082 | 3825 |
self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter) |
3826 |
from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque. |
|
3827 |
^ self. |
|
4029 | 3828 |
]. |
3829 |
||
295 | 3830 |
"x/y not integer, badGC or drawable, or not a string" |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3831 |
self primitiveFailedOrClosedConnection |
295 | 3832 |
! |
3833 |
||
4245 | 3834 |
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
295 | 3835 |
"draw a string - if opaque is false, draw foreground only; otherwise, draw both |
3836 |
foreground and background characters. |
|
3837 |
If the coordinates are not integers, an error is triggered." |
|
3838 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
3839 |
<context: #return> |
4245 | 3840 |
%{ |
295 | 3841 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3842 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
3843 |
Window win; |
1831 | 3844 |
char *cp; |
295 | 3845 |
int n; |
3846 |
OBJ cls; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3847 |
# define NLOCALBUFFER 200 |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3848 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
3849 |
int nInstBytes; |
295 | 3850 |
|
1209 | 3851 |
if (ISCONNECTED |
3852 |
&& __isExternalAddress(aGCId) |
|
295 | 3853 |
&& __isExternalAddress(aDrawableId) |
3854 |
&& __isNonNilObject(aString) |
|
3855 |
&& __bothSmallInteger(x, y)) { |
|
4082 | 3856 |
int lMax = __intVal(@global(MaxStringLength)); |
3857 |
Display *dpy = myDpy; |
|
3858 |
gc = __GCVal(aGCId); |
|
3859 |
win = __WindowVal(aDrawableId); |
|
3860 |
cls = __qClass(aString); |
|
3861 |
||
3862 |
cp = (char *) __stringVal(aString); |
|
3863 |
||
3864 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
3865 |
n = __stringSize(aString); |
|
3866 |
if (n > lMax) n = lMax; |
|
3867 |
ENTER_XLIB(); |
|
3868 |
if (opaque == true) |
|
3869 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
|
3870 |
else |
|
3871 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
|
3872 |
LEAVE_XLIB(); |
|
3873 |
RETURN ( self ); |
|
3874 |
} |
|
3875 |
||
3876 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
3877 |
cp += nInstBytes; |
|
3878 |
||
3879 |
if (__isBytes(aString)) { |
|
3880 |
n = __byteArraySize(aString) - nInstBytes - 1; |
|
3881 |
||
3882 |
if (n > lMax) n = lMax; |
|
3883 |
ENTER_XLIB(); |
|
3884 |
if (opaque == true) |
|
3885 |
XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
|
3886 |
else |
|
3887 |
XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n); |
|
3888 |
LEAVE_XLIB(); |
|
3889 |
RETURN ( self ); |
|
3890 |
} |
|
3891 |
||
3892 |
/* TWOBYTESTRINGS */ |
|
3893 |
if (__isWords(aString)) { |
|
3894 |
union { |
|
3895 |
char b[2]; |
|
3896 |
unsigned short s; |
|
3897 |
} u; |
|
3898 |
int i; |
|
3899 |
XChar2b *cp2; |
|
3900 |
int mustFree = 0; |
|
3901 |
||
3902 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
3903 |
if (n > lMax) n = lMax; |
|
3990 | 3904 |
|
4029 | 3905 |
#if defined(MSBFIRST) || defined(__MSBFIRST) |
3906 |
/* |
|
3907 |
* chars already in correct order |
|
3908 |
*/ |
|
3909 |
#else |
|
3910 |
# if ! (defined(LSBFIRST) || defined(__LSBFIRST)) |
|
4082 | 3911 |
/* |
3912 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
3913 |
* X expects them MSB first |
|
3914 |
* convert as required |
|
3915 |
*/ |
|
3916 |
u.s = 0x1234; |
|
4245 | 3917 |
if (u.b[0] != 0x12) |
4029 | 3918 |
# endif |
3919 |
{ |
|
4082 | 3920 |
if (n <= NLOCALBUFFER) { |
3921 |
cp2 = xlatebuffer; |
|
3922 |
} else { |
|
3923 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
3924 |
mustFree = 1; |
|
3925 |
} |
|
3926 |
||
3927 |
for (i=0; i<n; i++) { |
|
3928 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
3929 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
3930 |
} |
|
3931 |
cp = (char *) cp2; |
|
3932 |
} |
|
4029 | 3933 |
#endif |
4082 | 3934 |
ENTER_XLIB(); |
3935 |
if (opaque == true) |
|
3936 |
XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
3937 |
else |
|
3938 |
XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n); |
|
3939 |
LEAVE_XLIB(); |
|
3940 |
||
3941 |
||
3942 |
if (mustFree) { |
|
3943 |
free(cp2); |
|
3944 |
} |
|
3945 |
||
3946 |
RETURN ( self ); |
|
3947 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
3948 |
} |
461
4a4b1384ab76
X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents:
459
diff
changeset
|
3949 |
#undef NLOCALBUFFER |
295 | 3950 |
%}. |
4245 | 3951 |
^ super displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque |
295 | 3952 |
! |
3953 |
||
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3954 |
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding |
4245 | 3955 |
width:imageWidth height:imageHeight |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3956 |
x:srcx y:srcy |
4245 | 3957 |
into:aDrawableId |
3958 |
x:dstx y:dsty |
|
3959 |
width:w height:h |
|
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3960 |
with:aGCId |
295 | 3961 |
|
3962 |
"draw a bitImage which has depth id, width iw and height ih into |
|
3963 |
the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty. |
|
3964 |
Individual source pixels have bitsPerPixel bits, allowing to draw |
|
3965 |
depth and pixel-units to be different. |
|
3966 |
It has to be checked elsewhere, that the server can do it with the given |
|
3967 |
depth - otherwise, primitive failure will be signalled. |
|
3968 |
Also it is assumed, that the colormap is setup correctly and the |
|
3969 |
colors are allocated - otherwise the colors may be wrong." |
|
3970 |
||
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3971 |
|fmt padding bits wantedPadding| |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3972 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3973 |
padding := givenPadding. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3974 |
bits := givenBits. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3975 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3976 |
"/ 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
|
3977 |
"/ 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
|
3978 |
"/ 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
|
3979 |
"/ care for that. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3980 |
|
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3981 |
((imageDepth == 4) and:[depth == 4]) ifTrue:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3982 |
fmt := self supportedImageFormatForDepth:4. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3983 |
fmt isNil ifTrue:[ |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3984 |
self primitiveFailed. "/ cannot represent this image |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3985 |
^ nil |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3986 |
]. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3987 |
wantedPadding := fmt at:#padding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3988 |
wantedPadding > givenPadding ifTrue:[ |
4245 | 3989 |
bits := self |
3990 |
repadBits:givenBits |
|
3991 |
width:imageWidth |
|
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3992 |
height:imageHeight |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3993 |
depth:imageDepth |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3994 |
from:givenPadding |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3995 |
to:wantedPadding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3996 |
padding := wantedPadding. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
3997 |
] |
2537
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3998 |
]. |
b8bb3e221b8b
repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents:
2531
diff
changeset
|
3999 |
|
295 | 4000 |
" |
4001 |
sorry; I had to separate it into 2 methods, since XPutImage needs |
|
4002 |
an unlimited stack, and thus cannot send primitiveFailed |
|
4003 |
" |
|
4245 | 4004 |
(self |
4005 |
primDrawBits:bits |
|
4006 |
bitsPerPixel:bitsPerPixel |
|
4007 |
depth:imageDepth |
|
4008 |
msb:true |
|
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
4009 |
padding:padding |
4245 | 4010 |
width:imageWidth height:imageHeight |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
4011 |
x:srcx y:srcy |
4245 | 4012 |
into:aDrawableId |
4013 |
x:dstx y:dsty |
|
4014 |
width:w height:h |
|
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
4015 |
with:aGCId) |
295 | 4016 |
ifFalse:[ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
4017 |
" |
4245 | 4018 |
also happens, if a segmentation violation occurs in the |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
4019 |
XPutImage ... |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
4020 |
" |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4021 |
self primitiveFailedOrClosedConnection |
295 | 4022 |
]. |
4023 |
! |
|
4024 |
||
652
30a701619098
fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents:
613
diff
changeset
|
4025 |
fillArcX:x y:y width:width height:height from:startAngle angle:angle |
1344 | 4026 |
in:aDrawableId with:aGCId |
90 | 4027 |
"fill an arc. If any coordinate is not integer, an error is triggered. |
4028 |
The angles may be floats or integer - they are given in degrees." |
|
0 | 4029 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4030 |
<context: #return> |
4245 | 4031 |
%{ |
0 | 4032 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
4033 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
4034 |
Window win; |
0 | 4035 |
int w, h, angle1, angle2; |
4036 |
double f; |
|
4037 |
||
97 | 4038 |
if (__isSmallInteger(startAngle)) |
1344 | 4039 |
angle1 = __intVal(startAngle) * 64; |
36 | 4040 |
else if (__isFloat(startAngle)) { |
1344 | 4041 |
f = __floatVal(startAngle); |
4042 |
angle1 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
4043 |
} else if (__isShortFloat(startAngle)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4044 |
f = __shortFloatVal(startAngle); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4045 |
angle1 = f * 64; |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4046 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4047 |
|
97 | 4048 |
if (__isSmallInteger(angle)) |
1344 | 4049 |
angle2 = __intVal(angle) * 64; |
36 | 4050 |
else if (__isFloat(angle)) { |
1344 | 4051 |
f = __floatVal(angle); |
4052 |
angle2 = f * 64; |
|
2268
1a774fc02c83
fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents:
2267
diff
changeset
|
4053 |
} else if (__isShortFloat(angle)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4054 |
f = __shortFloatVal(angle); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4055 |
angle2 = f * 64; |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4056 |
} else goto bad; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4057 |
|
1209 | 4058 |
if (ISCONNECTED |
4059 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4060 |
&& __isExternalAddress(aDrawableId) |
97 | 4061 |
&& __bothSmallInteger(x, y) |
4062 |
&& __bothSmallInteger(width, height)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4063 |
gc = __GCVal(aGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4064 |
win = __WindowVal(aDrawableId); |
1344 | 4065 |
w = __intVal(width); |
4066 |
h = __intVal(height); |
|
4067 |
/* |
|
4068 |
* need this check here: some servers simply dump core with bad args |
|
4069 |
*/ |
|
4070 |
if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) { |
|
1974 | 4071 |
ENTER_XLIB(); |
1344 | 4072 |
XFillArc(myDpy, win, gc, __intVal(x), __intVal(y), |
4073 |
w, h, angle1, angle2); |
|
1974 | 4074 |
LEAVE_XLIB(); |
1344 | 4075 |
} |
4076 |
RETURN ( self ); |
|
0 | 4077 |
} |
2267
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4078 |
bad: ; |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4079 |
%}. |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4080 |
"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
|
4081 |
or non float angle(s)" |
f6fbc3e71521
care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents:
2231
diff
changeset
|
4082 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4083 |
self primitiveFailedOrClosedConnection |
0 | 4084 |
! |
4085 |
||
4086 |
fillPolygon:aPolygon in:aDrawableId with:aGCId |
|
4245 | 4087 |
"fill a polygon given by its points. |
118 | 4088 |
If any coordinate is not integer, an error is triggered." |
73 | 4089 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4090 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4091 |
|
73 | 4092 |
|numberOfPoints| |
0 | 4093 |
|
4094 |
numberOfPoints := aPolygon size. |
|
4095 |
%{ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
4096 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
4097 |
Window win; |
73 | 4098 |
OBJ point, x, y; |
4099 |
int i, num; |
|
4100 |
XPoint *points; |
|
4101 |
XPoint qPoints[100]; |
|
377 | 4102 |
int mustFree = 0; |
73 | 4103 |
|
1209 | 4104 |
if (ISCONNECTED |
4105 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4106 |
&& __isExternalAddress(aDrawableId) |
97 | 4107 |
&& __isSmallInteger(numberOfPoints)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4108 |
gc = __GCVal(aGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4109 |
win = __WindowVal(aDrawableId); |
1344 | 4110 |
num = __intVal(numberOfPoints); |
4111 |
if (num < 3) { |
|
4112 |
RETURN ( self ); |
|
4113 |
} |
|
4114 |
/* |
|
4115 |
* avoid (slow) malloc, if not many points |
|
4116 |
*/ |
|
4117 |
if (num > 100) { |
|
4118 |
points = (XPoint *) malloc(sizeof(XPoint) * num); |
|
4119 |
if (! points) goto fail; |
|
4120 |
mustFree = 1; |
|
4121 |
} else |
|
4122 |
points = qPoints; |
|
4123 |
for (i=0; i<num; i++) { |
|
4124 |
point = __AT_(aPolygon, __MKSMALLINT(i+1)); |
|
4125 |
if (! __isPoint(point)) goto fail; |
|
4126 |
x = _point_X(point); |
|
4127 |
y = _point_Y(point); |
|
4128 |
if (! __bothSmallInteger(x, y)) |
|
4129 |
goto fail; |
|
4130 |
points[i].x = __intVal(x); |
|
4131 |
points[i].y = __intVal(y); |
|
4132 |
} |
|
1974 | 4133 |
ENTER_XLIB(); |
1344 | 4134 |
XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin); |
1974 | 4135 |
LEAVE_XLIB(); |
1344 | 4136 |
if (mustFree) |
4137 |
free(points); |
|
4138 |
RETURN ( self ); |
|
377 | 4139 |
|
0 | 4140 |
fail: ; |
1344 | 4141 |
if (mustFree) |
4142 |
free(points); |
|
0 | 4143 |
} |
73 | 4144 |
%}. |
4145 |
"badGC, badDrawable or coordinates not integer" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4146 |
self primitiveFailedOrClosedConnection |
0 | 4147 |
! |
4148 |
||
295 | 4149 |
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId |
4150 |
"fill a rectangle. If any coordinate is not integer, an error is triggered." |
|
4151 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4152 |
<context: #return> |
4245 | 4153 |
%{ |
295 | 4154 |
|
4155 |
int w, h; |
|
4156 |
||
1209 | 4157 |
if (ISCONNECTED |
4158 |
&& __isExternalAddress(aGCId) |
|
295 | 4159 |
&& __isExternalAddress(aDrawableId) |
4160 |
&& __bothSmallInteger(x, y) |
|
4161 |
&& __bothSmallInteger(width, height)) { |
|
1344 | 4162 |
w = __intVal(width); |
4163 |
h = __intVal(height); |
|
4164 |
/* |
|
4165 |
* need this check here: some servers simply dump core with bad args |
|
4166 |
*/ |
|
4167 |
if ((w >= 0) && (h >= 0)) { |
|
1974 | 4168 |
ENTER_XLIB(); |
1344 | 4169 |
XFillRectangle(myDpy, |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4170 |
__DrawableVal(aDrawableId), __GCVal(aGCId), |
1344 | 4171 |
__intVal(x), __intVal(y), w, h); |
1974 | 4172 |
LEAVE_XLIB(); |
1344 | 4173 |
} |
4174 |
RETURN ( self ); |
|
295 | 4175 |
} |
4176 |
%}. |
|
4177 |
"badGC, badDrawable or coordinates not integer" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4178 |
self primitiveFailedOrClosedConnection |
43 | 4179 |
! |
4180 |
||
3609 | 4181 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding |
3693 | 4182 |
extent:imageExtent sourceOrigin:srcOrg |
4245 | 4183 |
into:aDrawableId |
4184 |
destinationOrigin:dstOrg extent:dstExtent |
|
3693 | 4185 |
with:aGCId |
3609 | 4186 |
|
4187 |
<context: #return> |
|
4188 |
||
4189 |
|imageWidth imageHeight rm gm bm srcx srcy dstx dsty w h| |
|
4190 |
||
4191 |
imageWidth := imageExtent x. |
|
4192 |
imageHeight := imageExtent y. |
|
4193 |
rm := maskArray at:1. |
|
4194 |
gm := maskArray at:2. |
|
4195 |
bm := maskArray at:3. |
|
4196 |
srcx := srcOrg x. |
|
4197 |
srcy := srcOrg y. |
|
4198 |
dstx := dstOrg x. |
|
4199 |
dsty := dstOrg y. |
|
4200 |
w := dstExtent x. |
|
4201 |
h := dstExtent y. |
|
4202 |
||
4245 | 4203 |
"since XPutImage may allocate huge amount of stack space |
3609 | 4204 |
(some implementations use alloca), this must run with unlimited stack." |
4205 |
||
4206 |
%{ /* UNLIMITEDSTACK */ |
|
4207 |
||
4208 |
/* |
|
4209 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
4210 |
* XPutImage |
|
4211 |
*/ |
|
4212 |
GC gc; |
|
4213 |
Window win; |
|
4214 |
XImage image; |
|
4215 |
int imgWdth; |
|
4216 |
||
4217 |
if (ISCONNECTED |
|
4218 |
&& __isExternalAddress(aGCId) |
|
4219 |
&& __isExternalAddress(aDrawableId) |
|
4220 |
&& __bothSmallInteger(srcx, srcy) |
|
4221 |
&& __bothSmallInteger(dstx, dsty) |
|
4222 |
&& __bothSmallInteger(w, h) |
|
4223 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
4224 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
4225 |
&& __isSmallInteger(bitPadding) |
|
4226 |
&& __bothSmallInteger(rm, gm) |
|
4227 |
&& __isSmallInteger(bm) |
|
4228 |
&& __isByteArray(imageBits)) { |
|
3693 | 4229 |
Display *dpy = myDpy; |
4230 |
int pad = __intVal(bitPadding); |
|
4231 |
||
4232 |
gc = __GCVal(aGCId); |
|
4233 |
win = __WindowVal(aDrawableId); |
|
4245 | 4234 |
if (! gc || !win) |
3693 | 4235 |
goto fail; |
3609 | 4236 |
#ifdef ARGDEBUG |
3693 | 4237 |
printf("args ok\n"); |
4238 |
#endif |
|
4239 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
|
4240 |
image.width = imgWdth = __intVal(imageWidth); |
|
4241 |
image.height = __intVal(imageHeight); |
|
4242 |
image.xoffset = 0; |
|
4243 |
image.format = ZPixmap; |
|
4244 |
image.byte_order = (msb == true) ? MSBFirst : LSBFirst; |
|
4245 |
image.bitmap_unit = 8; |
|
4246 |
image.bitmap_bit_order = MSBFirst; |
|
4247 |
image.bitmap_pad = pad; |
|
4248 |
image.depth = __intVal(imageDepth); |
|
4249 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
|
4250 |
image.red_mask = __intVal(rm); |
|
4251 |
image.green_mask = __intVal(gm); |
|
4252 |
image.blue_mask = __intVal(bm); |
|
4253 |
||
4254 |
image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8; |
|
4255 |
||
4256 |
switch (image.bits_per_pixel) { |
|
4257 |
case 1: |
|
4258 |
case 2: |
|
4259 |
case 4: |
|
4260 |
case 8: |
|
4261 |
case 16: |
|
4262 |
case 24: |
|
4263 |
case 32: |
|
4264 |
break; |
|
4265 |
||
4266 |
default: |
|
3609 | 4267 |
#ifdef ARGDEBUG |
3693 | 4268 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
4269 |
#endif |
|
4270 |
goto fail; |
|
4271 |
} |
|
4272 |
||
4273 |
/* ENTER_XLIB(); */ |
|
4274 |
XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy), |
|
4275 |
__intVal(dstx), __intVal(dsty), |
|
4276 |
__intVal(w), __intVal(h)); |
|
4277 |
/* LEAVE_XLIB(); */ |
|
4278 |
||
4279 |
RETURN ( true ); |
|
3609 | 4280 |
} |
4281 |
#ifdef ARGDEBUG |
|
4282 |
if (!! __isExternalAddress(aGCId)) printf("GC\n"); |
|
4283 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
|
4284 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
|
4285 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
4286 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
4287 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
4288 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
4289 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
4290 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
4291 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
4292 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
4293 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
4294 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
4295 |
#endif |
|
4296 |
||
4297 |
fail: ; |
|
4298 |
%} |
|
4299 |
. |
|
4300 |
^ false |
|
4301 |
! |
|
4302 |
||
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4303 |
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding |
4245 | 4304 |
width:imageWidth height:imageHeight |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4305 |
x:srcx y:srcy |
4245 | 4306 |
into:aDrawableId |
4307 |
x:dstx y:dsty |
|
4308 |
width:w height:h |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4309 |
with:aGCId |
0 | 4310 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4311 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4312 |
|
4245 | 4313 |
"since XPutImage may allocate huge amount of stack space |
132 | 4314 |
(some implementations use alloca), this must run with unlimited stack." |
4315 |
||
12 | 4316 |
%{ /* UNLIMITEDSTACK */ |
0 | 4317 |
|
43 | 4318 |
/* |
4319 |
* need unlimited stack, since some Xlibs do a huge alloca in |
|
4320 |
* XPutImage |
|
4321 |
*/ |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
4322 |
GC gc; |
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
4323 |
Window win; |
43 | 4324 |
XImage image; |
377 | 4325 |
int imgWdth; |
43 | 4326 |
|
1209 | 4327 |
if (ISCONNECTED |
4328 |
&& __isExternalAddress(aGCId) |
|
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4329 |
&& __isExternalAddress(aDrawableId) |
97 | 4330 |
&& __bothSmallInteger(srcx, srcy) |
4331 |
&& __bothSmallInteger(dstx, dsty) |
|
4332 |
&& __bothSmallInteger(w, h) |
|
4333 |
&& __bothSmallInteger(imageWidth, imageHeight) |
|
4334 |
&& __bothSmallInteger(imageDepth, bitsPerPixel) |
|
1995
1ff668145d23
allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents:
1990
diff
changeset
|
4335 |
&& __isSmallInteger(bitPadding) |
43 | 4336 |
&& __isByteArray(imageBits)) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4337 |
Display *dpy = myDpy; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4338 |
int pad = __intVal(bitPadding); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4339 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4340 |
gc = __GCVal(aGCId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4341 |
win = __WindowVal(aDrawableId); |
4245 | 4342 |
if (! gc || !win) |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4343 |
goto fail; |
46 | 4344 |
#ifdef ARGDEBUG |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4345 |
printf("args ok\n"); |
46 | 4346 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4347 |
image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4348 |
image.width = imgWdth = __intVal(imageWidth); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4349 |
image.height = __intVal(imageHeight); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4350 |
image.xoffset = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4351 |
image.format = ZPixmap; |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4352 |
image.byte_order = (msb == true) ? MSBFirst : LSBFirst; |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4353 |
image.bitmap_unit = 8; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4354 |
image.bitmap_bit_order = MSBFirst; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4355 |
image.bitmap_pad = pad; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4356 |
image.depth = __intVal(imageDepth); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4357 |
image.bits_per_pixel = __intVal(bitsPerPixel); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4358 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4359 |
/* |
2021 | 4360 |
image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8; |
4361 |
*/ |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4362 |
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
|
4363 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4364 |
switch (image.bits_per_pixel) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4365 |
case 1: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4366 |
case 2: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4367 |
case 4: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4368 |
case 8: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4369 |
case 16: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4370 |
case 24: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4371 |
case 32: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4372 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4373 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4374 |
default: |
46 | 4375 |
#ifdef ARGDEBUG |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4376 |
printf("bits_per_pixel=%d\n",image.bits_per_pixel); |
46 | 4377 |
#endif |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4378 |
goto fail; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4379 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4380 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4381 |
image.red_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4382 |
image.green_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4383 |
image.blue_mask = 0xFFFF; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4384 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4385 |
/* ENTER_XLIB(); */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4386 |
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
|
4387 |
__intVal(dstx), __intVal(dsty), |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4388 |
__intVal(w), __intVal(h)); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4389 |
/* LEAVE_XLIB(); */ |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4390 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
4391 |
RETURN ( true ); |
43 | 4392 |
} |
46 | 4393 |
#ifdef ARGDEBUG |
206
4284b80bebdf
changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents:
202
diff
changeset
|
4394 |
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
|
4395 |
if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n"); |
193 | 4396 |
if (!! __isSmallInteger(srcx)) printf("srcx\n"); |
4397 |
if (!! __isSmallInteger(srcy)) printf("srcy\n"); |
|
4398 |
if (!! __isSmallInteger(dstx)) printf("dstx\n"); |
|
4399 |
if (!! __isSmallInteger(dsty)) printf("dsty\n"); |
|
4400 |
if (!! __isSmallInteger(w)) printf("w\n"); |
|
4401 |
if (!! __isSmallInteger(h)) printf("h\n"); |
|
4402 |
if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n"); |
|
4403 |
if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n"); |
|
4404 |
if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n"); |
|
4405 |
if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n"); |
|
4406 |
if (!! __isByteArray(imageBits)) printf("imageBits\n"); |
|
46 | 4407 |
#endif |
4408 |
||
0 | 4409 |
fail: ; |
4410 |
%} |
|
4411 |
. |
|
12 | 4412 |
^ false |
0 | 4413 |
! ! |
4414 |
||
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4415 |
!XWorkstation methodsFor:'event forwarding'! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4416 |
|
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4417 |
buttonMotion:view state:state x:x y:y rootX:rX rootY:rY time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4418 |
"forward a buttonMotion event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4419 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4420 |
self buttonMotion:state x:x y:y view:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4421 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4422 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4423 |
buttonPress:view button:button state:state x:x y:y rootX:rX rootY:rY time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4424 |
"forward a buttonPress event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4425 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4426 |
|logicalButton nextMultiClickTime| |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4427 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4428 |
altDown := state bitTest:altModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4429 |
metaDown := state bitTest:metaModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4430 |
shiftDown := state bitTest:(self shiftModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4431 |
ctrlDown := state bitTest:(self ctrlModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4432 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4433 |
eventRootX := rX. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4434 |
eventRootY := rY. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4435 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4436 |
"/ physical to logical button translation |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4437 |
logicalButton := buttonTranslation at:button ifAbsent:button. |
3245 | 4438 |
|
3332 | 4439 |
"/ special for mouse-wheel implementation |
3312
21eca9090ee2
mouseWheel support for hp (and maybe others)
Claus Gittinger <cg@exept.de>
parents:
3305
diff
changeset
|
4440 |
(logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[ |
3329 | 4441 |
self mouseWheelMotion:state x:x y:y amount:(logicalButton == #wheelFwd ifTrue:[10] ifFalse:[-10]) deltaTime:10 view:view. |
4442 |
^ self. |
|
4443 |
]. |
|
4444 |
||
4445 |
logicalButton isInteger ifTrue:[ |
|
3424 | 4446 |
buttonsPressed := buttonsPressed bitOr:(1 bitShift:logicalButton-1). |
3329 | 4447 |
]. |
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4448 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4449 |
multiClickTimeDelta notNil ifTrue:[ |
3424 | 4450 |
nextMultiClickTime := time + multiClickTimeDelta. |
4451 |
multiClickTime notNil ifTrue:[ |
|
4452 |
time < multiClickTime ifTrue:[ |
|
4453 |
multiClickTime := nextMultiClickTime. |
|
4454 |
self buttonMultiPress:logicalButton x:x y:y view:view. |
|
4455 |
^ self. |
|
4456 |
] |
|
4457 |
]. |
|
4458 |
multiClickTime := nextMultiClickTime. |
|
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4459 |
]. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4460 |
|
3329 | 4461 |
view isNil ifTrue:[ |
3424 | 4462 |
"/ event arrived, after I destroyed it myself |
4463 |
^ self |
|
3329 | 4464 |
]. |
4465 |
logicalButton == 1 ifTrue:[ |
|
3424 | 4466 |
activateOnClick == true ifTrue:[ |
4467 |
"/ dont raise above an active popup view. |
|
4468 |
(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
|
4469 |
view topView raise. |
|
4470 |
] |
|
4471 |
]. |
|
3329 | 4472 |
]. |
3330 | 4473 |
super buttonPress:logicalButton x:x y:y view:view |
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4474 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4475 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4476 |
buttonRelease:view button:button state:state x:x y:y rootX:rX rootY:rY time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4477 |
"forward a buttonPress event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4478 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4479 |
|logicalButton| |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4480 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4481 |
altDown := state bitTest:altModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4482 |
metaDown := state bitTest:metaModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4483 |
shiftDown := state bitTest:(self shiftModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4484 |
ctrlDown := state bitTest:(self ctrlModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4485 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4486 |
eventRootX := rX. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4487 |
eventRootY := rY. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4488 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4489 |
"/ physical to logical button translation |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4490 |
logicalButton := buttonTranslation at:button ifAbsent:button. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4491 |
|
3322
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4492 |
"/ special for HPs mouse-wheel implementation |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4493 |
(logicalButton == #wheelFwd or:[logicalButton == #wheelBwd]) ifTrue:[ |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4494 |
^ self |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4495 |
]. |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
4496 |
|
3329 | 4497 |
logicalButton isInteger ifTrue:[ |
3424 | 4498 |
buttonsPressed := buttonsPressed bitClear:(1 bitShift:logicalButton-1). |
3329 | 4499 |
]. |
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4500 |
self buttonRelease:logicalButton x:x y:y view:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4501 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4502 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4503 |
clientMessage:targetView type:typeAtom format:format data:data |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4504 |
|sensor| |
1543 | 4505 |
|
4506 |
"/ DND drag&drop protocol |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4507 |
typeAtom == (self atomIDOf:#DndProtocol) ifTrue:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4508 |
format == 32 ifTrue:[ |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4509 |
self dndMessage:nil data:data view:targetView. |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4510 |
^ self |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4511 |
] |
1543 | 4512 |
]. |
4513 |
||
4514 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4515 |
sensor clientMessage:typeAtom format:format eventData:data view:targetView |
1543 | 4516 |
] ifFalse:[ |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4517 |
" |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4518 |
not posted, if there is no sensor ... |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
4519 |
" |
1543 | 4520 |
] |
4521 |
||
4522 |
"Created: 4.4.1997 / 17:49:26 / cg" |
|
4523 |
"Modified: 4.4.1997 / 18:00:18 / cg" |
|
4524 |
! |
|
4525 |
||
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4526 |
configure:view x:x y:y width:w height:h above:above |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4527 |
"forward a size-change event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4528 |
|
3603
3665199a413f
#configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents:
3592
diff
changeset
|
4529 |
self configureX:x y:y width:w height:h view:view. |
3665199a413f
#configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents:
3592
diff
changeset
|
4530 |
above notNil ifTrue:[ |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4531 |
|aboveView| |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4532 |
aboveView := self viewFromId:above. |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4533 |
aboveView notNil ifTrue:[ |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4534 |
self coveredBy:aboveView view:view. |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
4535 |
]. |
3603
3665199a413f
#configue:... sends also #coveredBy:view:
Stefan Vogel <sv@exept.de>
parents:
3592
diff
changeset
|
4536 |
]. |
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4537 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4538 |
|
1543 | 4539 |
dndMessage:event data:data view:targetView |
4540 |
"handle a DND drag&drop protocol message" |
|
4541 |
||
1553 | 4542 |
|sensor dropType dropValue names i1 i2 t| |
1543 | 4543 |
|
4544 |
dropType := data doubleWordAt:1. |
|
4545 |
||
4546 |
"/ see def's in DragAndDropTypes.h |
|
1556 | 4547 |
dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd. |
1543 | 4548 |
|
4245 | 4549 |
self |
3920 | 4550 |
getProperty:(self atomIDOf:#DndSelection) |
4551 |
from:rootId |
|
4552 |
delete:false |
|
4553 |
into:[:type :value | |
|
4554 |
t := type. |
|
4555 |
dropValue := value |
|
4556 |
]. |
|
1543 | 4557 |
|
1558 | 4558 |
"/ preconvert into a collection |
4559 |
"/ of fileNames, string or byteArray |
|
4560 |
"/ Notice: we do not yet convert into dropObjects |
|
4561 |
"/ here, to allow arbitrary data to be handled by |
|
4562 |
"/ redefined dropMessage methods in applications. |
|
4563 |
"/ Conversion is done for some well known types |
|
4564 |
"/ in the default dropMessage handling of SimpleView. |
|
4565 |
||
1543 | 4566 |
dropType == #DndFiles ifTrue:[ |
3920 | 4567 |
"/ actually, a list of fileNames |
4568 |
t ~~ stringAtom ifTrue:[ |
|
4569 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
|
4570 |
^ self |
|
4571 |
]. |
|
4572 |
||
4573 |
names := OrderedCollection new. |
|
4574 |
i1 := 1. |
|
4575 |
[i1 ~~ 0] whileTrue:[ |
|
4576 |
i2 := dropValue indexOf:(Character value:0) startingAt:i1. |
|
4577 |
i2 ~~ 0 ifTrue:[ |
|
4578 |
names add:(dropValue copyFrom:i1 to:(i2-1)). |
|
4579 |
i1 := i2 + 1. |
|
4580 |
] ifFalse:[ |
|
4581 |
i1 := i2 |
|
4582 |
]. |
|
4583 |
]. |
|
4584 |
dropValue := names. |
|
4585 |
dropValue := dropValue collect:[:nm | nm asFilename]. |
|
4586 |
dropType := #files. |
|
1558 | 4587 |
] ifFalse:[ (dropType == #DndFile) ifTrue:[ |
3920 | 4588 |
t ~~ stringAtom ifTrue:[ |
4589 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
|
4590 |
^ self |
|
4591 |
]. |
|
4592 |
||
4593 |
dropValue := dropValue asFilename. |
|
4594 |
dropType := #file. |
|
1558 | 4595 |
] ifFalse:[ (dropType == #DndDir) ifTrue:[ |
3920 | 4596 |
t ~~ stringAtom ifTrue:[ |
4597 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
|
4598 |
^ self |
|
4599 |
]. |
|
4600 |
||
4601 |
dropValue := dropValue asFilename. |
|
4602 |
dropType := #directory. |
|
1558 | 4603 |
] ifFalse:[ (dropType == #DndText) ifTrue:[ |
3920 | 4604 |
t ~~ stringAtom ifTrue:[ |
4605 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
|
4606 |
^ self |
|
4607 |
]. |
|
4608 |
||
4609 |
dropValue := dropValue. |
|
4610 |
dropType := #text. |
|
1558 | 4611 |
] ifFalse:[ (dropType == #DndExe) ifTrue:[ |
3920 | 4612 |
t ~~ stringAtom ifTrue:[ |
4613 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
|
4614 |
^ self |
|
4615 |
]. |
|
4616 |
||
4617 |
dropValue := dropValue. |
|
4618 |
dropType := #executable. |
|
1558 | 4619 |
] ifFalse:[ (dropType == #DndLink) ifTrue:[ |
3920 | 4620 |
t ~~ stringAtom ifTrue:[ |
4621 |
'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR. |
|
4622 |
^ self |
|
4623 |
]. |
|
4624 |
||
4625 |
dropValue := dropValue. |
|
4626 |
dropType := #link. |
|
1558 | 4627 |
] ifFalse:[ (dropType == #DndRawData) ifTrue:[ |
3920 | 4628 |
dropValue := dropValue. |
4629 |
dropType := #rawData. |
|
1552 | 4630 |
] ifFalse:[ |
3920 | 4631 |
'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR. |
4245 | 4632 |
'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. |
3920 | 4633 |
|
4634 |
dropValue := dropValue. |
|
4635 |
dropType := #unknown. |
|
1558 | 4636 |
]]]]]]]. |
1543 | 4637 |
|
4638 |
(sensor := targetView sensor) notNil ifTrue:[ |
|
3920 | 4639 |
sensor dropMessage:dropType data:dropValue view:targetView |
1543 | 4640 |
] ifFalse:[ |
3920 | 4641 |
" |
4642 |
not posted, if there is no sensor ... |
|
4643 |
" |
|
1543 | 4644 |
] |
4645 |
||
4646 |
"Created: 4.4.1997 / 17:59:37 / cg" |
|
1558 | 4647 |
"Modified: 6.4.1997 / 14:50:44 / cg" |
1543 | 4648 |
! |
4649 |
||
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4650 |
expose:view x:x y:y width:w height:h count:count |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4651 |
"forward an expose event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4652 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4653 |
self exposeX:x y:y width:w height:h view:view. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4654 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4655 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4656 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4657 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4658 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4659 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4660 |
focusIn:view mode:mode detail:detail |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4661 |
"forward a key-press event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4662 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4663 |
self focusInView:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4664 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4665 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4666 |
focusOut:view mode:mode detail:detail |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4667 |
"forward a key-press event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4668 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4669 |
self focusOutView:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4670 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4671 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4672 |
graphicsExpose:view x:x y:y width:w height:h count:count |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4673 |
"forward a graphics-expose event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4674 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4675 |
self graphicsExposeX:x y:y width:w height:h final:(count==0) view:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4676 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4677 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4678 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4679 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4680 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4681 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4682 |
keyPress:view key:key code:keyCode state:state x:x y:y rootX:rX rootY:rY time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4683 |
"forward a key-press event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4684 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4685 |
altDown := state bitTest:altModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4686 |
metaDown := state bitTest:metaModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4687 |
shiftDown := state bitTest:(self shiftModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4688 |
ctrlDown := state bitTest:(self ctrlModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4689 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4690 |
key isNil ifTrue:[ |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4691 |
"/ happens sometimes on some systems |
4245 | 4692 |
"/ (alt-graph on sun has no keysym) |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4693 |
^ self |
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4694 |
]. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4695 |
eventRootX := rX. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4696 |
eventRootY := rY. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4697 |
self keyPress:key x:x y:y view:view. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4698 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4699 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4700 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4701 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4702 |
keyRelease:view key:key code:keyCode state:state x:x y:y rootX:rX rootY:rY time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4703 |
"forward a key-release event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4704 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4705 |
altDown := state bitTest:altModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4706 |
metaDown := state bitTest:metaModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4707 |
shiftDown := state bitTest:(self shiftModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4708 |
ctrlDown := state bitTest:(self ctrlModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4709 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4710 |
key isNil ifTrue:[ |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4711 |
"/ happens sometimes on some systems |
4245 | 4712 |
"/ (alt-graph on sun has no keysym) |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
4713 |
^ self |
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4714 |
]. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4715 |
eventRootX := rX. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4716 |
eventRootY := rY. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4717 |
self keyRelease:key x:x y:y view:view. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4718 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4719 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4720 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4721 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4722 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4723 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4724 |
mappingNotify:view request:what event:eB |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4725 |
"One of Keyboard-, Modifier- or PointerMap has changed, probably by xmodmap. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4726 |
Tell xlib about the fact." |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4727 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4728 |
(what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[ |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4729 |
self refreshKeyboardMapping:eB. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4730 |
"Maybe some of our modifiers have been changed" |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4731 |
self initializeModifierMappings. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4732 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4733 |
|
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4734 |
! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4735 |
|
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4736 |
pointerEnter:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4737 |
"forward a pointer enter event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4738 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4739 |
altDown := state bitTest:altModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4740 |
metaDown := state bitTest:metaModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4741 |
shiftDown := state bitTest:(self shiftModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4742 |
ctrlDown := state bitTest:(self ctrlModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4743 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4744 |
eventRootX := rX. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4745 |
eventRootY := rY. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4746 |
self pointerEnter:state x:x y:y view:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4747 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4748 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4749 |
pointerLeave:view x:x y:y rootX:rX rootY:rY state:state mode:mode detail:detail time:time |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4750 |
"forward a pointer leave event for some view" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4751 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4752 |
altDown := state bitTest:altModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4753 |
metaDown := state bitTest:metaModifierMask. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4754 |
shiftDown := state bitTest:(self shiftModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4755 |
ctrlDown := state bitTest:(self ctrlModifierMask). |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4756 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4757 |
eventRootX := rX. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4758 |
eventRootY := rY. |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4759 |
self pointerLeave:state view:view |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4760 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4761 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4762 |
propertyChange:aView atom:atom state:aSymbol time:time |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4763 |
"sent when an X property changes. |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4764 |
This is a very X-specific mechanism." |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4765 |
|
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
4766 |
aView isNil ifTrue:[ |
3920 | 4767 |
"/ event arrived, after I destroyed it myself |
4768 |
^ self |
|
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4769 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4770 |
"/ aView propertyChange:atom state:aSymbol. |
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4771 |
! |
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
4772 |
|
3238 | 4773 |
selectionClear:aView atom:selectionID time:time |
4774 |
"sent when another X-client has created a selection. |
|
4775 |
This is a very X-specific mechanism." |
|
4776 |
||
3758 | 4777 |
self setCopyBuffer:nil. |
4778 |
||
4779 |
SelectionHandlers notNil ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4780 |
SelectionHandlers do:[:eachHandler | |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4781 |
eachHandler selectionClear:selectionID |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4782 |
] |
3758 | 4783 |
]. |
3238 | 4784 |
|
4785 |
"/ noone is interested in that ... |
|
4786 |
"/ aView selectionClear:selectionID |
|
3758 | 4787 |
! |
4788 |
||
4789 |
selectionNotify:aView selection:selectionID target:targetID property:propertyID requestor:requestorID time:time |
|
3238 | 4790 |
"sent when the server returns an answer from a request for a selection. |
4791 |
This is a very X-specific mechanism." |
|
4792 |
||
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4793 |
|clipBoardContents| |
3238 | 4794 |
|
3985 | 4795 |
"/ Transcript show:'seletionNotify selID:'. |
4245 | 4796 |
"/ Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '. |
3985 | 4797 |
"/ Transcript show:' targetID:'. |
4798 |
"/ Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '. |
|
4799 |
"/ Transcript show:' propertyID:'. |
|
4800 |
"/ Transcript show:propertyID; show:' ('; show:(self atomName:propertyID); show:') '. |
|
4801 |
"/ Transcript showCR:''. |
|
4802 |
"/ Transcript endEntry. |
|
4803 |
||
3988 | 4804 |
clipBoardContents := self getProperty:propertyID type:targetID from:requestorID. |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4805 |
clipBoardContents notNil ifTrue:[ |
4082 | 4806 |
aView sensor pasteFromClipBoard:clipBoardContents view:aView |
1341
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4807 |
] |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4808 |
! |
026bdf39f4ea
pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents:
1339
diff
changeset
|
4809 |
|
3238 | 4810 |
selectionRequest:aView requestor:requestorID selection:selectionID target:targetID property:propertyID time:time |
4811 |
"sent by some other X-client to ask for the selection. |
|
4812 |
This is a very X-specific mechanism." |
|
4813 |
||
3790 | 4814 |
|selection targetIdOut| |
4815 |
||
4816 |
"/'Selection: ' print. (self atomName:selectionID) print. ' TargetId: ' print. (self atomName:targetID) print. |
|
4817 |
"/' Property: ' print. (self atomName:propertyID) print. ' Requestor: ' print. requestorID printCR. |
|
4818 |
||
4819 |
selection := self selectionAs:targetID. |
|
4820 |
selection isNil ifTrue:[ |
|
4821 |
"/ ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR. |
|
4822 |
||
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4823 |
"sending property None tells client, that i cannot convert" |
4245 | 4824 |
self |
4825 |
sendSelectionNotifySelection:selectionID |
|
4826 |
property:nil |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4827 |
target:targetID |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4828 |
time:time |
3790 | 4829 |
"/ from:aView id BAD: nobody understands this |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4830 |
from:requestorID |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4831 |
to:requestorID. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4832 |
^ self |
3790 | 4833 |
]. |
4834 |
"/'Send selection: ' print. selection printCR. |
|
4835 |
||
4836 |
targetIdOut := targetID. |
|
4837 |
selection isString ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4838 |
targetIdOut := self atomIDOf:#STRING. |
3790 | 4839 |
]. |
4840 |
||
4245 | 4841 |
self sendSelection:selection |
4842 |
selection:selectionID |
|
4843 |
property:propertyID |
|
4844 |
target:targetIdOut |
|
4845 |
time:time |
|
3790 | 4846 |
"/ from:aView id BAD: nobody understands this |
4245 | 4847 |
from:requestorID |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4848 |
to:requestorID. |
3238 | 4849 |
! |
4850 |
||
3232 | 4851 |
visibilityNotify:aView state:how |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4852 |
|
3232 | 4853 |
aView notNil ifTrue:[ |
3920 | 4854 |
aView visibilityChange:how |
3232 | 4855 |
] |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4856 |
! ! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4857 |
|
3886 | 4858 |
!XWorkstation methodsFor:'event forwarding-ignored events'! |
3856
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4859 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4860 |
circulateNotify:aView place:aSymbol |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4861 |
"sent, when the stacking order changes. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4862 |
ignored for now." |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4863 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4864 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4865 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4866 |
circulateRequest:aView place:aSymbol |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4867 |
"sent, when the stacking order is about to change. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4868 |
ignored for now." |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4869 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4870 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4871 |
colorMapNotify:aView state:aBoolean |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4872 |
"sent, when another colormap is installed. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4873 |
This is a very X-specific mechanism." |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4874 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4875 |
aView isNil ifTrue:[ |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4876 |
"/ event arrived, after I destroyed it myself |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4877 |
^ self |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4878 |
]. |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4879 |
"/ not yet implemented |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4880 |
"/ aView colorMapChange |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4881 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4882 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4883 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4884 |
configureRequest:view x:x y:y width:w height:h above:above detail:detail |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4885 |
"ignored for now" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4886 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4887 |
"/ view configureRequest |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4888 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4889 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4890 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4891 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4892 |
gravityNotify:aView x:x y:y |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4893 |
"ignored for now" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4894 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4895 |
"/ aView gravityNotify |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4896 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4897 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4898 |
keymapNotify:aView |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4899 |
"ignore for now" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4900 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4901 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4902 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4903 |
mapRequest:aView |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4904 |
"ignored for now" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4905 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4906 |
"/ aView mapRequest |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4907 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4908 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4909 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4910 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4911 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4912 |
reparentedView:aView |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4913 |
"ignored for now" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4914 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4915 |
"/ aView reparented |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4916 |
! |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4917 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4918 |
resizeRequest:aView width:width height:height |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4919 |
"ignored for now" |
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4920 |
|
45fccc92d834
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3814
diff
changeset
|
4921 |
"/ aView resizeRequest |
1338
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4922 |
! ! |
8df6dbb44883
no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents:
1295
diff
changeset
|
4923 |
|
86 | 4924 |
!XWorkstation methodsFor:'event handling'! |
0 | 4925 |
|
2977
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4926 |
defaultEventMask |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4927 |
"return a mask to enable some events by default." |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4928 |
|
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4929 |
%{ /* NOCONTEXT */ |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4930 |
RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask | |
3920 | 4931 |
KeyPressMask | KeyReleaseMask | |
4932 |
PointerMotionMask | |
|
4933 |
EnterWindowMask | LeaveWindowMask | |
|
4934 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask | |
|
4935 |
PropertyChangeMask )); |
|
2977
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4936 |
%} |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4937 |
! |
abdb7cf1635a
enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents:
2974
diff
changeset
|
4938 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4939 |
dispatchEvent:evArray |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
4940 |
|viewId view evType arguments| |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4941 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4942 |
viewId := evArray at:1. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4943 |
viewId notNil ifTrue:[ |
3806 | 4944 |
viewId = lastId ifTrue:[ |
4945 |
view := lastView |
|
4946 |
] ifFalse:[ |
|
4947 |
view := self viewFromId:viewId |
|
4948 |
]. |
|
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4949 |
]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4950 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4951 |
evType := evArray at:3. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4952 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4953 |
(self respondsTo:evType) ifTrue:[ |
3806 | 4954 |
arguments := evArray copyFrom:3 to:(3 + evType numArgs - 1). |
4955 |
arguments at:1 put:view. |
|
4956 |
||
4957 |
self perform:evType withArguments:arguments. |
|
4958 |
^ true. |
|
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4959 |
]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4960 |
'********** unhandled event:' errorPrintCR. |
3329 | 4961 |
evType errorPrintCR. (evArray at:2) errorPrintCR. |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4962 |
'********** see dispatchEvent' errorPrintCR. |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4963 |
^ false |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4964 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
4965 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4966 |
dispatchEventFor:aViewIdOrNil withMask:eventMask |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4967 |
"central event handling method: |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4968 |
get next event and send appropriate message to the sensor or view. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4969 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4970 |
otherwise only events for the view with given id are processed. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4971 |
If the argument aMask is nonNil, only events for this eventMask are |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4972 |
handled. |
4245 | 4973 |
WARNING: this may block to wait for an event - you better check for a |
3806 | 4974 |
pending event before calling this." |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4975 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4976 |
|eventArray| |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4977 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4978 |
eventArray := Array new:13. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4979 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4980 |
(self getEventFor:aViewIdOrNil withMask:eventMask into:eventArray) ifTrue:[ |
3806 | 4981 |
AbortSignal handle:[:ex | |
4982 |
ex return |
|
4983 |
] do:[ |
|
4984 |
self dispatchEvent:eventArray. |
|
4985 |
] |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4986 |
]. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4987 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4988 |
"Modified: 19.8.1997 / 17:10:42 / cg" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4989 |
! |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4990 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4991 |
dispatchExposeEventFor:aViewIdOrNil |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4992 |
"get next expose event and send appropriate message to the sensor or view. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4993 |
If the argument aViewIdOrNil is nil, events for any view are processed, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4994 |
otherwise only events for the view with given id are processed. |
4245 | 4995 |
WARNING: this may block to wait for an event - you better check for a |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4996 |
pending event before calling this." |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4997 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4998 |
self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
4999 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5000 |
"Modified: 19.8.1997 / 17:10:26 / cg" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5001 |
! |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5002 |
|
3647 | 5003 |
dispatchLoop |
5004 |
|flushBlock| |
|
5005 |
||
5006 |
flushBlock := [self flush]. |
|
5007 |
||
5008 |
Processor addPreWaitAction:flushBlock. |
|
5009 |
||
5010 |
[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5011 |
super dispatchLoop |
3778
77a339649f30
Remove preWaitACtion if dispatchLoop is finished.
Stefan Vogel <sv@exept.de>
parents:
3758
diff
changeset
|
5012 |
] ensure:[ |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5013 |
Processor removePreWaitAction:flushBlock. |
3647 | 5014 |
]. |
5015 |
! |
|
5016 |
||
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5017 |
dispatchPendingEvents |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5018 |
"central event handling method for modal operation. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5019 |
(i.e. this is now only used in the modal debugger) |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5020 |
Dispatch any pending events; return when no more are pending. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5021 |
This code is somewhat special, since X has a concept of graphic |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5022 |
expose events (which are sent after a bitblt). After such a bitblt, |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5023 |
we only handle exposes until the graphicsExpose arrives. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5024 |
Other systems may not need such a kludge" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5025 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5026 |
"interested in exposes only ?" |
3800 | 5027 |
|
5028 |
|eventArray| |
|
5029 |
||
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5030 |
dispatchingExpose notNil ifTrue:[ |
3806 | 5031 |
[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[ |
5032 |
self dispatchExposeEventFor:dispatchingExpose |
|
5033 |
]. |
|
5034 |
^ self |
|
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5035 |
]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5036 |
|
3800 | 5037 |
eventArray := Array new:13. |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5038 |
[self eventPendingWithSync:false] whileTrue:[ |
3806 | 5039 |
(self getEventFor:nil withMask:nil into:eventArray) ifTrue:[ |
5040 |
AbortSignal handle:[:ex | |
|
5041 |
ex return |
|
5042 |
] do:[ |
|
5043 |
self dispatchEvent:eventArray. |
|
5044 |
] |
|
5045 |
]. |
|
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5046 |
] |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5047 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5048 |
"Modified: 19.8.1997 / 17:11:18 / cg" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5049 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5050 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5051 |
disposeEventsWithMask:aMask for:aWindowIdOrNil |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5052 |
"dispose (throw away) specific events. If aWindowId is nil, |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5053 |
events matching the mask are thrown away regardless of which |
4245 | 5054 |
view they are for. Otherwise, only matching events for that |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5055 |
view are flushed." |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5056 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5057 |
<context: #return> |
3787
58b1a317d361
Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents:
3779
diff
changeset
|
5058 |
%{ /* UNLIMITEDSTACK */ |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5059 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5060 |
XEvent ev; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5061 |
Window win; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5062 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5063 |
if (ISCONNECTED |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5064 |
&& __isSmallInteger(aMask)) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5065 |
Display *dpy = myDpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5066 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5067 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5068 |
if (__isExternalAddress(aWindowIdOrNil)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5069 |
win = __WindowVal(aWindowIdOrNil); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5070 |
while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5071 |
} else { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5072 |
while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5073 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5074 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5075 |
RETURN ( self ); |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5076 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5077 |
%}. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5078 |
self primitiveFailedOrClosedConnection |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5079 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5080 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5081 |
eventMaskFor:anEventSymbol |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5082 |
"return the eventMask bit-constant corresponding to an event symbol" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5083 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5084 |
%{ /* NOCONTEXT */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5085 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5086 |
int m = 0; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5087 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5088 |
if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5089 |
else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5090 |
else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5091 |
else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5092 |
else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5093 |
else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5094 |
else if (anEventSymbol == @symbol(expose)) m = ExposureMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5095 |
else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5096 |
else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5097 |
else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5098 |
else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5099 |
else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5100 |
else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5101 |
else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5102 |
else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5103 |
else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5104 |
RETURN (__MKSMALLINT(m)); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5105 |
%} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5106 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5107 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5108 |
eventPending |
4245 | 5109 |
"return true, if any event is pending. |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5110 |
This looks for both the internal queue and the display connection." |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5111 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5112 |
"/ ConservativeSync is required for some Xlib implementation, |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5113 |
"/ where eventPending returns wrong if we do not flush the buffer. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5114 |
"/ (especially Win32 & Xlib) |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5115 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5116 |
ConservativeSync == true ifTrue:[self sync]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5117 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5118 |
dispatchingExpose notNil ifTrue:[ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5119 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5120 |
]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5121 |
^ self eventPendingWithSync:false |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5122 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5123 |
"Modified: / 28.4.1999 / 11:08:12 / cg" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5124 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5125 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5126 |
eventPending:anEventSymbol for:aWindowIdOrNil |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5127 |
"return true, if a specific event is pending" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5128 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5129 |
^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5130 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5131 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5132 |
eventPending:anEventMask for:aWindowIdOrNil withSync:doSync |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5133 |
"return true, if any of the masked events is pending" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5134 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5135 |
<context: #return> |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5136 |
%{ /* UNLIMITEDSTACK */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5137 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5138 |
XEvent ev; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5139 |
Window win; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5140 |
int thereIsOne; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5141 |
OBJ rslt = false; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5142 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5143 |
if (ISCONNECTED && __isSmallInteger(anEventMask)) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5144 |
Display *dpy = myDpy; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5145 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5146 |
ENTER_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5147 |
if (doSync == true) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5148 |
XSync(dpy, 0); /* make certain everything is flushed */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5149 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5150 |
if (__isExternalAddress(aWindowIdOrNil)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5151 |
win = __WindowVal(aWindowIdOrNil); |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5152 |
thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5153 |
} else { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5154 |
thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5155 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5156 |
if (thereIsOne) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5157 |
XPutBackEvent(dpy, &ev); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5158 |
rslt = true; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5159 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5160 |
LEAVE_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5161 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5162 |
RETURN ( rslt ); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5163 |
%} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5164 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5165 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5166 |
eventPendingWithSync:doSync |
4245 | 5167 |
"return true, if any event is pending. |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5168 |
If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed) |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5169 |
before checking." |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5170 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5171 |
<context: #return> |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5172 |
%{ /* UNLIMITEDSTACK */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5173 |
OBJ rslt = false; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5174 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5175 |
if (ISCONNECTED) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5176 |
Display *dpy = myDpy; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5177 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5178 |
if (XEventsQueued(dpy, QueuedAlready)) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5179 |
RETURN (true); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5180 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5181 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5182 |
ENTER_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5183 |
if (doSync == true) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5184 |
XSync(dpy, 0); /* make certain everything is flushed */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5185 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5186 |
if (XPending(dpy)) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5187 |
rslt = true; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5188 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5189 |
LEAVE_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5190 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5191 |
RETURN ( rslt ); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5192 |
%} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5193 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5194 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5195 |
eventQueued |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5196 |
"return true, if any event is queued" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5197 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5198 |
dispatchingExpose notNil ifTrue:[ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5199 |
^ self exposeEventPendingFor:dispatchingExpose withSync:false |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5200 |
]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5201 |
^ self eventQueuedAlready |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5202 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5203 |
"Created: 12.12.1995 / 21:43:00 / stefan" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5204 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5205 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5206 |
eventQueuedAlready |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5207 |
"return true, if any event is queued internally. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5208 |
(i.e. in X's internal event queue, which is both filled by explicit |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5209 |
nextEvent calls AND whenever drawing is done and events are pending on |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5210 |
the display connection)." |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5211 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5212 |
%{ /* UNLIMITEDSTACK */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5213 |
OBJ rslt = false; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5214 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5215 |
if (ISCONNECTED) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5216 |
/* ENTER ... LEAVE not needed; XEventsQueued will not block */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5217 |
/* ENTER_XLIB(); */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5218 |
if (XEventsQueued(myDpy, QueuedAlready)) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5219 |
rslt = true; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5220 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5221 |
/* LEAVE_XLIB(); */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5222 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5223 |
RETURN ( rslt ); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5224 |
%} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5225 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5226 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5227 |
exposeEventPendingFor:aWindowIdOrNil withSync:doSync |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5228 |
"return true, if any expose event is pending for a specific view, |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5229 |
or any view (if the arg is nil). |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5230 |
This is an X specific, only required after a scroll operation." |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5231 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5232 |
<context: #return> |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5233 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5234 |
%{ /* UNLIMITEDSTACK */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5235 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5236 |
XEvent ev; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5237 |
Window win; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5238 |
int thereIsOne; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5239 |
OBJ rslt = false; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5240 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5241 |
if (ISCONNECTED) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5242 |
Display *dpy = myDpy; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5243 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5244 |
ENTER_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5245 |
if (doSync == true) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5246 |
XSync(dpy, 0); /* make certain everything is flushed */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5247 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5248 |
if (__isExternalAddress(aWindowIdOrNil)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5249 |
win = __WindowVal(aWindowIdOrNil); |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5250 |
thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5251 |
} else { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5252 |
thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5253 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5254 |
if (thereIsOne) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5255 |
XPutBackEvent(dpy, &ev); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5256 |
rslt = true; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5257 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5258 |
LEAVE_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5259 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5260 |
RETURN ( rslt ); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5261 |
%} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5262 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5263 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5264 |
getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray |
4245 | 5265 |
"read next event if there is one and put events data into anEventArray. |
5266 |
If aViewIdOrNil is nil, events for any view are fetched; |
|
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5267 |
otherwise only events for that specific view will be fetched. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5268 |
Returns true, if there was an event, false otherwise. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5269 |
This method may block - so you better check for pending events |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5270 |
before calling for it. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5271 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5272 |
The event fields are placed them into anEventArray (must be at least size 13): |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5273 |
the fields are: |
4082 | 5274 |
1: windowID |
5275 |
2: eventType-ID |
|
5276 |
3: eventTypeSymbol |
|
5277 |
||
5278 |
4.. args |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5279 |
|
3948 | 5280 |
Sorry I had to split dispatch into this fetch method and a separate |
5281 |
handler method to allow UNLIMITEDSTACK here. |
|
4245 | 5282 |
(some Xlibs do a big alloca there which cannot be done in |
3948 | 5283 |
#dispatchEvent:, since it dispatches out into ST-methods). |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5284 |
" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5285 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5286 |
%{ /* UNLIMITEDSTACK */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5287 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5288 |
Display *dpy; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5289 |
Window win, wWanted; |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5290 |
int evMask, returnValue; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5291 |
XEvent ev; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5292 |
OBJ eB; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5293 |
KeySym keySym; |
4245 | 5294 |
unsigned char buffer[10]; |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5295 |
int i, nchars; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5296 |
char *keySymString; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5297 |
char keySymStringBuffer[32]; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5298 |
unsigned INT nextMultiClickTime; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5299 |
OBJ arg, sym, t, windowID; |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5300 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5301 |
if (! ISCONNECTED) { |
4082 | 5302 |
RETURN (false); |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5303 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5304 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5305 |
dpy = myDpy; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5306 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5307 |
ev.type = 0; |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5308 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5309 |
if (__isSmallInteger(eventMask)) { |
4082 | 5310 |
evMask = __intVal(eventMask); |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5311 |
} else { |
4082 | 5312 |
evMask = ~0; |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5313 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5314 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5315 |
if (__isExternalAddress(aViewIdOrNil)) { |
4082 | 5316 |
wWanted = __WindowVal(aViewIdOrNil); |
5317 |
returnValue = XCheckWindowEvent(dpy, wWanted, evMask, &ev); |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5318 |
} else { |
4082 | 5319 |
if (evMask == ~0) { |
5320 |
XNextEvent(dpy, &ev); |
|
5321 |
returnValue = 1; |
|
5322 |
} else { |
|
5323 |
returnValue = XCheckMaskEvent(dpy, evMask, &ev); |
|
5324 |
} |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5325 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5326 |
if (!returnValue) { |
4082 | 5327 |
/* there is no event */ |
5328 |
RETURN (false); |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5329 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5330 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5331 |
if (anEventArray == nil) { |
4082 | 5332 |
/* sender is not interested in the event */ |
5333 |
RETURN(true); |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5334 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5335 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5336 |
if (!__isArray(anEventArray)) { |
4082 | 5337 |
fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__); |
5338 |
RETURN (false); |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5339 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5340 |
if (__arraySize(anEventArray) < 11) { |
4082 | 5341 |
fprintf(stderr, "XWorkstation: bad argument [%d]\n", __LINE__); |
5342 |
RETURN (false); |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5343 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5344 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5345 |
# define ANYBUTTON (Button1MotionMask | Button2MotionMask | Button3MotionMask) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5346 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5347 |
# define ae ((XAnyEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5348 |
# define ee ((XExposeEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5349 |
# define ke ((XKeyPressedEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5350 |
# define be ((XButtonPressedEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5351 |
# define ce ((XConfigureEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5352 |
# define cr ((XConfigureRequestEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5353 |
# define me ((XMotionEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5354 |
# define ele ((XCrossingEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5355 |
# define de ((XDestroyWindowEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5356 |
# define ve ((XVisibilityEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5357 |
# define fe ((XFocusChangeEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5358 |
# define cre ((XCreateWindowEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5359 |
# define mape ((XMappingEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5360 |
# define gre ((XGravityEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5361 |
# define rr ((XResizeRequestEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5362 |
# define cie ((XCirculateEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5363 |
# define pe ((XPropertyEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5364 |
# define sce ((XSelectionClearEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5365 |
# define cme ((XColormapEvent *)&ev) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5366 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5367 |
if (((t = __INST(lastId)) != nil) |
4082 | 5368 |
&& __isExternalAddress(t) |
5369 |
&& (__WindowVal(t) == ae->window)) { |
|
5370 |
windowID = t; |
|
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5371 |
} else { |
4082 | 5372 |
windowID = __MKEXTERNALADDRESS(ae->window); |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5373 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5374 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5375 |
__ArrayInstPtr(anEventArray)->a_element[0] = windowID; __STORE(anEventArray, windowID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5376 |
__ArrayInstPtr(anEventArray)->a_element[1] = __MKSMALLINT(ev.type); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5377 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5378 |
switch (ev.type) { |
4082 | 5379 |
case KeyRelease: |
5380 |
sym = @symbol(keyRelease:key:code:state:x:y:rootX:rootY:time:); |
|
5381 |
goto keyPressAndRelease; |
|
5382 |
||
5383 |
case KeyPress: |
|
5384 |
sym = @symbol(keyPress:key:code:state:x:y:rootX:rootY:time:); |
|
5385 |
/* FALL INTO */ |
|
5386 |
||
5387 |
keyPressAndRelease: |
|
5388 |
arg = nil; |
|
5389 |
nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL); |
|
4245 | 5390 |
if (nchars |
4082 | 5391 |
&& (((buffer[0] >= ' ') && (buffer[0] <= '~')) |
5392 |
|| (buffer[0] >= 0x80))) { |
|
5393 |
arg = __MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */; |
|
5394 |
keySymString = NULL; |
|
5395 |
} else { |
|
5396 |
keySymString = XKeysymToString(keySym); |
|
5397 |
if (keySymString) { |
|
5398 |
arg = __MKSYMBOL(keySymString, 0); |
|
5399 |
} else { |
|
5400 |
arg = nil; |
|
5401 |
} |
|
5402 |
} |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5403 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5404 |
#ifdef IGNORE_UNKNOWN_KEYCODES |
4082 | 5405 |
if (arg == nil) { |
5406 |
/* happens sometimes (alt-graph on sun has no keysym) */ |
|
5407 |
RETURN (false); |
|
5408 |
} |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5409 |
#endif |
4082 | 5410 |
__ArrayInstPtr(anEventArray)->a_element[2] = sym; |
5411 |
||
5412 |
__ArrayInstPtr(anEventArray)->a_element[3] = arg; __STORE(anEventArray, arg); |
|
5413 |
__ArrayInstPtr(anEventArray)->a_element[4] = t = __MKUINT(ke->keycode); __STORE(anEventArray, t); |
|
5414 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ke->state); |
|
5415 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ke->x); |
|
5416 |
__ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ke->y); |
|
5417 |
__ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ke->x_root); |
|
5418 |
__ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ke->y_root); |
|
5419 |
__ArrayInstPtr(anEventArray)->a_element[10] = t = __MKUINT(ke->time); __STORE(anEventArray, t); |
|
5420 |
break; |
|
5421 |
||
5422 |
case ButtonPress: |
|
5423 |
sym = @symbol(buttonPress:button:state:x:y:rootX:rootY:time:); |
|
5424 |
goto buttonPressAndRelease; |
|
5425 |
||
5426 |
case ButtonRelease: |
|
5427 |
sym = @symbol(buttonRelease:button:state:x:y:rootX:rootY:time:); |
|
5428 |
/* fall into */ |
|
5429 |
||
5430 |
buttonPressAndRelease: |
|
5431 |
__ArrayInstPtr(anEventArray)->a_element[2] = sym; |
|
5432 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(be->button); |
|
5433 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ke->state); |
|
5434 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(be->x); |
|
5435 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(be->y); |
|
5436 |
__ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(be->x_root); |
|
5437 |
__ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(be->y_root); |
|
5438 |
__ArrayInstPtr(anEventArray)->a_element[9] = t = __MKUINT(be->time); __STORE(anEventArray, t); |
|
5439 |
break; |
|
5440 |
||
5441 |
case MotionNotify: |
|
5442 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(buttonMotion:state:x:y:rootX:rootY:time:); |
|
5443 |
||
5444 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(me->state); |
|
5445 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(me->x); |
|
5446 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(me->y); |
|
5447 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(me->x_root); |
|
5448 |
__ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(me->y_root); |
|
5449 |
__ArrayInstPtr(anEventArray)->a_element[8] = t = __MKUINT(me->time); __STORE(anEventArray, t); |
|
5450 |
break; |
|
5451 |
||
5452 |
case FocusIn: |
|
5453 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusIn:mode:detail:); |
|
5454 |
goto focusInOut; |
|
5455 |
||
5456 |
case FocusOut: |
|
5457 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(focusOut:mode:detail:); |
|
5458 |
/* fall into */ |
|
5459 |
||
5460 |
focusInOut: |
|
5461 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(fe->mode); |
|
5462 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(fe->detail); |
|
5463 |
break; |
|
5464 |
||
5465 |
case EnterNotify: |
|
5466 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerEnter:x:y:rootX:rootY:state:mode:detail:time:); |
|
5467 |
goto enterLeave; |
|
5468 |
||
5469 |
case LeaveNotify: |
|
5470 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(pointerLeave:x:y:rootX:rootY:state:mode:detail:time:); |
|
5471 |
/* fall into */ |
|
5472 |
||
5473 |
enterLeave: |
|
5474 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ele->x); |
|
5475 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ele->y); |
|
5476 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ele->x_root); |
|
5477 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ele->y_root); |
|
5478 |
__ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ele->state); |
|
5479 |
__ArrayInstPtr(anEventArray)->a_element[8] = __mkSmallInteger(ele->mode); |
|
5480 |
__ArrayInstPtr(anEventArray)->a_element[9] = __mkSmallInteger(ele->detail); |
|
5481 |
__ArrayInstPtr(anEventArray)->a_element[10] = t = __MKUINT(ele->time); __STORE(anEventArray, t); |
|
5482 |
break; |
|
5483 |
||
5484 |
case Expose: |
|
5485 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(expose:x:y:width:height:count:); |
|
5486 |
goto expose; |
|
5487 |
||
5488 |
case GraphicsExpose: |
|
5489 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(graphicsExpose:x:y:width:height:count:); |
|
5490 |
/* fall into */ |
|
5491 |
||
5492 |
expose: |
|
5493 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ee->x); |
|
5494 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ee->y); |
|
5495 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ee->width); |
|
5496 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ee->height); |
|
5497 |
__ArrayInstPtr(anEventArray)->a_element[7] = __mkSmallInteger(ee->count); |
|
5498 |
break; |
|
5499 |
||
5500 |
case NoExpose: |
|
5501 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(noExposeView:); |
|
5502 |
break; |
|
5503 |
||
5504 |
case VisibilityNotify: |
|
5505 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(visibilityNotify:state:); |
|
5506 |
switch (ve->state) { |
|
5507 |
case VisibilityUnobscured: |
|
5508 |
__ArrayInstPtr(anEventArray)->a_element[3] = @symbol(unobscured); |
|
5509 |
break; |
|
5510 |
case VisibilityPartiallyObscured: |
|
5511 |
__ArrayInstPtr(anEventArray)->a_element[3] = @symbol(partiallyObscured); |
|
5512 |
break; |
|
5513 |
case VisibilityFullyObscured: |
|
5514 |
__ArrayInstPtr(anEventArray)->a_element[3] = @symbol(fullyObscured); |
|
5515 |
break; |
|
5516 |
default: |
|
5517 |
__ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(ve->state); |
|
5518 |
break; |
|
5519 |
} |
|
5520 |
break; |
|
5521 |
||
5522 |
case CreateNotify: |
|
5523 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(createWindow:x:y:width:height:); |
|
5524 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cre->x); |
|
5525 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cre->y); |
|
5526 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cre->width); |
|
5527 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cre->height); |
|
5528 |
break; |
|
5529 |
||
5530 |
case DestroyNotify: |
|
5531 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(destroyedView:); |
|
5532 |
break; |
|
5533 |
||
5534 |
case UnmapNotify: |
|
5535 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unmappedView:); |
|
5536 |
break; |
|
5537 |
||
5538 |
case MapNotify: |
|
5539 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappedView:); |
|
5540 |
break; |
|
5541 |
||
5542 |
case ConfigureNotify: |
|
5543 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configure:x:y:width:height:above:); |
|
5544 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(ce->x); |
|
5545 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(ce->y); |
|
5546 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(ce->width); |
|
5547 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(ce->height); |
|
5548 |
__ArrayInstPtr(anEventArray)->a_element[7] = nil; |
|
5549 |
if (ce->above != None) { |
|
5550 |
__ArrayInstPtr(anEventArray)->a_element[7] = t = __MKEXTERNALADDRESS(ce->above); __STORE(anEventArray, t); |
|
5551 |
} |
|
5552 |
break; |
|
5553 |
||
5554 |
case GravityNotify: |
|
5555 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(gravityNotify:x:y:); |
|
5556 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(gre->x); |
|
5557 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(gre->y); |
|
5558 |
break; |
|
5559 |
||
5560 |
case ResizeRequest: |
|
5561 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(resizeRequest:width:height:); |
|
5562 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(rr->width); |
|
5563 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(rr->height); |
|
5564 |
break; |
|
5565 |
||
5566 |
case ConfigureRequest: |
|
5567 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(configureRequest:x:y:width:height:above:detail:); |
|
5568 |
__ArrayInstPtr(anEventArray)->a_element[3] = __mkSmallInteger(cr->x); |
|
5569 |
__ArrayInstPtr(anEventArray)->a_element[4] = __mkSmallInteger(cr->y); |
|
5570 |
__ArrayInstPtr(anEventArray)->a_element[5] = __mkSmallInteger(cr->width); |
|
5571 |
__ArrayInstPtr(anEventArray)->a_element[6] = __mkSmallInteger(cr->height); |
|
5572 |
__ArrayInstPtr(anEventArray)->a_element[7] = nil; |
|
5573 |
if (cr->above != None) { |
|
5574 |
__ArrayInstPtr(anEventArray)->a_element[7] = t = __MKEXTERNALADDRESS(cr->above); __STORE(anEventArray, t); |
|
5575 |
} |
|
5576 |
switch (cr->detail) { |
|
5577 |
case Above: |
|
5578 |
__ArrayInstPtr(anEventArray)->a_element[8] = @symbol(above); |
|
5579 |
break; |
|
5580 |
case Below: |
|
5581 |
__ArrayInstPtr(anEventArray)->a_element[8] = @symbol(below); |
|
5582 |
break; |
|
5583 |
case TopIf: |
|
5584 |
__ArrayInstPtr(anEventArray)->a_element[8] = @symbol(topIf); |
|
5585 |
break; |
|
5586 |
case BottomIf: |
|
5587 |
__ArrayInstPtr(anEventArray)->a_element[8] = @symbol(bottomIf); |
|
5588 |
break; |
|
5589 |
case Opposite: |
|
5590 |
__ArrayInstPtr(anEventArray)->a_element[8] = @symbol(opposite); |
|
5591 |
break; |
|
5592 |
default: |
|
5593 |
__ArrayInstPtr(anEventArray)->a_element[8] = __MKSMALLINT(cr->detail); |
|
5594 |
break; |
|
5595 |
} |
|
5596 |
break; |
|
5597 |
||
5598 |
case CirculateNotify: |
|
5599 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateNotify:place:); |
|
5600 |
goto circulate; |
|
5601 |
||
5602 |
case CirculateRequest: |
|
5603 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(circulateRequest:place:); |
|
5604 |
/* fall into */ |
|
5605 |
circulate: |
|
5606 |
switch (cie->place) { |
|
5607 |
case PlaceOnTop: |
|
5608 |
__ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnTop); |
|
5609 |
break; |
|
5610 |
case PlaceOnBottom: |
|
5611 |
__ArrayInstPtr(anEventArray)->a_element[3] = @symbol(placeOnBottom); |
|
5612 |
break; |
|
5613 |
default: |
|
5614 |
__ArrayInstPtr(anEventArray)->a_element[3] = __MKSMALLINT(cie->place); |
|
5615 |
break; |
|
5616 |
} |
|
5617 |
break; |
|
5618 |
||
5619 |
case PropertyNotify: |
|
5620 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(propertyChange:atom:state:time:); |
|
5621 |
__ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(pe->atom); |
|
5622 |
switch (pe->state) { |
|
5623 |
case PropertyNewValue: |
|
5624 |
__ArrayInstPtr(anEventArray)->a_element[4] = @symbol(newValue); |
|
5625 |
break; |
|
5626 |
case PropertyDelete: |
|
5627 |
__ArrayInstPtr(anEventArray)->a_element[4] = @symbol(deleted); |
|
5628 |
break; |
|
5629 |
default: |
|
5630 |
__ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(pe->state); |
|
5631 |
break; |
|
5632 |
} |
|
5633 |
__ArrayInstPtr(anEventArray)->a_element[5] = t = __MKUINT(pe->time); __STORE(anEventArray, t); |
|
5634 |
break; |
|
5635 |
||
5636 |
case SelectionClear: |
|
5637 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:atom:time:); |
|
4245 | 5638 |
__ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection); |
4082 | 5639 |
__ArrayInstPtr(anEventArray)->a_element[4] = t = __MKUINT(sce->time); __STORE(anEventArray, t); |
5640 |
break; |
|
5641 |
||
5642 |
case SelectionRequest: |
|
5643 |
/* |
|
5644 |
* someone wants the selection |
|
5645 |
*/ |
|
5646 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:); |
|
5647 |
__ArrayInstPtr(anEventArray)->a_element[3] = t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __STORE(anEventArray, t); |
|
4245 | 5648 |
__ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection); |
5649 |
__ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target); |
|
5650 |
__ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property); |
|
4082 | 5651 |
__ArrayInstPtr(anEventArray)->a_element[7] = t = __MKUINT(ev.xselectionrequest.time); __STORE(anEventArray, t); |
5652 |
break; |
|
5653 |
||
5654 |
case SelectionNotify: |
|
5655 |
/* |
|
5656 |
* returned selection value (answer from SelectionRequest) |
|
5657 |
*/ |
|
5658 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:); |
|
4245 | 5659 |
__ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection); |
5660 |
__ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target); |
|
5661 |
__ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property); |
|
4082 | 5662 |
__ArrayInstPtr(anEventArray)->a_element[6] = t = __MKEXTERNALADDRESS(ev.xselection.requestor); __STORE(anEventArray, t); |
5663 |
__ArrayInstPtr(anEventArray)->a_element[7] = t = __MKUINT(ev.xselection.time); __STORE(anEventArray, t); |
|
5664 |
break; |
|
5665 |
||
5666 |
case ColormapNotify: |
|
5667 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(colormapNotify:state:); |
|
5668 |
__ArrayInstPtr(anEventArray)->a_element[3] = cme->state == ColormapInstalled ? true : false; |
|
5669 |
break; |
|
5670 |
||
5671 |
case ClientMessage: |
|
5672 |
if (ev.xclient.message_type == (int) __AtomVal(__INST(protocolsAtom))) { |
|
5673 |
if ((ev.xclient.data.l[0] == (int) __AtomVal(__INST(quitAppAtom))) |
|
5674 |
|| (ev.xclient.data.l[0] == (int) __AtomVal(__INST(deleteWindowAtom)))) { |
|
5675 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(terminateView:); |
|
5676 |
break; |
|
5677 |
} |
|
5678 |
if (ev.xclient.data.l[0] == (int) __AtomVal(__INST(saveYourselfAtom))) { |
|
5679 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(saveAndTerminateView:); |
|
5680 |
break; |
|
5681 |
} |
|
5682 |
} |
|
5683 |
/* |
|
5684 |
* any other client message |
|
5685 |
*/ |
|
3948 | 5686 |
printf("clientMessage type:%d format:%d\n", ev.xclient.message_type, ev.xclient.format); |
4082 | 5687 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(clientMessage:type:format:data:); |
5688 |
__ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xclient.message_type); |
|
5689 |
__ArrayInstPtr(anEventArray)->a_element[4] = __MKSMALLINT(ev.xclient.format); |
|
5690 |
__ArrayInstPtr(anEventArray)->a_element[5] = t = __MKBYTEARRAY(ev.xclient.data, sizeof(ev.xclient.data)); __STORE(anEventArray, t); |
|
5691 |
break; |
|
5692 |
||
5693 |
case MappingNotify: |
|
5694 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mappingNotify:request:event:); |
|
5695 |
switch(mape->request) { |
|
5696 |
case MappingModifier: |
|
5697 |
arg = @symbol(mappingModifier); |
|
5698 |
break; |
|
5699 |
case MappingKeyboard: |
|
5700 |
arg = @symbol(mappingKeyboard); |
|
5701 |
break; |
|
5702 |
case MappingPointer: |
|
5703 |
arg = @symbol(mappingPointer); |
|
5704 |
break; |
|
5705 |
default: |
|
5706 |
arg = __MKSMALLINT(mape->request); |
|
5707 |
break; |
|
5708 |
} |
|
5709 |
__ArrayInstPtr(anEventArray)->a_element[3] = arg; |
|
5710 |
__ArrayInstPtr(anEventArray)->a_element[4] = t = __MKBYTEARRAY(&ev, sizeof(*mape)); |
|
5711 |
__STORE(anEventArray, t); |
|
5712 |
break; |
|
5713 |
||
5714 |
case KeymapNotify: |
|
5715 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(keymapNotify:); |
|
5716 |
break; |
|
5717 |
||
5718 |
case MapRequest: |
|
5719 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(mapRequest:); |
|
5720 |
break; |
|
5721 |
||
5722 |
case ReparentNotify: |
|
5723 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(reparentedView:); |
|
5724 |
break; |
|
5725 |
||
5726 |
default: |
|
5727 |
__ArrayInstPtr(anEventArray)->a_element[2] = @symbol(unknownX11Event); |
|
5728 |
break; |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5729 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5730 |
#undef ae |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5731 |
#undef ee |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5732 |
#undef ke |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5733 |
#undef be |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5734 |
#undef ce |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5735 |
#undef cr |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5736 |
#undef cre |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5737 |
#undef cle |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5738 |
#undef gre |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5739 |
#undef me |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5740 |
#undef ewe |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5741 |
#undef ele |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5742 |
#undef lwe |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5743 |
#undef de |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5744 |
#undef mape |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5745 |
#undef ve |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5746 |
#undef fe |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5747 |
#undef rr |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5748 |
#undef pe |
3799
65c6905e1250
Instvar eventbuffer no longer needed
Stefan Vogel <sv@exept.de>
parents:
3798
diff
changeset
|
5749 |
#undef cie |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5750 |
#undef sce |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5751 |
#undef cme |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5752 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5753 |
%}. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5754 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
5755 |
^ true |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5756 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5757 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5758 |
handleAllEvents |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5759 |
"from now on, handle any kind of event" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5760 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5761 |
dispatchingExpose := nil |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5762 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5763 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5764 |
handleExposeOnlyFor:aView |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5765 |
"from now on, handle expose events only" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5766 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5767 |
dispatchingExpose := aView id |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5768 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5769 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5770 |
setEventMask:aMask in:aWindowId |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5771 |
"tell X that we are only interested in events from aMask, which |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5772 |
is the bitwise or of the eventMask bits (see 'eventMaskFor:')" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5773 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5774 |
<context: #return> |
4245 | 5775 |
%{ |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5776 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5777 |
int mask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5778 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5779 |
if (ISCONNECTED |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5780 |
&& __isExternalAddress(aWindowId) |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5781 |
&& __isSmallInteger(aMask)) { |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5782 |
mask = __intVal(aMask); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5783 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5784 |
#ifdef OLD |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5785 |
/* these may not be disabled */ |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5786 |
mask |= ExposureMask | StructureNotifyMask | |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5787 |
KeyPressMask | KeyReleaseMask | |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5788 |
EnterWindowMask | LeaveWindowMask | |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5789 |
ButtonPressMask | ButtonMotionMask | ButtonReleaseMask; |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5790 |
#endif |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5791 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5792 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5793 |
XSelectInput(myDpy, __WindowVal(aWindowId), mask); |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5794 |
LEAVE_XLIB(); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5795 |
RETURN ( self ); |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5796 |
} |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5797 |
%}. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5798 |
self primitiveFailedOrClosedConnection |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5799 |
! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5800 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5801 |
startDispatch |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5802 |
"redefined to clear dispatchingExpose, which is a special X feature" |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5803 |
|
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5804 |
dispatching ifTrue:[^ self]. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5805 |
dispatchingExpose := nil. |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5806 |
super startDispatch |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5807 |
! ! |
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5808 |
|
3885 | 5809 |
!XWorkstation methodsFor:'event handling-old dispatch'! |
3319
e3b21cba1c59
Fix mappingNotifyEvents with new dispatcher.
Stefan Vogel <sv@exept.de>
parents:
3312
diff
changeset
|
5810 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5811 |
buttonPress:button x:x y:y view:aView |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5812 |
"forward a button-press event for some view" |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5813 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5814 |
aView isNil ifTrue:[ |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5815 |
"/ event arrived, after I destroyed it myself |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5816 |
^ self |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5817 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5818 |
button == 1 ifTrue:[ |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5819 |
activateOnClick == true ifTrue:[ |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5820 |
"/ dont raise above an active popup view. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5821 |
(activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[ |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5822 |
aView topView raise. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5823 |
"/ ] ifFalse:[ |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5824 |
"/ activeKeyboardGrab printCR. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5825 |
"/ activePointerGrab printCR. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5826 |
] |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5827 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5828 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5829 |
super buttonPress:button x:x y:y view:aView |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5830 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5831 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5832 |
|
0 | 5833 |
! ! |
295 | 5834 |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5835 |
!XWorkstation methodsFor:'event sending'! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5836 |
|
1567 | 5837 |
sendClientEvent:msgType format:msgFormat to:targetWindowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5 |
1556 | 5838 |
"send a ClientMessage to some other (possibly: non-ST/X) view. |
1567 | 5839 |
The client message gets message_type and msgFormat as specified by |
1556 | 5840 |
the arguments. The additional data arguments specify up to |
5841 |
5 longWords of user data; each may be an integer or nil. |
|
5842 |
It is passed transparently in the events data field. |
|
5843 |
See XProtocol specification for more details." |
|
5844 |
||
5845 |
"/ Event.xclient.type = ClientMessage; |
|
5846 |
"/ Event.xclient.display = dpy; |
|
5847 |
"/ Event.xclient.message_type = msgType; |
|
1567 | 5848 |
"/ Event.xclient.format = msgFormat; |
1556 | 5849 |
"/ Event.xclient.window = targetWindowID; |
5850 |
"/ Event.xclient.data.l[0] = d1 |
|
5851 |
"/ Event.xclient.data.l[1] = d2 |
|
5852 |
"/ Event.xclient.data.l[2] = d3 |
|
5853 |
"/ Event.xclient.data.l[3] = d4 |
|
5854 |
"/ Event.xclient.data.l[4] = d5 |
|
5855 |
"/ |
|
5856 |
"/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event); |
|
5857 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
5858 |
<context: #return> |
4245 | 5859 |
%{ |
1556 | 5860 |
int type; |
5861 |
int state; |
|
5862 |
||
5863 |
if (ISCONNECTED |
|
5864 |
&& __isInteger(msgType) |
|
1567 | 5865 |
&& __isInteger(msgFormat) |
1556 | 5866 |
&& (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5867 |
Display *dpy = myDpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5868 |
XEvent ev; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5869 |
Status result; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5870 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5871 |
if (__isInteger(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5872 |
ev.xclient.data.l[0] = __longIntVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5873 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5874 |
if (__isExternalAddress(d1)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5875 |
ev.xclient.data.l[0] = (int)__externalAddressVal(d1); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5876 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5877 |
ev.xclient.data.l[0] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5878 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5879 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5880 |
if (__isInteger(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5881 |
ev.xclient.data.l[1] = __longIntVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5882 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5883 |
if (__isExternalAddress(d2)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5884 |
ev.xclient.data.l[1] = (int)__externalAddressVal(d2); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5885 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5886 |
ev.xclient.data.l[1] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5887 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5888 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5889 |
if (__isInteger(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5890 |
ev.xclient.data.l[2] = __longIntVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5891 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5892 |
if (__isExternalAddress(d3)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5893 |
ev.xclient.data.l[2] = (int)__externalAddressVal(d3); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5894 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5895 |
ev.xclient.data.l[2] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5896 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5897 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5898 |
if (__isInteger(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5899 |
ev.xclient.data.l[3] = __longIntVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5900 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5901 |
if (__isExternalAddress(d4)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5902 |
ev.xclient.data.l[3] = (int)__externalAddressVal(d4); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5903 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5904 |
ev.xclient.data.l[3] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5905 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5906 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5907 |
if (__isInteger(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5908 |
ev.xclient.data.l[4] = __longIntVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5909 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5910 |
if (__isExternalAddress(d5)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5911 |
ev.xclient.data.l[4] = (int)__externalAddressVal(d5); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5912 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5913 |
ev.xclient.data.l[4] = 0; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5914 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5915 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5916 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5917 |
if (__isExternalAddress(targetWindowID)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
5918 |
ev.xclient.window = __WindowVal(targetWindowID); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5919 |
} else { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5920 |
ev.xclient.window = (Window)__longIntVal(targetWindowID); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5921 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5922 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5923 |
ev.xclient.type = ClientMessage; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5924 |
ev.xclient.display = dpy; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5925 |
ev.xclient.message_type = __longIntVal(msgType); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5926 |
ev.xclient.format = __longIntVal(msgFormat); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5927 |
|
1974 | 5928 |
ENTER_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5929 |
result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev); |
1974 | 5930 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5931 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5932 |
if ((result == BadValue) || (result == BadWindow)) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5933 |
DPRINTF(("bad status in sendClientEvent\n")); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5934 |
RETURN ( false ) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5935 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
5936 |
RETURN (true) |
1556 | 5937 |
} |
5938 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
5939 |
self primitiveFailedOrClosedConnection. |
1556 | 5940 |
^ false |
5941 |
! |
|
5942 |
||
1344 | 5943 |
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
|
5944 |
"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
|
5945 |
TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5946 |
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
|
5947 |
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
|
5948 |
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
|
5949 |
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
|
5950 |
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
|
5951 |
(not very user friendly)" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5952 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
5953 |
<context: #return> |
4245 | 5954 |
%{ |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5955 |
int type; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5956 |
int state; |
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5957 |
|
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5958 |
if (__isSmallInteger(stateMask)) { |
1344 | 5959 |
state = __intVal(stateMask); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5960 |
} else { |
1344 | 5961 |
state = 0; |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
5962 |
} |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5963 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5964 |
if (ISCONNECTED |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5965 |
&& __isSmallInteger(xPos) && __isSmallInteger(yPos) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5966 |
&& (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
5967 |
&& (__isExternalAddress(targetId) || __isInteger(targetId))) { |
1344 | 5968 |
Display *dpy = myDpy; |
5969 |
||
5970 |
XEvent ev; |
|
5971 |
Window target; |
|
5972 |
Status result; |
|
5973 |
KeySym keySym, *syms; |
|
5974 |
int screen = __intVal(__INST(screen)); |
|
5975 |
char s[2]; |
|
5976 |
int nSyms; |
|
5977 |
||
5978 |
if ((typeSymbol == @symbol(keyPress)) |
|
5979 |
|| (typeSymbol == @symbol(keyRelease))) { |
|
5980 |
if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) { |
|
5981 |
keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr)); |
|
5982 |
} else { |
|
5983 |
if (__isCharacter(keySymCodeOrButtonNr)) { |
|
5984 |
s[0] = __intVal(__characterVal(keySymCodeOrButtonNr)); |
|
5985 |
s[1] = '\0'; |
|
5986 |
keySym = XStringToKeysym(s); |
|
5987 |
} else { |
|
5988 |
keySym = (KeySym) __intVal(keySymCodeOrButtonNr); |
|
5989 |
} |
|
5990 |
} |
|
5991 |
ev.xkey.keycode = XKeysymToKeycode(dpy, keySym); |
|
5992 |
||
5993 |
if (stateMask == nil) { |
|
5994 |
/* |
|
5995 |
* get the modifier from the keySym |
|
5996 |
*/ |
|
5997 |
nSyms = 0; |
|
5998 |
syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms); |
|
5999 |
if (syms) { |
|
6000 |
int i; |
|
6001 |
||
6002 |
for (i=0; i<nSyms; i++) { |
|
6003 |
if (syms[i] == keySym) { |
|
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
6004 |
#ifdef MODIFIERDEBUG |
1344 | 6005 |
printf("modifier-index is %d\n", i); |
480
07ab9bbaea5f
create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
6006 |
#endif |
1344 | 6007 |
if (i) state = (1 << (i-1)); |
6008 |
break; |
|
6009 |
} |
|
6010 |
} |
|
6011 |
XFree(syms); |
|
6012 |
} |
|
6013 |
} |
|
6014 |
} else { |
|
6015 |
if ((typeSymbol == @symbol(buttonPress)) |
|
6016 |
|| (typeSymbol == @symbol(buttonRelease))) { |
|
6017 |
if (__isSmallInteger(keySymCodeOrButtonNr)) { |
|
6018 |
ev.xbutton.button = __intVal(keySymCodeOrButtonNr); |
|
6019 |
} else { |
|
6020 |
ev.xbutton.button = 1; |
|
6021 |
} |
|
6022 |
} else { |
|
6023 |
DPRINTF(("invalid sendEvent typeSymbol\n")); |
|
6024 |
RETURN (false); |
|
6025 |
} |
|
6026 |
} |
|
6027 |
||
6028 |
if (typeSymbol == @symbol(keyPress)) |
|
6029 |
ev.xany.type = KeyPress; |
|
6030 |
else if (typeSymbol == @symbol(keyRelease)) |
|
6031 |
ev.xany.type = KeyRelease; |
|
6032 |
else if (typeSymbol == @symbol(buttonPress)) |
|
6033 |
ev.xany.type = ButtonPress; |
|
6034 |
else if (typeSymbol == @symbol(buttonRelease)) |
|
6035 |
ev.xany.type = ButtonRelease; |
|
6036 |
||
6037 |
if (__isExternalAddress(targetId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
6038 |
target = __WindowVal(targetId); |
1344 | 6039 |
} else { |
6040 |
target = (Window) __longIntVal(targetId); |
|
6041 |
} |
|
6042 |
ev.xkey.window = target; |
|
6043 |
ev.xkey.same_screen = 1; |
|
6044 |
ev.xkey.subwindow = 0; |
|
2541 | 6045 |
ev.xkey.root = RootWindow(dpy, screen); |
1344 | 6046 |
ev.xkey.x = __intVal(xPos); |
6047 |
ev.xkey.y = __intVal(yPos); |
|
6048 |
ev.xkey.state = state; |
|
6049 |
ev.xkey.time = CurrentTime; |
|
6050 |
||
1974 | 6051 |
ENTER_XLIB(); |
1344 | 6052 |
result = XSendEvent(dpy, target, False, 0 , &ev); |
1974 | 6053 |
LEAVE_XLIB(); |
1344 | 6054 |
if ((result == BadValue) || (result == BadWindow)) { |
6055 |
DPRINTF(("bad status\n")); |
|
6056 |
RETURN ( false ) |
|
6057 |
} |
|
6058 |
RETURN (true) |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6059 |
} |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6060 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6061 |
self primitiveFailedOrClosedConnection. |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6062 |
^ false |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6063 |
! ! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6064 |
|
295 | 6065 |
!XWorkstation methodsFor:'font stuff'! |
6066 |
||
1344 | 6067 |
createFontFor:aFontName |
295 | 6068 |
"a basic method for X-font allocation; this method allows |
6069 |
any font to be aquired (even those not conforming to |
|
6070 |
standard naming conventions, such as cursor, fixed or k14)" |
|
6071 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6072 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6073 |
|
295 | 6074 |
%{ /* UNLIMITEDSTACK */ |
6075 |
||
6076 |
XFontStruct *newFont; |
|
6077 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6078 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6079 |
&& __isNonNilObject(aFontName) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6080 |
&& (__qIsString(aFontName) || __qIsSymbol(aFontName))) { |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
6081 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6082 |
ENTER_XLIB(); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6083 |
newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName)); |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6084 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6085 |
#ifdef COUNT_RESOURCES |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6086 |
if (newFont) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6087 |
__cnt_font++; |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6088 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
6089 |
|
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
6090 |
RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil ); |
295 | 6091 |
} |
6092 |
%}. |
|
3461
779f5d3cdcee
dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
6093 |
"/ --- disabled due to UNLIMITEDSTACK -- self primitiveFailedOrClosedConnection. |
295 | 6094 |
^ nil |
6095 |
! |
|
6096 |
||
1344 | 6097 |
decomposeXFontName:aString into:aBlock |
295 | 6098 |
"extract family, face, style and size from an |
3418 | 6099 |
X-font name |
6100 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
4245 | 6101 |
-brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding; |
295 | 6102 |
evaluate aBlock with these" |
6103 |
||
3418 | 6104 |
|family face style moreStyle fheight size |
6105 |
resX resY registry encoding coding fields| |
|
295 | 6106 |
|
6107 |
aString isNil ifTrue:[^ false]. |
|
3418 | 6108 |
fields := aString asCollectionOfSubstringsSeparatedBy:$-. |
6109 |
fields size == 3 ifTrue:[ |
|
3424 | 6110 |
"take care of old font names: family-style-size" |
6111 |
family := fields at:1. |
|
6112 |
style := fields at:2. |
|
6113 |
size := Number readFromString:(fields at:3) onError:[^ false]. |
|
3418 | 6114 |
] ifFalse:[fields size == 2 ifTrue:[ |
3424 | 6115 |
"take care of old font names: family-size" |
6116 |
family := fields at:1. |
|
6117 |
size := Number readFromString:(fields at:2) onError:[^ false]. |
|
3418 | 6118 |
] ifFalse:[fields size >= 15 ifTrue:[ |
3424 | 6119 |
family := fields at:3. |
6120 |
face := fields at:4. |
|
6121 |
style := fields at:5. |
|
6122 |
style = 'o' ifTrue:[ |
|
6123 |
style := 'oblique' |
|
6124 |
] ifFalse:[style = 'i' ifTrue:[ |
|
6125 |
style := 'italic' |
|
6126 |
] ifFalse:[style = 'r' ifTrue:[ |
|
6127 |
style := 'roman' |
|
6128 |
]]]. |
|
6129 |
moreStyle := fields at:6. |
|
6130 |
(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[ |
|
6131 |
style := style, '-', moreStyle. |
|
6132 |
]. |
|
6133 |
fheight := fields at:8. |
|
6134 |
size := (Number readFromString:(fields at:9) onError:[^ false]) / 10. |
|
6135 |
resX := fields at:10. |
|
6136 |
resY := fields at:11. |
|
6137 |
registry := fields at:14. |
|
6138 |
encoding := fields at:15. |
|
6139 |
coding := registry , '-' , encoding. |
|
295 | 6140 |
] ifFalse:[ |
3424 | 6141 |
^ false |
3418 | 6142 |
]]]. |
295 | 6143 |
aBlock value:family value:face value:style value:size value:coding. |
6144 |
^ true |
|
3216 | 6145 |
! |
6146 |
||
6147 |
encodingOf:aFontId |
|
6148 |
"the fonts encoding - if the font does not provide that info, |
|
6149 |
return nil (and assume #ascii, which is a subset of #iso8859)." |
|
6150 |
||
4020 | 6151 |
|props reg enc coll| |
6152 |
||
6153 |
props := self fontPropertiesOf:aFontId. |
|
6154 |
reg := props at:#'CHARSET_REGISTRY' ifAbsent:nil. |
|
6155 |
enc := props at:#'CHARSET_ENCODING' ifAbsent:nil. |
|
6156 |
coll := props at:#'CHARSET_COLLECTIONS' ifAbsent:nil. |
|
6157 |
||
6158 |
reg notNil ifTrue:[ reg := self atomName:reg]. |
|
6159 |
enc notNil ifTrue:[ enc := self atomName:enc]. |
|
6160 |
coll notNil ifTrue:[ coll := self atomName:coll]. |
|
6161 |
||
6162 |
^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll |
|
3418 | 6163 |
|
6164 |
" |
|
4245 | 6165 |
Screen current encodingOf:Screen current getDefaultFont |
3418 | 6166 |
" |
1344 | 6167 |
! |
6168 |
||
6169 |
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections |
|
4004
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6170 |
"given registry and encoding as returned by X11, |
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6171 |
generate a single symbol naming the ST/X encoding. |
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6172 |
I.e. from registry='ISO8859' and encoding='1', generate #'iso8859-1'. |
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6173 |
This is pure magic ..." |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
6174 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
6175 |
|enc charSets| |
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
6176 |
|
3418 | 6177 |
(registry size ~~ 0) ifTrue:[ |
4082 | 6178 |
enc := registry asLowercase. |
6179 |
encoding size ~~ 0 ifTrue:[ |
|
6180 |
enc := enc, '-', encoding asLowercase. |
|
6181 |
]. |
|
6182 |
enc := enc asSymbol. |
|
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6183 |
] ifFalse:[ |
4082 | 6184 |
(encoding size ~~ 0) ifTrue:[ |
6185 |
enc := encoding asLowercase asSymbol |
|
6186 |
] ifFalse:[ |
|
4245 | 6187 |
charSets := charSetCollections. |
4082 | 6188 |
(charSets notNil and:[charSets notEmpty]) ifTrue:[ |
6189 |
charSets := charSets asUppercase asCollectionOfWords. |
|
6190 |
(charSets includes:'ISO8859-1') ifTrue:[ |
|
6191 |
enc := #'iso8859-1' |
|
6192 |
] ifFalse:[ |
|
6193 |
(charSets includes:'ISO8859') ifTrue:[ |
|
6194 |
enc := #iso8859 |
|
6195 |
] ifFalse:[ |
|
6196 |
(charSets includes:'ASCII') ifTrue:[ |
|
6197 |
enc := #ascii |
|
6198 |
] ifFalse:[ |
|
6199 |
(charSets includes:'ADOBE-STANDARD') ifTrue:[ |
|
6200 |
enc := #iso8859 |
|
6201 |
] |
|
6202 |
] |
|
6203 |
] |
|
6204 |
] |
|
4245 | 6205 |
] |
4082 | 6206 |
] |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6207 |
]. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6208 |
^ enc |
567
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
6209 |
|
7b735ef0974b
separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents:
558
diff
changeset
|
6210 |
"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
|
6211 |
"Modified: 17.4.1996 / 17:22:35 / cg" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6212 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6213 |
|
1344 | 6214 |
flushListOfAvailableFonts |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6215 |
"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
|
6216 |
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
|
6217 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6218 |
listOfXFonts := nil |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6219 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6220 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6221 |
Display flushListOfAvailableFonts. |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6222 |
Display listOfAvailableFonts |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6223 |
" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6224 |
|
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6225 |
"Modified: 27.9.1995 / 10:54:47 / stefan" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6226 |
"Created: 20.2.1996 / 22:55:52 / cg" |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6227 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6228 |
|
4020 | 6229 |
fontDescriptionFromXFontName:aFontNameString |
6230 |
"extract family, face, style and size from an |
|
6231 |
X-font name |
|
6232 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
4245 | 6233 |
-brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding; |
4020 | 6234 |
evaluate aBlock with these" |
6235 |
||
6236 |
|family face style moreStyle fheight size |
|
6237 |
resX resY registry encoding coding fields| |
|
6238 |
||
6239 |
aFontNameString isNil ifTrue:[^ nil]. |
|
6240 |
||
6241 |
Error handle:[:ex | |
|
4082 | 6242 |
family := nil. |
4020 | 6243 |
] do:[ |
4082 | 6244 |
fields := aFontNameString asCollectionOfSubstringsSeparatedBy:$-. |
6245 |
fields size == 3 ifTrue:[ |
|
6246 |
"take care of old font names: family-style-size" |
|
6247 |
family := fields at:1. |
|
6248 |
style := fields at:2. |
|
6249 |
size := Number readFromString:(fields at:3). |
|
6250 |
] ifFalse:[ |
|
6251 |
fields size == 2 ifTrue:[ |
|
6252 |
"take care of old font names: family-size" |
|
6253 |
family := fields at:1. |
|
6254 |
size := Number readFromString:(fields at:2). |
|
6255 |
] ifFalse:[ |
|
6256 |
fields size >= 15 ifTrue:[ |
|
6257 |
family := fields at:3. |
|
6258 |
face := fields at:4. |
|
6259 |
style := fields at:5. |
|
6260 |
style = 'o' ifTrue:[ |
|
6261 |
style := 'oblique' |
|
6262 |
] ifFalse:[style = 'i' ifTrue:[ |
|
6263 |
style := 'italic' |
|
6264 |
] ifFalse:[style = 'r' ifTrue:[ |
|
6265 |
style := 'roman' |
|
6266 |
]]]. |
|
6267 |
moreStyle := fields at:6. |
|
6268 |
(moreStyle ~= 'normal' and:[moreStyle size > 1]) ifTrue:[ |
|
6269 |
style := style, '-', moreStyle. |
|
6270 |
]. |
|
6271 |
fheight := fields at:8. |
|
6272 |
size := (Number readFromString:(fields at:9)) / 10. |
|
6273 |
resX := fields at:10. |
|
6274 |
resY := fields at:11. |
|
6275 |
registry := fields at:14. |
|
6276 |
encoding := fields at:15. |
|
6277 |
coding := registry , '-' , encoding. |
|
6278 |
] ifFalse:[ |
|
6279 |
"/ very old name (such as cursor, 5x7 etc) |
|
6280 |
] |
|
6281 |
] |
|
6282 |
]. |
|
4020 | 6283 |
]. |
6284 |
||
6285 |
family notNil ifTrue:[ |
|
6286 |
^ FontDescription family:family face:face style:style size:size encoding:coding. |
|
6287 |
]. |
|
6288 |
^ FontDescription name:aFontNameString |
|
6289 |
||
6290 |
" |
|
6291 |
Screen current fontDescriptionFromXFontName:'-arabic-newspaper-medium-r-normal--32-246-100-100-p-137-iso10646-1' |
|
6292 |
" |
|
6293 |
! |
|
6294 |
||
4245 | 6295 |
fontMetricsOf:fontId |
3478 | 6296 |
"return a fonts metrics info object" |
6297 |
||
6298 |
<context: #return> |
|
6299 |
||
4020 | 6300 |
|info avgAscent avgDescent minCode maxCode dir |
3418 | 6301 |
maxAscent maxDescent minWidth maxWidth avgWidth| |
991 | 6302 |
|
994 | 6303 |
%{ |
991 | 6304 |
XFontStruct *f; |
6305 |
int len; |
|
6306 |
||
6307 |
if (ISCONNECTED) { |
|
4082 | 6308 |
if (__isExternalAddress(fontId)) { |
6309 |
f = __FontVal(fontId); |
|
6310 |
if (f) { |
|
6311 |
minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2); |
|
6312 |
maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2); |
|
4245 | 6313 |
|
4082 | 6314 |
if (f->direction == FontLeftToRight) { |
6315 |
dir = @symbol(LeftToRight); |
|
4245 | 6316 |
} else if (f->direction == FontRightToLeft) { |
4082 | 6317 |
dir = @symbol(RightToLeft); |
6318 |
} |
|
6319 |
avgDescent = __MKSMALLINT(f->descent); |
|
6320 |
avgAscent = __MKSMALLINT(f->ascent); |
|
6321 |
avgDescent = __MKSMALLINT(f->descent); |
|
6322 |
maxAscent = __MKSMALLINT(f->max_bounds.ascent); |
|
6323 |
maxDescent = __MKSMALLINT(f->max_bounds.descent); |
|
6324 |
minWidth = __MKSMALLINT(f->min_bounds.width); |
|
6325 |
maxWidth = __MKSMALLINT(f->max_bounds.width); |
|
6326 |
||
6327 |
ENTER_XLIB(); |
|
6328 |
len = XTextWidth(f, " ", 1); |
|
6329 |
LEAVE_XLIB(); |
|
6330 |
||
6331 |
avgWidth = __MKSMALLINT( len ); |
|
6332 |
} |
|
6333 |
} |
|
3216 | 6334 |
} |
6335 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6336 |
avgAscent == nil ifTrue:[ |
4082 | 6337 |
self primitiveFailedOrClosedConnection. |
6338 |
^ nil |
|
3670
f61f690d281c
maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents:
3650
diff
changeset
|
6339 |
]. |
f61f690d281c
maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents:
3650
diff
changeset
|
6340 |
|
f61f690d281c
maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents:
3650
diff
changeset
|
6341 |
"DingBats font returns 0 for maxAscent/maxDescent" |
f61f690d281c
maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents:
3650
diff
changeset
|
6342 |
maxAscent := maxAscent max:avgAscent. |
f61f690d281c
maxAscent/Descent should be >= ascent/descent
Michael Beyl <mb@exept.de>
parents:
3650
diff
changeset
|
6343 |
maxDescent := maxDescent max:avgDescent. |
3478 | 6344 |
|
6345 |
info := DeviceWorkstation::DeviceFontMetrics new. |
|
6346 |
info |
|
6347 |
ascent:avgAscent |
|
6348 |
descent:avgDescent |
|
6349 |
maxAscent:maxAscent |
|
6350 |
maxDescent:maxDescent |
|
6351 |
minWidth:minWidth |
|
6352 |
maxWidth:maxWidth |
|
4020 | 6353 |
avgWidth:avgWidth |
6354 |
minCode:minCode |
|
6355 |
maxCode:maxCode |
|
6356 |
direction:dir. |
|
3478 | 6357 |
^ info |
4020 | 6358 |
|
6359 |
" |
|
6360 |
Screen current fontMetricsOf:(View defaultFont onDevice:Screen current) fontId |
|
6361 |
CharacterSetView openOn:(View defaultFont onDevice:Screen current) |
|
6362 |
||
6363 |
Screen current fontMetricsOf:(MenuView defaultFont onDevice:Screen current) fontId |
|
6364 |
CharacterSetView openOn:(MenuView defaultFont onDevice:Screen current) |
|
6365 |
" |
|
1344 | 6366 |
! |
6367 |
||
3418 | 6368 |
fontProperties:propertyNames of:aFontId |
6369 |
"Answer an array with selected property values of a font. |
|
6370 |
This is X11-Specific. |
|
6371 |
PropertyNames is an array with property names (symbols or strings). |
|
6372 |
Nonexistant properties are returned as nil" |
|
6373 |
||
4020 | 6374 |
|props| |
3418 | 6375 |
|
6376 |
props := self fontPropertiesOf:aFontId. |
|
4020 | 6377 |
^ propertyNames collect:[:propName | props at:propName ifAbsent:nil]. |
3418 | 6378 |
|
6379 |
" |
|
4245 | 6380 |
Screen current |
6381 |
fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' #'RESOLUTION' notExistant) |
|
4082 | 6382 |
of:Screen current getDefaultFont |
3418 | 6383 |
" |
6384 |
! |
|
6385 |
||
6386 |
fontPropertiesOf:aFontId |
|
6387 |
"Answer an array with all the properties of a font. |
|
6388 |
This is X11-Specific. |
|
6389 |
Odd indices contain the property name (atom) |
|
6390 |
Even indices contain the property value (atom) |
|
6391 |
||
6392 |
Answer nil, if there are no properties" |
|
6393 |
||
4020 | 6394 |
|propsArray result| |
3418 | 6395 |
|
4245 | 6396 |
%{ |
3418 | 6397 |
XFontStruct *f; |
6398 |
XFontProp *prop; |
|
6399 |
int n, i; |
|
6400 |
OBJ x; |
|
6401 |
||
6402 |
if (__isExternalAddress(aFontId)) { |
|
4082 | 6403 |
f = __FontVal(aFontId); |
6404 |
if (f && (prop = f->properties) != 0) { |
|
6405 |
n = f->n_properties; |
|
6406 |
propsArray = __ARRAY_NEW_INT(n*2); |
|
6407 |
for (i = 0; n; n--, prop++) { |
|
6408 |
__ArrayInstPtr(propsArray)->a_element[i++] = x = __MKUINT(prop->name); __STORE(propsArray, x); |
|
6409 |
__ArrayInstPtr(propsArray)->a_element[i++] = x = __MKUINT(prop->card32); __STORE(propsArray, x); |
|
6410 |
} |
|
6411 |
} |
|
4020 | 6412 |
} |
6413 |
%}. |
|
6414 |
result := Dictionary new. |
|
6415 |
propsArray notNil ifTrue:[ |
|
4082 | 6416 |
propsArray pairWiseDo:[:n :v | result at:(self atomName:n) put:v]. |
4020 | 6417 |
]. |
6418 |
^ result |
|
6419 |
||
6420 |
" |
|
6421 |
Screen current fontPropertiesOf:Screen current getDefaultFont |
|
6422 |
Dictionary withKeysAndValues:(Screen current fontPropertiesOf:Screen current getDefaultFont) |
|
6423 |
||
6424 |
|d| |
|
6425 |
d := Dictionary new. |
|
6426 |
(Screen current fontPropertiesOf:Screen current getDefaultFont) pairWiseDo:[:name :value| |
|
4082 | 6427 |
d at:((Screen current atomName:name) ? name) put:value |
4020 | 6428 |
]. |
4245 | 6429 |
d |
3418 | 6430 |
" |
6431 |
! |
|
6432 |
||
1344 | 6433 |
fontResolutionOf:fontId |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6434 |
"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
|
6435 |
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
|
6436 |
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
|
6437 |
|
3418 | 6438 |
|props res resX resY| |
6439 |
||
4020 | 6440 |
props := self fontProperties:#(#'RESOLUTION_X' #'RESOLUTION_Y' RESOLUTION) of:fontId. |
3418 | 6441 |
resX := props at:1. |
6442 |
resY := props at:2. |
|
1046 | 6443 |
(resX notNil and:[resY notNil]) ifTrue:[ |
4082 | 6444 |
^ resX @ resY |
3418 | 6445 |
]. |
6446 |
res := props at:3. |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6447 |
res notNil ifTrue:[ |
4082 | 6448 |
^ res @ res |
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6449 |
]. |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6450 |
^ self resolution |
3418 | 6451 |
|
6452 |
" |
|
6453 |
Screen current fontResolutionOf:(Screen current getDefaultFont) |
|
6454 |
" |
|
1045
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6455 |
! |
b03222053583
added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents:
1030
diff
changeset
|
6456 |
|
3417
88c4df032e94
Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents:
3414
diff
changeset
|
6457 |
fullFontNameOf:aFontId |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6458 |
"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
|
6459 |
used for user feed-back (for example: in the fontPanel). |
3417
88c4df032e94
Fix possible botch in #rootWindowId.
Stefan Vogel <sv@exept.de>
parents:
3414
diff
changeset
|
6460 |
If the display/font does not provide that info, return nil." |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6461 |
|
3418 | 6462 |
|props fullName| |
4012 | 6463 |
|
4020 | 6464 |
props := self fontPropertiesOf:aFontId. |
6465 |
#('FONT' 'FONT_NAME' 'FULL_NAME' 'FULLNAME' ) do:[:try | |
|
4082 | 6466 |
|fullNameID| |
6467 |
||
6468 |
fullNameID := props at:try ifAbsent:nil. |
|
6469 |
fullNameID notNil ifTrue:[ |
|
6470 |
fullName := self atomName:fullNameID. |
|
6471 |
fullName notEmptyOrNil ifTrue:[ |
|
6472 |
^ fullName |
|
6473 |
]. |
|
6474 |
] |
|
4020 | 6475 |
]. |
6476 |
||
3418 | 6477 |
^ nil. |
6478 |
||
6479 |
" |
|
4245 | 6480 |
Screen current fullFontNameOf:(Screen current getDefaultFont) |
3418 | 6481 |
" |
440
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6482 |
! |
e959b8e18453
font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
6483 |
|
1344 | 6484 |
getAvailableFontsMatching:pattern |
295 | 6485 |
"return an Array filled with font names matching aPattern" |
6486 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6487 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6488 |
|
295 | 6489 |
%{ /* UNLIMITEDSTACK */ |
6490 |
||
3801 | 6491 |
int nnames = 15000; |
295 | 6492 |
int available = nnames + 1; |
6493 |
char **fonts; |
|
6494 |
OBJ arr, str; |
|
6495 |
int i; |
|
6496 |
||
6497 |
if (ISCONNECTED) { |
|
3806 | 6498 |
if (__isString(pattern)) { |
6499 |
for (;;) { |
|
6500 |
ENTER_XLIB(); |
|
6501 |
fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available); |
|
6502 |
LEAVE_XLIB(); |
|
6503 |
if (fonts == 0) RETURN(nil); |
|
6504 |
if (available < nnames) break; |
|
6505 |
XFreeFontNames(fonts); |
|
6506 |
nnames = available * 2; |
|
6507 |
} |
|
6508 |
||
6509 |
/* |
|
6510 |
* now, that we know the number of font names, |
|
6511 |
* create the array ... |
|
6512 |
*/ |
|
6513 |
arr = __ARRAY_NEW_INT(available); |
|
6514 |
if (arr != nil) { |
|
6515 |
/* |
|
6516 |
* ... and fill it |
|
6517 |
*/ |
|
6518 |
for (i=0; i<available; i++) { |
|
6519 |
__PROTECT__(arr); |
|
6520 |
str = __MKSTRING(fonts[i]); |
|
6521 |
__UNPROTECT__(arr); |
|
6522 |
__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str); |
|
6523 |
} |
|
6524 |
} |
|
6525 |
XFreeFontNames(fonts); |
|
6526 |
RETURN (arr); |
|
6527 |
} |
|
295 | 6528 |
} |
6529 |
%}. |
|
6530 |
^ nil |
|
3801 | 6531 |
|
6532 |
" |
|
6533 |
Screen current getAvailableFontsMatching:'*' |
|
6534 |
" |
|
295 | 6535 |
! |
6536 |
||
1344 | 6537 |
getDefaultFont |
295 | 6538 |
"return a default font id - used when class Font cannot |
6539 |
find anything usable" |
|
6540 |
||
6541 |
^ self createFontFor:'fixed' |
|
3418 | 6542 |
|
6543 |
" |
|
6544 |
Screen current getDefaultFont |
|
6545 |
" |
|
295 | 6546 |
! |
6547 |
||
1344 | 6548 |
getFontWithFamily:familyString face:faceString |
4082 | 6549 |
style:styleArgString size:sizeArg encoding:encoding |
295 | 6550 |
|
6551 |
"try to get the specified font, if not available, try next smaller |
|
6552 |
font. Access to X-fonts by name is possible, by passing the X font name |
|
6553 |
as family and the other parameters as nil. For example, the cursor font |
|
6554 |
can be aquired that way." |
|
6555 |
||
4245 | 6556 |
|styleString theName theId xlatedStyle |
4004
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6557 |
id spacing encodingMatch idx roundedSize| |
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6558 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6559 |
styleString := styleArgString. |
295 | 6560 |
|
3990 | 6561 |
sizeArg notNil ifTrue:[ |
4082 | 6562 |
roundedSize := sizeArg rounded asInteger. |
3990 | 6563 |
]. |
6564 |
||
295 | 6565 |
"special: if face is nil, allow access to X-fonts" |
6566 |
faceString isNil ifTrue:[ |
|
4082 | 6567 |
roundedSize notNil ifTrue:[ |
6568 |
theName := familyString , '-' , roundedSize printString |
|
6569 |
] ifFalse:[ |
|
6570 |
theName := familyString |
|
6571 |
]. |
|
6572 |
theName isNil ifTrue:[ |
|
6573 |
" |
|
6574 |
mhmh - fall back to the default font |
|
6575 |
" |
|
6576 |
theName := 'fixed' |
|
6577 |
]. |
|
6578 |
theId := self createFontFor:theName. |
|
6579 |
theId isNil ifTrue:[ |
|
6580 |
theId := self getDefaultFont |
|
6581 |
]. |
|
6582 |
^ theId |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6583 |
]. |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6584 |
|
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6585 |
"/ 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
|
6586 |
"/ in style |
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6587 |
|
1392
45ae91abdfac
care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents:
1376
diff
changeset
|
6588 |
(styleString notNil |
4245 | 6589 |
and:[(styleString endsWith:'-narrow') |
4082 | 6590 |
or:[styleString endsWith:'-semicondensed']]) ifTrue:[ |
6591 |
|i| |
|
6592 |
i := styleString lastIndexOf:$-. |
|
6593 |
spacing := styleString copyFrom:(i+1). |
|
6594 |
styleString := styleString copyTo:(i-1). |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6595 |
] ifFalse:[ |
4082 | 6596 |
spacing := 'normal'. |
295 | 6597 |
]. |
6598 |
||
6599 |
xlatedStyle := styleString. |
|
6600 |
xlatedStyle notNil ifTrue:[ |
|
4082 | 6601 |
xlatedStyle := xlatedStyle first asString |
3449 | 6602 |
]. |
6603 |
||
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6604 |
encoding isNil ifTrue:[ |
4082 | 6605 |
encodingMatch := '*-*'. |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6606 |
] ifFalse:[ |
4082 | 6607 |
idx := encoding indexOf:$-. |
6608 |
idx ~~ 0 ifTrue:[ |
|
6609 |
encodingMatch := encoding |
|
6610 |
] ifFalse:[ |
|
6611 |
encodingMatch := encoding , '-*'. |
|
6612 |
]. |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6613 |
]. |
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6614 |
|
4245 | 6615 |
id := self |
4082 | 6616 |
getFontWithFoundry:'*' |
6617 |
family:familyString asLowercase |
|
6618 |
weight:faceString |
|
6619 |
slant:xlatedStyle |
|
6620 |
spacing:spacing |
|
6621 |
pixelSize:nil |
|
4245 | 6622 |
size:roundedSize |
4082 | 6623 |
encoding:encodingMatch. |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6624 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6625 |
id isNil ifTrue:[ |
4082 | 6626 |
(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[ |
6627 |
"/ too stupid: registries come in both cases |
|
6628 |
"/ and X does not ignore case |
|
6629 |
"/ |
|
4245 | 6630 |
id := self |
4082 | 6631 |
getFontWithFoundry:'*' |
6632 |
family:familyString asLowercase |
|
6633 |
weight:faceString |
|
6634 |
slant:xlatedStyle |
|
6635 |
spacing:spacing |
|
6636 |
pixelSize:nil |
|
4245 | 6637 |
size:roundedSize |
4082 | 6638 |
encoding:encodingMatch asUppercase. |
6639 |
id isNil ifTrue:[ |
|
4245 | 6640 |
id := self |
4082 | 6641 |
getFontWithFoundry:'*' |
6642 |
family:familyString asLowercase |
|
6643 |
weight:faceString |
|
6644 |
slant:xlatedStyle |
|
6645 |
spacing:spacing |
|
6646 |
pixelSize:nil |
|
4245 | 6647 |
size:roundedSize |
4082 | 6648 |
encoding:encodingMatch asLowercase. |
6649 |
] |
|
6650 |
] |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6651 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6652 |
^ id |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6653 |
|
914
6cf4cc647095
Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents:
911
diff
changeset
|
6654 |
"Modified: 4.7.1996 / 11:38:47 / stefan" |
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6655 |
"Modified: 10.4.1997 / 19:20:06 / cg" |
295 | 6656 |
! |
6657 |
||
1344 | 6658 |
getFontWithFoundry:foundry family:family weight:weight |
4245 | 6659 |
slant:slant spacing:spc pixelSize:pSize size:size |
4082 | 6660 |
encoding:encoding |
295 | 6661 |
|
6662 |
"get the specified font, if not available, return nil. |
|
6663 |
This is the new font creation method - all others will be changed to |
|
6664 |
use this entry. |
|
6665 |
Individual attributes can be left empty (i.e. '') or nil to match any. |
|
6666 |
||
6667 |
foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*' |
|
6668 |
family: 'helvetica' 'courier' 'times' ... |
|
6669 |
weight: 'bold' 'medium' 'demi' ... |
|
6670 |
slant: 'r(oman)' 'i(talic)' 'o(blique)' |
|
6671 |
spacing: 'narrow' 'normal' semicondensed' ... usually '*' |
|
6672 |
pixelSize: 16,18 ... usually left empty |
|
6673 |
size: size in point (1/72th of an inch) |
|
4004
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6674 |
encoding: iso8859-*, iso8859-1, iso10646-1 ... '*' |
295 | 6675 |
" |
6676 |
||
4245 | 6677 |
|theName sizeMatch |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6678 |
foundryMatch familyMatch weightMatch slantMatch spcMatch |
4004
349680545ec4
treat encoding and registry as a single entity
Claus Gittinger <cg@exept.de>
parents:
3990
diff
changeset
|
6679 |
pSizeMatch encodingMatch| |
295 | 6680 |
|
6681 |
"this works only on 'Release >= 3' - X-servers" |
|
6682 |
"name is: |
|
4082 | 6683 |
-foundry-family -weight -slant- |
6684 |
sony helvetica bold r |
|
6685 |
adobe courier medium i |
|
6686 |
msic fixed o |
|
6687 |
... ... |
|
295 | 6688 |
" |
6689 |
||
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6690 |
size isNil ifTrue:[ |
4082 | 6691 |
sizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6692 |
] ifFalse:[ |
4082 | 6693 |
sizeMatch := size printString , '0' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6694 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6695 |
foundry isNil ifTrue:[ |
4082 | 6696 |
foundryMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6697 |
] ifFalse:[ |
4082 | 6698 |
foundryMatch := foundry |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6699 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6700 |
family isNil ifTrue:[ |
4082 | 6701 |
familyMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6702 |
] ifFalse:[ |
4082 | 6703 |
familyMatch := family |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6704 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6705 |
weight isNil ifTrue:[ |
4082 | 6706 |
weightMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6707 |
] ifFalse:[ |
4082 | 6708 |
weightMatch := weight |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6709 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6710 |
slant isNil ifTrue:[ |
4082 | 6711 |
slantMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6712 |
] ifFalse:[ |
4082 | 6713 |
slantMatch := slant |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6714 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6715 |
spc isNil ifTrue:[ |
4082 | 6716 |
spcMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6717 |
] ifFalse:[ |
4082 | 6718 |
spcMatch := spc |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6719 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6720 |
pSize isNil ifTrue:[ |
4082 | 6721 |
pSizeMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6722 |
] ifFalse:[ |
4082 | 6723 |
pSizeMatch := pSize printString |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6724 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6725 |
encoding isNil ifTrue:[ |
4082 | 6726 |
encodingMatch := '*' |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6727 |
] ifFalse:[ |
4082 | 6728 |
encodingMatch := encoding |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6729 |
]. |
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6730 |
|
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6731 |
theName := ('-' , foundryMatch, |
4082 | 6732 |
'-' , familyMatch, |
6733 |
'-' , weightMatch , |
|
4245 | 6734 |
'-' , slantMatch , |
4082 | 6735 |
'-' , spcMatch , |
6736 |
'-*' , |
|
6737 |
'-' , pSizeMatch , |
|
6738 |
'-' , sizeMatch , |
|
6739 |
'-*-*-*-*' , |
|
6740 |
'-' , encodingMatch). |
|
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6741 |
|
697 | 6742 |
"/ Transcript showCR:theName; endEntry. |
295 | 6743 |
|
6744 |
^ self createFontFor:theName. |
|
4245 | 6745 |
|
6746 |
||
6747 |
" |
|
6748 |
Display |
|
4082 | 6749 |
getFontWithFoundry:'*' |
6750 |
family:'courier' |
|
6751 |
weight:'medium' |
|
6752 |
slant:'r' |
|
6753 |
spacing:nil |
|
6754 |
pixelSize:nil |
|
6755 |
size:13 |
|
6756 |
encoding:'iso8859-*' |
|
295 | 6757 |
" |
457
b40bf5d8727c
ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents:
449
diff
changeset
|
6758 |
|
1576
b75c64bb5849
care for encoding & registry
Claus Gittinger <cg@exept.de>
parents:
1567
diff
changeset
|
6759 |
"Modified: 10.4.1997 / 19:15:44 / cg" |
295 | 6760 |
! |
6761 |
||
1344 | 6762 |
listOfAvailableFonts |
295 | 6763 |
"return a list with all available fonts on this display. |
3418 | 6764 |
Since this takes some time, keep the result of the query for the |
295 | 6765 |
next time. The elements of the returned collection are instances of |
6766 |
FontDescription." |
|
6767 |
||
3418 | 6768 |
|names| |
295 | 6769 |
|
6770 |
listOfXFonts isNil ifTrue:[ |
|
4082 | 6771 |
names := self getAvailableFontsMatching:'*'. |
6772 |
names isNil ifTrue:[ |
|
6773 |
"no names returned ..." |
|
6774 |
^ nil |
|
6775 |
]. |
|
6776 |
listOfXFonts := names collect:[:aName | self fontDescriptionFromXFontName:aName]. |
|
295 | 6777 |
]. |
6778 |
^ listOfXFonts |
|
6779 |
||
6780 |
" |
|
4020 | 6781 |
Display flushListOfAvailableFonts. |
568
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6782 |
Display listOfAvailableFonts. |
ded98de3475f
return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents:
567
diff
changeset
|
6783 |
|
4020 | 6784 |
Display getAvailableFontsMatching:'*'. |
3418 | 6785 |
Display getAvailableFontsMatching:'fixed'. |
6786 |
Display fontsInFamily:'fixed' filtering:nil. |
|
295 | 6787 |
" |
6788 |
||
6789 |
"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
|
6790 |
"Modified: 17.4.1996 / 15:27:57 / cg" |
295 | 6791 |
! |
6792 |
||
1344 | 6793 |
releaseFont:aFontId |
295 | 6794 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6795 |
<context: #return> |
4245 | 6796 |
%{ |
295 | 6797 |
|
6798 |
XFontStruct *f; |
|
6799 |
||
1212 | 6800 |
if (! ISCONNECTED) { |
1344 | 6801 |
RETURN ( self ); |
1212 | 6802 |
} |
6803 |
||
6804 |
if (__isExternalAddress(aFontId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
6805 |
f = __FontVal(aFontId); |
1344 | 6806 |
if (f) { |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
6807 |
|
1974 | 6808 |
ENTER_XLIB(); |
1344 | 6809 |
XFreeFont(myDpy, f); |
1974 | 6810 |
LEAVE_XLIB(); |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6811 |
#ifdef COUNT_RESOURCES |
1344 | 6812 |
__cnt_font--; |
923
64bbcd3ee100
added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents:
918
diff
changeset
|
6813 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
6814 |
|
1344 | 6815 |
RETURN ( self ); |
6816 |
} |
|
295 | 6817 |
} |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6818 |
%}. |
295 | 6819 |
self primitiveFailed |
6820 |
! |
|
6821 |
||
1344 | 6822 |
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter |
295 | 6823 |
"return a set of all available font sizes in aFamily/aFace/aStyle |
6824 |
on this display. |
|
6825 |
Redefined to handle X's special case of 0-size (which stands for any)" |
|
6826 |
||
6827 |
|sizes| |
|
6828 |
||
466 | 6829 |
sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter. |
295 | 6830 |
(sizes notNil and:[sizes includes:0]) ifTrue:[ |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
6831 |
"special: in X11R5 and above, size 0 means: |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
6832 |
there are scaled versions in all sizes available" |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
6833 |
|
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
6834 |
^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288) |
295 | 6835 |
]. |
6836 |
^ sizes |
|
6837 |
||
6838 |
" |
|
6839 |
Display sizesInFamily:'courier' face:'bold' style:'roman' |
|
6840 |
" |
|
466 | 6841 |
|
6842 |
"Created: 27.2.1996 / 01:38:15 / cg" |
|
295 | 6843 |
! |
6844 |
||
1344 | 6845 |
widthOf:aString from:index1 to:index2 inFont:aFontId |
295 | 6846 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6847 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
6848 |
%{ |
295 | 6849 |
|
6850 |
XFontStruct *f; |
|
6851 |
char *cp; |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6852 |
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
|
6853 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6854 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
6855 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
6856 |
int nInstBytes; |
3482 | 6857 |
int directionReturn, fontAscentReturn, fontDescentReturn; |
6858 |
XCharStruct overAllReturn; |
|
295 | 6859 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
6860 |
if (ISCONNECTED) { |
4245 | 6861 |
if (__bothSmallInteger(index1, index2) |
6862 |
&& __isExternalAddress(aFontId) |
|
6863 |
&& __isNonNilObject(aString)) { |
|
6864 |
int lMax = __intVal(@global(MaxStringLength)); |
|
6865 |
f = __FontVal(aFontId); |
|
6866 |
if (! f) goto fail; |
|
6867 |
||
6868 |
i1 = __intVal(index1) - 1; |
|
6869 |
cls = __qClass(aString); |
|
6870 |
||
6871 |
if (i1 >= 0) { |
|
6872 |
i2 = __intVal(index2) - 1; |
|
6873 |
if (i2 < i1) { |
|
6874 |
RETURN ( __MKSMALLINT(0) ); |
|
6875 |
} |
|
6876 |
||
6877 |
cp = (char *) __stringVal(aString); |
|
6878 |
l = i2 - i1 + 1; |
|
6879 |
||
6880 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
6881 |
n = __stringSize(aString); |
|
6882 |
if (i2 < n) { |
|
6883 |
cp += i1; |
|
3482 | 6884 |
|
6885 |
#if 0 |
|
4245 | 6886 |
ENTER_XLIB(); |
6887 |
len = XQueryTextExtents(myDpy, f->fid, cp, l, |
|
6888 |
&directionReturn, &fontAscentReturn, &fontDescentReturn, |
|
6889 |
&overAllReturn); |
|
6890 |
LEAVE_XLIB(); |
|
6891 |
printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); |
|
6892 |
#endif |
|
6893 |
ENTER_XLIB(); |
|
6894 |
len = XTextWidth(f, cp, l); |
|
6895 |
LEAVE_XLIB(); |
|
6896 |
||
6897 |
RETURN ( __MKSMALLINT(len) ); |
|
6898 |
} |
|
6899 |
} |
|
6900 |
||
6901 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
6902 |
cp += nInstBytes; |
|
6903 |
||
6904 |
if (__isBytes(aString)) { |
|
6905 |
n = __byteArraySize(aString) - nInstBytes; |
|
6906 |
if (i2 < n) { |
|
6907 |
cp += i1; |
|
6908 |
||
6909 |
ENTER_XLIB(); |
|
6910 |
len = XTextWidth(f, cp, l); |
|
6911 |
LEAVE_XLIB(); |
|
6912 |
||
6913 |
RETURN ( __MKSMALLINT(len) ); |
|
6914 |
} |
|
6915 |
} |
|
6916 |
||
6917 |
/* TWOBYTESTRINGS */ |
|
6918 |
if (__isWords(aString)) { |
|
6919 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
6920 |
||
6921 |
if (i2 < n) { |
|
6922 |
union { |
|
6923 |
char b[2]; |
|
6924 |
unsigned short s; |
|
6925 |
} u; |
|
6926 |
int i; |
|
6927 |
XChar2b *cp2 = (XChar2b *)0; |
|
6928 |
int mustFree = 0; |
|
6929 |
||
6930 |
cp += (i1 * 2); |
|
6931 |
if (l > lMax) l = lMax; |
|
6932 |
||
6933 |
/* |
|
6934 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
6935 |
* X expects them MSB first |
|
6936 |
* convert as required |
|
6937 |
*/ |
|
6938 |
||
6939 |
u.s = 0x1234; |
|
6940 |
if (u.b[0] != 0x12) { |
|
6941 |
if (l <= NLOCALBUFFER) { |
|
6942 |
cp2 = xlatebuffer; |
|
6943 |
} else { |
|
6944 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
6945 |
mustFree = 1; |
|
6946 |
} |
|
6947 |
for (i=0; i<l; i++) { |
|
6948 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
6949 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
6950 |
} |
|
6951 |
cp = (char *) cp2; |
|
6952 |
} |
|
6953 |
||
6954 |
ENTER_XLIB(); |
|
6955 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
|
6956 |
LEAVE_XLIB(); |
|
6957 |
||
6958 |
||
6959 |
if (mustFree) { |
|
6960 |
free(cp2); |
|
6961 |
} |
|
6962 |
||
6963 |
RETURN ( __MKSMALLINT(len) ); |
|
6964 |
} |
|
6965 |
} |
|
6966 |
/* FOURBYTESTRINGS */ |
|
6967 |
if (__isLongs(aString)) { |
|
6968 |
int i; |
|
6969 |
XChar2b *cp2; |
|
6970 |
int mustFree = 0; |
|
6971 |
||
6972 |
n = (__byteArraySize(aString) - nInstBytes) / 4; |
|
6973 |
if (i2 < n) { |
|
6974 |
union { |
|
6975 |
char b[2]; |
|
6976 |
unsigned short s; |
|
6977 |
} u; |
|
6978 |
int i; |
|
6979 |
XChar2b *cp2 = (XChar2b *)0; |
|
6980 |
int mustFree = 0; |
|
6981 |
||
6982 |
cp += (i1 * 4); |
|
6983 |
if (l > lMax) l = lMax; |
|
6984 |
||
6985 |
/* |
|
6986 |
* For now: X does not support 32bit characters without the new 32Unicode extensions. |
|
6987 |
* For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?). |
|
6988 |
*/ |
|
6989 |
if (l <= NLOCALBUFFER) { |
|
6990 |
cp2 = xlatebuffer; |
|
6991 |
} else { |
|
6992 |
cp2 = (XChar2b *)(malloc(l * 2)); |
|
6993 |
mustFree = 1; |
|
6994 |
} |
|
6995 |
for (i=0; i<l; i++) { |
|
6996 |
int codePoint; |
|
6997 |
||
6998 |
codePoint = ((unsigned int32 *)cp)[i]; |
|
6999 |
if (codePoint > 0xFFFF) { |
|
7000 |
codePoint = 0xFFFF; |
|
7001 |
} |
|
7002 |
cp2[i].byte1 = codePoint & 0xFF; |
|
7003 |
cp2[i].byte2 = (codePoint >> 8) & 0xFF;; |
|
7004 |
} |
|
7005 |
cp = (char *) cp2; |
|
7006 |
||
7007 |
ENTER_XLIB(); |
|
7008 |
len = XTextWidth16(f, (XChar2b *)cp, l); |
|
7009 |
LEAVE_XLIB(); |
|
7010 |
||
7011 |
||
7012 |
if (mustFree) { |
|
7013 |
free(cp2); |
|
7014 |
} |
|
7015 |
||
7016 |
RETURN ( __MKSMALLINT(len) ); |
|
7017 |
} |
|
7018 |
} |
|
7019 |
} |
|
7020 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
7021 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
7022 |
#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
|
7023 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
7024 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7025 |
self primitiveFailedOrClosedConnection. |
1361
784d654780e6
added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents:
1345
diff
changeset
|
7026 |
^ 0 |
295 | 7027 |
! |
7028 |
||
1344 | 7029 |
widthOf:aString inFont:aFontId |
295 | 7030 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7031 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7032 |
%{ |
295 | 7033 |
|
7034 |
XFontStruct *f; |
|
7035 |
char *cp; |
|
7036 |
int len, n; |
|
447
9a58924e921b
dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents:
440
diff
changeset
|
7037 |
OBJ cls; |
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
7038 |
# define NLOCALBUFFER 200 |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
7039 |
XChar2b xlatebuffer[NLOCALBUFFER]; |
481
62f1be5db8aa
also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents:
480
diff
changeset
|
7040 |
int nInstBytes; |
3482 | 7041 |
int directionReturn, fontAscentReturn, fontDescentReturn; |
7042 |
XCharStruct overAllReturn; |
|
295 | 7043 |
|
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
7044 |
if (ISCONNECTED) { |
4245 | 7045 |
if (__isExternalAddress(aFontId) |
7046 |
&& __isNonNilObject(aString)) { |
|
7047 |
int lMax = __intVal(@global(MaxStringLength)); |
|
7048 |
f = __FontVal(aFontId); |
|
7049 |
if (! f) goto fail; |
|
7050 |
||
7051 |
cls = __qClass(aString); |
|
7052 |
||
7053 |
cp = (char *) __stringVal(aString); |
|
7054 |
||
7055 |
if ((cls == @global(String)) || (cls == @global(Symbol))) { |
|
7056 |
n = __stringSize(aString); |
|
3482 | 7057 |
|
7058 |
#if 0 |
|
4245 | 7059 |
ENTER_XLIB(); |
7060 |
len = XQueryTextExtents(myDpy, f->fid, cp, n, |
|
7061 |
&directionReturn, &fontAscentReturn, &fontDescentReturn, |
|
7062 |
&overAllReturn); |
|
7063 |
LEAVE_XLIB(); |
|
7064 |
printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width); |
|
7065 |
#endif |
|
7066 |
||
7067 |
ENTER_XLIB(); |
|
7068 |
len = XTextWidth(f, cp, n); |
|
7069 |
LEAVE_XLIB(); |
|
7070 |
||
7071 |
RETURN ( __MKSMALLINT(len) ); |
|
7072 |
} |
|
7073 |
||
7074 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
7075 |
cp += nInstBytes; |
|
7076 |
||
7077 |
if (__isBytes(aString)) { |
|
7078 |
n = __byteArraySize(aString) - nInstBytes; |
|
7079 |
||
7080 |
||
7081 |
ENTER_XLIB(); |
|
7082 |
len = XTextWidth(f, cp, n); |
|
7083 |
LEAVE_XLIB(); |
|
7084 |
||
7085 |
RETURN ( __MKSMALLINT(len) ); |
|
7086 |
} |
|
7087 |
||
7088 |
/* TWOBYTESTRINGS */ |
|
7089 |
if (__isWords(aString)) { |
|
7090 |
union { |
|
7091 |
char b[2]; |
|
7092 |
unsigned short s; |
|
7093 |
} u; |
|
7094 |
int i; |
|
7095 |
XChar2b *cp2; |
|
7096 |
int mustFree = 0; |
|
7097 |
||
7098 |
n = (__byteArraySize(aString) - nInstBytes) / 2; |
|
7099 |
if (n > lMax) n = lMax; |
|
7100 |
||
7101 |
/* |
|
7102 |
* ST/X TwoByteStrings store the asciiValue in native byteOrder; |
|
7103 |
* X expects them MSB first |
|
7104 |
* convert as required |
|
7105 |
*/ |
|
7106 |
||
7107 |
u.s = 0x1234; |
|
7108 |
if (u.b[0] != 0x12) { |
|
7109 |
if (n <= NLOCALBUFFER) { |
|
7110 |
cp2 = xlatebuffer; |
|
7111 |
} else { |
|
7112 |
cp2 = (XChar2b *)(malloc(n * 2)); |
|
7113 |
mustFree = 1; |
|
7114 |
} |
|
7115 |
||
7116 |
for (i=0; i<n; i++) { |
|
7117 |
cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2; |
|
7118 |
cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1; |
|
7119 |
} |
|
7120 |
cp = (char *) cp2; |
|
7121 |
} |
|
7122 |
||
7123 |
||
7124 |
ENTER_XLIB(); |
|
7125 |
len = XTextWidth16(f, (XChar2b *)cp, n); |
|
7126 |
LEAVE_XLIB(); |
|
7127 |
||
7128 |
||
7129 |
if (mustFree) { |
|
7130 |
free(cp2); |
|
7131 |
} |
|
7132 |
||
7133 |
RETURN ( __MKSMALLINT(len) ); |
|
7134 |
} |
|
7135 |
} |
|
486
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
7136 |
} |
0c35ed67797d
oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents:
481
diff
changeset
|
7137 |
#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
|
7138 |
fail: ; |
402
f5a53e2a868d
check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
7139 |
%}. |
3245 | 7140 |
^ super widthOf:aString inFont:aFontId |
295 | 7141 |
! ! |
7142 |
||
3177 | 7143 |
!XWorkstation methodsFor:'grabbing'! |
295 | 7144 |
|
1344 | 7145 |
allowEvents:mode |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7146 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7147 |
%{ |
295 | 7148 |
|
7149 |
int _mode, ok = 1; |
|
7150 |
||
7151 |
if (mode == @symbol(asyncPointer)) |
|
1344 | 7152 |
_mode = AsyncPointer; |
295 | 7153 |
else if (mode == @symbol(syncPointer)) |
1344 | 7154 |
_mode = SyncPointer; |
295 | 7155 |
else if (mode == @symbol(asyncKeyboard)) |
1344 | 7156 |
_mode = AsyncKeyboard; |
295 | 7157 |
else if (mode == @symbol(syncKeyboard)) |
1344 | 7158 |
_mode = SyncKeyboard; |
295 | 7159 |
else if (mode == @symbol(syncBoth)) |
1344 | 7160 |
_mode = SyncBoth; |
295 | 7161 |
else if (mode == @symbol(asyncBoth)) |
1344 | 7162 |
_mode = AsyncBoth; |
295 | 7163 |
else if (mode == @symbol(replayPointer)) |
1344 | 7164 |
_mode = ReplayPointer; |
295 | 7165 |
else if (mode == @symbol(replayKeyboard)) |
1344 | 7166 |
_mode = ReplayKeyboard; |
295 | 7167 |
else |
1344 | 7168 |
ok = 0; |
295 | 7169 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7170 |
if (ok |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7171 |
&& ISCONNECTED) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7172 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7173 |
XAllowEvents(myDpy, _mode, CurrentTime); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7174 |
LEAVE_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7175 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7176 |
RETURN (self); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7177 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7178 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7179 |
self primitiveFailedOrClosedConnection |
295 | 7180 |
! |
7181 |
||
1344 | 7182 |
grabKeyboardIn:aWindowId |
295 | 7183 |
"grab the keyboard" |
7184 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7185 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7186 |
%{ |
295 | 7187 |
int result, ok; |
7188 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7189 |
if (ISCONNECTED) { |
1344 | 7190 |
if (__isExternalAddress(aWindowId)) { |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
7191 |
|
1974 | 7192 |
ENTER_XLIB(); |
1344 | 7193 |
result = XGrabKeyboard(myDpy, |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7194 |
__WindowVal(aWindowId), |
1344 | 7195 |
True /* False */, |
7196 |
GrabModeAsync, |
|
7197 |
GrabModeAsync, |
|
7198 |
CurrentTime); |
|
1974 | 7199 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
7200 |
|
1344 | 7201 |
ok = 0; |
7202 |
switch(result) { |
|
4245 | 7203 |
case AlreadyGrabbed: |
1344 | 7204 |
if (@global(ErrorPrinting) == true) { |
7205 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n"); |
|
7206 |
} |
|
7207 |
break; |
|
4245 | 7208 |
case GrabNotViewable: |
1344 | 7209 |
if (@global(ErrorPrinting) == true) { |
7210 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n"); |
|
7211 |
} |
|
7212 |
break; |
|
4245 | 7213 |
case GrabInvalidTime: |
1344 | 7214 |
if (@global(ErrorPrinting) == true) { |
7215 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n"); |
|
7216 |
} |
|
7217 |
break; |
|
4245 | 7218 |
case GrabFrozen: |
1344 | 7219 |
if (@global(ErrorPrinting) == true) { |
7220 |
fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n"); |
|
7221 |
} |
|
7222 |
break; |
|
7223 |
default: |
|
7224 |
ok = 1; |
|
7225 |
break; |
|
7226 |
} |
|
7227 |
if (! ok) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7228 |
ENTER_XLIB(); |
1344 | 7229 |
XUngrabKeyboard(myDpy, CurrentTime); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7230 |
LEAVE_XLIB(); |
1344 | 7231 |
RETURN (false); |
7232 |
} |
|
7233 |
||
7234 |
RETURN ( true ); |
|
7235 |
} |
|
295 | 7236 |
} |
1183 | 7237 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7238 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7239 |
^ false |
295 | 7240 |
! |
7241 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7242 |
grabPointerIn:aWindowId withCursor:aCursorId eventMask:eventMask pointerMode:pMode keyboardMode:kMode confineTo:confineId |
295 | 7243 |
"grap the pointer - return true if ok" |
7244 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7245 |
<context: #return> |
4245 | 7246 |
%{ |
295 | 7247 |
|
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7248 |
int result, ok, evMask; |
295 | 7249 |
Window confineWin; |
7250 |
Cursor curs; |
|
7251 |
int pointer_mode, keyboard_mode; |
|
7252 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7253 |
if (ISCONNECTED) { |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7254 |
if (__isExternalAddress(aWindowId)) { |
4245 | 7255 |
if (__isExternalAddress(confineId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7256 |
confineWin = __WindowVal(confineId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7257 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7258 |
confineWin = (Window) None; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7259 |
|
4245 | 7260 |
if (__isExternalAddress(aCursorId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7261 |
curs = __CursorVal(aCursorId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7262 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7263 |
curs = (Cursor) None; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7264 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7265 |
if (pMode == @symbol(sync)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7266 |
pointer_mode = GrabModeSync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7267 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7268 |
pointer_mode = GrabModeAsync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7269 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7270 |
if (kMode == @symbol(sync)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7271 |
keyboard_mode = GrabModeSync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7272 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7273 |
keyboard_mode = GrabModeAsync; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7274 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7275 |
if (__isSmallInteger(eventMask)) |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7276 |
evMask = __intVal(eventMask); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7277 |
else |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7278 |
evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7279 |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
7280 |
|
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7281 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7282 |
ENTER_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7283 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7284 |
result = XGrabPointer(myDpy, |
4245 | 7285 |
__WindowVal(aWindowId), |
7286 |
False, |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7287 |
evMask, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7288 |
pointer_mode, keyboard_mode, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7289 |
confineWin, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7290 |
curs, |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7291 |
CurrentTime); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7292 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7293 |
LEAVE_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7294 |
*/ |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
7295 |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7296 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7297 |
ok = 0; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7298 |
switch (result) { |
4245 | 7299 |
case AlreadyGrabbed: |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7300 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7301 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7302 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7303 |
break; |
4245 | 7304 |
case GrabNotViewable: |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7305 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7306 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7307 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7308 |
break; |
4245 | 7309 |
case GrabInvalidTime: |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7310 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7311 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7312 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7313 |
break; |
4245 | 7314 |
case GrabFrozen: |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7315 |
if (@global(ErrorPrinting) == true) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7316 |
fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n"); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7317 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7318 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7319 |
default: |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7320 |
ok = 1; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7321 |
break; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7322 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7323 |
|
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7324 |
if (! ok) { |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7325 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7326 |
ENTER_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7327 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7328 |
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
|
7329 |
/* |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7330 |
LEAVE_XLIB(); |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7331 |
*/ |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7332 |
RETURN (false); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7333 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7334 |
RETURN ( true ); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7335 |
} |
295 | 7336 |
} |
1183 | 7337 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7338 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7339 |
^ false |
295 | 7340 |
! |
7341 |
||
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7342 |
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
|
7343 |
"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
|
7344 |
|
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7345 |
^ self |
4245 | 7346 |
grabPointerIn:aWindowId |
7347 |
withCursor:aCursorId |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7348 |
eventMask:nil |
4245 | 7349 |
pointerMode:pMode |
7350 |
keyboardMode:kMode |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7351 |
confineTo:confineId |
2195
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7352 |
|
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7353 |
"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
|
7354 |
! |
f64b74292537
arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
7355 |
|
3225 | 7356 |
primUngrabKeyboard |
295 | 7357 |
"release the keyboard" |
7358 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7359 |
<context: #return> |
4245 | 7360 |
%{ |
295 | 7361 |
|
7362 |
if (ISCONNECTED) { |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7363 |
Display *dpy = myDpy; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7364 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7365 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7366 |
XUngrabKeyboard(dpy, CurrentTime); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7367 |
XSync(dpy, 0); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7368 |
LEAVE_XLIB(); |
3225 | 7369 |
|
7370 |
} |
|
7371 |
%}. |
|
7372 |
! |
|
7373 |
||
7374 |
primUngrabPointer |
|
7375 |
"release the pointer" |
|
7376 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7377 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7378 |
%{ |
3225 | 7379 |
|
7380 |
if (ISCONNECTED) { |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7381 |
Display *dpy = myDpy; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7382 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7383 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7384 |
XUngrabPointer(dpy, CurrentTime); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7385 |
XSync(dpy, 0); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7386 |
LEAVE_XLIB(); |
3225 | 7387 |
|
7388 |
} |
|
7389 |
%}. |
|
7390 |
! |
|
7391 |
||
7392 |
ungrabKeyboard |
|
7393 |
"release the keyboard" |
|
7394 |
||
3467 | 7395 |
activeKeyboardGrab notNil ifTrue:[ |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
7396 |
activeKeyboardGrab := nil. |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
7397 |
self primUngrabKeyboard. |
3453 | 7398 |
] |
295 | 7399 |
! |
7400 |
||
1344 | 7401 |
ungrabPointer |
295 | 7402 |
"release the pointer" |
7403 |
||
3467 | 7404 |
activePointerGrab notNil ifTrue:[ |
3608
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
7405 |
activePointerGrab := nil. |
6ac2b6c8fbd8
primDrawBits - additional msb argument
Claus Gittinger <cg@exept.de>
parents:
3603
diff
changeset
|
7406 |
self primUngrabPointer. |
3453 | 7407 |
] |
295 | 7408 |
! ! |
7409 |
||
7410 |
!XWorkstation methodsFor:'graphic context stuff'! |
|
7411 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
7412 |
noClipIn:aDrawableId gc:aGCId |
295 | 7413 |
"disable clipping rectangle" |
7414 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7415 |
<context: #return> |
4245 | 7416 |
%{ |
295 | 7417 |
|
7418 |
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
|
7419 |
GC gc; |
295 | 7420 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7421 |
if (ISCONNECTED) { |
1344 | 7422 |
if (__isExternalAddress(aGCId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7423 |
gc = __GCVal(aGCId); |
1344 | 7424 |
gcv.clip_mask = None; |
1974 | 7425 |
ENTER_XLIB(); |
1344 | 7426 |
XChangeGC(myDpy, gc, GCClipMask, &gcv); |
1974 | 7427 |
LEAVE_XLIB(); |
1344 | 7428 |
RETURN ( self ); |
7429 |
} |
|
295 | 7430 |
} |
7431 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7432 |
self primitiveFailedOrClosedConnection |
295 | 7433 |
! |
7434 |
||
1344 | 7435 |
setBackground:bgColorIndex in:aGCId |
295 | 7436 |
"set background color to be drawn with" |
7437 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7438 |
<context: #return> |
4245 | 7439 |
%{ |
295 | 7440 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7441 |
if (ISCONNECTED) { |
1344 | 7442 |
if (__isExternalAddress(aGCId) |
7443 |
&& __isSmallInteger(bgColorIndex)) { |
|
1974 | 7444 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7445 |
XSetBackground(myDpy, __GCVal(aGCId), __intVal(bgColorIndex)); |
1974 | 7446 |
LEAVE_XLIB(); |
1344 | 7447 |
RETURN ( self ); |
7448 |
} |
|
295 | 7449 |
} |
7450 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7451 |
self primitiveFailedOrClosedConnection |
295 | 7452 |
! |
7453 |
||
1344 | 7454 |
setBitmapMask:aBitmapId in:aGCId |
295 | 7455 |
"set or clear the drawing mask - a bitmap mask using current fg/bg" |
7456 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7457 |
<context: #return> |
4245 | 7458 |
%{ |
295 | 7459 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7460 |
GC gc; |
295 | 7461 |
Pixmap bitmap; |
7462 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7463 |
if (ISCONNECTED) { |
1344 | 7464 |
Display *dpy = myDpy; |
7465 |
||
7466 |
if (__isExternalAddress(aGCId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7467 |
gc = __GCVal(aGCId); |
1344 | 7468 |
if (__isExternalAddress(aBitmapId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7469 |
bitmap = __PixmapVal(aBitmapId); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7470 |
ENTER_XLIB(); |
1344 | 7471 |
XSetStipple(dpy, gc, bitmap); |
7472 |
XSetFillStyle(dpy, gc, FillOpaqueStippled); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7473 |
LEAVE_XLIB(); |
1344 | 7474 |
RETURN ( self ); |
7475 |
} |
|
7476 |
if (aBitmapId == nil) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7477 |
ENTER_XLIB(); |
1344 | 7478 |
XSetFillStyle(dpy, gc, FillSolid); |
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
7479 |
LEAVE_XLIB(); |
1344 | 7480 |
RETURN ( self ); |
7481 |
} |
|
7482 |
} |
|
295 | 7483 |
} |
7484 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7485 |
self primitiveFailedOrClosedConnection |
295 | 7486 |
! |
7487 |
||
1681
069ede63fb19
pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents:
1627
diff
changeset
|
7488 |
setClipByChildren:aBool in:aDrawableId gc:aGCId |
295 | 7489 |
"enable/disable drawing into child views" |
7490 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7491 |
<context: #return> |
4245 | 7492 |
%{ |
295 | 7493 |
|
7494 |
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
|
7495 |
GC gc; |
295 | 7496 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7497 |
if (ISCONNECTED) { |
1694 | 7498 |
if (__isExternalAddress(aGCId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7499 |
gc = __GCVal(aGCId); |
1694 | 7500 |
if (aBool == true) |
7501 |
gcv.subwindow_mode = ClipByChildren; |
|
7502 |
else |
|
7503 |
gcv.subwindow_mode = IncludeInferiors; |
|
7504 |
||
1974 | 7505 |
ENTER_XLIB(); |
1694 | 7506 |
XChangeGC(myDpy, gc, GCSubwindowMode, &gcv); |
1974 | 7507 |
LEAVE_XLIB(); |
1694 | 7508 |
RETURN ( self ); |
7509 |
} |
|
295 | 7510 |
} |
7511 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7512 |
self primitiveFailedOrClosedConnection |
295 | 7513 |
! |
7514 |
||
1709
342fc0eb3517
pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents:
1695
diff
changeset
|
7515 |
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId |
295 | 7516 |
"clip to a rectangle" |
7517 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7518 |
<context: #return> |
4245 | 7519 |
%{ |
295 | 7520 |
|
7521 |
XRectangle r; |
|
7522 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7523 |
if (ISCONNECTED) { |
1344 | 7524 |
if (__isExternalAddress(aGCId) |
7525 |
&& __bothSmallInteger(clipX, clipY) |
|
7526 |
&& __bothSmallInteger(clipWidth, clipHeight)) { |
|
7527 |
r.x = __intVal(clipX); |
|
7528 |
r.y = __intVal(clipY); |
|
7529 |
r.width = __intVal(clipWidth); |
|
7530 |
r.height = __intVal(clipHeight); |
|
1974 | 7531 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7532 |
XSetClipRectangles(myDpy, __GCVal(aGCId), 0, 0, &r, 1, Unsorted); |
1974 | 7533 |
LEAVE_XLIB(); |
1344 | 7534 |
RETURN ( self ); |
7535 |
} |
|
295 | 7536 |
} |
7537 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7538 |
self primitiveFailedOrClosedConnection |
295 | 7539 |
! |
7540 |
||
1344 | 7541 |
setDashes:dashList dashOffset:offset in:aGCId |
788 | 7542 |
"set line attributes" |
7543 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7544 |
<context: #return> |
4245 | 7545 |
%{ |
788 | 7546 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7547 |
if (ISCONNECTED) { |
1344 | 7548 |
if (__isExternalAddress(aGCId) |
7549 |
&& __isSmallInteger(offset) |
|
7550 |
&& __isByteArray(dashList)) { |
|
1974 | 7551 |
ENTER_XLIB(); |
4245 | 7552 |
XSetDashes(myDpy, __GCVal(aGCId), |
1344 | 7553 |
__intVal(offset), |
7554 |
__ByteArrayInstPtr(dashList)->ba_element, |
|
7555 |
__byteArraySize(dashList)); |
|
1974 | 7556 |
LEAVE_XLIB(); |
1344 | 7557 |
RETURN ( self ); |
7558 |
} |
|
788 | 7559 |
} |
7560 |
bad: ; |
|
7561 |
%}. |
|
7562 |
" |
|
7563 |
either aGCId is invalid, |
|
7564 |
and/or dashList is not a byteArray |
|
7565 |
and/or offset is not a smallInteger |
|
7566 |
" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7567 |
self primitiveFailedOrClosedConnection |
788 | 7568 |
! |
7569 |
||
1344 | 7570 |
setFont:aFontId in:aGCId |
295 | 7571 |
"set font to be drawn in" |
7572 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7573 |
<context: #return> |
4245 | 7574 |
%{ |
295 | 7575 |
|
7576 |
XFontStruct *f; |
|
7577 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7578 |
if (ISCONNECTED) { |
1344 | 7579 |
if (__isExternalAddress(aFontId) |
7580 |
&& __isExternalAddress(aGCId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7581 |
f = (XFontStruct *) __FontVal(aFontId); |
1974 | 7582 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7583 |
XSetFont(myDpy, __GCVal(aGCId), f->fid); |
1974 | 7584 |
LEAVE_XLIB(); |
1344 | 7585 |
RETURN ( self ); |
7586 |
} |
|
295 | 7587 |
} |
7588 |
%}. |
|
7589 |
" |
|
7590 |
aGCId and/or aFontId are invalid |
|
7591 |
" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7592 |
self primitiveFailedOrClosedConnection |
295 | 7593 |
! |
7594 |
||
1344 | 7595 |
setForeground:fgColorIndex background:bgColorIndex in:aGCId |
295 | 7596 |
"set foreground and background colors to be drawn with" |
7597 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7598 |
<context: #return> |
4245 | 7599 |
%{ |
295 | 7600 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7601 |
GC gc; |
295 | 7602 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7603 |
if (ISCONNECTED) { |
1344 | 7604 |
Display *dpy = myDpy; |
7605 |
if (__bothSmallInteger(fgColorIndex, bgColorIndex) |
|
7606 |
&& __isExternalAddress(aGCId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7607 |
gc = __GCVal(aGCId); |
1344 | 7608 |
|
1974 | 7609 |
ENTER_XLIB(); |
1344 | 7610 |
XSetForeground(dpy, gc, __intVal(fgColorIndex)); |
7611 |
XSetBackground(dpy, gc, __intVal(bgColorIndex)); |
|
1974 | 7612 |
LEAVE_XLIB(); |
1344 | 7613 |
RETURN ( self ); |
7614 |
} |
|
295 | 7615 |
} |
7616 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7617 |
self primitiveFailedOrClosedConnection |
295 | 7618 |
! |
7619 |
||
1344 | 7620 |
setForeground:fgColorIndex in:aGCId |
295 | 7621 |
"set foreground color to be drawn with" |
7622 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7623 |
<context: #return> |
4245 | 7624 |
%{ |
295 | 7625 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7626 |
if (ISCONNECTED) { |
1344 | 7627 |
if (__isExternalAddress(aGCId) |
7628 |
&& __isSmallInteger(fgColorIndex)) { |
|
1974 | 7629 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7630 |
XSetForeground(myDpy, __GCVal(aGCId), __intVal(fgColorIndex)); |
1974 | 7631 |
LEAVE_XLIB(); |
1344 | 7632 |
RETURN ( self ); |
7633 |
} |
|
295 | 7634 |
} |
7635 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7636 |
self primitiveFailedOrClosedConnection |
295 | 7637 |
! |
7638 |
||
1344 | 7639 |
setFunction:aFunctionSymbol in:aGCId |
295 | 7640 |
"set alu function to be drawn with" |
7641 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7642 |
<context: #return> |
4245 | 7643 |
%{ |
295 | 7644 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7645 |
GC gc; |
295 | 7646 |
int fun = -1; |
7647 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7648 |
if (ISCONNECTED) { |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7649 |
if (__isExternalAddress(aGCId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7650 |
gc = __GCVal(aGCId); |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7651 |
if (aFunctionSymbol == @symbol(copy)) fun = GXcopy; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7652 |
else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7653 |
else if (aFunctionSymbol == @symbol(xor)) fun = GXxor; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7654 |
else if (aFunctionSymbol == @symbol(and)) fun = GXand; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7655 |
else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7656 |
else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7657 |
else if (aFunctionSymbol == @symbol(or)) fun = GXor; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7658 |
else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7659 |
else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7660 |
else if (aFunctionSymbol == @symbol(invert)) fun = GXinvert; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7661 |
else if (aFunctionSymbol == @symbol(clear)) fun = GXclear; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7662 |
else if (aFunctionSymbol == @symbol(set)) fun = GXset; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7663 |
else if (aFunctionSymbol == @symbol(noop)) fun = GXnoop; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7664 |
else if (aFunctionSymbol == @symbol(equiv)) fun = GXequiv; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7665 |
else if (aFunctionSymbol == @symbol(nand)) fun = GXnand; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7666 |
if (fun != -1) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7667 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7668 |
XSetFunction(myDpy, gc, fun); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7669 |
LEAVE_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7670 |
RETURN ( self ); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7671 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7672 |
} |
295 | 7673 |
} |
7674 |
%}. |
|
7675 |
" |
|
7676 |
either aGCId is not an integer, or an invalid symbol |
|
7677 |
was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse, |
|
7678 |
#andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details. |
|
7679 |
" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7680 |
self primitiveFailedOrClosedConnection |
295 | 7681 |
! |
7682 |
||
1344 | 7683 |
setGraphicsExposures:aBoolean in:aGCId |
295 | 7684 |
"set or clear the graphics exposures flag" |
7685 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7686 |
<context: #return> |
4245 | 7687 |
%{ |
295 | 7688 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7689 |
if (ISCONNECTED) { |
1344 | 7690 |
if (__isExternalAddress(aGCId)) { |
1974 | 7691 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7692 |
XSetGraphicsExposures(myDpy, __GCVal(aGCId), (aBoolean==true)?1:0); |
1974 | 7693 |
LEAVE_XLIB(); |
1344 | 7694 |
RETURN ( self ); |
7695 |
} |
|
295 | 7696 |
} |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7697 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7698 |
self primitiveFailedOrClosedConnection |
295 | 7699 |
! |
7700 |
||
1344 | 7701 |
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId |
4245 | 7702 |
"set line attributes; |
1455 | 7703 |
lineStyle must be one of #solid, #dashed or #doubleDashed; |
7704 |
capStyle one of: #notLast, #butt, #round or #projecting; |
|
7705 |
joinStyle one of: #miter, #bevel or #round." |
|
295 | 7706 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7707 |
<context: #return> |
4245 | 7708 |
%{ |
295 | 7709 |
|
7710 |
int x_style, x_cap, x_join; |
|
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7711 |
static char dashList[2] = { 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7712 |
static char dotList[2] = { 4,4 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7713 |
static char dashDotList[4] = { 4,1 , 1,1 }; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7714 |
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
|
7715 |
char *x_dashes = 0; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7716 |
int x_nDash; |
295 | 7717 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7718 |
if (ISCONNECTED) { |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7719 |
if (__isExternalAddress(aGCId) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7720 |
&& __isSmallInteger(aNumber)) { |
2541 | 7721 |
Display *dpy = myDpy; |
7722 |
||
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7723 |
if (lineStyle == @symbol(solid)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7724 |
x_dashes = (char *)0; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7725 |
x_style = LineSolid; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7726 |
} else if (lineStyle == @symbol(dashed)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7727 |
x_dashes = dashList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7728 |
x_nDash = sizeof(dashList); |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
7729 |
x_style = LineOnOffDash; |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7730 |
} else if (lineStyle == @symbol(doubleDashed)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7731 |
x_dashes = dashList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7732 |
x_nDash = sizeof(dashList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7733 |
x_style = LineDoubleDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7734 |
} else if (lineStyle == @symbol(dotted)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7735 |
x_dashes = dotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7736 |
x_nDash = sizeof(dotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7737 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7738 |
} else if (lineStyle == @symbol(dashDot)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7739 |
x_dashes = dashDotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7740 |
x_nDash = sizeof(dashDotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7741 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7742 |
} else if (lineStyle == @symbol(dashDotDot)) { |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7743 |
x_dashes = dashDotDotList; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7744 |
x_nDash = sizeof(dashDotDotList); |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7745 |
x_style = LineOnOffDash; |
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7746 |
} else goto bad; |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7747 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7748 |
if (capStyle == @symbol(notLast)) x_cap = CapNotLast; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7749 |
else if (capStyle == @symbol(butt)) x_cap = CapButt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7750 |
else if (capStyle == @symbol(round)) x_cap = CapRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7751 |
else if (capStyle == @symbol(projecting)) x_cap = CapProjecting; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7752 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7753 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7754 |
if (joinStyle == @symbol(miter)) x_join = JoinMiter; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7755 |
else if (joinStyle == @symbol(bevel)) x_join = JoinBevel; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7756 |
else if (joinStyle == @symbol(round)) x_join = JoinRound; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7757 |
else goto bad; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7758 |
|
1974 | 7759 |
ENTER_XLIB(); |
2361
b721237f3265
added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents:
2330
diff
changeset
|
7760 |
if (x_dashes) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7761 |
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
|
7762 |
} |
2541 | 7763 |
XSetLineAttributes(dpy, |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7764 |
__GCVal(aGCId), __intVal(aNumber), |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7765 |
x_style, x_cap, x_join); |
1974 | 7766 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7767 |
RETURN ( self ); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
7768 |
} |
295 | 7769 |
} |
7770 |
bad: ; |
|
7771 |
%}. |
|
7772 |
" |
|
7773 |
either aGCId is invalid, |
|
1455 | 7774 |
and/or lineWidth is not a smallInteger, |
295 | 7775 |
and/or lineStyle is none of #solid, #dashed, #doubleDashed |
7776 |
and/or capStyle is none of #notLast, #butt, #round, #projecting |
|
7777 |
and/or joinStyle is none of #miter, #bevel, #round |
|
7778 |
" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7779 |
self primitiveFailedOrClosedConnection |
295 | 7780 |
! |
7781 |
||
1344 | 7782 |
setMaskOriginX:orgX y:orgY in:aGCid |
295 | 7783 |
"set the mask origin" |
7784 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7785 |
<context: #return> |
4245 | 7786 |
%{ |
295 | 7787 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7788 |
if (ISCONNECTED) { |
1344 | 7789 |
if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) { |
1974 | 7790 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7791 |
XSetTSOrigin(myDpy, __GCVal(aGCid), __intVal(orgX), __intVal(orgY)); |
1974 | 7792 |
LEAVE_XLIB(); |
1344 | 7793 |
RETURN ( self ); |
7794 |
} |
|
295 | 7795 |
} |
7796 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7797 |
self primitiveFailedOrClosedConnection |
295 | 7798 |
! |
7799 |
||
1344 | 7800 |
setPixmapMask:aPixmapId in:aGCId |
295 | 7801 |
"set or clear the drawing mask - a pixmap mask providing full color" |
7802 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7803 |
<context: #return> |
4245 | 7804 |
%{ |
295 | 7805 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
7806 |
GC gc; |
295 | 7807 |
Pixmap pixmap; |
7808 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
7809 |
if (ISCONNECTED) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7810 |
Display *dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7811 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7812 |
if (__isExternalAddress(aGCId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7813 |
gc = __GCVal(aGCId); |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7814 |
if (__isExternalAddress(aPixmapId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
7815 |
pixmap = __PixmapVal(aPixmapId); |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7816 |
ENTER_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7817 |
XSetTile(dpy, gc, pixmap); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7818 |
XSetFillStyle(dpy, gc, FillTiled); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7819 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7820 |
RETURN ( self ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7821 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7822 |
if (aPixmapId == nil) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7823 |
ENTER_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7824 |
XSetFillStyle(dpy, gc, FillSolid); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7825 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7826 |
RETURN ( self ); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7827 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7828 |
} |
295 | 7829 |
} |
7830 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7831 |
self primitiveFailedOrClosedConnection |
295 | 7832 |
! ! |
7833 |
||
3883 | 7834 |
!XWorkstation methodsFor:'initialization & release'! |
295 | 7835 |
|
1344 | 7836 |
closeConnection |
295 | 7837 |
"close down the connection to the X-server" |
7838 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7839 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
7840 |
|
3061
060d483207c2
allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents:
3058
diff
changeset
|
7841 |
"/ 'closing' errorPrintCR. |
060d483207c2
allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents:
3058
diff
changeset
|
7842 |
"/ thisContext fullPrintAll. |
060d483207c2
allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents:
3058
diff
changeset
|
7843 |
|
3787
58b1a317d361
Need some more UNLIMITEDSTACKS to avoid crashes on Solaris 8 & 9
Stefan Vogel <sv@exept.de>
parents:
3779
diff
changeset
|
7844 |
%{ /* UNLIMITEDSTACK */ /* calls XSync()! */ |
295 | 7845 |
if (ISCONNECTED) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7846 |
Display *dpy = myDpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7847 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7848 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7849 |
__INST(displayId) = nil; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7850 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7851 |
XCloseDisplay(dpy); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
7852 |
LEAVE_XLIB(); |
295 | 7853 |
} |
7854 |
%} |
|
7855 |
! |
|
7856 |
||
3015 | 7857 |
emergencyCloseConnection |
7858 |
"low level close of the displays connection (without sending any buffered |
|
7859 |
requests to the display). Only used in case of emergency (brokenConnection)" |
|
7860 |
||
4245 | 7861 |
%{ |
3015 | 7862 |
if (ISCONNECTED) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7863 |
Display *dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7864 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7865 |
__INST(displayId) = nil; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
7866 |
close(ConnectionNumber(dpy)); |
3015 | 7867 |
} |
7868 |
%} |
|
7869 |
! |
|
7870 |
||
3216 | 7871 |
eventBufferSize |
7872 |
%{ |
|
7873 |
RETURN ( __MKSMALLINT(sizeof(XEvent) + 100) ); |
|
7874 |
%} |
|
7875 |
! |
|
7876 |
||
1344 | 7877 |
initializeDefaultValues |
2685
094ce08f9fc5
made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents:
2671
diff
changeset
|
7878 |
activateOnClick := false. |
2862
2f43bf146110
moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents:
2856
diff
changeset
|
7879 |
super initializeDefaultValues. |
295 | 7880 |
! |
7881 |
||
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7882 |
initializeDeviceSignals |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7883 |
super initializeDeviceSignals. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7884 |
|
2984 | 7885 |
deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal. |
2856 | 7886 |
deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal. |
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7887 |
|
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7888 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7889 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7890 |
ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError. |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7891 |
! |
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7892 |
|
1344 | 7893 |
initializeFor:aDisplayName |
295 | 7894 |
"initialize the receiver for a connection to an X-Server; |
7895 |
the argument, aDisplayName may be nil (for the default server from |
|
4245 | 7896 |
DISPLAY-variable or command line argument) or the name of the server |
295 | 7897 |
as hostname:number" |
7898 |
||
2286 | 7899 |
displayId notNil ifTrue:[ |
3806 | 7900 |
"/ already connected - you bad guy try to trick me manually ? |
7901 |
^ self |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3615
diff
changeset
|
7902 |
]. |
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3615
diff
changeset
|
7903 |
|
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3615
diff
changeset
|
7904 |
displayId := self openConnectionTo:aDisplayName. |
295 | 7905 |
displayId isNil ifTrue:[ |
3806 | 7906 |
"/ could not connect. |
7907 |
DeviceOpenErrorSignal raiseWith:aDisplayName. |
|
7908 |
^ nil |
|
295 | 7909 |
]. |
7910 |
||
4245 | 7911 |
xlibTimeout := xlibTimeout ? DefaultXLibTimeout. |
7912 |
xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation. |
|
7913 |
||
295 | 7914 |
dispatching := false. |
7915 |
dispatchingExpose := false. |
|
7916 |
isSlow := false. |
|
7917 |
shiftDown := false. |
|
7918 |
ctrlDown := false. |
|
7919 |
metaDown := false. |
|
7920 |
altDown := false. |
|
7921 |
motionEventCompression := true. |
|
7922 |
buttonsPressed := 0. |
|
3630
2b2f6649c014
Change Workstation initialization.
Stefan Vogel <sv@exept.de>
parents:
3615
diff
changeset
|
7923 |
displayName := aDisplayName. |
295 | 7924 |
|
3418 | 7925 |
listOfXFonts := nil. |
7926 |
||
7927 |
atoms := nil. |
|
295 | 7928 |
protocolsAtom := nil. |
7929 |
deleteWindowAtom := nil. |
|
7930 |
saveYourselfAtom := nil. |
|
7931 |
quitAppAtom := nil. |
|
7932 |
||
2992 | 7933 |
self initializeDeviceResourceTables. |
295 | 7934 |
self initializeScreenProperties. |
7935 |
||
7936 |
self initializeDefaultValues. |
|
7937 |
self initializeSpecialFlags. |
|
7938 |
self initializeKeyboardMap. |
|
2855
f1fca530bab1
moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
2791
diff
changeset
|
7939 |
self initializeDeviceSignals. |
2992 | 7940 |
|
7941 |
self initializeViewStyle. |
|
295 | 7942 |
! |
7943 |
||
1344 | 7944 |
initializeModifierMappings |
3200
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
7945 |
"initialize keyboard modifiers. |
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
7946 |
We assume that mod1 are the META modifiers and mod2 are the ALT modifiers, |
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
7947 |
but if any of them contains the Num_Lock key, it is disregarded." |
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
7948 |
|
4067
95d3cc7b4f62
getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
7949 |
|map| |
295 | 7950 |
|
4245 | 7951 |
super initializeModifierMappings. |
295 | 7952 |
|
3322
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
7953 |
rawKeySymTranslation := RawKeySymTranslation. |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
7954 |
|
295 | 7955 |
map := self modifierMapping. |
342 | 7956 |
map isNil ifTrue:[ |
4082 | 7957 |
"/ |
7958 |
"/ mhmh - a crippled Xlib which does not provide modifier mappings |
|
7959 |
"/ setup some reasonable default. If that is not sufficient, |
|
7960 |
"/ you have to change things from your display.rc file. |
|
7961 |
"/ |
|
7962 |
altModifierMask := self modifier1Mask. |
|
7963 |
metaModifierMask := self modifier2Mask. |
|
342 | 7964 |
] ifFalse:[ |
4082 | 7965 |
| mod stringFromKeyCode nonNilOnes | |
7966 |
||
7967 |
altModifierMask := 0. |
|
7968 |
metaModifierMask := 0. |
|
7969 |
||
4245 | 7970 |
stringFromKeyCode := [:key | |
7971 |
|s| |
|
7972 |
s := self stringFromKeycode:key. |
|
7973 |
s notNil |
|
7974 |
ifTrue:[s asSymbol] |
|
4082 | 7975 |
ifFalse:[nil] |
7976 |
]. |
|
7977 |
nonNilOnes := [:str | str notNil]. |
|
7978 |
||
7979 |
mod := map at:1. |
|
7980 |
mod notNil ifTrue:[ |
|
7981 |
shiftModifiers := mod collect:stringFromKeyCode thenSelect:nonNilOnes. |
|
7982 |
]. |
|
7983 |
mod := map at:3. |
|
7984 |
mod notNil ifTrue:[ |
|
7985 |
ctrlModifiers := mod collect:stringFromKeyCode thenSelect:nonNilOnes. |
|
7986 |
]. |
|
7987 |
mod := map at:4. |
|
7988 |
mod notNil ifTrue:[ |
|
7989 |
mod := mod collect:stringFromKeyCode thenSelect:nonNilOnes. |
|
7990 |
(mod includes:'Num_Lock') ifFalse:[ |
|
7991 |
metaModifiers := mod. |
|
7992 |
metaModifierMask := 1 bitShift:(4-1). |
|
7993 |
]. |
|
7994 |
]. |
|
7995 |
mod := map at:5. |
|
7996 |
mod notNil ifTrue:[ |
|
7997 |
mod := mod collect:stringFromKeyCode thenSelect:nonNilOnes. |
|
7998 |
(mod includes:'Num_Lock') ifFalse:[ |
|
7999 |
altModifiers := mod. |
|
8000 |
altModifierMask := 1 bitShift:(5-1). |
|
8001 |
]. |
|
8002 |
] |
|
4245 | 8003 |
]. |
3200
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
8004 |
|
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
8005 |
" |
4067
95d3cc7b4f62
getEvent: return symbols for keys (used to return strings)
Claus Gittinger <cg@exept.de>
parents:
4061
diff
changeset
|
8006 |
Display initializeModifierMappings |
3200
f92ccb3cac8e
Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents:
3177
diff
changeset
|
8007 |
" |
295 | 8008 |
|
8009 |
"Modified: 1.12.1995 / 23:44:40 / stefan" |
|
8010 |
! |
|
8011 |
||
1344 | 8012 |
initializeScreenProperties |
3214 | 8013 |
|masks| |
8014 |
||
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
8015 |
super initializeScreenProperties. |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
8016 |
|
3214 | 8017 |
hasShapeExtension := self queryShapeExtension. |
8018 |
hasShmExtension := self querySHMExtension. |
|
8019 |
hasDPSExtension := self queryDPSExtension. |
|
8020 |
hasXVideoExtension := self queryXVideoExtension. |
|
8021 |
hasMbufExtension := self queryMBUFExtension. |
|
8022 |
hasPEXExtension := self queryPEXExtension. |
|
8023 |
hasImageExtension := self queryXIEExtension. |
|
8024 |
hasInputExtension := self queryXIExtension. |
|
8025 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
8026 |
primaryAtom := self atomIDOf:#PRIMARY. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
8027 |
stringAtom := self atomIDOf:#STRING. |
3790 | 8028 |
clipboardAtom := self atomIDOf:#CLIPBOARD. |
3214 | 8029 |
|
8030 |
altModifierMask := self modifier2Mask. |
|
8031 |
metaModifierMask := self modifier1Mask. |
|
8032 |
||
8033 |
screen := self queryDefaultScreen. |
|
8034 |
depth := self queryDepth. |
|
8035 |
ncells := self queryCells. |
|
8036 |
width := self queryWidth. |
|
8037 |
height := self queryHeight. |
|
8038 |
widthMM := self queryWidthMM. |
|
8039 |
heightMM := self queryHeightMM. |
|
8040 |
blackpixel := self queryBlackPixel. |
|
8041 |
whitepixel := self queryWhitePixel. |
|
8042 |
||
8043 |
monitorType := #unknown. |
|
8044 |
visualType := self queryDefaultVisualType. |
|
8045 |
||
8046 |
hasColors := hasGreyscales := true. |
|
8047 |
(visualType == #StaticGray |
|
8048 |
or:[ visualType == #GrayScale]) ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8049 |
hasColors := false. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8050 |
monitorType := #monochrome. |
3214 | 8051 |
]. |
8052 |
||
8053 |
ncells == 2 ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8054 |
hasColors := hasGreyscales := false. |
3214 | 8055 |
]. |
8056 |
||
8057 |
masks := self queryRGBMasks. |
|
8058 |
redMask := masks at:1. |
|
8059 |
greenMask := masks at:2. |
|
8060 |
blueMask := masks at:3. |
|
8061 |
bitsPerRGB := masks at:4. |
|
8062 |
||
8063 |
visualType == #TrueColor ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8064 |
redShift := redMask lowBit - 1. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8065 |
greenShift := greenMask lowBit - 1. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8066 |
blueShift := blueMask lowBit - 1. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8067 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8068 |
bitsRed := redMask highBit - redMask lowBit + 1. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8069 |
bitsGreen := greenMask highBit - greenMask lowBit + 1. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8070 |
bitsBlue := blueMask highBit - blueMask lowBit + 1. |
3214 | 8071 |
]. |
8072 |
||
1627
e7ba6be03b14
removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents:
1610
diff
changeset
|
8073 |
%{ |
295 | 8074 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
8075 |
Display *dpy; |
295 | 8076 |
int scr; |
8077 |
Visual *visual; |
|
8078 |
XVisualInfo viproto; |
|
8079 |
XVisualInfo *vip; /* retured info */ |
|
8080 |
int maxRGBDepth; |
|
8081 |
int rgbRedMask, rgbGreenMask, rgbBlueMask; |
|
8082 |
int rgbVisualID; |
|
8083 |
int nvi, i; |
|
8084 |
char *type, *nm; |
|
8085 |
int dummy; |
|
8086 |
||
8087 |
if (ISCONNECTED) { |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8088 |
dpy = myDpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8089 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8090 |
/* |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8091 |
* look for RGB visual |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8092 |
*/ |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8093 |
nvi = 0; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8094 |
viproto.screen = scr; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8095 |
vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8096 |
maxRGBDepth = 0; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8097 |
for (i = 0; i < nvi; i++) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8098 |
switch (vip[i].class) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8099 |
case TrueColor: |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8100 |
if (vip[i].depth > maxRGBDepth) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8101 |
maxRGBDepth = vip[i].depth; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8102 |
rgbRedMask = vip[i].red_mask; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8103 |
rgbGreenMask = vip[i].green_mask; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8104 |
rgbBlueMask = vip[i].blue_mask; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8105 |
rgbVisualID = vip[i].visualid; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8106 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8107 |
break; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8108 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8109 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8110 |
if (vip) XFree ((char *) vip); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8111 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8112 |
if (maxRGBDepth) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8113 |
__INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
8114 |
} |
815
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
8115 |
} |
1e659479b292
call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents:
811
diff
changeset
|
8116 |
%}. |
295 | 8117 |
! |
8118 |
||
1344 | 8119 |
initializeSpecialFlags |
295 | 8120 |
"perform additional special server implementation flags" |
8121 |
||
8122 |
"/ |
|
8123 |
"/ assume we have it ... (should check) |
|
8124 |
"/ |
|
8125 |
hasSaveUnder := true. |
|
8126 |
ignoreBackingStore := false. |
|
8127 |
||
8128 |
(self serverVendor = 'X11/NeWS') ifTrue:[ |
|
1344 | 8129 |
"/ |
8130 |
"/ this is a kludge around a bug in the X11/NeWS server, |
|
8131 |
"/ which does not correctly handle saveUnder |
|
8132 |
"/ |
|
8133 |
hasSaveUnder := false. |
|
295 | 8134 |
]. |
8135 |
! |
|
8136 |
||
2286 | 8137 |
openConnectionTo:dpyName |
8138 |
"open a connection to some display; |
|
3214 | 8139 |
return displayId if ok, nil of not ok" |
2286 | 8140 |
|
3800 | 8141 |
%{ /* STACK:100000 */ /* XOpenDisplay() calls gethostbyname() */ |
2286 | 8142 |
Display *dpy; |
8143 |
int i; |
|
8144 |
char *nm; |
|
8145 |
||
8146 |
if (__isString(dpyName)) |
|
3806 | 8147 |
nm = (char *) __stringVal(dpyName); |
2286 | 8148 |
else { |
3806 | 8149 |
nm = NULL; |
2286 | 8150 |
} |
8151 |
dpy = XOpenDisplay(nm); |
|
8152 |
||
8153 |
if (dpy) { |
|
3806 | 8154 |
static int firstCall = 1; |
8155 |
OBJ dpyID; |
|
8156 |
||
8157 |
dpyID = __MKEXTERNALADDRESS(dpy); |
|
8158 |
||
8159 |
if (firstCall) { |
|
8160 |
firstCall = 0; |
|
8161 |
XSetErrorHandler(__XErrorHandler__); |
|
8162 |
XSetIOErrorHandler(__XIOErrorHandler__); |
|
8163 |
} |
|
8164 |
RETURN (dpyID); |
|
3214 | 8165 |
} |
8166 |
%}. |
|
8167 |
^ nil |
|
2286 | 8168 |
! |
8169 |
||
3487 | 8170 |
queryBlackPixel |
8171 |
%{ /* NOCONTEXT */ |
|
8172 |
||
8173 |
if (ISCONNECTED) { |
|
8174 |
Display *dpy; |
|
8175 |
int scr; |
|
8176 |
||
8177 |
dpy = myDpy; |
|
8178 |
scr = DefaultScreen(dpy); |
|
8179 |
RETURN ( __MKSMALLINT(BlackPixel(dpy, scr))); |
|
8180 |
} |
|
8181 |
%}. |
|
8182 |
^ nil |
|
8183 |
||
8184 |
" |
|
8185 |
Display queryBlackPixel |
|
8186 |
" |
|
8187 |
! |
|
8188 |
||
8189 |
queryCells |
|
8190 |
%{ /* NOCONTEXT */ |
|
8191 |
||
8192 |
if (ISCONNECTED) { |
|
8193 |
Display *dpy; |
|
8194 |
int scr; |
|
8195 |
||
8196 |
dpy = myDpy; |
|
8197 |
scr = DefaultScreen(dpy); |
|
8198 |
RETURN ( __MKSMALLINT(DisplayCells(dpy, scr))); |
|
8199 |
} |
|
8200 |
%}. |
|
8201 |
^ nil |
|
8202 |
||
8203 |
" |
|
4245 | 8204 |
Display queryCells |
3487 | 8205 |
" |
8206 |
! |
|
8207 |
||
8208 |
queryDPSExtension |
|
8209 |
%{ /* NOCONTEXT */ |
|
8210 |
||
8211 |
#ifdef DPS |
|
8212 |
if (ISCONNECTED) { |
|
8213 |
Display *dpy; |
|
8214 |
int dummy; |
|
8215 |
||
8216 |
dpy = myDpy; |
|
8217 |
||
8218 |
if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy)) { |
|
8219 |
RETURN ( true ); |
|
8220 |
} |
|
8221 |
} |
|
8222 |
#endif |
|
8223 |
%}. |
|
8224 |
^ false |
|
8225 |
||
8226 |
" |
|
4245 | 8227 |
Display queryDPSExtension |
3487 | 8228 |
" |
8229 |
! |
|
8230 |
||
8231 |
queryDefaultScreen |
|
8232 |
%{ /* NOCONTEXT */ |
|
8233 |
||
8234 |
if (ISCONNECTED) { |
|
8235 |
Display *dpy; |
|
8236 |
||
8237 |
dpy = myDpy; |
|
8238 |
RETURN ( __MKSMALLINT(DefaultScreen(dpy))); |
|
8239 |
} |
|
8240 |
%}. |
|
8241 |
^ nil |
|
8242 |
||
8243 |
" |
|
4245 | 8244 |
Display queryDefaultScreen |
3487 | 8245 |
" |
8246 |
! |
|
8247 |
||
8248 |
queryDefaultVisualType |
|
8249 |
%{ /* NOCONTEXT */ |
|
8250 |
||
8251 |
if (ISCONNECTED) { |
|
8252 |
Display *dpy; |
|
8253 |
Visual *visual; |
|
8254 |
||
8255 |
dpy = myDpy; |
|
8256 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
8257 |
switch (visual->class) { |
|
8258 |
case StaticGray: |
|
8259 |
RETURN ( @symbol(StaticGray) ); |
|
8260 |
case GrayScale: |
|
8261 |
RETURN ( @symbol(GrayScale) ); |
|
8262 |
case StaticColor: |
|
8263 |
RETURN ( @symbol(StaticColor) ); |
|
8264 |
case PseudoColor: |
|
8265 |
RETURN ( @symbol(PseudoColor) ); |
|
8266 |
case TrueColor: |
|
8267 |
RETURN ( @symbol(TrueColor) ); |
|
8268 |
case DirectColor: |
|
8269 |
RETURN ( @symbol(DirectColor) ); |
|
8270 |
} |
|
8271 |
} |
|
8272 |
%}. |
|
8273 |
^ nil |
|
8274 |
||
8275 |
" |
|
8276 |
Display queryDefaultVisualType |
|
8277 |
" |
|
8278 |
! |
|
8279 |
||
8280 |
queryDepth |
|
8281 |
%{ /* NOCONTEXT */ |
|
8282 |
||
8283 |
if (ISCONNECTED) { |
|
8284 |
Display *dpy; |
|
8285 |
int scr; |
|
8286 |
||
8287 |
dpy = myDpy; |
|
8288 |
scr = DefaultScreen(dpy); |
|
8289 |
RETURN ( __MKSMALLINT(DisplayPlanes(dpy, scr))); |
|
8290 |
} |
|
8291 |
%}. |
|
8292 |
^ nil |
|
8293 |
||
8294 |
" |
|
4245 | 8295 |
Display queryDepth |
3487 | 8296 |
" |
8297 |
! |
|
8298 |
||
8299 |
queryHeight |
|
8300 |
%{ /* NOCONTEXT */ |
|
8301 |
||
8302 |
if (ISCONNECTED) { |
|
8303 |
Display *dpy; |
|
8304 |
int scr; |
|
8305 |
||
8306 |
dpy = myDpy; |
|
8307 |
scr = DefaultScreen(dpy); |
|
8308 |
RETURN ( __MKSMALLINT(DisplayHeight(dpy, scr))); |
|
8309 |
} |
|
8310 |
%}. |
|
8311 |
^ nil |
|
8312 |
||
8313 |
" |
|
4245 | 8314 |
Display queryHeight |
3487 | 8315 |
" |
8316 |
! |
|
8317 |
||
8318 |
queryHeightMM |
|
8319 |
%{ /* NOCONTEXT */ |
|
8320 |
||
8321 |
if (ISCONNECTED) { |
|
8322 |
Display *dpy; |
|
8323 |
int scr; |
|
8324 |
||
8325 |
dpy = myDpy; |
|
8326 |
scr = DefaultScreen(dpy); |
|
8327 |
RETURN ( __MKSMALLINT(DisplayHeightMM(dpy, scr))); |
|
8328 |
} |
|
8329 |
%}. |
|
8330 |
^ nil |
|
8331 |
||
8332 |
" |
|
4245 | 8333 |
Display queryHeightMM |
3487 | 8334 |
" |
8335 |
! |
|
8336 |
||
8337 |
queryMBUFExtension |
|
8338 |
%{ /* NOCONTEXT */ |
|
8339 |
||
8340 |
#ifdef MBUF |
|
8341 |
if (ISCONNECTED) { |
|
8342 |
Display *dpy; |
|
8343 |
int dummy; |
|
8344 |
||
8345 |
dpy = myDpy; |
|
8346 |
||
8347 |
if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy)) { |
|
8348 |
RETURN ( true ); |
|
8349 |
} |
|
8350 |
} |
|
8351 |
#endif |
|
8352 |
%}. |
|
8353 |
^ false |
|
8354 |
||
8355 |
" |
|
4245 | 8356 |
Display queryMBUFExtension |
3487 | 8357 |
" |
8358 |
! |
|
8359 |
||
8360 |
queryPEXExtension |
|
8361 |
%{ /* NOCONTEXT */ |
|
8362 |
||
8363 |
#ifdef PEX5 |
|
8364 |
if (ISCONNECTED) { |
|
8365 |
Display *dpy; |
|
8366 |
int dummy; |
|
8367 |
||
8368 |
dpy = myDpy; |
|
8369 |
||
8370 |
if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy)) { |
|
8371 |
RETURN ( true ); |
|
8372 |
} |
|
8373 |
} |
|
8374 |
#endif |
|
8375 |
%}. |
|
8376 |
^ false |
|
8377 |
||
8378 |
" |
|
8379 |
Display queryPEXExtension |
|
8380 |
" |
|
8381 |
! |
|
8382 |
||
8383 |
queryRGBMasks |
|
8384 |
%{ /* NOCONTEXT */ |
|
8385 |
||
8386 |
if (ISCONNECTED) { |
|
8387 |
Display *dpy; |
|
8388 |
Visual *visual; |
|
8389 |
OBJ redMask, greenMask, blueMask, bprgb; |
|
8390 |
||
8391 |
dpy = myDpy; |
|
8392 |
visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy)); |
|
8393 |
redMask = __MKSMALLINT(visual->red_mask); |
|
8394 |
greenMask = __MKSMALLINT(visual->green_mask); |
|
8395 |
blueMask = __MKSMALLINT(visual->blue_mask); |
|
8396 |
bprgb = __MKSMALLINT(visual->bits_per_rgb); |
|
8397 |
RETURN ( __ARRAY_WITH4(redMask, greenMask, blueMask, bprgb) ); |
|
8398 |
} |
|
8399 |
%}. |
|
8400 |
^ nil |
|
8401 |
||
8402 |
" |
|
8403 |
Display queryRGBMasks |
|
8404 |
" |
|
8405 |
! |
|
8406 |
||
8407 |
querySHMExtension |
|
8408 |
%{ /* NOCONTEXT */ |
|
8409 |
||
8410 |
#ifdef xxSHM |
|
8411 |
if (ISCONNECTED) { |
|
8412 |
Display *dpy; |
|
8413 |
int dummy; |
|
8414 |
||
8415 |
dpy = myDpy; |
|
8416 |
||
8417 |
if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy)) { |
|
8418 |
RETURN ( true ); |
|
8419 |
} |
|
8420 |
} |
|
8421 |
#endif |
|
8422 |
%}. |
|
8423 |
^ false |
|
8424 |
||
8425 |
" |
|
4245 | 8426 |
Display querySHMExtension |
3487 | 8427 |
" |
8428 |
! |
|
8429 |
||
8430 |
queryShapeExtension |
|
8431 |
%{ /* NOCONTEXT */ |
|
8432 |
||
8433 |
#ifdef SHAPE |
|
8434 |
if (ISCONNECTED) { |
|
8435 |
Display *dpy; |
|
8436 |
int dummy; |
|
8437 |
||
8438 |
dpy = myDpy; |
|
8439 |
||
8440 |
if (XShapeQueryExtension(dpy, &dummy, &dummy)) { |
|
8441 |
RETURN ( true ); |
|
8442 |
} |
|
8443 |
} |
|
8444 |
#endif |
|
8445 |
%}. |
|
8446 |
^ false |
|
8447 |
||
8448 |
" |
|
8449 |
Display queryShapeExtension |
|
8450 |
" |
|
8451 |
! |
|
8452 |
||
8453 |
queryWhitePixel |
|
8454 |
%{ /* NOCONTEXT */ |
|
8455 |
||
8456 |
if (ISCONNECTED) { |
|
8457 |
Display *dpy; |
|
8458 |
int scr; |
|
8459 |
||
8460 |
dpy = myDpy; |
|
8461 |
scr = DefaultScreen(dpy); |
|
8462 |
RETURN ( __MKSMALLINT(WhitePixel(dpy, scr))); |
|
8463 |
} |
|
8464 |
%}. |
|
8465 |
^ nil |
|
8466 |
||
8467 |
" |
|
4245 | 8468 |
Display queryWhitePixel |
3487 | 8469 |
" |
8470 |
! |
|
8471 |
||
8472 |
queryWidth |
|
8473 |
%{ /* NOCONTEXT */ |
|
8474 |
||
8475 |
if (ISCONNECTED) { |
|
8476 |
Display *dpy; |
|
8477 |
int scr; |
|
8478 |
||
8479 |
dpy = myDpy; |
|
8480 |
scr = DefaultScreen(dpy); |
|
8481 |
RETURN ( __MKSMALLINT(DisplayWidth(dpy, scr))); |
|
8482 |
} |
|
8483 |
%}. |
|
8484 |
^ nil |
|
8485 |
||
8486 |
" |
|
4245 | 8487 |
Display queryWidth |
3487 | 8488 |
" |
8489 |
! |
|
8490 |
||
8491 |
queryWidthMM |
|
8492 |
%{ /* NOCONTEXT */ |
|
8493 |
||
8494 |
if (ISCONNECTED) { |
|
8495 |
Display *dpy; |
|
8496 |
int scr; |
|
8497 |
||
8498 |
dpy = myDpy; |
|
8499 |
scr = DefaultScreen(dpy); |
|
8500 |
RETURN ( __MKSMALLINT(DisplayWidthMM(dpy, scr))); |
|
8501 |
} |
|
8502 |
%}. |
|
8503 |
^ nil |
|
8504 |
||
8505 |
" |
|
4245 | 8506 |
Display queryWidthMM |
3487 | 8507 |
" |
8508 |
! |
|
8509 |
||
8510 |
queryXIEExtension |
|
8511 |
%{ /* NOCONTEXT */ |
|
8512 |
||
8513 |
#ifdef XIE |
|
8514 |
if (ISCONNECTED) { |
|
8515 |
Display *dpy; |
|
8516 |
int dummy; |
|
8517 |
||
8518 |
dpy = myDpy; |
|
8519 |
||
8520 |
if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy)) { |
|
8521 |
RETURN ( true ); |
|
8522 |
} |
|
8523 |
} |
|
8524 |
#endif |
|
8525 |
%}. |
|
8526 |
^ false |
|
8527 |
||
8528 |
" |
|
8529 |
Display queryXIEExtension |
|
8530 |
" |
|
8531 |
! |
|
8532 |
||
8533 |
queryXIExtension |
|
8534 |
%{ /* NOCONTEXT */ |
|
8535 |
||
8536 |
#ifdef XI |
|
8537 |
if (ISCONNECTED) { |
|
8538 |
Display *dpy; |
|
8539 |
int dummy; |
|
8540 |
||
8541 |
dpy = myDpy; |
|
8542 |
||
8543 |
if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy)) { |
|
8544 |
RETURN ( true ); |
|
8545 |
} |
|
8546 |
} |
|
8547 |
#endif |
|
8548 |
%}. |
|
8549 |
^ false |
|
8550 |
||
8551 |
" |
|
8552 |
Display queryXIExtension |
|
8553 |
" |
|
8554 |
! |
|
8555 |
||
8556 |
queryXVideoExtension |
|
8557 |
%{ /* NOCONTEXT */ |
|
8558 |
||
8559 |
#ifdef XVIDEO |
|
8560 |
if (ISCONNECTED) { |
|
8561 |
Display *dpy; |
|
8562 |
int dummy; |
|
8563 |
||
8564 |
dpy = myDpy; |
|
8565 |
||
8566 |
if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy)) { |
|
8567 |
RETURN ( true ); |
|
8568 |
} |
|
8569 |
} |
|
8570 |
#endif |
|
8571 |
%}. |
|
8572 |
^ false |
|
8573 |
||
8574 |
" |
|
4245 | 8575 |
Display queryXVideoExtension |
3487 | 8576 |
" |
8577 |
! |
|
8578 |
||
1344 | 8579 |
reinitialize |
3418 | 8580 |
|
295 | 8581 |
virtualRootId := rootId := nil. |
8582 |
super reinitialize. |
|
8583 |
dispatchingExpose := nil |
|
8584 |
! ! |
|
8585 |
||
8586 |
!XWorkstation methodsFor:'keyboard mapping'! |
|
8587 |
||
1344 | 8588 |
altModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8589 |
"return the mask (in motionEvents) for the alt-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8590 |
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
|
8591 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8592 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8593 |
^ altModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8594 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8595 |
"Created: 23.3.1996 / 12:43:22 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8596 |
"Modified: 23.3.1996 / 12:44:56 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8597 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8598 |
|
1344 | 8599 |
altModifierMask:aSmallInteger |
341 | 8600 |
"define which key takes the role of an alt-key. |
8601 |
By default, this is X's modifier1, which is the ALT key on |
|
8602 |
most keyboards. However, there may be exceptions to this, |
|
8603 |
and the setting can be changed with: |
|
1344 | 8604 |
Display altModifierMask:(Display modifier2Mask) |
341 | 8605 |
Setting the mask to 0 disables the ALT key (in ST/X) altogether. |
8606 |
" |
|
8607 |
||
8608 |
altModifierMask := aSmallInteger |
|
8609 |
! |
|
8610 |
||
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8611 |
ctrlModifierMask |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8612 |
"return the Xlib mask bit for the control modifier key" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8613 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8614 |
%{ /* NOCONTEXT */ |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8615 |
RETURN (__MKSMALLINT(ControlMask)); |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8616 |
%} |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8617 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8618 |
|
1344 | 8619 |
metaModifierMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8620 |
"return the mask (in motionEvents) for the meta-key modifier. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8621 |
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
|
8622 |
therefore return a variable here, which can be changed during startup." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8623 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8624 |
^ metaModifierMask |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8625 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8626 |
"Created: 23.3.1996 / 12:43:39 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8627 |
"Modified: 23.3.1996 / 12:45:09 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8628 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
8629 |
|
1344 | 8630 |
metaModifierMask:aSmallInteger |
341 | 8631 |
"define which key takes the role of a meta key. |
8632 |
By default, this is X's modifier2, which is the 2nd ALT key on |
|
8633 |
most keyboards (if present at all). |
|
8634 |
However, there may be exceptions to this, and the setting can |
|
8635 |
be changed with: |
|
1344 | 8636 |
Display metaModifierMask:(Display modifier1Mask) |
341 | 8637 |
Setting the mask to 0 disables the META key (in ST/X) altogether. |
8638 |
As reported, some Xservers place the Meta-key onto NumLock, |
|
8639 |
and having NumLock enabled makes ST/X think, that meta is pressed |
|
8640 |
all the time. On those, you should disable the meta key by setting |
|
8641 |
the mask to 0. |
|
8642 |
" |
|
8643 |
||
8644 |
metaModifierMask := aSmallInteger |
|
8645 |
! |
|
8646 |
||
1344 | 8647 |
modifier1Mask |
341 | 8648 |
"return the Xlib mask bit for the 1st modifier key. |
8649 |
See comment in altModifierMask: / metaModifierMask: for what |
|
8650 |
this could be used." |
|
8651 |
||
8652 |
%{ /* NOCONTEXT */ |
|
8653 |
RETURN (__MKSMALLINT(Mod1Mask)); |
|
8654 |
%} |
|
8655 |
! |
|
8656 |
||
1344 | 8657 |
modifier2Mask |
341 | 8658 |
"return the Xlib mask bit for the 2nd modifier key. |
8659 |
See comment in altModifierMask: / metaModifierMask: for what |
|
8660 |
this could be used." |
|
8661 |
||
8662 |
%{ /* NOCONTEXT */ |
|
8663 |
RETURN (__MKSMALLINT(Mod2Mask)); |
|
8664 |
%} |
|
8665 |
! |
|
8666 |
||
3305 | 8667 |
modifier3Mask |
8668 |
"return the Xlib mask bit for the 3rd modifier key. |
|
8669 |
See comment in altModifierMask: / metaModifierMask: for what |
|
8670 |
this could be used." |
|
8671 |
||
8672 |
%{ /* NOCONTEXT */ |
|
8673 |
RETURN (__MKSMALLINT(Mod3Mask)); |
|
8674 |
%} |
|
8675 |
! |
|
8676 |
||
8677 |
modifier4Mask |
|
8678 |
"return the Xlib mask bit for the 4th modifier key. |
|
8679 |
See comment in altModifierMask: / metaModifierMask: for what |
|
8680 |
this could be used." |
|
8681 |
||
8682 |
%{ /* NOCONTEXT */ |
|
8683 |
RETURN (__MKSMALLINT(Mod4Mask)); |
|
8684 |
%} |
|
8685 |
! |
|
8686 |
||
8687 |
modifier5Mask |
|
8688 |
"return the Xlib mask bit for the 5th modifier key. |
|
8689 |
See comment in altModifierMask: / metaModifierMask: for what |
|
8690 |
this could be used." |
|
8691 |
||
8692 |
%{ /* NOCONTEXT */ |
|
8693 |
RETURN (__MKSMALLINT(Mod5Mask)); |
|
8694 |
%} |
|
8695 |
! |
|
8696 |
||
1344 | 8697 |
modifierMapping |
341 | 8698 |
"Get the Modifier Mapping. |
8699 |
We return an array of arrays of keycodes" |
|
8700 |
||
8701 |
|modifierKeyMap maxKeyPerMod ret nextKey| |
|
8702 |
||
3214 | 8703 |
modifierKeyMap := self rawModifierMapping. |
8704 |
maxKeyPerMod := modifierKeyMap size // 8. |
|
8705 |
modifierKeyMap isNil ifTrue:[^ nil]. |
|
8706 |
||
8707 |
ret := Array new:8. |
|
8708 |
nextKey := 1. |
|
8709 |
1 to:8 do:[ :i | |
|
3424 | 8710 |
(modifierKeyMap at:nextKey) ~= 0 ifTrue:[ |
8711 |
|mod| |
|
8712 |
||
8713 |
mod := OrderedCollection new:maxKeyPerMod. |
|
8714 |
modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key | |
|
8715 |
key ~= 0 ifTrue:[ |
|
8716 |
mod add:key |
|
8717 |
]. |
|
8718 |
]. |
|
8719 |
ret at:i put:mod. |
|
8720 |
]. |
|
8721 |
nextKey := nextKey+maxKeyPerMod. |
|
3214 | 8722 |
]. |
8723 |
||
8724 |
^ ret |
|
8725 |
||
8726 |
" |
|
3305 | 8727 |
Display modifierMapping |
8728 |
" |
|
8729 |
||
8730 |
" |
|
8731 |
|mapping| |
|
8732 |
||
3322
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8733 |
mapping := Display modifierMapping. |
4245 | 8734 |
^ mapping collect:[:eachRow | |
3424 | 8735 |
eachRow notNil ifTrue:[ |
8736 |
eachRow collect:[ :key | Display stringFromKeycode:key ]. |
|
8737 |
] ifFalse:[ |
|
8738 |
nil |
|
8739 |
] |
|
8740 |
]. |
|
3322
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8741 |
" |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8742 |
! |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8743 |
|
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8744 |
rawKeySymTranslation |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8745 |
"Get the raw keyboard mapping (maps some special X-keySyms to STX-internal names |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8746 |
and can also be used to untranslate a stupid x-mapping (as on hpux)." |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8747 |
|
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8748 |
^ rawKeySymTranslation |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8749 |
|
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8750 |
|
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8751 |
" |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8752 |
Display rawKeySymTranslation |
3214 | 8753 |
" |
8754 |
! |
|
8755 |
||
8756 |
rawModifierMapping |
|
8757 |
"Get the raw Modifier Mapping." |
|
8758 |
||
8759 |
|modifierKeyMap maxKeyPerMod | |
|
8760 |
||
341 | 8761 |
%{ |
8762 |
XModifierKeymap *modmap; |
|
8763 |
OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT(); |
|
8764 |
||
8765 |
if (ISCONNECTED) { |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8766 |
Display *dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8767 |
|
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8768 |
if ((modmap = XGetModifierMapping(dpy)) != 0) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8769 |
maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8770 |
modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8771 |
if (modifierKeyMap != nil) { |
4245 | 8772 |
memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8773 |
(char *)modmap->modifiermap, modmap->max_keypermod * 8); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8774 |
} |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8775 |
XFreeModifiermap(modmap); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8776 |
} |
3214 | 8777 |
} |
8778 |
%}. |
|
4245 | 8779 |
^ modifierKeyMap |
3214 | 8780 |
|
8781 |
" |
|
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
8782 |
Display rawModifierMapping |
341 | 8783 |
" |
8784 |
! |
|
8785 |
||
3230
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8786 |
shiftModifierMask |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8787 |
"return the Xlib mask bit for the shift modifier key" |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8788 |
|
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8789 |
%{ /* NOCONTEXT */ |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8790 |
RETURN (__MKSMALLINT(ShiftMask)); |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8791 |
%} |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8792 |
! |
e6e06f7b7df4
new event decomposition code.
Claus Gittinger <cg@exept.de>
parents:
3229
diff
changeset
|
8793 |
|
1344 | 8794 |
stringFromKeycode:code |
341 | 8795 |
"Get a KeySymbol (a smalltalk symbol) from the keycode." |
8796 |
||
8797 |
|str| |
|
8798 |
||
8799 |
%{ |
|
8800 |
KeySym keysym; |
|
8801 |
char *keystring; |
|
8802 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8803 |
if (ISCONNECTED |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8804 |
&& __isSmallInteger(code)) { |
1344 | 8805 |
Display *dpy = myDpy; |
8806 |
||
2541 | 8807 |
if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol && |
4245 | 8808 |
(keystring = XKeysymToString(keysym)) != 0) |
1344 | 8809 |
str = __MKSTRING(keystring); |
341 | 8810 |
} |
8811 |
%}. |
|
8812 |
^ str |
|
8813 |
||
8814 |
" |
|
1344 | 8815 |
Display stringFromKeycode:28 |
341 | 8816 |
" |
8817 |
! |
|
8818 |
||
3305 | 8819 |
superModifierMask |
8820 |
"return the Xlib mask bit for the super modifier key" |
|
8821 |
||
8822 |
^ self modifier4Mask |
|
8823 |
! |
|
8824 |
||
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
8825 |
translateKey:untranslatedKey forView:aView |
295 | 8826 |
"Return the key translated via the translation table. |
4245 | 8827 |
Here, we preTranslate the key into a common ST/X symbolic name, |
295 | 8828 |
which gets further processed in the superclasses translation method." |
8829 |
||
8830 |
|key| |
|
8831 |
||
3322
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8832 |
key := untranslatedKey. |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8833 |
(rawKeySymTranslation includesKey:key) ifTrue:[ |
3424 | 8834 |
key := rawKeySymTranslation at:key. |
3322
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8835 |
]. |
1c92a842f099
keyboard mapping fixes for hpux
Claus Gittinger <cg@exept.de>
parents:
3321
diff
changeset
|
8836 |
key isCharacter ifFalse:[ |
3424 | 8837 |
key := key asSymbol |
295 | 8838 |
]. |
2140
21ad63e0c739
allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents:
2132
diff
changeset
|
8839 |
^ super translateKey:key forView:aView |
295 | 8840 |
! ! |
8841 |
||
8842 |
!XWorkstation methodsFor:'misc'! |
|
8843 |
||
1344 | 8844 |
beep |
295 | 8845 |
"output an audible beep or bell" |
8846 |
||
3079 | 8847 |
UserPreferences current beepEnabled ifTrue:[ |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
8848 |
self beep:50 |
1906 | 8849 |
] |
3079 | 8850 |
|
8851 |
"Modified: / 3.12.1999 / 17:13:59 / ps" |
|
295 | 8852 |
! |
8853 |
||
1344 | 8854 |
beep:volumeInPercent |
295 | 8855 |
"output an audible beep" |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8856 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8857 |
<context: #return> |
295 | 8858 |
%{ |
8859 |
int volume; |
|
8860 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8861 |
if (__isSmallInteger(volumeInPercent) |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8862 |
&& ISCONNECTED) { |
1344 | 8863 |
/* stupid: X wants -100 .. 100 and calls this percent */ |
8864 |
volume = __intVal(volumeInPercent) * 2 - 100; |
|
8865 |
if (volume < -100) volume = -100; |
|
8866 |
else if (volume > 100) volume = 100; |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
8867 |
|
1974 | 8868 |
ENTER_XLIB(); |
1344 | 8869 |
XBell(myDpy, volume); |
1974 | 8870 |
LEAVE_XLIB(); |
295 | 8871 |
} |
8872 |
%} |
|
8873 |
! |
|
8874 |
||
1344 | 8875 |
buffered |
295 | 8876 |
"buffer drawing - do not send it immediately to the display. |
374 | 8877 |
This is the default anyway. |
8878 |
See #unBuffered for additional info." |
|
295 | 8879 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8880 |
<context: #return> |
4245 | 8881 |
%{ |
295 | 8882 |
if (ISCONNECTED) { |
1974 | 8883 |
ENTER_XLIB(); |
1344 | 8884 |
XSynchronize(myDpy, 0); |
1974 | 8885 |
LEAVE_XLIB(); |
295 | 8886 |
} |
8887 |
%} |
|
374 | 8888 |
" |
8889 |
Display buffered |
|
8890 |
" |
|
295 | 8891 |
! |
8892 |
||
1344 | 8893 |
flush |
295 | 8894 |
"send all buffered drawing to the display. |
8895 |
This may be required to make certain, that all previous operations |
|
8896 |
are really sent to the display before continuing. For example, |
|
8897 |
after a cursor-change with a followup long computation. |
|
374 | 8898 |
(otherwise, the cursor change request may still be in the output buffer) |
8899 |
See also #sync, which even waits until the request has been processed." |
|
295 | 8900 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8901 |
<context: #return> |
4245 | 8902 |
%{ |
295 | 8903 |
if (ISCONNECTED) { |
1974 | 8904 |
ENTER_XLIB(); |
1344 | 8905 |
XFlush(myDpy); |
1974 | 8906 |
LEAVE_XLIB(); |
310 | 8907 |
} |
8908 |
%} |
|
8909 |
! |
|
8910 |
||
1344 | 8911 |
flushDpsContext:aDPSContext |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
8912 |
<context: #return> |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
8913 |
%{ |
295 | 8914 |
#ifdef DPS |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8915 |
if (ISCONNECTED |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
8916 |
&& __isExternalAddress(aDPSContext)) { |
1974 | 8917 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
8918 |
DPSFlushContext(__DPSContextVal(aDPSContext)); |
1974 | 8919 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
8920 |
|
1344 | 8921 |
RETURN ( self ); |
295 | 8922 |
} |
8923 |
#endif |
|
374 | 8924 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8925 |
self primitiveFailedOrClosedConnection |
295 | 8926 |
! |
8927 |
||
3326
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8928 |
primSync |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8929 |
"send all buffered drawing to the display AND wait until the display |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8930 |
has finished drawing it. |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8931 |
This is almost never needed, except if you are about to read previously |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8932 |
drawn pixels back from the display screen, or you want to wait for a beep |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8933 |
to be finished. See also #flush." |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8934 |
|
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8935 |
<context: #return> |
4245 | 8936 |
%{ |
3326
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8937 |
|
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8938 |
if (ISCONNECTED) { |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8939 |
|
3424 | 8940 |
ENTER_XLIB(); |
8941 |
XSync(myDpy, 0); |
|
8942 |
LEAVE_XLIB(); |
|
3326
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8943 |
|
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8944 |
} |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8945 |
%} |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8946 |
! |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
8947 |
|
1344 | 8948 |
refreshKeyboardMapping:eB |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8949 |
<context: #return> |
295 | 8950 |
%{ |
8951 |
XMappingEvent *ev; |
|
8952 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8953 |
if (ISCONNECTED |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8954 |
&& __isByteArray(eB)) { |
1344 | 8955 |
ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element); |
1974 | 8956 |
ENTER_XLIB(); |
1344 | 8957 |
XRefreshKeyboardMapping(ev); |
1974 | 8958 |
LEAVE_XLIB(); |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8959 |
RETURN ( self ); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8960 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8961 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8962 |
self primitiveFailedOrClosedConnection |
295 | 8963 |
! |
8964 |
||
3575 | 8965 |
roundTripTime |
8966 |
"answer the round trip time in milliSeconds. |
|
8967 |
May be used to detect slow X11 connections" |
|
8968 |
||
8969 |
self sync. |
|
4119
a770b7e08c72
Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents:
4114
diff
changeset
|
8970 |
^ Timestamp millisecondsToRun:[ self primSync ]. |
3575 | 8971 |
|
8972 |
" |
|
8973 |
Screen current roundTripTime |
|
8974 |
" |
|
8975 |
! |
|
8976 |
||
1344 | 8977 |
setInputFocusTo:aWindowId |
2871 | 8978 |
"set the focus to the view as defined by aWindowId. |
8979 |
When released, return the focus to the root window" |
|
8980 |
||
295 | 8981 |
"/ self setInputFocusTo:aWindowId revertTo:#parent |
8982 |
self setInputFocusTo:aWindowId revertTo:#root |
|
8983 |
! |
|
8984 |
||
1344 | 8985 |
setInputFocusTo:aWindowId revertTo:revertSymbol |
295 | 8986 |
"set the focus to the view as defined by aWindowId. |
8987 |
Passing nil set the focus to no window and lets the display discard all |
|
8988 |
input until a new focus is set. |
|
8989 |
RevertSymbol specifies what should happen if the view becomes invisible; |
|
8990 |
passing one of #parent, #root or nil specifies that the focus should be |
|
8991 |
given to the parent view, the root view or no view." |
|
8992 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
8993 |
<context: #return> |
4245 | 8994 |
%{ |
295 | 8995 |
int arg; |
8996 |
Window focusWindow; |
|
8997 |
||
8998 |
if (ISCONNECTED) { |
|
3693 | 8999 |
if (__isExternalAddress(aWindowId)) { |
9000 |
focusWindow = __WindowVal(aWindowId); |
|
9001 |
} else if (aWindowId == nil) { |
|
9002 |
focusWindow = None; |
|
9003 |
} else |
|
9004 |
goto err; |
|
9005 |
if (revertSymbol == @symbol(parent)) |
|
9006 |
arg = RevertToParent; |
|
9007 |
else if (revertSymbol == @symbol(root)) |
|
9008 |
arg = RevertToPointerRoot; |
|
4245 | 9009 |
else |
3693 | 9010 |
arg = RevertToNone; |
9011 |
||
9012 |
||
9013 |
ENTER_XLIB(); |
|
9014 |
XSetInputFocus(myDpy, focusWindow, arg, CurrentTime); |
|
9015 |
LEAVE_XLIB(); |
|
9016 |
||
9017 |
RETURN ( self ); |
|
3650 | 9018 |
} |
9019 |
err:; |
|
295 | 9020 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9021 |
self primitiveFailedOrClosedConnection |
295 | 9022 |
! |
9023 |
||
1344 | 9024 |
sync |
341 | 9025 |
"send all buffered drawing to the display AND wait until the display |
9026 |
has finished drawing it. |
|
9027 |
This is almost never needed, except if you are about to read previously |
|
374 | 9028 |
drawn pixels back from the display screen, or you want to wait for a beep |
9029 |
to be finished. See also #flush." |
|
341 | 9030 |
|
3326
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
9031 |
self primSync. |
5d58d51bf927
sync checks for pending events
Claus Gittinger <cg@exept.de>
parents:
3322
diff
changeset
|
9032 |
self dispatchPendingEvents. |
341 | 9033 |
! |
9034 |
||
1344 | 9035 |
unBuffered |
374 | 9036 |
"make all drawing be sent immediately to the display. |
9037 |
This makes all graphics synchronous and turns off any buffering |
|
4245 | 9038 |
(i.e. each individual draw-request is sent immediately without |
374 | 9039 |
packing multiple requests into a larger message buffer). |
9040 |
Be prepared, that this slows down graphics considerably. |
|
9041 |
However, it allows display errors to be handled immediately and |
|
9042 |
may be useful if you get Xdisplay errors and want to find the request |
|
1813 | 9043 |
which was responsible for it. See also #buffered." |
295 | 9044 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9045 |
<context: #return> |
4245 | 9046 |
%{ |
295 | 9047 |
|
9048 |
if (ISCONNECTED) { |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9049 |
|
1974 | 9050 |
ENTER_XLIB(); |
1344 | 9051 |
XSynchronize(myDpy, 1); |
1974 | 9052 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9053 |
|
295 | 9054 |
} |
9055 |
%} |
|
1813 | 9056 |
" |
9057 |
Display unBuffered |
|
9058 |
" |
|
295 | 9059 |
! ! |
9060 |
||
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9061 |
!XWorkstation methodsFor:'pointer stuff'! |
295 | 9062 |
|
1344 | 9063 |
anyButtonStateMask |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9064 |
"return an integer for masking out any button from a |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9065 |
buttonStates value." |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9066 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9067 |
"/ should use ``Display buttonXMotionMask bitOr:....'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9068 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9069 |
^ 256 + 512 + 1024 |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9070 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9071 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9072 |
"Created: 23.3.1996 / 12:46:35 / cg" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9073 |
! |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9074 |
|
1344 | 9075 |
buttonStates |
295 | 9076 |
"return an integer representing the state of the pointer buttons; |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9077 |
a one-bit in positions 0.. represent a pressed button. |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9078 |
See the button1Mask/button2Mask/button3Mask, |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9079 |
shiftMask/controlMask and modifierMask methods for the meaning of the bits." |
295 | 9080 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9081 |
<context: #return> |
4245 | 9082 |
%{ |
295 | 9083 |
Window w; |
555 | 9084 |
int screen = __intVal(__INST(screen)); |
295 | 9085 |
Window rootRet, childRet; |
9086 |
int rootX, rootY, winX, winY; |
|
9087 |
unsigned int mask; |
|
9088 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9089 |
if (ISCONNECTED) { |
1906 | 9090 |
Display *dpy = myDpy; |
9091 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9092 |
|
295 | 9093 |
#ifdef VIRTUAL_ROOT |
3920 | 9094 |
ENTER_XLIB(); |
2541 | 9095 |
w = getRootWindow(dpy, screen); |
3920 | 9096 |
LEAVE_XLIB(); |
295 | 9097 |
#else |
1906 | 9098 |
w = RootWindow(dpy, screen); |
295 | 9099 |
#endif |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9100 |
|
1906 | 9101 |
if (w) { |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9102 |
|
1974 | 9103 |
ENTER_XLIB(); |
1906 | 9104 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
9105 |
&rootX, &rootY, |
|
9106 |
&winX, &winY, |
|
9107 |
&mask); |
|
1974 | 9108 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9109 |
|
1906 | 9110 |
RETURN (__MKSMALLINT(mask)); |
9111 |
} |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9112 |
} |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9113 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9114 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9115 |
^ nil |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9116 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9117 |
" |
4245 | 9118 |
Display buttonStates |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9119 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9120 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9121 |
"is the control-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9122 |
|
4245 | 9123 |
Display buttonStates bitTest:(Display controlMask) |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9124 |
" |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9125 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9126 |
"is the alt/meta-key pressed ? |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9127 |
|
4245 | 9128 |
Display buttonStates bitTest:(Display altModifierMask) |
9129 |
Display buttonStates bitTest:(Display metaModifierMask) |
|
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9130 |
" |
295 | 9131 |
! |
9132 |
||
1344 | 9133 |
leftButtonStateMask |
295 | 9134 |
"return an integer for masking out the left button from a |
9135 |
buttonStates value" |
|
9136 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9137 |
"/ should use ``Display button1MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9138 |
|
295 | 9139 |
^ 256 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9140 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9141 |
"Modified: 23.3.1996 / 12:41:33 / cg" |
295 | 9142 |
! |
9143 |
||
1344 | 9144 |
middleButtonStateMask |
295 | 9145 |
"return an integer for masking out the middle button from a |
9146 |
buttonStates value" |
|
9147 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9148 |
"/ should use ``Display button2MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9149 |
|
295 | 9150 |
^ 512 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9151 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9152 |
"Modified: 23.3.1996 / 12:41:43 / cg" |
295 | 9153 |
! |
9154 |
||
1344 | 9155 |
pointerPosition |
295 | 9156 |
"return the current pointer position in root-window coordinates" |
9157 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9158 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9159 |
|
295 | 9160 |
|xpos ypos| |
9161 |
||
9162 |
%{ |
|
9163 |
Window w; |
|
555 | 9164 |
int screen = __intVal(__INST(screen)); |
295 | 9165 |
Window rootRet, childRet; |
9166 |
int rootX, rootY, winX, winY; |
|
9167 |
unsigned int mask; |
|
9168 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9169 |
if (ISCONNECTED) { |
1344 | 9170 |
Display *dpy = myDpy; |
9171 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9172 |
|
295 | 9173 |
#ifdef VIRTUAL_ROOT |
3920 | 9174 |
ENTER_XLIB(); |
2541 | 9175 |
w = getRootWindow(dpy, screen); |
3920 | 9176 |
LEAVE_XLIB(); |
295 | 9177 |
#else |
1344 | 9178 |
w = RootWindow(dpy, screen); |
295 | 9179 |
#endif |
1974 | 9180 |
ENTER_XLIB(); |
1344 | 9181 |
XQueryPointer(dpy, w, &rootRet, &childRet, |
9182 |
&rootX, &rootY, |
|
9183 |
&winX, &winY, |
|
9184 |
&mask); |
|
1974 | 9185 |
LEAVE_XLIB(); |
1344 | 9186 |
xpos = __MKSMALLINT(rootX); |
9187 |
ypos = __MKSMALLINT(rootY); |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9188 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9189 |
} |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9190 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9191 |
xpos isNil ifTrue:[ |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9192 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9193 |
^ nil |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9194 |
]. |
295 | 9195 |
^ xpos @ ypos |
9196 |
! |
|
9197 |
||
1344 | 9198 |
rightButtonStateMask |
295 | 9199 |
"return an integer for masking out the right button from a |
9200 |
buttonStates value" |
|
9201 |
||
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9202 |
"/ should use ``Display button3MotionMask'' |
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9203 |
|
295 | 9204 |
^ 1024 |
540
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9205 |
|
c954c490c8be
stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents:
487
diff
changeset
|
9206 |
"Modified: 23.3.1996 / 12:41:52 / cg" |
295 | 9207 |
! |
9208 |
||
1344 | 9209 |
rootPositionOfLastEvent |
295 | 9210 |
"return the position in root-window coordinates |
9211 |
of the last button, key or pointer event" |
|
9212 |
||
9213 |
^ eventRootX @ eventRootY |
|
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9214 |
! |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9215 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9216 |
setPointerPosition:newPosition in:aWindowId |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9217 |
"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
|
9218 |
given windows origin (which may be the rootWindow). |
3329 | 9219 |
Be careful with this - its usually not very ergonomically |
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9220 |
to change the mousePointer position. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9221 |
This interface is provided for special applications (presentation |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9222 |
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
|
9223 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9224 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9225 |
|
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9226 |
|xpos ypos| |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9227 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9228 |
xpos := newPosition x. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9229 |
ypos := newPosition y. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9230 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9231 |
%{ |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9232 |
if (ISCONNECTED |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9233 |
&& __isExternalAddress(aWindowId) |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9234 |
&& __bothSmallInteger(xpos, ypos)) { |
3424 | 9235 |
Display *dpy = myDpy; |
9236 |
Window w = __WindowVal(aWindowId); |
|
9237 |
||
9238 |
ENTER_XLIB(); |
|
4245 | 9239 |
XWarpPointer(dpy, |
3424 | 9240 |
None, /* src window */ |
9241 |
w, /* dst window */ |
|
9242 |
0, /* src_x */ |
|
9243 |
0, /* src_y */ |
|
9244 |
0, /* src_w */ |
|
9245 |
0, /* src_h */ |
|
9246 |
__intVal(xpos), /* dst_x */ |
|
9247 |
__intVal(ypos) /* dst_y */ |
|
9248 |
); |
|
9249 |
LEAVE_XLIB(); |
|
1718
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9250 |
} |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9251 |
%}. |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9252 |
^ self |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9253 |
|
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9254 |
" |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9255 |
Display setPointerPosition:1000@1000 |
886b895eb2f3
added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents:
1709
diff
changeset
|
9256 |
" |
295 | 9257 |
! ! |
9258 |
||
1556 | 9259 |
!XWorkstation methodsFor:'properties'! |
9260 |
||
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9261 |
deleteProperty:propertyID for:aWindowID |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9262 |
"delete a property in the XServer" |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9263 |
|
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9264 |
<context: #return> |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9265 |
|
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9266 |
%{ |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9267 |
if (ISCONNECTED && __isAtomID(propertyID)) { |
3806 | 9268 |
Display *dpy = myDpy; |
9269 |
Atom prop; |
|
9270 |
Window window; |
|
9271 |
||
9272 |
prop = __AtomVal(propertyID); |
|
9273 |
||
9274 |
if (__isExternalAddress(aWindowID)) { |
|
9275 |
window = __WindowVal(aWindowID); |
|
9276 |
} else if (aWindowID == nil) { |
|
9277 |
window = DefaultRootWindow(dpy); |
|
9278 |
} else if (__isInteger(aWindowID)) { |
|
9279 |
window = (Window)__unsignedLongIntVal(aWindowID); |
|
9280 |
} else { |
|
9281 |
goto fail; |
|
9282 |
} |
|
9283 |
||
9284 |
ENTER_XLIB(); |
|
9285 |
XDeleteProperty(dpy, window, prop); |
|
9286 |
LEAVE_XLIB(); |
|
9287 |
RETURN(true); |
|
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9288 |
} |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9289 |
fail:; |
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9290 |
%}. |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9291 |
self primitiveFailedOrClosedConnection. |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9292 |
! |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9293 |
|
1556 | 9294 |
getObjectProperty:propertyID from:aWindowID |
9295 |
"get an object property from the server; return object or nil" |
|
9296 |
||
4245 | 9297 |
self |
9298 |
getProperty:propertyID |
|
9299 |
from:aWindowID |
|
9300 |
delete:true |
|
4082 | 9301 |
into: |
9302 |
[:type :value | |
|
9303 |
type == stringAtom ifTrue:[ |
|
9304 |
^ value |
|
9305 |
]. |
|
9306 |
(value isMemberOf:ByteArray) ifTrue:[ |
|
9307 |
^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil]) |
|
9308 |
] |
|
9309 |
]. |
|
1556 | 9310 |
^ nil |
9311 |
||
9312 |
"Modified: 6.4.1997 / 13:27:07 / cg" |
|
9313 |
! |
|
9314 |
||
3974 | 9315 |
getProperty:propertySymbolOrAtomID from:aWindowOrWindowIDOrNil delete:doDelete into:aTwoArgBlock |
1556 | 9316 |
"get a property, evaluate aTwoArgBlock with typeID and value" |
9317 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9318 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9319 |
|
3974 | 9320 |
|val typeID propertyID windowID| |
9321 |
||
9322 |
propertySymbolOrAtomID isString ifTrue:[ |
|
4082 | 9323 |
propertyID := self atomIDOf:propertySymbolOrAtomID create:false. |
9324 |
propertyID isNil ifTrue:[^ false]. |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9325 |
] ifFalse:[ |
4082 | 9326 |
propertyID := propertySymbolOrAtomID. |
3974 | 9327 |
]. |
9328 |
aWindowOrWindowIDOrNil isView ifTrue:[ |
|
4082 | 9329 |
windowID := aWindowOrWindowIDOrNil id. |
3974 | 9330 |
] ifFalse:[ |
4082 | 9331 |
windowID := aWindowOrWindowIDOrNil. |
3650 | 9332 |
]. |
9333 |
||
1556 | 9334 |
%{ |
9335 |
Window window; |
|
9336 |
Atom property; |
|
9337 |
char *cp, *cp2; |
|
9338 |
Atom actual_type; |
|
9339 |
int actual_format,i; |
|
9340 |
unsigned long nitems, bytes_after, nread; |
|
9341 |
unsigned char *data; |
|
9342 |
int ok = 1; |
|
9343 |
# define PROP_SIZE 2048 |
|
9344 |
||
9345 |
if (ISCONNECTED) { |
|
4082 | 9346 |
Display *dpy = myDpy; |
9347 |
||
9348 |
if (__isAtomID(propertyID)) { |
|
9349 |
property = __AtomVal(propertyID); |
|
9350 |
||
9351 |
if (__isExternalAddress(windowID)) { |
|
9352 |
window = __WindowVal(windowID); |
|
9353 |
} else if (windowID == nil) { |
|
9354 |
window = DefaultRootWindow(dpy); |
|
9355 |
} else |
|
9356 |
goto fail; |
|
9357 |
||
9358 |
nread = 0; |
|
9359 |
cp = 0; |
|
3974 | 9360 |
#ifdef PROPERTY_DEBUG |
4082 | 9361 |
fprintf(stderr, "getProperty %x\n", property); |
3974 | 9362 |
#endif |
9363 |
||
4082 | 9364 |
do { |
9365 |
int retVal; |
|
9366 |
||
9367 |
ENTER_XLIB(); |
|
9368 |
retVal = XGetWindowProperty(dpy, window, property, nread/4, PROP_SIZE, |
|
9369 |
doDelete == true, |
|
9370 |
AnyPropertyType, &actual_type, &actual_format, |
|
9371 |
&nitems, &bytes_after, (unsigned char **)&data); |
|
9372 |
LEAVE_XLIB(); |
|
9373 |
if (retVal != Success) { |
|
3974 | 9374 |
#ifdef PROPERTY_DEBUG |
4082 | 9375 |
fprintf(stderr, "- no success\n"); |
3974 | 9376 |
#endif |
4082 | 9377 |
ok = 0; |
9378 |
break; |
|
9379 |
} |
|
3974 | 9380 |
#ifdef PROPERTY_DEBUG |
4082 | 9381 |
fprintf(stderr, "- type:%x\n", actual_type); |
3974 | 9382 |
#endif |
4082 | 9383 |
typeID = __MKATOMOBJ(actual_type); |
9384 |
if (! cp) { |
|
9385 |
cp = cp2 = (char *)malloc(nitems+1); |
|
9386 |
} else { |
|
9387 |
cp = (char *)realloc(cp, nread + nitems + 1); |
|
9388 |
cp2 = cp + nread; |
|
9389 |
} |
|
9390 |
if (! cp) { |
|
9391 |
XFree(data); |
|
9392 |
goto fail; |
|
9393 |
} |
|
4245 | 9394 |
|
4082 | 9395 |
nread += nitems; |
9396 |
bcopy(data, cp2, nitems); |
|
9397 |
XFree(data); |
|
3974 | 9398 |
#ifdef PROPERTY_DEBUG |
4082 | 9399 |
fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after); |
3974 | 9400 |
#endif |
4082 | 9401 |
} while (bytes_after > 0); |
4245 | 9402 |
|
4082 | 9403 |
if (ok) { |
9404 |
if (actual_type == XA_STRING) { |
|
9405 |
cp[nread] = '\0'; |
|
9406 |
val = __MKSTRING_L(cp, nread); |
|
9407 |
} else { |
|
9408 |
val = __MKBYTEARRAY(cp, nread); |
|
9409 |
} |
|
9410 |
} |
|
9411 |
if (cp) |
|
9412 |
free(cp); |
|
9413 |
} |
|
1556 | 9414 |
} |
9415 |
fail: ; |
|
9416 |
%}. |
|
9417 |
typeID isNil ifTrue:[ |
|
4082 | 9418 |
^ false |
1556 | 9419 |
]. |
9420 |
aTwoArgBlock value:typeID value:val. |
|
9421 |
^ true |
|
3977 | 9422 |
|
9423 |
" |
|
4245 | 9424 |
Display |
4082 | 9425 |
getProperty:#'_DESKTOP_COLORS' |
9426 |
from:nil |
|
9427 |
delete:false |
|
9428 |
into:[:a :b | self halt] |
|
3977 | 9429 |
" |
1556 | 9430 |
! |
9431 |
||
3988 | 9432 |
getProperty:propertyID type:targetID from:aWindowID |
9433 |
| value | |
|
9434 |
||
9435 |
targetID == (self atomIDOf:#'ST_OBJECT') ifTrue:[ |
|
4082 | 9436 |
"an object" |
9437 |
^ self getObjectProperty:propertyID from:aWindowID. |
|
3988 | 9438 |
]. |
9439 |
||
9440 |
(targetID == stringAtom |
|
9441 |
or:[ targetID == (self atomIDOf:#'UTF8_STRING') |
|
9442 |
or:[ targetID == (self atomIDOf:#'COMPOUND_TEXT') |
|
9443 |
or:[ targetID == (self atomIDOf:#'TEXT') ]]]) ifTrue:[ |
|
4082 | 9444 |
"some kind of string" |
9445 |
value := self getTextProperty:propertyID from:aWindowID. |
|
9446 |
value notNil ifTrue:[ |
|
9447 |
(value endsWith:Character cr) ifTrue:[ |
|
9448 |
value := value asStringCollection copyWith:'' |
|
9449 |
] |
|
9450 |
]. |
|
9451 |
^ value. |
|
3988 | 9452 |
]. |
9453 |
||
9454 |
'XWorkstation [info]: unhandled targetType: ' infoPrint. |
|
9455 |
(self atomName:targetID) infoPrintCR. |
|
9456 |
^ nil. |
|
9457 |
! |
|
9458 |
||
1556 | 9459 |
getTextProperty:propertyID from:aWindowID |
9460 |
"get a text property; return string or nil" |
|
9461 |
||
4245 | 9462 |
self |
9463 |
getProperty:propertyID |
|
9464 |
from:aWindowID |
|
9465 |
delete:true |
|
4082 | 9466 |
into: |
9467 |
[:type :value | |
|
9468 |
|stringClass| |
|
9469 |
||
9470 |
type == stringAtom ifTrue:[ |
|
9471 |
clipBoardEncoding notNil ifTrue:[ |
|
9472 |
^ value decodeFrom:clipBoardEncoding |
|
4245 | 9473 |
]. |
4082 | 9474 |
^ value |
9475 |
]. |
|
9476 |
||
9477 |
type == (self atomIDOf:#'UTF8_STRING') ifTrue:[ |
|
4245 | 9478 |
"/ Transcript show:'UTF8: '; showCR:value storeString. |
4082 | 9479 |
^ CharacterArray fromUTF8Bytes:value |
9480 |
]. |
|
9481 |
||
9482 |
type == (self atomIDOf:#'TEXT') ifTrue:[ |
|
4245 | 9483 |
"/ Transcript show:'TEXT: '; showCR:value storeString. |
4082 | 9484 |
^ value asString |
9485 |
]. |
|
9486 |
||
9487 |
type == (self atomIDOf:#'COMPOUND_TEXT') ifTrue:[ |
|
4245 | 9488 |
"/ Transcript show:'COMPOUND_TEXT: '; showCR:value storeString. |
4082 | 9489 |
^ value asString |
9490 |
]. |
|
9491 |
||
9492 |
type == (self atomIDOf:#INCR) ifTrue:[ |
|
9493 |
'XWorkstation: unimplemented property type: INCR value: ' infoPrint. |
|
9494 |
value storeString infoPrintCR. |
|
9495 |
^ nil |
|
9496 |
]. |
|
9497 |
||
9498 |
'XWorkstation: unimplemented property type: ' infoPrint. type infoPrint. |
|
9499 |
' ' infoPrint. (self atomName:type) infoPrint. |
|
9500 |
' value:' infoPrint. value infoPrintCR. |
|
9501 |
^ nil |
|
9502 |
]. |
|
1556 | 9503 |
^ nil |
1793 | 9504 |
|
1798 | 9505 |
"Modified: 30.6.1997 / 20:54:59 / cg" |
3974 | 9506 |
|
9507 |
" |
|
4245 | 9508 |
Display getTextProperty:#'_KDE_GENERAL' from:nil. |
9509 |
Display getTextProperty:#'_DESKTOP_FONTS' from:nil. |
|
3974 | 9510 |
" |
1556 | 9511 |
! |
9512 |
||
3975 | 9513 |
propertiesOf:aWindowOrWindowIDOrNil |
9514 |
"return a collection of all properties' atomIDs of a window. |
|
9515 |
Returns the rootWindows props for a nil window argument." |
|
9516 |
||
9517 |
<context: #return> |
|
9518 |
||
9519 |
|windowID atoms| |
|
9520 |
||
9521 |
aWindowOrWindowIDOrNil isView ifTrue:[ |
|
4082 | 9522 |
windowID := aWindowOrWindowIDOrNil id. |
3975 | 9523 |
] ifFalse:[ |
4082 | 9524 |
windowID := aWindowOrWindowIDOrNil. |
3975 | 9525 |
]. |
9526 |
||
9527 |
%{ |
|
9528 |
Window window; |
|
9529 |
Atom *atomListPtr; |
|
9530 |
int i; |
|
9531 |
||
9532 |
if (ISCONNECTED) { |
|
4082 | 9533 |
Display *dpy = myDpy; |
9534 |
int numProps = 0; |
|
9535 |
||
9536 |
if (__isExternalAddress(windowID)) { |
|
9537 |
window = __WindowVal(windowID); |
|
9538 |
} else if (windowID == nil) { |
|
9539 |
window = DefaultRootWindow(dpy); |
|
9540 |
} else if (__isInteger(windowID)) { |
|
9541 |
window = (Window)__unsignedLongIntVal(windowID); |
|
9542 |
} else { |
|
9543 |
goto fail; |
|
9544 |
} |
|
9545 |
||
9546 |
ENTER_XLIB(); |
|
9547 |
atomListPtr = XListProperties(dpy, window, &numProps); |
|
9548 |
LEAVE_XLIB(); |
|
9549 |
||
9550 |
if (atomListPtr == NULL) { |
|
9551 |
RETURN (nil); |
|
9552 |
} |
|
9553 |
||
9554 |
atoms = __ARRAY_NEW_INT(numProps); |
|
9555 |
||
9556 |
if (atoms == nil) { |
|
9557 |
goto fail; |
|
9558 |
} |
|
9559 |
||
9560 |
for (i=0; i<numProps; i++) { |
|
9561 |
OBJ atm; |
|
9562 |
||
9563 |
atm = __MKATOMOBJ(atomListPtr[i]); |
|
9564 |
__ArrayInstPtr(atoms)->a_element[i] = atm; __STORE(atoms, atm); |
|
9565 |
} |
|
9566 |
XFree(atomListPtr); |
|
9567 |
RETURN (atoms); |
|
3975 | 9568 |
} |
9569 |
fail: ; |
|
9570 |
%}. |
|
9571 |
^ self primitiveFailed |
|
9572 |
||
9573 |
" |
|
9574 |
Display propertiesOf:nil |
|
9575 |
" |
|
9576 |
" |
|
9577 |
(Display propertiesOf:nil) do:[:atm | |
|
4082 | 9578 |
|v| |
9579 |
||
9580 |
Transcript show:(atm printStringLeftPaddedTo:5). |
|
9581 |
Transcript show:' '. |
|
9582 |
Display getProperty:atm from:nil delete:false into:[:type :val | v := type->val]. |
|
9583 |
Transcript showCR:v. |
|
3975 | 9584 |
] |
9585 |
" |
|
9586 |
! |
|
9587 |
||
1556 | 9588 |
setProperty:propertyID type:typeID value:anObject for:aWindowID |
9589 |
"set a property in the XServer" |
|
9590 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9591 |
<context: #return> |
3461
779f5d3cdcee
dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
9592 |
|
3790 | 9593 |
|retval| |
9594 |
||
9595 |
retval := false. |
|
9596 |
||
1556 | 9597 |
%{ /* UNLIMITEDSTACK */ |
3790 | 9598 |
if (ISCONNECTED && __isAtomID(propertyID) && __isAtomID(typeID)) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9599 |
Display *dpy = myDpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9600 |
Atom prop, type; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9601 |
Window window; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9602 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9603 |
prop = __AtomVal(propertyID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9604 |
type = __AtomVal(typeID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9605 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9606 |
if (__isExternalAddress(aWindowID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9607 |
window = __WindowVal(aWindowID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9608 |
} else if (aWindowID == nil) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9609 |
window = DefaultRootWindow(dpy); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9610 |
} else if (__isInteger(aWindowID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9611 |
window = (Window)__unsignedLongIntVal(aWindowID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9612 |
} else { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9613 |
RETURN(false); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9614 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9615 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9616 |
retval = true; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9617 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9618 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9619 |
if (__isSmallInteger(anObject)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9620 |
unsigned INT value = __intVal(anObject); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9621 |
XChangeProperty(dpy, window, prop, type, 32, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9622 |
PropModeReplace, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9623 |
(unsigned char *)&value, 1); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9624 |
} else if (__isByteArray(anObject)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9625 |
XChangeProperty(dpy, window, prop, type, 8, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9626 |
PropModeReplace, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9627 |
__byteArrayVal(anObject), |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9628 |
__byteArraySize(anObject)); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9629 |
} else if (__isWords(anObject)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9630 |
/* wordArray-like (16bit-string) object */ |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9631 |
XChangeProperty(dpy, window, prop, type, 16, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9632 |
PropModeReplace, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9633 |
__stringVal(anObject), |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9634 |
__wordArraySize(anObject)); |
3806 | 9635 |
#ifdef __integerArrayVal |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9636 |
} else if (__isIntegerArray(anObject)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9637 |
/* array of atoms */ |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9638 |
XChangeProperty(dpy, window, prop, type, 32, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9639 |
PropModeReplace, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9640 |
(char *)__integerArrayVal(anObject), |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9641 |
__integerArraySize(anObject)); |
3806 | 9642 |
#endif |
4245 | 9643 |
} else if (__isString(anObject) || __isSymbol(anObject)) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9644 |
XChangeProperty(dpy, window, prop, type, 8, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9645 |
PropModeReplace, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9646 |
__stringVal(anObject), |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9647 |
__stringSize(anObject)); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9648 |
} else { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9649 |
retval = false; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9650 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9651 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9652 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9653 |
DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type)); |
3790 | 9654 |
} |
9655 |
%}. |
|
9656 |
^ retval |
|
9657 |
! ! |
|
9658 |
||
9659 |
!XWorkstation methodsFor:'queries'! |
|
9660 |
||
9661 |
supportedClipboards |
|
9662 |
"answer a collection of symbols with the supported clipboards. |
|
4245 | 9663 |
X11 additionaly supports a buffer containing the currently selected text |
3790 | 9664 |
(in xterm) - the PRIMARY selection" |
9665 |
||
9666 |
^ #(clipboard selection) |
|
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
9667 |
! |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
9668 |
|
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
9669 |
supportsUTF8WindowLabels |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
9670 |
"answer true, if window labels are to be utf-8 encoded" |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
9671 |
|
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
9672 |
^ false |
1556 | 9673 |
! ! |
9674 |
||
295 | 9675 |
!XWorkstation methodsFor:'resources'! |
9676 |
||
1344 | 9677 |
atomIDOf:aStringOrSymbol |
3418 | 9678 |
"return an X11 atoms ID; dont create if not already present. |
9679 |
This is highly X specific and only for local use (with selections). |
|
9680 |
The default is to create the atom, if it does not exist, in order to |
|
9681 |
speed up future lookups" |
|
9682 |
||
9683 |
^ self atomIDOf:aStringOrSymbol create:true |
|
9684 |
||
9685 |
" |
|
4245 | 9686 |
Display atomIDOf:#'FACE_NAME' |
9687 |
Display atomIDOf:#'FULL_NAME' |
|
9688 |
Display atomIDOf:#DndProtocol |
|
9689 |
Display atomIDOf:#DndSelection |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9690 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9691 |
|
1535 | 9692 |
"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
|
9693 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9694 |
|
1344 | 9695 |
atomIDOf:aStringOrSymbol create:create |
3988 | 9696 |
"return an Atoms ID given its name. |
9697 |
If it already exists, return its ID. |
|
9698 |
If not and the create argument is true, it is created. |
|
9699 |
Otherwise, nil is returned. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9700 |
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
|
9701 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9702 |
|atomSymbol atom| |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9703 |
|
4245 | 9704 |
atomSymbol := aStringOrSymbol asSymbol. |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9705 |
(atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[ |
4082 | 9706 |
^ atom. |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9707 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9708 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9709 |
atom := self primAtomIDOf:atomSymbol create:create. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9710 |
atom notNil ifTrue:[ |
4082 | 9711 |
atoms isNil ifTrue:[ |
9712 |
atoms := IdentityDictionary new. |
|
9713 |
]. |
|
9714 |
atoms at:atomSymbol put:atom. |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9715 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9716 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9717 |
^ atom |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9718 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9719 |
" |
3418 | 9720 |
Display atomIDOf:#'VT_SELECTION' create:false |
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
9721 |
Display atomIDOf:#CLIPBOARD create:false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9722 |
Display atomIDOf:'STRING' create:false |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9723 |
Display atomIDOf:'PRIMARY' create:false |
4245 | 9724 |
Display atomIDOf:'blabla' create:false |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9725 |
" |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9726 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9727 |
|
1344 | 9728 |
atomName:anAtomID |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9729 |
"given an AtomID, return its name. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9730 |
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
|
9731 |
|
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9732 |
<context: #return> |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9733 |
|
4245 | 9734 |
%{ |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9735 |
OBJ str; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9736 |
char *name; |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9737 |
|
3418 | 9738 |
if (ISCONNECTED && __isAtomID(anAtomID)) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9739 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9740 |
name = XGetAtomName(myDpy, __AtomVal(anAtomID)); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9741 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9742 |
if (name == 0) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9743 |
RETURN (nil); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9744 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9745 |
str = __MKSTRING(name); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9746 |
XFree(name); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9747 |
RETURN ( str ); |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9748 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9749 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9750 |
self primitiveFailedOrClosedConnection. |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9751 |
^ nil |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9752 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9753 |
" |
3418 | 9754 |
Display atomName:1 'PRIMARY' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9755 |
Display atomName:130 '_DEC_DEVICE_FONTNAMES' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9756 |
Display atomName:132 'FONTNAME_REGISTRY' |
4245 | 9757 |
Display atomName:135 'FOUNDRY' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9758 |
Display atomName:150 'CHARSET_REGISTRY' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9759 |
Display atomName:151 'ISO8859' |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9760 |
Display atomName:152 'CHARSET_ENCODING' |
4245 | 9761 |
Display atomName:154 |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9762 |
" |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9763 |
! |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9764 |
|
1344 | 9765 |
getResource:name class:cls |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9766 |
"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
|
9767 |
of name in a resource class. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9768 |
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
|
9769 |
|
4245 | 9770 |
Notice: |
1344 | 9771 |
we do not plan to use X's resources for ST/X's defaults, |
9772 |
styles or resources. This would make porting of applications |
|
9773 |
to different platforms much more difficult (Windows has no resource |
|
9774 |
database). If you stay within ST/X's resource files, these can be |
|
9775 |
easily transported to other platforms. |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9776 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9777 |
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
|
9778 |
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
|
9779 |
platforms." |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9780 |
|
295 | 9781 |
%{ |
9782 |
char *rslt; |
|
9783 |
||
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9784 |
if (ISCONNECTED |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9785 |
&& __isNonNilObject(name) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9786 |
&& (__qIsString(name) || __qIsSymbol(name)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9787 |
&& __isNonNilObject(cls) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
9788 |
&& (__qIsString(cls) || __qIsSymbol(cls))) { |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9789 |
|
1831 | 9790 |
rslt = XGetDefault(myDpy, (char *) __stringVal(cls), |
9791 |
(char *) __stringVal(name)); |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
9792 |
|
1344 | 9793 |
RETURN (rslt ? __MKSTRING(rslt) : nil ); |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9794 |
} |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9795 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9796 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9797 |
^ nil. |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9798 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9799 |
"if your ~/.Xdefaults contains an entry such as: |
1344 | 9800 |
OpenWindows.Beep: notices |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9801 |
the following returns 'notices'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9802 |
|
4245 | 9803 |
Display getResource:'Beep' class:'OpenWindows' |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9804 |
|
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9805 |
if your ~/.Xdefaults contains an entry such as: |
1344 | 9806 |
*.beNiceToColormap: false |
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9807 |
the following return 'false'. |
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9808 |
|
4245 | 9809 |
Display getResource:'beNiceToColormap' class:'any' |
9810 |
Display getResource:'beNiceToColormap' class:'' |
|
487
f6ac7231749e
category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents:
486
diff
changeset
|
9811 |
" |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9812 |
! |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9813 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9814 |
primAtomIDOf:aStringOrSymbol create:create |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9815 |
"return an Atoms ID; if create is true, create it if not already present. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9816 |
This is highly X specific and only for local use (with selections)." |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9817 |
|
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9818 |
<context: #return> |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9819 |
|
4245 | 9820 |
%{ |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9821 |
Atom prop; |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9822 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9823 |
if (ISCONNECTED |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9824 |
&& __isNonNilObject(aStringOrSymbol) |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9825 |
&& (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) { |
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
9826 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9827 |
ENTER_XLIB(); |
4245 | 9828 |
prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9829 |
(create == true) ? False : True); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9830 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9831 |
if (prop == None) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9832 |
RETURN (nil); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9833 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
9834 |
RETURN ( __MKATOMOBJ(prop) ); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9835 |
} |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9836 |
%}. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9837 |
self primitiveFailedOrClosedConnection. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9838 |
^ nil |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9839 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9840 |
" |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9841 |
Display primAtomIDOf:'VT_SELECTION' create:false |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9842 |
Display primAtomIDOf:'CUT_BUFFER0' create:false |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9843 |
Display primAtomIDOf:'STRING' create:false |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9844 |
Display primAtomIDOf:'PRIMARY' create:false |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9845 |
" |
295 | 9846 |
! ! |
9847 |
||
9848 |
!XWorkstation methodsFor:'retrieving pixels'! |
|
9849 |
||
1462
f8b2909deb3c
renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents:
1455
diff
changeset
|
9850 |
getBitsFromId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits |
295 | 9851 |
"get bits from a drawable into the imageBits. The storage for the bits |
9852 |
must be big enough for the data to fit. If ok, returns an array with some |
|
9853 |
info and the bits in imageBits. The info contains the depth, bitOrder and |
|
9854 |
number of bytes per scanline. The number of bytes per scanline is not known |
|
9855 |
in advance, since the X-server is free to return whatever it thinks is a good padding." |
|
9856 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
9857 |
|rawInfo info| |
295 | 9858 |
|
9859 |
((w <= 0) or:[h <= 0]) ifTrue:[ |
|
1344 | 9860 |
self primitiveFailed. |
9861 |
^ nil |
|
295 | 9862 |
]. |
9863 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
9864 |
rawInfo := Array new:8. |
1344 | 9865 |
"1 -> bit order" |
9866 |
"2 -> depth" |
|
9867 |
"3 -> bytes_per_line" |
|
9868 |
"4 -> byte_order" |
|
9869 |
"5 -> format" |
|
9870 |
"6 -> bitmap_unit" |
|
9871 |
"7 -> bitmap_pad" |
|
9872 |
"8 -> bits_per_pixel" |
|
295 | 9873 |
|
9874 |
"/ had to extract the getPixel call into a separate method, to specify |
|
9875 |
"/ unlimitedStack (some implementations use alloca and require huge amounts |
|
9876 |
"/ of temporary stack space |
|
9877 |
||
397
094b8604ea72
return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
9878 |
(self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[ |
1344 | 9879 |
info := IdentityDictionary new. |
9880 |
info at:#bitOrder put:(rawInfo at:1). |
|
9881 |
info at:#depth put:(rawInfo at:2). |
|
9882 |
info at:#bytesPerLine put:(rawInfo at:3). |
|
9883 |
info at:#byteOrder put:(rawInfo at:4). |
|
9884 |
info at:#format put:(rawInfo at:5). |
|
9885 |
info at:#bitmapUnit put:(rawInfo at:6). |
|
9886 |
info at:#bitmapPad put:(rawInfo at:7). |
|
9887 |
info at:#bitsPerPixel put:(rawInfo at:8). |
|
9888 |
^ info |
|
295 | 9889 |
]. |
9890 |
" |
|
9891 |
some error occured - either args are not smallintegers, imageBits is not a ByteArray |
|
9892 |
or is too small to hold the bits |
|
9893 |
" |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9894 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9895 |
^ nil |
295 | 9896 |
! |
9897 |
||
2713
1aef3acb4e04
need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents:
2685
diff
changeset
|
9898 |
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
|
9899 |
"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
|
9900 |
Nil is returned for invalid coordinates or if any other problem arises." |
295 | 9901 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9902 |
<context: #return> |
3461
779f5d3cdcee
dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
9903 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9904 |
%{ /* UNLIMITEDSTACK */ |
295 | 9905 |
|
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
9906 |
Window win; |
295 | 9907 |
XImage *img; |
9908 |
int ret; |
|
9909 |
int xpos, ypos; |
|
9910 |
||
1209 | 9911 |
if (ISCONNECTED |
9912 |
&& __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9913 |
win = __WindowVal(aDrawableId); |
1344 | 9914 |
xpos = __intVal(x); |
9915 |
ypos = __intVal(y); |
|
9916 |
if ((xpos < 0) || (ypos < 0)) { |
|
9917 |
RETURN ( __MKSMALLINT(0) ); |
|
9918 |
} |
|
1974 | 9919 |
ENTER_XLIB(); |
1344 | 9920 |
img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap); |
1974 | 9921 |
LEAVE_XLIB(); |
1344 | 9922 |
if (img != 0) { |
9923 |
ret = XGetPixel(img, 0, 0); |
|
9924 |
XDestroyImage(img); |
|
9925 |
RETURN ( __MKSMALLINT(ret) ); |
|
9926 |
} |
|
295 | 9927 |
} |
9928 |
%}. |
|
9929 |
^ nil |
|
9930 |
! |
|
9931 |
||
1344 | 9932 |
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info |
4245 | 9933 |
"since XGetImage may allocate huge amount of stack space |
295 | 9934 |
(some implementations use alloca), this must run with unlimited stack." |
9935 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
9936 |
<context: #return> |
3461
779f5d3cdcee
dont send fail-messages (which raise an exception) from unlimited stack
Claus Gittinger <cg@exept.de>
parents:
3454
diff
changeset
|
9937 |
|
295 | 9938 |
%{ /* UNLIMITEDSTACK */ |
9939 |
||
303
f2021d90f12d
dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents:
295
diff
changeset
|
9940 |
Window win; |
295 | 9941 |
XImage *image = (XImage *)0; |
9942 |
int pad, bytes_per_line, numBytes; |
|
9943 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9944 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
9945 |
&& __isExternalAddress(aDrawableId) |
295 | 9946 |
&& __bothSmallInteger(srcx, srcy) |
9947 |
&& __bothSmallInteger(w, h) |
|
9948 |
&& __isArray(info) |
|
9949 |
&& __isByteArray(imageBits)) { |
|
1344 | 9950 |
Display *dpy = myDpy; |
9951 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
9952 |
win = __WindowVal(aDrawableId); |
1974 | 9953 |
ENTER_XLIB(); |
1344 | 9954 |
image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy), |
9955 |
__intVal(w), __intVal(h), |
|
9956 |
(unsigned)AllPlanes, ZPixmap); |
|
1974 | 9957 |
LEAVE_XLIB(); |
1344 | 9958 |
|
9959 |
if (! image) { |
|
9960 |
RETURN ( false ); |
|
9961 |
} |
|
9962 |
||
9963 |
pad = image->bitmap_pad; |
|
295 | 9964 |
#ifdef SUPERDEBUG |
1344 | 9965 |
printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth); |
295 | 9966 |
#endif |
1344 | 9967 |
switch (image->depth) { |
9968 |
case 1: |
|
9969 |
case 2: |
|
9970 |
case 4: |
|
9971 |
case 8: |
|
9972 |
case 16: |
|
9973 |
case 24: |
|
9974 |
case 32: |
|
9975 |
numBytes = image->bytes_per_line * image->height; |
|
9976 |
break; |
|
1728 | 9977 |
|
1344 | 9978 |
default: |
9979 |
/* unsupported depth ? */ |
|
3468 | 9980 |
fprintf(stderr, "possibly unsupported depth:%d in primGetBits\n", image->depth); |
1344 | 9981 |
numBytes = image->bytes_per_line * image->height; |
9982 |
break; |
|
9983 |
} |
|
295 | 9984 |
|
9985 |
#ifdef SUPERDEBUG |
|
1344 | 9986 |
printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits)); |
295 | 9987 |
#endif |
9988 |
||
1344 | 9989 |
if (numBytes > __byteArraySize(imageBits)) { |
9990 |
/* imageBits too small */ |
|
1728 | 9991 |
fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n"); |
9992 |
fprintf(stderr, " bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits)); |
|
4245 | 9993 |
fprintf(stderr, " pad:%d depth:%d imgBytesPerLine:%d\n", |
1728 | 9994 |
image->bitmap_pad, image->depth, image->bytes_per_line); |
1344 | 9995 |
goto fail; |
9996 |
} |
|
9997 |
if (image->bitmap_bit_order == MSBFirst) |
|
9998 |
__ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst); |
|
9999 |
else |
|
10000 |
__ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst); |
|
10001 |
__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth); |
|
10002 |
__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line); |
|
10003 |
if (image->byte_order == MSBFirst) |
|
10004 |
__ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst); |
|
10005 |
else |
|
10006 |
__ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst); |
|
10007 |
if (image->format == XYBitmap) |
|
10008 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap); |
|
10009 |
else if (image->format == XYPixmap) |
|
10010 |
__ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap); |
|
10011 |
else if (image->format == ZPixmap) |
|
10012 |
__ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap); |
|
4245 | 10013 |
|
1344 | 10014 |
__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit); |
10015 |
__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad); |
|
10016 |
__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel); |
|
10017 |
bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes); |
|
10018 |
XDestroyImage(image); |
|
10019 |
RETURN ( true ); |
|
295 | 10020 |
} |
4245 | 10021 |
fail: |
295 | 10022 |
if (image) { |
1344 | 10023 |
XDestroyImage(image); |
295 | 10024 |
} |
10025 |
%}. |
|
10026 |
^ false |
|
10027 |
! ! |
|
10028 |
||
10029 |
!XWorkstation methodsFor:'selections'! |
|
10030 |
||
3758 | 10031 |
addSelectionHandler:aHandler |
10032 |
SelectionHandlers isNil ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10033 |
SelectionHandlers := IdentitySet new. |
3758 | 10034 |
]. |
10035 |
SelectionHandlers add:aHandler |
|
10036 |
! |
|
10037 |
||
1344 | 10038 |
getSelectionFor:drawableId |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10039 |
"get the object selection - either immediate, or asynchronous. |
3790 | 10040 |
Returns nil, if async request is on its way. |
10041 |
||
10042 |
Smalltalk puts ST_OBJECT only into the CLIPBOARD" |
|
10043 |
||
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10044 |
|selectionOwnerWindowId| |
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10045 |
|
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10046 |
selectionOwnerWindowId := self getSelectionOwnerOf:clipboardAtom. |
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10047 |
selectionOwnerWindowId isNil ifTrue:[ |
4082 | 10048 |
^ nil "no selection" |
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10049 |
]. |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10050 |
selectionOwnerWindowId == selectionOwner ifTrue:[ |
4082 | 10051 |
"I still hold the selection, so return my locally buffered data" |
10052 |
^ copyBuffer |
|
3985 | 10053 |
]. |
10054 |
||
4245 | 10055 |
self |
10056 |
requestSelection:clipboardAtom |
|
10057 |
property:(self atomIDOf:#'ST_SELECTION') |
|
10058 |
type:(self atomIDOf:#'ST_OBJECT') |
|
4082 | 10059 |
for:drawableId. |
295 | 10060 |
^ nil |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10061 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10062 |
"Modified: / 17.6.1998 / 17:11:15 / cg" |
295 | 10063 |
! |
10064 |
||
3790 | 10065 |
getTextSelection:selectionBufferSymbol for:drawableId |
3779 | 10066 |
"get the text selection - either immediate, or asynchronous. |
4245 | 10067 |
Returns nil, if async request is on its way |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10068 |
or if no selection is available" |
3779 | 10069 |
|
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10070 |
|selectionId selectionOwnerWindowId| |
3790 | 10071 |
|
10072 |
selectionBufferSymbol == #selection ifTrue:[ |
|
4245 | 10073 |
selectionId := primaryAtom. |
3790 | 10074 |
] ifFalse:[ |
4245 | 10075 |
selectionId := clipboardAtom. |
3790 | 10076 |
]. |
10077 |
||
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10078 |
selectionOwnerWindowId := self getSelectionOwnerOf:selectionId. |
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10079 |
selectionOwnerWindowId isNil ifTrue:[ |
4245 | 10080 |
^ nil "no selection" |
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10081 |
]. |
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10082 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10083 |
selectionOwnerWindowId == selectionOwner ifTrue:[ |
4245 | 10084 |
"I still hold the selection, so return my locally buffered data" |
10085 |
^ self selectionAsString. |
|
10086 |
]. |
|
10087 |
||
10088 |
self |
|
10089 |
requestSelection:selectionId |
|
10090 |
property:(self atomIDOf:#'VT_SELECTION') |
|
10091 |
type:(self atomIDOf:#'UTF8_STRING') |
|
10092 |
for:drawableId. |
|
10093 |
||
10094 |
"/ self |
|
10095 |
"/ requestSelection:selectionId |
|
10096 |
"/ property:(self atomIDOf:#'VT_SELECTION') |
|
10097 |
"/ type:stringAtom |
|
4114 | 10098 |
"/ for:drawableId. |
10099 |
||
3790 | 10100 |
^ nil. |
3779 | 10101 |
! |
10102 |
||
10103 |
removeSelectionHandler:aHandler |
|
10104 |
SelectionHandlers notNil ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10105 |
SelectionHandlers remove:aHandler ifAbsent:nil. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10106 |
SelectionHandlers isEmpty ifTrue:[ |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10107 |
SelectionHandlers := nil |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10108 |
] |
3779 | 10109 |
]. |
10110 |
! |
|
10111 |
||
3790 | 10112 |
selectionAs:aTargetAtom |
10113 |
"convert the current selection to the format defined by aTargetAtom. |
|
10114 |
Answer the converted selection" |
|
10115 |
||
10116 |
|stream| |
|
10117 |
||
10118 |
(aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10119 |
"the other view wants the selection as string" |
4245 | 10120 |
^ self selectionAsString. |
3790 | 10121 |
]. |
10122 |
||
10123 |
(aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10124 |
"the other view wants to know which targets we support" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10125 |
^ self supportedTargetAtoms. |
3790 | 10126 |
]. |
10127 |
||
10128 |
(aTargetAtom == (self atomIDOf:#'ST_OBJECT')) ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10129 |
"send the selection in binaryStore format" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10130 |
stream := WriteStream on:(ByteArray new:200). |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10131 |
self getCopyBuffer storeBinaryOn:stream. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10132 |
^ stream contents. |
3790 | 10133 |
]. |
10134 |
||
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10135 |
aTargetAtom == (self atomIDOf:#LENGTH) ifTrue:[ |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10136 |
"the other one wants to know the size of our selection. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10137 |
LENGTH is deprecated, since we do not know how the selection is |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10138 |
going to be converted. The client must not rely on the length returned" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10139 |
|
4245 | 10140 |
^ self selectionAsString size |
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10141 |
]. |
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10142 |
|
3790 | 10143 |
"we do not support the requestet target" |
10144 |
^ nil. |
|
10145 |
! |
|
10146 |
||
3779 | 10147 |
sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID |
3790 | 10148 |
"send the selection back from a SelectionRequest" |
10149 |
||
10150 |
|property| |
|
10151 |
||
10152 |
property := propertyID. |
|
10153 |
property == 0 ifTrue:[ |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10154 |
"Support old (obsolete) clients requesting a None property. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10155 |
Set the propertyID to the targetID" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10156 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10157 |
property := targetID. |
3790 | 10158 |
]. |
10159 |
||
4245 | 10160 |
self setProperty:property |
10161 |
type:targetID |
|
10162 |
value:something |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10163 |
for:requestorID. |
3790 | 10164 |
|
4245 | 10165 |
self sendSelectionNotifySelection:selectionID |
10166 |
property:property |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10167 |
target:targetID |
4245 | 10168 |
time:t |
10169 |
from:windowID |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10170 |
to:requestorID. |
3779 | 10171 |
! |
10172 |
||
10173 |
setSelection:anObject owner:aWindowId |
|
10174 |
"set the object selection, and make aWindowId be the owner. |
|
3790 | 10175 |
This can be used by other Smalltalk(X) applications only. |
10176 |
We set only the CLIPBOARD selection" |
|
10177 |
||
10178 |
^ self setSelectionOwner:aWindowId of:clipboardAtom |
|
3779 | 10179 |
! |
10180 |
||
10181 |
setTextSelection:aString owner:aWindowId |
|
10182 |
"set the text selection, and make aWindowId be the owner. |
|
3790 | 10183 |
This can be used by any other X application. |
10184 |
||
4245 | 10185 |
We set both the PRIMARY and CLIPBOARD, so that you can paste |
3790 | 10186 |
into xterm." |
10187 |
||
10188 |
(self setSelectionOwner:aWindowId of:clipboardAtom) ifFalse:[ |
|
3806 | 10189 |
'XWorkstation [warning]: selection ownerchange failed' errorPrintCR. |
3790 | 10190 |
]. |
10191 |
self setSelectionOwner:aWindowId of:primaryAtom. |
|
10192 |
^ true |
|
3779 | 10193 |
|
10194 |
"Modified: / 17.6.1998 / 19:48:54 / cg" |
|
3790 | 10195 |
! |
10196 |
||
10197 |
supportedTargetAtoms |
|
10198 |
"answer an integer array containing the list of supported targets |
|
10199 |
i.e. supported clipboard formats" |
|
10200 |
||
10201 |
|supportedTargets numericTargetArray| |
|
10202 |
||
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10203 |
supportedTargets := #(ST_OBJECT STRING TARGETS LENGTH). |
3790 | 10204 |
|
10205 |
numericTargetArray := IntegerArray new:supportedTargets size. |
|
4245 | 10206 |
supportedTargets keysAndValuesDo:[:index :targetSymbol| |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10207 |
numericTargetArray at:index put:(self atomIDOf:targetSymbol) |
3790 | 10208 |
]. |
10209 |
||
10210 |
^ numericTargetArray |
|
3779 | 10211 |
! ! |
10212 |
||
10213 |
!XWorkstation methodsFor:'selections-basic'! |
|
10214 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10215 |
getSelectionOwnerOf:selectionAtomSymbolOrID |
295 | 10216 |
"get the owner of a selection" |
10217 |
||
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
10218 |
<context:#return> |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
10219 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10220 |
|selectionAtomID| |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10221 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10222 |
selectionAtomSymbolOrID isString ifTrue:[ |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10223 |
selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10224 |
] ifFalse:[ |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10225 |
selectionAtomID := selectionAtomSymbolOrID. |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10226 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10227 |
|
4245 | 10228 |
%{ |
295 | 10229 |
Window window; |
10230 |
||
3790 | 10231 |
if (__isAtomID(selectionAtomID) && ISCONNECTED) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10232 |
Display *dpy = myDpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10233 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10234 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10235 |
window = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID)); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10236 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10237 |
RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window)); |
295 | 10238 |
} |
10239 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10240 |
self primitiveFailedOrClosedConnection. |
295 | 10241 |
^ nil |
10242 |
! |
|
10243 |
||
1344 | 10244 |
requestSelection:selectionID property:propertyID type:typeID for:aWindowId |
295 | 10245 |
"ask the server to send us the selection - the view with id aWindowID |
10246 |
will later receive a SelectionNotify event for it (once the Xserver replies |
|
10247 |
with the selections value)." |
|
10248 |
||
3794
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
10249 |
<context:#return> |
3b5fbd07d46d
Delete property in X-Server when no longer used
Stefan Vogel <sv@exept.de>
parents:
3792
diff
changeset
|
10250 |
|
4245 | 10251 |
%{ |
295 | 10252 |
Atom sel_prop; |
10253 |
char *cp; |
|
10254 |
||
3758 | 10255 |
if ((__isExternalAddress(aWindowId) || (aWindowId == nil)) |
295 | 10256 |
&& ISCONNECTED |
3779 | 10257 |
&& __isAtomID(typeID) |
10258 |
&& __isAtomID(propertyID) |
|
295 | 10259 |
&& __isAtomID(selectionID)) { |
4082 | 10260 |
Display *dpy = myDpy; |
10261 |
Window w; |
|
10262 |
Window selectionOwner; |
|
10263 |
||
10264 |
if (__isExternalAddress(aWindowId)) { |
|
10265 |
w = __WindowVal(aWindowId); |
|
10266 |
} else { |
|
10267 |
w = (Window)0; |
|
10268 |
} |
|
10269 |
||
10270 |
ENTER_XLIB(); |
|
4245 | 10271 |
XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), |
4082 | 10272 |
__AtomVal(propertyID), w, CurrentTime); |
10273 |
LEAVE_XLIB(); |
|
10274 |
||
10275 |
RETURN (true); |
|
295 | 10276 |
} |
10277 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10278 |
self primitiveFailedOrClosedConnection. |
295 | 10279 |
^ false |
10280 |
||
10281 |
" |
|
4245 | 10282 |
Display |
4082 | 10283 |
requestSelection:(Display atomIDOf:'PRIMARY') |
10284 |
property:(Display atomIDOf:'VT_SELECTION') |
|
10285 |
type:(Display atomIDOf:'STRING') |
|
10286 |
for:Transcript id |
|
3985 | 10287 |
" |
10288 |
" |
|
4245 | 10289 |
Display |
4082 | 10290 |
requestSelection:(Display atomIDOf:'PRIMARY') |
10291 |
property:(Display atomIDOf:'VT_SELECTION') |
|
10292 |
type:(Display atomIDOf:'C_STRING') |
|
10293 |
for:Transcript id |
|
295 | 10294 |
" |
10295 |
! |
|
10296 |
||
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10297 |
sendSelectionNotifySelection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID |
295 | 10298 |
"send a selectionNotify back from a SelectionRequest" |
10299 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10300 |
<context: #return> |
4245 | 10301 |
%{ |
3790 | 10302 |
if (ISCONNECTED |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10303 |
&& (__isAtomID(propertyID) || propertyID == nil) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10304 |
&& __isAtomID(targetID) && __isAtomID(selectionID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10305 |
Display *dpy = myDpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10306 |
XEvent ev; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10307 |
Window requestor, originator; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10308 |
Status result; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10309 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10310 |
if (__isExternalAddress(requestorID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10311 |
requestor = __WindowVal(requestorID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10312 |
} else if (__isSmallInteger(requestorID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10313 |
requestor = (Window)__smallIntegerVal(requestorID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10314 |
} else if (requestorID == nil) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10315 |
requestor = DefaultRootWindow(dpy); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10316 |
} else { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10317 |
requestor = (Window)__unsignedLongIntVal(requestorID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10318 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10319 |
if (__isExternalAddress(windowID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10320 |
originator = __WindowVal(windowID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10321 |
} else if (__isSmallInteger(windowID)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10322 |
originator = (Window)__smallIntegerVal(windowID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10323 |
} else if (windowID == nil) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10324 |
originator = DefaultRootWindow(dpy); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10325 |
} else { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10326 |
originator = (Window)__unsignedLongIntVal(windowID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10327 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10328 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10329 |
ev.xselection.type = SelectionNotify; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10330 |
ev.xselection.display = dpy; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10331 |
ev.xselection.selection = __AtomVal(selectionID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10332 |
ev.xselection.target = __AtomVal(targetID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10333 |
ev.xselection.requestor = originator; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10334 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10335 |
if (__isExternalAddress(t)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10336 |
ev.xselection.time = (INT)(__externalAddressVal(t)); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10337 |
} else if (__isSmallInteger(t)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10338 |
ev.xselection.time = __smallIntegerVal(t); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10339 |
} else if (t == nil) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10340 |
ev.xselection.time = CurrentTime; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10341 |
} else { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10342 |
ev.xselection.time = (INT)__unsignedLongIntVal(t); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10343 |
} |
3238 | 10344 |
#if 0 |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10345 |
printf("ev.xselection.selection: %x\n", ev.xselection.selection); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10346 |
printf("ev.xselection.target: %x\n", ev.xselection.target); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10347 |
printf("ev.xselection.requestor: %x\n", ev.xselection.requestor); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10348 |
printf("ev.xselection.time: %x\n", ev.xselection.time); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10349 |
printf("requestor: %x\n", requestor); |
3779 | 10350 |
#endif |
3790 | 10351 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10352 |
/* send nil property if selection cannot be converted */ |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10353 |
if (propertyID == nil) |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10354 |
ev.xselection.property = None; |
4245 | 10355 |
else |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10356 |
ev.xselection.property = __AtomVal(propertyID); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10357 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10358 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10359 |
DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n", |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10360 |
ev.xselection.selection, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10361 |
ev.xselection.property, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10362 |
ev.xselection.target, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10363 |
ev.xselection.requestor, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10364 |
requestor)); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10365 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10366 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10367 |
result = XSendEvent(dpy, requestor, False, 0 , &ev); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10368 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10369 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10370 |
if ((result == BadValue) || (result == BadWindow)) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10371 |
DPRINTF(("bad status\n")); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10372 |
RETURN (false); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10373 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10374 |
ENTER_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10375 |
XFlush(dpy); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10376 |
LEAVE_XLIB(); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10377 |
RETURN (true) |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10378 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10379 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10380 |
self primitiveFailedOrClosedConnection. |
382 | 10381 |
^ false |
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10382 |
|
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10383 |
"Modified: / 17.6.1998 / 20:23:20 / cg" |
295 | 10384 |
! |
10385 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10386 |
setSelectionOwner:aWindowId of:selectionAtomSymbolOrID |
295 | 10387 |
"set the owner of a selection; return false if failed" |
10388 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10389 |
<context: #return> |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10390 |
|
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10391 |
|selectionAtomID| |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10392 |
|
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10393 |
"store the current owner of the selection. |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10394 |
If we still own the selection on paste, |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10395 |
we can avoid the X11 overhead" |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10396 |
|
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10397 |
selectionOwner := aWindowId. |
3797
a5b60da8de9a
Prepare local selection handling
Stefan Vogel <sv@exept.de>
parents:
3794
diff
changeset
|
10398 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10399 |
selectionAtomSymbolOrID isString ifTrue:[ |
3806 | 10400 |
selectionAtomID := self atomIDOf:selectionAtomSymbolOrID create:false. |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10401 |
] ifFalse:[ |
3806 | 10402 |
selectionAtomID := selectionAtomSymbolOrID. |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10403 |
]. |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10404 |
|
4245 | 10405 |
%{ |
295 | 10406 |
Window win; |
10407 |
||
10408 |
if (__isExternalAddress(aWindowId) |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10409 |
&& __isAtomID(selectionAtomID) |
295 | 10410 |
&& ISCONNECTED) { |
3806 | 10411 |
Display *dpy = myDpy; |
10412 |
Window owner; |
|
10413 |
||
10414 |
win = __WindowVal(aWindowId); |
|
10415 |
DPRINTF(("setOwner prop=%x win=%x\n", __AtomVal(selectionAtomID), win)); |
|
10416 |
ENTER_XLIB(); |
|
10417 |
XSetSelectionOwner(dpy, __AtomVal(selectionAtomID), win, CurrentTime); |
|
10418 |
owner = XGetSelectionOwner(dpy, __AtomVal(selectionAtomID)); |
|
10419 |
LEAVE_XLIB(); |
|
10420 |
if (owner != win) { |
|
10421 |
RETURN (false); |
|
10422 |
} |
|
10423 |
RETURN (true); |
|
2156
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10424 |
} |
0cb3b353630f
fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
10425 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10426 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10427 |
^ false |
295 | 10428 |
! ! |
10429 |
||
10430 |
!XWorkstation methodsFor:'window stuff'! |
|
10431 |
||
1344 | 10432 |
clearRectangleX:x y:y width:width height:height in:aWindowId |
295 | 10433 |
"clear a rectangular area to viewbackground" |
10434 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10435 |
<context: #return> |
4245 | 10436 |
%{ |
295 | 10437 |
|
10438 |
int w, h; |
|
10439 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10440 |
if (ISCONNECTED) { |
1344 | 10441 |
if (__isExternalAddress(aWindowId) |
10442 |
&& __bothSmallInteger(x, y) |
|
10443 |
&& __bothSmallInteger(width, height)) { |
|
10444 |
w = __intVal(width); |
|
10445 |
h = __intVal(height); |
|
10446 |
/* |
|
10447 |
* need this check here: some servers simply dump core with bad args |
|
10448 |
*/ |
|
10449 |
if ((w >= 0) && (h >= 0)) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10450 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10451 |
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
|
10452 |
LEAVE_XLIB(); |
1344 | 10453 |
} |
10454 |
RETURN ( self ); |
|
10455 |
} |
|
295 | 10456 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10457 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10458 |
self primitiveFailedOrClosedConnection. |
295 | 10459 |
! |
10460 |
||
1344 | 10461 |
clearWindow:aWindowId |
295 | 10462 |
"clear a window to viewbackground" |
10463 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10464 |
<context: #return> |
4245 | 10465 |
%{ |
295 | 10466 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10467 |
if (ISCONNECTED) { |
1344 | 10468 |
if (__isExternalAddress(aWindowId)) { |
1974 | 10469 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10470 |
XClearWindow(myDpy, __WindowVal(aWindowId)); |
1974 | 10471 |
LEAVE_XLIB(); |
1344 | 10472 |
RETURN ( self ); |
10473 |
} |
|
295 | 10474 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10475 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10476 |
self primitiveFailedOrClosedConnection |
295 | 10477 |
! |
10478 |
||
1344 | 10479 |
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol |
295 | 10480 |
"configure stacking operation of aWindowId w.r.t siblingId" |
10481 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10482 |
<context: #return> |
4245 | 10483 |
%{ |
295 | 10484 |
|
10485 |
XWindowChanges chg; |
|
10486 |
int mask = CWSibling | CWStackMode; |
|
10487 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10488 |
if (ISCONNECTED) { |
1344 | 10489 |
if (__isExternalAddress(aWindowId) |
10490 |
&& __isExternalAddress(siblingId)) { |
|
10491 |
if (modeSymbol == @symbol(above)) { |
|
10492 |
chg.stack_mode = Above; |
|
10493 |
} else if (modeSymbol == @symbol(below)) { |
|
10494 |
chg.stack_mode = Below; |
|
10495 |
} else if (modeSymbol == @symbol(topIf)) { |
|
10496 |
chg.stack_mode = TopIf; |
|
10497 |
} else if (modeSymbol == @symbol(bottomIf)) { |
|
10498 |
chg.stack_mode = BottomIf; |
|
10499 |
} else if (modeSymbol == @symbol(opposite)) { |
|
10500 |
chg.stack_mode = Opposite; |
|
10501 |
} else { |
|
10502 |
mask = CWSibling; |
|
10503 |
} |
|
10504 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10505 |
chg.sibling = __WindowVal(siblingId); |
1974 | 10506 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10507 |
XConfigureWindow(myDpy, __WindowVal(aWindowId), |
1344 | 10508 |
mask, &chg); |
1974 | 10509 |
LEAVE_XLIB(); |
1344 | 10510 |
RETURN ( self ); |
10511 |
} |
|
295 | 10512 |
} |
10513 |
bad: ; |
|
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10514 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10515 |
self primitiveFailedOrClosedConnection |
295 | 10516 |
! |
10517 |
||
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10518 |
getGeometryOf:aWindowId |
4245 | 10519 |
"get a windows geometry. |
10520 |
NOTICE: X-WindowManagers usually do wrap client topViews into their own |
|
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10521 |
decoration views (top label, resize boundaries etc.). |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10522 |
Thus, the numbers returned here for topViews are the physical (real) dimensions |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10523 |
relative to such a wrapper. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10524 |
In contrast, the values found in the views instance variables are virtual dimensions |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10525 |
(i.e. ST/X makes this decoration view transparent to the program." |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10526 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10527 |
<context: #return> |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10528 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10529 |
|x y width height depth borderWidth info| |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10530 |
|
4245 | 10531 |
%{ |
3790 | 10532 |
int x_ret, y_ret; |
4245 | 10533 |
unsigned int width_ret, height_ret, |
4082 | 10534 |
border_width_ret, depth_ret; |
3790 | 10535 |
Window root_ret; |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10536 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10537 |
if (ISCONNECTED |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10538 |
&& __isExternalAddress(aWindowId)) { |
4082 | 10539 |
ENTER_XLIB(); |
4245 | 10540 |
XGetGeometry(myDpy, __WindowVal(aWindowId), |
10541 |
&root_ret, |
|
10542 |
&x_ret, &y_ret, |
|
4082 | 10543 |
&width_ret, &height_ret, &border_width_ret, |
10544 |
&depth_ret); |
|
10545 |
LEAVE_XLIB(); |
|
10546 |
||
10547 |
x = __MKSMALLINT(x_ret); |
|
10548 |
y = __MKSMALLINT(y_ret); |
|
10549 |
width = __MKSMALLINT(width_ret); |
|
10550 |
height = __MKSMALLINT(height_ret); |
|
10551 |
depth = __MKSMALLINT(depth_ret); |
|
10552 |
borderWidth = __MKSMALLINT(border_width_ret); |
|
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10553 |
} |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10554 |
%}. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10555 |
borderWidth isNil ifTrue:[ |
4082 | 10556 |
self primitiveFailedOrClosedConnection. |
10557 |
^ nil |
|
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10558 |
]. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10559 |
info := Dictionary new. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10560 |
info at:#origin put:(x @ y). |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10561 |
info at:#extent put:(width @ height). |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10562 |
info at:#depth put:depth. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10563 |
info at:#borderWidth put:borderWidth. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10564 |
^ info |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10565 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10566 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10567 |
Transcript topView device |
4082 | 10568 |
getGeometryOf:(Transcript id) |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10569 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10570 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10571 |
Transcript topView device |
4082 | 10572 |
getGeometryOf:(Transcript topView id) |
4024 | 10573 |
" |
10574 |
" |
|
10575 |
Display |
|
4082 | 10576 |
getGeometryOf:(Display viewIdFromUser) |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10577 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10578 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10579 |
|d| |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10580 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10581 |
d := Transcript topView device. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10582 |
d getGeometryOf:(d parentWindowIdOf:Transcript topView id) |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10583 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10584 |
! |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10585 |
|
2457 | 10586 |
isValidWindowId:aWindowId |
10587 |
"return true, if the given window ID is (still) valid. |
|
4245 | 10588 |
Especially useful, if the passed windowID is |
2457 | 10589 |
an alien (external) windows id." |
10590 |
||
10591 |
|ret| |
|
10592 |
||
4245 | 10593 |
%{ |
2457 | 10594 |
|
10595 |
if (ISCONNECTED |
|
10596 |
&& __isExternalAddress(aWindowId)) { |
|
10597 |
char *name = NULL; |
|
10598 |
Status ok; |
|
10599 |
Window root, parent, *children = NULL; |
|
10600 |
int nChildren; |
|
10601 |
||
10602 |
/* ENTER_XLIB(); */ |
|
4245 | 10603 |
ok = XQueryTree(myDpy, __WindowVal(aWindowId), |
2457 | 10604 |
&root, &parent, &children, &nChildren); |
10605 |
if (children) { |
|
10606 |
XFree(children); |
|
10607 |
} |
|
10608 |
/* LEAVE_XLIB(); */ |
|
10609 |
if (ok) { |
|
10610 |
RETURN (true); |
|
10611 |
} |
|
10612 |
RETURN (false); |
|
10613 |
} |
|
10614 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10615 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10616 |
^ false |
2457 | 10617 |
|
10618 |
" |
|
10619 |
|v aWindowId ok| |
|
10620 |
||
10621 |
v := StandardSystemView new. |
|
10622 |
v label:'hello'. |
|
10623 |
v openAndWait. |
|
10624 |
aWindowId := v id. |
|
10625 |
ok := Display isValidWindowId:aWindowId. |
|
10626 |
Transcript showCR:'ok is: ' , ok printString. |
|
10627 |
Delay waitForSeconds:1. |
|
10628 |
v destroy. |
|
10629 |
ok := Display isValidWindowId:aWindowId. |
|
10630 |
Transcript showCR:'ok is: ' , ok printString. |
|
10631 |
" |
|
10632 |
! |
|
10633 |
||
1344 | 10634 |
lowerWindow:aWindowId |
295 | 10635 |
"bring a window to back" |
10636 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10637 |
<context: #return> |
4245 | 10638 |
%{ |
295 | 10639 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10640 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10641 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10642 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10643 |
XLowerWindow(myDpy, __WindowVal(aWindowId)); |
1974 | 10644 |
LEAVE_XLIB(); |
1344 | 10645 |
RETURN ( self ); |
295 | 10646 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10647 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10648 |
self primitiveFailedOrClosedConnection |
295 | 10649 |
! |
10650 |
||
4245 | 10651 |
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos |
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10652 |
width:w height:h minExtent:minExt maxExtent:maxExt |
2650 | 10653 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10654 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10655 |
|
4245 | 10656 |
"make a window visible - either as icon or as a real view |
2650 | 10657 |
in addition, allow change of extend, position, minExtend and maxExtent. |
10658 |
Needed for restart, to allow recreating a view as iconified, |
|
10659 |
and to collaps/expand windows." |
|
295 | 10660 |
|
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10661 |
|wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH| |
295 | 10662 |
|
10663 |
aBoolean ifTrue:[ |
|
1344 | 10664 |
wicon := aView icon. |
10665 |
wicon notNil ifTrue:[ |
|
10666 |
wiconId := wicon id |
|
10667 |
]. |
|
10668 |
wiconView := aView iconView. |
|
10669 |
wiconView notNil ifTrue:[ |
|
10670 |
wiconViewId := wiconView id |
|
10671 |
]. |
|
10672 |
wlabel := aView label. |
|
295 | 10673 |
]. |
2105
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10674 |
minExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10675 |
minW := minExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10676 |
minH := minExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10677 |
]. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10678 |
maxExt notNil ifTrue:[ |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10679 |
maxW := maxExt x. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10680 |
maxH := maxExt y. |
1c1277d63a2c
pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
10681 |
]. |
4245 | 10682 |
%{ |
295 | 10683 |
|
10684 |
XWMHints wmhints; |
|
10685 |
XSizeHints szhints; |
|
10686 |
Window win; |
|
10687 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10688 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10689 |
&& __isExternalAddress(aWindowId)) { |
1344 | 10690 |
Display *dpy = myDpy; |
10691 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10692 |
win = __WindowVal(aWindowId); |
1344 | 10693 |
|
10694 |
szhints.flags = 0; |
|
10695 |
if (__bothSmallInteger(xPos, yPos)) { |
|
10696 |
szhints.x = __intVal(xPos); |
|
10697 |
szhints.y = __intVal(yPos); |
|
10698 |
szhints.flags |= USPosition; |
|
10699 |
} |
|
10700 |
if (__bothSmallInteger(w, h)) { |
|
10701 |
szhints.width = __intVal(w); |
|
10702 |
szhints.height = __intVal(h); |
|
10703 |
szhints.flags |= USSize; |
|
10704 |
} |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10705 |
if (__bothSmallInteger(minW, minH)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10706 |
szhints.flags |= PMinSize; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10707 |
szhints.min_width = __intVal(minW); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10708 |
szhints.min_height = __intVal(minH); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10709 |
} |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10710 |
if (__bothSmallInteger(maxW, maxH)) { |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10711 |
szhints.flags |= PMaxSize; |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10712 |
szhints.max_width = __intVal(maxW); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10713 |
szhints.max_height = __intVal(maxH); |
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10714 |
} |
1344 | 10715 |
|
10716 |
if (aBoolean == true) { |
|
10717 |
char *windowName; |
|
10718 |
Pixmap iconBitmap = (Pixmap)0; |
|
10719 |
Window iconWindow; |
|
10720 |
||
10721 |
if (__isExternalAddress(wiconId)) |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10722 |
iconBitmap = __PixmapVal(wiconId); |
1344 | 10723 |
else |
10724 |
iconBitmap = (Pixmap)0; |
|
10725 |
||
10726 |
if (__isExternalAddress(wiconViewId)) |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10727 |
iconWindow = __WindowVal(wiconViewId); |
1344 | 10728 |
else |
10729 |
iconWindow = (Window)0; |
|
10730 |
||
10731 |
if (__isString(wlabel) || __isSymbol(wlabel)) |
|
1831 | 10732 |
windowName = (char *) __stringVal(wlabel); |
1344 | 10733 |
else |
10734 |
windowName = ""; |
|
10735 |
||
10736 |
if (iconBitmap || windowName) { |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10737 |
ENTER_XLIB(); |
1344 | 10738 |
XSetStandardProperties(dpy, win, |
10739 |
windowName, windowName, |
|
10740 |
iconBitmap, |
|
10741 |
0, 0, &szhints); |
|
2305
7746d6252645
added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2289
diff
changeset
|
10742 |
LEAVE_XLIB(); |
1344 | 10743 |
} |
10744 |
||
10745 |
wmhints.flags = 0; |
|
10746 |
if (iconBitmap) { |
|
10747 |
wmhints.flags |= IconPixmapHint; |
|
10748 |
wmhints.icon_pixmap = iconBitmap; |
|
10749 |
} |
|
10750 |
if (iconWindow) { |
|
10751 |
wmhints.flags |= IconWindowHint; |
|
10752 |
wmhints.icon_window = iconWindow; |
|
10753 |
} |
|
10754 |
||
10755 |
wmhints.initial_state = IconicState; |
|
10756 |
wmhints.flags |= StateHint; |
|
1974 | 10757 |
ENTER_XLIB(); |
1344 | 10758 |
XSetWMHints(dpy, win, &wmhints); |
1974 | 10759 |
LEAVE_XLIB(); |
1344 | 10760 |
} |
10761 |
||
10762 |
if (szhints.flags) { |
|
1974 | 10763 |
ENTER_XLIB(); |
1344 | 10764 |
XSetNormalHints(dpy, win, &szhints); |
1974 | 10765 |
LEAVE_XLIB(); |
10766 |
} |
|
10767 |
||
10768 |
ENTER_XLIB(); |
|
1344 | 10769 |
XMapWindow(dpy, win); |
1974 | 10770 |
LEAVE_XLIB(); |
1344 | 10771 |
RETURN ( self ); |
295 | 10772 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10773 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10774 |
self primitiveFailedOrClosedConnection |
295 | 10775 |
! |
10776 |
||
1344 | 10777 |
mapWindow:aWindowId |
295 | 10778 |
"make a window visible" |
10779 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10780 |
<context: #return> |
4245 | 10781 |
%{ |
295 | 10782 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10783 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10784 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10785 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10786 |
XMapWindow(myDpy, __WindowVal(aWindowId)); |
1974 | 10787 |
LEAVE_XLIB(); |
1344 | 10788 |
RETURN ( self ); |
295 | 10789 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10790 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10791 |
self primitiveFailedOrClosedConnection |
295 | 10792 |
! |
10793 |
||
1344 | 10794 |
moveResizeWindow:aWindowId x:x y:y width:w height:h |
295 | 10795 |
"move and resize a window" |
10796 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10797 |
<context: #return> |
4245 | 10798 |
%{ |
295 | 10799 |
|
10800 |
int newWidth, newHeight; |
|
10801 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10802 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10803 |
&& __isExternalAddress(aWindowId) |
295 | 10804 |
&& __bothSmallInteger(w, h) |
10805 |
&& __bothSmallInteger(x, y)) { |
|
1344 | 10806 |
newWidth = __intVal(w); |
10807 |
newHeight = __intVal(h); |
|
10808 |
if (newWidth < 1) newWidth = 1; |
|
10809 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 10810 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10811 |
XMoveResizeWindow(myDpy, __WindowVal(aWindowId), |
1344 | 10812 |
__intVal(x), __intVal(y), |
10813 |
newWidth, newHeight); |
|
1974 | 10814 |
LEAVE_XLIB(); |
1344 | 10815 |
RETURN ( self ); |
295 | 10816 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10817 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10818 |
self primitiveFailedOrClosedConnection |
295 | 10819 |
! |
10820 |
||
1344 | 10821 |
moveWindow:aWindowId x:x y:y |
295 | 10822 |
"move a window" |
10823 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10824 |
<context: #return> |
4245 | 10825 |
%{ |
295 | 10826 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10827 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10828 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) { |
1974 | 10829 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10830 |
XMoveWindow(myDpy, __WindowVal(aWindowId), __intVal(x), __intVal(y)); |
1974 | 10831 |
LEAVE_XLIB(); |
1344 | 10832 |
RETURN ( self ); |
295 | 10833 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10834 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10835 |
self primitiveFailedOrClosedConnection |
295 | 10836 |
! |
10837 |
||
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10838 |
parentWindowIdOf:aWindowId |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10839 |
"return a windows parent-window id. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10840 |
Useful with getGeometryOf:, to compute information about the decoration." |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10841 |
|
4245 | 10842 |
%{ |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10843 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10844 |
if (ISCONNECTED |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10845 |
&& __isExternalAddress(aWindowId)) { |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10846 |
Status ok; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10847 |
Window root, parent, *children = NULL; |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10848 |
int nChildren; |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10849 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10850 |
/* ENTER_XLIB(); */ |
4245 | 10851 |
ok = XQueryTree(myDpy, __WindowVal(aWindowId), |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10852 |
&root, &parent, &children, &nChildren); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10853 |
if (children) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10854 |
XFree(children); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10855 |
} |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10856 |
/* LEAVE_XLIB(); */ |
3798
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10857 |
if (! ok) { |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10858 |
RETURN ( nil ); |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10859 |
} |
17ceda3c711f
Handle local selections locally.
Stefan Vogel <sv@exept.de>
parents:
3797
diff
changeset
|
10860 |
RETURN ( __MKEXTERNALADDRESS(parent) ); |
3789
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10861 |
} |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10862 |
%}. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10863 |
self primitiveFailedOrClosedConnection. |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10864 |
^ false |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10865 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10866 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10867 |
|id| |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10868 |
|
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10869 |
id := Transcript device parentWindowIdOf:(Transcript id). |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10870 |
self assert: ( Transcript container id = id ). |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10871 |
" |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10872 |
! |
712d129efee8
added parentWindowIdOf: and getGeometryOf:
Claus Gittinger <cg@exept.de>
parents:
3788
diff
changeset
|
10873 |
|
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10874 |
primSetWindowName:aString in:aWindowId |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10875 |
"define a windows name" |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10876 |
|
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10877 |
<context: #return> |
4245 | 10878 |
%{ |
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10879 |
|
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10880 |
if (ISCONNECTED |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10881 |
&& __isNonNilObject(aString) |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10882 |
&& (__qIsString(aString) || __qIsSymbol(aString)) |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10883 |
&& __isExternalAddress(aWindowId)) { |
4245 | 10884 |
ENTER_XLIB(); |
10885 |
XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString)); |
|
10886 |
LEAVE_XLIB(); |
|
10887 |
RETURN ( self ); |
|
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10888 |
} |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10889 |
%}. |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10890 |
self primitiveFailedOrClosedConnection |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10891 |
! |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
10892 |
|
1344 | 10893 |
raiseWindow:aWindowId |
295 | 10894 |
"bring a window to front" |
10895 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10896 |
<context: #return> |
4245 | 10897 |
%{ |
295 | 10898 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10899 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10900 |
&& __isExternalAddress(aWindowId)) { |
1974 | 10901 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10902 |
XRaiseWindow(myDpy, __WindowVal(aWindowId)); |
1974 | 10903 |
LEAVE_XLIB(); |
1344 | 10904 |
RETURN ( self ); |
295 | 10905 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10906 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10907 |
self primitiveFailedOrClosedConnection |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10908 |
! |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10909 |
|
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10910 |
reparentWindow:windowId to:newParentWindowId |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10911 |
"change a windows parent (an optional interface)" |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10912 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10913 |
<context: #return> |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10914 |
%{ |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10915 |
if (ISCONNECTED |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10916 |
&& __isExternalAddress(windowId) |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10917 |
&& __isExternalAddress(newParentWindowId)) { |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10918 |
Display *dpy = myDpy; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10919 |
Window _child, _newParent; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10920 |
int i; |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10921 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10922 |
_child = __WindowVal(windowId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10923 |
_newParent = __WindowVal(newParentWindowId); |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10924 |
ENTER_XLIB(); |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10925 |
|
2428 | 10926 |
#if 0 |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10927 |
XWithdrawWindow (dpy, _child, DefaultScreen(dpy)); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10928 |
XSync (dpy, 0); |
2428 | 10929 |
#endif |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10930 |
/* |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10931 |
* Code 'stolen' from xswallow source ... |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10932 |
* ... mhmh - what is this loop for ? |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10933 |
*/ |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10934 |
for (i=0; i<5; i++) { |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10935 |
XReparentWindow (dpy, _child, _newParent, 0, 0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10936 |
XSync (dpy, 0); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10937 |
} |
2428 | 10938 |
#if 0 |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10939 |
XMapWindow (dpy, _child); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10940 |
XSync (dpy, 0); |
2428 | 10941 |
#endif |
3222
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10942 |
LEAVE_XLIB(); |
0bb571e07c0e
moved screen instance variable
Claus Gittinger <cg@exept.de>
parents:
3220
diff
changeset
|
10943 |
RETURN ( true ); |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10944 |
} |
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10945 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10946 |
self primitiveFailedOrClosedConnection |
295 | 10947 |
! |
10948 |
||
1344 | 10949 |
resizeWindow:aWindowId width:w height:h |
295 | 10950 |
"resize a window" |
10951 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10952 |
<context: #return> |
4245 | 10953 |
%{ |
295 | 10954 |
|
10955 |
int newWidth, newHeight; |
|
10956 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10957 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10958 |
&& __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) { |
1344 | 10959 |
newWidth = __intVal(w); |
10960 |
newHeight = __intVal(h); |
|
10961 |
if (newWidth < 1) newWidth = 1; |
|
10962 |
if (newHeight < 1) newHeight = 1; |
|
1974 | 10963 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10964 |
XResizeWindow(myDpy, __WindowVal(aWindowId), newWidth, newHeight); |
1974 | 10965 |
LEAVE_XLIB(); |
1344 | 10966 |
RETURN ( self ); |
295 | 10967 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
10968 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10969 |
self primitiveFailedOrClosedConnection |
295 | 10970 |
! |
10971 |
||
1344 | 10972 |
setBackingStore:how in:aWindowId |
295 | 10973 |
"turn on/off backing-store for a window" |
10974 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10975 |
<context: #return> |
4245 | 10976 |
%{ |
295 | 10977 |
|
10978 |
XSetWindowAttributes wa; |
|
10979 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10980 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
10981 |
&& __isExternalAddress(aWindowId)) { |
1344 | 10982 |
if (__INST(ignoreBackingStore) != true) { |
10983 |
if (how == @symbol(always)) wa.backing_store = Always; |
|
10984 |
else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped; |
|
10985 |
else if (how == true) wa.backing_store = Always; |
|
10986 |
else wa.backing_store = 0; |
|
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
10987 |
|
1974 | 10988 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
10989 |
XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBackingStore, &wa); |
1974 | 10990 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
10991 |
|
1344 | 10992 |
} |
10993 |
RETURN ( self ); |
|
295 | 10994 |
} |
10995 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
10996 |
self primitiveFailedOrClosedConnection |
295 | 10997 |
! |
10998 |
||
1344 | 10999 |
setBitGravity:how in:aWindowId |
295 | 11000 |
"set bit gravity for a window" |
11001 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11002 |
<context: #return> |
4245 | 11003 |
%{ |
295 | 11004 |
|
11005 |
XSetWindowAttributes wa; |
|
11006 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11007 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11008 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11009 |
if (how == @symbol(NorthWest)) { |
11010 |
wa.bit_gravity = NorthWestGravity; |
|
11011 |
} else if (how == @symbol(NorthEast)) { |
|
11012 |
wa.bit_gravity = NorthEastGravity; |
|
11013 |
} else if (how == @symbol(SouthWest)) { |
|
11014 |
wa.bit_gravity = SouthWestGravity; |
|
11015 |
} else if (how == @symbol(SouthEast)) { |
|
11016 |
wa.bit_gravity = SouthEastGravity; |
|
11017 |
} else if (how == @symbol(Center)) { |
|
11018 |
wa.bit_gravity = CenterGravity; |
|
11019 |
} else if (how == @symbol(North)) { |
|
11020 |
wa.bit_gravity = NorthGravity; |
|
11021 |
} else if (how == @symbol(South)) { |
|
11022 |
wa.bit_gravity = SouthGravity; |
|
11023 |
} else if (how == @symbol(West)) { |
|
11024 |
wa.bit_gravity = WestGravity; |
|
11025 |
} else if (how == @symbol(East)) { |
|
11026 |
wa.bit_gravity = EastGravity; |
|
11027 |
} else { |
|
11028 |
wa.bit_gravity = NorthWestGravity; |
|
11029 |
} |
|
11030 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
11031 |
|
1974 | 11032 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11033 |
XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWBitGravity, &wa); |
1974 | 11034 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
11035 |
|
1344 | 11036 |
RETURN ( self ); |
295 | 11037 |
} |
11038 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11039 |
self primitiveFailedOrClosedConnection |
295 | 11040 |
! |
11041 |
||
1344 | 11042 |
setCursor:aCursorId in:aWindowId |
295 | 11043 |
"define a windows cursor" |
11044 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11045 |
<context: #return> |
4245 | 11046 |
%{ |
295 | 11047 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11048 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11049 |
&& __isExternalAddress(aWindowId) |
295 | 11050 |
&& __isExternalAddress(aCursorId)) { |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11051 |
Display *dpy = myDpy; |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11052 |
Window w = __WindowVal(aWindowId); |
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11053 |
Cursor c = __CursorVal(aCursorId); |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11054 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11055 |
if (w && c) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11056 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11057 |
XDefineCursor(dpy, w, c); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11058 |
LEAVE_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11059 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11060 |
RETURN ( self ); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11061 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11062 |
%}. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11063 |
self primitiveFailedOrClosedConnection |
295 | 11064 |
! |
11065 |
||
1344 | 11066 |
setIconName:aString in:aWindowId |
295 | 11067 |
"define a windows iconname" |
11068 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11069 |
<context: #return> |
4245 | 11070 |
%{ |
295 | 11071 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11072 |
if (ISCONNECTED |
2531
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
11073 |
&& __isNonNilObject(aString) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
11074 |
&& (__qIsString(aString) || __qIsSymbol(aString)) |
e4d6bdae7bcf
use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents:
2501
diff
changeset
|
11075 |
&& __isExternalAddress(aWindowId)) { |
1974 | 11076 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11077 |
XSetIconName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString)); |
1974 | 11078 |
LEAVE_XLIB(); |
1344 | 11079 |
RETURN ( self ); |
295 | 11080 |
} |
11081 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11082 |
self primitiveFailedOrClosedConnection |
295 | 11083 |
! |
11084 |
||
1344 | 11085 |
setSaveUnder:yesOrNo in:aWindowId |
295 | 11086 |
"turn on/off save-under for a window" |
11087 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11088 |
<context: #return> |
4245 | 11089 |
%{ |
295 | 11090 |
|
11091 |
XSetWindowAttributes wa; |
|
11092 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11093 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11094 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11095 |
if (__INST(hasSaveUnder) == true) { |
11096 |
wa.save_under = (yesOrNo == true) ? 1 : 0; |
|
1974 | 11097 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11098 |
XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWSaveUnder, &wa); |
1974 | 11099 |
LEAVE_XLIB(); |
1344 | 11100 |
} |
11101 |
RETURN ( self ); |
|
295 | 11102 |
} |
11103 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11104 |
self primitiveFailedOrClosedConnection |
295 | 11105 |
! |
11106 |
||
1344 | 11107 |
setTransient:aWindowId for:aMainWindowId |
295 | 11108 |
"set aWindowId to be a transient of aMainWindow" |
11109 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11110 |
<context: #return> |
4245 | 11111 |
%{ |
295 | 11112 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11113 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11114 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11115 |
Window w; |
11116 |
||
11117 |
if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) { |
|
11118 |
w = (Window) 0; |
|
11119 |
} else { |
|
11120 |
if (__isExternalAddress(aMainWindowId)) { |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11121 |
w = __WindowVal(aMainWindowId); |
1344 | 11122 |
} else { |
11123 |
goto getOutOfHere; |
|
11124 |
} |
|
11125 |
} |
|
1974 | 11126 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11127 |
XSetTransientForHint(myDpy, __WindowVal(aWindowId), w); |
1974 | 11128 |
LEAVE_XLIB(); |
1344 | 11129 |
RETURN ( self ); |
295 | 11130 |
} |
353
5be3ae3c8838
sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
11131 |
getOutOfHere: ; |
295 | 11132 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11133 |
self primitiveFailedOrClosedConnection |
295 | 11134 |
! |
11135 |
||
1344 | 11136 |
setWindowBackground:aColorIndex in:aWindowId |
295 | 11137 |
"set the windows background color. This is the color with which |
11138 |
the view is filled whenever exposed. Do not confuse this with |
|
11139 |
the background drawing color, which is used with opaque drawing." |
|
11140 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11141 |
<context: #return> |
4245 | 11142 |
%{ |
295 | 11143 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11144 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11145 |
&& __isExternalAddress(aWindowId) |
295 | 11146 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 11147 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11148 |
XSetWindowBackground(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 11149 |
LEAVE_XLIB(); |
1344 | 11150 |
RETURN ( self ); |
295 | 11151 |
} |
11152 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11153 |
self primitiveFailedOrClosedConnection |
295 | 11154 |
! |
11155 |
||
1344 | 11156 |
setWindowBackgroundPixmap:aPixmapId in:aWindowId |
295 | 11157 |
"set the windows background pattern to be a form. |
4245 | 11158 |
This is the pattern with which the view is filled whenever exposed. |
11159 |
Do not confuse this with the background drawing color, which is used |
|
295 | 11160 |
with opaque drawing." |
11161 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11162 |
<context: #return> |
4245 | 11163 |
%{ |
295 | 11164 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11165 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11166 |
&& __isExternalAddress(aWindowId) |
295 | 11167 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 11168 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11169 |
XSetWindowBackgroundPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); |
1974 | 11170 |
LEAVE_XLIB(); |
1344 | 11171 |
RETURN ( self ); |
295 | 11172 |
} |
11173 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11174 |
self primitiveFailedOrClosedConnection |
295 | 11175 |
! |
11176 |
||
1344 | 11177 |
setWindowBorderColor:aColorIndex in:aWindowId |
295 | 11178 |
"set the windows border color" |
11179 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11180 |
<context: #return> |
4245 | 11181 |
%{ |
295 | 11182 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11183 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11184 |
&& __isExternalAddress(aWindowId) |
295 | 11185 |
&& __isSmallInteger(aColorIndex)) { |
1974 | 11186 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11187 |
XSetWindowBorder(myDpy, __WindowVal(aWindowId), __intVal(aColorIndex)); |
1974 | 11188 |
LEAVE_XLIB(); |
1344 | 11189 |
RETURN ( self ); |
295 | 11190 |
} |
11191 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11192 |
self primitiveFailedOrClosedConnection |
295 | 11193 |
! |
11194 |
||
1344 | 11195 |
setWindowBorderPixmap:aPixmapId in:aWindowId |
295 | 11196 |
"set the windows border pattern" |
11197 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11198 |
<context: #return> |
4245 | 11199 |
%{ |
295 | 11200 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11201 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11202 |
&& __isExternalAddress(aWindowId) |
295 | 11203 |
&& __isExternalAddress(aPixmapId)) { |
1974 | 11204 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11205 |
XSetWindowBorderPixmap(myDpy, __WindowVal(aWindowId), __PixmapVal(aPixmapId)); |
1974 | 11206 |
LEAVE_XLIB(); |
1344 | 11207 |
RETURN ( self ); |
295 | 11208 |
} |
2426
7cb649f45f93
added support to reparent a window
Claus Gittinger <cg@exept.de>
parents:
2422
diff
changeset
|
11209 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11210 |
self primitiveFailedOrClosedConnection |
295 | 11211 |
! |
11212 |
||
1344 | 11213 |
setWindowBorderShape:aPixmapId in:aWindowId |
295 | 11214 |
"set the windows border shape" |
11215 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11216 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11217 |
|
295 | 11218 |
hasShapeExtension ifFalse:[^ self]. |
11219 |
||
4245 | 11220 |
%{ |
295 | 11221 |
|
11222 |
#ifdef SHAPE |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11223 |
Pixmap shapeBitmap; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11224 |
|
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11225 |
if (__isExternalAddress(aPixmapId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11226 |
shapeBitmap = __PixmapVal(aPixmapId); |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11227 |
else |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11228 |
shapeBitmap = (Pixmap)0; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11229 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11230 |
if (ISCONNECTED |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11231 |
&& __isExternalAddress(aWindowId)) { |
1974 | 11232 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11233 |
XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeBounding, |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11234 |
0, 0, shapeBitmap, ShapeSet); |
1974 | 11235 |
LEAVE_XLIB(); |
1344 | 11236 |
RETURN ( self ); |
295 | 11237 |
} |
11238 |
#endif |
|
11239 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11240 |
self primitiveFailedOrClosedConnection |
295 | 11241 |
! |
11242 |
||
1344 | 11243 |
setWindowBorderWidth:aNumber in:aWindowId |
295 | 11244 |
"set the windows border width" |
11245 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11246 |
<context: #return> |
4245 | 11247 |
%{ |
295 | 11248 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11249 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11250 |
&& __isExternalAddress(aWindowId) |
295 | 11251 |
&& __isSmallInteger(aNumber)) { |
1974 | 11252 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11253 |
XSetWindowBorderWidth(myDpy, __WindowVal(aWindowId), __intVal(aNumber)); |
1974 | 11254 |
LEAVE_XLIB(); |
1344 | 11255 |
RETURN ( self ); |
295 | 11256 |
} |
11257 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11258 |
self primitiveFailedOrClosedConnection |
295 | 11259 |
! |
11260 |
||
1344 | 11261 |
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
|
11262 |
"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
|
11263 |
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
|
11264 |
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
|
11265 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11266 |
<context: #return> |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
11267 |
%{ |
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11268 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11269 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11270 |
XClassHint classhint; |
11271 |
||
11272 |
classhint.res_class = classhint.res_name = 0; |
|
11273 |
||
11274 |
if (__isString(wClass) || __isSymbol(wClass)) { |
|
1831 | 11275 |
classhint.res_class = (char *) __stringVal(wClass); |
1344 | 11276 |
} else if (wClass != nil) |
11277 |
goto error; |
|
11278 |
||
11279 |
if (__isString(wName) || __isSymbol(wName)) { |
|
1831 | 11280 |
classhint.res_name = (char *) __stringVal(wName); |
1344 | 11281 |
} else if (wName != nil) |
11282 |
goto error; |
|
11283 |
||
1974 | 11284 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11285 |
XSetClassHint(myDpy, __WindowVal(aWindowId), &classhint); |
1974 | 11286 |
LEAVE_XLIB(); |
1344 | 11287 |
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
|
11288 |
error:; |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
11289 |
} |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
11290 |
%}. |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11291 |
self primitiveFailedOrClosedConnection |
857
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
11292 |
! |
df5125310d86
New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents:
850
diff
changeset
|
11293 |
|
1344 | 11294 |
setWindowGravity:how in:aWindowId |
295 | 11295 |
"set window gravity for a window" |
11296 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11297 |
<context: #return> |
4245 | 11298 |
%{ |
295 | 11299 |
|
11300 |
XSetWindowAttributes wa; |
|
11301 |
||
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11302 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11303 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11304 |
if (how == @symbol(NorthWest)) { |
11305 |
wa.win_gravity = NorthWestGravity; |
|
11306 |
} else if (how == @symbol(NorthEast)) { |
|
11307 |
wa.win_gravity = NorthEastGravity; |
|
11308 |
} else if (how == @symbol(SouthWest)) { |
|
11309 |
wa.win_gravity = SouthWestGravity; |
|
11310 |
} else if (how == @symbol(SouthEast)) { |
|
11311 |
wa.win_gravity = SouthEastGravity; |
|
11312 |
} else if (how == @symbol(Center)) { |
|
11313 |
wa.win_gravity = CenterGravity; |
|
11314 |
} else if (how == @symbol(North)) { |
|
11315 |
wa.win_gravity = NorthGravity; |
|
11316 |
} else if (how == @symbol(South)) { |
|
11317 |
wa.win_gravity = SouthGravity; |
|
11318 |
} else if (how == @symbol(West)) { |
|
11319 |
wa.win_gravity = WestGravity; |
|
11320 |
} else if (how == @symbol(East)) { |
|
11321 |
wa.win_gravity = EastGravity; |
|
11322 |
} else { |
|
11323 |
wa.win_gravity = NorthWestGravity; |
|
11324 |
} |
|
11325 |
||
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
11326 |
|
1974 | 11327 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11328 |
XChangeWindowAttributes(myDpy, __WindowVal(aWindowId), CWWinGravity, &wa); |
1974 | 11329 |
LEAVE_XLIB(); |
3131
88293c577ba6
got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents:
3079
diff
changeset
|
11330 |
|
1344 | 11331 |
RETURN ( self ); |
295 | 11332 |
} |
11333 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11334 |
self primitiveFailedOrClosedConnection |
295 | 11335 |
! |
11336 |
||
1344 | 11337 |
setWindowIcon:aForm in:aWindowId |
295 | 11338 |
"define a bitmap to be used as icon" |
11339 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11340 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11341 |
|
295 | 11342 |
|iconId| |
11343 |
||
11344 |
aForm notNil ifTrue:[ |
|
1344 | 11345 |
iconId := aForm id |
295 | 11346 |
]. |
11347 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11348 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11349 |
&& __isExternalAddress(iconId) |
295 | 11350 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11351 |
XWMHints hints; |
11352 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11353 |
hints.icon_pixmap = __PixmapVal(iconId); |
1344 | 11354 |
hints.flags = IconPixmapHint; |
1974 | 11355 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11356 |
XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); |
1974 | 11357 |
LEAVE_XLIB(); |
1344 | 11358 |
RETURN ( self ); |
295 | 11359 |
} |
11360 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11361 |
self primitiveFailedOrClosedConnection |
295 | 11362 |
! |
11363 |
||
1376 | 11364 |
setWindowIcon:aForm mask:aMaskForm in:aWindowId |
1535 | 11365 |
"define a windows icon and (optional) iconMask." |
11366 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11367 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11368 |
|
1535 | 11369 |
|iconId maskId| |
11370 |
||
11371 |
aForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11372 |
iconId := aForm id |
1535 | 11373 |
]. |
11374 |
aMaskForm notNil ifTrue:[ |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11375 |
maskId := aMaskForm id. |
1535 | 11376 |
]. |
11377 |
%{ |
|
11378 |
if (ISCONNECTED |
|
11379 |
&& __isExternalAddress(iconId) |
|
11380 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11381 |
XWMHints hints; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11382 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11383 |
hints.icon_pixmap = __PixmapVal(iconId); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11384 |
hints.flags = IconPixmapHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11385 |
if ((maskId != nil) |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11386 |
&& __isExternalAddress(maskId)) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11387 |
hints.icon_mask = __PixmapVal(maskId); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11388 |
hints.flags |= IconMaskHint; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11389 |
} |
1974 | 11390 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11391 |
XSetWMHints(myDpy, __WindowVal(aWindowId), &hints); |
1974 | 11392 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11393 |
RETURN ( self ); |
1535 | 11394 |
} |
11395 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11396 |
self primitiveFailedOrClosedConnection |
1535 | 11397 |
|
1376 | 11398 |
! |
11399 |
||
1344 | 11400 |
setWindowIconWindow:aView in:aWindowId |
295 | 11401 |
"define a window to be used as icon" |
11402 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11403 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11404 |
|
295 | 11405 |
|iconWindowId| |
11406 |
||
11407 |
aView notNil ifTrue:[ |
|
1344 | 11408 |
iconWindowId := aView id |
295 | 11409 |
]. |
11410 |
%{ |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11411 |
if (ISCONNECTED |
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11412 |
&& __isExternalAddress(iconWindowId) |
295 | 11413 |
&& __isExternalAddress(aWindowId)) { |
1344 | 11414 |
XWMHints wmhints; |
11415 |
||
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11416 |
wmhints.icon_window = __WindowVal(iconWindowId); |
1344 | 11417 |
wmhints.flags = IconWindowHint; |
1974 | 11418 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11419 |
XSetWMHints(myDpy, __WindowVal(aWindowId), &wmhints); |
1974 | 11420 |
LEAVE_XLIB(); |
1344 | 11421 |
RETURN ( self ); |
295 | 11422 |
} |
11423 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11424 |
self primitiveFailedOrClosedConnection |
295 | 11425 |
! |
11426 |
||
3245 | 11427 |
setWindowMinExtentX:minW y:minH maxExtentX:maxW y:maxH in:aWindowId |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11428 |
"set a windows minimum & max extents. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11429 |
nil arguments are ignored." |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11430 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11431 |
<context: #return> |
4245 | 11432 |
%{ |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11433 |
if (ISCONNECTED |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11434 |
&& __isExternalAddress(aWindowId)) { |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11435 |
Display *dpy = myDpy; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11436 |
XSizeHints szhints; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11437 |
Window win; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11438 |
|
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11439 |
win = __WindowVal(aWindowId); |
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11440 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11441 |
szhints.flags = 0; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11442 |
if (__bothSmallInteger(minW, minH)) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11443 |
szhints.flags |= PMinSize; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11444 |
szhints.min_width = __intVal(minW); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11445 |
szhints.min_height = __intVal(minH); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11446 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11447 |
if (__bothSmallInteger(maxW, maxH)) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11448 |
szhints.flags |= PMaxSize; |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11449 |
szhints.max_width = __intVal(maxW); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11450 |
szhints.max_height = __intVal(maxH); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11451 |
} |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11452 |
|
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11453 |
if (szhints.flags) { |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11454 |
ENTER_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11455 |
XSetNormalHints(dpy, win, &szhints); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11456 |
LEAVE_XLIB(); |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11457 |
} |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11458 |
} |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11459 |
%}. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11460 |
! |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11461 |
|
1344 | 11462 |
setWindowName:aString in:aWindowId |
295 | 11463 |
"define a windows name" |
11464 |
||
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11465 |
|stringUsed| |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11466 |
|
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11467 |
stringUsed := aString. |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11468 |
self supportsUTF8WindowLabels ifTrue:[ |
4245 | 11469 |
stringUsed := aString utf8Encoded. |
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11470 |
] ifFalse:[ |
4245 | 11471 |
aString bitsPerCharacter > 8 ifTrue:[ |
11472 |
stringUsed := aString utf8Encoded. |
|
11473 |
]. |
|
4127
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11474 |
]. |
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11475 |
|
2be685c11752
to utf8 or not - that is the question
Michael Beyl <mb@exept.de>
parents:
4119
diff
changeset
|
11476 |
self primSetWindowName:stringUsed in:aWindowId |
295 | 11477 |
! |
11478 |
||
1344 | 11479 |
setWindowShape:aPixmapId in:aWindowId |
2647
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11480 |
"set the windows shape. |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11481 |
Returns false, if the display does not support the |
3c65550477c0
allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents:
2635
diff
changeset
|
11482 |
X shape extension." |
295 | 11483 |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11484 |
<context: #return> |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11485 |
|
295 | 11486 |
hasShapeExtension ifFalse:[^ self]. |
11487 |
||
4245 | 11488 |
%{ |
295 | 11489 |
|
11490 |
#ifdef SHAPE |
|
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11491 |
Pixmap shapeBitmap; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11492 |
|
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11493 |
if (__isExternalAddress(aPixmapId)) |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11494 |
shapeBitmap = __PixmapVal(aPixmapId); |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11495 |
else |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11496 |
shapeBitmap = (Pixmap)0; |
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11497 |
|
1207
274dbb13f15a
always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents:
1206
diff
changeset
|
11498 |
if (ISCONNECTED |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11499 |
&& __isExternalAddress(aWindowId)) { |
1974 | 11500 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11501 |
XShapeCombineMask(myDpy, __WindowVal(aWindowId), ShapeClip, |
1344 | 11502 |
0, 0, |
2758
329098f17dd9
allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents:
2748
diff
changeset
|
11503 |
shapeBitmap, ShapeSet); |
1974 | 11504 |
LEAVE_XLIB(); |
1344 | 11505 |
RETURN ( self ); |
295 | 11506 |
} |
11507 |
#endif |
|
11508 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11509 |
self primitiveFailedOrClosedConnection |
295 | 11510 |
! |
11511 |
||
1344 | 11512 |
unmapWindow:aWindowId |
295 | 11513 |
"make a window invisible" |
11514 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11515 |
<context: #return> |
4245 | 11516 |
%{ |
295 | 11517 |
|
1214 | 11518 |
if (!ISCONNECTED) { |
1344 | 11519 |
RETURN ( self ); |
1214 | 11520 |
} |
11521 |
||
11522 |
if (__isExternalAddress(aWindowId)) { |
|
1974 | 11523 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11524 |
XUnmapWindow(myDpy, __WindowVal(aWindowId)); |
1974 | 11525 |
LEAVE_XLIB(); |
1344 | 11526 |
RETURN ( self ); |
11527 |
} |
|
11528 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11529 |
self primitiveFailedOrClosedConnection |
1535 | 11530 |
! |
11531 |
||
11532 |
windowIsIconified:aWindowId |
|
11533 |
"return true, if some window is iconified. |
|
11534 |
The passed windowID may be an alien windows id." |
|
11535 |
||
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11536 |
<context: #return> |
4245 | 11537 |
%{ |
1535 | 11538 |
|
11539 |
if (ISCONNECTED |
|
11540 |
&& __isExternalAddress(aWindowId)) { |
|
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11541 |
Atom JunkAtom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11542 |
int JunkInt; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11543 |
unsigned long WinState,JunkLong; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11544 |
unsigned char *Property; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11545 |
Atom WM_STATE_Atom; |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11546 |
|
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11547 |
if (__INST(wmStateAtom) != nil) { |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11548 |
WM_STATE_Atom = __AtomVal(__INST(wmStateAtom)); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11549 |
|
1974 | 11550 |
ENTER_XLIB(); |
3320
20c37636e4b8
Fixes for newDisplatchLastEvent.
Stefan Vogel <sv@exept.de>
parents:
3319
diff
changeset
|
11551 |
XGetWindowProperty(myDpy, __WindowVal(aWindowId), |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11552 |
WM_STATE_Atom, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11553 |
0L, 2L, False, AnyPropertyType, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11554 |
&JunkAtom,&JunkInt,&WinState,&JunkLong, |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11555 |
&Property); |
1974 | 11556 |
LEAVE_XLIB(); |
1579
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11557 |
WinState=(unsigned long)(*((long*)Property)); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11558 |
if (WinState==3) { |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11559 |
RETURN (true); |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11560 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11561 |
} |
692c2f62d94e
handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents:
1576
diff
changeset
|
11562 |
RETURN (false); |
1535 | 11563 |
} |
11564 |
%}. |
|
3303
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11565 |
self primitiveFailedOrClosedConnection. |
8a2e99ebccb3
primitiveFailed vs. primitiveFailedOrClosedConnection
Claus Gittinger <cg@exept.de>
parents:
3287
diff
changeset
|
11566 |
^ false "/ or true or what ? |
295 | 11567 |
! ! |
11568 |
||
1171
a40ea3d796fd
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
1138
diff
changeset
|
11569 |
!XWorkstation class methodsFor:'documentation'! |
295 | 11570 |
|
11571 |
version |
|
4245 | 11572 |
^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.460 2004-09-14 12:30:34 cg Exp $' |
295 | 11573 |
! ! |
3758 | 11574 |
|
295 | 11575 |
XWorkstation initialize! |