XWorkstation.st
author Claus Gittinger <cg@exept.de>
Mon, 10 Jun 1996 19:33:14 +0200
changeset 815 1e659479b292
parent 811 bf8721a1e3ec
child 818 ba6b21959afe
permissions -rw-r--r--
call super in initScreenProps
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
6
7ee0cfde237d *** empty log message ***
claus
parents: 5
diff changeset
     2
COPYRIGHT (c) 1989 by Claus Gittinger
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
DeviceWorkstation subclass:#XWorkstation
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    14
	instanceVariableNames:'screen hasShapeExtension hasFaxExtension hasShmExtension
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    15
		hasDPSExtension hasMbufExtension hasXVideoExtension hasSaveUnder
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    16
		hasPEXExtension hasImageExtension hasInputExtension
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    17
		ignoreBackingStore blackpixel whitepixel protocolsAtom
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    18
		deleteWindowAtom saveYourselfAtom quitAppAtom primaryAtom
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    19
		secondaryAtom cutBuffer0Atom stringAtom lengthAtom listOfXFonts
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    20
		buttonsPressed eventRootX eventRootY displayName eventTrace
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    21
		dispatchingExpose rgbVisual virtualRootId rootId eventBuffer
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
    22
		altModifierMask metaModifierMask'
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
    23
	classVariableNames:'RawKeysymTranslation ConservativeSync'
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    24
	poolDictionaries:''
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
    25
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    26
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    27
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    28
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    29
%{
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    30
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    31
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    32
 */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    33
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    34
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    35
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    36
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    37
 * 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
    38
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    39
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    40
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    41
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    42
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    43
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    44
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    45
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    46
#include <stdio.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    47
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    48
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    49
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    50
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    51
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    52
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    53
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    54
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    55
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    56
/*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    57
 * this define adds support for two-byte-strings.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    58
 * leaving it undefined does not really save you much
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    59
 * (the define will vanish)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    60
 */
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
    61
#define TWOBYTESTRINGS
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
    62
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    63
/*
48194c26a46c Initial revision
claus
parents:
diff changeset
    64
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
    65
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
    66
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
    67
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
    68
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    69
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
    70
48194c26a46c Initial revision
claus
parents:
diff changeset
    71
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    72
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    73
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
    74
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
    75
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
    76
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    77
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
    78
48194c26a46c Initial revision
claus
parents:
diff changeset
    79
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    80
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    81
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    82
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    83
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    84
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    85
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    86
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    87
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    88
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    89
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    90
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    91
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    92
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    93
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    94
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    95
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    96
 * this is a non-standard fax-image decompression extension
48194c26a46c Initial revision
claus
parents:
diff changeset
    97
 * (only found in megascan servers ported by myself)
48194c26a46c Initial revision
claus
parents:
diff changeset
    98
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
    99
#ifdef FAX
48194c26a46c Initial revision
claus
parents:
diff changeset
   100
# include <X11/extensions/XFAXImage.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   101
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   102
48194c26a46c Initial revision
claus
parents:
diff changeset
   103
/*
186
claus
parents: 180
diff changeset
   104
 * PEX extension - if available
claus
parents: 180
diff changeset
   105
 */
claus
parents: 180
diff changeset
   106
#ifdef PEX5
claus
parents: 180
diff changeset
   107
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   108
#endif
claus
parents: 180
diff changeset
   109
claus
parents: 180
diff changeset
   110
/*
claus
parents: 180
diff changeset
   111
 * XImage extension - if available
claus
parents: 180
diff changeset
   112
 */
claus
parents: 180
diff changeset
   113
#ifdef XIE
claus
parents: 180
diff changeset
   114
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   115
#endif
claus
parents: 180
diff changeset
   116
claus
parents: 180
diff changeset
   117
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   118
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   119
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   120
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   121
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   122
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   123
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   124
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   125
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   126
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   127
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   128
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   129
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   130
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   131
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   132
#if defined(IRIX5) || (XlibSpecificationRelease == 6)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   133
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   134
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   135
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   136
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   137
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   138
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   139
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   140
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   141
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   142
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   143
 */
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   144
#define _DisplayVal(o)       (Display *)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   145
#define _WindowVal(o)        (Window)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   146
#define _PixmapVal(o)        (Pixmap)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   147
#define _GCVal(o)            (GC)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   148
#define _CursorVal(o)        (Cursor)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   149
#define _FontVal(o)          (XFontStruct *)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   150
#define _DPSContextVal(o)    (DPSContext)(__MKCP(o))
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   151
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   152
#define __MKATOMOBJ(a)       __MKSMALLINT(a)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
   153
#define _AtomVal(o)          __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   154
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   155
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   156
#define myDpy                _DisplayVal(__INST(displayId))
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   157
#define ISCONNECTED          (__INST(displayId) != nil)
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   158
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   159
#ifndef THISCONTEXT_IN_REGISTER
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   160
# define BEGIN_INTERRUPTSBLOCKED /* */
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   161
# define END_INTERRUPTSBLOCKED /* */
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   162
#else
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   163
extern int __interruptsBlocked;
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   164
# define BEGIN_INTERRUPTSBLOCKED        \
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   165
    {                                   \
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   166
	int needUnblock = 0;            \
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   167
	extern OBJ __thisContext__;     \
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   168
					\
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   169
	__thisContext__ = __thisContext;\
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   170
	if (!__interruptsBlocked) {     \
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   171
	    __BLOCKINTERRUPTS();        \
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   172
	    needUnblock = 1;            \
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   173
	}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   174
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   175
# define END_INTERRUPTSBLOCKED          \
158
claus
parents: 157
diff changeset
   176
	__thisContext = __thisContext;  \
claus
parents: 157
diff changeset
   177
	__thisContext__ = 0;            \
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   178
	if (needUnblock) {              \
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   179
	    __UNBLOCKINTERRUPTS();      \
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   180
	}                               \
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   181
    }
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   182
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   183
#endif
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   184
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   185
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   186
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   187
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   188
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   189
/*
146
claus
parents: 145
diff changeset
   190
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   191
 */
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   192
static char lastErrorMsg[80] = "";
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   193
static unsigned lastRequestCode = 0;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   194
static unsigned lastMinorCode = 0;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   195
static unsigned lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   196
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   197
static int __debug__ = 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   198
#define DPRINTF(x)      if (__debug__) { printf x; }
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   199
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   200
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   201
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   202
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   203
%{
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   204
/*
144
claus
parents: 143
diff changeset
   205
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   206
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   207
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   208
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   209
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   210
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   211
 */
168
claus
parents: 163
diff changeset
   212
static
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
   213
__XErrorHandler__(dpy, event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   214
    Display *dpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
   215
    XErrorEvent *event;
48194c26a46c Initial revision
claus
parents:
diff changeset
   216
{
48194c26a46c Initial revision
claus
parents:
diff changeset
   217
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 80);
48194c26a46c Initial revision
claus
parents:
diff changeset
   218
    if (lastErrorMsg[0] == '\0') {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   219
	sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   220
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   221
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   222
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   223
    lastResource = event->resourceid;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   224
254
d6f12ecd7767 ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   225
    if (@global(ErrorPrinting) == true) {
219
9ff0660f447f uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   226
	fprintf(stderr, "XWORKSTAT: x-error cought maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
9ff0660f447f uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   227
			event->request_code, event->request_code, 
9ff0660f447f uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   228
			event->minor_code, event->minor_code, event->resourceid);
9ff0660f447f uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents: 218
diff changeset
   229
	fprintf(stderr, "XWORKSTAT: x-error message is '%s'\n", lastErrorMsg);
218
10072d9beba5 can now turn off Xlib error messages from the errorHandler
Claus Gittinger <cg@exept.de>
parents: 217
diff changeset
   230
    }
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   231
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   232
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKOBJ(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   233
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   234
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   235
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   236
#ifdef VIRTUAL_ROOT
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   237
/*
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   238
 * added since RootWindow-macro is not suficient
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   239
 * when virtual root-windows are involved (i.e. tvtwm)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   240
 */
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   241
static Window
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   242
getRootWindow(dpy, screen)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   243
    Display *dpy;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   244
{
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   245
    Window root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   246
    Atom vRootAtom = None;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   247
    int i;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   248
    Window rootReturn, parentReturn;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   249
    Window* children;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   250
    unsigned int numChildren;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   251
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   252
    root = RootWindow(dpy, screen);
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   253
    /*
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   254
     * on IRIS, this creates a badwindow error - why ?
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   255
     * children contains a funny window (000034)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   256
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   257
# if !defined(IRIS) || defined(IRIX5)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   258
    if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   259
	vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   260
	if (vRootAtom != None) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   261
	    for (i=0; i < numChildren; i++) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   262
		Atom actual_type;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   263
		int actual_format;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   264
		unsigned long nitems, bytesafter;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   265
		Window* newRoot = (Window*) 0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   266
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   267
		if (children[i]) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   268
		    if (XGetWindowProperty(dpy, children[i], vRootAtom,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   269
					   0L, 1L, False, XA_WINDOW,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   270
					   &actual_type, &actual_format, &nitems, &bytesafter,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   271
					   (unsigned char**) &newRoot) == Success && newRoot) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   272
			root = *newRoot;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   273
			break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   274
		    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   275
		}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   276
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   277
	    if (children) XFree( children );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   278
	}
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   279
    }
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   280
# endif
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   281
    return root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   282
}
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   283
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   284
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   285
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   286
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   287
!XWorkstation class methodsFor:'documentation'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   288
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   289
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   290
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   291
COPYRIGHT (c) 1989 by Claus Gittinger
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   292
	      All Rights Reserved
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   293
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   294
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   295
 only in accordance with the terms of that license and with the
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   296
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   297
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   298
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   299
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   300
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   301
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   302
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   303
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   304
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   305
    this class provides the interface to X11. It redefines all required methods
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   306
    from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   307
    limited to one display - in theory, you can create Views on many displays
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   308
    simultanously. However, the default setup is for one display only.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   309
    To support multiple displays, you will have to start another event dispatcher
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   310
    process for the other display(s) and create the other views with a slightly
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   311
    different protocol. However, 'normal' applications do not have to care for
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   312
    all of this ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   313
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   314
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   315
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   316
    [author:]
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   317
        Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   318
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   319
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   320
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   321
!XWorkstation class methodsFor:'initialization'!
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   322
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   323
initialize
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   324
    |d|
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   325
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   326
    super initialize.
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   327
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   328
    RawKeysymTranslation isNil ifTrue:[
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   329
	"/ the following table maps X-keyevents to ST/X
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   330
	"/ device independed events. 
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   331
	"/ It is NOT meant as a keyboardMap replacement.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   332
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   333
	RawKeysymTranslation := d := Dictionary new.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   334
	d at:'Delete_line' put:#DeleteLine.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   335
	d at:'Delete_word' put:#DeleteWord.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   336
	d at:'Down' put:#CursorDown.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   337
	d at:'Up' put:#CursorUp.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   338
	d at:'Left' put:#CursorLeft.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   339
	d at:'Right' put:#CursorRight.
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   340
    ]
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   341
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   342
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   343
!XWorkstation class methodsFor:'error handling'!
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   344
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   345
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   346
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   347
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   348
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   349
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   350
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   351
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   352
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   353
%{
216
f4fd44038317 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 215
diff changeset
   354
    RETURN ( __MKSTRING(lastErrorMsg COMMA_CON) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   355
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   356
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   357
135
claus
parents: 133
diff changeset
   358
lastErrorString
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   359
    "return the last X-error string - 
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   360
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   361
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   362
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   363
    |string requestCode s match line|
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   364
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   365
    string := self errorStringOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   366
    requestCode := self requestCodeOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   367
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   368
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   369
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   370
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   371
    s := '/usr/lib/X11/XErrorDB' asFilename readStream.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   372
    s notNil ifTrue:[
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   373
	match := 'XRequest.' , requestCode printString.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   374
	line := s peekForLineStartingWith:match.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   375
	line notNil ifTrue:[
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   376
	    string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   377
	].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   378
	s close.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   379
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   380
    ^ string
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   381
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   382
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   383
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   384
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   385
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   386
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   387
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   388
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   389
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   390
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   391
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   392
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   393
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   394
%}
135
claus
parents: 133
diff changeset
   395
!
claus
parents: 133
diff changeset
   396
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   397
resourceIdOfLastError
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   398
%{  /* NOCONTEXT */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   399
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   400
    RETURN ( __MKOBJ(lastResource) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   401
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   402
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   403
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   404
!XWorkstation class methodsFor:'queries'!
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   405
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   406
platformName
133
claus
parents: 132
diff changeset
   407
    "ST-80 compatibility.
claus
parents: 132
diff changeset
   408
     Return a string describing the display systems platform."
claus
parents: 132
diff changeset
   409
715
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   410
    ^ 'X11'  "I don't know what ST-80 returns for X ..."
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   411
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   412
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   413
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   414
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   415
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   416
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   417
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   418
    "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
   419
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   420
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   421
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   422
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   423
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   424
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   425
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   426
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   427
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   428
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   429
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   430
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   431
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   432
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   433
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   434
    "return the state-mask for button1 in motion events' state-field.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   435
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   436
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   437
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   438
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   439
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   440
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   441
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   442
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   443
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   444
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   445
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   446
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   447
    "return the state-mask for button2 in motion events' state-field
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   448
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   449
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   450
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   451
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   452
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   453
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   454
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   455
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   456
    "return the state-mask for button3 in motion events' state-field
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   457
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   458
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   459
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   460
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   461
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   462
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   463
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   464
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   465
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   466
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   467
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   468
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   469
    if (aButton == __MKSMALLINT(1)) {
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   470
	RETURN (__MKSMALLINT(Button1MotionMask));
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   471
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   472
    if (aButton == __MKSMALLINT(2)) {
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   473
	RETURN (__MKSMALLINT(Button2MotionMask));
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   474
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   475
    if (aButton == __MKSMALLINT(3)) {
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   476
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   477
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   478
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   479
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   480
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   481
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   482
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   483
    "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
   484
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   485
%{  /* NOCONTEXT */
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   486
    RETURN (__MKSMALLINT(ControlMask));
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   487
%}
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   488
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   489
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   490
defaultEventMask
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   491
    "return a mask to enable some events by default."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   492
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   493
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   494
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   495
			 KeyPressMask | KeyReleaseMask |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   496
			 EnterWindowMask | LeaveWindowMask |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   497
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   498
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   499
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   500
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   501
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
   502
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
   503
48194c26a46c Initial revision
claus
parents:
diff changeset
   504
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
   505
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   506
    if (ISCONNECTED) {
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
   507
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   508
    }
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   509
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   510
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   511
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   512
133
claus
parents: 132
diff changeset
   513
displayName
claus
parents: 132
diff changeset
   514
    "return the X-connections display name.
claus
parents: 132
diff changeset
   515
     This is (currently) nil for the default display, 
claus
parents: 132
diff changeset
   516
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
   517
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
   518
claus
parents: 132
diff changeset
   519
    ^ displayName
claus
parents: 132
diff changeset
   520
!
claus
parents: 132
diff changeset
   521
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   522
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   523
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   524
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   525
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   526
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   527
    if (ISCONNECTED) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   528
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   529
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   530
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   531
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   532
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   533
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   534
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   535
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   536
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   537
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   538
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   539
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   540
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   541
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   542
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   543
    if (ISCONNECTED) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   544
	RETURN ( __MKSTRING(XServerVendor(myDpy) COMMA_CON) );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   545
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   546
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   547
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   548
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   549
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   550
     Display serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   551
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   552
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   553
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   554
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   555
    "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
   556
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   557
%{  /* NOCONTEXT */
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   558
    RETURN (__MKSMALLINT(ShiftMask));
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   559
%}
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   560
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   561
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   562
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   563
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   564
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   565
     in aPoint and returns a device coordinate relative to the 2nd views origin.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   566
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   567
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   568
    |x1 y1 x2 y2|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   569
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   570
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   571
    y1 := y2 := aPoint y truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   572
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   573
    int xpos, ypos;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   574
    Window w1, w2, child_return;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   575
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   576
    Display *dpy = myDpy;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   577
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   578
    if (__isExternalAddress(windowId1)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   579
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   580
     && __bothSmallInteger(x1, y1)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   581
	w1 = _WindowVal(windowId1);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   582
	w2 = _WindowVal(windowId2);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   583
#ifdef VIRTUAL_ROOT
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   584
	if ((w1 == RootWindow(dpy, screen))
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   585
	 || (w2 == RootWindow(dpy, screen))) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   586
	    if (w1 == RootWindow(dpy, screen)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   587
		w1 = getRootWindow(dpy, screen);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   588
	    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   589
	    if (w2 == RootWindow(dpy, screen)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   590
		w2 = getRootWindow(dpy, screen);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   591
	    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   592
	}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   593
#endif
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   594
	BEGIN_INTERRUPTSBLOCKED
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   595
	XTranslateCoordinates(dpy, w1, w2,
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   596
			      __intVal(x1), __intVal(y1), 
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   597
			      &xpos, &ypos, &child_return);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   598
	END_INTERRUPTSBLOCKED
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   599
	x2 = __MKSMALLINT(xpos);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   600
	y2 = __MKSMALLINT(ypos);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   601
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   602
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   603
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   604
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   605
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   606
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   607
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   608
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   609
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   610
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   611
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   612
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   613
    if (ISCONNECTED) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   614
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   615
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   616
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   617
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   618
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   619
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   620
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   621
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   622
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   623
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   624
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   625
    "given a point in rootWindow, return the viewId of the subview of windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   626
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   627
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   628
     - used to find the window to drop objects after a cross-view drag."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   629
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   630
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   631
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   632
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   633
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   634
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   635
    int xpos, ypos;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   636
    Window child_return;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   637
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   638
    if (__isExternalAddress(windowId)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   639
     && __isPoint(aPoint)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   640
	xp = _point_X(aPoint);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   641
	yp = _point_Y(aPoint);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   642
	if (__bothSmallInteger(xp, yp)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   643
	    BEGIN_INTERRUPTSBLOCKED
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   644
	    XTranslateCoordinates(dpy,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   645
				  RootWindow(dpy, screen),
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   646
				  _WindowVal(windowId),
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   647
				  __intVal(xp), __intVal(yp), 
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   648
				  &xpos, &ypos, &child_return);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   649
	    END_INTERRUPTSBLOCKED
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   650
	    if (child_return) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   651
		RETURN ( __MKOBJ(child_return) );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   652
	    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   653
	    RETURN ( nil );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   654
	}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   655
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   656
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   657
    windowId notNil ifTrue:[
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   658
	aPoint isPoint ifTrue:[
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   659
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   660
	]
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   661
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   662
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   663
    ^ nil
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   664
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   665
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   666
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   667
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   668
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   669
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   670
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   671
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   672
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   673
    if ((__INST(rootId) != __INST(virtualRootId)) 
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   674
     && __isExternalAddress(__INST(virtualRootId))) {
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   675
	Window vRootWin;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   676
	Window root;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   677
	int x, y;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   678
	unsigned int width, height;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   679
	unsigned int dummy;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   680
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   681
	vRootWin = _WindowVal(__INST(virtualRootId));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   682
	if (XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   683
					  &dummy, &dummy)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   684
	    RETURN ( __MKPOINT_INT(width, height) );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   685
	}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   686
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   687
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   688
    ^ width @ height
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   689
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   690
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   691
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   692
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   693
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   694
    ^ whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   695
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   696
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   697
!XWorkstation methodsFor:'accessing display capabilities'!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   698
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   699
hasDPS
186
claus
parents: 180
diff changeset
   700
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
   701
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
   702
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   703
48194c26a46c Initial revision
claus
parents:
diff changeset
   704
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
   705
claus
parents: 180
diff changeset
   706
    "
claus
parents: 180
diff changeset
   707
     Display hasDPS 
claus
parents: 180
diff changeset
   708
    "
claus
parents: 180
diff changeset
   709
!
claus
parents: 180
diff changeset
   710
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   711
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   712
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   713
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
   714
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
   715
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   716
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   717
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   718
    int dummy;
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   719
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   720
    if (__isString(extensionString) && ISCONNECTED) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   721
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   722
	    RETURN ( true );
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   723
	}
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   724
    }
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   725
%}.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   726
    ^ false
186
claus
parents: 180
diff changeset
   727
claus
parents: 180
diff changeset
   728
    "
claus
parents: 180
diff changeset
   729
     Display hasExtension:'XVideo' 
claus
parents: 180
diff changeset
   730
     Display hasExtension:'Input' 
claus
parents: 180
diff changeset
   731
     Display hasExtension:'GLX' 
claus
parents: 180
diff changeset
   732
     Display hasExtension:'X3D-PEX' 
claus
parents: 180
diff changeset
   733
     Display hasExtension:'XInputExtension' 
claus
parents: 180
diff changeset
   734
     Display hasExtension:'SHAPE' 
claus
parents: 180
diff changeset
   735
     Display hasExtension:'MIT-SHM' 
claus
parents: 180
diff changeset
   736
     Display hasExtension:'SGIFullScreenStereo' 
claus
parents: 180
diff changeset
   737
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   738
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   739
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   740
hasFax
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   741
    "return true, if this workstation supports decompression of fax images.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   742
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   743
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   744
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   745
    ^ hasFaxExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   746
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   747
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   748
     Display hasFaxExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   749
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   750
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   751
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   752
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   753
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   754
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   755
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   756
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   757
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   758
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   759
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   760
     Display hasImageExtension 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   761
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   762
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   763
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   764
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   765
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   766
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   767
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   768
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   769
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   770
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   771
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   772
     Display hasInputExtension 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   773
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   774
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   775
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   776
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   777
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   778
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   779
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   780
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   781
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   782
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   783
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   784
     Display hasMultibuffer 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   785
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   786
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   787
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   788
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   789
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   790
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   791
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   792
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   793
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   794
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   795
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   796
     Display hasPEX 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   797
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   798
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   799
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   800
hasShape
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   801
    "return true, if this workstation supports non-rectangular windows.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   802
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   803
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   804
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   805
    ^ hasShapeExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   806
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   807
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   808
     Display hasShape   
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   809
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   810
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   811
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   812
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   813
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   814
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   815
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   816
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   817
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   818
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   819
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   820
     Display hasShm 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   821
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   822
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   823
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   824
hasXVideo
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   825
    "return true, if this workstation supports the XVideo extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   826
     Both the server must support it, and the feature must have been
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   827
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   828
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   829
    ^ hasXVideoExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   830
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   831
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   832
     Display hasXVideo 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   833
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   834
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   835
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   836
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   837
    "Get the preferred/supported icon sizes. These are set by the window manager.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   838
     We return nil (if not set) or an OrderedCollection of Intervals."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   839
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   840
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   841
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   842
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   843
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   844
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   845
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   846
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   847
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   848
    if (ISCONNECTED) {
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   849
        if (XGetIconSizes(myDpy, RootWindow(dpy, screen), &sizeList, &cnt) > 0) {
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   850
           xIconSizes = __MKEXTERNALBYTES(sizeList);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   851
           count = __MKSMALLINT(cnt);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   852
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   853
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   854
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   855
    xIconSizes isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   856
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   857
    ret := OrderedCollection new:count.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   858
    1 to:count do:[ :i |
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   859
        | startX startY stopX stopY stepX stepY|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   860
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   861
%{
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   862
        XIconSize *slp;
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   863
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   864
        slp = &((XIconSize *)__externalBytesAddress(xIconSizes))[__intVal(i)-1];
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   865
        startX = __MKSMALLINT(slp->min_width);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   866
        startY = __MKSMALLINT(slp->min_height);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   867
        stopX = __MKSMALLINT(slp->max_width);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   868
        stopY = __MKSMALLINT(slp->max_height);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   869
        stepX = __MKSMALLINT(slp->width_inc);
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   870
        stepY = __MKSMALLINT(slp->height_inc);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   871
%}.
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   872
        ret add:(Interval from:startX@startY to:stopX@stopY by:stepX@stepY)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   873
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   874
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   875
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   876
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   877
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   878
    "
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   879
     Display iconSizes OrderedCollection(Interval(16@16 17@17 18@18 19@19 20@20 21@21 22@22 23@23 24@24 25@25 26@26 27@27 28@28 29@29 30@30 31@31 32@32 33@33 34@34 35@35 36@36 37@37 38@38 39@39 40@40 41@41 42@42 43@43 44@44 45@45 46@46 47@47 48@48 49@49 50@50 51@51 52@52 53@53 54@54 55@55 56@56 57@57 58@58 59@59 60@60 61@61 62@62 63@63 64@64 65@65 66@66 67@67 68@68 69@69 70@70 71@71 72@72 73@73 74@74 75@75 76@76 77@77 78@78 79@79 80@80 81@81 82@82 83@83 84@84 85@85))
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   880
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   881
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   882
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   883
ignoreBackingStore:aBoolean
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   884
    "if the argument is true, the views backingStore setting will be ignored, and
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   885
     no backing store used - this can be used on servers where backing store is
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   886
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   887
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   888
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   889
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   890
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   891
supportedImageFormats
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   892
    "return an array with supported image formats; 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   893
     each array entry is an attribute dictionary, consisting of 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   894
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   895
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   896
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   897
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   898
%{
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   899
    Display *dpy = myDpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   900
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   901
    if (! ISCONNECTED) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   902
	RETURN (nil);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   903
    }
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   904
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   905
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   906
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   907
    1 to:nFormats do:[:index |
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   908
	|info bitsPerPixelInfo depthInfo paddingInfo i|
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   909
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   910
	i := index.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   911
%{
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   912
	ScreenFormat *format;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   913
	Display *dpy = myDpy;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
   914
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   915
	format = DISPLAYACCESS(dpy)->pixmap_format;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   916
	format += (__intVal(i)-1);
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   917
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   918
	depthInfo = __MKSMALLINT(format->depth);
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   919
	paddingInfo = __MKSMALLINT(format->scanline_pad);
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   920
%}.
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   921
	info := IdentityDictionary new.
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   922
	info at:#depth put:depthInfo.
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   923
	info at:#bitsPerPixel put:bitsPerPixelInfo.
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   924
	info at:#padding put:paddingInfo.
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   925
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   926
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   927
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   928
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   929
    "
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
   930
     Display supportedImageFormats 
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   931
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   932
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
   933
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   934
supportsDeepIcons
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   935
    "return true, if this device supports non b&w (i.e. greyScale
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   936
     or colored icons). Many Xservers (and/or windowManagers) crash,
186
claus
parents: 180
diff changeset
   937
     if you pass them a deep form as icon; therefore, we return false.
claus
parents: 180
diff changeset
   938
     It may be a good idea to check for the server vendor/release and
claus
parents: 180
diff changeset
   939
     return trie sometimes."
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   940
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   941
    ^ false
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   942
!
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   943
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   944
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   945
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
   946
     We do not depend on it being implemented, but some resizing operations
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   947
     are faster, it is is."
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   948
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   949
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   950
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   951
48194c26a46c Initial revision
claus
parents:
diff changeset
   952
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   953
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   954
createBitmapFromArray:anArray width:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   955
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   956
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   957
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   958
    bitmapId isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   959
	self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   960
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   961
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   962
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   963
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   964
createBitmapFromFile:aString for:aForm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   965
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   966
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   967
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   968
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   969
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   970
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   971
    char *filename;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   972
    unsigned b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   973
    int b_x_hot, b_y_hot;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   974
    int status;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   975
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   976
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   977
	if (__isString(aString) || __isSymbol(aString)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   978
	    filename = (char *)_stringVal(aString);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   979
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   980
	    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   981
	    status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   982
				     filename, &b_width, &b_height, &newBitmap,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   983
				     &b_x_hot, &b_y_hot);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   984
	    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   985
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   986
	    if (status == BitmapSuccess) {
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   987
		w = __MKSMALLINT(b_width);
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   988
		h = __MKSMALLINT(b_height);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   989
		id = __MKOBJ(newBitmap);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   990
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   991
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   992
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   993
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   994
    id notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   995
	aForm setWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   996
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   997
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   998
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   999
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1000
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1001
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1002
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1003
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1004
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1005
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1006
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1007
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1008
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1009
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1010
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1011
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1012
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1013
				       __intVal(w), __intVal(h), 1);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1014
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1015
	RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1016
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1017
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1018
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1019
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1020
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1021
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1022
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1023
createFaxImageFromArray:data width:w height:h type:type k:k msbFirst:msbFirst
48194c26a46c Initial revision
claus
parents:
diff changeset
  1024
    "create a new faxImage in the workstation
48194c26a46c Initial revision
claus
parents:
diff changeset
  1025
     type: 0 -> uncompressed
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1026
	   1 -> group3 1D (k is void)
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1027
	   2 -> group3 2D
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1028
	   3 -> group4 2D (k is void)"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1029
48194c26a46c Initial revision
claus
parents:
diff changeset
  1030
    |nBytes|
48194c26a46c Initial revision
claus
parents:
diff changeset
  1031
48194c26a46c Initial revision
claus
parents:
diff changeset
  1032
    hasFaxExtension ifFalse:[^ nil].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1033
    nBytes := data size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1034
%{
48194c26a46c Initial revision
claus
parents:
diff changeset
  1035
#ifdef FAX
48194c26a46c Initial revision
claus
parents:
diff changeset
  1036
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1037
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1038
    FAXImage newImage;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1039
    int _type, _msb, _k = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1040
    unsigned char *bits;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1041
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1042
    if (__bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1043
     && __bothSmallInteger(type, k)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1044
     && __isSmallInteger(nBytes)
44
e45356abd276 *** empty log message ***
claus
parents: 43
diff changeset
  1045
     && __isByteArray(data)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1046
	if (msbFirst == true)
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1047
	    _msb = 1;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1048
	else
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1049
	    _msb = 0;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1050
	_type = __intVal(type);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1051
	if ((_type < 0) || (_type > 3)) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1052
	    RETURN ( nil );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1053
	}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1054
	if (_type == 2) {
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1055
	    if (! __isSmallInteger(k)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1056
		RETURN ( nil );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1057
	    }
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1058
	    _k = __intVal(k);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1059
	}
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1060
	bits =  __ByteArrayInstPtr(data)->ba_element;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1061
	BEGIN_INTERRUPTSBLOCKED
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1062
	newImage = XFAXImageCreateImage(dpy, __intVal(w), __intVal(h),
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1063
					_type, _k, _msb,
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1064
					__intVal(nBytes), bits);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1065
	END_INTERRUPTSBLOCKED
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  1066
	RETURN ( (newImage != (FAXImage)0) ? __MKOBJ(newImage) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1067
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1068
#else
48194c26a46c Initial revision
claus
parents:
diff changeset
  1069
    RETURN ( nil );
48194c26a46c Initial revision
claus
parents:
diff changeset
  1070
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1071
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1072
.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1073
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1074
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1075
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1076
48194c26a46c Initial revision
claus
parents:
diff changeset
  1077
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  1078
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  1079
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1080
48194c26a46c Initial revision
claus
parents:
diff changeset
  1081
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1082
48194c26a46c Initial revision
claus
parents:
diff changeset
  1083
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1084
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1085
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1086
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1087
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1088
	BEGIN_INTERRUPTSBLOCKED
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1089
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1090
				       __intVal(w), __intVal(h), __intVal(d));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1091
	END_INTERRUPTSBLOCKED
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  1092
	RETURN ( (newBitmap != (Pixmap)0) ? __MKOBJ(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1093
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1094
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1095
.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1096
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1097
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1098
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1099
48194c26a46c Initial revision
claus
parents:
diff changeset
  1100
createWindowFor:aView left:xpos top:ypos width:wwidth height:wheight
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1101
    "will vanish - for compatibility with previous versions"
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1102
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1103
    ^ self 
780
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1104
          createWindowFor:aView 
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1105
          origin:(xpos @ ypos)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1106
          extent:(wwidth @ wheight)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1107
          minExtent:(aView minExtent)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1108
          maxExtent:(aView maxExtent)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1109
          borderWidth:(aView borderWidth)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1110
          subViewOf:(aView superView)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1111
          onTop:(aView isPopUpView)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1112
          inputOnly:(aView isInputOnly)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1113
          label:(aView label)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1114
          cursor:(aView cursor)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1115
          icon:(aView icon)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1116
          iconView:(aView iconView)
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1117
b2f13d436188 renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents: 729
diff changeset
  1118
    "Modified: 1.6.1996 / 13:22:48 / cg"
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1119
!
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1120
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1121
createWindowFor:aView
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1122
		 origin:origin
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1123
		 extent:extent
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1124
		 minExtent:minExt 
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1125
		 maxExtent:maxExt
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1126
		 borderWidth:bWidth
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1127
		 subViewOf:wsuperView
157
claus
parents: 154
diff changeset
  1128
		 onTop:wisPopUpView
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1129
		 inputOnly:winputOnly
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1130
		 label:wlabel
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1131
		 cursor:wcursor
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1132
		 icon:wicon
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1133
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1134
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1135
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight 
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1136
     bColorId wsuperViewId wcursorId wiconId windowId
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1137
     weventMask wiconViewId bitGravity viewGravity vBgColor
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1138
     vBgForm deepForm preferredVisual preferredDepth|
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1139
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1140
    displayId isNil ifTrue:[
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1141
	self primitiveFailed.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1142
	^ nil
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1143
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1144
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1145
    origin notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1146
	xpos := origin x.
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1147
	ypos := origin y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1148
    ] ifFalse:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1149
	xpos := ypos := 0.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1150
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1151
    extent notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1152
	wwidth := extent x.
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1153
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1154
    ] ifFalse:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1155
	wwidth := wheight := 100.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1156
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1157
    minExt notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1158
	minWidth := minExt x.
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1159
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1160
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1161
    maxExt notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1162
	maxWidth := maxExt x.
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1163
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1164
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1165
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1166
    wsuperView notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1167
	wsuperViewId := wsuperView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1168
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1169
    wcursor isNil ifTrue:[
145
claus
parents: 144
diff changeset
  1170
	'XWORKSTATION: cursor nil - defaulted' errorPrintNL
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1171
    ] ifFalse:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1172
	wcursorId := wcursor id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1173
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1174
48194c26a46c Initial revision
claus
parents:
diff changeset
  1175
    wicon notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1176
	wiconId := wicon id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1177
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1178
    wiconView notNil ifTrue:[
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1179
	wiconViewId := wiconView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1180
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1181
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1182
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1183
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1184
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1185
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1186
%{  /* STACK:16000 */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1187
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1188
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1189
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1190
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1191
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1192
    XSizeHints sizehints;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1193
    XWMHints wmhints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1194
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1195
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1196
    char *windowName;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1197
    XFontStruct *f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1198
    Pixmap backPixmap = (Pixmap)0, iconBitmap = (Pixmap)0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1199
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1200
    Window iconWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1201
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1202
    Atom WmQuitAppAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1203
    Atom atoms[3];
48194c26a46c Initial revision
claus
parents:
diff changeset
  1204
    int atomCount = 0, isTopWindow = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1205
48194c26a46c Initial revision
claus
parents:
diff changeset
  1206
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1207
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1208
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1209
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1210
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1211
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1212
    if (__bothSmallInteger(wwidth, wheight)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1213
	sizehints.flags |= PSize;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1214
	sizehints.width = __intVal(wwidth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1215
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1216
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1217
    if (__bothSmallInteger(xpos, ypos)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1218
	sizehints.flags |= PPosition;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1219
	sizehints.x = __intVal(xpos);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1220
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1221
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1222
    if (__bothSmallInteger(minWidth, minHeight)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1223
	sizehints.flags |= PMinSize;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1224
	sizehints.min_width = __intVal(minWidth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1225
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1226
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1227
    if (__bothSmallInteger(maxWidth, maxHeight)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1228
	sizehints.flags |= PMaxSize;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1229
	sizehints.max_width = __intVal(maxWidth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1230
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1231
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1232
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  1233
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1234
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1235
    if (__isSmallInteger(bWidth)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1236
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1237
    } else {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1238
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1239
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1240
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1241
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1242
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1243
    if (__isExternalAddress(wsuperViewId)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1244
	parentWindow = _WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1245
    } else {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1246
	parentWindow = RootWindow(dpy, screen);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1247
	isTopWindow = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1248
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1249
157
claus
parents: 154
diff changeset
  1250
    if (wisPopUpView == true)
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1251
	xswa.override_redirect = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1252
    else 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1253
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1254
48194c26a46c Initial revision
claus
parents:
diff changeset
  1255
    if (winputOnly == true) 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1256
	ioClass = InputOnly;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1257
    else 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1258
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1259
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1260
    if (__isSmallInteger(weventMask)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1261
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1262
    } else {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1263
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1264
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1265
48194c26a46c Initial revision
claus
parents:
diff changeset
  1266
    if (ioClass == InputOnly) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1267
	bw = 0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1268
	depth = 0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1269
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1270
    } else {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1271
	depth = DefaultDepth(dpy,screen);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1272
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1273
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1274
	if (backPixmap != (Pixmap)0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1275
	    xswa.background_pixmap = backPixmap;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1276
	    flags |= CWBackPixmap;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1277
	} else {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1278
	    xswa.background_pixel = bg;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1279
	    flags |= CWBackPixel;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1280
	}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1281
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1282
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1283
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1284
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1285
    if (__isSmallInteger(preferredDepth)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1286
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1287
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1288
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1289
    BEGIN_INTERRUPTSBLOCKED
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1290
    if (preferredVisual != nil) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1291
	XVisualInfo vi;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1292
	int cls;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1293
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1294
	if (preferredVisual == @symbol(StaticGray))
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1295
	    cls = StaticGray;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1296
	else if (preferredVisual == @symbol(GrayScale)) 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1297
	    cls = StaticGray;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1298
	else if (preferredVisual == @symbol(StaticColor)) 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1299
	    cls = StaticColor;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1300
	else if (preferredVisual == @symbol(PseudoColor)) 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1301
	    cls = PseudoColor;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1302
	else if (preferredVisual == @symbol(TrueColor)) 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1303
	    cls = TrueColor;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1304
	else if (preferredVisual == @symbol(DirectColor)) 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1305
	    cls = DirectColor;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1306
	else
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1307
	    cls = PseudoColor;
200
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1308
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1309
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1310
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  1311
/*
claus
parents: 162
diff changeset
  1312
	    printf("visualId=%x\n", vi.visualid);
claus
parents: 162
diff changeset
  1313
*/
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1314
	}
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1315
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1316
48194c26a46c Initial revision
claus
parents:
diff changeset
  1317
    newWindow = XCreateWindow(dpy, parentWindow,
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1318
			   sizehints.x, sizehints.y,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1319
			   sizehints.width, sizehints.height,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1320
			   bw, depth, ioClass, &visual,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1321
			   flags, &xswa);
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1322
    END_INTERRUPTSBLOCKED
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1323
48194c26a46c Initial revision
claus
parents:
diff changeset
  1324
    if (! newWindow) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1325
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1326
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1327
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1328
    BEGIN_INTERRUPTSBLOCKED
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1329
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  1330
     * define its cursor
48194c26a46c Initial revision
claus
parents:
diff changeset
  1331
     */
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1332
    if (__isExternalAddress(wcursorId)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1333
	XDefineCursor(dpy, newWindow, _CursorVal(wcursorId));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1334
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1335
48194c26a46c Initial revision
claus
parents:
diff changeset
  1336
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  1337
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  1338
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  1339
     */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1340
    if (isTopWindow) {
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1341
	if (__isExternalAddress(wiconId))
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1342
	    iconBitmap = _PixmapVal(wiconId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1343
	else
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1344
	    iconBitmap = (Pixmap)0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1345
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1346
	if (__isExternalAddress(wiconViewId))
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1347
	    iconWindow = _WindowVal(wiconViewId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1348
	else
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1349
	    iconWindow = (Window)0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1350
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1351
	if (__isString(wlabel) || __isSymbol(wlabel))
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1352
	    windowName = (char *)_stringVal(wlabel);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1353
	else
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1354
	    windowName = "";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1355
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1356
	if (iconBitmap || windowName) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1357
	    XSetStandardProperties(dpy, newWindow,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1358
					windowName, windowName,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1359
					iconBitmap,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1360
					0, 0, &sizehints);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1361
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1362
	}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1363
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1364
	wmhints.flags = 0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1365
	if (iconBitmap) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1366
	    wmhints.flags |= IconPixmapHint;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1367
	    wmhints.icon_pixmap = iconBitmap;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1368
	}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1369
	if (iconWindow) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1370
	    wmhints.flags |= IconWindowHint;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1371
	    wmhints.icon_window = iconWindow;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1372
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1373
/*
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1374
	wmhints.flags |= InputHint;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1375
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1376
*/
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1377
	XSetWMHints(dpy, newWindow, &wmhints);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1378
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1379
	/*
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1380
	 * tell window manager to not kill us but send an event instead
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1381
	 */
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1382
	/*
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1383
	 * get atoms first (if not already known)
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1384
	 */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1385
	if (__INST(protocolsAtom) == nil) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1386
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1387
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1388
#ifdef USE_SAVEYOURSELF_ATOM
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1389
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1390
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1391
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1392
#ifdef USE_QUIT_APP_ATOM
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1393
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1394
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1395
#endif
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1396
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1397
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1398
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1399
#ifdef USE_QUIT_APP_ATOM
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1400
	    WmQuitAppAtom = _AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1401
#else
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1402
	    WmQuitAppAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1403
#endif
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1404
	    WmProtocolsAtom = _AtomVal(__INST(protocolsAtom));
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1405
	    WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1406
#ifdef USE_SAVEYOURSELF_ATOM
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1407
	    WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1408
#else
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1409
	    WmSaveYourselfAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1410
#endif
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1411
	}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1412
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1413
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1414
#ifdef USE_SAVEYOURSELF_ATOM
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1415
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1416
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1417
#ifdef USE_QUIT_APP_ATOM
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1418
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1419
#endif
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1420
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1421
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1422
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1423
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1424
    END_INTERRUPTSBLOCKED
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1425
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  1426
    windowId = __MKOBJ(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1427
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1428
    self addKnownView:aView withId:windowId.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1429
    ^ windowId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1430
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1431
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1432
destroyFaxImage:aFaxImageId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1433
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1434
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1435
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1436
#ifdef FAX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1437
    if (__isExternalAddress(aFaxImageId)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1438
	BEGIN_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1439
	XFAXImageFreeImage(myDpy, (FAXImage)_WindowVal(aFaxImageId));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1440
	END_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1441
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1442
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1443
#endif
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1444
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1445
    self primitiveFailed
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1446
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1447
48194c26a46c Initial revision
claus
parents:
diff changeset
  1448
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1449
48194c26a46c Initial revision
claus
parents:
diff changeset
  1450
%{  /* NOCONTEXT */
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1451
    if (__isExternalAddress(aGCId) && ISCONNECTED) {
366
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1452
	GC gc = _GCVal(aGCId);
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1453
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1454
	if (gc) {
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1455
	    BEGIN_INTERRUPTSBLOCKED
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1456
	    XFreeGC(myDpy, gc);
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1457
	    END_INTERRUPTSBLOCKED
4783fabc35c0 validate GC before freeing
Claus Gittinger <cg@exept.de>
parents: 353
diff changeset
  1458
	}
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1459
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1460
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  1461
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1462
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  1463
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1464
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1465
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1466
48194c26a46c Initial revision
claus
parents:
diff changeset
  1467
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1468
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1469
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1470
	BEGIN_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1471
	XFreePixmap(myDpy, _PixmapVal(aDrawableId));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1472
	END_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1473
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1474
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  1475
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1476
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1477
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1478
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1479
destroyView:aView withId:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1480
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1481
    if (__isExternalAddress(aWindowId) && ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1482
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1483
	XDestroyWindow(myDpy, _WindowVal(aWindowId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1484
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1485
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1486
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1487
    self removeKnownView:aView
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1488
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1489
48194c26a46c Initial revision
claus
parents:
diff changeset
  1490
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1491
48194c26a46c Initial revision
claus
parents:
diff changeset
  1492
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1493
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1494
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1495
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1496
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1497
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1498
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1499
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1500
     && ISCONNECTED) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1501
	BEGIN_INTERRUPTSBLOCKED
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1502
	dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId),
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1503
				       _GCVal(aGCId),
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1504
				       0, height, 0, colormap, NULL, 0,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1505
				       XDPSDefaultTextBackstop,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1506
				       XDPSDefaultErrorProc,
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1507
				       NULL);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1508
	END_INTERRUPTSBLOCKED
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  1509
	RETURN ( dps ? __MKOBJ(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1510
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1511
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1512
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1513
.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1514
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1515
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1516
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1517
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1518
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  1519
claus
parents: 129
diff changeset
  1520
%{  /* NOCONTEXT */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1521
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1522
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1523
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1524
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1525
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1526
	gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId),
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1527
			      0L, (XGCValues *)0);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1528
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1529
	RETURN ( gc ? __MKOBJ(gc) : nil );
200
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1530
    }
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1531
%}.
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1532
    self primitiveFailed.
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1533
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1534
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1535
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1536
primCreateBitmapFromArray:anArray width:w height:h
154
claus
parents: 153
diff changeset
  1537
claus
parents: 153
diff changeset
  1538
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  1539
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1540
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1541
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1542
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1543
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1544
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1545
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1546
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1547
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1548
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1549
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1550
    static char reverseBitTable[256];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1551
    static firstCall = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1552
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1553
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1554
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1555
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1556
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1557
    if (firstCall) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1558
	for (index=0; index < 256; index++) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1559
	    reverseBitTable[index] = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1560
	    if (index & 128) reverseBitTable[index] |=   1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1561
	    if (index &  64) reverseBitTable[index] |=   2;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1562
	    if (index &  32) reverseBitTable[index] |=   4;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1563
	    if (index &  16) reverseBitTable[index] |=   8;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1564
	    if (index &   8) reverseBitTable[index] |=  16;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1565
	    if (index &   4) reverseBitTable[index] |=  32;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1566
	    if (index &   2) reverseBitTable[index] |=  64;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1567
	    if (index &   1) reverseBitTable[index] |= 128;
154
claus
parents: 153
diff changeset
  1568
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1569
	firstCall = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1570
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1571
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1572
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  1573
	newBitmap = (Pixmap)0;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1574
	b_width = __intVal(w);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1575
	b_height = __intVal(h);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1576
	bytesPerRow = (b_width + 7) / 8;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1577
	nBytes = b_height * bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1578
	if (nBytes < sizeof(fastBits)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1579
	    cp = b_bits = fastBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1580
	    allocatedBits = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1581
	} else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1582
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1583
	    if (! cp) goto fail;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1584
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1585
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  1586
	if (__qClass(anArray) == @global(Array)) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1587
	    index = 1;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1588
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1589
	    for (row = b_height; row; row--) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1590
		for (col = bytesPerRow; col; col--) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1591
		    num = *op++;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1592
		    if (! __isSmallInteger(num)) goto fail;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1593
		    bits = __intVal(num);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1594
		    *cp++ = reverseBitTable[bits];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1595
		}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1596
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1597
	} else {
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  1598
	    if (__qClass(anArray) == @global(ByteArray)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1599
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1600
		for (col = b_height*bytesPerRow; col; col--) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1601
		    *cp++ = reverseBitTable[*pBits++];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1602
		}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1603
	    } else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1604
		goto fail;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1605
	    }
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1606
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1607
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1608
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1609
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1610
					       (char *)b_bits, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1611
					       b_width, b_height);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1612
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1613
fail: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1614
	if (allocatedBits)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1615
	    free(allocatedBits);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1616
	RETURN ( newBitmap ? __MKOBJ(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1617
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1618
%}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1619
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1620
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1621
realRootWindowFor:aView
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1622
    "the name of this method is historic;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1623
     - it will vanish"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1624
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1625
    |id|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1626
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1627
    id := self realRootWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1628
    self addKnownView:aView withId:id.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1629
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1630
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1631
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1632
realRootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1633
    "return the id of the real root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1634
     This may not be the window you see as background,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1635
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1636
     of it. Except for very special cases, use #rootWindowId, which takes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1637
     care of any virtual root."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1638
48194c26a46c Initial revision
claus
parents:
diff changeset
  1639
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1640
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1641
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1642
    Window root;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1643
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1644
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1645
    if (__INST(rootId) != nil) {
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1646
	RETURN (__INST(rootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1647
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1648
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1649
    if (ISCONNECTED) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1650
	root = RootWindow(myDpy, screen);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1651
	if (! root) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1652
	    id = nil;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1653
	} else {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1654
	    __INST(rootId) = id = __MKOBJ(root); __STORE(self, id);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1655
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1656
	RETURN (id);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1657
    }
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1658
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1659
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1660
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1661
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1662
rootWindowFor:aView
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1663
    |id|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1664
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1665
    id := self rootWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1666
    self addKnownView:aView withId:id.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1667
    ^ id
48194c26a46c Initial revision
claus
parents:
diff changeset
  1668
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1669
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1670
rootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1671
    "return the id of the root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1672
     This is the window you see as background, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1673
     however, it may or may not be the real physical root window,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1674
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1675
     of the real one. If this is the case, that views id is returned here."
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1676
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1677
%{  /* NOCONTEXT */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1678
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1679
    Window rootWin, vRootWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1680
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1681
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1682
    if (__INST(virtualRootId) != nil) {
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1683
	RETURN (__INST(virtualRootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1684
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1685
169
claus
parents: 168
diff changeset
  1686
    if (ISCONNECTED) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1687
	vRootWin = rootWin = RootWindow(myDpy, screen);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1688
#ifndef IRIS
180
claus
parents: 176
diff changeset
  1689
	BEGIN_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1690
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1691
	 * on IRIS, this creates a badwindow error - why ?
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1692
	 * children contains a funny window (000034)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1693
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1694
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1695
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1696
	 * care for virtual root windows (tvtwm & friends)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1697
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1698
	{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1699
	    Atom vRootAtom = None;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1700
	    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1701
	    Window rootReturn, parentReturn;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1702
	    Window* children;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1703
	    unsigned int numChildren;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1704
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1705
	    if (XQueryTree(myDpy, rootWin, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1706
			   &rootReturn, &parentReturn, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1707
			   &children, &numChildren)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1708
		vRootAtom = XInternAtom(myDpy, "__SWM_VROOT", True );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1709
		if (vRootAtom != None) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1710
		    for (i=0; i < numChildren; i++) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1711
			Atom actual_type;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1712
			int actual_format;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1713
			unsigned long nitems, bytesafter;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1714
			Window* newRoot = (Window*) 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1715
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1716
			if (children[i]) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1717
			    if (XGetWindowProperty(myDpy, children[i], vRootAtom, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1718
						     0L, 1L, False, XA_WINDOW,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1719
						     &actual_type, &actual_format, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1720
						     &nitems, &bytesafter,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1721
						     (unsigned char**) &newRoot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1722
						   ) == Success && newRoot) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1723
				vRootWin = *newRoot;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1724
				break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1725
			    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1726
			}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1727
		    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1728
		    if (children) XFree( children );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1729
		}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1730
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1731
	}
180
claus
parents: 176
diff changeset
  1732
	END_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1733
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1734
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1735
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1736
    /* cannot happen */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1737
    if (! vRootWin) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1738
	vRootWin = rootWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1739
	if (! rootWin) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1740
	    RETURN ( nil );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1741
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1742
    }
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1743
    __INST(rootId) = id = __MKOBJ(rootWin); __STORE(self, id);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1744
    __INST(virtualRootId) = id = __MKOBJ(vRootWin); __STORE(self, id);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1745
    RETURN ( id );
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  1746
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1747
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1748
48194c26a46c Initial revision
claus
parents:
diff changeset
  1749
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1750
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1751
colorCell
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1752
    "allocate a color cell - return index.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1753
     This method will return nil for StaticGrey and StaticGrey displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1754
48194c26a46c Initial revision
claus
parents:
diff changeset
  1755
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1756
48194c26a46c Initial revision
claus
parents:
diff changeset
  1757
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1758
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1759
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1760
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1761
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1762
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1763
    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1764
    ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1765
			       &dummy, 0, &color.pixel, 1);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1766
    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1767
    if (ok) {
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1768
	RETURN ( __MKSMALLINT(color.pixel) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1769
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1770
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1771
.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1772
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1773
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1774
48194c26a46c Initial revision
claus
parents:
diff changeset
  1775
colorNamed:aString
48194c26a46c Initial revision
claus
parents:
diff changeset
  1776
    "allocate a color with color name - return index.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1777
     Dont use this method, colornames are mostly X specific"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1778
48194c26a46c Initial revision
claus
parents:
diff changeset
  1779
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1780
48194c26a46c Initial revision
claus
parents:
diff changeset
  1781
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1782
    Display *dpy = myDpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1783
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1784
    int screen = __intVal(__INST(screen));
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1785
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1786
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1787
    if (ISCONNECTED) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1788
	if (__isString(aString) || __isSymbol(aString)) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1789
	    colorname = (char *)_stringVal(aString);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1790
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1791
	    BEGIN_INTERRUPTSBLOCKED
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1792
	    ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1793
	    if (ok) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1794
		ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1795
	    }
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1796
	    END_INTERRUPTSBLOCKED
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1797
	    if (! ok) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1798
		RETURN ( nil );
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1799
	    }
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1800
	    RETURN ( __MKSMALLINT(ecolor.pixel) );
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  1801
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1802
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1803
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1804
.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1805
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1806
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1807
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1808
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1809
colorRed:redVal green:greenVal blue:blueVal
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1810
    "allocate a color with rgb values (0..100) - return index"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1811
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1812
    |r g b|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1813
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1814
    r := self percentToXColorValue:redVal.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1815
    g := self percentToXColorValue:greenVal.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1816
    b := self percentToXColorValue:blueVal.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1817
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1818
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1819
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1820
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1821
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1822
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1823
    if (__bothSmallInteger(r, g) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1824
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1825
     && ISCONNECTED) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1826
	ecolor.red = __intVal(r);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1827
	ecolor.green= __intVal(g);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1828
	ecolor.blue = __intVal(b);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1829
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1830
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1831
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1832
	if (! ok) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1833
	    RETURN ( nil );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1834
	}
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1835
	RETURN ( __MKSMALLINT(ecolor.pixel) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1836
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1837
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1838
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1839
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1840
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1841
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1842
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1843
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1844
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1845
48194c26a46c Initial revision
claus
parents:
diff changeset
  1846
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1847
48194c26a46c Initial revision
claus
parents:
diff changeset
  1848
    Display *dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1849
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1850
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1851
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1852
#ifdef LATER
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1853
    if (__INST(visualType) == @symbol(TrueColor)) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1854
	/* no need to do anything on TrueColor displays ... */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1855
	RETURN (self);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1856
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1857
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1858
    if (__isSmallInteger(colorIndex) && ISCONNECTED) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1859
	color = (long) __intVal(colorIndex);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1860
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1861
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1862
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1863
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1864
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1865
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  1866
.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1867
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1868
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1869
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1870
getRGBFrom:index into:aBlock
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1871
    "get rgb components (0..100) of color in map at:index,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1872
     and evaluate the 3-arg block, aBlock with them"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1873
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1874
    |r g b|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1875
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1876
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1877
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1878
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1879
    double fr, fg, fb;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1880
    double floor();
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1881
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1882
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1883
    if (__isSmallInteger(index)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1884
	color.pixel = __intVal(index);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1885
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1886
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1887
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1888
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1889
	/* scale to 0..100 and round to the first decimal */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1890
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1891
	/* 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1892
	 * have to compensate for an error in X ?, which does not scale
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1893
	 * colors correctly if lesser than 16bits are valid in a color,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1894
	 * (for example, color white on a 4bitsPerRGB server will return
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1895
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1896
	 */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1897
	bits = __intVal(__INST(bitsPerRGB));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1898
	scale = (1<<bits) - 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1899
	shift = 16 - bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1900
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1901
	fr = floor( ( ((double)(color.red>>shift) * 1000.0) / scale) + 0.5) / 10.0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1902
	fg = floor( ( ((double)(color.green>>shift) * 1000.0) / scale) + 0.5) / 10.0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1903
	fb = floor( ( ((double)(color.blue>>shift) * 1000.0) / scale) + 0.5) / 10.0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1904
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1905
	r = __MKFLOAT(fr COMMA_CON);
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1906
	g = __MKFLOAT(fg COMMA_CON);
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1907
	b = __MKFLOAT(fb COMMA_CON);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1908
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1909
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1910
    aBlock value:r value:g value:b
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1911
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1912
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1913
getRGBFromName:colorName into:aBlock
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1914
    "get rgb components (0..100) of color named colorName,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1915
     and evaluate the 3-arg block, aBlock with them"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1916
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1917
    |r g b|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1918
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1919
    displayId isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1920
	self pimitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1921
	^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1922
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1923
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1924
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1925
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1926
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1927
    double fr, fg, fb;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1928
    double floor();
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1929
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1930
    if (__isString(colorName) || __isSymbol(colorName)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1931
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1932
	if (XParseColor(dpy, DefaultColormap(dpy, screen), 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1933
			     (char *)_stringVal(colorName), &color)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1934
	    /* 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1935
	     * scale to 0..100 and round to the first decimal
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1936
	     */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1937
	    fr = floor( ((((double)color.red) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1938
	    fg = floor( ((((double)color.green) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1939
	    fb = floor( ((((double)color.blue) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1940
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1941
	    r = __MKFLOAT(fr COMMA_CON);
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1942
	    g = __MKFLOAT(fg COMMA_CON);
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1943
	    b = __MKFLOAT(fb COMMA_CON);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1944
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1945
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1946
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1947
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1948
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1949
    aBlock value:r value:g value:b
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1950
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1951
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1952
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1953
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1954
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1955
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1956
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1957
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1958
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1959
    aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1960
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1961
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1962
    [aStream atEnd] whileFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1963
	line := aStream nextLine.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1964
	line notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1965
	    "skip the r/g/b numbers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1966
	    index := 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1967
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1968
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1969
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1970
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1971
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1972
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1973
	    colorName := line copyFrom:index.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1974
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1975
		list add:colorName
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1976
	    ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1977
	]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1978
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1979
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1980
    ^ list sort
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1981
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1982
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1983
percentToXColorValue:aPercentage
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1984
    "given a color-component value in percent (0..100), return the corresponding
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1985
     x-component value (0..65k) as an integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1986
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1987
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1988
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1989
    if (__isSmallInteger(aPercentage)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1990
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1991
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1992
    if (__isFloat(aPercentage)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1993
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1994
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1995
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1996
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1997
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1998
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1999
48194c26a46c Initial revision
claus
parents:
diff changeset
  2000
setColor:index red:redVal green:greenVal blue:blueVal
48194c26a46c Initial revision
claus
parents:
diff changeset
  2001
    "change color in map at:index to rgb (0..100).
48194c26a46c Initial revision
claus
parents:
diff changeset
  2002
     This method is a noop for StaticGrey and StaticGrey displays."
48194c26a46c Initial revision
claus
parents:
diff changeset
  2003
48194c26a46c Initial revision
claus
parents:
diff changeset
  2004
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2005
48194c26a46c Initial revision
claus
parents:
diff changeset
  2006
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2007
    Display *dpy = myDpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2008
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2009
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2010
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2011
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2012
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2013
    if (__isSmallInteger(redVal))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2014
	r = 0xFFFF * __intVal(redVal) / 100;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2015
    else if (__isFloat(redVal))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2016
	r = 0xFFFF * (int)(__floatVal(redVal)) / 100;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2017
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2018
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2019
    if (__isSmallInteger(greenVal))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2020
	g = 0xFFFF * __intVal(greenVal) / 100;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2021
    else if (__isFloat(greenVal))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2022
	g = 0xFFFF * (int)(__floatVal(greenVal)) / 100;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2023
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2024
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2025
    if (__isSmallInteger(blueVal))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2026
	b = 0xFFFF * __intVal(blueVal) / 100;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2027
    else if (__isFloat(blueVal))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2028
	b = 0xFFFF * (int)(__floatVal(blueVal)) / 100;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2029
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2030
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2031
    if (__isSmallInteger(index) && ok) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2032
	color.pixel = __intVal(index);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2033
	color.red = r;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2034
	color.green = g;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2035
	color.blue = b;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2036
	color.flags = DoRed | DoGreen | DoBlue;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2037
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2038
	BEGIN_INTERRUPTSBLOCKED
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2039
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2040
	END_INTERRUPTSBLOCKED
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2041
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2042
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2043
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  2044
.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2045
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2046
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2047
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2048
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2049
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2050
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2051
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2052
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2053
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2054
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2055
    fgR := fgColor red.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2056
    fgG := fgColor green.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2057
    fgB := fgColor blue.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2058
    bgR := bgColor red.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2059
    bgG := bgColor green.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2060
    bgB := bgColor blue.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2061
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2062
    fgR := self percentToXColorValue:fgR.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2063
    fgG := self percentToXColorValue:fgG.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2064
    fgB := self percentToXColorValue:fgB.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2065
    bgR := self percentToXColorValue:bgR.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2066
    bgG := self percentToXColorValue:bgG.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2067
    bgB := self percentToXColorValue:bgB.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2068
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2069
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2070
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2071
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2072
    if (__isExternalAddress(aCursorId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2073
     && __bothSmallInteger(fgG, fgB)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2074
     && __bothSmallInteger(bgR, bgG) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2075
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2076
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2077
	fgcolor.red = __intVal(fgR);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2078
	fgcolor.green= __intVal(fgG);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2079
	fgcolor.blue = __intVal(fgB);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2080
	bgcolor.red = __intVal(bgR);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2081
	bgcolor.green= __intVal(bgG);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2082
	bgcolor.blue = __intVal(bgB);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2083
	BEGIN_INTERRUPTSBLOCKED
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2084
	XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor);
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2085
	END_INTERRUPTSBLOCKED
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2086
	RETURN ( self );
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2087
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2088
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  2089
.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2090
    self primitiveFailed
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2091
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2092
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2093
createCursorShape:aShape
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2094
    "create a cursor given a shape-symbol"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2095
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2096
    |number id|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2097
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2098
    displayId isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2099
	self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2100
	^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2101
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2102
    number := self shapeNumberFromSymbol:aShape.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2103
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2104
    Cursor newCursor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2105
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2106
    if (__isSmallInteger(number)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2107
	BEGIN_INTERRUPTSBLOCKED
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2108
	newCursor = XCreateFontCursor(myDpy, __intVal(number));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2109
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2110
	if (newCursor != (Cursor)0) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2111
	    id = __MKOBJ(newCursor);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2112
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2113
    }
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  2114
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2115
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2116
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2117
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2118
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2119
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2120
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2121
    |id sourceId maskId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2122
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2123
    displayId isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2124
	self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2125
	^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2126
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2127
    sourceId := sourceForm id.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2128
    maskId := maskForm id.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2129
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2130
    Cursor newCursor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2131
    XColor fgColor, bgColor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2132
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2133
    if (__isExternalAddress(sourceId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2134
     && __isExternalAddress(maskId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2135
     && __bothSmallInteger(hx, hy)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2136
	fgColor.red = 0;        /* fg is black */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2137
	fgColor.green = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2138
	fgColor.blue = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2139
	bgColor.red = 0xFFFF;   /* bg is white */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2140
	bgColor.green = 0xFFFF;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2141
	bgColor.blue = 0xFFFF;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2142
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2143
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2144
	newCursor = XCreatePixmapCursor(myDpy,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2145
				_PixmapVal(sourceId),
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2146
				_PixmapVal(maskId),
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2147
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2148
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2149
	if (newCursor != (Cursor)0) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2150
	    id = __MKOBJ(newCursor);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2151
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2152
    }
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  2153
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2154
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2155
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2156
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2157
destroyCursor:aCursorId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2158
48194c26a46c Initial revision
claus
parents:
diff changeset
  2159
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2160
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2161
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2162
	if (__isExternalAddress(aCursorId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2163
	    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2164
	    XFreeCursor(myDpy, _CursorVal(aCursorId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2165
	    END_INTERRUPTSBLOCKED
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2166
	    RETURN ( self );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2167
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2168
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2169
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  2170
.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2171
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2172
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2173
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2174
shapeNumberFromSymbol:shape
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2175
    "given a shape-symbol, return the corresponding cursor-number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2176
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2177
    "this is pure X-knowlegde - but you may easily add more"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2178
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2179
    (shape == #upLeftArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow)    %} "132" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2180
    (shape == #upRightHand)     ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1)             %} "58" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2181
    (shape == #upDownArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2182
    (shape == #leftRightArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2183
    (shape == #upLimitArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side)          %} "138" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2184
    (shape == #downLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side)       %} "16" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2185
    (shape == #leftLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side)         %} "70" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2186
    (shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side)        %} "96" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2187
    (shape == #text)            ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm)             %} "152" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2188
    (shape == #upRightArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large)       %} "44" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2189
    (shape == #leftHand)        ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2)             %} "60" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2190
    (shape == #questionMark)    ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow)    %} "92" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2191
    (shape == #cross)           ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2192
    (shape == #wait)            ifTrue:[ ^ %{ __MKSMALLINT(XC_watch)             %} "150" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2193
    (shape == #crossHair)       ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross)            %} "130" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2194
    ((shape == #origin)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2195
    or:[shape == #topLeft])     ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle)          %} "144" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2196
    ((shape == #corner)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2197
    or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle)          %} "78" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2198
    (shape == #topRight)        ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle)          %} "148" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2199
    (shape == #bottomLeft)      ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle)          %} "76" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2200
    (shape == #square)          ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox)            %} "40" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2201
    (shape == #fourWay)         ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur)             %} "52" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2202
    (shape == #crossCursor)     ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2203
    ('XWORKSTATION: invalid cursorShape:' , shape printString) errorPrintNL.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2204
    ^  0
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2205
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2206
48194c26a46c Initial revision
claus
parents:
diff changeset
  2207
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2208
48194c26a46c Initial revision
claus
parents:
diff changeset
  2209
copyFromFaxImage:sourceId x:srcX y:srcY to:destId x:dstX y:dstY 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2210
		      width:w height:h with:aGCId scaleX:scaleX scaleY:scaleY
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  2211
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  2212
    "do a bit-blt of a compressed FAX image 
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  2213
     - this needs my private FAX extension"
132
claus
parents: 129
diff changeset
  2214
claus
parents: 129
diff changeset
  2215
%{  /* NOCONTEXT */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2216
#ifdef FAX
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2217
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2218
    FAXImage source;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2219
    Drawable dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2220
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2221
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2222
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2223
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2224
     && __bothSmallInteger(scaleX, scaleY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2225
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2226
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2227
     && __bothSmallInteger(dstX, dstY)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2228
	gc = _GCVal(aGCId);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2229
	source = (FAXImage) _WindowVal(sourceId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2230
	dest = (Drawable) _WindowVal(destId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2231
	XFAXImageCopyImage(myDpy, source, dest, gc,
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2232
				__intVal(srcX), __intVal(srcY),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2233
				__intVal(w), __intVal(h),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2234
				__intVal(dstX), __intVal(dstY),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2235
				__intVal(scaleX), __intVal(scaleY));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2236
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2237
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  2238
#endif
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2239
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2240
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2241
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2242
48194c26a46c Initial revision
claus
parents:
diff changeset
  2243
copyFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2244
		width:w height:h with:aGCId
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2245
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2246
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2247
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2248
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2249
48194c26a46c Initial revision
claus
parents:
diff changeset
  2250
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2251
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2252
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2253
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2254
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2255
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2256
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2257
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2258
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2259
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2260
     && __bothSmallInteger(dstX, dstY)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2261
	gc = _GCVal(aGCId);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2262
	source = (Drawable) _WindowVal(sourceId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2263
	dest = (Drawable) _WindowVal(destId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2264
	XCopyArea(myDpy, source, dest, gc,
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2265
				 __intVal(srcX), __intVal(srcY),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2266
				__intVal(w), __intVal(h),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2267
				__intVal(dstX), __intVal(dstY));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2268
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2269
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2270
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2271
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2272
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2273
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2274
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2275
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2276
48194c26a46c Initial revision
claus
parents:
diff changeset
  2277
copyPlaneFromId:sourceId x:srcX y:srcY to:destId x:dstX y:dstY 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2278
		width:w height:h with:aGCId
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2279
    "do a bit-blt, but only copy the low-bit plane; 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2280
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2281
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2282
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2283
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2284
48194c26a46c Initial revision
claus
parents:
diff changeset
  2285
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2286
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2287
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2288
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2289
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2290
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2291
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2292
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2293
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2294
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2295
     && __bothSmallInteger(dstX, dstY)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2296
	gc = _GCVal(aGCId);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2297
	source = (Drawable) _WindowVal(sourceId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2298
	dest = (Drawable) _WindowVal(destId);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2299
	XCopyPlane(myDpy, source, dest, gc,
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2300
				 __intVal(srcX), __intVal(srcY),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2301
				 __intVal(w), __intVal(h),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2302
				 __intVal(dstX), __intVal(dstY), 1);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2303
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2304
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2305
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2306
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2307
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2308
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2309
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2310
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2311
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2312
displayArcX:x y:y width:width height:height from:startAngle angle:angle in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  2313
    "draw an arc. If any of x,y, w or h is not an integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  2314
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2315
48194c26a46c Initial revision
claus
parents:
diff changeset
  2316
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2317
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2318
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2319
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2320
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2321
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2322
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2323
    if (__isSmallInteger(startAngle))
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2324
        angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2325
    else if (__isFloat(startAngle)) {
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2326
        f = __floatVal(startAngle);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2327
        angle1 = f * 64;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2328
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2329
    if (__isSmallInteger(angle))
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2330
        angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2331
    else if (__isFloat(angle)) {
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2332
        f = __floatVal(angle);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2333
        angle2 = f * 64;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2334
    }
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2335
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2336
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2337
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2338
     && __bothSmallInteger(width, height)) {
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2339
        win = _WindowVal(aDrawableId);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2340
        gc = _GCVal(aGCId);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2341
        w = __intVal(width);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2342
        h = __intVal(height);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2343
        /*
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2344
         * need this check here: some servers simply dump core with bad args
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2345
         */
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2346
        if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2347
            XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2348
                                   w, h, angle1, angle2);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2349
        }
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2350
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2351
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2352
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2353
    "badGC, badDrawable or coordinates not integer"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2354
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2355
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2356
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2357
displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2358
    "draw a line. If the coordinates are not integers, an error is triggered." 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2359
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2360
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2361
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2362
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2363
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2364
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2365
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2366
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2367
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2368
     && __bothSmallInteger(x1, y1)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2369
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2370
	win = _WindowVal(aDrawableId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2371
	XDrawLine(myDpy, win, gc, __intVal(x0), __intVal(y0),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2372
				  __intVal(x1), __intVal(y1));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2373
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2374
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2375
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2376
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2377
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2378
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2379
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2380
displayPointX:x y:y in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2381
    "draw a point. If x/y are not integers, an error is triggered." 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2382
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2383
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2384
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2385
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2386
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2387
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2388
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2389
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2390
     && __bothSmallInteger(x, y)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2391
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2392
	win = _WindowVal(aDrawableId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2393
	XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2394
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2395
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2396
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2397
    "badGC, badDrawable or x/y not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2398
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2399
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2400
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2401
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2402
    "draw a polygon, the argument aPolygon is a Collection of individual points, which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2403
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2404
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2405
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2406
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2407
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2408
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2409
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2410
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2411
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2412
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2413
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2414
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2415
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2416
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2417
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2418
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2419
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2420
     && __isSmallInteger(numberOfPoints)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2421
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2422
	win = _WindowVal(aDrawableId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2423
	num = __intVal(numberOfPoints);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2424
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2425
	 * avoid a (slow) malloc, if the number of points is small
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2426
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2427
	if (num > 100) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2428
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2429
	    if (! points) goto fail;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2430
	    mustFree = 1;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2431
	} else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2432
	    points = qPoints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2433
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2434
	for (i=0; i<num; i++) {
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2435
	    point = __AT_(aPolygon COMMA_CON, __MKSMALLINT(i+1));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2436
	    if (! __isPoint(point)) goto fail;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2437
	    x = _point_X(point);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2438
	    y = _point_Y(point);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2439
	    if (! __bothSmallInteger(x, y))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2440
		goto fail;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2441
	    points[i].x = __intVal(x);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2442
	    points[i].y = __intVal(y);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2443
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2444
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2445
	if (mustFree)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2446
	    free(points);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2447
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2448
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2449
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2450
    if (mustFree)
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  2451
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2452
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2453
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2454
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2455
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2456
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2457
displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2458
    "draw a rectangle. If the coordinates are not integers, an error is triggered." 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2459
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2460
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2461
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2462
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2463
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2464
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2465
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2466
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2467
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2468
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2469
     && __bothSmallInteger(width, height)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2470
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2471
	win = _WindowVal(aDrawableId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2472
	w = __intVal(width);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2473
	h = __intVal(height);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2474
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2475
	 * need this check here: some servers simply dump core with bad args
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2476
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2477
	if ((w >= 0) && (h >= 0)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2478
	    XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2479
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2480
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2481
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2482
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2483
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2484
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2485
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2486
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2487
displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2488
    "draw a sub-string - if opaque is false, draw foreground only; otherwise, draw both
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2489
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2490
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2491
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2492
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2493
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2494
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2495
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2496
    unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2497
    OBJ cls;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2498
    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
  2499
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  2500
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  2501
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2502
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2503
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2504
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2505
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2506
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2507
     && __bothSmallInteger(x, y)) {
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2508
        gc = _GCVal(aGCId);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2509
        win = _WindowVal(aDrawableId);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2510
        cls = __qClass(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2511
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2512
        i1 = __intVal(index1) - 1;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2513
        if (i1 >= 0) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2514
            i2 = __intVal(index2) - 1;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2515
            if (i2 < i1) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2516
                RETURN (self);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2517
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2518
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2519
            cp = _stringVal(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2520
            l = i2 - i1 + 1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2521
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2522
            if ((cls == @global(String)) || (cls == @global(Symbol))) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2523
                n = _stringSize(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2524
                if (i2 < n) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2525
                    cp += i1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2526
                    if (l > 1000) l = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2527
                    if (opaque == true)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2528
                        XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2529
                    else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2530
                        XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2531
                    RETURN ( self );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2532
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2533
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2534
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2535
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2536
            cp += nInstBytes;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2537
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2538
            if (__isBytes(aString)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2539
                n = __byteArraySize(aString) - nInstBytes - 1;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2540
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2541
                if (i2 < n) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2542
                    cp += i1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2543
                    if (l > 1000) l = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2544
                    if (opaque == true)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2545
                        XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2546
                    else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2547
                        XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, l);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2548
                    RETURN ( self );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2549
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2550
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2551
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2552
            /* TWOBYTESTRINGS */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2553
            if (__isWords(aString)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2554
                n = (__byteArraySize(aString) - nInstBytes) / 2;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2555
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2556
                if (i2 < n) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2557
                    union {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2558
                        char b[2];
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2559
                        unsigned short s;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2560
                    } u;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2561
                    int i;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2562
                    XChar2b *cp2 = (XChar2b *)0;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2563
                    int mustFree = 0;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2564
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2565
                    cp += (i1 * 2);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2566
                    if (l > 1000) l = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2567
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2568
                    /*
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2569
                     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2570
                     * X expects them MSB first
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2571
                     * convert as required
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2572
                     */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2573
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2574
                    u.s = 0x1234;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2575
                    if (u.b[0] != 0x12) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2576
                        if (l <= NLOCALBUFFER) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2577
                            cp2 = xlatebuffer;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2578
                        } else {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2579
                            cp2 = (XChar2b *)(malloc(l * 2));
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2580
                            mustFree = 1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2581
                        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2582
                        for (i=0; i<l; i++) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2583
                            cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2584
                            cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2585
                        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2586
                        cp = (char *) cp2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2587
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2588
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2589
                    if (opaque == true)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2590
                        XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2591
                    else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2592
                        XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2593
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2594
                    if (mustFree) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2595
                        free(cp2);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2596
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2597
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2598
                    RETURN ( self );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2599
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2600
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2601
        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2602
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  2603
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2604
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2605
    "x/y not integer, badGC or drawable, or not a string"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2606
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2607
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2608
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2609
displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2610
    "draw a string - if opaque is false, draw foreground only; otherwise, draw both
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2611
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2612
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2613
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2614
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2615
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2616
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2617
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2618
    unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2619
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2620
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2621
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  2622
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  2623
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2624
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2625
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2626
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2627
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2628
     && __bothSmallInteger(x, y)) {
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2629
        gc = _GCVal(aGCId);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2630
        win = _WindowVal(aDrawableId);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2631
        cls = __qClass(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2632
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2633
        cp = _stringVal(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2634
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2635
        if ((cls == @global(String)) || (cls == @global(Symbol))) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2636
            n = _stringSize(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2637
            if (n > 1000) n = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2638
            if (opaque == true)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2639
                XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2640
            else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2641
                XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2642
            RETURN ( self );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2643
        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2644
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2645
        nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2646
        cp += nInstBytes;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2647
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2648
        if (__isBytes(aString)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2649
            n = __byteArraySize(aString) - nInstBytes - 1;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2650
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2651
            if (n > 1000) n = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2652
            if (opaque == true)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2653
                XDrawImageString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2654
            else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2655
                XDrawString(myDpy, win, gc, __intVal(x), __intVal(y), (char *)cp, n);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2656
            RETURN ( self );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2657
        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2658
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2659
        /* TWOBYTESTRINGS */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2660
        if (__isWords(aString)) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2661
            union {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2662
                char b[2];
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2663
                unsigned short s;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2664
            } u;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2665
            int i;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2666
            XChar2b *cp2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2667
            int mustFree = 0;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2668
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2669
            n = (__byteArraySize(aString) - nInstBytes) / 2;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2670
            if (n > 1000) n = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2671
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2672
            /*
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2673
             * ST/X TwoByteStrings store the asciiValue in native byteOrder;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2674
             * X expects them MSB first
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2675
             * convert as required
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2676
             */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2677
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2678
            u.s = 0x1234;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2679
            if (u.b[0] != 0x12) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2680
                if (n <= NLOCALBUFFER) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2681
                    cp2 = xlatebuffer;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2682
                } else {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2683
                    cp2 = (XChar2b *)(malloc(n * 2));
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2684
                    mustFree = 1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2685
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2686
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2687
                for (i=0; i<n; i++) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2688
                    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2689
                    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2690
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2691
                cp = (char *) cp2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2692
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2693
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2694
            if (opaque == true)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2695
                XDrawImageString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2696
            else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2697
                XDrawString16(myDpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2698
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2699
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2700
            if (mustFree) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2701
                free(cp2);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2702
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2703
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2704
            RETURN ( self );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2705
        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  2706
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  2707
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2708
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2709
    "x/y not integer, badGC or drawable, or not a string"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2710
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2711
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2712
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2713
drawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2714
			  width:imageWidth height:imageHeight 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2715
			      x:srcx y:srcy
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2716
			   into:aDrawableId 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2717
			      x:dstx y:dsty 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2718
			  width:w height:h 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2719
			   with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2720
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2721
    "draw a bitImage which has depth id, width iw and height ih into
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2722
     the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2723
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2724
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2725
     It has to be checked elsewhere, that the server can do it with the given
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2726
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2727
     Also it is assumed, that the colormap is setup correctly and the
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2728
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2729
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2730
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2731
     sorry; I had to separate it into 2 methods, since XPutImage needs
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2732
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2733
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2734
    (self primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2735
					width:imageWidth height:imageHeight 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2736
					     x:srcx y:srcy
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2737
					  into:aDrawableId 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2738
					     x:dstx y:dsty 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2739
					 width:w height:h 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2740
					  with:aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2741
    ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2742
	"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2743
	 also happens, if a segmentation violation occurs in the 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2744
	 XPutImage ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2745
	"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2746
	self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2747
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2748
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2749
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2750
drawBits:imageBits depth:imageDepth 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2751
		   width:imageWidth height:imageHeight 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2752
		       x:srcx y:srcy
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2753
		    into:aDrawableId 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2754
		       x:dstx y:dsty 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2755
		   width:w height:h 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2756
		    with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2757
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2758
    "draw a bitImage which has depth id, width iw and height ih into
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2759
     the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2760
     Individual source pixels must have imageDepth bits.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2761
     It has to be checked elsewhere, that the server can do it with the given
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2762
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2763
     Also it is assumed, that the colormap is setup correctly and the
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2764
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2765
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2766
    ^ self drawBits:imageBits bitsPerPixel:imageDepth depth:imageDepth 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2767
				     width:imageWidth height:imageHeight 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2768
					 x:srcx y:srcy
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2769
				      into:aDrawableId 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2770
					 x:dstx y:dsty 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2771
				     width:w height:h 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2772
				      with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2773
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2774
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2775
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2776
fillArcX:x y:y width:width height:height from:startAngle angle:angle
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2777
               in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  2778
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  2779
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2780
48194c26a46c Initial revision
claus
parents:
diff changeset
  2781
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2782
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2783
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2784
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2785
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2786
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2787
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2788
    if (__isSmallInteger(startAngle))
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2789
        angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2790
    else if (__isFloat(startAngle)) {
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2791
        f = __floatVal(startAngle);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2792
        angle1 = f * 64;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2793
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2794
    if (__isSmallInteger(angle))
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2795
        angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  2796
    else if (__isFloat(angle)) {
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2797
        f = __floatVal(angle);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2798
        angle2 = f * 64;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2799
    }
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2800
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2801
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2802
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2803
     && __bothSmallInteger(width, height)) {
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2804
        gc = _GCVal(aGCId);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2805
        win = _WindowVal(aDrawableId);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2806
        w = __intVal(width);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2807
        h = __intVal(height);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2808
        /*
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2809
         * need this check here: some servers simply dump core with bad args
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2810
         */
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2811
        if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2812
            XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2813
                                   w, h, angle1, angle2);
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2814
        }
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  2815
        RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2816
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2817
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2818
    "badGC, badDrawable or coordinates not integer"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2819
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2820
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2821
48194c26a46c Initial revision
claus
parents:
diff changeset
  2822
fillPolygon:aPolygon in:aDrawableId with:aGCId
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2823
    "fill a polygon given by its points. 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2824
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2825
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2826
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2827
48194c26a46c Initial revision
claus
parents:
diff changeset
  2828
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  2829
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2830
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2831
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2832
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2833
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2834
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2835
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2836
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2837
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2838
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2839
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2840
     && __isSmallInteger(numberOfPoints)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2841
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2842
	win = _WindowVal(aDrawableId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2843
	num = __intVal(numberOfPoints);
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2844
	if (num < 3) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2845
	    RETURN ( self );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2846
	}
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2847
	/*
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2848
	 * avoid (slow) malloc, if not many points
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2849
	 */
96
claus
parents: 90
diff changeset
  2850
	if (num > 100) {
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2851
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
96
claus
parents: 90
diff changeset
  2852
	    if (! points) goto fail;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2853
	    mustFree = 1;
96
claus
parents: 90
diff changeset
  2854
	} else
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2855
	    points = qPoints;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2856
	for (i=0; i<num; i++) {
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  2857
	    point = __AT_(aPolygon COMMA_CON, __MKSMALLINT(i+1));
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2858
	    if (! __isPoint(point)) goto fail;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2859
	    x = _point_X(point);
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2860
	    y = _point_Y(point);
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2861
	    if (! __bothSmallInteger(x, y))
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2862
		goto fail;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2863
	    points[i].x = __intVal(x);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2864
	    points[i].y = __intVal(y);
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2865
	}
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2866
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2867
	if (mustFree)
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2868
	    free(points);
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2869
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2870
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2871
fail: ;
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  2872
	if (mustFree)
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  2873
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2874
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2875
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  2876
    "badGC, badDrawable or coordinates not integer"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2877
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2878
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2879
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2880
fillRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2881
    "fill a rectangle. If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2882
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2883
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2884
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2885
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2886
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2887
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2888
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2889
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2890
     && __bothSmallInteger(width, height)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2891
	w = __intVal(width);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2892
	h = __intVal(height);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2893
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2894
	 * need this check here: some servers simply dump core with bad args
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2895
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2896
	if ((w >= 0) && (h >= 0)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2897
	    XFillRectangle(myDpy,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2898
			   (Drawable)_WindowVal(aDrawableId), _GCVal(aGCId),
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2899
			   __intVal(x), __intVal(y), w, h);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2900
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2901
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2902
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2903
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2904
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2905
    self primitiveFailed
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2906
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2907
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2908
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth 
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2909
			      width:imageWidth height:imageHeight 
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2910
				  x:srcx y:srcy
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2911
			       into:aDrawableId 
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2912
				  x:dstx y:dsty 
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2913
			      width:w height:h 
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2914
			       with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2915
132
claus
parents: 129
diff changeset
  2916
    "since XPutImage may allocate huge amount of stack space 
claus
parents: 129
diff changeset
  2917
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  2918
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  2919
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2920
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2921
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2922
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2923
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2924
     */
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2925
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2926
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2927
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2928
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2929
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2930
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2931
    if (__isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2932
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2933
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2934
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2935
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2936
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2937
     && __bothSmallInteger(imageDepth, bitsPerPixel)
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2938
     && __isByteArray(imageBits)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2939
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2940
	win = _WindowVal(aDrawableId);
811
bf8721a1e3ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 790
diff changeset
  2941
	if (! gc || !win) 
bf8721a1e3ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 790
diff changeset
  2942
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2943
#ifdef ARGDEBUG
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2944
	printf("args ok\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2945
#endif
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2946
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2947
	image.width = imgWdth = __intVal(imageWidth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2948
	image.height = __intVal(imageHeight);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2949
	image.xoffset = 0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2950
	image.format = ZPixmap;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2951
	image.byte_order = MSBFirst;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2952
	image.bitmap_unit = 8;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2953
	image.bitmap_bit_order = MSBFirst;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2954
	image.bitmap_pad = 8;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2955
	image.depth = __intVal(imageDepth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2956
	image.bits_per_pixel = __intVal(bitsPerPixel);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2957
	switch (image.bits_per_pixel) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2958
	    case 1:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2959
		image.bytes_per_line = (imgWdth + 7) / 8;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2960
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2961
	    case 2:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2962
		image.bytes_per_line = (imgWdth*2 + 7) / 8;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2963
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2964
	    case 4:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2965
		image.bytes_per_line = (imgWdth*4 + 7) / 8;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2966
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2967
	    case 8:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2968
		image.bytes_per_line = imgWdth;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2969
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2970
	    case 16:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2971
		image.bytes_per_line = imgWdth*2;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2972
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2973
	    case 24:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2974
		image.bytes_per_line = imgWdth*3;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2975
		break;
193
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2976
	    case 32:
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  2977
		image.bytes_per_line = imgWdth*4;
193
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2978
		break;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2979
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2980
#ifdef ARGDEBUG
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2981
		printf("bits_per_pixel=%d\n",image.bits_per_pixel);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2982
#endif
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2983
		goto fail;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2984
	}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2985
	image.red_mask = 0xFFFF;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2986
	image.green_mask = 0xFFFF;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2987
	image.blue_mask = 0xFFFF;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2988
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2989
					__intVal(dstx), __intVal(dsty),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2990
					__intVal(w), __intVal(h));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2991
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2992
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  2993
#ifdef ARGDEBUG
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2994
    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
  2995
    if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n");
193
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2996
    if (!! __isSmallInteger(srcx)) printf("srcx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2997
    if (!! __isSmallInteger(srcy)) printf("srcy\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2998
    if (!! __isSmallInteger(dstx)) printf("dstx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  2999
    if (!! __isSmallInteger(dsty)) printf("dsty\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3000
    if (!! __isSmallInteger(w)) printf("w\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3001
    if (!! __isSmallInteger(h)) printf("h\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3002
    if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3003
    if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3004
    if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3005
    if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3006
    if (!! __isByteArray(imageBits)) printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3007
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3008
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3009
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3010
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  3011
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3012
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3013
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3014
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  3015
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3016
48194c26a46c Initial revision
claus
parents:
diff changeset
  3017
dispatchEventFor:aViewIdOrNil withMask:eventMask
48194c26a46c Initial revision
claus
parents:
diff changeset
  3018
    "central event handling method:
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3019
     get next event and send appropriate message to the sensor or view.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3020
     If the argument aViewIdOrNil is nil, events for any view are processed,
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3021
     otherwise only events for the view with given id are processed.
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3022
     If the argument aMask is nonNil, only events for this eventMask are
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3023
     handled."
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3024
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3025
    (self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[
392
caf4452ec3dd merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  3026
	AbortSignal catch:[
83
597bdb33e832 *** empty log message ***
claus
parents: 82
diff changeset
  3027
	    self dispatchLastEvent.
597bdb33e832 *** empty log message ***
claus
parents: 82
diff changeset
  3028
	]
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3029
    ].
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3030
!
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3031
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3032
dispatchExposeEventFor:aViewIdOrNil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3033
    "get next expose event and send appropriate message to the sensor or view.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3034
     If the argument aViewIdOrNil is nil, events for any view are processed,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3035
     otherwise only events for the view with given id are processed."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3036
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3037
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3038
!
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3039
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3040
dispatchLastEvent
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3041
    |theView symS arg butt sibling windowID siblingID propertyID selectionID targetID requestorID
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3042
     eventType|
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3043
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3044
%{  /* STACK: 8000 */
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3045
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3046
48194c26a46c Initial revision
claus
parents:
diff changeset
  3047
    Display *dpy = myDpy;
135
claus
parents: 133
diff changeset
  3048
    OBJ eB;
claus
parents: 133
diff changeset
  3049
    XEvent *ev;
claus
parents: 133
diff changeset
  3050
claus
parents: 133
diff changeset
  3051
#   define ae ((XAnyEvent *)ev)
claus
parents: 133
diff changeset
  3052
#   define ee ((XExposeEvent *)ev)
claus
parents: 133
diff changeset
  3053
#   define ke ((XKeyPressedEvent *)ev)
claus
parents: 133
diff changeset
  3054
#   define be ((XButtonPressedEvent *)ev)
claus
parents: 133
diff changeset
  3055
#   define ce ((XConfigureEvent *)ev)
claus
parents: 133
diff changeset
  3056
#   define me ((XMotionEvent *)ev)
claus
parents: 133
diff changeset
  3057
#   define ewe ((XEnterWindowEvent *)ev)
claus
parents: 133
diff changeset
  3058
#   define lwe ((XLeaveWindowEvent *)ev)
claus
parents: 133
diff changeset
  3059
#   define de ((XDestroyWindowEvent *)ev)
claus
parents: 133
diff changeset
  3060
#   define ve ((XVisibilityEvent *)ev)
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3061
#   define mape ((XMappingEvent *)ev)
135
claus
parents: 133
diff changeset
  3062
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3063
    KeySym keySym;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3064
    unsigned char buffer[10];
48194c26a46c Initial revision
claus
parents:
diff changeset
  3065
    int i, nchars;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3066
    char *keySymString;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3067
    char keySymStringBuffer[32];
48194c26a46c Initial revision
claus
parents:
diff changeset
  3068
    static unsigned multiClickTime = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3069
    unsigned nextMultiClickTime;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3070
    OBJ upDown;
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3071
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3072
    struct inlineCache *ipS;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3073
    static struct inlineCache vid = _ILC1;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3074
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3075
    static struct inlineCache expS = _ILC5;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3076
    static struct inlineCache gexpS = _ILC5;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3077
    static struct inlineCache nexpS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3078
    static struct inlineCache motS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3079
    static struct inlineCache bpS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3080
    static struct inlineCache bmpS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3081
    static struct inlineCache bspS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3082
    static struct inlineCache brS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3083
    static struct inlineCache focInS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3084
    static struct inlineCache focOutS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3085
    static struct inlineCache peS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3086
    static struct inlineCache plS = _ILC2;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3087
    static struct inlineCache termS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3088
    static struct inlineCache savtermS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3089
    static struct inlineCache destrS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3090
    static struct inlineCache unmapS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3091
    static struct inlineCache mapS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  3092
    static struct inlineCache confS = _ILC5;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3093
    static struct inlineCache coveredS = _ILC2;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3094
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3095
    static struct inlineCache keymap = _ILC0;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3096
    static struct inlineCache created = _ILC0;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3097
    static struct inlineCache mapReq = _ILC0;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3098
    static struct inlineCache repar = _ILC0;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3099
    static struct inlineCache confReq = _ILC0;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3100
    static struct inlineCache resReq = _ILC0;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3101
    static struct inlineCache prop = _ILC0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3102
    static struct inlineCache selClear = _ILC1;
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3103
    static struct inlineCache selReq = _ILC4;
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3104
    static struct inlineCache selNotify = _ILC4;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3105
    static struct inlineCache colormap = _ILC0;
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3106
    static struct inlineCache mapping = _ILC2;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3107
    static struct inlineCache vis = _ILC1;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3108
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3109
    static struct inlineCache skpS = _ILC4;
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  3110
    static struct inlineCache skrS = _ILC4;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3111
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3112
    eB = __INST(eventBuffer);
135
claus
parents: 133
diff changeset
  3113
    if (__isByteArray(eB)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3114
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
135
claus
parents: 133
diff changeset
  3115
    } else {
claus
parents: 133
diff changeset
  3116
	printf("DISPLAY: no eventBuffer\n");
claus
parents: 133
diff changeset
  3117
	RETURN (false);
claus
parents: 133
diff changeset
  3118
    }
claus
parents: 133
diff changeset
  3119
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3120
    windowID = __MKOBJ(ae->window);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3121
    theView = (*vid.ilc_func)(self, @symbol(viewFromId:) COMMA_CON, nil, &vid, windowID);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3122
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3123
    if ((theView == nil) && (ev->type != MappingNotify)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3124
	RETURN (nil);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3125
    }
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3126
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3127
    /*
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3128
     * key, button and pointer events are sent to the sensor,
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3129
     * or (if there is none) to the delegate.
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3130
     * or (if there is none) to the view.
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  3131
     *
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  3132
     * expose events are sent to the sensor,
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  3133
     * or (if there is none) to the view
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  3134
     *
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3135
     * sensor and delegate get view as additional argument
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3136
     * all of this has been taken out of here to corresponding methods
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3137
     * in DeviceWorkstation.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3138
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3139
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3140
#ifdef DEBUG
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3141
    eventType = __MKSMALLINT(ev->type);
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3142
#endif
135
claus
parents: 133
diff changeset
  3143
    switch (ev->type) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3144
	case KeyRelease:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3145
	    symS = @symbol(keyRelease:x:y:view:);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3146
	    ipS = &skrS;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3147
	    upDown = false;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3148
	    goto keyPressAndRelease;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3149
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3150
	case KeyPress:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3151
	    symS = @symbol(keyPress:x:y:view:);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3152
	    ipS = &skpS;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3153
	    upDown = true;
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3154
	    /* FALL INTO */
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3155
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3156
	keyPressAndRelease:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3157
	    __INST(eventRootX) = __MKSMALLINT(ke->x_root);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3158
	    __INST(eventRootY) = __MKSMALLINT(ke->y_root);
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3159
#ifdef OLD
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3160
	    __INST(altDown) = (ke->state & Mod2Mask) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3161
	    __INST(metaDown) = (ke->state & Mod1Mask) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3162
#else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3163
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3164
	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3165
#endif
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3166
	    __INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3167
	    __INST(ctrlDown) = (ke->state & ControlMask) ? true : false;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3168
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3169
	    arg = nil;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3170
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3171
	    if (nchars 
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3172
	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3173
		 || (buffer[0] >= 0x80))) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3174
		arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3175
		keySymString = NULL;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3176
	    } else {
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  3177
#ifdef OLD
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3178
		switch (keySym) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3179
		    case XK_Control_L:
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3180
		    case XK_Control_R:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3181
			__INST(ctrlDown) = upDown;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3182
			break;
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3183
		    case XK_Shift_L:
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3184
		    case XK_Shift_R:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3185
			__INST(shiftDown) = upDown;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3186
			break;
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3187
		    case XK_Meta_L:
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3188
		    case XK_Meta_R:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3189
			__INST(metaDown) = upDown;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3190
			break;
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3191
		    case XK_Alt_L:
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3192
		    case XK_Alt_R:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3193
			__INST(altDown) = upDown;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3194
			break;
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3195
		}
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  3196
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3197
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3198
		keySymString = XKeysymToString(keySym);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3199
		if (keySymString) {
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  3200
#ifdef OLD
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3201
		    if (keySymString[0] == 'D') {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3202
			/*
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3203
			 * remove underscore, dont want it in symbols
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3204
			 */
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3205
			if (strcmp(keySymString, "Delete_line") == 0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3206
			    keySymString = "DeleteLine";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3207
			} else if (strcmp(keySymString, "Delete_word") == 0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3208
			    keySymString = "DeleteWord";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3209
			}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3210
		    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3211
		    /*
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3212
		     * make names compatible
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3213
		     */
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3214
		    if (strcmp(keySymString, "Down") == 0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3215
			keySymString = "CursorDown";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3216
		    } else if (strcmp(keySymString, "Up") == 0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3217
			keySymString = "CursorUp";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3218
		    } else if (strcmp(keySymString, "Left") == 0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3219
			keySymString = "CursorLeft";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3220
		    } else if (strcmp(keySymString, "Right") == 0) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3221
			keySymString = "CursorRight";
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3222
		    }
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3223
		    arg = __MKSYMBOL(keySymString, (OBJ *)0, __context);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  3224
#else
350
ade060e42304 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
  3225
		    __PROTECT__(theView);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  3226
		    arg = __MKSTRING(keySymString COMMA_CON);
350
ade060e42304 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
  3227
		    __UNPROTECT__(theView);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  3228
#endif
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3229
		}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3230
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3231
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3232
	    if (arg == nil) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3233
		/* happens sometimes (alt-graph on sun has no keysym) */
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3234
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3235
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3236
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3237
	    (*(*ipS).ilc_func)(self, symS COMMA_CON, nil, ipS,
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3238
			       arg, 
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3239
			       __MKSMALLINT(ke->x), 
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3240
			       __MKSMALLINT(ke->y),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3241
			       theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3242
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3243
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3244
	case ButtonPress:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3245
	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button));
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3246
	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3247
	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3248
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3249
	    if (__isSmallInteger(__INST(multiClickTimeDelta)))
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3250
		nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta));
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3251
	    else
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3252
		nextMultiClickTime = 0;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3253
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3254
	    if (multiClickTime) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3255
		if (be->time < multiClickTime) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3256
		    multiClickTime = nextMultiClickTime;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3257
		    ipS = &bmpS;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3258
		    symS = @symbol(buttonMultiPress:x:y:view:);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3259
		    goto sendButtonEvent;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3260
		    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3261
		}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3262
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3263
	    multiClickTime = nextMultiClickTime;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3264
	    if (be->state & ShiftMask) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3265
		ipS = &bspS;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3266
		symS = @symbol(buttonShiftPress:x:y:view:);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3267
		goto sendButtonEvent;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3268
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3269
	    ipS = &bpS;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3270
	    symS = @symbol(buttonPress:x:y:view:);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3271
	    goto sendButtonEvent;
200
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  3272
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3273
	    /* NOT REACHED */
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3274
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3275
	case ButtonRelease:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3276
	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button));
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3277
	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3278
	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3279
	    ipS = &brS;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3280
	    symS = @symbol(buttonRelease:x:y:view:);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3281
	    /* fall into */
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3282
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3283
	sendButtonEvent:
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3284
	    butt = __MKSMALLINT(be->button);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3285
#ifdef NOTDEF
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3286
	    /*
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3287
	     * this allows operation with single button mouses: meta-click is always Button 2
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3288
	     */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3289
	    if (__INST(metaDown) == true)
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3290
		butt = __MKSMALLINT(2);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3291
	    else 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3292
#endif
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3293
		butt = __AT_(__INST(buttonTranslation), butt);
200
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  3294
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3295
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3296
	    (*(*ipS).ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3297
			       symS
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3298
			       COMMA_CON, nil, ipS,
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3299
			       butt, 
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3300
			       __MKSMALLINT(ke->x), 
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3301
			       __MKSMALLINT(ke->y),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3302
			       theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3303
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3304
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3305
	case MotionNotify:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3306
	    if (__INST(motionEventCompression) != false) {
135
claus
parents: 133
diff changeset
  3307
		while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3308
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3309
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3310
	    __INST(eventRootX) = __MKSMALLINT(me->x_root);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3311
	    __INST(eventRootY) = __MKSMALLINT(me->y_root);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3312
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3313
#ifdef OLD
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3314
	    __INST(altDown) = (me->state & Mod2Mask) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3315
	    __INST(metaDown) = (me->state & Mod1Mask) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3316
#else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3317
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3318
	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3319
#endif
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3320
	    __INST(shiftDown) = (me->state & ShiftMask) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3321
	    __INST(ctrlDown) = (me->state & ControlMask) ? true : false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3322
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3323
	    (*motS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3324
			     @symbol(buttonMotion:x:y:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3325
			     COMMA_CON, nil, &motS,
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3326
			     __MKSMALLINT(me->state),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3327
			     __MKSMALLINT(me->x),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3328
			     __MKSMALLINT(me->y),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3329
			     theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3330
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3331
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3332
	case FocusIn:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3333
	    (*focInS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3334
			       @symbol(focusInView:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3335
			       COMMA_CON, nil, &focInS, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3336
			       theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3337
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3338
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3339
	case FocusOut:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3340
	    (*focOutS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3341
				@symbol(focusOutView:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3342
				COMMA_CON, nil, &focOutS, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3343
				theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3344
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3345
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3346
	case EnterNotify:
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3347
#ifdef OLD
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3348
	    __INST(altDown) = (ewe->state & Mod2Mask) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3349
	    __INST(metaDown) = (ewe->state & Mod1Mask) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3350
#else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3351
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3352
	    __INST(metaDown) = (ke->state & __intVal(__INST(metaModifierMask))) ? true : false;
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  3353
#endif
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3354
	    __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3355
	    __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3356
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3357
	    (*peS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3358
			    @symbol(pointerEnter:x:y:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3359
			    COMMA_CON, nil, &peS,
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3360
			    __MKSMALLINT(ewe->state),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3361
			    __MKSMALLINT(ewe->x), 
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3362
			    __MKSMALLINT(ewe->y),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3363
			    theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3364
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3365
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3366
	case LeaveNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3367
	    (*plS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3368
			    @symbol(pointerLeave:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3369
			    COMMA_CON, nil, &plS,
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3370
			    __MKSMALLINT(lwe->state), 
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3371
			    theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3372
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3373
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3374
	case GraphicsExpose:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3375
	    (*gexpS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3376
			      @symbol(graphicExposeX:y:width:height:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3377
			      COMMA_CON, nil, &gexpS,
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3378
			      __MKSMALLINT(ee->x),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3379
			      __MKSMALLINT(ee->y),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3380
			      __MKSMALLINT(ee->width),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3381
			      __MKSMALLINT(ee->height),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3382
			      theView);
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3383
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3384
	    if (ee->count != 0) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3385
		break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3386
	    }
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3387
	    /* fall into */
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3388
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3389
	case NoExpose:
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3390
	    (*nexpS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3391
			      @symbol(noExposeView:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3392
			      COMMA_CON, nil, &nexpS, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3393
			      theView);
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3394
	    break;
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3395
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3396
	case Expose:
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3397
	    (*expS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3398
			     @symbol(exposeX:y:width:height:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3399
			     COMMA_CON, nil, &expS,
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3400
			     __MKSMALLINT(ee->x),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3401
			     __MKSMALLINT(ee->y),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3402
			     __MKSMALLINT(ee->width),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3403
			     __MKSMALLINT(ee->height),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3404
			     theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3405
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3406
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3407
	case ConfigureNotify:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3408
	    if (ce->above != None) {
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3409
		siblingID = __MKOBJ(ce->above);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3410
		sibling = (*vid.ilc_func)(self, @symbol(viewFromId:) 
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3411
					  COMMA_CON, nil, &vid, siblingID);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3412
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3413
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3414
	    (*confS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3415
			     @symbol(configureX:y:width:height:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3416
			     COMMA_CON, nil, &confS,
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3417
			     __MKSMALLINT(ce->x),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3418
			     __MKSMALLINT(ce->y),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3419
			     __MKSMALLINT(ce->width),
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3420
			     __MKSMALLINT(ce->height),
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3421
			     theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3422
	    if (sibling != nil) {
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3423
		(*coveredS.ilc_func)(self,
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3424
				    @symbol(coveredBy:view:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3425
				    COMMA_CON, nil, &coveredS,
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3426
				    theView,
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3427
				    sibling);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3428
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3429
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3430
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3431
	case ClientMessage:
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3432
	    if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) {
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3433
		if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom)))
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3434
		 || (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) {
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3435
		    (*termS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3436
				      @symbol(terminateView:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3437
				      COMMA_CON, nil, &termS, theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3438
		    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3439
		}
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3440
		if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) {
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3441
		    (*savtermS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3442
					 @symbol(saveAndTerminateView:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3443
					 COMMA_CON, nil, &savtermS, theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3444
		    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3445
		}
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3446
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3447
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3448
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3449
	case DestroyNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3450
	    (*destrS.ilc_func)(self, @symbol(destroyedView:)
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3451
			       COMMA_CON, nil, &destrS, theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3452
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3453
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3454
	case UnmapNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3455
	    (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3456
			       COMMA_CON, nil, &unmapS, theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3457
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3458
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3459
	case MapNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3460
	    (*mapS.ilc_func)(self, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3461
			     @symbol(mappedView:) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3462
			     COMMA_CON, nil, &mapS, theView);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3463
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3464
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3465
	case KeymapNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3466
	    (*keymap.ilc_func)(theView, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3467
			       @symbol(keyMapChange) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3468
			       COMMA_CON, nil, &keymap);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3469
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3470
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3471
	case VisibilityNotify:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3472
	    switch (ve->state) {
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3473
		case VisibilityUnobscured:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3474
		    arg = @symbol(unobscured);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3475
		    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3476
		case VisibilityPartiallyObscured:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3477
		    arg = @symbol(partiallyObscured);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3478
		    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3479
		case VisibilityFullyObscured:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3480
		    arg = @symbol(fullyObscured);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3481
		    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3482
	    }
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3483
	    (*vis.ilc_func)(theView, @symbol(visibilityChange:) COMMA_CON, nil, &vis, arg);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3484
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3485
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3486
	case CreateNotify:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3487
	    (*created.ilc_func)(theView, @symbol(created) COMMA_CON, nil, &created);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3488
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3489
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3490
	case MapRequest:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3491
	    (*mapReq.ilc_func)(theView, @symbol(mapRequest) COMMA_CON, nil, &mapReq);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3492
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3493
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3494
	case ReparentNotify:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3495
	    (*repar.ilc_func)(theView, @symbol(reparented) COMMA_CON, nil, &repar);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3496
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3497
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3498
	case ConfigureRequest:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3499
	    (*confReq.ilc_func)(theView, @symbol(configRequest) COMMA_CON, nil, &confReq);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3500
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3501
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3502
	case GravityNotify:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3503
	case ResizeRequest:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3504
	    (*resReq.ilc_func)(theView, @symbol(resizeRequest) COMMA_CON, nil, &resReq);
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3505
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3506
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3507
	case CirculateNotify:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3508
	case CirculateRequest:
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3509
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3510
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3511
	case PropertyNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3512
	    (*prop.ilc_func)(theView, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3513
			     @symbol(propertyChange) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3514
			     COMMA_CON, nil, &prop);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3515
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3516
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3517
	case SelectionClear:
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3518
	    selectionID = __MKATOMOBJ(ev->xselectionclear.selection);
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3519
	    (*selClear.ilc_func)(theView, 
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3520
				 @symbol(selectionClear:) 
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3521
				 COMMA_CON, nil, &selClear,
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3522
				 selectionID);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3523
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3524
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3525
	case SelectionNotify:
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3526
	    /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3527
	     * returned selection value (answer from SelectionRequest)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3528
	     */
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3529
	    DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
135
claus
parents: 133
diff changeset
  3530
			ev->xselection.property, ev->xselection.target,
claus
parents: 133
diff changeset
  3531
			ev->xselection.selection, ev->xselection.requestor));
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3532
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3533
	    propertyID = __MKATOMOBJ(ev->xselection.property);
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3534
	    targetID = __MKATOMOBJ(ev->xselection.target);
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3535
	    selectionID = __MKATOMOBJ(ev->xselection.selection);
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3536
	    requestorID = __MKOBJ(ev->xselection.requestor);
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3537
	    (*selNotify.ilc_func)(theView, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3538
				  @symbol(selectionNotify:target:selection:from:) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3539
				  COMMA_CON, nil, &selNotify,
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3540
				  propertyID, targetID, selectionID, requestorID);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3541
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3542
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3543
	case SelectionRequest:
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3544
	    /*
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3545
	     * someone wants the selection
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3546
	     */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3547
	    DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
135
claus
parents: 133
diff changeset
  3548
			ev->xselectionrequest.property,
claus
parents: 133
diff changeset
  3549
			ev->xselectionrequest.target,
claus
parents: 133
diff changeset
  3550
			ev->xselectionrequest.selection,
claus
parents: 133
diff changeset
  3551
			ev->xselectionrequest.requestor));
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
  3552
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3553
	    propertyID = __MKATOMOBJ(ev->xselectionrequest.property);
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3554
	    targetID = __MKATOMOBJ(ev->xselectionrequest.target);
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3555
	    selectionID = __MKATOMOBJ(ev->xselectionrequest.selection);
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
  3556
	    requestorID = __MKOBJ(ev->xselectionrequest.requestor);
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3557
	    (*selReq.ilc_func)(theView, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3558
			       @symbol(selectionRequest:target:selection:from:) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3559
			       COMMA_CON, nil, &selReq,
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3560
			       propertyID, targetID, selectionID, requestorID);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3561
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3562
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3563
	case ColormapNotify:
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3564
	    (*colormap.ilc_func)(theView, 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3565
				 @symbol(colorMapChange) 
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  3566
				 COMMA_CON, nil, &colormap);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3567
	    break;
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3568
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3569
	case MappingNotify:
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3570
	    switch(mape->request) {
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3571
		case MappingModifier:
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3572
		    arg = @symbol(mappingModifier);
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3573
		    break;
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3574
		case MappingKeyboard:
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3575
		    arg = @symbol(mappingKeyboard);
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3576
		    break;
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3577
		case MappingPointer:
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3578
		    arg = @symbol(mappingPointer);
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3579
		    break;
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3580
		default:
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3581
		    arg = nil;
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3582
		    break;
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3583
	    }
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3584
	    (*mapping.ilc_func)(self, 
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3585
				@symbol(mappingChanged:event:) 
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3586
				COMMA_CON, nil, &mapping, arg, eB);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3587
	    break;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3588
    }
135
claus
parents: 133
diff changeset
  3589
#undef ae
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3590
#undef ee
48194c26a46c Initial revision
claus
parents:
diff changeset
  3591
#undef ke
48194c26a46c Initial revision
claus
parents:
diff changeset
  3592
#undef be
48194c26a46c Initial revision
claus
parents:
diff changeset
  3593
#undef ce
48194c26a46c Initial revision
claus
parents:
diff changeset
  3594
#undef me
48194c26a46c Initial revision
claus
parents:
diff changeset
  3595
#undef ewe
48194c26a46c Initial revision
claus
parents:
diff changeset
  3596
#undef lwe
48194c26a46c Initial revision
claus
parents:
diff changeset
  3597
#undef de
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3598
#undef mape
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3599
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  3600
.
48194c26a46c Initial revision
claus
parents:
diff changeset
  3601
    ^ true
48194c26a46c Initial revision
claus
parents:
diff changeset
  3602
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3603
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3604
dispatchPendingEvents
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3605
    "central event handling method for modal operation.
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3606
     (i.e. this is now only used in the modal debugger)
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3607
     This code is somewhat special, since X has a concept of graphic
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3608
     expose events (which are sent after a bitblt). After such a bitblt,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3609
     we only handle exposes until the graphicsExpose arrives.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3610
     Other systems may not need such a kludge"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3611
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  3612
    "interested in exposes only ?"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3613
    dispatchingExpose notNil ifTrue:[
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3614
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3615
	    self dispatchExposeEventFor:dispatchingExpose
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3616
	].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3617
	^ self
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3618
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3619
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3620
    "no, general dispatch"
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3621
    [self eventPendingWithSync:false] whileTrue:[
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3622
	self dispatchEventFor:nil withMask:nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3623
    ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3624
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3625
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3626
disposeEventsWithMask:aMask for:aWindowIdOrNil
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3627
    "dispose (throw away) specific events. If aWindowId is nil,
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3628
     events matching the mask are thrown away regardless of which
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3629
     view they are for. Otherwise, only matching events for that 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3630
     view are flushed."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3631
48194c26a46c Initial revision
claus
parents:
diff changeset
  3632
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  3633
48194c26a46c Initial revision
claus
parents:
diff changeset
  3634
    Display *dpy = myDpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3635
    XEvent ev;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3636
    Window win;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3637
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3638
    if (__isSmallInteger(aMask)) {
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3639
	if (__isExternalAddress(aWindowIdOrNil)) {
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3640
	    win = _WindowVal(aWindowIdOrNil);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3641
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;;
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3642
	} else {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3643
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;;
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3644
	}
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3645
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3646
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  3647
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  3648
.
48194c26a46c Initial revision
claus
parents:
diff changeset
  3649
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  3650
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3651
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3652
eventMaskFor:anEventSymbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3653
    "return the eventMask bit-constant corresponding to an event symbol"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3654
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3655
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3656
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3657
    int m = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3658
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3659
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3660
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3661
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3662
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3663
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3664
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3665
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3666
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3667
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3668
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3669
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3670
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3671
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3672
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3673
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3674
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  3675
    RETURN (__MKSMALLINT(m));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3676
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3677
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3678
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3679
eventPending
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3680
    "return true, if any event is pending. 
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3681
     This looks for both the internal queue and the display connection."
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3682
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3683
    ConservativeSyncing == true ifTrue:[self sync].
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3684
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3685
    dispatchingExpose notNil ifTrue:[
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3686
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3687
    ].
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3688
    ^ self eventPendingWithSync:false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3689
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3690
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3691
eventPending:anEventSymbol for:aWindowIdOrNil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3692
    "return true, if a specific event is pending"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3693
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3694
    ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil withSync:false
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3695
!
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3696
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3697
eventPendingWithSync:doSync
7
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  3698
    "return true, if any event is pending. 
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3699
     If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed)
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3700
     before checking."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3701
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3702
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3703
48194c26a46c Initial revision
claus
parents:
diff changeset
  3704
    Display *dpy = myDpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3705
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3706
    if (ISCONNECTED) {
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3707
	if (doSync == true) {
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3708
	    XSync(dpy, 0);      /* make certain everything is flushed */
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3709
	}
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3710
	if (XPending(dpy)) {
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3711
	    RETURN (true);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3712
	}
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3713
    }
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3714
    RETURN ( false );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3715
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  3716
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3717
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3718
eventQueued
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3719
    "return true, if any event is queued"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3720
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3721
    dispatchingExpose notNil ifTrue:[
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3722
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3723
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3724
    ^ self eventQueuedAlready
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3725
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3726
    "Created: 12.12.1995 / 21:43:00 / stefan"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3727
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3728
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3729
eventQueuedAlready
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3730
    "return true, if any event is queued internally.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3731
     (i.e. in X's internal event queue, which is both filled by explicit
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3732
      nextEvent calls AND whenever drawing is done and events are pending on
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3733
      the display connection)."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3734
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3735
%{  /* UNLIMITEDSTACK */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3736
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3737
    if (ISCONNECTED) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3738
	if (XEventsQueued(myDpy, QueuedAlready)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3739
	    RETURN (true);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3740
	}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3741
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3742
    RETURN ( false );
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3743
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3744
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  3745
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3746
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3747
    "return true, if any of the masked events is pending"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3748
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3749
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3750
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3751
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3752
    XEvent ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3753
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3754
    int thereIsOne;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3755
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3756
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3757
	if (doSync == true) {
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3758
	    XSync(dpy, 0);      /* make certain everything is flushed */
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3759
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3760
	if (__isExternalAddress(aWindowIdOrNil)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3761
	    win = _WindowVal(aWindowIdOrNil);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3762
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3763
	} else {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3764
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3765
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3766
	if (thereIsOne) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3767
	    XPutBackEvent(dpy, &ev);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3768
	    RETURN ( true );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3769
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3770
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3771
    RETURN ( false );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3772
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3773
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3774
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3775
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3776
    "return true, if any expose event is pending for a specific view,
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3777
     or any view (if the arg is nil).
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  3778
     This is an X specific, only required after a scroll operation."
7
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  3779
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3780
%{  /* UNLIMITEDSTACK */
7
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  3781
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  3782
    Display *dpy = myDpy;
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  3783
    XEvent ev;
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  3784
    Window win;
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3785
    int thereIsOne;
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3786
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3787
    if (ISCONNECTED) {
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3788
	if (doSync == true) {
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3789
	    XSync(dpy, 0);      /* make certain everything is flushed */
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  3790
	}
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3791
	if (__isExternalAddress(aWindowIdOrNil)) {
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3792
	    win = _WindowVal(aWindowIdOrNil);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3793
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3794
	} else {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3795
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3796
	}
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3797
	if (thereIsOne) {
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3798
	    XPutBackEvent(dpy, &ev);
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3799
	    RETURN ( true );
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  3800
	}
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3801
    }
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3802
    RETURN ( false );
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3803
%}
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3804
!
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3805
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3806
getEventFor:aViewIdOrNil withMask:eventMask
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3807
    "read next event - put into local eventBuffer. 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3808
     If aViewIdOrNil is nil, events for any view are fetched; 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3809
     otherwise only events for that specific view will be fetched.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3810
     Returns true, if there was an event, false otherwise.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3811
     This method may block - so you better check for pending events
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3812
     before calling for it.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3813
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3814
     Sorry I had to split dispatch into this fetch method and an extra
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3815
     handle method to allow unlimitedstack here.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3816
     (some Xlibs do a big alloca there ...) which cannot be done in 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3817
     dispatchLastEvent, since it dispatches out into ST-methods.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3818
     BUG: uses a static buffer - has to be rewritten, to support multiple
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3819
     display connections.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3820
    "
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3821
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3822
%{  /* UNLIMITEDSTACK */
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3823
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  3824
    Display *dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3825
    Window win, wWanted;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3826
    int evMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3827
    OBJ eB;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3828
    XEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3829
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3830
    if (! ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3831
	RETURN (false);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3832
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3833
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3834
    eB = __INST(eventBuffer);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3835
    if (__isByteArray(eB)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3836
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3837
    } else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3838
	printf("DISPLAY: no eventBuffer\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3839
	RETURN (false);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3840
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3841
    ev->type = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3842
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3843
    if (__isSmallInteger(eventMask)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3844
	evMask = __intVal(eventMask);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3845
    } else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3846
	evMask = ~0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3847
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3848
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3849
    if (__isExternalAddress(aViewIdOrNil)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3850
	wWanted = _WindowVal(aViewIdOrNil);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3851
	if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) {
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3852
	    RETURN ( true );
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  3853
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3854
    } else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3855
	if (evMask == ~0) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3856
	    XNextEvent(dpy, ev);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3857
	    RETURN (true);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3858
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3859
	if (XCheckMaskEvent(dpy, evMask, ev)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3860
	   RETURN (true);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3861
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3862
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3863
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3864
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3865
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3866
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3867
handleAllEvents
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3868
    "from now on, handle any kind of event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3869
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3870
    dispatchingExpose := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3871
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3872
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3873
handleExposeOnlyFor:aView
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3874
    "from now on, handle expose events only"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3875
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3876
    dispatchingExpose := aView id
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3877
!
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3878
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3879
mappingChanged:what event:eB
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3880
    "One of Keyboard-, Modifier- or PointerMap has change, probably by xmodmap.
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3881
     Tell xlib about the fact."
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3882
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3883
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3884
	self refreshKeyboardMapping:eB.
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3885
	"Maybe some of our modifiers have been changed"
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3886
	self initializeModifierMappings.
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3887
    ].
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3888
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  3889
    "Created: 1.12.1995 / 16:28:23 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3890
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3891
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3892
setEventMask:aMask in:aWindowId
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  3893
    "tell X that we are only interested in events from aMask, which
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3894
     is the bitwise or of the eventMask bits (see 'eventMaskFor:')"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3895
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3896
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3897
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3898
    int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3899
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3900
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3901
     && __isSmallInteger(aMask)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3902
	mask = __intVal(aMask);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3903
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3904
#ifdef OLD
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3905
	/* these may not be disabled */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3906
	mask |= ExposureMask | StructureNotifyMask |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3907
		KeyPressMask | KeyReleaseMask |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3908
		EnterWindowMask | LeaveWindowMask |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3909
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3910
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3911
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3912
	XSelectInput(myDpy, _WindowVal(aWindowId), mask);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3913
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3914
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3915
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3916
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3917
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3918
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3919
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3920
startDispatch
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3921
    "redefined to clear dispatchingExpose, which is a special X feature"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3922
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3923
    dispatching ifTrue:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3924
    dispatchingExpose := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3925
    super startDispatch
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3926
! !
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3927
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3928
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3929
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3930
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3931
    "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
  3932
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3933
     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
  3934
     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
  3935
     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
  3936
     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
  3937
     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
  3938
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3939
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3940
%{  /* NOCONTEXT */
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3941
    Display *dpy = myDpy;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3942
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3943
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3944
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3945
    if (__isSmallInteger(stateMask)) {
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3946
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3947
    } else {
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3948
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3949
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3950
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3951
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3952
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3953
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr))
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  3954
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3955
	XEvent ev;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3956
	Window target;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3957
	Status result;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3958
	KeySym keySym, *syms;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  3959
	int screen = __intVal(__INST(screen));
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3960
	char s[2];
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3961
	int nSyms;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3962
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3963
	if ((typeSymbol == @symbol(keyPress))
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3964
	 || (typeSymbol == @symbol(keyRelease))) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3965
	    if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3966
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3967
	    } else {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3968
		if (__isCharacter(keySymCodeOrButtonNr)) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3969
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3970
		    s[1] = '\0';
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3971
		    keySym = XStringToKeysym(s);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3972
		} else {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3973
		    keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3974
		}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3975
	    }
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3976
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3977
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3978
	    if (stateMask == nil) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3979
		/*
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3980
		 * get the modifier from the keySym
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3981
		 */
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3982
		nSyms = 0;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3983
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3984
		if (syms) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3985
		    int i;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3986
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3987
		    for (i=0; i<nSyms; i++) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3988
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3989
#ifdef MODIFIERDEBUG
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3990
			    printf("modifier-index is %d\n", i);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  3991
#endif
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3992
			    if (i) state = (1 << (i-1));
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3993
			    break;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3994
			}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3995
		    }
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3996
		    XFree(syms);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3997
		}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3998
	    }
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3999
	} else {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4000
	    if ((typeSymbol == @symbol(buttonPress))
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4001
	     || (typeSymbol == @symbol(buttonRelease))) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4002
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4003
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4004
		} else {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4005
		    ev.xbutton.button = 1;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4006
		}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4007
	    } else {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4008
		DPRINTF(("invalid sendEvent typeSymbol\n"));
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4009
		RETURN (false);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4010
	    }
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4011
	}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4012
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4013
	if (typeSymbol == @symbol(keyPress))
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4014
	    ev.xany.type = KeyPress;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4015
	else if (typeSymbol == @symbol(keyRelease))
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4016
	    ev.xany.type = KeyRelease;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4017
	else if (typeSymbol == @symbol(buttonPress))
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4018
	    ev.xany.type = ButtonPress;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4019
	else if (typeSymbol == @symbol(buttonRelease))
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4020
	    ev.xany.type = ButtonRelease;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4021
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4022
	if (__isExternalAddress(targetId)) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4023
	    target = _WindowVal(targetId);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4024
	} else {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4025
	    target = (Window) __longIntVal(targetId);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4026
	}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4027
	ev.xkey.window = target;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4028
	ev.xkey.same_screen = 1;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4029
	ev.xkey.subwindow = 0;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4030
	ev.xkey.root = RootWindow(myDpy, screen);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4031
	ev.xkey.x = __intVal(xPos);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4032
	ev.xkey.y = __intVal(yPos);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4033
	ev.xkey.state = state;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4034
	ev.xkey.time = CurrentTime;
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4035
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4036
	result = XSendEvent(dpy, target, False, 0 , &ev);
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4037
	if ((result == BadValue) || (result == BadWindow)) {
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4038
	    DPRINTF(("bad status\n"));
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4039
	    RETURN ( false )
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4040
	}
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4041
	RETURN (true)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4042
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4043
%}.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4044
    self primitiveFailed.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4045
    ^ false
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4046
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4047
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4048
simulateKeyboardInput:aCharacterOrString inViewId:viewId
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4049
    "send input to some other view, by simulating keyPress/keyRelease
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4050
     events. 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4051
     Only a few control characters are supported.
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4052
     Notice: not all alien views allow this kind of synthetic input;
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4053
	     some simply ignore it."
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4054
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4055
    |control code state|
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4056
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4057
    aCharacterOrString isString ifTrue:[
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4058
	aCharacterOrString do:[:char |
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4059
	    self simulateKeyboardInput:char inViewId:viewId
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4060
	].
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4061
	^ self
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4062
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4063
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4064
    control := false.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4065
    code := aCharacterOrString asciiValue.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4066
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4067
    (aCharacterOrString == Character cr) ifTrue:[
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4068
	code := #Return
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4069
    ] ifFalse:[
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4070
	(aCharacterOrString == Character tab) ifTrue:[
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4071
	    code := #Tab 
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4072
	] ifFalse:[
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4073
	    (aCharacterOrString == Character esc) ifTrue:[
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4074
		code := #Escape 
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4075
	    ]
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4076
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4077
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4078
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4079
    control ifTrue:[
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4080
	state := state bitOr:(self controlMask)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4081
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4082
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4083
    self sendKeyOrButtonEvent:#keyPress x:0 y:0 keyOrButton:code state:state toViewId:viewId.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4084
    self sendKeyOrButtonEvent:#keyRelease x:0 y:0 keyOrButton:code state:state toViewId:viewId
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4085
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4086
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4087
      sending input to some (possibly alien) view:
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4088
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4089
      |point id|
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4090
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4091
      point :=  Display pointFromUser.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4092
      id := Display viewIdFromPoint:point.
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4093
      Display simulateKeyboardInput:'Hello_world' inViewId:id
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4094
    "
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4095
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4096
    "Modified: 1.3.1996 / 18:31:15 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4097
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4098
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4099
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4100
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4101
ascentOf:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4102
    "the normal ascent"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4103
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4104
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4105
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4106
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4107
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4108
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4109
	if (__isExternalAddress(aFontId)) {
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4110
	    f = _FontVal(aFontId);
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4111
	    RETURN ( __MKSMALLINT(f->ascent) );
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4112
	}
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4113
    }
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4114
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4115
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4116
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4117
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4118
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4119
createFontFor:aFontName
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4120
    "a basic method for X-font allocation; this method allows
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4121
     any font to be aquired (even those not conforming to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4122
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4123
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4124
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4125
    /* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4126
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4127
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4128
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4129
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4130
	if (__isString(aFontName) || __isSymbol(aFontName)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4131
	    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4132
	    newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4133
	    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4134
	    RETURN ( newFont ? __MKOBJ(newFont) : nil );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4135
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4136
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4137
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4138
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4139
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4140
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4141
decomposeXFontName:aString into:aBlock
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4142
    "extract family, face, style and size from an
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4143
     X-font name 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4144
     (-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4145
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4146
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4147
    |origin family face style moreStyle skip fheight size
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4148
     resX resY x1 x2 coding start end |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4149
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4150
    aString isNil ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4151
    (aString startsWith:'-') ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4152
	"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4153
	 take care for ill-named fonts (i.e. pre Rel4 fonts)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4154
	"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4155
	('*-*-[0-9]*' match:aString) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4156
	    end := aString indexOf:$- startingAt:1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4157
	    family := aString copyFrom:1 to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4158
	    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4159
	    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4160
	    style := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4161
	    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4162
	    size := aString copyFrom:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4163
	    size := (Number readFromString:size onError:[^false]).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4164
	    aBlock value:family value:nil value:style value:size value:nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4165
	    ^ true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4166
	].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4167
	('*-[0-9]*' match:aString) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4168
	    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4169
	     something like lucidasans-24
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4170
	    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4171
	    end := aString indexOf:$- startingAt:1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4172
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4173
	    family := aString copyFrom:1 to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4174
	    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4175
	    size := aString copyFrom:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4176
	    size := (Number readFromString:size onError:[^false]).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4177
	    aBlock value:family value:nil value:nil value:size value:nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4178
	    ^ true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4179
	].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4180
	aBlock value:aString value:nil value:nil value:nil value:nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4181
	^ true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4182
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4183
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4184
    end := aString indexOf:$- startingAt:2.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4185
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4186
    origin := aString copyFrom:2 to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4187
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4188
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4189
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4190
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4191
    family := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4192
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4193
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4194
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4195
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4196
    face := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4197
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4198
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4199
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4200
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4201
    style := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4202
    (style = 'o') ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4203
	style := 'oblique'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4204
    ] ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4205
	(style = 'i') ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4206
	    style := 'italic'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4207
	] ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4208
	    (style = 'r') ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4209
		style := 'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4210
	    ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4211
	]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4212
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4213
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4214
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4215
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4216
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4217
    moreStyle := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4218
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4219
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4220
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4221
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4222
    skip := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4223
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4224
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4225
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4226
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4227
    fheight := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4228
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4229
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4230
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4231
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4232
    size := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4233
    size := (Number readFromString:size) / 10.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4234
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4235
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4236
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4237
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4238
    resX := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4239
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4240
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4241
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4242
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4243
    resY := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4244
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4245
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4246
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4247
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4248
    x1 := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4249
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4250
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4251
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4252
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4253
    x2 := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4254
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4255
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4256
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4257
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4258
    coding := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4259
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4260
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4261
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4262
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4263
    "Modified: 27.9.1995 / 10:46:52 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4264
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4265
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4266
descentOf:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4267
    "the normal descent"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4268
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4269
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4270
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4271
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4272
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4273
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4274
	if (__isExternalAddress(aFontId)) {
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4275
	    f = _FontVal(aFontId);
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4276
	    RETURN ( __MKSMALLINT(f->descent) );
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4277
	}
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4278
    }
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4279
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4280
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4281
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4282
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4283
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4284
encodingOf:aFontId
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4285
    "the fonts encoding - if the font does not provide that info,
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4286
     return nil (and assume #ascii, which is a subset of #iso8859)."
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4287
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4288
    |enc fullName fontName registry encoding charSetCollections|
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4289
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4290
%{ 
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4291
    XFontStruct *f;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4292
    XFontProp *prop;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4293
    int n;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4294
    char *cp;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4295
    Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4296
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4297
    registryAtom = XInternAtom(myDpy, "CHARSET_REGISTRY", True);
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4298
    encodingAtom = XInternAtom(myDpy, "CHARSET_ENCODING", True);
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4299
    charSetCollAtom = XInternAtom(myDpy, "CHARSET_COLLECTIONS", True);
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4300
    fontAtom = XInternAtom(myDpy, "FONT", True);
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4301
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4302
    if (ISCONNECTED) {
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4303
        if (__isExternalAddress(aFontId)) {
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4304
        
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4305
            f = _FontVal(aFontId);
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4306
            if (f) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4307
                n = f->n_properties;
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4308
                prop = f->properties;
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4309
                if (prop) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4310
                    while (n--) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4311
                        cp = XGetAtomName(myDpy, prop->name);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4312
#ifdef SUPERDEBUG
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4313
                        printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4314
#endif
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4315
                        if (prop->name == XA_FULL_NAME) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4316
                            cp = XGetAtomName(myDpy, prop->card32);
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4317
                            if (cp) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4318
                                fullName = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4319
#ifdef SUPERDEBUG
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4320
                                printf("   FULL_NAME -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4321
#endif
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4322
                            }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4323
                        }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4324
                        if (prop->name == fontAtom) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4325
                            cp = XGetAtomName(myDpy, prop->card32);
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4326
                            if (cp) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4327
                                fontName = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4328
#ifdef SUPERDEBUG
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4329
                                printf("   FONT -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4330
#endif
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4331
                            }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4332
                        }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4333
                        if (prop->name == encodingAtom) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4334
                            cp = XGetAtomName(myDpy, prop->card32);
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4335
                            if (cp) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4336
                                encoding = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4337
#ifdef SUPERDEBUG
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4338
                                printf("   ENCODING -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4339
#endif
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4340
                            }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4341
                        }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4342
                        if (prop->name == registryAtom) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4343
                            cp = XGetAtomName(myDpy, prop->card32);
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4344
                            if (cp) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4345
                                registry = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4346
#ifdef SUPERDEBUG
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4347
                                printf("   REGISTRY -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4348
#endif
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4349
                            }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4350
                        }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4351
                        if (prop->name == charSetCollAtom) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4352
                            cp = XGetAtomName(myDpy, prop->card32);
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4353
                            if (cp) {
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4354
                                charSetCollections = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4355
#ifdef SUPERDEBUG
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4356
                                printf("   CHARSET_COLLECTIONS -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4357
#endif
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4358
                            }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4359
                        }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4360
                        prop++;
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4361
                    }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4362
                }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4363
            }
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4364
        }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4365
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4366
%}.
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4367
    ^ self
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4368
        extractEncodingFromRegistry:registry 
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4369
        encoding:encoding 
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4370
        charSetCollections:charSetCollections
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4371
!
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4372
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4373
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4374
    "this is pure magic ..."
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4375
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4376
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4377
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4378
    (registry notNil and:[registry notEmpty]) ifTrue:[
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4379
        enc := registry asLowercase asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4380
    ] ifFalse:[
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4381
        (encoding notNil and:[encoding notEmpty]) ifTrue:[
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4382
            enc := encoding asLowercase asSymbol
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4383
        ] ifFalse:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4384
            charSets := charSetCollections.    
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4385
            (charSets notNil and:[charSets notEmpty]) ifTrue:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4386
                charSets := charSets asUppercase asCollectionOfWords.
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4387
                (charSets includes:'ISO8859-1') ifTrue:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4388
                    enc := #iso8859
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4389
                ] ifFalse:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4390
                    (charSets includes:'ISO8859') ifTrue:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4391
                        enc := #iso8859
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4392
                    ] ifFalse:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4393
                        (charSets includes:'ASCII') ifTrue:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4394
                            enc := #ascii
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4395
                        ] ifFalse:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4396
                            (charSets includes:'ADOBE-STANDARD') ifTrue:[
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4397
                                enc := #iso8859
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4398
                            ]
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4399
                        ]
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4400
                    ]
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4401
                ]
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4402
            ] 
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4403
        ]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4404
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4405
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4406
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  4407
    "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
  4408
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4409
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4410
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4411
flushListOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4412
    "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
  4413
     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
  4414
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4415
    listOfXFonts := nil
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4416
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4417
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4418
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4419
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4420
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4421
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4422
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4423
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4424
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4425
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4426
fullNameOf:aFontId
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4427
    "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
  4428
     used for user feed-back (for example: in the fontPanel).
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4429
     If the display/font do not provide that info, return nil."
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4430
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4431
    |fullName fontName|
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4432
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4433
%{ 
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4434
    XFontStruct *f;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4435
    XFontProp *prop;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4436
    int n;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4437
    char *cp;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4438
    Atom fontAtom;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4439
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4440
    fontAtom = XInternAtom(myDpy, "FONT", True);
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4441
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4442
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4443
	if (__isExternalAddress(aFontId)) {
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4444
        
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4445
	    f = _FontVal(aFontId);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4446
	    if (f) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4447
		n = f->n_properties;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4448
		prop = f->properties;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4449
		if (prop) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4450
		    while (n--) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4451
			cp = XGetAtomName(myDpy, prop->name);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4452
#ifdef SUPERDEBUG
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4453
			printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4454
#endif
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4455
			if (prop->name == XA_FULL_NAME) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4456
			    cp = XGetAtomName(myDpy, prop->card32);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4457
			    if (cp) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4458
				fullName = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4459
#ifdef SUPERDEBUG
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4460
				printf("   FULL_NAME -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4461
#endif
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4462
			    }
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4463
			}
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4464
			if (prop->name == fontAtom) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4465
			    cp = XGetAtomName(myDpy, prop->card32);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4466
			    if (cp) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4467
				fontName = __MKSTRING(cp COMMA_CON);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4468
#ifdef SUPERDEBUG
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4469
				printf("   FONT -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4470
#endif
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4471
			    }
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4472
			}
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4473
			prop++;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4474
		    }
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4475
		}
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4476
	    }
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4477
	}
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4478
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4479
%}.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4480
    (fullName notNil and:[fullName notEmpty]) ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4481
	^ fullName
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4482
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4483
    ^ fontName
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4484
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  4485
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4486
getAvailableFontsMatching:pattern
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4487
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4488
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4489
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4490
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4491
    int nnames = 1500;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4492
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4493
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4494
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4495
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4496
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4497
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4498
	if (__isString(pattern)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4499
	    for (;;) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4500
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4501
		if ((fonts == NULL) || (available < nnames)) break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4502
		XFreeFontNames(fonts);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4503
		nnames = available * 2;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4504
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4505
	    if (fonts == NULL) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4506
		RETURN ( nil );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4507
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4508
	    /*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4509
	     * now, that we know the number of font names,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4510
	     * create the array ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4511
	     */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4512
	    arr = __ARRAY_NEW_INT(available);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4513
	    if (! arr) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4514
		RETURN (nil);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4515
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4516
	    /*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4517
	     * ... and fill it
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4518
	     */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4519
	    for (i=0; i<available; i++) {
350
ade060e42304 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
  4520
		__PROTECT__(arr);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4521
		str = __MKSTRING(fonts[i] COMMA_CON);
350
ade060e42304 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
  4522
		__UNPROTECT__(arr);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4523
		__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4524
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4525
	    RETURN (arr);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4526
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4527
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4528
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4529
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4530
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4531
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4532
getDefaultFont
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4533
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4534
     find anything usable"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4535
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4536
     ^ self createFontFor:'fixed'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4537
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4538
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4539
getFontWithFamily:familyString face:faceString
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4540
	    style:styleString size:sizeArg encoding:encodingSym
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4541
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4542
    "try to get the specified font, if not available, try next smaller
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4543
     font. Access to X-fonts by name is possible, by passing the X font name
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4544
     as family and the other parameters as nil. For example, the cursor font
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4545
     can be aquired that way."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4546
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4547
    |theName theId xlatedStyle id |
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4548
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4549
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4550
    faceString isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4551
	sizeArg notNil ifTrue:[
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4552
	    theName := familyString , '-' , sizeArg printString
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4553
	] ifFalse:[
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4554
	    theName := familyString
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4555
	].
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4556
	theName isNil ifTrue:[
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4557
	    "
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4558
	     mhmh - fall back to the default font
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4559
	    "
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4560
	    theName := 'fixed'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4561
	].
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4562
	theId := self createFontFor:theName.
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4563
	theId isNil ifTrue:[
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4564
	    theId := self getDefaultFont
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4565
	].
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4566
	^ theId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4567
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4568
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4569
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4570
    xlatedStyle notNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4571
	xlatedStyle := xlatedStyle first asString
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4572
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4573
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4574
    id := self 
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4575
	    getFontWithFoundry:'*'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4576
	    family:familyString asLowercase
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4577
	    weight:faceString
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4578
	    slant:xlatedStyle
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4579
	    spacing:'normal'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4580
	    pixelSize:nil
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4581
	    size:sizeArg 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4582
	    registry:encodingSym
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4583
	    encoding:'*'.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4584
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4585
    id isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4586
	(encodingSym notNil and:[encodingSym ~= '*']) ifTrue:[
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4587
	    "/ too stupid: encodings come in both cases
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4588
	    "/ and X does not ignore case
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4589
	    "/
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4590
	    id := self 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4591
		    getFontWithFoundry:'*'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4592
		    family:familyString asLowercase
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4593
		    weight:faceString
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4594
		    slant:xlatedStyle
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4595
		    spacing:'normal'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4596
		    pixelSize:nil
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4597
		    size:sizeArg 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4598
		    registry:encodingSym asUppercase
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4599
		    encoding:'*'.
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4600
	    id isNil ifTrue:[
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4601
		id := self 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4602
			getFontWithFoundry:'*'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4603
			family:familyString asLowercase
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4604
			weight:faceString
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4605
			slant:xlatedStyle
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4606
			spacing:'normal'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4607
			pixelSize:nil
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4608
			size:sizeArg 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4609
			registry:encodingSym asLowercase
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4610
			encoding:'*'.
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4611
	    ]
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4612
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4613
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4614
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4615
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4616
    "Modified: 24.2.1996 / 22:37:24 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4617
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4618
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4619
getFontWithFoundry:foundry family:family weight:weight
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4620
	      slant:slant spacing:spc pixelSize:pSize size:size 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4621
	      registry:registry encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4622
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4623
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4624
     This is the new font creation method - all others will be changed to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4625
     use this entry.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4626
     Individual attributes can be left empty (i.e. '') or nil to match any.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4627
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4628
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4629
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4630
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4631
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4632
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4633
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4634
     size:      size in point (1/72th of an inch)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4635
     registry:  iso8859, sgi ... '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4636
     encoding:  vendor specific encoding (usually '*')
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4637
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4638
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4639
    |theName sizeMatch 
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4640
     foundryMatch familyMatch weightMatch slantMatch spcMatch
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4641
     pSizeMatch registryMatch encodingMatch
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4642
     id|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4643
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4644
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4645
    "name is:
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4646
	-foundry-family    -weight -slant-
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4647
	 sony    helvetica bold     r
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4648
	 adobe   courier   medium   i
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4649
	 msic    fixed              o
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4650
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4651
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4652
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4653
    size isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4654
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4655
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4656
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4657
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4658
    foundry isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4659
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4660
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4661
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4662
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4663
    family isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4664
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4665
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4666
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4667
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4668
    weight isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4669
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4670
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4671
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4672
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4673
    slant isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4674
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4675
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4676
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4677
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4678
    spc isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4679
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4680
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4681
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4682
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4683
    pSize isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4684
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4685
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4686
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4687
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4688
    registry isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4689
	registryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4690
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4691
	registryMatch := registry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4692
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4693
    encoding isNil ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4694
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4695
    ] ifFalse:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4696
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4697
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4698
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4699
    theName := ('-' , foundryMatch,
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4700
		'-' , familyMatch,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4701
		'-' , weightMatch ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4702
		'-' , slantMatch , 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4703
		'-' , spcMatch ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4704
		'-*' ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4705
		'-' , pSizeMatch ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4706
		'-' , sizeMatch ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4707
		'-*-*-*-*' ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4708
		'-' , registryMatch ,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4709
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4710
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  4711
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4712
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4713
    ^ self createFontFor:theName.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4714
        
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4715
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4716
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4717
     Display getFontWithFoundry:'*'
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4718
			 family:'courier'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4719
			 weight:'medium'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4720
			  slant:'r'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4721
			spacing:nil
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4722
		      pixelSize:nil
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4723
			   size:13
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4724
		       registry:'iso8859'
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4725
		       encoding:'*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4726
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4727
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  4728
    "Modified: 24.2.1996 / 22:33:29 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4729
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4730
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4731
listOfAvailableFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4732
    "return a list with all available fonts on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4733
     Since this takes a long time, keep the result of the query for the
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4734
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4735
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4736
392
caf4452ec3dd merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  4737
    |"stream aName fntDescr" names|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4738
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4739
    listOfXFonts isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4740
"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4741
"/ old code; using a pipe to xlsfonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4742
"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4743
"/      stream := PipeStream readingFrom:'xlsfonts ''*'''.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4744
"/      stream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4745
"/      listOfXFonts := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4746
"/      [stream atEnd] whileFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4747
"/          aName := stream nextLine.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4748
"/          aName notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4749
"/          self decomposeXFontName:aName into:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4750
"/                  [:family :face :style :size :coding |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4751
"/                      family notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4752
"/                          fntDescr := FontDescription
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4753
"/                                          family:family
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4754
"/                                          face:face
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4755
"/                                          style:style
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4756
"/                                          size:size
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4757
"/                                          encoding:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4758
"/                          listOfXFonts add:fntDescr
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4759
"/                      ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4760
"/                  ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4761
"/          ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4762
"/      ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4763
"/      stream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4764
"/      "if xlsfont is broken ... (hey sco)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4765
"/      (listOfXFonts size == 0) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4766
"/          listOfXFonts := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4767
"/      ] ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4768
"/          listOfXFonts sort:[:a :b | a family < b family].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4769
"/      ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4770
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4771
        "/
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4772
        "/ new code:
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4773
        "/ use new primitive to get font names;
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4774
        "/ this is much faster, and also works on systems where
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4775
        "/      a) xlsfonts is broken (sco)
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4776
        "/      b) xlsfonts is not available (aix)
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4777
        "/
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4778
        names := self getAvailableFontsMatching:'*'.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4779
        names isNil ifTrue:[
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4780
            "no names returned ..."
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4781
            ^ nil
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4782
        ].
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4783
        listOfXFonts := names collect:[:aName |
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4784
                                    |fntDescr|
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4785
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4786
                                    (self decomposeXFontName:aName into:
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4787
                                        [:family :face :style :size :coding |
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4788
                                           family notNil ifTrue:[
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4789
                                               fntDescr := FontDescription
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4790
                                                               family:family
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4791
                                                               face:face
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4792
                                                               style:style
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4793
                                                               size:size
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4794
                                                               encoding:coding.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4795
                                           ] ifFalse:[
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4796
                                               fntDescr := FontDescription
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4797
                                                               name:aName
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4798
                                           ]
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4799
                                        ]
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4800
                                    ) ifFalse:[
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4801
                                        fntDescr := FontDescription name:aName.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4802
                                    ].  
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4803
                                    fntDescr
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4804
                            ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4805
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4806
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4807
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4808
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4809
    "
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4810
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4811
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  4812
     Display getAvailableFontsMatching:'*'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4813
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4814
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4815
    "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
  4816
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4817
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4818
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4819
maxAscentOf:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4820
    "the max ascent"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4821
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4822
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4823
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4824
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4825
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4826
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4827
	if (__isExternalAddress(aFontId)) {
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4828
	    f = _FontVal(aFontId);
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4829
	    RETURN ( __MKSMALLINT(f->max_bounds.ascent) );
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4830
	}
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4831
    }
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4832
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4833
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4834
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4835
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4836
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4837
maxDescentOf:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4838
    "the max descent"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4839
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4840
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4841
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4842
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4843
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4844
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4845
	if (__isExternalAddress(aFontId)) {
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4846
	    f = _FontVal(aFontId);
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4847
	    RETURN ( __MKSMALLINT(f->max_bounds.descent) );
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4848
	}
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4849
    }
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4850
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4851
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4852
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4853
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4854
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4855
maxWidthOfFont:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4856
    "the width of the widest character"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4857
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4858
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4859
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4860
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4861
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4862
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4863
	if (__isExternalAddress(aFontId)) {
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4864
	    f = _FontVal(aFontId);
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4865
	    RETURN ( __MKSMALLINT(f->max_bounds.width) );
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4866
	}
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4867
    }
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4868
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4869
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4870
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4871
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4872
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4873
minWidthOfFont:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4874
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4875
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4876
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4877
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4878
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4879
    if (ISCONNECTED) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4880
	if (__isExternalAddress(aFontId)) {
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4881
	    f = _FontVal(aFontId);
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4882
	    RETURN ( __MKSMALLINT(f->min_bounds.width) );
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4883
	}
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4884
    }
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4885
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4886
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4887
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4888
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4889
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4890
releaseFont:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4891
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4892
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4893
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4894
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4895
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4896
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4897
	if (__isExternalAddress(aFontId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4898
	    f = _FontVal(aFontId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4899
	    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4900
	    XFreeFont(myDpy, f);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4901
	    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4902
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4903
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4904
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4905
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4906
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4907
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4908
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  4909
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4910
    "return a set of all available font sizes in aFamily/aFace/aStyle
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4911
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4912
     Redefined to handle X's special case of 0-size (which stands for any)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4913
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4914
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4915
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  4916
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4917
    (sizes notNil and:[sizes includes:0]) ifTrue:[
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4918
	"special: in X11R5 and above, size 0 means:
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4919
	 there are scaled versions in all sizes available"
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4920
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  4921
	^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4922
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4923
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4924
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4925
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4926
     Display sizesInFamily:'courier' face:'bold' style:'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4927
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  4928
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  4929
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4930
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4931
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4932
widthOf:aString from:index1 to:index2 inFont:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4933
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4934
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4935
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4936
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4937
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4938
    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
  4939
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4940
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4941
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  4942
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4943
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  4944
    if (ISCONNECTED) {
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4945
        if (__bothSmallInteger(index1, index2)
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4946
         && __isExternalAddress(aFontId)
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4947
         && __isNonNilObject(aString)) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4948
            f = _FontVal(aFontId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  4949
            i1 = __intVal(index1) - 1;
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  4950
            cls = __qClass(aString);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4951
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4952
            if (i1 >= 0) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  4953
                i2 = __intVal(index2) - 1;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4954
                if (i2 < i1) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4955
                    RETURN (self);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4956
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4957
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4958
                cp = (char *) _stringVal(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4959
                l = i2 - i1 + 1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4960
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4961
                if ((cls == @global(String)) || (cls == @global(Symbol))) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4962
                    n = _stringSize(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4963
                    if (i2 < n) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4964
                        cp += i1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4965
                        BEGIN_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4966
                        len = XTextWidth(f, cp, l);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4967
                        END_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4968
                        RETURN ( __MKSMALLINT(len) );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4969
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4970
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4971
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  4972
                nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4973
                cp += nInstBytes;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4974
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4975
                if (__isBytes(aString)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  4976
                    n = __byteArraySize(aString) - nInstBytes;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4977
                    if (i2 < n) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4978
                        cp += i1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4979
                        BEGIN_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4980
                        len = XTextWidth(f, cp, l);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4981
                        END_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4982
                        RETURN ( __MKSMALLINT(len) );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4983
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4984
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4985
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4986
                /* TWOBYTESTRINGS */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4987
                if (__isWords(aString)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  4988
                    n = (__byteArraySize(aString) - nInstBytes) / 2;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4989
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4990
                    if (i2 < n) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4991
                        union {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4992
                            char b[2];
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4993
                            unsigned short s;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4994
                        } u;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4995
                        int i;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4996
                        XChar2b *cp2 = (XChar2b *)0;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4997
                        int mustFree = 0;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4998
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  4999
                        cp += (i1 * 2);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5000
                        if (l > 1000) l = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5001
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5002
                        /*
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5003
                         * ST/X TwoByteStrings store the asciiValue in native byteOrder;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5004
                         * X expects them MSB first
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5005
                         * convert as required
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5006
                         */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5007
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5008
                        u.s = 0x1234;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5009
                        if (u.b[0] != 0x12) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5010
                            if (l <= NLOCALBUFFER) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5011
                                cp2 = xlatebuffer;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5012
                            } else {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5013
                                cp2 = (XChar2b *)(malloc(l * 2));
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5014
                                mustFree = 1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5015
                            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5016
                            for (i=0; i<l; i++) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5017
                                cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5018
                                cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5019
                            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5020
                            cp = (char *) cp2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5021
                        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5022
                        BEGIN_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5023
                        len = XTextWidth16(f, (XChar2b *)cp, l);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5024
                        END_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5025
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5026
                        if (mustFree) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5027
                            free(cp2);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5028
                        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5029
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5030
                        RETURN ( __MKSMALLINT(len) );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5031
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5032
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5033
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5034
        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5035
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5036
#undef NLOCALBUFFER
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  5037
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5038
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5039
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5040
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5041
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5042
widthOf:aString inFont:aFontId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5043
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5044
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5045
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5046
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5047
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5048
    int len, n;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  5049
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5050
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5051
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  5052
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5053
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  5054
    if (ISCONNECTED) {
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5055
        if (__isExternalAddress(aFontId)
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5056
         && __isNonNilObject(aString)) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5057
            f = _FontVal(aFontId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5058
            cls = __qClass(aString);
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5059
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5060
            cp = (char *)_stringVal(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5061
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5062
            if ((cls == @global(String)) || (cls == @global(Symbol))) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5063
                n = _stringSize(aString);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5064
                BEGIN_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5065
                len = XTextWidth(f, cp, n);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5066
                END_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5067
                RETURN ( __MKSMALLINT(len) );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5068
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5069
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5070
            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5071
            cp += nInstBytes;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5072
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5073
            if (__isBytes(aString)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5074
                n = __byteArraySize(aString) - nInstBytes;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5075
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5076
                BEGIN_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5077
                len = XTextWidth(f, cp, n);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5078
                END_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5079
                RETURN ( __MKSMALLINT(len) );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5080
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5081
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5082
            /* TWOBYTESTRINGS */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5083
            if (__isWords(aString)) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5084
                union {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5085
                    char b[2];
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5086
                    unsigned short s;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5087
                } u;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5088
                int i;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5089
                XChar2b *cp2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5090
                int mustFree = 0;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5091
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5092
                n = (__byteArraySize(aString) - nInstBytes) / 2;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5093
                if (n > 1000) n = 1000;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5094
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5095
                /*
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5096
                 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5097
                 * X expects them MSB first
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5098
                 * convert as required
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5099
                 */
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5100
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5101
                u.s = 0x1234;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5102
                if (u.b[0] != 0x12) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5103
                    if (n <= NLOCALBUFFER) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5104
                        cp2 = xlatebuffer;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5105
                    } else {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5106
                        cp2 = (XChar2b *)(malloc(n * 2));
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5107
                        mustFree = 1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5108
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5109
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5110
                    for (i=0; i<n; i++) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5111
                        cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5112
                        cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5113
                    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5114
                    cp = (char *) cp2;
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5115
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5116
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5117
                BEGIN_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5118
                len = XTextWidth16(f, (XChar2b *)cp, n);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5119
                END_INTERRUPTSBLOCKED
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5120
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5121
                if (mustFree) {
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5122
                    free(cp2);
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5123
                }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5124
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5125
                RETURN ( __MKSMALLINT(len) );
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5126
            }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5127
        }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5128
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  5129
#undef NLOCALBUFFER
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  5130
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5131
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5132
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5133
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5134
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5135
!XWorkstation methodsFor:'grabbing '!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5136
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5137
allowEvents:mode
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5138
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5139
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5140
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5141
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5142
    if (mode == @symbol(asyncPointer))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5143
	_mode = AsyncPointer;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5144
    else if (mode == @symbol(syncPointer))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5145
	_mode = SyncPointer;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5146
    else if (mode == @symbol(asyncKeyboard))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5147
	_mode = AsyncKeyboard;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5148
    else if (mode == @symbol(syncKeyboard))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5149
	_mode = SyncKeyboard;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5150
    else if (mode == @symbol(syncBoth))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5151
	_mode = SyncBoth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5152
    else if (mode == @symbol(asyncBoth))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5153
	_mode = AsyncBoth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5154
    else if (mode == @symbol(replayPointer))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5155
	_mode = ReplayPointer;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5156
    else if (mode == @symbol(replayKeyboard))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5157
	_mode = ReplayKeyboard;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5158
    else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5159
	ok = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5160
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5161
    if (ok) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5162
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5163
	XAllowEvents(myDpy, _mode, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5164
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5165
	RETURN (self);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5166
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  5167
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5168
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5169
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5170
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5171
grabKeyboardIn:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5172
    "grab the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5173
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5174
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5175
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5176
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5177
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5178
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5179
	result = XGrabKeyboard(myDpy,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5180
			       _WindowVal(aWindowId),
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5181
			       True /* False */,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5182
			       GrabModeAsync,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5183
			       GrabModeAsync,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5184
			       CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5185
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5186
	ok = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5187
	switch(result) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5188
	    case AlreadyGrabbed: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5189
		printf("XWORKSTAT: grab keyboard: AlreadyGrabbed\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5190
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5191
	    case GrabNotViewable: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5192
		printf("XWORKSTAT: grab keyboard: GrabNotViewable\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5193
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5194
	    case GrabInvalidTime: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5195
		printf("XWORKSTAT: grab keyboard: InvalidTime\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5196
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5197
	    case GrabFrozen: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5198
		printf("XWORKSTAT: grab keyboard: Frozen\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5199
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5200
	    default:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5201
		ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5202
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5203
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5204
	if (! ok) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5205
	    XUngrabKeyboard(myDpy, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5206
	    RETURN (false);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5207
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5208
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5209
	RETURN ( true );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5210
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5211
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5212
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5213
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5214
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5215
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5216
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5217
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5218
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5219
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5220
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5221
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5222
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5223
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5224
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5225
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5226
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5227
	if (__isExternalAddress(confineId)) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5228
	    confineWin = _WindowVal(confineId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5229
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5230
	    confineWin = (Window) None;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5231
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5232
	if (__isExternalAddress(aCursorId)) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5233
	    curs = _CursorVal(aCursorId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5234
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5235
	    curs = (Cursor) None;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5236
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5237
	if (pMode == @symbol(sync))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5238
	    pointer_mode = GrabModeSync;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5239
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5240
	    pointer_mode = GrabModeAsync;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5241
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5242
	if (kMode == @symbol(sync))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5243
	    keyboard_mode = GrabModeSync;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5244
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5245
	    keyboard_mode = GrabModeAsync;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5246
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5247
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5248
	result = XGrabPointer(myDpy,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5249
			      _WindowVal(aWindowId), 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5250
			      False, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5251
			      ButtonPressMask | ButtonMotionMask | ButtonReleaseMask,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5252
			      pointer_mode, keyboard_mode,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5253
			      confineWin,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5254
			      curs,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5255
			      CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5256
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5257
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5258
	ok = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5259
	switch (result) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5260
	    case AlreadyGrabbed: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5261
		printf("XWORKSTAT: grab pointer: AlreadyGrabbed\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5262
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5263
	    case GrabNotViewable: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5264
		printf("XWORKSTAT: grab pointer: GrabNotViewable\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5265
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5266
	    case GrabInvalidTime: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5267
		printf("XWORKSTAT: grab pointer: InvalidTime\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5268
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5269
	    case GrabFrozen: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5270
		printf("XWORKSTAT: grab pointer: Frozen\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5271
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5272
	    default:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5273
		ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5274
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5275
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5276
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5277
	if (! ok) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5278
	    XUngrabPointer(myDpy, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5279
	    RETURN (false);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5280
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5281
	RETURN ( true );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5282
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5283
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5284
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5285
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5286
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5287
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5288
ungrabKeyboard
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5289
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5290
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5291
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5292
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5293
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5294
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5295
	XUngrabKeyboard(myDpy, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5296
	XSync(myDpy, 0);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5297
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5298
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5299
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5300
    activeKeyboardGrab := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5301
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5302
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5303
ungrabPointer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5304
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5305
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5306
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5307
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5308
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5309
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5310
	XUngrabPointer(myDpy, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5311
	XSync(myDpy, 0);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5312
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5313
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5314
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5315
    activePointerGrab := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5316
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5317
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5318
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5319
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5320
noClipIn:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5321
    "disable clipping rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5322
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5323
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5324
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5325
    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
  5326
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5327
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5328
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5329
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5330
	gcv.clip_mask = None;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5331
	XChangeGC(myDpy, gc, GCClipMask, &gcv);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5332
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5333
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5334
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5335
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5336
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5337
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5338
setBackground:bgColorIndex in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5339
    "set background color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5340
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5341
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5342
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5343
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5344
     && __isSmallInteger(bgColorIndex)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5345
	XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5346
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5347
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5348
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5349
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5350
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5351
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5352
setBitmapMask:aBitmapId in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5353
    "set or clear the drawing mask - a bitmap mask using current fg/bg"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5354
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5355
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5356
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5357
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5358
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5359
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5360
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5361
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5362
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5363
	if (__isExternalAddress(aBitmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5364
	    bitmap = _PixmapVal(aBitmapId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5365
	    XSetStipple(dpy, gc, bitmap);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5366
	    XSetFillStyle(dpy, gc, FillOpaqueStippled);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5367
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5368
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5369
	if (aBitmapId == nil) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5370
	    XSetFillStyle(dpy, gc, FillSolid);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5371
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5372
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5373
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5374
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5375
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5376
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5377
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5378
setClipByChildren:aBool in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5379
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5380
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5381
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5382
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5383
    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
  5384
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5385
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5386
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5387
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5388
	if (aBool == true)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5389
	    gcv.subwindow_mode = ClipByChildren;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5390
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5391
	    gcv.subwindow_mode = IncludeInferiors;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5392
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5393
	XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5394
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5395
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5396
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5397
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5398
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5399
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5400
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5401
    "clip to a rectangle"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5402
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5403
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5404
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5405
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5406
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5407
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5408
     && __bothSmallInteger(clipX, clipY)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5409
     && __bothSmallInteger(clipWidth, clipHeight)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5410
	r.x = __intVal(clipX);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5411
	r.y = __intVal(clipY);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5412
	r.width = __intVal(clipWidth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5413
	r.height = __intVal(clipHeight);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5414
	XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5415
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5416
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5417
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5418
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5419
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5420
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5421
setDashes:dashList dashOffset:offset in:aGCId
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5422
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5423
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5424
%{  /* NOCONTEXT */
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5425
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5426
    if (__isExternalAddress(aGCId)
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5427
     && __isSmallInteger(offset)
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5428
     && __isByteArray(dashList)) {
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5429
        XSetDashes(myDpy, _GCVal(aGCId), 
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5430
                   __intVal(offset),
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5431
                   __ByteArrayInstPtr(dashList)->ba_element,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5432
                   __byteArraySize(dashList));
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5433
        RETURN ( self );
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5434
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5435
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5436
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5437
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5438
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5439
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5440
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5441
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5442
    self primitiveFailed
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5443
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  5444
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5445
setFont:aFontId in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5446
    "set font to be drawn in"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5447
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5448
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5449
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5450
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5451
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5452
    if (__isExternalAddress(aFontId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5453
     && __isExternalAddress(aGCId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5454
	f = (XFontStruct *) _FontVal(aFontId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5455
	XSetFont(myDpy, _GCVal(aGCId), f->fid);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5456
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5457
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5458
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5459
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5460
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5461
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5462
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5463
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5464
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5465
setForeground:fgColorIndex background:bgColorIndex in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5466
    "set foreground and background colors to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5467
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5468
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5469
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5470
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5471
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5472
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5473
    if (__bothSmallInteger(fgColorIndex, bgColorIndex)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5474
     && __isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5475
	gc = _GCVal(aGCId);
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5476
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5477
	XSetForeground(dpy, gc, __intVal(fgColorIndex));
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5478
	XSetBackground(dpy, gc, __intVal(bgColorIndex));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5479
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5480
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5481
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5482
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5483
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5484
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5485
setForeground:fgColor background:bgColor mask:aBitmapId in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5486
    "set foreground and background colors to be drawn with using mask or
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5487
     solid (if aBitmapId is nil)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5488
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5489
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5490
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5491
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5492
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5493
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5494
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5495
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5496
	if (__isSmallInteger(fgColor))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5497
	    XSetForeground(dpy, gc, __intVal(fgColor));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5498
	if (__isSmallInteger(bgColor))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5499
	    XSetBackground(dpy, gc, __intVal(bgColor));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5500
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5501
	if (__isExternalAddress(aBitmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5502
	    XSetStipple(dpy, gc, _PixmapVal(aBitmapId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5503
	    XSetFillStyle(dpy, gc, FillOpaqueStippled);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5504
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5505
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5506
	if (aBitmapId == nil) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5507
	    XSetFillStyle(dpy, gc, FillSolid);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5508
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5509
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5510
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5511
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5512
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5513
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5514
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5515
setForeground:fgColor background:bgColor mask:aBitmapId lineWidth:lw in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5516
    "set foreground and background colors to be drawn with using mask or
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5517
     solid (if aBitmapId is nil); also set lineWidth"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5518
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5519
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5520
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5521
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5522
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5523
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5524
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5525
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5526
	if (__isSmallInteger(lw)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5527
	    XSetLineAttributes(dpy, gc, __intVal(lw),
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5528
				    LineSolid, CapNotLast, JoinMiter);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5529
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5530
	if (__isSmallInteger(fgColor))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5531
	    XSetForeground(dpy, gc, __intVal(fgColor));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5532
	if (__isSmallInteger(bgColor))
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5533
	    XSetBackground(dpy, gc, __intVal(bgColor));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5534
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5535
	if (__isExternalAddress(aBitmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5536
	    XSetStipple(dpy, gc, _PixmapVal(aBitmapId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5537
	    XSetFillStyle(dpy, gc, FillOpaqueStippled);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5538
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5539
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5540
	if (aBitmapId == nil) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5541
	    XSetFillStyle(dpy, gc, FillSolid);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5542
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5543
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5544
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5545
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5546
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5547
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5548
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5549
setForeground:fgColorIndex in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5550
    "set foreground color to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5551
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5552
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5553
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5554
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5555
     && __isSmallInteger(fgColorIndex)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5556
	XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5557
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5558
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5559
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5560
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5561
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5562
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5563
setFunction:aFunctionSymbol in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5564
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5565
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5566
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5567
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5568
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5569
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5570
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5571
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5572
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5573
	if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5574
	else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5575
	else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5576
	else if (aFunctionSymbol == @symbol(and)) fun = GXand;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5577
	else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5578
	else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5579
	else if (aFunctionSymbol == @symbol(or)) fun = GXor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5580
	else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5581
	else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5582
	if (fun != -1) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5583
	    XSetFunction(myDpy, gc, fun);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5584
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5585
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5586
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5587
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5588
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5589
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5590
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5591
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5592
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5593
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5594
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5595
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5596
setGraphicsExposures:aBoolean in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5597
    "set or clear the graphics exposures flag"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5598
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5599
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5600
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5601
    if (__isExternalAddress(aGCId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5602
	XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5603
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5604
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5605
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5606
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5607
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5608
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5609
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5610
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5611
    "set line attributes"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5612
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5613
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5614
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5615
    int x_style, x_cap, x_join;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5616
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5617
    if (__isExternalAddress(aGCId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5618
     && __isSmallInteger(aNumber)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5619
	if (lineStyle == @symbol(solid)) x_style = LineSolid;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5620
	else if (lineStyle == @symbol(dashed)) x_style = LineOnOffDash;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5621
	else if (lineStyle == @symbol(doubleDashed)) x_style = LineDoubleDash;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5622
	else  goto bad;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5623
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5624
	if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5625
	else if (capStyle == @symbol(butt)) x_cap = CapButt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5626
	else if (capStyle == @symbol(round)) x_cap  = CapRound;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5627
	else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5628
	else  goto bad;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5629
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5630
	if (joinStyle == @symbol(miter)) x_join = JoinMiter;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5631
	else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5632
	else if (joinStyle == @symbol(round)) x_join  = JoinRound;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5633
	else  goto bad;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5634
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5635
	XSetLineAttributes(myDpy,
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5636
			   _GCVal(aGCId), __intVal(aNumber),
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5637
			   x_style, x_cap, x_join);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5638
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5639
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5640
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5641
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5642
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5643
     either aGCId is invalid,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5644
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5645
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5646
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5647
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5648
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5649
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5650
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5651
setMaskOriginX:orgX y:orgY in:aGCid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5652
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5653
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5654
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5655
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5656
    if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5657
	XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5658
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5659
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5660
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5661
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5662
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5663
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5664
setPixmapMask:aPixmapId in:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5665
    "set or clear the drawing mask - a pixmap mask providing full color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5666
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5667
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5668
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5669
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5670
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5671
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5672
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5673
    if (__isExternalAddress(aGCId)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  5674
	gc = _GCVal(aGCId);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5675
	if (__isExternalAddress(aPixmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5676
	    pixmap = _PixmapVal(aPixmapId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5677
	    XSetTile(dpy, gc, pixmap);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5678
	    XSetFillStyle(dpy, gc, FillTiled);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5679
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5680
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5681
	if (aPixmapId == nil) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5682
	    XSetFillStyle(dpy, gc, FillSolid);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5683
	    RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5684
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5685
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5686
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5687
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5688
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5689
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5690
!XWorkstation methodsFor:'initialize / release'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5691
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5692
close
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5693
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5694
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5695
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5696
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5697
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5698
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5699
	XCloseDisplay(myDpy);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5700
	__INST(displayId) = nil;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5701
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5702
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5703
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5704
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5705
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5706
initializeDefaultValues
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5707
    buttonTranslation := ButtonTranslation.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5708
    multiClickTimeDelta := MultiClickTimeDelta.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5709
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5710
    self initializeModifierMappings
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5711
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5712
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5713
initializeEventBuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5714
    |sz|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5715
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5716
%{
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  5717
    sz = __MKSMALLINT(sizeof(XEvent) + 100);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5718
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5719
    eventBuffer isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5720
	eventBuffer := ByteArray new:sz.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5721
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5722
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5723
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5724
initializeFor:aDisplayName
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5725
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5726
     the argument, aDisplayName may be nil (for the default server from
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5727
     DISPLAY-variable or command line argument) or the name of the server 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5728
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5729
334
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  5730
    |dpyName index arguments|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5731
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5732
    dpyName := aDisplayName.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5733
    dpyName isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5734
	"look for a '-display xxx' argument"
334
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  5735
	(arguments := Smalltalk commandLineArguments) notNil ifTrue:[
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  5736
	    index := arguments indexOf:'-display'.
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  5737
	    (index between:1 and:(arguments size - 1)) ifTrue:[
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  5738
		dpyName := arguments at:index+1
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5739
	    ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5740
	]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5741
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5742
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5743
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5744
    Display *dpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5745
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5746
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5747
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5748
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5749
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5750
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5751
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5752
    int shapeEventBase, shapeErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5753
    int shmEventBase, shmErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5754
    int faxEventBase, faxErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5755
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5756
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5757
    OBJ dpyID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5758
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5759
    if (__INST(displayId) != nil) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5760
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5761
	 * already connected - you bad guy try to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5762
	 * trick me manually ?
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5763
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5764
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5765
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5766
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5767
    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5768
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5769
    if (__isString(dpyName))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5770
	nm = (char *)_stringVal(dpyName);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5771
    else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5772
	dpyName = __MKSTRING((char *)getenv("DISPLAY") COMMA_CON);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5773
	nm = NULL;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5774
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5775
    dpy = XOpenDisplay(nm);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5776
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5777
    if (dpy) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5778
	__INST(displayId) = dpyID = __MKOBJ(dpy); __STORE(self, dpyID);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5779
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5780
#ifdef SUPERDEBUG
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5781
	XSynchronize(dpy, 1);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5782
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5783
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5784
	XSetErrorHandler(__XErrorHandler__);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5785
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5786
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5787
    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5788
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5789
    displayId isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5790
	'XWORKSTATION: cannot connect to Display.' errorPrintNL.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5791
	^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5792
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5793
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5794
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5795
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5796
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5797
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5798
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5799
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5800
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5801
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5802
    buttonsPressed := 0.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5803
    displayName := dpyName.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5804
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5805
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5806
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5807
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5808
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5809
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5810
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5811
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5812
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5813
    self initializeEventBuffer.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5814
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5815
    self initializeKeyboardMap.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5816
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5817
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5818
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5819
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5820
initializeModifierMappings
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5821
    |map mod|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5822
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5823
"/    altModifiers := #(Alt_L Alt_R).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5824
"/    metaModifiers := #(Meta_L Meta_R).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5825
"/    ctrlModifiers := #(Control_L Control_R).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5826
"/    shiftModifiers := #(Shift_L Shift_R).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5827
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5828
    shiftModifiers := ctrlModifiers := altModifiers := metaModifiers := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5829
    altModifierMask := metaModifierMask := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5830
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5831
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5832
    map isNil ifTrue:[
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5833
	"/
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5834
	"/ mhmh - a crippled Xlib which does not provide modifier mappings
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5835
	"/ setup some reasonable default. If that is not sufficient,
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5836
	"/ you have to change things from your display.rc file.
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5837
	"/
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5838
	altModifierMask := self modifier1Mask.
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5839
	metaModifierMask := self modifier2Mask.
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5840
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5841
	shiftModifiers := #(Shift_L Shift_R Shift).
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5842
	ctrlModifiers := #(Control_L Control_R Control).
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5843
	metaModifiers := #(Alt_L Meta_L Meta_R Meta).
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5844
	altModifiers := #(Alt_R Alt).
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5845
    ] ifFalse:[
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5846
	altModifierMask := 0.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5847
	metaModifierMask := 0.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5848
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5849
	mod := map at:1.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5850
	mod notNil ifTrue:[
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5851
	    shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ].
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5852
	].
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5853
	mod := map at:3.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5854
	mod notNil ifTrue:[
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5855
	    ctrlModifiers  := mod collect:[ :key | self stringFromKeycode:key ].
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5856
	].
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5857
	mod := map at:4.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5858
	mod notNil ifTrue:[
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5859
	    metaModifiers  := mod collect:[ :key | self stringFromKeycode:key ].    
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5860
	    metaModifierMask := 1 bitShift:(4-1).
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5861
	].
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5862
	mod := map at:5.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  5863
	mod notNil ifTrue:[
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5864
	    altModifiers   := mod collect:[ :key | self stringFromKeycode:key ].    
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5865
	    altModifierMask := 1 bitShift:(5-1).
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  5866
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5867
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5868
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5869
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5870
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5871
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5872
initializeScreenProperties
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5873
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5874
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5875
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5876
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5877
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5878
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5879
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5880
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5881
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5882
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5883
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5884
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5885
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5886
    int shapeEventBase, shapeErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5887
    int shmEventBase, shmErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5888
    int faxEventBase, faxErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5889
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5890
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5891
    int mask, shift, nBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5892
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5893
    if (ISCONNECTED) {
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5894
        __INST(altModifierMask) = __MKSMALLINT(Mod2Mask);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5895
        __INST(metaModifierMask) = __MKSMALLINT(Mod1Mask);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5896
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5897
        BEGIN_INTERRUPTSBLOCKED
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5898
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5899
        __INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5900
        __INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5901
        __INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5902
        __INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5903
        __INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5904
        __INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5905
        __INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5906
        __INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5907
        __INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5908
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5909
#ifdef SHAPE
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5910
        if (XShapeQueryExtension(dpy, &shapeEventBase, &shapeErrorBase))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5911
            __INST(hasShapeExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5912
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5913
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5914
          __INST(hasShapeExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5915
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5916
#ifdef SHM
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5917
        if (XShmQueryExtension(dpy, &shmEventBase, &shmErrorBase))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5918
            __INST(hasShmExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5919
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5920
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5921
          __INST(hasShmExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5922
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5923
#ifdef FAX
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5924
        if (XFAXImageQueryExtension(dpy, &faxEventBase, &faxErrorBase))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5925
            __INST(hasFaxExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5926
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5927
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5928
          __INST(hasFaxExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5929
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5930
#ifdef DPS
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5931
        if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5932
            __INST(hasDPSExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5933
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5934
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5935
          __INST(hasDPSExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5936
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5937
#ifdef XVIDEO
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5938
        if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5939
            __INST(hasXVideoExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5940
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5941
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5942
          __INST(hasXVideoExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5943
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5944
#ifdef MBUF
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5945
        if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5946
            __INST(hasMbufExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5947
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5948
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5949
          __INST(hasMbufExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5950
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5951
#ifdef PEX5
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5952
        if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5953
            __INST(hasPEXExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5954
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5955
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5956
          __INST(hasPEXExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5957
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5958
#ifdef XIE
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5959
        if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5960
            __INST(hasImageExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5961
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5962
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5963
          __INST(hasImageExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5964
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5965
#ifdef XI
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5966
        if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy))
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5967
            __INST(hasInputExtension) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5968
        else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5969
#endif
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5970
          __INST(hasInputExtension) = false;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5971
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5972
        /*
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5973
         * look for RGB visual
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5974
         */
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5975
        nvi = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5976
        viproto.screen = scr;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5977
        vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5978
        maxRGBDepth = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5979
        for (i = 0; i < nvi; i++) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5980
            switch (vip[i].class) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5981
                case TrueColor:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5982
                    if (vip[i].depth > maxRGBDepth) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5983
                        maxRGBDepth = vip[i].depth;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5984
                        rgbRedMask = vip[i].red_mask;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5985
                        rgbGreenMask = vip[i].green_mask;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5986
                        rgbBlueMask = vip[i].blue_mask;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5987
                        rgbVisualID = vip[i].visualid;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5988
                    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5989
                    break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5990
            }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5991
        }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5992
        if (vip) XFree ((char *) vip);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5993
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5994
        if (maxRGBDepth) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5995
            __INST(rgbVisual) = __MKOBJ(rgbVisualID); __STORESELF(rgbVisual);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5996
        }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5997
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5998
        visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  5999
        __INST(monitorType) = @symbol(unknown);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6000
        __INST(hasColors) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6001
        __INST(hasGreyscales) = true;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6002
        switch (visual->class) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6003
            case StaticGray:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6004
                __INST(visualType) = @symbol(StaticGray);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6005
                __INST(hasColors) = false;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6006
                __INST(monitorType) = @symbol(monochrome);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6007
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6008
            case GrayScale:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6009
                __INST(visualType) = @symbol(GrayScale);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6010
                __INST(hasColors) = false;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6011
                __INST(monitorType) = @symbol(monochrome);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6012
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6013
            case StaticColor:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6014
                __INST(visualType) = @symbol(StaticColor);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6015
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6016
            case PseudoColor:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6017
                __INST(visualType) = @symbol(PseudoColor);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6018
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6019
            case TrueColor:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6020
                __INST(visualType) = @symbol(TrueColor);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6021
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6022
            case DirectColor:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6023
                __INST(visualType) = @symbol(DirectColor);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6024
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6025
        }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6026
        if (DisplayCells(dpy, scr) == 2) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6027
            __INST(hasColors) = false;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6028
            __INST(hasGreyscales) = false;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6029
            __INST(monitorType) = @symbol(monochrome);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6030
        }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6031
        __INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6032
        __INST(redMask)   = __MKSMALLINT(visual->red_mask);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6033
        __INST(greenMask) = __MKSMALLINT(visual->green_mask);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6034
        __INST(blueMask)  = __MKSMALLINT(visual->blue_mask);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6035
        switch (visual->class) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6036
            case TrueColor:
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6037
                /* extract number of bits and shift counts */
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6038
                mask = visual->red_mask;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6039
                shift = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6040
                while (mask && ((mask & 1) == 0)) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6041
                    mask >>= 1;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6042
                    shift++;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6043
                }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6044
                __INST(redShift) = __MKSMALLINT(shift);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6045
                nBits = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6046
                while (mask) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6047
                    mask >>= 1;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6048
                    nBits++;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6049
                }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6050
                __INST(bitsRed) = __MKSMALLINT(nBits);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6051
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6052
                mask = visual->green_mask;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6053
                shift = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6054
                while (mask && ((mask & 1) == 0)) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6055
                    mask >>= 1;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6056
                    shift++;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6057
                }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6058
                __INST(greenShift) = __MKSMALLINT(shift);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6059
                nBits = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6060
                while (mask) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6061
                    mask >>= 1;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6062
                    nBits++;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6063
                }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6064
                __INST(bitsGreen) = __MKSMALLINT(nBits);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6065
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6066
                mask = visual->blue_mask;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6067
                shift = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6068
                while (mask && ((mask & 1) == 0)) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6069
                    mask >>= 1;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6070
                    shift++;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6071
                }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6072
                __INST(blueShift) = __MKSMALLINT(shift);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6073
                nBits = 0;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6074
                while (mask) {
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6075
                    mask >>= 1;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6076
                    nBits++;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6077
                }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6078
                __INST(bitsBlue) = __MKSMALLINT(nBits);
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6079
                break;
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6080
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6081
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6082
#ifndef XA_PRIMARY
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6083
        __INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6084
#else
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6085
        __INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6086
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6087
#ifndef XA_SECONDARY
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6088
        __INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6089
#else
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6090
        __INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6091
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6092
#ifndef XA_CUT_BUFFER0
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6093
        __INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6094
#else
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6095
        __INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6096
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6097
#ifndef XA_STRING
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6098
        __INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6099
#else
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6100
        __INST(stringAtom) = __MKATOMOBJ( XA_STRING );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6101
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6102
#ifndef XA_LENGTH
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6103
        __INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6104
#else
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6105
        __INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6106
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6107
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6108
        END_INTERRUPTSBLOCKED
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6109
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  6110
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6111
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6112
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6113
initializeSpecialFlags
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6114
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6115
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6116
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6117
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6118
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6119
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6120
    ignoreBackingStore := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6121
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6122
    (self serverVendor = 'X11/NeWS') ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6123
	"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6124
	"/ this is a kludge around a bug in the X11/NeWS server,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6125
	"/ which does not correctly handle saveUnder
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6126
	"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6127
	hasSaveUnder := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6128
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6129
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6130
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6131
reinitialize
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6132
    virtualRootId := rootId := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6133
    super reinitialize.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6134
    dispatchingExpose := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6135
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6136
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6137
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6138
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6139
altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6140
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6141
     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
  6142
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6143
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6144
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6145
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6146
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6147
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6148
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6149
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6150
altModifierMask:aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6151
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6152
     By default, this is X's modifier1, which is the ALT key on
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6153
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6154
     and the setting can be changed with:
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6155
	Display altModifierMask:(Display modifier2Mask)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6156
     Setting the mask to 0 disables the ALT key (in ST/X) altogether.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6157
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6158
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6159
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6160
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6161
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6162
metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6163
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6164
     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
  6165
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6166
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6167
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6168
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6169
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6170
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6171
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6172
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6173
metaModifierMask:aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6174
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6175
     By default, this is X's modifier2, which is the 2nd ALT key on
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6176
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6177
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6178
     be changed with:
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6179
	Display metaModifierMask:(Display modifier1Mask)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6180
     Setting the mask to 0 disables the META key (in ST/X) altogether.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6181
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6182
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6183
     all the time. On those, you should disable the meta key by setting
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6184
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6185
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6186
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6187
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6188
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6189
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6190
modifier1Mask
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6191
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6192
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6193
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6194
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6195
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6196
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6197
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6198
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6199
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6200
modifier2Mask
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6201
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6202
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6203
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6204
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6205
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6206
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6207
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6208
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6209
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6210
modifierMapping
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6211
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6212
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6213
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6214
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6215
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6216
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6217
    Display *dpy = myDpy;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6218
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6219
    OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT();
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6220
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6221
    if (ISCONNECTED) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6222
	if ((modmap = XGetModifierMapping(myDpy)) != 0) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6223
	   maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6224
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6225
	   if (modifierKeyMap != nil) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6226
		maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6227
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, 
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6228
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6229
	   }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6230
	   XFreeModifiermap(modmap);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6231
	}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6232
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6233
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6234
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6235
    modifierKeyMap isNil ifTrue:[^ nil].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6236
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6237
    ret := Array new:8.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6238
    nextKey := 1.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6239
    1 to:8 do:[ :i |
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6240
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6241
	    |mod|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6242
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6243
	    mod := OrderedCollection new:maxKeyPerMod.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6244
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6245
		key ~= 0 ifTrue:[
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6246
		    mod add:key
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6247
		].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6248
	    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6249
	    ret at:i put:mod.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6250
	].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6251
	nextKey := nextKey+maxKeyPerMod.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6252
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6253
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6254
    ^ ret
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6255
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6256
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6257
	Display modifierMapping
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6258
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6259
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6260
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6261
stringFromKeycode:code
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6262
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6263
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6264
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6265
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6266
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6267
    Display *dpy = myDpy;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6268
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6269
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6270
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6271
    if (ISCONNECTED && __isSmallInteger(code)) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6272
	if ((keysym = XKeycodeToKeysym(myDpy, __intVal(code), 0)) != NoSymbol &&
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6273
	    (keystring = XKeysymToString(keysym)) != 0) 
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6274
	    str = __MKSTRING(keystring);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6275
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6276
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6277
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6278
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6279
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6280
	Display stringFromKeycode:28
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6281
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6282
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6283
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6284
translateKey:untranslatedKey
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6285
    "Return the key translated via the translation table.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6286
     Here, we preTranslate the key into a common ST/X symbolic name, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6287
     which gets further processed in the superclasses translation method."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6288
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6289
    |key|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6290
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6291
    (key := untranslatedKey) isString ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6292
	key := RawKeysymTranslation at:key ifAbsent:key.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6293
	key := key asSymbol.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6294
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6295
    ^ super translateKey:key 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6296
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6297
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6298
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6299
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6300
beep
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6301
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6302
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6303
    self beep:50
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6304
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6305
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6306
beep:volumeInPercent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6307
    "output an audible beep"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6308
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6309
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6310
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6311
    if (__isSmallInteger(volumeInPercent) && ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6312
	/* stupid: X wants -100 .. 100 and calls this percent */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6313
	volume = __intVal(volumeInPercent) * 2 - 100;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6314
	if (volume < -100) volume = -100;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6315
	else if (volume > 100) volume = 100;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6316
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6317
	XBell(myDpy, volume);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6318
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6319
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6320
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6321
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6322
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6323
buffered
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6324
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6325
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6326
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6327
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6328
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6329
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6330
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6331
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6332
	XSynchronize(myDpy, 0);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6333
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6334
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6335
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6336
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6337
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6338
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6339
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6340
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6341
flush
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6342
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6343
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6344
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6345
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6346
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6347
     See also #sync, which even waits until the request has been processed."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6348
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6349
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6350
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6351
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6352
	BEGIN_INTERRUPTSBLOCKED
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  6353
	XFlush(myDpy);
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  6354
	END_INTERRUPTSBLOCKED
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  6355
    }
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  6356
%}
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  6357
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  6358
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6359
flushDpsContext:aDPSContext
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6360
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6361
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6362
#ifdef DPS
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6363
    if (__isExternalAddress(aDPSContext)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6364
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6365
	DPSFlushContext(MKDPSCONTEXT(aDPSContext));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6366
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6367
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6368
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6369
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6370
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6371
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6372
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6373
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6374
refreshKeyboardMapping:eB
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6375
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6376
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6377
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6378
    if (__isByteArray(eB)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6379
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6380
	XRefreshKeyboardMapping(ev);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6381
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6382
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6383
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6384
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6385
setInputFocusTo:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6386
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6387
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6388
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6389
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6390
setInputFocusTo:aWindowId revertTo:revertSymbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6391
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6392
     Passing nil set the focus to no window and lets the display discard all
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6393
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6394
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6395
     passing one of #parent, #root or nil specifies that the focus should be
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6396
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6397
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6398
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6399
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6400
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6401
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6402
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6403
	if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6404
	    focusWindow = _WindowVal(aWindowId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6405
	} else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6406
	    focusWindow = None;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6407
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6408
	if (revertSymbol == @symbol(parent))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6409
	    arg = RevertToParent;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6410
	else if (revertSymbol == @symbol(root))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6411
	    arg = RevertToPointerRoot;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6412
	else 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6413
	    arg = RevertToNone;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6414
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6415
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6416
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6417
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6418
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6419
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6420
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6421
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6422
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6423
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6424
sync
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6425
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6426
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6427
     This is almost never needed, except if you are about to read previously
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6428
     drawn pixels back from the display screen, or you want to wait for a beep
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6429
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6430
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6431
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6432
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6433
    if (ISCONNECTED) {
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6434
	BEGIN_INTERRUPTSBLOCKED
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6435
	XSync(myDpy, 0);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6436
	END_INTERRUPTSBLOCKED
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6437
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6438
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6439
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  6440
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6441
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6442
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6443
     This makes all graphics synchronous and turns off any buffering
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6444
     (i.e. each individual draw-request is sent immediately without 
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6445
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6446
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6447
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6448
     may be useful if you get Xdisplay errors and want to find the request
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  6449
     which was responsiblefor it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6450
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6451
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6452
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6453
    if (ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6454
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6455
	XSynchronize(myDpy, 1);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6456
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6457
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6458
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6459
    "Display unbuffered"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6460
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6461
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6462
!XWorkstation methodsFor:'pointer queries '!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6463
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6464
anyButtonStateMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6465
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6466
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6467
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6468
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6469
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6470
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6471
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6472
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6473
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6474
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6475
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6476
buttonStates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6477
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6478
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6479
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6480
     shiftMask/controlMask and modifierMask methods for the meaning of the bits."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6481
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6482
%{  /* NOCONTEXT*/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6483
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6484
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6485
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6486
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6487
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6488
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6489
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6490
    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6491
#ifdef VIRTUAL_ROOT
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6492
    w = getRootWindow(myDpy, screen);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6493
#else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6494
    w = RootWindow(dpy, screen);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6495
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6496
    XQueryPointer(dpy, w, &rootRet, &childRet,
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6497
                          &rootX, &rootY,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6498
                          &winX, &winY,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6499
                          &mask);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6500
    END_INTERRUPTSBLOCKED
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  6501
    RETURN (__MKSMALLINT(mask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6502
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6503
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6504
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6505
     Display buttonStates     
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6506
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6507
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6508
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6509
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6510
     Display buttonStates bitTest:(Display controlMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6511
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6512
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6513
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6514
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6515
     Display buttonStates bitTest:(Display altModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6516
     Display buttonStates bitTest:(Display metaModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6517
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6518
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6519
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6520
leftButtonStateMask
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6521
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6522
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6523
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6524
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6525
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6526
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6527
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6528
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6529
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6530
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6531
middleButtonStateMask
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6532
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6533
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6534
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6535
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6536
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6537
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6538
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6539
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6540
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6541
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6542
pointerPosition
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6543
    "return the current pointer position in root-window coordinates"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6544
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6545
    |xpos ypos|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6546
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6547
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6548
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6549
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6550
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6551
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6552
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6553
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6554
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6555
    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6556
#ifdef VIRTUAL_ROOT
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6557
    w = getRootWindow(myDpy, screen);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6558
#else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6559
    w = RootWindow(dpy, screen);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6560
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6561
    XQueryPointer(dpy, w, &rootRet, &childRet,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6562
			  &rootX, &rootY,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6563
			  &winX, &winY,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6564
			  &mask);
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  6565
    xpos = __MKSMALLINT(rootX);
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  6566
    ypos = __MKSMALLINT(rootY);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6567
    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6568
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6569
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6570
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6571
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6572
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6573
rightButtonStateMask
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6574
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6575
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6576
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6577
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6578
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6579
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6580
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  6581
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6582
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6583
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6584
rootPositionOfLastEvent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6585
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6586
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6587
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6588
    ^ eventRootX @ eventRootY
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6589
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6590
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6591
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6592
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6593
atomIDOf:aStringOrSymbol
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6594
    "return an Atoms ID; dont create if not already present.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6595
     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
  6596
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6597
    ^ self atomIDOf:aStringOrSymbol create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6598
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6599
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6600
     Display atomIDOf:'FACE_NAME'      
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6601
     Display atomIDOf:'FULL_NAME' 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6602
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6603
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6604
    "Modified: 2.3.1996 / 15:09:29 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6605
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6606
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6607
atomIDOf:aStringOrSymbol create:create
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6608
    "return an Atoms ID; if create is true, create it if not already present.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6609
     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
  6610
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6611
%{  /* NOCONTEXT */
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6612
    Atom prop;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6613
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6614
    if (ISCONNECTED) {
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6615
        if (__isString(aStringOrSymbol)
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6616
         || __isSymbol(aStringOrSymbol)) {
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6617
            prop = XInternAtom(myDpy, _stringVal(aStringOrSymbol), 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6618
                                      (create == true) ? False : True);
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6619
            if (prop == None) {
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6620
                RETURN (nil);
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6621
            }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6622
            RETURN ( __MKATOMOBJ(prop) );
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6623
        }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6624
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6625
%}.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6626
    self primitiveFailed.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6627
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6628
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6629
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6630
     Display atomIDOf:'VT_SELECTION' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6631
     Display atomIDOf:'CUT_BUFFER0' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6632
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6633
     Display atomIDOf:'PRIMARY' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6634
     Display atomIDOfPRIMARY
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6635
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6636
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6637
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6638
atomIDOfCUTBUFFER0
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6639
    "return the CUTBUFFER0 AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6640
     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
  6641
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6642
    ^ cutBuffer0Atom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6643
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6644
    "Modified: 2.3.1996 / 15:10:36 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6645
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6646
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6647
atomIDOfLENGTH
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6648
    "return the LENGTH AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6649
     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
  6650
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6651
    ^ lengthAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6652
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6653
    "Modified: 2.3.1996 / 15:10:41 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6654
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6655
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6656
atomIDOfPRIMARY
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6657
    "return the PRIMARY AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6658
     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
  6659
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6660
    ^ primaryAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6661
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6662
    "Modified: 2.3.1996 / 15:10:49 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6663
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6664
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6665
atomIDOfSECONDARY
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6666
    "return the SECONDARY AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6667
     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
  6668
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6669
    ^ secondaryAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6670
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6671
    "Modified: 2.3.1996 / 15:10:59 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6672
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6673
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6674
atomIDOfSTRING
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6675
    "return the STRING AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6676
     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
  6677
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6678
    ^ stringAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6679
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6680
    "Modified: 2.3.1996 / 15:11:08 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6681
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6682
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6683
atomName:anAtomID
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6684
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6685
     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
  6686
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6687
%{  /* NOCONTEXT */ 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6688
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6689
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6690
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6691
    if (ISCONNECTED) {
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6692
        if (__isAtomID(anAtomID)) {
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6693
            name = XGetAtomName(myDpy, _AtomVal(anAtomID));
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6694
            if (name == 0) {
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6695
                RETURN (nil);
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6696
            }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6697
            str = __MKSTRING(name COMMA_CON);
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6698
            XFree(name);
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6699
            RETURN ( str );
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6700
        }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6701
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6702
%}.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6703
    self primitiveFailed.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6704
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6705
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6706
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6707
     Display atomName:1 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6708
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6709
     Display atomName:132  'FONTNAME_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6710
     Display atomName:135 'FOUNDRY' 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6711
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6712
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6713
     Display atomName:152 'CHARSET_ENCODING'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6714
     Display atomName:154 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6715
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6716
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6717
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6718
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6719
    "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
  6720
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6721
     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
  6722
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6723
     Notice: 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6724
        we do not plan to use X's resources for ST/X's defaults,
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6725
        styles or resources. This would make porting of applications
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6726
        to different platforms much more difficult (Windows has no resource
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6727
        database). If you stay within ST/X's resource files, these can be
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6728
        easily transported to other platforms.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6729
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6730
     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
  6731
     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
  6732
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6733
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6734
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6735
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6736
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6737
    if ((__isString(name) || __isSymbol(name))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6738
     && (__isString(cls) || __isSymbol(cls))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6739
     && ISCONNECTED) {
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6740
        BEGIN_INTERRUPTSBLOCKED
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6741
        rslt = XGetDefault(myDpy, (char *)_stringVal(cls),
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6742
                                  (char *)_stringVal(name));
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6743
        END_INTERRUPTSBLOCKED
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6744
        RETURN (rslt ? __MKSTRING(rslt COMMA_CON) : nil );
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6745
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6746
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6747
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6748
    ^ nil
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6749
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6750
    "if your ~/.Xdefaults contains an entry such as:
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6751
        OpenWindows.Beep:       notices
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6752
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6753
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6754
         Display getResource:'Beep' class:'OpenWindows'   
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6755
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6756
     if your ~/.Xdefaults contains an entry such as:
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6757
        *.beNiceToColormap:       false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6758
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6759
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6760
         Display getResource:'beNiceToColormap' class:'any'  
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6761
         Display getResource:'beNiceToColormap' class:''  
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  6762
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6763
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6764
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6765
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6766
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6767
getBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6768
    "get bits from a drawable into the imageBits. The storage for the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6769
     must be big enough for the data to fit. If ok, returns an array with some
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6770
     info and the bits in imageBits. The info contains the depth, bitOrder and
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6771
     number of bytes per scanline. The number of bytes per scanline is not known
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6772
     in advance, since the X-server is free to return whatever it thinks is a good padding."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6773
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6774
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6775
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6776
    ((w <= 0) or:[h <= 0]) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6777
	self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6778
	^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6779
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6780
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6781
    rawInfo := Array new:8.
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6782
		  "1 -> bit order"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6783
		  "2 -> depth"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6784
		  "3 -> bytes_per_line"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6785
		  "4 -> byte_order"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6786
		  "5 -> format"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6787
		  "6 -> bitmap_unit"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6788
		  "7 -> bitmap_pad"
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6789
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6790
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6791
    "/ had to extract the getPixel call into a separate method, to specify
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6792
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6793
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6794
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6795
    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6796
	info := IdentityDictionary new.
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6797
	info at:#bitOrder put:(rawInfo at:1).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6798
	info at:#depth put:(rawInfo at:2).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6799
	info at:#bytesPerLine put:(rawInfo at:3).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6800
	info at:#byteOrder put:(rawInfo at:4).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6801
	info at:#format put:(rawInfo at:5).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6802
	info at:#bitmapUnit put:(rawInfo at:6).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6803
	info at:#bitmapPad put:(rawInfo at:7).
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6804
	info at:#bitsPerPixel put:(rawInfo at:8).
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6805
	^ info
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6806
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6807
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6808
     some error occured - either args are not smallintegers, imageBits is not a ByteArray
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6809
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6810
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6811
    ^ self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6812
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6813
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6814
getPixelX:x y:y from:aDrawableId
790
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6815
    "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
  6816
     Nil is returned for invalid coordinates or if any other problem arises."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6817
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6818
%{  /* UNLIMITEDSTACK NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6819
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  6820
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6821
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6822
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6823
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6824
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6825
    if (__isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
790
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6826
        win = _WindowVal(aDrawableId);
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6827
        xpos = __intVal(x);
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6828
        ypos = __intVal(y);
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6829
        if ((xpos < 0) || (ypos < 0)) {
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6830
            RETURN ( __MKSMALLINT(0) );
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6831
        }
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6832
        img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6833
        if (img != 0) {
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6834
            ret = XGetPixel(img, 0, 0);
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6835
            XDestroyImage(img);
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6836
            RETURN (  __MKSMALLINT(ret) );
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  6837
        }
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6838
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6839
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6840
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6841
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6842
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6843
primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6844
    "since XGetImage may allocate huge amount of stack space 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6845
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6846
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6847
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6848
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6849
    Display *dpy = myDpy;
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  6850
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6851
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6852
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6853
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6854
    if (__isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6855
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6856
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6857
     && __isArray(info)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6858
     && __isByteArray(imageBits)) {
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  6859
	win = _WindowVal(aDrawableId);
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6860
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6861
				    __intVal(w), __intVal(h),
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6862
				    (unsigned)AllPlanes, ZPixmap);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6863
378
5d3c20a3bf7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 377
diff changeset
  6864
	if (! image) {
5d3c20a3bf7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 377
diff changeset
  6865
	    RETURN ( false );
5d3c20a3bf7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 377
diff changeset
  6866
	}
5d3c20a3bf7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 377
diff changeset
  6867
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6868
	pad = image->bitmap_pad;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6869
#ifdef SUPERDEBUG
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6870
	printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6871
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6872
	switch (image->depth) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6873
	    case 1:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6874
	    case 2:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6875
	    case 4:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6876
	    case 8:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6877
	    case 16:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6878
	    case 24:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6879
	    case 32:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6880
		numBytes = image->bytes_per_line * image->height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6881
		break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6882
	    default:
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6883
		/* unsupported depth ? */
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6884
		printf("possibly unsupported depth:%d in primGetBits\n", image->depth);
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6885
		numBytes = image->bytes_per_line * image->height;
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6886
		break;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6887
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6888
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6889
#ifdef SUPERDEBUG
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6890
	printf("bytes need:%d bytes given:%d\n", numBytes, __byteArraySize(imageBits));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6891
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6892
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6893
	if (numBytes > __byteArraySize(imageBits)) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6894
	    /* imageBits too small */
378
5d3c20a3bf7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 377
diff changeset
  6895
	    printf("provided byteArray too small\n");
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6896
	    goto fail;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6897
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6898
	if (image->bitmap_bit_order == MSBFirst)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6899
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6900
	else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6901
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6902
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6903
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6904
	if (image->byte_order == MSBFirst)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6905
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6906
	else
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6907
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6908
	if (image->format == XYBitmap)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6909
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6910
	else if (image->format == XYPixmap)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6911
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  6912
	else if (image->format == ZPixmap)
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6913
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  6914
        
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6915
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6916
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6917
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  6918
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6919
	XDestroyImage(image);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6920
	RETURN ( true );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6921
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6922
fail: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6923
    if (image) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6924
	XDestroyImage(image);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6925
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6926
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6927
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6928
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6929
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6930
!XWorkstation methodsFor:'selections'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6931
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6932
getObjectProperty:propertyID from:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6933
    "get an object property; return object or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6934
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6935
    self getProperty:propertyID from:aWindowID into:[:type :value |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6936
	type == stringAtom ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6937
	    ^ value
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6938
	].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6939
	(value isMemberOf:ByteArray) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6940
	    ^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil])
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6941
	]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6942
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6943
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6944
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6945
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6946
getProperty:propertyID from:aWindowID into:aTwoArgBlock
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6947
    "get a property, evaluate aTwoArgBlock with typeID and value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6948
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6949
    |val typeID cls|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6950
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6951
    cls := ByteArray.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6952
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6953
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6954
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6955
    Atom property;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6956
    char *cp, *cp2;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6957
    Atom actual_type;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6958
    int actual_format,i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6959
    unsigned long nitems, bytes_after, nread;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6960
    unsigned char *data;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6961
    int ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6962
#   define PROP_SIZE    2048
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6963
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6964
    if (__isAtomID(propertyID)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6965
	property = _AtomVal(propertyID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6966
	if (__isExternalAddress(aWindowID)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6967
	    window = _WindowVal(aWindowID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6968
	} else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6969
	    window = DefaultRootWindow(dpy);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6970
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6971
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6972
	nread = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6973
	cp = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6974
/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6975
	fprintf(stderr, "getProperty: ");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6976
 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6977
	do {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6978
	    if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6979
				   AnyPropertyType,&actual_type,&actual_format,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6980
				   &nitems,&bytes_after,(unsigned char **)&data)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6981
		!= Success) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6982
		    ok = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6983
		    break;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6984
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6985
	    typeID = __MKATOMOBJ(actual_type);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6986
	    if (! cp) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6987
		cp = cp2 = (char *)malloc(nitems+1);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6988
	    } else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6989
		cp = (char *)realloc(cp, nread + nitems + 1);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6990
		cp2 = cp + nread;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6991
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6992
	    if (! cp) goto fail;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6993
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6994
	    nread += nitems;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6995
	    bcopy(data, cp2, nitems);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6996
	    XFree(data);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6997
/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6998
	    fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6999
 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7000
	} while (bytes_after > 0);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7001
/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7002
	fprintf(stderr, "\n");
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7003
 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7004
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7005
	if (ok) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7006
	    if (actual_type == XA_STRING) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7007
		cp[nread] = '\0';
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7008
		val = __MKSTRING_L(cp, nread COMMA_CON);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7009
	    } else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7010
		val = __new(nread + OHDR_SIZE);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7011
		val->o_class = cls;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7012
		bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7013
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7014
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7015
	if (cp)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7016
	    free(cp);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7017
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7018
fail: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7019
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7020
    typeID isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7021
	^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7022
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7023
    aTwoArgBlock value:typeID value:val.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7024
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7025
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7026
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7027
getSelectionFor:drawableId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7028
    "get the object selection -  either immediate, or asynchronous.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7029
     Returns nil, if async request is on its way"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7030
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7031
    |selProp sel|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7032
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7033
    (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7034
	"no primary selection - use cut buffer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7035
	sel := self getObjectProperty:cutBuffer0Atom from:nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7036
	^ sel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7037
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7038
    selProp := self atomIDOf:'ST_SELECTION' create:true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7039
    self requestObjectSelection:primaryAtom property:selProp for:drawableId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7040
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7041
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7042
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7043
getSelectionOwnerOf:selectionAtomID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7044
    "get the owner of a selection"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7045
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7046
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7047
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7048
    Atom selection;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7049
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7050
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7051
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7052
	window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7053
	RETURN ((window == None) ? nil : __MKOBJ(window));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7054
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7055
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7056
     self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7057
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7058
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7059
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7060
getTextProperty:propertyID from:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7061
    "get a text property; return string or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7062
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7063
    self getProperty:propertyID from:aWindowID into:[:type :value |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7064
	type == stringAtom ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7065
	    ^ value
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7066
	]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7067
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7068
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7069
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7070
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7071
getTextSelectionFor:drawableId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7072
    "get the text selection -  either immediate, or asynchronous.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7073
     Returns nil, if async request is on its way"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7074
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7075
    |selProp sel|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7076
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7077
    (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7078
	"no primary selection - use cut buffer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7079
	sel := self getTextProperty:cutBuffer0Atom from:nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7080
	^ sel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7081
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7082
    selProp := self atomIDOf:'VT_SELECTION' create:true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7083
    self requestTextSelection:primaryAtom property:selProp for:drawableId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7084
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7085
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7086
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7087
requestObjectSelection:selectionID property:propertyID for:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7088
    "ask the server to send us the selection - the view with ID aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7089
     will later receive a SelectionNotify event for it."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7090
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7091
    ^ self requestSelection:selectionID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7092
		   property:propertyID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7093
		   type:(self atomIDOf:'ST_OBJECT' create:true) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7094
		   for:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7095
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7096
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7097
requestSelection:selectionID property:propertyID type:typeID for:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7098
    "ask the server to send us the selection - the view with id aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7099
     will later receive a SelectionNotify event for it (once the Xserver replies
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7100
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7101
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7102
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7103
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7104
    Atom sel_prop;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7105
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7106
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7107
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7108
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7109
     && __isSmallInteger(typeID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7110
     && __isAtomID(selectionID)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7111
	if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7112
	    /*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7113
	     * no owner of primary selection
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7114
	     */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7115
	    RETURN (false);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7116
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7117
	/*
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7118
	 * PRIMARY selection
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7119
	 */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7120
	XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7121
			       _AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7122
	RETURN (true);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7123
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7124
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7125
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7126
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7127
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7128
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7129
     Display requestSelection:(Display atomIDOf:'PRIMARY')
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7130
		     property:(Display atomIDOf:'VT_SELECTION')
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7131
			  for:0
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7132
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7133
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7134
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7135
requestTextSelection:selectionID property:propertyID for:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7136
    "ask the server to send us the selection - the view with ID aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7137
     will later receive a SelectionNotify event for it."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7138
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7139
    ^ self requestSelection:selectionID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7140
		   property:propertyID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7141
		       type:stringAtom 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7142
			for:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7143
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7144
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7145
sendSelection:something property:propertyID target:targetID from:windowID to:requestorID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7146
    "send aString back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7147
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7148
    self 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7149
	sendSelection:something 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7150
	selection:primaryAtom
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7151
	property:propertyID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7152
	target:targetID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7153
	from:windowID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7154
	to:requestorID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7155
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7156
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7157
sendSelection:something selection:selectionID property:propertyID target:targetID from:windowID to:requestorID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7158
    "send aString back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7159
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7160
    self 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7161
	setProperty:propertyID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7162
	type:targetID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7163
	value:something 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7164
	for:requestorID.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7165
    self 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7166
	sendSelectionNotifySelection:selectionID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7167
	property:propertyID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7168
	target:targetID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7169
	from:requestorID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7170
	to:requestorID.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7171
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7172
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7173
sendSelectionNotifySelection:selectionID property:propertyID target:targetID from:windowID to:requestorID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7174
    "send a selectionNotify back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7175
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7176
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7177
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7178
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7179
    if (__isAtomID(propertyID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7180
     && __isExternalAddress(requestorID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7181
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7182
     && __isAtomID(targetID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7183
     && __isAtomID(selectionID)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7184
	XEvent ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7185
	Window requestor = _WindowVal(requestorID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7186
	Atom property = _AtomVal(propertyID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7187
	Atom target = _AtomVal(targetID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7188
	Atom selection = _AtomVal(selectionID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7189
	Status result;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7190
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7191
	ev.xselection.type = SelectionNotify;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7192
	ev.xselection.selection = selection;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7193
	ev.xselection.target = target;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7194
	if (__isExternalAddress(windowID))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7195
	    ev.xselection.requestor = _WindowVal(windowID);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7196
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7197
	    ev.xselection.requestor = DefaultRootWindow(dpy);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7198
	ev.xselection.time = CurrentTime;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7199
	if (property == None)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7200
	    ev.xselection.property = target;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7201
	else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7202
	    ev.xselection.property = property;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7203
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7204
	DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7205
		ev.xselection.selection,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7206
		ev.xselection.property,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7207
		ev.xselection.target,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7208
		ev.xselection.requestor,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7209
		requestor));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7210
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7211
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7212
	if ((result == BadValue) || (result == BadWindow)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7213
	    DPRINTF(("bad status\n"));
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  7214
	    RETURN (false);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7215
	}
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  7216
	RETURN (true)
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  7217
    }
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  7218
%}.
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  7219
    self primitiveFailed.
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  7220
    ^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7221
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7222
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7223
setLengthProperty:propertyID value:aNumber for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7224
    ^ self setProperty:propertyID type:(self atomIDOfLENGTH) value:aNumber for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7225
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7226
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7227
setObjectProperty:propertyID value:anObject for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7228
    |s|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7229
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7230
    (anObject isMemberOf:String) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7231
	^ self setTextProperty:propertyID value:anObject for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7232
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7233
    s := WriteStream on:(ByteArray new:200).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7234
    anObject storeBinaryOn:s.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7235
    ^ self 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7236
	setProperty:propertyID 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7237
	type:(self atomIDOf:'ST_OBJECT' create:true) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7238
	value:(s contents) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7239
	for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7240
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7241
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7242
setProperty:propertyID type:typeID value:anObject for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7243
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7244
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7245
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7246
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7247
    Atom prop, type;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7248
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7249
    unsigned int value;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7250
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7251
    if (__isAtomID(propertyID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7252
     && __isAtomID(typeID) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7253
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7254
     && (__isString(anObject) 
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7255
	 || __isSmallInteger(anObject) 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7256
	 || __isSymbol(anObject) 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7257
	 || __isByteArray(anObject)
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7258
	 || __isWords(anObject))) { 
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7259
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7260
	prop = _AtomVal(propertyID);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7261
	type = _AtomVal(typeID);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7262
	if (__isExternalAddress(aWindowID)) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7263
	    window = _WindowVal(aWindowID);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7264
	} else {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7265
	    window = DefaultRootWindow(dpy);
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7266
	}
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7267
	if (__isSmallInteger(anObject)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7268
	    value = __intVal(anObject);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7269
	    XChangeProperty(dpy, window, prop, type, 32,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7270
			    PropModeReplace,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7271
			    (unsigned char *)(&value), sizeof(unsigned int));
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7272
	} else {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7273
	    if (__isByteArray(anObject)) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7274
		XChangeProperty(dpy, window, prop, type, 8,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7275
				PropModeReplace,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7276
				__ByteArrayInstPtr(anObject)->ba_element,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7277
				__byteArraySize(anObject));
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7278
	    } else {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7279
		/* string or symbol or wordArray-like (16bit-string) object */
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7280
		if (__isWords(__qClass(anObject))) {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7281
		    XChangeProperty(dpy, window, prop, XA_STRING, 16,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7282
				    PropModeReplace,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7283
				    __stringVal(anObject),
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7284
				    __wordArraySize(anObject));
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7285
		} else {
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7286
		    XChangeProperty(dpy, window, prop, XA_STRING, 8,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7287
				    PropModeReplace,
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7288
				    __stringVal(anObject),
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7289
				    strlen(__stringVal(anObject)));
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7290
		}
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7291
	    }
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7292
	}
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  7293
	RETURN (true);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7294
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7295
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7296
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7297
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7298
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7299
setSelection:anObject owner:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7300
    "set the object selection, and make aWindowId be the owner.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7301
     This can be used by other Smalltalk(X) applications only."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7302
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7303
    (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7304
	^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7305
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7306
"/    ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7307
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7308
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7309
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7310
setSelectionOwner:aWindowId of:selectionID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7311
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7312
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7313
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7314
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7315
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7316
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7317
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7318
     && __isAtomID(selectionID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7319
     && ISCONNECTED) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7320
	win = _WindowVal(aWindowId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7321
	XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7322
	if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7323
	    RETURN (false);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7324
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7325
	RETURN (true);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7326
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7327
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7328
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7329
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7330
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7331
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7332
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7333
setTextProperty:propertyID value:aString for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7334
    ^ self setProperty:propertyID type:(self atomIDOfSTRING) value:aString for:aWindowID
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7335
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7336
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7337
setTextSelection:aString owner:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7338
    "set the text selection, and make aWindowId be the owner.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7339
     This can be used by any other X application."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7340
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7341
    (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7342
	'ownerchange failed' errorPrintNL.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7343
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7344
    ^ self setTextProperty:cutBuffer0Atom value:aString for:nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7345
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7346
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7347
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7348
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7349
clearRectangleX:x y:y width:width height:height in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7350
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7351
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7352
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7353
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7354
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7355
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7356
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7357
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7358
     && __bothSmallInteger(width, height)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7359
	w = __intVal(width);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7360
	h = __intVal(height);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7361
	if (w < 0) w = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7362
	if (h < 0) h = 0;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7363
	XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7364
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7365
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7366
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7367
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7368
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7369
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7370
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7371
clearWindow:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7372
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7373
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7374
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7375
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7376
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7377
	XClearWindow(myDpy, _WindowVal(aWindowId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7378
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7379
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7380
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7381
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7382
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7383
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7384
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7385
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7386
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7387
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7388
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7389
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7390
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7391
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7392
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7393
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7394
     && __isExternalAddress(siblingId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7395
	if (modeSymbol == @symbol(above)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7396
	    chg.stack_mode = Above;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7397
	} else if (modeSymbol == @symbol(below)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7398
	    chg.stack_mode = Below;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7399
	} else if (modeSymbol == @symbol(topIf)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7400
	    chg.stack_mode = TopIf;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7401
	} else if (modeSymbol == @symbol(bottomIf)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7402
	    chg.stack_mode = BottomIf;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7403
	} else if (modeSymbol == @symbol(opposite)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7404
	    chg.stack_mode = Opposite;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7405
	} else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7406
	    mask = CWSibling;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7407
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7408
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7409
	chg.sibling = _WindowVal(siblingId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7410
	XConfigureWindow(myDpy, _WindowVal(aWindowId),
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7411
				mask, &chg);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7412
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7413
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7414
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7415
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7416
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7417
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7418
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7419
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7420
lowerWindow:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7421
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7422
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7423
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7424
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7425
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7426
	XLowerWindow(myDpy, _WindowVal(aWindowId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7427
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7428
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7429
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7430
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7431
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7432
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7433
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7434
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos width:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7435
    "make a window visible - either as icon or as a real view - needed for restart"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7436
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7437
    |wicon wiconId wiconView wiconViewId wlabel|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7438
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7439
    aBoolean ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7440
	wicon := aView icon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7441
	wicon notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7442
	    wiconId := wicon id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7443
	].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7444
	wiconView := aView iconView.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7445
	wiconView notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7446
	    wiconViewId := wiconView id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7447
	].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7448
	wlabel := aView label.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7449
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7450
%{  
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7451
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7452
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7453
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7454
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7455
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7456
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7457
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7458
	win = _WindowVal(aWindowId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7459
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7460
	szhints.flags = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7461
	if (__bothSmallInteger(xPos, yPos)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7462
	    szhints.x = __intVal(xPos);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7463
	    szhints.y = __intVal(yPos);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7464
	    szhints.flags |= USPosition;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7465
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7466
	if (__bothSmallInteger(w, h)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7467
	    szhints.width = __intVal(w);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7468
	    szhints.height = __intVal(h);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7469
	    szhints.flags |= USSize;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7470
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7471
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7472
	if (aBoolean == true) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7473
	    char *windowName;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7474
	    Pixmap iconBitmap = (Pixmap)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7475
	    Window iconWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7476
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7477
	    if (__isExternalAddress(wiconId))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7478
		iconBitmap = _PixmapVal(wiconId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7479
	    else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7480
		iconBitmap = (Pixmap)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7481
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7482
	    if (__isExternalAddress(wiconViewId))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7483
		iconWindow = _WindowVal(wiconViewId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7484
	    else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7485
		iconWindow = (Window)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7486
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7487
	    if (__isString(wlabel) || __isSymbol(wlabel))
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7488
		windowName = (char *)_stringVal(wlabel);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7489
	    else
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7490
		windowName = "";
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7491
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7492
	    if (iconBitmap || windowName) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7493
		XSetStandardProperties(dpy, win,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7494
					windowName, windowName,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7495
					iconBitmap,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7496
					0, 0, &szhints);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7497
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7498
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7499
	    wmhints.flags = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7500
	    if (iconBitmap) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7501
		wmhints.flags |= IconPixmapHint;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7502
		wmhints.icon_pixmap = iconBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7503
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7504
	    if (iconWindow) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7505
		wmhints.flags |= IconWindowHint;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7506
		wmhints.icon_window = iconWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7507
	    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7508
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7509
	    wmhints.initial_state = IconicState;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7510
	    wmhints.flags |= StateHint;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7511
	    XSetWMHints(dpy, win, &wmhints);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7512
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7513
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7514
	if (szhints.flags) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7515
	    XSetNormalHints(dpy, win, &szhints);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7516
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7517
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7518
	XMapWindow(dpy, win);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7519
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7520
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7521
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7522
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7523
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7524
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7525
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7526
mapWindow:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7527
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7528
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7529
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7530
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7531
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7532
	XMapWindow(myDpy, _WindowVal(aWindowId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7533
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7534
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7535
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7536
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7537
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7538
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7539
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7540
moveResizeWindow:aWindowId x:x y:y width:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7541
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7542
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7543
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7544
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7545
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7546
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7547
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7548
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7549
     && __bothSmallInteger(x, y)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7550
	newWidth = __intVal(w);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7551
	newHeight = __intVal(h);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7552
	if (newWidth < 1) newWidth = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7553
	if (newHeight < 1) newHeight = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7554
	XMoveResizeWindow(myDpy, _WindowVal(aWindowId),
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7555
			      __intVal(x), __intVal(y),
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7556
			      newWidth, newHeight);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7557
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7558
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7559
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7560
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7561
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7562
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7563
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7564
moveWindow:aWindowId x:x y:y
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7565
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7566
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7567
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7568
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7569
    if (__isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7570
	XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7571
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7572
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7573
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7574
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7575
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7576
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7577
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7578
raiseWindow:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7579
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7580
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7581
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7582
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7583
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7584
	XRaiseWindow(myDpy, _WindowVal(aWindowId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7585
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7586
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7587
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7588
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7589
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7590
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7591
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7592
resizeWindow:aWindowId width:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7593
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7594
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7595
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7596
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7597
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7598
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7599
    if (__isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7600
	newWidth = __intVal(w);
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7601
	newHeight = __intVal(h);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7602
	if (newWidth < 1) newWidth = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7603
	if (newHeight < 1) newHeight = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7604
	XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7605
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7606
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7607
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7608
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7609
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7610
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7611
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7612
setBackingStore:how in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7613
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7614
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7615
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7616
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7617
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7618
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7619
    if (__isExternalAddress(aWindowId)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7620
	if (__INST(ignoreBackingStore) != true) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7621
	    if (how == @symbol(always)) wa.backing_store = Always;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7622
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7623
	    else if (how == true) wa.backing_store = Always;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7624
	    else wa.backing_store = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7625
	    BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7626
	    XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7627
	    END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7628
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7629
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7630
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7631
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7632
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7633
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7634
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7635
setBitGravity:how in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7636
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7637
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7638
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7639
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7640
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7641
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7642
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7643
	if (how == @symbol(NorthWest)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7644
	    wa.bit_gravity = NorthWestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7645
	} else if (how == @symbol(NorthEast)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7646
	    wa.bit_gravity = NorthEastGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7647
	} else if (how == @symbol(SouthWest)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7648
	    wa.bit_gravity = SouthWestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7649
	} else if (how == @symbol(SouthEast)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7650
	    wa.bit_gravity = SouthEastGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7651
	} else if (how == @symbol(Center)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7652
	    wa.bit_gravity = CenterGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7653
	} else if (how == @symbol(North)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7654
	    wa.bit_gravity = NorthGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7655
	} else if (how == @symbol(South)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7656
	    wa.bit_gravity = SouthGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7657
	} else if (how == @symbol(West)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7658
	    wa.bit_gravity = WestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7659
	} else if (how == @symbol(East)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7660
	    wa.bit_gravity = EastGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7661
	} else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7662
	    wa.bit_gravity = NorthWestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7663
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7664
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7665
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7666
	XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7667
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7668
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7669
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7670
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7671
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7672
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7673
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7674
setCursor:aCursorId in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7675
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7676
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7677
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7678
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7679
    Display *dpy = myDpy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7680
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7681
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7682
     && __isExternalAddress(aCursorId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7683
	XDefineCursor(dpy, _WindowVal(aWindowId), _CursorVal(aCursorId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7684
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7685
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7686
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7687
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7688
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7689
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7690
setIconName:aString in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7691
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7692
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7693
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7694
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7695
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7696
     && (__isString(aString) || __isSymbol(aString))) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7697
	XSetIconName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7698
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7699
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7700
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7701
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7702
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7703
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7704
setSaveUnder:yesOrNo in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7705
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7706
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7707
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7708
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7709
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7710
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7711
    if (__isExternalAddress(aWindowId)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7712
	if (__INST(hasSaveUnder) == true) {
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7713
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7714
	    XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7715
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7716
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7717
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7718
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7719
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7720
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7721
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7722
setTransient:aWindowId for:aMainWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7723
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7724
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7725
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7726
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7727
    if (__isExternalAddress(aWindowId)) {
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7728
	Window w;
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7729
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7730
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7731
	    w = (Window) 0;
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7732
	} else {
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  7733
	    if (__isExternalAddress(aMainWindowId)) {
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7734
		w = _WindowVal(aMainWindowId);
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7735
	    } else {
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7736
		goto getOutOfHere;
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7737
	    }
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7738
	}
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7739
	XSetTransientForHint(myDpy, _WindowVal(aWindowId), w);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7740
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7741
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  7742
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7743
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7744
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7745
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7746
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7747
setWindowBackground:aColorIndex in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7748
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7749
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7750
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7751
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7752
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7753
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7754
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7755
     && __isSmallInteger(aColorIndex)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7756
	XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7757
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7758
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7759
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7760
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7761
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7762
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7763
setWindowBackgroundPixmap:aPixmapId in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7764
    "set the windows background pattern to be a form.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7765
     This is the pattern with which the view is filled whenever exposed. 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7766
     Do not confuse this with the background drawing color, which is used 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7767
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7768
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7769
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7770
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7771
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7772
     && __isExternalAddress(aPixmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7773
	XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7774
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7775
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7776
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7777
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7778
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7779
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7780
setWindowBorderColor:aColorIndex in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7781
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7782
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7783
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7784
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7785
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7786
     && __isSmallInteger(aColorIndex)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7787
	XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7788
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7789
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7790
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7791
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7792
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7793
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7794
setWindowBorderPixmap:aPixmapId in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7795
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7796
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7797
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7798
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7799
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7800
     && __isExternalAddress(aPixmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7801
	XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7802
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7803
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7804
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7805
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7806
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7807
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7808
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7809
setWindowBorderShape:aPixmapId in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7810
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7811
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7812
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7813
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7814
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7815
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7816
#ifdef SHAPE
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7817
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7818
     && __isExternalAddress(aPixmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7819
	XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7820
			  0, 0, _PixmapVal(aPixmapId), ShapeSet);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7821
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7822
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7823
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7824
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7825
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7826
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7827
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7828
setWindowBorderWidth:aNumber in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7829
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7830
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7831
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7832
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7833
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7834
     && __isSmallInteger(aNumber)) {
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  7835
	XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7836
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7837
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7838
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7839
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7840
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7841
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7842
setWindowGravity:how in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7843
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7844
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7845
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7846
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7847
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7848
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7849
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7850
	if (how == @symbol(NorthWest)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7851
	    wa.win_gravity = NorthWestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7852
	} else if (how == @symbol(NorthEast)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7853
	    wa.win_gravity = NorthEastGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7854
	} else if (how == @symbol(SouthWest)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7855
	    wa.win_gravity = SouthWestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7856
	} else if (how == @symbol(SouthEast)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7857
	    wa.win_gravity = SouthEastGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7858
	} else if (how == @symbol(Center)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7859
	    wa.win_gravity = CenterGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7860
	} else if (how == @symbol(North)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7861
	    wa.win_gravity = NorthGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7862
	} else if (how == @symbol(South)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7863
	    wa.win_gravity = SouthGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7864
	} else if (how == @symbol(West)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7865
	    wa.win_gravity = WestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7866
	} else if (how == @symbol(East)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7867
	    wa.win_gravity = EastGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7868
	} else {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7869
	    wa.win_gravity = NorthWestGravity;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7870
	}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7871
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7872
	BEGIN_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7873
	XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7874
	END_INTERRUPTSBLOCKED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7875
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7876
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7877
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7878
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7879
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7880
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7881
setWindowIcon:aForm in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7882
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7883
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7884
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7885
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7886
    aForm notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7887
	iconId := aForm id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7888
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7889
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7890
    if (__isExternalAddress(iconId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7891
     && __isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7892
	XWMHints hints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7893
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7894
	hints.icon_pixmap = _PixmapVal(iconId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7895
	hints.flags = IconPixmapHint;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7896
	XSetWMHints(myDpy, _WindowVal(aWindowId), &hints);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7897
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7898
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7899
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7900
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7901
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7902
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7903
setWindowIconWindow:aView in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7904
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7905
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7906
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7907
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7908
    aView notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7909
	iconWindowId := aView id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7910
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7911
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7912
    if (__isExternalAddress(iconWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7913
     && __isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7914
	XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7915
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7916
	wmhints.icon_window = _WindowVal(iconWindowId);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7917
	wmhints.flags = IconWindowHint;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7918
	XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7919
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7920
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7921
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7922
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7923
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7924
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7925
setWindowName:aString in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7926
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7927
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7928
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7929
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7930
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7931
     && (__isString(aString) || __isSymbol(aString))) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7932
	XStoreName(myDpy, _WindowVal(aWindowId), (char *)_stringVal(aString));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7933
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7934
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7935
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7936
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7937
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7938
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7939
setWindowShape:aPixmapId in:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7940
    "set the windows shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7941
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7942
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7943
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7944
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7945
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7946
#ifdef SHAPE
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7947
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7948
     && __isExternalAddress(aPixmapId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7949
	XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7950
			  0, 0,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7951
			  _PixmapVal(aPixmapId), ShapeSet);
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7952
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7953
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7954
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7955
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7956
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7957
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7958
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7959
unmapWindow:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7960
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7961
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7962
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7963
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7964
    if (__isExternalAddress(aWindowId)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7965
	XUnmapWindow(myDpy, _WindowVal(aWindowId));
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7966
	RETURN ( self );
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7967
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7968
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7969
.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7970
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7971
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7972
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7973
!XWorkstation class methodsFor:'documentation'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7974
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7975
version
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7976
    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.137 1996-06-10 17:33:14 cg Exp $'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7977
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7978
XWorkstation initialize!