XWorkstation.st
author Stefan Vogel <sv@exept.de>
Tue, 30 May 2000 19:06:04 +0200
changeset 3205 8648fa72c0af
parent 3203 2df4b477c891
child 3206 61414144918b
permissions -rw-r--r--
Fix error handling (#displayTimoutError)
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
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
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
    13
'From Smalltalk/X, Version:4.1.1 on 25-Mai-2000 at 19:05:54'                    !
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
    14
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    15
"{ Package: 'stx:libview' }"
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
    16
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    17
DeviceWorkstation subclass:#XWorkstation
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    18
	instanceVariableNames:'screen hasShapeExtension hasShmExtension hasDPSExtension
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    19
		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    20
		hasImageExtension hasInputExtension ignoreBackingStore blackpixel
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    21
		whitepixel protocolsAtom deleteWindowAtom saveYourselfAtom
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    22
		quitAppAtom primaryAtom secondaryAtom cutBuffer0Atom stringAtom
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
    23
		lengthAtom wmStateAtom listOfXFonts buttonsPressed eventRootX
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
    24
		eventRootY displayName eventTrace dispatchingExpose rgbVisual
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
    25
		virtualRootId rootId eventBuffer altModifierMask metaModifierMask
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
    26
		multiClickTime deviceIOTimeoutErrorSignal activateOnClick'
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
    27
	classVariableNames:'RawKeysymTranslation ConservativeSync'
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    28
	poolDictionaries:''
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
    29
	category:'Interface-Graphics'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
    30
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    31
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
    32
!XWorkstation primitiveDefinitions!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    33
%{
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    34
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    35
#ifdef LINUX
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    36
# define SHM
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    37
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
    38
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    39
#define COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    40
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    41
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    42
static int __cnt_color = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    43
static int __cnt_bitmap = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    44
static int __cnt_view = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    45
static int __cnt_gc = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    46
static int __cnt_cursor = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    47
static int __cnt_font = 0;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    48
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    49
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
    50
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    51
/*
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    52
 * x does a typedef Time - I need Object Time ...
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
    53
 */
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    54
#undef Time
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    55
#define Time XTime
48194c26a46c Initial revision
claus
parents:
diff changeset
    56
391
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    57
/*
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    58
 * x does a #define True / False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    59
 * 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
    60
 */
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    61
#undef True
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    62
#undef False
d3cad7c15ae2 well well well - do a sync in eventPending
Claus Gittinger <cg@exept.de>
parents: 386
diff changeset
    63
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    64
#ifdef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    65
# undef memset
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    66
#endif
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
    67
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
    68
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    69
#include <stdio.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    70
#include <X11/Xlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    71
#include <X11/Xutil.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    72
#include <X11/Xatom.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    73
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    74
#define XK_MISCELLANY
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    75
#include <X11/keysymdef.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
    76
277
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    77
#include <X11/cursorfont.h>
eb67c44da084 testing new inline-expression feature of stc - no real change
Claus Gittinger <cg@exept.de>
parents: 268
diff changeset
    78
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    79
#ifdef LINUX
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    80
# include <sys/socket.h>
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    81
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
    82
2422
6bffcb4c8360 changes for egcs (__new in stdio)
Claus Gittinger <cg@exept.de>
parents: 2386
diff changeset
    83
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
    84
/*
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    85
 * this define suppresses XAllocColor/XFreeColor on
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    86
 * TrueColor systems - I am not certain, if this is
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    87
 * always legal to do (it works with XFree servers).
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    88
 */
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    89
#define QUICK_TRUE_COLORS
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    90
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
    91
/*
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    92
 * shape support works; enabled by -DSHAPE in makefile
48194c26a46c Initial revision
claus
parents:
diff changeset
    93
 * see RoundClock and RoundGlobe examples
48194c26a46c Initial revision
claus
parents:
diff changeset
    94
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
    95
#ifdef SHAPE
48194c26a46c Initial revision
claus
parents:
diff changeset
    96
# include <X11/extensions/shape.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
    97
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
    98
48194c26a46c Initial revision
claus
parents:
diff changeset
    99
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   100
 * shared memory extension access is currently not supported
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   101
 * (only query is implemented)
48194c26a46c Initial revision
claus
parents:
diff changeset
   102
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   103
#ifdef SHM
48194c26a46c Initial revision
claus
parents:
diff changeset
   104
# include <X11/extensions/XShm.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   105
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   106
48194c26a46c Initial revision
claus
parents:
diff changeset
   107
/*
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   108
 * multiBuffer extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   109
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   110
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   111
#ifdef MBUF
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   112
# include <X11/extensions/multibuf.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   113
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   114
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   115
/*
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   116
 * XVideo extension access is currently not supported
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   117
 * (only query is implemented)
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   118
 */
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   119
#ifdef XVIDEO
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   120
# include <X11/extensions/Xv.h>
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   121
#endif
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   122
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   123
/*
186
claus
parents: 180
diff changeset
   124
 * PEX extension - if available
claus
parents: 180
diff changeset
   125
 */
claus
parents: 180
diff changeset
   126
#ifdef PEX5
claus
parents: 180
diff changeset
   127
# include <PEX5/PEX.h>
claus
parents: 180
diff changeset
   128
#endif
claus
parents: 180
diff changeset
   129
claus
parents: 180
diff changeset
   130
/*
claus
parents: 180
diff changeset
   131
 * XImage extension - if available
claus
parents: 180
diff changeset
   132
 */
claus
parents: 180
diff changeset
   133
#ifdef XIE
claus
parents: 180
diff changeset
   134
# include <X11/extensions/XIE.h>
claus
parents: 180
diff changeset
   135
#endif
claus
parents: 180
diff changeset
   136
claus
parents: 180
diff changeset
   137
/*
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   138
 * when I have more time to check it out, I will support display-PS
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   139
 */
48194c26a46c Initial revision
claus
parents:
diff changeset
   140
#ifdef DPS
48194c26a46c Initial revision
claus
parents:
diff changeset
   141
# ifdef sgi
48194c26a46c Initial revision
claus
parents:
diff changeset
   142
#  include <X11/extensions/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   143
#  include <X11/extensions/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   144
#  include <X11/extensions/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   145
# else
48194c26a46c Initial revision
claus
parents:
diff changeset
   146
#  include <DPS/XDPS.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   147
#  include <DPS/XDPSlib.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   148
#  include <DPS/dpsXclient.h>
48194c26a46c Initial revision
claus
parents:
diff changeset
   149
# endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   150
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
   151
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   152
#if defined(someMachine)
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   153
/*
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   154
 * if nformats cannot be found in the Display structure ...
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   155
 */
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   156
# define NO_PRIVATE_DISPLAY_ACCESS
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   157
#endif
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   158
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
   159
#if defined(IRIX5) || defined(__VMS) || (XlibSpecificationRelease == 6)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   160
  /*
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   161
   * accessing private data in Display ... sorry
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   162
   */
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   163
# define DISPLAYACCESS(d) ((_XPrivDisplay)d)
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   164
#else
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   165
# define DISPLAYACCESS(d) d
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   166
#endif
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   167
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   168
/*
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   169
 * some defines - tired of typing ...
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   170
 */
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   171
#define _DisplayVal(o)       (Display *)(__externalAddressVal(o))
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   172
#define _WindowVal(o)        (Window)(__externalAddressVal(o))
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   173
#define _PixmapVal(o)        (Pixmap)(__externalAddressVal(o))
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   174
#define _GCVal(o)            (GC)(__externalAddressVal(o))
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   175
#define _CursorVal(o)        (Cursor)(__externalAddressVal(o))
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   176
#define _FontVal(o)          (XFontStruct *)(__externalAddressVal(o))
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   177
#define _DPSContextVal(o)    (DPSContext)(__externalAddressVal(o))
207
9124817bbb03 use new c-pointer wrapper macros (based on externalAddress)
Claus Gittinger <cg@exept.de>
parents: 206
diff changeset
   178
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   179
#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
   180
#define _AtomVal(o)          __intVal(o)
211
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   181
#define __isAtomID(o)        __isSmallInteger(o)
b5f925b56e8e Fix example.
Stefan Vogel <sv@exept.de>
parents: 208
diff changeset
   182
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   183
#define myDpy                _DisplayVal(__INST(displayId))
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   184
#define ISCONNECTED          (__INST(displayId) != nil)
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   185
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   186
#ifdef __VMS__
1899
de1eb2a3318e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1898
diff changeset
   187
# include "vms_Xnames.h"
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   188
#endif
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
   189
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   190
void __XTimeoutErrorHandler();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   191
int __XErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   192
int __XIOErrorHandler__();
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   193
3018
e4721b7db256 Enable Xlib tiemout stuff for all systems.
Stefan Vogel <sv@exept.de>
parents: 3016
diff changeset
   194
#if 1 /* LINUX */
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   195
# define DEFAULT_XLIB_TIMEOUT   600     /* in 50ms ticks (30 seconds) */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   196
  static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT;
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   197
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   198
# define ENTER_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   199
    { \
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   200
        __blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   201
        __blockingPrimitiveTimeoutArg__ = (INT)self; \
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   202
        __blockingPrimitiveTimeout__ = __xlibTimeout__; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   203
    } {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
   204
# define LEAVE_XLIB()   \
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   205
    { \
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
   206
        __blockingPrimitiveTimeout__ = 0; \
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   207
    } }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   208
#else
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   209
# define ENTER_XLIB() {  /* as nothing */
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   210
# define LEAVE_XLIB() }  /* as nothing */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   211
#endif
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   212
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   213
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   214
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   215
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   216
!XWorkstation primitiveVariables!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   217
%{
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   218
/*
146
claus
parents: 145
diff changeset
   219
 * remembered info from private error handler
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   220
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   221
static char lastErrorMsg[128] = "";
1888
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   222
static unsigned INT lastRequestCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   223
static unsigned INT lastMinorCode = 0;
05f4db77cc91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   224
static unsigned INT lastResource = 0;
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   225
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   226
static int __debug__ = 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   227
#define DPRINTF(x)      if (__debug__) { printf x; }
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   228
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   229
! !
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   230
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   231
!XWorkstation primitiveFunctions!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   232
%{
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   233
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   234
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   235
 * some systems need a dummy reference to force the linker
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   236
 * to include that stuff. Should be #ifdef'd ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   237
 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   238
#ifndef ELF
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   239
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   240
# ifdef __GNUC__
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   241
VOLATILE 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   242
# endif
1081
f7d19178fb2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1080
diff changeset
   243
static
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   244
dummyToForceLoading() {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   245
        XCreateSimpleWindow(0, 0, 0, 0, 0, 0, 0, 0, 0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   246
        XCloseDisplay(0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   247
        XCreateImage(0, 0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   248
        XSetWindowColormap(0, 0, 0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   249
        XQueryColors(0,0,0,0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   250
# ifdef SHM
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   251
        XShmAttach(0, 0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   252
        XShmCreateImage(0, 0, 0, 0, 0, 0, 0 ,0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   253
        XShmDetach(0, 0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   254
        XShmPutImage(0, 0, 0, 0 , 0,0,0,0,0,0,0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   255
        shmctl(0,0,0);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   256
        fgetc(0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   257
# endif
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   258
}
1062
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   259
#endif
2a5d50022c96 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
   260
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   261
/*
144
claus
parents: 143
diff changeset
   262
 * catch X-errors and forward as errorInterrupt:#DisplayError,
claus
parents: 143
diff changeset
   263
 * (which itself invokes my handler and optionally raises an exceptionSignal)
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   264
 * the implementation below is somewhat wrong: it will
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   265
 * report all errors for Display, even though there could be
162
claus
parents: 160
diff changeset
   266
 * more than one display connection. (being fixed, new errorInterrupt mechanism
claus
parents: 160
diff changeset
   267
 * allows passing an additional argument, which is the displayID ...)
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   268
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   269
int
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
   270
__XErrorHandler__(dpy, event)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   271
    Display *dpy;
48194c26a46c Initial revision
claus
parents:
diff changeset
   272
    XErrorEvent *event;
48194c26a46c Initial revision
claus
parents:
diff changeset
   273
{
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   274
    XGetErrorText(dpy, event->error_code, lastErrorMsg, 127);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   275
    lastErrorMsg[127] = '\0';
1060
bc581886fe8f dont interrupt immediately; use superclasses colorName processing as fallBack
Claus Gittinger <cg@exept.de>
parents: 1056
diff changeset
   276
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   277
    if (lastErrorMsg[0] == '\0') {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   278
        sprintf(lastErrorMsg, "code: %d", event->error_code);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   279
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   280
    lastRequestCode = event->request_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   281
    lastMinorCode = event->minor_code;
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   282
    lastResource = event->resourceid;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   283
    if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   284
        /* 
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   285
         * this is a BadWindow error for X_DestroyWindow.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   286
         * ignore it here, since it results from the GC freeing windows
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   287
         * in non bottom-up window order.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   288
         */
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   289
        return 0;
911
c934a49174e8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
   290
    }
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   291
254
d6f12ecd7767 ErrorPrinting variable now correctly detected by stc
Claus Gittinger <cg@exept.de>
parents: 250
diff changeset
   292
    if (@global(ErrorPrinting) == true) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   293
        fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   294
                        event->request_code, event->request_code, 
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   295
                        event->minor_code, event->minor_code, event->resourceid);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   296
        fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", 
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   297
                        event->error_code, lastErrorMsg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   298
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   299
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   300
    __errorInterruptWithIDAndParameter__(@symbol(DisplayError), __MKEXTERNALADDRESS(dpy));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   301
    return 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
   302
}
48194c26a46c Initial revision
claus
parents:
diff changeset
   303
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   304
/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   305
 * much like the above, but for IO Errors;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   306
 * forwarded as errorInterrupt:#DisplayIOError,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   307
 * In single display apps, handling those here does not
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   308
 * really make sense (except, for a controlled cleanup).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   309
 * However, in multiDisplay apps, a single broken
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   310
 * connection should not affect the other users.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   311
 */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   312
int
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   313
__XIOErrorHandler__(dpy)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   314
    Display *dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   315
{
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   316
    if (@global(ErrorPrinting) == true) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   317
        fprintf(stderr, "XWorkstation [error]: I/O error\n");
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   318
    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   319
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOError),
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   320
                                                  __MKEXTERNALADDRESS(dpy));
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   321
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   322
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   323
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   324
     */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   325
    __internalError("unhandled display I/O error");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   326
    __terminateProcess(0);      /* soft terminate */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   327
    __terminateProcess(1);      /* hard terminate */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   328
    /* never reached */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   329
    return 0;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   330
}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   331
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   332
/*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   333
 * timeout error in case of Xlib request timeout.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   334
 * forwarded as errorInterrupt:#DisplayIOTimeoutError,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   335
 * This is generated synthetically by the VM if the
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   336
 * timeoutHandler has been set.
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   337
 */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   338
void
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   339
__XTimeoutErrorHandler(displayDeviceInst)
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   340
    OBJ displayDeviceInst;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   341
{
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   342
    if (@global(ErrorPrinting) == true) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   343
        fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   344
    }
2057
ff2964f2bd9d increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents: 2021
diff changeset
   345
    if (displayDeviceInst == @global(MainDisplay)) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   346
        fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n");
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   347
        return;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   348
    }
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   349
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   350
#if 0
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   351
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   352
This is litter: 
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   353
    1. How should I ever close the display without a displayId?
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   354
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   355
    2. This may loop for ever, if there is some data in the socket, but #eventPending returns
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   356
       false because displayId is nil.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   357
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   358
    3. The problem is not the EventListener, which is reading (and waiting in #eventPending),
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   359
       but maybe other processes writing to the Display and blocking the system again (for 30 Seconds).
2057
ff2964f2bd9d increased Xtimeout to 30 secs; do NEVER shutdown the master (MainDisplay)
Claus Gittinger <cg@exept.de>
parents: 2021
diff changeset
   360
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   361
    /*
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   362
     * must immediately flush that displays deviceID - otherwise,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   363
     * the scheduler may try to ask for pending events without a watchdog
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   364
     * timer ...
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   365
     */
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   366
    __OINST(displayDeviceInst, displayId) = nil;
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   367
#endif
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   368
    __immediateErrorInterruptWithIDAndParameter__(@symbol(DisplayIOTimeoutError), displayDeviceInst);
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   369
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   370
    /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   371
     * if we return from the error interrupt ...
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   372
     */
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   373
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   374
    __internalError("unhandled display Timeout error");
1990
201f8ecfdad3 device timeout handling
Claus Gittinger <cg@exept.de>
parents: 1979
diff changeset
   375
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   376
    __terminateProcess(0);      /* soft terminate */
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   377
    __terminateProcess(1);      /* hard terminate */
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   378
}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   379
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   380
#ifdef VIRTUAL_ROOT
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   381
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   382
 * added since RootWindow-macro is not sufficient
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   383
 * when virtual root-windows are involved (i.e. tvtwm)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   384
 */
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   385
static Window
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   386
getRootWindow(dpy, screen)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   387
    Display *dpy;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   388
{
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   389
    Window root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   390
    Atom vRootAtom = None;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   391
    int i;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   392
    Window rootReturn, parentReturn;
1050
b2c03e24d56c another memoryLeak, due to an ommited XFree
Claus Gittinger <cg@exept.de>
parents: 1049
diff changeset
   393
    Window* children = (Window *)0;
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   394
    unsigned int numChildren;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   395
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   396
    root = RootWindow(dpy, screen);
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   397
    /*
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   398
     * on IRIS, this creates a badwindow error - why ?
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   399
     * children contains a funny window (000034)
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   400
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   401
# if !defined(IRIS) || defined(IRIX5)
1887
98bb2fb45fda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1883
diff changeset
   402
    if (root) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   403
        if (XQueryTree(dpy, root, &rootReturn, &parentReturn, &children, &numChildren)) {
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   404
            vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   405
            if (vRootAtom != None) {
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   406
                for (i=0; i < numChildren; i++) {
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   407
                    Atom actual_type;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   408
                    int actual_format;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   409
                    unsigned long nitems, bytesafter;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   410
                    Window* newRoot = (Window*) 0;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   411
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   412
                    if (children[i]) {
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   413
                        if (XGetWindowProperty(dpy, children[i], vRootAtom,
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   414
                                               0L, 1L, False, XA_WINDOW,
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   415
                                               &actual_type, &actual_format, &nitems, &bytesafter,
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   416
                                               (unsigned char**) &newRoot) == Success && newRoot) {
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   417
                            root = *newRoot;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   418
                            XFree(newRoot); /* XXX */
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   419
                            break;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   420
                        }
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   421
                    }
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   422
                }
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   423
            }
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   424
            if (children) XFree( children );
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
   425
        }
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   426
    }
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   427
# endif
18
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   428
    return root;
9ffa3bf0ee58 *** empty log message ***
claus
parents: 12
diff changeset
   429
}
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   430
#endif
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   431
%}
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   432
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   433
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   434
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   435
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   436
copyright
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   437
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   438
COPYRIGHT (c) 1989 by Claus Gittinger
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   439
	      All Rights Reserved
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   440
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   441
 This software is furnished under a license and may be used
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   442
 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
   443
 inclusion of the above copyright notice.   This software may not
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   444
 be provided or otherwise made available to, or used by, any
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   445
 other person.  No title to or ownership of the software is
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   446
 hereby transferred.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   447
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   448
!
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
documentation
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   451
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   452
    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
   453
    from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   454
    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
   455
    simultanously. However, the default setup is for one display only.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   456
    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
   457
    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
   458
    different protocol. However, 'normal' applications do not have to care for
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   459
    all of this ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   460
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   461
    See more documentation in my superclass, DeviceWorkstation.
613
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   462
c12586985dcd documentation
Claus Gittinger <cg@exept.de>
parents: 568
diff changeset
   463
    [author:]
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   464
	Claus Gittinger
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   465
"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   466
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   467
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   468
!XWorkstation class methodsFor:'initialization'!
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   469
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   470
initialize
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   471
    |d|
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   472
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   473
    super initialize.
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   474
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   475
    ConservativeSync := OperatingSystem platformName == #win32.
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   476
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   477
    RawKeysymTranslation isNil ifTrue:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   478
	"/ the following table maps X-keyevents to ST/X
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   479
	"/ device independed events. 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   480
	"/ It is NOT meant as a keyboardMap replacement.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   481
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   482
	RawKeysymTranslation := d := Dictionary new.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   483
	d at:'Delete_line' put:#DeleteLine.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   484
	d at:'Delete_word' put:#DeleteWord.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   485
	d at:'Down' put:#CursorDown.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   486
	d at:'Up' put:#CursorUp.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   487
	d at:'Left' put:#CursorLeft.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
   488
	d at:'Right' put:#CursorRight.
386
f9a80cac659e only init once
Claus Gittinger <cg@exept.de>
parents: 382
diff changeset
   489
    ]
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   490
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
   491
    "Modified: / 27.4.1999 / 17:21:30 / cg"
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   492
! !
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
   493
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   494
!XWorkstation class methodsFor:'error handling'!
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   495
129
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   496
debug:aBoolean
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   497
%{  /* NOCONTEXT */
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   498
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   499
    __debug__ = (aBoolean == true) ? 1 : 0;
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   500
%}
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   501
!
752fbb07635a *** empty log message ***
claus
parents: 125
diff changeset
   502
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   503
debugResources
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   504
%{
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   505
#ifdef COUNT_RESOURCES
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   506
    printf("colors:%d bitmaps:%d views:%d gc:%d cursors:%d fonts:%d\n",
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   507
	    __cnt_color, __cnt_bitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   508
	    __cnt_view, __cnt_gc, __cnt_cursor, __cnt_font);
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   509
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   510
%}
1404
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   511
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   512
    "
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   513
     XWorkstation debugResources
680d840cbd3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1392
diff changeset
   514
    "
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   515
!
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
   516
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   517
errorStringOfLastError
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   518
%{
1065
fdc5b9059d82 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1062
diff changeset
   519
    RETURN ( __MKSTRING(lastErrorMsg) );
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   520
%}
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   521
!
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   522
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   523
getConnectionTimeOut
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   524
%{
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   525
    RETURN (__MKSMALLINT(__xlibTimeout__ / 50));
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   526
%}
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   527
!
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
   528
135
claus
parents: 133
diff changeset
   529
lastErrorString
2
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   530
    "return the last X-error string - 
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   531
     when buffering is on, this may be
b35336ab0de3 *** empty log message ***
claus
parents: 0
diff changeset
   532
     an error for a long-ago operation"
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   533
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   534
    |string requestCode s match line|
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   535
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   536
    string := self errorStringOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   537
    requestCode := self requestCodeOfLastError.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   538
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   539
     X specific: search the requestCode in '/usr/lib/X11/XErrorDB',
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   540
     and append the name of the corresponding X-request
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   541
    "
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   542
    s := '/usr/lib/X11/XErrorDB' asFilename readStream.
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   543
    s notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   544
	match := 'XRequest.' , requestCode printString.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   545
	line := s peekForLineStartingWith:match.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   546
	line notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   547
	    string := string , ' in ' , (line copyFrom:(line indexOf:$:)+1)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   548
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   549
	s close.
78
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   550
    ].
1c9c22df3251 *** empty log message ***
claus
parents: 73
diff changeset
   551
    ^ string
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   552
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   553
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   554
minorCodeOfLastError
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   555
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   556
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   557
    RETURN ( __MKSMALLINT(lastMinorCode) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   558
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   559
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   560
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   561
requestCodeOfLastError
152
claus
parents: 150
diff changeset
   562
%{  /* NOCONTEXT */
claus
parents: 150
diff changeset
   563
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   564
    RETURN ( __MKSMALLINT(lastRequestCode) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   565
%}
135
claus
parents: 133
diff changeset
   566
!
claus
parents: 133
diff changeset
   567
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   568
resourceIdOfLastError
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   569
%{  /* NOCONTEXT */
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   570
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   571
    RETURN ( __MKEXTERNALADDRESS(lastResource) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   572
%}
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   573
!
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   574
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   575
setConnectionTimeOut:seconds
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   576
%{
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   577
    __xlibTimeout__ = __intVal(seconds) * 50;
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
   578
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   579
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
   580
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
   581
!XWorkstation class methodsFor:'queries'!
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   582
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   583
platformName
133
claus
parents: 132
diff changeset
   584
    "ST-80 compatibility.
2777
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   585
     Return a string describing the display systems platform.
60ba83db1fab comment
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   586
     WinWorkstation always returns 'X11'."
133
claus
parents: 132
diff changeset
   587
715
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   588
    ^ 'X11'  "I don't know what ST-80 returns for X ..."
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   589
0c715cbd2bde checkin from browser
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   590
    "Modified: 26.5.1996 / 15:32:46 / cg"
104
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   591
! !
aa39cabdc13b *** empty log message ***
claus
parents: 98
diff changeset
   592
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   593
!XWorkstation methodsFor:'Signal constants'!
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   594
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   595
deviceIOTimeoutErrorSignal
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   596
    "return the per-device signal, which is raised when a timeout
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   597
     IO error (i.e. broken connection) occurs."
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   598
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   599
    ^ deviceIOTimeoutErrorSignal
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   600
! !
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
   601
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   602
!XWorkstation methodsFor:'accessing & queries'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   603
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   604
activateOnClick:aBoolean
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   605
    "set/clear the activateOnClick behavior.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   606
     If on, a click into a window raises and activates
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   607
     the (top) window.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   608
     Windows users typically enable this;
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   609
     in contrast, those used to the X-Window system typically prefer
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   610
     it disabled.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   611
     Returns the previous setting."
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   612
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   613
    |prev|
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   614
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   615
    prev := activateOnClick.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   616
    activateOnClick := aBoolean.
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   617
    ^ prev
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   618
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   619
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   620
     Display class activateOnClick:true
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   621
     Display class activateOnClick:false
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   622
    "
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   623
!
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
   624
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   625
anyButtonMotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   626
    "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
   627
     This is the devices mask."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   628
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   629
%{  /* NOCONTEXT */
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   630
    RETURN (__MKSMALLINT(Button1MotionMask | Button2MotionMask | Button3MotionMask));
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   631
%}.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   632
    ^ nil
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   633
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   634
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   635
blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   636
    "return the colornumber of black"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   637
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   638
    ^ blackpixel
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   639
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   640
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   641
button1MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   642
    "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
   643
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   644
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   645
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   646
    RETURN (__MKSMALLINT(Button1MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   647
%}
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   648
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   649
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   650
     Display button1MotionMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   651
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   652
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   653
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   654
button2MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   655
    "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
   656
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   657
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   658
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   659
    RETURN (__MKSMALLINT(Button2MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   660
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   661
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   662
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   663
button3MotionMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   664
    "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
   665
     For backward compatibility."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   666
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   667
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   668
    RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   669
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   670
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   671
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   672
buttonMotionMask:aButton
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   673
    "return the state-mask for button1 in motion events state-field.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   674
     This is the devices mask."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   675
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   676
%{  /* NOCONTEXT */
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   677
    if (aButton == __MKSMALLINT(1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   678
	RETURN (__MKSMALLINT(Button1MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   679
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   680
    if (aButton == __MKSMALLINT(2)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   681
	RETURN (__MKSMALLINT(Button2MotionMask));
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   682
    }
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
   683
    if (aButton == __MKSMALLINT(3)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   684
	RETURN (__MKSMALLINT(Button3MotionMask));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   685
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   686
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   687
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   688
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   689
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   690
controlMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   691
    "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
   692
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   693
%{  /* NOCONTEXT */
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   694
    RETURN (__MKSMALLINT(ControlMask));
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   695
%}
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   696
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   697
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   698
displayFileDescriptor
48194c26a46c Initial revision
claus
parents:
diff changeset
   699
    "return the displays fileNumber - for select"
48194c26a46c Initial revision
claus
parents:
diff changeset
   700
48194c26a46c Initial revision
claus
parents:
diff changeset
   701
%{  /* NOCONTEXT */
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   702
#ifndef WIN32
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   703
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   704
	RETURN ( __MKSMALLINT(ConnectionNumber(myDpy)) );
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   705
    }
2231
817b5fad2fb7 md changes for WIN32
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   706
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   707
    RETURN (nil);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   708
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
   709
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   710
133
claus
parents: 132
diff changeset
   711
displayName
claus
parents: 132
diff changeset
   712
    "return the X-connections display name.
claus
parents: 132
diff changeset
   713
     This is (currently) nil for the default display, 
claus
parents: 132
diff changeset
   714
     something like foo:0 for any other remote display.
claus
parents: 132
diff changeset
   715
     Future versions may return non-nil strings for the default display as well."
claus
parents: 132
diff changeset
   716
claus
parents: 132
diff changeset
   717
    ^ displayName
claus
parents: 132
diff changeset
   718
!
claus
parents: 132
diff changeset
   719
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   720
protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   721
    "return the X-servers protocol version - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   722
     any interest"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   723
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   724
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   725
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   726
	RETURN ( __MKSMALLINT(XProtocolVersion(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   727
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   728
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   729
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   730
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   731
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   732
     Display protocolVersion
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   733
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   734
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   735
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   736
serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   737
    "return the X-server vendor string - this should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   738
     any interest, but can be for special cases
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   739
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   740
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   741
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   742
	RETURN ( __MKSTRING(XServerVendor(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   743
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   744
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   745
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   746
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   747
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   748
     Display serverVendor
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   749
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   750
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   751
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   752
shiftMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
   753
    "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
   754
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   755
%{  /* NOCONTEXT */
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   756
    RETURN (__MKSMALLINT(ShiftMask));
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   757
%}
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   758
!
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
   759
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   760
translatePoint:aPoint from:windowId1 to:windowId2
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   761
    "given a point in window1, return the coordinate in window2.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   762
     This expects a device coordinate (relative to the first views origin)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   763
     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
   764
     - use to xlate points from a window to rootwindow"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   765
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   766
    |x1 y1 x2 y2|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   767
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   768
    x1 := x2 := aPoint x truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   769
    y1 := y2 := aPoint y truncated.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   770
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   771
    int xpos, ypos;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   772
    Window w1, w2, child_return;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   773
    int screen = __intVal(__INST(screen));
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   774
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   775
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   776
     && __isExternalAddress(windowId1)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   777
     && __isExternalAddress(windowId2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   778
     && __bothSmallInteger(x1, y1)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   779
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   780
	Window rootWin;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   781
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   782
	w1 = _WindowVal(windowId1);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   783
	w2 = _WindowVal(windowId2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   784
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   785
#ifdef VIRTUAL_ROOT
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   786
	rootWin = RootWindow(dpy, screen);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   787
	if ((w1 == rootWin) || (w2 == rootWin)) {
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   788
	    if (w1 == rootWin) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   789
		w1 = getRootWindow(dpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   790
	    }
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   791
	    if (w2 == rootWin) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   792
		w2 = getRootWindow(dpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   793
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   794
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   795
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   796
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   797
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   798
	XTranslateCoordinates(dpy, w1, w2,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   799
			      __intVal(x1), __intVal(y1), 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   800
			      &xpos, &ypos, &child_return);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   801
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   802
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   803
	x2 = __MKSMALLINT(xpos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   804
	y2 = __MKSMALLINT(ypos);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   805
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   806
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   807
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   808
    ^ (x2 @ y2)
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   809
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   810
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   811
vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   812
    "return the X-servers vendor release - should normally not be of
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   813
     any interest, but can be for special cases.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   814
     (to avoid bugs in certain implementations)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   815
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   816
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   817
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   818
	RETURN ( __MKSMALLINT(XVendorRelease(myDpy)) );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   819
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   820
    RETURN (nil);
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   821
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   822
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   823
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   824
     Display vendorRelease
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   825
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   826
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   827
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   828
viewIdFromPoint:aPoint in:windowId
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   829
    "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
   830
     hit by this coordinate. Return nil if no view was hit.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   831
     The returned id may be the id of a non ST view.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   832
     - 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
   833
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   834
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   835
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   836
    int screen = __intVal(__INST(screen));
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   837
    OBJ xp, yp;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   838
    int xpos, ypos;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   839
    Window child_return;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   840
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   841
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   842
     && __isExternalAddress(windowId)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   843
     && __isPoint(aPoint)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   844
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   845
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   846
	xp = _point_X(aPoint);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   847
	yp = _point_Y(aPoint);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   848
	if (__bothSmallInteger(xp, yp)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   849
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   850
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   851
	    XTranslateCoordinates(dpy,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   852
				  RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   853
				  _WindowVal(windowId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   854
				  __intVal(xp), __intVal(yp), 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   855
				  &xpos, &ypos, &child_return);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   856
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
   857
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   858
	    if (child_return) {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
   859
		RETURN ( __MKEXTERNALADDRESS(child_return) );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   860
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   861
	    RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   862
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   863
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   864
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   865
    windowId notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   866
	aPoint isPoint ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   867
	    ^ self viewIdFromPoint:aPoint asPoint truncated in:windowId
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   868
	]
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   869
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   870
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   871
    ^ nil
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   872
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   873
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   874
virtualExtent
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   875
    "return the virtual extent of the display (in pixels).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   876
     On most systems, this is the same as the physical width;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   877
     except, if a window manager with a virtual desktop like olvwm
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   878
     (simulating a bigger screen) is running."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   879
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   880
%{
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   881
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
   882
     && (__INST(rootId) != __INST(virtualRootId)) 
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
   883
     && __isExternalAddress(__INST(virtualRootId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   884
	Window vRootWin;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   885
	Window root;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   886
	int x, y;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   887
	unsigned int width, height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   888
	unsigned int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   889
	int ret;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   890
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   891
	vRootWin = _WindowVal(__INST(virtualRootId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   892
	ENTER_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   893
	ret = XGetGeometry(myDpy, vRootWin, &root, &x, &y, &width, &height,
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   894
					  &dummy, &dummy);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   895
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   896
	if (ret) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   897
	    RETURN ( __MKPOINT_INT(width, height) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   898
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   899
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   900
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   901
    ^ width @ height
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   902
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   903
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   904
whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   905
    "return the colornumber of white"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   906
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   907
    ^ whitepixel
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   908
! !
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   909
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   910
!XWorkstation methodsFor:'accessing display capabilities'!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
   911
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   912
hasDPS
186
claus
parents: 180
diff changeset
   913
    "return true, if this workstation supports display postscript.
claus
parents: 180
diff changeset
   914
     Both the server must support it, and the feature must have been
claus
parents: 180
diff changeset
   915
     enabled in the smalltalk system, for true to be returned."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   916
48194c26a46c Initial revision
claus
parents:
diff changeset
   917
    ^ hasDPSExtension
186
claus
parents: 180
diff changeset
   918
claus
parents: 180
diff changeset
   919
    "
claus
parents: 180
diff changeset
   920
     Display hasDPS 
claus
parents: 180
diff changeset
   921
    "
claus
parents: 180
diff changeset
   922
!
claus
parents: 180
diff changeset
   923
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   924
hasExtension:extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   925
    "query for an X extension. The argument, extensionString
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   926
     should be the name of the extension (i.e. 'SHAPE', 'XInputExtension' etc).
186
claus
parents: 180
diff changeset
   927
     Return true, if that extension is available in the server.
claus
parents: 180
diff changeset
   928
     (which does not imply, that there is support in smalltalk for it."
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   929
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   930
%{
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   931
    int dummy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   932
    OBJ rslt = false;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   933
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   934
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   935
     && __isNonNilObject(extensionString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
   936
     && (__qIsString(extensionString) || __qIsSymbol(extensionString))) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   937
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
   938
	if (XQueryExtension(myDpy, __stringVal(extensionString), &dummy, &dummy, &dummy)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   939
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   940
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   941
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   942
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   943
    RETURN (rslt);
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
   944
%}
186
claus
parents: 180
diff changeset
   945
claus
parents: 180
diff changeset
   946
    "
claus
parents: 180
diff changeset
   947
     Display hasExtension:'XVideo' 
claus
parents: 180
diff changeset
   948
     Display hasExtension:'Input' 
claus
parents: 180
diff changeset
   949
     Display hasExtension:'GLX' 
claus
parents: 180
diff changeset
   950
     Display hasExtension:'X3D-PEX' 
claus
parents: 180
diff changeset
   951
     Display hasExtension:'XInputExtension' 
claus
parents: 180
diff changeset
   952
     Display hasExtension:'SHAPE' 
claus
parents: 180
diff changeset
   953
     Display hasExtension:'MIT-SHM' 
claus
parents: 180
diff changeset
   954
     Display hasExtension:'SGIFullScreenStereo' 
claus
parents: 180
diff changeset
   955
    "
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   956
!
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
   957
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   958
hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   959
    "return true, if this workstation supports the X image extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   960
     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
   961
     enabled in the smalltalk system, for true to be returned."
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
    ^ hasImageExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   964
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   965
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   966
     Display hasImageExtension 
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   969
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   970
hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   971
    "return true, if this workstation supports the X input extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   972
     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
   973
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   974
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   975
    ^ hasInputExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   976
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   977
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   978
     Display hasInputExtension 
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   981
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   982
hasMultibuffer
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   983
    "return true, if this workstation supports the multibuffer extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   984
     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
   985
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   986
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   987
    ^ hasMbufExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   988
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   989
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   990
     Display hasMultibuffer 
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
hasPEX
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   995
    "return true, if this workstation supports PEX 3D graphics.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
   996
     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
   997
     enabled in the smalltalk system, for true to be returned."
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
    ^ hasPEXExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1000
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1001
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1002
     Display hasPEX 
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
!
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
hasShm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1007
    "return true, if this workstation supports the shared pixmap extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1008
     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
  1009
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1010
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1011
    ^ hasShmExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1012
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1013
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1014
     Display hasShm 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1015
    "
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
hasXVideo
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1019
    "return true, if this workstation supports the XVideo extension.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1020
     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
  1021
     enabled in the smalltalk system, for true to be returned."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1022
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1023
    ^ hasXVideoExtension
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1024
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1025
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1026
     Display hasXVideo 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1027
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1028
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1029
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1030
iconSizes
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  1031
    "Get the preferred/supported icon sizes. These are set by the window manager.
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1032
     We return nil (if not set) or an OrderedCollection of iconSize specs."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1033
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1034
    |xIconSizes count ret|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1035
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1036
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1037
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1038
    XIconSize *sizeList;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1039
    int cnt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1040
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1041
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1042
	Display *dpy = myDpy;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1043
	int status;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1044
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1045
	ENTER_XLIB();
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  1046
	status = XGetIconSizes(dpy, RootWindow(dpy, screen), &sizeList, &cnt);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1047
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1048
	if (status > 0) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1049
	   xIconSizes = __MKEXTERNALBYTES(sizeList);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1050
	   count = __MKSMALLINT(cnt);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1051
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1052
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1053
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1054
    xIconSizes isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1055
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1056
    ret := OrderedCollection new:count.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1057
    1 to:count do:[ :i |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1058
	|minWidth minHeight maxWidth maxHeight widthStep heightStep d|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1059
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1060
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1061
	XIconSize *slp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1062
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1063
	slp = &((XIconSize *)__externalAddressVal(xIconSizes))[__intVal(i)-1];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1064
	minWidth = __MKSMALLINT(slp->min_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1065
	minHeight = __MKSMALLINT(slp->min_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1066
	maxWidth = __MKSMALLINT(slp->max_width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1067
	maxHeight = __MKSMALLINT(slp->max_height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1068
	widthStep = __MKSMALLINT(slp->width_inc);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1069
	heightStep = __MKSMALLINT(slp->height_inc);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1070
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1071
	d := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1072
	d at:#minWidth put:minWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1073
	d at:#maxWidth put:maxWidth.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1074
	d at:#widthStep put:widthStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1075
	d at:#minHeight put:minHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1076
	d at:#maxHeight put:maxHeight.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1077
	d at:#heightStep put:heightStep.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1078
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1079
	ret add:d
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1080
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1081
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1082
    xIconSizes free.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1083
    ^ ret
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1084
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1085
    "
819
88aaa6ff1ca3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 818
diff changeset
  1086
     Display iconSizes
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1087
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1088
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1089
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1090
ignoreBackingStore:aBoolean
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1091
    "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
  1092
     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
  1093
     very slow or is broken (can be put into display-rc-file)"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1094
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  1095
    ignoreBackingStore := aBoolean
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1096
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1097
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1098
preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1099
    "return the displays preferred size for icons.
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1100
     Redefined to return a special value on SGI servers."
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1101
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1102
    self serverVendor = 'Silicon Graphics' ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1103
	^ 86@68
823
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1104
    ].
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1105
    ^ super preferredIconSize
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1106
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1107
    "Created: 10.6.1996 / 21:06:48 / cg"
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1108
!
1a0933c804ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 819
diff changeset
  1109
1025
40dde7d8f538 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1018
diff changeset
  1110
scrollsAsynchronous
1008
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1111
    "return true, if this display asynchronously sends expose events after a
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1112
     scroll operation. False otherwise. Asynchronous expose events are an X
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1113
     speciality, which affects a few methods outside of the display class (sorry)"
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1114
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1115
    ^ true
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1116
!
ca0a38a11bdc support (prepared) for devices which do not send asynchronous exposes
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1117
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1118
supportedImageFormats
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1119
    "return an array with supported image formats; 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1120
     each array entry is an attribute dictionary, consisting of 
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1121
     depth, bitsPerPixel and padding values."
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1122
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1123
    |nFormats "{ Class: SmallInteger }"
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1124
     formatArray|
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1125
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1126
    Display *dpy;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1127
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1128
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1129
	RETURN (nil);
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1130
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1131
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1132
    dpy = myDpy;
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1133
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1134
    nFormats = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1135
#else
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  1136
    nFormats = __MKSMALLINT(DISPLAYACCESS(dpy)->nformats);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1137
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1138
%}.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1139
    formatArray := Array new:nFormats.
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1140
    1 to:nFormats do:[:index |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1141
	|info bitsPerPixelInfo depthInfo paddingInfo i|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1142
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1143
	i := index.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1144
%{
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1145
	ScreenFormat *format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1146
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1147
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1148
#ifdef NO_PRIVATE_DISPLAY_ACCESS
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1149
	depthInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1150
	bitsPerPixelInfo = __MKSMALLINT(1);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1151
	paddingInfo = __MKSMALLINT(8);
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1152
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1153
	format = DISPLAYACCESS(dpy)->pixmap_format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1154
	format += (__intVal(i)-1);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1155
	bitsPerPixelInfo = __MKSMALLINT(format->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1156
	depthInfo = __MKSMALLINT(format->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1157
	paddingInfo = __MKSMALLINT(format->scanline_pad);
1891
0dc56210cbfb VMS stuff
Claus Gittinger <cg@exept.de>
parents: 1888
diff changeset
  1158
#endif
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1159
%}.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1160
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1161
	info at:#depth put:depthInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1162
	info at:#bitsPerPixel put:bitsPerPixelInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1163
	info at:#padding put:paddingInfo.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1164
	formatArray at:index put:info.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1165
    ].
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1166
    ^ formatArray
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1167
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1168
    "
235
579f3f804a46 padding info in supportedFormats
Claus Gittinger <cg@exept.de>
parents: 233
diff changeset
  1169
     Display supportedImageFormats 
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1170
    "
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1171
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1172
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1173
supportsAnyViewBackgroundPixmaps
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1174
    "return true, if the device allows pixmaps as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1175
     viewBackground."
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1176
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1177
    ^ true
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1178
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1179
    "Created: / 4.5.1999 / 18:41:07 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1180
!
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1181
2745
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1182
supportsArbitraryShapedViews
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1183
    "return true, if this workstation supports arbitrary shaped windows.
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1184
     Both the server must support it (the shape-extension), 
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1185
     and the feature must have been enabled in the smalltalk system, 
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1186
     for true to be returned."
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1187
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1188
    ^ hasShapeExtension
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1189
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1190
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1191
     Display supportsArbitraryShapedViews   
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1192
    "
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1193
!
55edb7d63d29 #hasShape -> #supportsArbitraryShapedViews
Claus Gittinger <cg@exept.de>
parents: 2713
diff changeset
  1194
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1195
supportsIconViews
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1196
    "return true, if this device supports views as icons.
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1197
     Only Xservers (currently) support this."
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1198
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1199
    ^ true
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1200
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1201
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1202
     Display supportsIconViews 
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1203
    "
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1204
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1205
    "Modified: 10.6.1996 / 20:11:48 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1206
    "Created: 10.6.1996 / 21:08:18 / cg"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1207
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  1208
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1209
supportsMaskedDrawingWith:aForm
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1210
    "return true, if the device allows the given form pixmap
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1211
     to be used as paint color. 
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1212
     True returned here - X has no trouble with any mask."
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1213
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1214
    ^ true
2632
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1215
e18b55db3e1e replaced supportdMaskedDrawing by a method which gets the
Claus Gittinger <cg@exept.de>
parents: 2594
diff changeset
  1216
    "Created: / 4.5.1999 / 12:16:43 / cg"
2330
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1217
!
2de54ce1d8c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2305
diff changeset
  1218
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1219
supportsViewBackgroundPixmap:aForm
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1220
    "return true, if the device allows the given pixmap as
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1221
     viewBackground. 
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1222
     True returned here - X support any size."
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1223
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1224
    ^ true
2635
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1225
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1226
    "Created: / 4.5.1999 / 18:40:42 / cg"
92ac1edfb047 another view-bg query
Claus Gittinger <cg@exept.de>
parents: 2632
diff changeset
  1227
    "Modified: / 4.5.1999 / 18:44:25 / cg"
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1228
!
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1229
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1230
supportsViewGravity
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1231
    "return true, if this device supports gravity attributes.
82
98a70bce6d51 *** empty log message ***
claus
parents: 81
diff changeset
  1232
     We do not depend on it being implemented, but some resizing operations
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1233
     are faster, it is is."
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1234
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  1235
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1236
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  1237
48194c26a46c Initial revision
claus
parents:
diff changeset
  1238
!XWorkstation methodsFor:'bitmap/window creation'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1239
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1240
createBitmapFromArray:anArray width:w height:h
2896
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1241
    "create a monochrome, depth1 bitmap from a given (byte-)array.
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1242
     The rows are aligned to a multiple of 8"
cad683a945dc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2871
diff changeset
  1243
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1244
    |bitmapId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1245
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1246
    bitmapId := self primCreateBitmapFromArray:anArray width:w height:h.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1247
    bitmapId isNil ifTrue:[
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  1248
	self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1249
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1250
    ^ bitmapId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1251
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1252
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1253
createBitmapFromFile:aString for:aForm
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1254
    |id w h|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1255
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1256
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1257
    int screen = __intVal(__INST(screen));
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1258
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1259
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1260
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1261
     && (__qIsString(aString) || __qIsSymbol(aString))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1262
	Display *dpy = myDpy;
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1263
	char *filename;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1264
	int status;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1265
	Pixmap newBitmap;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1266
	unsigned b_width, b_height;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1267
	int b_x_hot, b_y_hot;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1268
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1269
	filename = (char *) __stringVal(aString);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1270
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1271
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1272
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1273
	status = XReadBitmapFile(dpy, RootWindow(dpy, screen),
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1274
				 filename, &b_width, &b_height, &newBitmap,
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1275
				 &b_x_hot, &b_y_hot);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1276
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1277
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1278
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1279
	if ((status == BitmapSuccess)  && newBitmap) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1280
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1281
	    __cnt_bitmap++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1282
#endif
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1283
	    w = __MKSMALLINT(b_width);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1284
	    h = __MKSMALLINT(b_height);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  1285
	    id = __MKEXTERNALADDRESS(newBitmap);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1286
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1287
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1288
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1289
    id notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1290
	aForm setWidth:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1291
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1292
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1293
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1294
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1295
createBitmapWidth:w height:h
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1296
    "allocate a bitmap on the Xserver, the contents is undefined
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1297
     (i.e. random). Return a bitmap id or nil"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1298
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1299
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1300
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1301
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1302
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1303
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1304
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1305
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1306
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1307
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1308
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1309
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1310
				       __intVal(w), __intVal(h), 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1311
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1312
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1313
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1314
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1315
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1316
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1317
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1318
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1319
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1320
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1321
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1322
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1323
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1324
createPixmapWidth:w height:h depth:d
48194c26a46c Initial revision
claus
parents:
diff changeset
  1325
    "allocate a pixmap on the Xserver, the contents is undefined
48194c26a46c Initial revision
claus
parents:
diff changeset
  1326
     (i.e. random). Return a bitmap id or nil"
48194c26a46c Initial revision
claus
parents:
diff changeset
  1327
48194c26a46c Initial revision
claus
parents:
diff changeset
  1328
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1329
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1330
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1331
    Pixmap newBitmap;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1332
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1333
    if (__bothSmallInteger(w, h) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1334
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1335
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1336
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1337
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1338
	newBitmap = XCreatePixmap(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1339
				       __intVal(w), __intVal(h), __intVal(d));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1340
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1341
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1342
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1343
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1344
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1345
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1346
	RETURN ( (newBitmap != (Pixmap)0) ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1347
    }
1424
29fb970f157f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1404
diff changeset
  1348
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1349
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1350
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1351
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1352
1468
9832c4017a70 added type argument to createWindowFor - prepare for native window support (windows)
Claus Gittinger <cg@exept.de>
parents: 1462
diff changeset
  1353
createWindowFor:aView type:typeSymbol
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1354
		 origin:origin
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1355
		 extent:extent
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1356
		 minExtent:minExt 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1357
		 maxExtent:maxExt
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1358
		 borderWidth:bWidth
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1359
		 subViewOf:wsuperView
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1360
		 style:wStyle
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1361
		 inputOnly:winputOnly
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1362
		 label:wlabel
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1363
		 owner:wowner
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1364
		 icon:wicon iconMask:wiconMask
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1365
		 iconView:wiconView
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1366
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1367
    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight 
1960
aa9ef6e21f15 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1916
diff changeset
  1368
     bColorId wsuperViewId wiconId wiconMaskId windowId
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1369
     weventMask wiconViewId bitGravity viewGravity vBgColor
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1370
     vBgForm deepForm preferredVisual preferredDepth|
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1371
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1372
    displayId isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1373
	self primitiveFailed.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1374
	^ nil
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1375
    ].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1376
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1377
    origin notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1378
	xpos := origin x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1379
	ypos := origin y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1380
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1381
	xpos := ypos := 0.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1382
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1383
    extent notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1384
	wwidth := extent x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1385
	wheight := extent y.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1386
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1387
	wwidth := wheight := 100.
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1388
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1389
    minExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1390
	minWidth := minExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1391
	minHeight := minExt y
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1392
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1393
    maxExt notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1394
	maxWidth := maxExt x.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1395
	maxHeight := maxExt y
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1396
    ].
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1397
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1398
    wsuperView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1399
	wsuperViewId := wsuperView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1400
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1401
48194c26a46c Initial revision
claus
parents:
diff changeset
  1402
    wicon notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1403
	wiconId := wicon id.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1404
	wiconMask notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1405
	    wiconMaskId := wiconMask id
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1406
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1407
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1408
    wiconView notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1409
	wiconViewId := wiconView id
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1410
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
  1411
    weventMask := aView eventMask.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1412
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1413
    preferredVisual := aView preferredVisual.
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1414
    preferredDepth := aView preferredDepth.
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1415
1898
e1b272aa6e82 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1416
%{  /* STACK:64000 */ /* used to be 16000 - but VMS seems to need a lot */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1417
    Display *dpy = myDpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1418
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1419
    Visual visual;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1420
    XGCValues xgcv;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1421
    XSetWindowAttributes xswa;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1422
    XSizeHints sizehints;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1423
    XWMHints wmhints;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1424
    int bw, bd, bg;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1425
    Window newWindow, parentWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1426
    char *windowName;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1427
    XFontStruct *f;
1537
16265a27165d icon masks
Claus Gittinger <cg@exept.de>
parents: 1535
diff changeset
  1428
    Pixmap backPixmap = (Pixmap)0, 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1429
	   iconBitmap = (Pixmap)0,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1430
	   iconMask = (Pixmap)0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1431
    int flags = 0, depth, ioClass;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1432
    Window iconWindow;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1433
    Atom WmDeleteWindowAtom, WmSaveYourselfAtom, WmProtocolsAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1434
    Atom WmQuitAppAtom;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1435
    Atom atoms[3];
48194c26a46c Initial revision
claus
parents:
diff changeset
  1436
    int atomCount = 0, isTopWindow = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1437
48194c26a46c Initial revision
claus
parents:
diff changeset
  1438
    sizehints.flags = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1439
    sizehints.width = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1440
    sizehints.height = 100;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1441
    sizehints.x = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1442
    sizehints.y = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1443
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1444
    if (__bothSmallInteger(wwidth, wheight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1445
	sizehints.flags |= PSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1446
	sizehints.width = __intVal(wwidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1447
	sizehints.height = __intVal(wheight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1448
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1449
    if (__bothSmallInteger(xpos, ypos)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1450
	sizehints.flags |= PPosition;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1451
	sizehints.x = __intVal(xpos);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1452
	sizehints.y = __intVal(ypos);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1453
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1454
    if (__bothSmallInteger(minWidth, minHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1455
	sizehints.flags |= PMinSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1456
	sizehints.min_width = __intVal(minWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1457
	sizehints.min_height = __intVal(minHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1458
    }
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1459
    if (__bothSmallInteger(maxWidth, maxHeight)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1460
	sizehints.flags |= PMaxSize;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1461
	sizehints.max_width = __intVal(maxWidth);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1462
	sizehints.max_height = __intVal(maxHeight);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1463
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1464
37
c2dc1832c0f1 *** empty log message ***
claus
parents: 36
diff changeset
  1465
    bg = WhitePixel(dpy, screen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1466
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1467
    if (__isSmallInteger(bWidth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1468
	bw = __intVal(bWidth);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  1469
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1470
	bw = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1471
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1472
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  1473
    bd = BlackPixel(dpy, screen);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1474
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1475
    if (__isExternalAddress(wsuperViewId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1476
	parentWindow = _WindowVal(wsuperViewId);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1477
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1478
	parentWindow = RootWindow(dpy, screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1479
	isTopWindow = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1480
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1481
1695
46d9101e4bee replaced isPopUp flag in #createWindow by a more general #style symbol argument
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
  1482
    if (wStyle == @symbol(popUp))
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1483
	xswa.override_redirect = 1;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1484
    else 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1485
	xswa.override_redirect = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1486
48194c26a46c Initial revision
claus
parents:
diff changeset
  1487
    if (winputOnly == true) 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1488
	ioClass = InputOnly;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1489
    else 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1490
	ioClass = InputOutput;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1491
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  1492
    if (__isSmallInteger(weventMask)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1493
	xswa.event_mask = __intVal(weventMask);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1494
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1495
	xswa.event_mask = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1496
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1497
48194c26a46c Initial revision
claus
parents:
diff changeset
  1498
    if (ioClass == InputOnly) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1499
	bw = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1500
	depth = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1501
	flags |= CWEventMask;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1502
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1503
	depth = DefaultDepth(dpy,screen);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1504
	flags |= CWEventMask | CWBorderPixel | CWOverrideRedirect;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1505
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1506
	if (backPixmap != (Pixmap)0) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1507
	    xswa.background_pixmap = backPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1508
	    flags |= CWBackPixmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1509
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1510
	    xswa.background_pixel = bg;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1511
	    flags |= CWBackPixel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1512
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1513
	xswa.border_pixel = bd;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1514
    }
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1515
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1516
    visual.visualid = CopyFromParent;
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1517
    if (__isSmallInteger(preferredDepth)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1518
	depth = __intVal(preferredDepth);
23
4a7e02de7b72 *** empty log message ***
claus
parents: 21
diff changeset
  1519
    }
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1520
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1521
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1522
    if (preferredVisual != nil) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1523
	XVisualInfo vi;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1524
	int cls;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1525
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1526
	if (preferredVisual == @symbol(StaticGray))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1527
	    cls = StaticGray;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1528
	else if (preferredVisual == @symbol(GrayScale)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1529
	    cls = GrayScale;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1530
	else if (preferredVisual == @symbol(StaticColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1531
	    cls = StaticColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1532
	else if (preferredVisual == @symbol(PseudoColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1533
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1534
	else if (preferredVisual == @symbol(TrueColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1535
	    cls = TrueColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1536
	else if (preferredVisual == @symbol(DirectColor)) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1537
	    cls = DirectColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1538
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1539
	    cls = PseudoColor;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1540
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1541
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1542
	if (XMatchVisualInfo(dpy, screen, depth, cls, &vi)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1543
	    visual.visualid = vi.visualid;
163
claus
parents: 162
diff changeset
  1544
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1545
	    printf("visualId=%x\n", vi.visualid);
163
claus
parents: 162
diff changeset
  1546
*/
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1547
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1548
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1549
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1550
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1551
    ENTER_XLIB();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1552
    newWindow = XCreateWindow(dpy, parentWindow,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1553
			   sizehints.x, sizehints.y,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1554
			   sizehints.width, sizehints.height,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1555
			   bw, depth, ioClass, &visual,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1556
			   flags, &xswa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  1557
    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1558
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1559
48194c26a46c Initial revision
claus
parents:
diff changeset
  1560
    if (! newWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1561
	RETURN ( nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1562
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1563
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1564
#ifdef COUNT_RESOURCES
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1565
    __cnt_view++;
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1566
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1567
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1568
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1569
48194c26a46c Initial revision
claus
parents:
diff changeset
  1570
    /*
48194c26a46c Initial revision
claus
parents:
diff changeset
  1571
     * define its icon and name
48194c26a46c Initial revision
claus
parents:
diff changeset
  1572
     * (only makes sense for topWindows)
48194c26a46c Initial revision
claus
parents:
diff changeset
  1573
     */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1574
    if (isTopWindow) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1575
	if (__isExternalAddress(wiconId))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1576
	    iconBitmap = _PixmapVal(wiconId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1577
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1578
	    iconBitmap = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1580
	if (__isExternalAddress(wiconMaskId))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1581
	    iconMask = _PixmapVal(wiconMaskId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1582
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1583
	    iconMask = (Pixmap)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1584
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1585
	if (__isExternalAddress(wiconViewId))
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1586
	    iconWindow = _WindowVal(wiconViewId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1587
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1588
	    iconWindow = (Window)0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1589
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1590
	if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1591
	    windowName = (char *) __stringVal(wlabel);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1592
	else
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1593
	    windowName = "";
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1594
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1595
	if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1596
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1597
	    XSetStandardProperties(dpy, newWindow,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1598
					windowName, windowName,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1599
					iconBitmap,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1600
					0, 0, &sizehints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1601
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1602
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1603
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1604
	wmhints.flags = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1605
	if (iconBitmap) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1606
	    wmhints.flags |= IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1607
	    wmhints.icon_pixmap = iconBitmap;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1608
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1609
	if (iconMask) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1610
	    wmhints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1611
	    wmhints.icon_mask = iconMask;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1612
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1613
	if (iconWindow) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1614
	    wmhints.flags |= IconWindowHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1615
	    wmhints.icon_window = iconWindow;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1616
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1617
/*
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1618
	wmhints.flags |= InputHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1619
	wmhints.input = True;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1620
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1621
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1622
	XSetWMHints(dpy, newWindow, &wmhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1623
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1624
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1625
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1626
	 * tell window manager to not kill us but send an event instead
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1627
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1628
	/*
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1629
	 * get atoms first (if not already known)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1630
	 */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1631
	if (__INST(protocolsAtom) == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1632
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1633
	    WmProtocolsAtom = XInternAtom(dpy, "WM_PROTOCOLS", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1634
	    __INST(protocolsAtom) = __MKATOMOBJ(WmProtocolsAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1635
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1636
	    WmSaveYourselfAtom = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1637
	    __INST(saveYourselfAtom) = __MKATOMOBJ(WmSaveYourselfAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1638
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1639
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1640
	    WmQuitAppAtom = XInternAtom(dpy, "_WM_QUIT_APP", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1641
	    __INST(quitAppAtom) = __MKATOMOBJ(WmQuitAppAtom);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1642
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1643
	    WmDeleteWindowAtom = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1644
	    __INST(deleteWindowAtom) = __MKATOMOBJ(WmDeleteWindowAtom);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1645
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1646
	} else {
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1647
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1648
	    WmQuitAppAtom = _AtomVal(__INST(quitAppAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1649
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1650
	    WmQuitAppAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1651
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1652
	    WmProtocolsAtom = _AtomVal(__INST(protocolsAtom));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1653
	    WmDeleteWindowAtom = _AtomVal(__INST(deleteWindowAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1654
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1655
	    WmSaveYourselfAtom = _AtomVal(__INST(saveYourselfAtom));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1656
#else
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1657
	    WmSaveYourselfAtom = 0;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1658
#endif
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1659
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1660
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1661
	atoms[0] = WmDeleteWindowAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1662
#ifdef USE_SAVEYOURSELF_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1663
	atoms[atomCount] = WmSaveYourselfAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1664
#endif
48194c26a46c Initial revision
claus
parents:
diff changeset
  1665
#ifdef USE_QUIT_APP_ATOM
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1666
	atoms[atomCount] = WmQuitAppAtom; atomCount++;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1667
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1668
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1669
	XChangeProperty(dpy, newWindow, WmProtocolsAtom, XA_ATOM,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1670
			32, PropModeReplace, (unsigned char *)atoms, atomCount);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1671
	LEAVE_XLIB();
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1672
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1673
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1674
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  1675
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1676
    windowId = __MKEXTERNALADDRESS(newWindow);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1677
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1678
    self addKnownView:aView withId:windowId.
48194c26a46c Initial revision
claus
parents:
diff changeset
  1679
    ^ windowId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1680
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1681
48194c26a46c Initial revision
claus
parents:
diff changeset
  1682
destroyGC:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1683
48194c26a46c Initial revision
claus
parents:
diff changeset
  1684
%{  /* NOCONTEXT */
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1685
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1686
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1687
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1688
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1689
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1690
    if (__isExternalAddress(aGCId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1691
	GC gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1692
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1693
	if (gc) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1694
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1695
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1696
	    XFreeGC(myDpy, gc);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1697
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1698
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1699
	    __cnt_gc--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1700
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1701
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1702
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1703
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1704
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  1705
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1706
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  1707
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1708
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1709
destroyPixmap:aDrawableId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1710
48194c26a46c Initial revision
claus
parents:
diff changeset
  1711
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1712
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1713
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1714
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1715
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1716
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1717
    if (__isExternalAddress(aDrawableId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1718
	Pixmap pix = _PixmapVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1719
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1720
	if (pix) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1721
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1722
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1723
	    XFreePixmap(myDpy, pix);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1724
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1725
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1726
	    __cnt_bitmap--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1727
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1728
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1729
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1730
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1731
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  1732
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1733
    self primitiveFailed
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
destroyView:aView withId:aWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1737
%{
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1738
    if (! ISCONNECTED) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1739
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1740
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1741
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  1742
    if (__isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1743
	Window win = _WindowVal(aWindowId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1744
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1745
	if (win) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1746
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1747
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1748
	    XDestroyWindow(myDpy, win);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1749
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1750
#ifdef COUNT_RESOURCES
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1751
	    __cnt_view--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1752
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1753
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  1754
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1755
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1756
%}.
1480
7fd8dff4cfc3 pass view + id to removeKnownView
Claus Gittinger <cg@exept.de>
parents: 1468
diff changeset
  1757
    self removeKnownView:aView withId:aWindowId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1758
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  1759
48194c26a46c Initial revision
claus
parents:
diff changeset
  1760
dpsContextFor:aDrawableId and:aGCId
48194c26a46c Initial revision
claus
parents:
diff changeset
  1761
48194c26a46c Initial revision
claus
parents:
diff changeset
  1762
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  1763
#ifdef XXDPS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1764
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1765
    DPSContext dps;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1766
    int height;
48194c26a46c Initial revision
claus
parents:
diff changeset
  1767
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1768
    if (__isExternalAddress(aDrawableId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1769
     && __isExternalAddress(aGCId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1770
     && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1771
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1772
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1773
	dps = XDPSCreateContext(myDpy, (Drawable)_WindowVal(aDrawableId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1774
				       _GCVal(aGCId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1775
				       0, height, 0, colormap, NULL, 0,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1776
				       XDPSDefaultTextBackstop,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1777
				       XDPSDefaultErrorProc,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1778
				       NULL);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1779
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1780
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1781
	RETURN ( dps ? __MKEXTERNALADDRESS(dps) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1782
    }
48194c26a46c Initial revision
claus
parents:
diff changeset
  1783
#endif
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1784
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1785
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  1786
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1787
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1788
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1789
gcFor:aDrawableId
132
claus
parents: 129
diff changeset
  1790
claus
parents: 129
diff changeset
  1791
%{  /* NOCONTEXT */
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1792
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1793
    GC gc;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1794
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1795
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1796
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1797
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1798
	gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1799
			      0L, (XGCValues *)0);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1800
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1801
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1802
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1803
	if (gc)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1804
	    __cnt_gc++;
1089
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1805
#endif
dd14759d8370 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
  1806
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1807
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1808
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1809
    }
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1810
%}.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1811
    self primitiveFailed.
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1812
    ^ nil
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1813
!
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1814
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1815
gcForBitmap:aDrawableId
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1816
    "with X, this is the same as a normal gc"
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1817
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1818
%{  /* NOCONTEXT */
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1819
    int screen = __intVal(__INST(screen));
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1820
    GC gc;
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1821
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1822
    if (__isExternalAddress(aDrawableId) && ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1823
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1824
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1825
	gc = XCreateGC(myDpy, (Drawable)_WindowVal(aDrawableId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1826
			      0L, (XGCValues *)0);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1827
	LEAVE_XLIB();
1138
4a2b3b407cae need separate createGC method for bitmaps (for WIN)
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1828
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1829
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1830
	if (gc)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1831
	    __cnt_gc++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1832
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1833
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1834
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1835
	RETURN ( gc ? __MKEXTERNALADDRESS(gc) : nil );
200
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1836
    }
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1837
%}.
aa66f76133ab New Method: atomName:
Stefan Vogel <sv@exept.de>
parents: 193
diff changeset
  1838
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1839
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1840
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1841
primCreateBitmapFromArray:anArray width:w height:h
154
claus
parents: 153
diff changeset
  1842
claus
parents: 153
diff changeset
  1843
%{  /* UNLIMITEDSTACK */
claus
parents: 153
diff changeset
  1844
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1845
    Display *dpy;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1846
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1847
    Pixmap newBitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1848
    unsigned int b_width, b_height;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1849
    REGISTER unsigned char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1850
    REGISTER unsigned char *pBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1851
    unsigned char *b_bits, *allocatedBits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1852
    int index, row;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1853
    REGISTER int col;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1854
    unsigned bits;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1855
    static char reverseBitTable[256];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1856
    static firstCall = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1857
    int nBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1858
    unsigned char fastBits[10000];
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1859
    OBJ num, *op;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1860
    int bytesPerRow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1861
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  1862
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1863
	RETURN (nil);
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  1864
    }
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1865
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1866
    dpy = myDpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1867
    if (firstCall) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1868
	for (index=0; index < 256; index++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1869
	    reverseBitTable[index] = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1870
	    if (index & 128) reverseBitTable[index] |=   1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1871
	    if (index &  64) reverseBitTable[index] |=   2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1872
	    if (index &  32) reverseBitTable[index] |=   4;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1873
	    if (index &  16) reverseBitTable[index] |=   8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1874
	    if (index &   8) reverseBitTable[index] |=  16;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1875
	    if (index &   4) reverseBitTable[index] |=  32;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1876
	    if (index &   2) reverseBitTable[index] |=  64;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1877
	    if (index &   1) reverseBitTable[index] |= 128;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1878
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1879
	firstCall = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1880
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1881
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1882
    if (__bothSmallInteger(w, h) && _isNonNilObject(anArray)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1883
	newBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1884
	b_width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1885
	b_height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1886
	bytesPerRow = (b_width + 7) / 8;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1887
	nBytes = b_height * bytesPerRow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1888
	if (nBytes < sizeof(fastBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1889
	    cp = b_bits = fastBits;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1890
	    allocatedBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1891
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1892
	    cp = b_bits = allocatedBits = (unsigned char *) malloc(nBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1893
	    if (! cp) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1894
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1895
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1896
	if (__qClass(anArray) == @global(Array)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1897
	    index = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1898
	    op = &(__ArrayInstPtr(anArray)->a_element[index - 1]);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1899
	    for (row = b_height; row; row--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1900
		for (col = bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1901
		    num = *op++;
2791
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1902
		    if (__isSmallInteger(num)) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1903
			bits = __intVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1904
		    } else {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1905
			bits = __longIntVal(num);
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1906
			if (bits == 0) {
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1907
			    goto fail;
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1908
			}
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1909
		    }
97ae9d3d44e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  1910
		    *cp++ = reverseBitTable[bits & 0xFF];
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1911
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1912
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1913
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1914
	    if (__qClass(anArray) == @global(ByteArray)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1915
		pBits = __ByteArrayInstPtr(anArray)->ba_element;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1916
		for (col = b_height*bytesPerRow; col; col--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1917
		    *cp++ = reverseBitTable[*pBits++];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1918
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1919
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1920
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1921
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1922
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1923
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1924
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1925
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1926
	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1927
					       (char *)b_bits, 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1928
					       b_width, b_height);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  1929
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1930
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1931
	if (newBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1932
	    __cnt_bitmap++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1933
#endif
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  1934
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1935
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1936
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1937
	if (allocatedBits)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1938
	    free(allocatedBits);
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1939
	RETURN ( newBitmap ? __MKEXTERNALADDRESS(newBitmap) : nil );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1940
    }
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1941
%}.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1942
    self primitiveFailed.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1943
    ^ nil
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1946
realRootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1947
    "return the id of the real root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1948
     This may not be the window you see as background,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1949
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1950
     of it. Except for very special cases, use #rootWindowId, which takes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1951
     care of any virtual root."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1952
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  1953
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1954
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1955
    Window root;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1956
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1957
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1958
    if (__INST(rootId) != nil) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1959
	RETURN (__INST(rootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1960
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1961
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  1962
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1963
	root = RootWindow(myDpy, screen);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1964
	if (! root) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1965
	    id = nil;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1966
	} else {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  1967
	    __INST(rootId) = id = __MKEXTERNALADDRESS(root); __STORE(self, id);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1968
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1969
	RETURN (id);
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1970
    }
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  1971
%}.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1972
    self primitiveFailed.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  1973
    ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1974
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1975
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1976
rootWindowId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1977
    "return the id of the root window.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1978
     This is the window you see as background, 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1979
     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
  1980
     since some window managers install a virtual root window on top
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1981
     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
  1982
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  1983
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1984
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1985
    Window rootWin, vRootWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1986
    OBJ id;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1987
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  1988
    if (__INST(virtualRootId) != nil) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1989
	RETURN (__INST(virtualRootId));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1990
    }
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  1991
169
claus
parents: 168
diff changeset
  1992
    if (ISCONNECTED) {
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  1993
	Display *dpy = myDpy;
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  1994
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  1995
	vRootWin = rootWin = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  1996
#ifndef IRIS
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  1997
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1998
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  1999
	 * on IRIS, this creates a badwindow error - why ?
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2000
	 * children contains a funny window (000034)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2001
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2002
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2003
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2004
	 * care for virtual root windows (tvtwm & friends)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2005
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2006
	{
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2007
	    Atom vRootAtom = None;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2008
	    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2009
	    Window rootReturn, parentReturn;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2010
	    Window* children = (Window *)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2011
	    unsigned int numChildren;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2012
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2013
	    if (XQueryTree(dpy, rootWin, 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2014
			   &rootReturn, &parentReturn, 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2015
			   &children, &numChildren)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2016
		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2017
		if (vRootAtom != None) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2018
		    for (i=0; i < numChildren; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2019
			Atom actual_type;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2020
			int actual_format;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2021
			unsigned long nitems, bytesafter;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2022
			Window* newRoot = (Window*) 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2023
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2024
			if (children[i]) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2025
			    if (XGetWindowProperty(dpy, children[i], vRootAtom, 
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2026
						   0L, 1L, False, XA_WINDOW,
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2027
						   &actual_type, &actual_format, 
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2028
						   &nitems, &bytesafter,
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2029
						   (unsigned char**) &newRoot
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  2030
						  ) == Success && newRoot) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2031
				vRootWin = *newRoot;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2032
				XFree(newRoot); /* XXX */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2033
				break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2034
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2035
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2036
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2037
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2038
		if (children) XFree( children );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2039
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2040
	}
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2041
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2042
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2043
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2044
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2045
    /* cannot happen */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2046
    if (! vRootWin) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2047
	vRootWin = rootWin;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2048
	if (! rootWin) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2049
	    RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2050
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2051
    }
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2052
    __INST(rootId) = id = __MKEXTERNALADDRESS(rootWin); __STORE(self, id);
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2053
    __INST(virtualRootId) = id = __MKEXTERNALADDRESS(vRootWin); __STORE(self, id);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2054
    RETURN ( id );
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  2055
%}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2056
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2057
48194c26a46c Initial revision
claus
parents:
diff changeset
  2058
!XWorkstation methodsFor:'color stuff'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2059
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2060
colorCell
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2061
    "allocate a color cell - return the color index (i.e. colorID).
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2062
     This method will return nil for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2063
48194c26a46c Initial revision
claus
parents:
diff changeset
  2064
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2065
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2066
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2067
    XColor color;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2068
    unsigned long dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2069
    Status ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2070
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2071
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2072
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2073
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2074
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2075
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2076
	ok = XAllocColorCells(dpy, DefaultColormap(dpy, screen), (Bool)0,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2077
				   &dummy, 0, &color.pixel, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2078
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2079
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2080
	if (ok) {
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2081
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2082
	    __cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2083
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2084
	    RETURN ( __MKSMALLINT(color.pixel) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2085
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2086
    }
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2087
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2088
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2089
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2090
48194c26a46c Initial revision
claus
parents:
diff changeset
  2091
colorNamed:aString
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2092
    "allocate a color with color name - return the color index (i.e. colorID).
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2093
     Dont use this method, colornames are mostly X specific"
48194c26a46c Initial revision
claus
parents:
diff changeset
  2094
48194c26a46c Initial revision
claus
parents:
diff changeset
  2095
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2096
48194c26a46c Initial revision
claus
parents:
diff changeset
  2097
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2098
    XColor scolor, ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2099
    int screen = __intVal(__INST(screen));
850
Claus Gittinger <cg@exept.de>
parents: 847
diff changeset
  2100
    int id;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  2101
    Status ok;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2102
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2103
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2104
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2105
     && (__qIsString(aString) || __qIsSymbol(aString))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2106
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2107
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2108
	colorname = (char *) __stringVal(aString);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2109
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2110
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2111
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2112
	ok = XParseColor(dpy, DefaultColormap(dpy, screen), colorname, &ecolor);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2113
	LEAVE_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2114
	if (ok) {
847
f7c402bc5983 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 846
diff changeset
  2115
#ifdef QUICK_TRUE_COLORS
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2116
	    if (__INST(visualType) == @symbol(TrueColor)) {
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2117
		id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2118
		id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2119
		id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2120
		RETURN ( __MKSMALLINT(id) );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2121
	    }
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2122
#endif
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2123
	    ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2124
	    ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2125
	    LEAVE_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2126
	}
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2127
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2128
	if (! ok) {
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2129
	    RETURN ( nil );
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2130
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2131
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2132
	__cnt_color++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2133
#endif
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2134
	RETURN ( __MKSMALLINT(ecolor.pixel) );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2135
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2136
%}.
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2137
    self primitiveFailed.
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  2138
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2139
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2140
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2141
colorRed:redVal green:greenVal blue:blueVal
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2142
    "allocate a color with rgb values (0..100) - return the color index (i.e. colorID).
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2143
     This method is obsoleted by #colorScaledRed:scaledGreen:scaledBlue:"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2144
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2145
    |r g b|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2146
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2147
    r := self percentToXColorValue:redVal.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2148
    g := self percentToXColorValue:greenVal.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2149
    b := self percentToXColorValue:blueVal.
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2150
    ^ self colorScaledRed:r scaledGreen:g scaledBlue:b
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2151
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2152
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2153
colorScaledRed:r scaledGreen:g scaledBlue:b
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2154
    "allocate a color with rgb values (0..16rFFFF) - return the color index (i.e. colorID)"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2155
%{
898
677e010d0cf8 exit from image restart, if connection is refused
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2156
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2157
    XColor ecolor;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2158
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2159
    Status ok;
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2160
    int id;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2161
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2162
    if (__bothSmallInteger(r, g) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2163
     && __isSmallInteger(b)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2164
     && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2165
	ecolor.red = __intVal(r);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2166
	ecolor.green= __intVal(g);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2167
	ecolor.blue = __intVal(b);
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2168
#ifdef QUICK_TRUE_COLORS
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2169
	if (__INST(visualType) == @symbol(TrueColor)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2170
	    id = ((ecolor.red >> (16 - __intVal(__INST(bitsRed)))) << __intVal(__INST(redShift))) & __intVal(__INST(redMask));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2171
	    id += ((ecolor.green >> (16 - __intVal(__INST(bitsGreen)))) << __intVal(__INST(greenShift))) & __intVal(__INST(greenMask));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2172
	    id += ((ecolor.blue >> (16 - __intVal(__INST(bitsBlue)))) << __intVal(__INST(blueShift))) & __intVal(__INST(blueMask));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2173
	    RETURN ( __MKSMALLINT(id) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2174
	}
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2175
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2176
	dpy = myDpy;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2177
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2178
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2179
	ok = XAllocColor(dpy, DefaultColormap(dpy, screen), &ecolor);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2180
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2181
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2182
	if (! ok) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2183
	    RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2184
	}
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2185
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2186
	__cnt_color++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2187
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2188
	RETURN ( __MKSMALLINT(ecolor.pixel) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2189
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2190
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2191
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2192
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2193
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2194
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2195
freeColor:colorIndex
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2196
    "free a display color when its no longer needed"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2197
48194c26a46c Initial revision
claus
parents:
diff changeset
  2198
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2199
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  2200
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2201
    unsigned long color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2202
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2203
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2204
#ifdef QUICK_TRUE_COLORS
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2205
    if (__INST(visualType) == @symbol(TrueColor)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2206
	/* no need to do anything on TrueColor displays ... */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2207
	RETURN (self);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2208
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2209
#endif
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2210
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2211
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2212
	RETURN (self);
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2213
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2214
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2215
    if (__isSmallInteger(colorIndex)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2216
	dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2217
	color = (long) __intVal(colorIndex);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2218
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2219
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2220
	XFreeColors(dpy, DefaultColormap(dpy, screen), &color, 1, 0L);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2221
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2222
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2223
	__cnt_color--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2224
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2225
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2226
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2227
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2228
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2229
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2230
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2231
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2232
getRGBFrom:index into:aBlock
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2233
    "get rgb components (0..100) of color in map at:index,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2234
     and evaluate the 3-arg block, aBlock with them"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2235
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2236
    |val|
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2237
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2238
    self getScaledRGBFrom:index into:[:r :g :b |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2239
	val := aBlock 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2240
		value:(r * 100.0 / 16rFFFF)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2241
		value:(g * 100.0 / 16rFFFF)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2242
		value:(b * 100.0 / 16rFFFF)
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2243
    ].
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2244
    ^ val
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2245
!
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2246
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2247
getRGBFromName:colorName into:aBlock
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2248
    "get rgb components (0..100) of color named colorName,
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2249
     and evaluate the 3-arg block, aBlock with them"
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2250
    |val|
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2251
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2252
    self getScaledRGBFromName:colorName into:[:r :g :b |
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2253
	r isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2254
	    ^ nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2255
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2256
	val := aBlock 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2257
	    value:(r * 100.0 / 16rFFFF)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2258
	    value:(g * 100.0 / 16rFFFF)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2259
	    value:(b * 100.0 / 16rFFFF)
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2260
    ].
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2261
    ^ val
1056
b645c4bea8a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  2262
1430
d338dabce832 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1424
diff changeset
  2263
    "Modified: 6.3.1997 / 02:36:43 / cg"
846
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2264
!
49a4732dec95 dont XAlloc/XFree colors on TrueColor systems
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
  2265
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2266
getScaledRGBFrom:index into:aBlock
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2267
    "get rgb components (0 .. 16rFFFF) of color in map at:index,
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2268
     and evaluate the 3-arg block, aBlock with them"
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2269
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2270
    |r g b|
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2271
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2272
    displayId isNil ifTrue:[
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2273
	self primitiveFailed.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2274
	^ nil
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2275
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2276
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2277
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2278
    XColor color;
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2279
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2280
    int bits, scale, shift;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2281
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2282
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2283
     && __isSmallInteger(index)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2284
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2285
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2286
	color.pixel = __intVal(index);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2287
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2288
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2289
	XQueryColor(dpy, DefaultColormap(dpy, screen), &color);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2290
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2291
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2292
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2293
	/* 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2294
	 * have to compensate for an error in X ?, which does not scale
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2295
	 * colors correctly if lesser than 16bits are valid in a color,
2748
e6bfd7044881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2745
diff changeset
  2296
	 * (for example, color white on a 4bitsPerRGB server will Return
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2297
	 * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2298
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2299
	bits = __intVal(__INST(bitsPerRGB));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2300
	scale = (1<<bits) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2301
	shift = 16 - bits;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2302
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2303
	sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2304
	sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2305
	sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2306
	r = __MKSMALLINT(sr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2307
	g = __MKSMALLINT(sg);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2308
	b = __MKSMALLINT(sb);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2309
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2310
%}.
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2311
    ^ aBlock value:r value:g value:b
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2312
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2313
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2314
getScaledRGBFromName:colorName into:aBlock
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2315
    "get rgb components (0..16rFFFF) of color named colorName,
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2316
     and evaluate the 3-arg block, aBlock with them"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2317
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2318
    |r g b|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2319
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2320
    displayId isNil ifTrue:[
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2321
	super getRGBFromName:colorName into:[:rr :gg :bb |
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2322
		r := (rr * 16rFFFF / 100) rounded.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2323
		g := (gg * 16rFFFF / 100) rounded.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2324
		b := (bb * 16rFFFF / 100) rounded.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2325
	].
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  2326
	^ aBlock value:r value:g value:b
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2327
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2328
%{
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2329
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2330
    XColor color;
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2331
    int sr, sg, sb;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2332
    double floor();
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2333
    int bits, scale, shift;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2334
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2335
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2336
     && __isNonNilObject(colorName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2337
     && (__qIsString(colorName) || __qIsSymbol(colorName))) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2338
	Display *dpy = myDpy;
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2339
        
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2340
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2341
	if (XParseColor(dpy, DefaultColormap(dpy, screen), 
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2342
			     (char *) __stringVal(colorName), &color)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2343
	    /* 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2344
	     * have to compensate for an error in X ?, which does not scale
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2345
	     * colors correctly if lesser than 16bits are valid in a color,
2748
e6bfd7044881 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2745
diff changeset
  2346
	     * (for example, color white on a 4bitsPerRGB server will Return
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2347
	     * (16rF000 16rF000 16rF000) instead of (16rFFFF 16rFFFF 16rFFFF)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2348
	     */
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2349
	    bits = __intVal(__INST(bitsPerRGB));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2350
	    scale = (1<<bits) - 1;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2351
	    shift = 16 - bits;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2352
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2353
	    sr = ((double)(color.red>>shift) / scale) * 0xFFFF;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2354
	    sg = ((double)(color.green>>shift) / scale) * 0xFFFF;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2355
	    sb = ((double)(color.blue>>shift) / scale) * 0xFFFF;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2356
	    r = __MKSMALLINT(sr);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2357
	    g = __MKSMALLINT(sg);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2358
	    b = __MKSMALLINT(sb);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2359
	}
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2360
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2361
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2362
%}.
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2363
    ^ aBlock value:r value:g value:b
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2366
listOfAvailableColors
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2367
    "return a list of all available colornames.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2368
     This should not be used, since colornames are very
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2369
     display-specific (here X-specific)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2370
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2371
    |aStream list line index colorName|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2372
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2373
    aStream := FileStream readonlyFileNamed:'/usr/lib/X11/rgb.txt'.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2374
    aStream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2375
    list := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2376
    [aStream atEnd] whileFalse:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2377
	line := aStream nextLine.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2378
	line notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2379
	    "skip the r/g/b numbers"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2380
	    index := 1.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2381
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2382
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2383
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2384
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2385
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2386
	    [(line at:index) isDigit] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2387
	    [(line at:index) isSeparator] whileTrue:[index := index + 1].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2388
	    colorName := line copyFrom:index.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2389
	    ((colorName occurrencesOf:(Character space)) == 0) ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2390
		list add:colorName
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2391
	    ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2392
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2393
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2394
    aStream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2395
    ^ list sort
1047
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2396
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2397
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2398
     Screen current listOfAvailableColors
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2399
    "
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2400
b1ab39266b10 Fix #listOfAvailableColors.
Stefan Vogel <sv@exept.de>
parents: 1046
diff changeset
  2401
    "Modified: 11.9.1996 / 15:26:28 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2402
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2403
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2404
percentToXColorValue:aPercentage
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2405
    "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
  2406
     x-component value (0..65k) as an integer"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2409
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2410
    if (__isSmallInteger(aPercentage)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2411
	RETURN ( __MKSMALLINT(0xFFFF * __intVal(aPercentage) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2412
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2413
    if (__isFloat(aPercentage)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2414
	RETURN ( __MKSMALLINT(0xFFFF * (int)(__floatVal(aPercentage)) / 100) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2415
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2416
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2417
    ^ (16rFFFF * aPercentage / 100) rounded
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2418
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2419
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2420
setColor:index scaledRed:sred scaledGreen:sgreen scaledBlue:sblue
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2421
    "change color in map at:index to rgb (0..16rFFFF).
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2422
     This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2423
48194c26a46c Initial revision
claus
parents:
diff changeset
  2424
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2425
48194c26a46c Initial revision
claus
parents:
diff changeset
  2426
    char *colorname;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2427
    XColor color;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  2428
    int screen = __intVal(__INST(screen));
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2429
    int r, g, b;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2430
    int ok = 1;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2431
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2432
    if (__isSmallInteger(sred))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2433
	r = __intVal(sred);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2434
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2435
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2436
    if (__isSmallInteger(sgreen))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2437
	g = __intVal(sgreen);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2438
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2439
892
602b15686c95 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  2440
    if (__isSmallInteger(sblue))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2441
	b = __intVal(sblue);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2442
    else ok = 0;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2443
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2444
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2445
     && __isSmallInteger(index) && ok) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2446
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2447
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2448
	color.pixel = __intVal(index);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2449
	color.red = r;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2450
	color.green = g;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2451
	color.blue = b;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2452
	color.flags = DoRed | DoGreen | DoBlue;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2453
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2454
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2455
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2456
	XStoreColor(dpy, DefaultColormap(dpy, screen), &color);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2457
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2458
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2459
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2460
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2461
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2462
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2463
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2464
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2465
!XWorkstation methodsFor:'cursor stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2466
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2467
builtInCursorShapes
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2468
    "return a collection of standard cursor names.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2469
     Those are built into the XServer and need not be created as
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2470
     user cursors.
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2471
     (actually, there are more than those below ...)"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2472
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2473
    "/ if you add something here, also add to #shapeNumberFromCursor ...
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2474
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2475
    ^ #(
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2476
	#upLeftArrow            "/ XC_top_left_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2477
	#upRightHand            "/ XC_hand1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2478
	#upDownArrow            "/ XC_sb_v_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2479
	#leftRightArrow         "/ XC_sb_h_double_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2480
	#upLimitArrow           "/ XC_top_side         
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2481
	#downLimitArrow         "/ XC_bottom_side   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2482
	#leftLimitArrow         "/ XC_left_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2483
	#rightLimitArrow        "/ XC_right_side
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2484
	#text                   "/ XC_xterm     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2485
	#upRightArrow           "/ XC_draft_large
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2486
	#leftHand               "/ XC_hand2   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2487
	#questionMark           "/ XC_question_arrow
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2488
	#cross                  "/ XC_X_cursor    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2489
	#wait                   "/ XC_watch   
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2490
	#crossHair              "/ XC_tcross  
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2491
	#origin                 "/ XC_ul_angle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2492
	#topLeft                "/ XC_ul_angle    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2493
	#corner                 "/ XC_lr_angle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2494
	#bottomRight            "/ XC_lr_angle      
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2495
	#topRight               "/ XC_ur_angle    
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2496
	#bottomLeft             "/ XC_ll_angle      
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2497
	#square                 "/ XC_dotbox     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2498
	#fourWay                "/ XC_fleur     
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2499
	#crossCursor            "/ XC_X_cursor 
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2500
      )
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2501
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2502
    "Created: 8.4.1997 / 10:12:30 / cg"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2503
    "Modified: 8.4.1997 / 10:31:46 / cg"
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2504
!
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2505
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2506
colorCursor:aCursorId foreground:fgColor background:bgColor
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2507
    "change a cursors colors"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2508
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2509
    |fgR fgG fgB bgR bgG bgB|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2510
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2511
    fgR := fgColor scaledRed.
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2512
    fgG := fgColor scaledGreen.
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2513
    fgB := fgColor scaledBlue.
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2514
    bgR := bgColor scaledRed.
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2515
    bgG := bgColor scaledGreen.
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2516
    bgB := bgColor scaledBlue.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2517
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2518
    XColor fgcolor, bgcolor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2519
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2520
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2521
     && __isExternalAddress(aCursorId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2522
     && __bothSmallInteger(fgG, fgB)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2523
     && __bothSmallInteger(bgR, bgG) 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2524
     && __bothSmallInteger(bgB, fgR)) {
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2525
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2526
	fgcolor.red = __intVal(fgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2527
	fgcolor.green= __intVal(fgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2528
	fgcolor.blue = __intVal(fgB);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2529
	bgcolor.red = __intVal(bgR);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2530
	bgcolor.green= __intVal(bgG);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2531
	bgcolor.blue = __intVal(bgB);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2532
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2533
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2534
	XRecolorCursor(myDpy, _CursorVal(aCursorId), &fgcolor, &bgcolor);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2535
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2536
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2537
	RETURN ( self );
72
3e84121988c3 *** empty log message ***
claus
parents: 70
diff changeset
  2538
    }
834
f71ba674da2a Color changed to use integer r/g/b components internally (0..16rFFFF)
Claus Gittinger <cg@exept.de>
parents: 830
diff changeset
  2539
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2540
    self primitiveFailed
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2541
!
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  2542
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2543
createCursorShape:aShape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2544
    "create a cursor given a shape-symbol. This only works
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2545
     for a few standard cursors, and returns nil if no such cursor exists.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2546
     Senders must always care for a fallBack, in case of a nil return."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2547
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2548
    |number id|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2549
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2550
    number := self shapeNumberFromSymbol:aShape.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2551
    number isNil ifTrue:[^ nil].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2552
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2553
    Cursor newCursor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2554
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2555
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2556
     && __isSmallInteger(number)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2557
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2558
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2559
	newCursor = XCreateFontCursor(myDpy, __intVal(number));
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2560
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2561
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2562
	if (newCursor)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2563
	    __cnt_cursor++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2564
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2565
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2566
	if (newCursor != (Cursor)0) {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2567
	    id = __MKEXTERNALADDRESS(newCursor);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2568
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2569
    }
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  2570
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2571
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2572
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2573
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2574
createCursorSourceForm:sourceForm maskForm:maskForm hotX:hx hotY:hy width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2575
    "create a cursor given 2 bitmaps (source, mask) and a hotspot"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2576
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2577
    |id sourceId maskId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2578
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2579
    sourceId := sourceForm id.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2580
    maskId := maskForm id.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2581
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2582
    Cursor newCursor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2583
    XColor fgColor, bgColor;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2584
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2585
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2586
     && __isExternalAddress(sourceId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2587
     && __isExternalAddress(maskId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2588
     && __bothSmallInteger(hx, hy)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2589
	fgColor.red = 0;        /* fg is black */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2590
	fgColor.green = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2591
	fgColor.blue = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2592
	bgColor.red = 0xFFFF;   /* bg is white */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2593
	bgColor.green = 0xFFFF;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2594
	bgColor.blue = 0xFFFF;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2595
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2596
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2597
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2598
	newCursor = XCreatePixmapCursor(myDpy,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2599
				_PixmapVal(sourceId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2600
				_PixmapVal(maskId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2601
				&fgColor, &bgColor, __intVal(hx), __intVal(hy));
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2602
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2603
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2604
	if (newCursor)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2605
	    __cnt_cursor++;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2606
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2607
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2608
	if (newCursor != (Cursor)0) {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  2609
	    id = __MKEXTERNALADDRESS(newCursor);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2610
	}
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2611
    }
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  2612
%}.
1838
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2613
    id isNil ifTrue:[
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2614
	self primitiveFailed.
040e4689dfcd oops - do not return self from failing primCreateBitmap
Claus Gittinger <cg@exept.de>
parents: 1835
diff changeset
  2615
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2616
    ^ id
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2617
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2618
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2619
destroyCursor:aCursorId
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2620
    "release a cursor - frees any device resources"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2621
48194c26a46c Initial revision
claus
parents:
diff changeset
  2622
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2623
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2624
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2625
	RETURN ( self );
1211
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2626
    }
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2627
06d63d128bde allow destroy & free methods to be called even if unconnected
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
  2628
    if (__isExternalAddress(aCursorId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2629
	Cursor curs = _CursorVal(aCursorId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2630
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2631
	if (curs) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2632
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2633
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2634
	    XFreeCursor(myDpy, curs);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2635
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2636
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2637
	    __cnt_cursor--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  2638
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  2639
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2640
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2641
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2642
    }
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2643
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2644
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2645
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2646
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2647
needDeviceFormsForCursor
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2648
    ^ true
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2649
!
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2650
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2651
shapeNumberFromSymbol:shape
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2652
    "given a shape-symbol, return the corresponding cursor-number,
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2653
     or nil if no such standard cursor exists."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2654
1563
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2655
    "/this is pure X-knowlegde - but you may easily add more
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2656
    "/ if you add something here, also add to #builtInCursorShapes ...
5a634cfaffad allow device to specify its builtIn cursors
Claus Gittinger <cg@exept.de>
parents: 1558
diff changeset
  2657
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2658
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2659
    (shape == #upLeftArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_top_left_arrow)    %} "132" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2660
    (shape == #upRightHand)     ifTrue:[ ^ %{ __MKSMALLINT(XC_hand1)             %} "58" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2661
    (shape == #upDownArrow)     ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_v_double_arrow) %} "116" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2662
    (shape == #leftRightArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_sb_h_double_arrow) %} "108" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2663
    (shape == #upLimitArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_top_side)          %} "138" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2664
    (shape == #downLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_bottom_side)       %} "16" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2665
    (shape == #leftLimitArrow)  ifTrue:[ ^ %{ __MKSMALLINT(XC_left_side)         %} "70" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2666
    (shape == #rightLimitArrow) ifTrue:[ ^ %{ __MKSMALLINT(XC_right_side)        %} "96" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2667
    (shape == #text)            ifTrue:[ ^ %{ __MKSMALLINT(XC_xterm)             %} "152" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2668
    (shape == #upRightArrow)    ifTrue:[ ^ %{ __MKSMALLINT(XC_draft_large)       %} "44" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2669
    (shape == #leftHand)        ifTrue:[ ^ %{ __MKSMALLINT(XC_hand2)             %} "60" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2670
    (shape == #questionMark)    ifTrue:[ ^ %{ __MKSMALLINT(XC_question_arrow)    %} "92" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2671
    (shape == #cross)           ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2672
    (shape == #wait)            ifTrue:[ ^ %{ __MKSMALLINT(XC_watch)             %} "150" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2673
    (shape == #crossHair)       ifTrue:[ ^ %{ __MKSMALLINT(XC_tcross)            %} "130" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2674
    ((shape == #origin)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2675
    or:[shape == #topLeft])     ifTrue:[ ^ %{ __MKSMALLINT(XC_ul_angle)          %} "144" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2676
    ((shape == #corner)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2677
    or:[shape == #bottomRight]) ifTrue:[ ^ %{ __MKSMALLINT(XC_lr_angle)          %} "78" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2678
    (shape == #topRight)        ifTrue:[ ^ %{ __MKSMALLINT(XC_ur_angle)          %} "148" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2679
    (shape == #bottomLeft)      ifTrue:[ ^ %{ __MKSMALLINT(XC_ll_angle)          %} "76" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2680
    (shape == #square)          ifTrue:[ ^ %{ __MKSMALLINT(XC_dotbox)            %} "40" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2681
    (shape == #fourWay)         ifTrue:[ ^ %{ __MKSMALLINT(XC_fleur)             %} "52" ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  2682
    (shape == #crossCursor)     ifTrue:[ ^ %{ __MKSMALLINT(XC_X_cursor)          %} "0" ].
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2683
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  2684
"/    ('XWorkstation [info]: invalid cursorShape:' , shape printString) infoPrintNL.
974
12797746a1f7 WIN32 changes
Claus Gittinger <cg@exept.de>
parents: 972
diff changeset
  2685
    ^  nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2686
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  2687
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2688
!XWorkstation methodsFor:'drag & drop'!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2689
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2690
dndDrop:dropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2691
    "drop something in some alien view, using the DND protocol.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2692
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2693
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2694
    |msgType dropColl dropCollSize anyFile anyDir anyText anyOther
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2695
     dropType dropTypeCode strings sz idx val|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2696
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2697
    (msgType := self atomIDOf:'DndProtocol') notNil ifTrue:[
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2698
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2699
	"/ DND can drop files, file, dir, links, dirLink and text
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2700
	"/ check for this.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2701
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2702
	dropObjects isCollection ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2703
	    dropColl := Array with:dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2704
	] ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2705
	    dropColl := dropObjects
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2706
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2707
	anyFile := anyDir := anyText := anyOther := false.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2708
	dropColl do:[:aDropObject |
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2709
	    aDropObject isFileObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2710
		aDropObject theObject isDirectory ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2711
		    anyDir := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2712
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2713
		    anyFile := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2714
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2715
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2716
		aDropObject isTextObject ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2717
		    anyText := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2718
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2719
		    anyOther := true
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2720
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2721
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2722
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2723
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2724
	anyOther ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2725
	    "/ DND does not support this ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2726
	    'XWorkstation [info]: DND can only drop files or text' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2727
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2728
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2729
	anyText ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2730
	    (anyFile or:[anyDir]) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2731
		"/ DND does not support mixed types
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2732
		'XWorkstation [info]: DND cannot drop both files and text' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2733
		^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2734
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2735
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2736
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2737
	dropCollSize := dropColl size.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2738
	anyFile ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2739
	    dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2740
	    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2741
		dropType := #DndFile
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2742
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2743
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2744
	    anyDir ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2745
		dropType := #DndFiles.
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2746
		dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2747
		    dropType := #DndDir
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2748
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2749
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2750
		anyText ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2751
		    dropCollSize == 1 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2752
			dropType := #DndText
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2753
		    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2754
			"/ can only drop a single text object
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2755
			'XWorkstation [info]: DND can only drop a single text' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2756
			^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2757
		    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2758
		] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2759
		    "/ mhmh ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2760
		    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2761
		    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2762
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2763
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2764
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2765
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2766
	dropTypeCode := self dndDropTypes indexOf:dropType.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2767
	dropTypeCode == 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2768
	    'XWorkstation [info]: DND cannot drop this' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2769
	    ^ false
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2770
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2771
	dropTypeCode := dropTypeCode - 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2772
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2773
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2774
	"/ place the selection inTo the DndSelection property
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2775
	"/ of the rootView ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2776
	"/ ... need a single string, with 0-terminated parts.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2777
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2778
	strings := OrderedCollection new.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2779
	sz := 0.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2780
	dropColl do:[:anObject |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2781
	    |s o|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2782
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2783
	    o := anObject theObject.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2784
	    anObject isFileObject ifTrue:[
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2785
		o := o pathName
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2786
	    ].
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2787
	    s := o asString.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2788
	    strings add:s.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2789
	    sz := sz + (s size) + 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2790
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2791
	val := String new:sz.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2792
	idx := 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2793
	strings do:[:aString |
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2794
	    |sz|
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2795
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2796
	    sz := aString size.
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2797
	    val replaceFrom:idx to:(idx + sz - 1) with:aString startingAt:1.
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  2798
	    idx := idx + sz.
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2799
	    val at:idx put:(Character value:0).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2800
	    idx := idx + 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2801
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2802
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2803
	self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2804
	    setProperty:(self atomIDOf:'DndSelection')
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2805
	    type:(stringAtom) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2806
	    value:val 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2807
	    for:rootId.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2808
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2809
	^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2810
	    sendClientEvent:msgType 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2811
	    format:32 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2812
	    to:destinationId 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2813
	    data1:dropTypeCode
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2814
	    data2:0
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2815
	    data3:(destinationId)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2816
	    data4:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2817
	    data5:nil.
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2818
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2819
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2820
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2821
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2822
    "Created: 6.4.1997 / 13:39:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  2823
    "Modified: 6.4.1997 / 14:30:43 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2824
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2825
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2826
dndDropTypes
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2827
    "return the dropTypes as supported by DND"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2828
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2829
    ^ #( 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2830
	    DndUnknown      "/ 0
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2831
	    DndRawData      "/ 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2832
	    DndFile         "/ 2
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2833
	    DndFiles        "/ 3
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2834
	    DndText         "/ 4
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2835
	    DndDir          "/ 5
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2836
	    DndLink         "/ 6
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2837
	    DndExe          "/ 7
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2838
       )
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2839
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2840
    "Created: 6.4.1997 / 12:57:56 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2841
    "Modified: 6.4.1997 / 13:38:52 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2842
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2843
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  2844
drop:aCollectionOfDropObjects inWindowID:destinationId position:destinationPoint rootPosition:rootPoint
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2845
    "drop something in some alien view.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2846
     Returns false, if the drop could not be performed."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2847
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2848
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2849
    "/ see, if the display supports the DND protocol ...
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2850
    "/
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2851
    (self atomIDOf:'DndProtocol') notNil ifTrue:[
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2852
	^ self
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2853
	    dndDrop:aCollectionOfDropObjects 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2854
	    inWindowID:destinationId 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2855
	    position:destinationPoint 
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  2856
	    rootPosition:rootPoint        
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2857
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2858
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2859
    "/ add more drag&drop protocols here.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2860
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2861
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  2862
1583
ca6e6732dc29 drop argument is always a collection
Claus Gittinger <cg@exept.de>
parents: 1579
diff changeset
  2863
    "Modified: 11.4.1997 / 12:44:50 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2864
! !
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  2865
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2866
!XWorkstation methodsFor:'drawing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2867
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  2868
copyFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2869
    "do a bit-blt; copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2870
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2871
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2872
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2873
48194c26a46c Initial revision
claus
parents:
diff changeset
  2874
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2875
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2876
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2877
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2878
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2879
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2880
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2881
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2882
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2883
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2884
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2885
     && __bothSmallInteger(dstX, dstY)) {
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2886
	int _sX, _sY, _w, _h, _dX, _dY;
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2887
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2888
	_sX = __intVal(srcX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2889
	_sY = __intVal(srcY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2890
	_w = __intVal(w);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2891
	_h = __intVal(h);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2892
	_dX = __intVal(dstX);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2893
	_dY = __intVal(dstY);
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2894
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2895
	gc = _GCVal(dstGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2896
	source = (Drawable) _WindowVal(sourceId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2897
	dest = (Drawable) _WindowVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2898
	ENTER_XLIB();
1848
bd9dbae5247f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1838
diff changeset
  2899
	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2900
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2901
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2902
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2903
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2904
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2905
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2906
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2907
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2908
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2909
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2910
copyFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2911
    "do a bit-blt from a pix- or bitmap; copy bits from the rectangle defined by
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2912
     srcX/srcY and w/h from the sourceId drawable to the rectangle
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2913
     below dstX/dstY in the destId drawable. Trigger an error if any
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2914
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2915
     This is basically the same as copyFromId:..., but does not generate expose events."
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2916
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2917
%{  /* NOCONTEXT */
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2918
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2919
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2920
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2921
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2922
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2923
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2924
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2925
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2926
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2927
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2928
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2929
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2930
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2931
	gc = _GCVal(dstGCId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2932
	source = (Drawable) _WindowVal(sourceId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2933
	dest = (Drawable) _WindowVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2934
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2935
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2936
	XCopyArea(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2937
				__intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2938
				__intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2939
				__intVal(dstX), __intVal(dstY));
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2940
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2941
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  2942
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2943
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2944
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2945
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2946
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2947
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2948
    self primitiveFailed
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2949
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2950
1030
ca9d23090688 pass srcGCId to bit-blitters (req'd on WINDOWS)
Claus Gittinger <cg@exept.de>
parents: 1025
diff changeset
  2951
copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2952
    "do a bit-blt, but only copy the low-bit plane; 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2953
     copy bits from the rectangle defined by
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2954
     srcX/srcY and w/h from the sourceId drawable to the rectangle
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2955
     below dstX/dstY in the destId drawable. Trigger an error if any
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2956
     argument is not integer."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2957
48194c26a46c Initial revision
claus
parents:
diff changeset
  2958
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  2959
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  2960
    GC gc;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2961
    Drawable source, dest;
48194c26a46c Initial revision
claus
parents:
diff changeset
  2962
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2963
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  2964
     && __isExternalAddress(dstGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2965
     && __isExternalAddress(sourceId)
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  2966
     && __isExternalAddress(destId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2967
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2968
     && __bothSmallInteger(srcX, srcY)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  2969
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2970
	gc = _GCVal(dstGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2971
	source = (Drawable) _WindowVal(sourceId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2972
	dest = (Drawable) _WindowVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2973
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2974
	XCopyPlane(myDpy, source, dest, gc,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2975
				 __intVal(srcX), __intVal(srcY),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2976
				 __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2977
				 __intVal(dstX), __intVal(dstY), 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  2978
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  2979
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2980
    }
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2981
%}.
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2982
    "badGC, bad sourceDrawableId or destDrawableID
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2983
     or any non integer coordinate"
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  2984
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  2985
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  2986
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  2987
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2988
copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2989
    "do a bit-blt from a pix- or bitmap, but only copy the low-bit plane; 
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2990
     copy bits from the rectangle defined by
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2991
     srcX/srcY and w/h from the sourceId drawable to the rectangle
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2992
     below dstX/dstY in the destId drawable. Trigger an error if any
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2993
     argument is not integer.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2994
     This is the same as copyPlaneFromId:..., but does not generate graphics exposes"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2995
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2996
%{  /* NOCONTEXT */
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2997
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2998
    GC gc;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  2999
    Drawable source, dest;
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3000
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3001
    if (ISCONNECTED
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3002
     && __isExternalAddress(dstGCId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3003
     && __isExternalAddress(sourceId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3004
     && __isExternalAddress(destId)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3005
     && __bothSmallInteger(w, h)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3006
     && __bothSmallInteger(srcX, srcY)
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3007
     && __bothSmallInteger(dstX, dstY)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3008
	Display *dpy = myDpy;
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3009
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3010
	gc = _GCVal(dstGCId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3011
	source = (Drawable) _WindowVal(sourceId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3012
	dest = (Drawable) _WindowVal(destId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3013
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3014
	XSetGraphicsExposures(dpy, gc, 0);
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3015
	XCopyPlane(dpy, source, dest, gc,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3016
				 __intVal(srcX), __intVal(srcY),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3017
				 __intVal(w), __intVal(h),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3018
				 __intVal(dstX), __intVal(dstY), 1);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3019
	XSetGraphicsExposures(dpy, gc, 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3020
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3021
	RETURN ( self );
1246
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3022
    }
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3023
%}.
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3024
    "badGC, bad sourceDrawableId or destDrawableID
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3025
     or any non integer coordinate"
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3026
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3027
    self primitiveFailed
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3028
!
f8835fc41467 added copy*FromPixmapId:* - which do not generate graphics exposures
Claus Gittinger <cg@exept.de>
parents: 1227
diff changeset
  3029
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3030
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
  3031
    "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
  3032
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3033
48194c26a46c Initial revision
claus
parents:
diff changeset
  3034
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  3035
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3036
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3037
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3038
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3039
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3040
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3041
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3042
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3043
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3044
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3045
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3046
    } else if (__isShortFloat(startAngle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3047
	f = __shortFloatVal(startAngle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3048
	angle1 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3049
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3050
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3051
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3052
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3053
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3054
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3055
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3056
    } else if (__isShortFloat(angle)) {
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3057
	f = __shortFloatVal(angle);
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3058
	angle2 = f * 64;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3059
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3060
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3061
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3062
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3063
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3064
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3065
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3066
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3067
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3068
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3069
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3070
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3071
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3072
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3073
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3074
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3075
	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3076
				   w, h, angle1, angle2);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3077
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3078
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3079
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3080
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3081
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3082
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3083
    "badGC, badDrawable or coordinates not integer
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3084
     or angle(s) not integer or float."
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3085
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3086
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  3087
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3088
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3089
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
  3090
    "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
  3091
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3092
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3093
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3094
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3095
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3096
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3097
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3098
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3099
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3100
     && __bothSmallInteger(x0, y0)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3101
     && __bothSmallInteger(x1, y1)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3102
	Display *dpy = myDpy;
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3103
	gc = _GCVal(aGCId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3104
	win = _WindowVal(aDrawableId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3105
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3106
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3107
	if ((x0 == x1) && (y0 == y1)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3108
	    XDrawPoint(dpy, win, gc, __intVal(x0), __intVal(y0));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3109
	} else {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3110
	    XDrawLine(dpy, win, gc, __intVal(x0), __intVal(y0),
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3111
				    __intVal(x1), __intVal(y1));
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3112
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3113
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3114
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3115
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3116
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3117
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3118
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3119
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3120
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3121
displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3122
    "draw a polygon starting at x; the y values derives from the collection yValues.
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3123
     The associated x is a multiple of step. Each y value will be scaled and translated
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3124
    "
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3125
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3126
    |noY|
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3127
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3128
    (noY := yValues size) < 2 ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3129
	^ self
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3130
    ].
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3131
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3132
%{
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3133
    OBJ      yA, t;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3134
    int      i, num;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3135
    float    y, x, sY, tY, step;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3136
    GC       gc;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3137
    XPoint * points;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3138
    XPoint   qPoints[200];
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3139
    int      mustFree = 0;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3140
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3141
    Window win;
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3142
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3143
    if (ISCONNECTED
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3144
     && __isExternalAddress(aGCId)
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3145
     && __isExternalAddress(aDrawableId) ) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3146
	gc = _GCVal(aGCId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3147
	win = _WindowVal(aDrawableId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3148
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3149
	if( __isSmallInteger(scaleY) ) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3150
	    sY = (float) __intVal( scaleY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3151
	else if (__isFloat(scaleY)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3152
	    sY = __floatVal( scaleY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3153
	else if (__isShortFloat(scaleY)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3154
	    sY = __shortFloatVal( scaleY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3155
	else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3156
	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3157
	    if (! __isFloat(t)) goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3158
	    sY = __floatVal( t );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3159
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3160
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3161
	if( __isSmallInteger(transY) ) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3162
	    tY = (float) __intVal( transY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3163
	else if (__isFloat(transY)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3164
	    tY = __floatVal( transY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3165
	else if (__isShortFloat(transY)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3166
	    tY = __shortFloatVal( transY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3167
	else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3168
	    t = __SSEND0(transY, @symbol(asFloat), 0);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3169
	    if (! __isFloat(t)) goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3170
	    tY = __floatVal( t );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3171
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3172
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3173
	if( __isSmallInteger(startX) ) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3174
	    x = (float) __intVal( startX );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3175
	else if (__isFloat(startX)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3176
	    x = __floatVal( startX );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3177
	else if (__isShortFloat(startX)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3178
	    x = __shortFloatVal( startX );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3179
	else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3180
	    t = __SSEND0(startX, @symbol(asFloat), 0);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3181
	    if (! __isFloat(t)) goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3182
	    x = __floatVal( t );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3183
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3184
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3185
	if( __isSmallInteger(stepX) ) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3186
	    step = (float) __intVal( stepX );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3187
	else if (__isFloat(stepX)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3188
	    step = __floatVal( stepX );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3189
	else if (__isShortFloat(stepX)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3190
	    step = __shortFloatVal( stepX );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3191
	else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3192
	    t = __SSEND0(stepX, @symbol(asFloat), 0);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3193
	    if (! __isFloat(t)) goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3194
	    step = __floatVal( t );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3195
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3196
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3197
	num = __intVal( noY );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3198
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3199
	if( num > 200 ) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3200
	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3201
		goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3202
	    mustFree = 1;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3203
	} else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3204
	    points = qPoints;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3205
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3206
	for( i = 0; i < num; ++i ) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3207
	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3208
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3209
	    if( __isFloat(yA) )
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3210
		y = __floatVal( yA );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3211
	    else if( __isSmallInteger(yA) )
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3212
		y = (float) __intVal( yA );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3213
	    else if( __isShortFloat( yA) )
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3214
		y = __shortFloatVal( yA );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3215
	    else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3216
		t = __SSEND0(yA, @symbol(asFloat), 0);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3217
		if (! __isFloat(t)) goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3218
		y = __floatVal( t );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3219
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3220
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3221
	    points[i].x = (int) (x + 0.5);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3222
	    points[i].y = (int) ((y * sY) + tY + 0.5);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3223
	    x = x + step;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3224
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3225
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3226
	ENTER_XLIB();
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3227
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3228
	LEAVE_XLIB();
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3229
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3230
	if( mustFree ) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3231
	    free( points );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3232
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3233
	RETURN ( self );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3234
    }
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3235
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3236
fail:
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3237
    if( mustFree )
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3238
	free( points );
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3239
%}.
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3240
    self primitiveFailed
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3241
2146
1c13fdc62a9f displayLinesFromX... - also handle shortFloats inline
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3242
    "Modified: / 13.6.1998 / 13:51:39 / cg"
1978
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3243
!
3587bf92b94a add new method for optimization:
ca
parents: 1974
diff changeset
  3244
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3245
displayPointX:x y:y in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3246
    "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
  3247
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3248
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3249
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3250
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3251
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3252
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3253
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3254
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3255
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3256
     && __bothSmallInteger(x, y)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3257
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3258
	win = _WindowVal(aDrawableId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3259
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3260
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3261
	XDrawPoint(myDpy, win, gc, __intVal(x), __intVal(y));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3262
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3263
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3264
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3265
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3266
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3267
    "badGC, badDrawable or x/y not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3268
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3269
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3270
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3271
displayPolygon:aPolygon in:aDrawableId with:aGCId
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3272
    "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
  3273
     define the polygon.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3274
     If any coordinate is not integer, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3275
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3276
    |numberOfPoints newPoints|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3277
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3278
    numberOfPoints := aPolygon size.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3279
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3280
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3281
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3282
    OBJ point, x, y;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3283
    int i, num;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3284
    XPoint *points;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3285
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3286
    int mustFree = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3287
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3288
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3289
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3290
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3291
     && __isSmallInteger(numberOfPoints)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3292
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3293
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3294
	num = __intVal(numberOfPoints);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3295
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3296
	 * avoid a (slow) malloc, if the number of points is small
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3297
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3298
	if (num > 100) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3299
	    points = (XPoint *)malloc(sizeof(XPoint) * num);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3300
	    if (! points) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3301
	    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3302
	} else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3303
	    points = qPoints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3304
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3305
	for (i=0; i<num; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3306
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3307
	    if (! __isPoint(point)) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3308
	    x = _point_X(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3309
	    y = _point_Y(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3310
	    if (! __bothSmallInteger(x, y))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3311
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3312
	    points[i].x = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3313
	    points[i].y = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3314
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3315
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3316
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3317
	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3318
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3319
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3320
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3321
	    free(points);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3322
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3323
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3324
fail: ;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3325
    if (mustFree)
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3326
	free(points);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3327
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3328
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3329
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3330
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3331
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3332
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
  3333
    "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
  3334
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3335
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3336
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3337
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3338
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3339
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3340
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3341
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3342
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3343
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3344
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3345
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3346
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3347
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3348
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3349
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3350
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3351
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3352
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3353
	if ((w >= 0) && (h >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3354
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3355
	    XDrawRectangle(myDpy, win, gc, __intVal(x), __intVal(y), w, h);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3356
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3357
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3358
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3359
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3360
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3361
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3362
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3363
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3364
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3365
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
  3366
    "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
  3367
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3368
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3369
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3370
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3371
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3372
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3373
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3374
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3375
    OBJ cls;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3376
    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
  3377
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3378
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3379
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3380
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3381
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3382
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3383
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3384
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3385
     && __bothSmallInteger(index1, index2)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3386
     && __bothSmallInteger(x, y)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3387
	Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3388
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3389
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3390
	cls = __qClass(aString);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3391
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3392
	i1 = __intVal(index1) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3393
	if (i1 >= 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3394
	    i2 = __intVal(index2) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3395
	    if (i2 < i1) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3396
		RETURN (self);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3397
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3398
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3399
	    cp = (char *) __stringVal(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3400
	    l = i2 - i1 + 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3401
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3402
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
2011
47e72d42226b eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  3403
		n = __stringSize(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3404
		if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3405
		    cp += i1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3406
		    if (l > 1000) l = 1000;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3407
		    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3408
		    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3409
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3410
		    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3411
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3412
		    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3413
		    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3414
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3415
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3416
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3417
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3418
	    cp += nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3419
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3420
	    if (__isBytes(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3421
		n = __byteArraySize(aString) - nInstBytes - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3422
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3423
		if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3424
		    cp += i1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3425
		    if (l > 1000) l = 1000;
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3426
		    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3427
		    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3428
			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3429
		    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3430
			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3431
		    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3432
		    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3433
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3434
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3435
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3436
	    /* TWOBYTESTRINGS */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3437
	    if (__isWords(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3438
		n = (__byteArraySize(aString) - nInstBytes) / 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3439
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3440
		if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3441
		    union {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3442
			char b[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3443
			unsigned short s;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3444
		    } u;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3445
		    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3446
		    XChar2b *cp2 = (XChar2b *)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3447
		    int mustFree = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3448
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3449
		    cp += (i1 * 2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3450
		    if (l > 1000) l = 1000;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3451
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3452
		    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3453
		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3454
		     * X expects them MSB first
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3455
		     * convert as required
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3456
		     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3457
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3458
		    u.s = 0x1234;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3459
		    if (u.b[0] != 0x12) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3460
			if (l <= NLOCALBUFFER) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3461
			    cp2 = xlatebuffer;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3462
			} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3463
			    cp2 = (XChar2b *)(malloc(l * 2));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3464
			    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3465
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3466
			for (i=0; i<l; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3467
			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3468
			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3469
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3470
			cp = (char *) cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3471
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3472
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3473
		    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3474
		    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3475
			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3476
		    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3477
			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3478
		    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3479
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3480
		    if (mustFree) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3481
			free(cp2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3482
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3483
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3484
		    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3485
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3486
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3487
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3488
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3489
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3490
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3491
    "x/y not integer, badGC or drawable, or not a string"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3492
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3493
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3494
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3495
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
  3496
    "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
  3497
     foreground and background characters.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3498
     If the coordinates are not integers, an error is triggered."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3499
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3500
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3501
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3502
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3503
    Window win;
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3504
    char *cp;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3505
    int n;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3506
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3507
#   define NLOCALBUFFER 200
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3508
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  3509
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3510
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3511
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3512
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3513
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3514
     && __isNonNilObject(aString)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3515
     && __bothSmallInteger(x, y)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3516
	Display *dpy = myDpy;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3517
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3518
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3519
	cls = __qClass(aString);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3520
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3521
	cp = (char *) __stringVal(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3522
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3523
	if ((cls == @global(String)) || (cls == @global(Symbol))) {
2011
47e72d42226b eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  3524
	    n = __stringSize(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3525
	    if (n > 1000) n = 1000;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3526
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3527
	    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3528
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3529
	    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3530
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3531
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3532
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3533
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3534
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3535
	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3536
	cp += nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3537
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3538
	if (__isBytes(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3539
	    n = __byteArraySize(aString) - nInstBytes - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3540
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3541
	    if (n > 1000) n = 1000;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3542
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3543
	    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3544
		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3545
	    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3546
		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3547
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3548
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3549
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3550
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3551
	/* TWOBYTESTRINGS */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3552
	if (__isWords(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3553
	    union {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3554
		char b[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3555
		unsigned short s;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3556
	    } u;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3557
	    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3558
	    XChar2b *cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3559
	    int mustFree = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3560
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3561
	    n = (__byteArraySize(aString) - nInstBytes) / 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3562
	    if (n > 1000) n = 1000;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3563
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3564
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3565
	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3566
	     * X expects them MSB first
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3567
	     * convert as required
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3568
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3569
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3570
	    u.s = 0x1234;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3571
	    if (u.b[0] != 0x12) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3572
		if (n <= NLOCALBUFFER) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3573
		    cp2 = xlatebuffer;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3574
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3575
		    cp2 = (XChar2b *)(malloc(n * 2));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3576
		    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3577
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3578
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3579
		for (i=0; i<n; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3580
		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3581
		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3582
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3583
		cp = (char *) cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3584
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3585
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3586
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3587
	    if (opaque == true)
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3588
		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3589
	    else
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  3590
		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3591
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3592
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3593
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3594
	    if (mustFree) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3595
		free(cp2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3596
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3597
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3598
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3599
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  3600
    }
461
4a4b1384ab76 X wants 16bit strings in MSBfirst
Claus Gittinger <cg@exept.de>
parents: 459
diff changeset
  3601
#undef NLOCALBUFFER
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3602
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3603
    "x/y not integer, badGC or drawable, or not a string"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3604
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3605
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3606
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3607
drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3608
	width:imageWidth height:imageHeight 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3609
	x:srcx y:srcy
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3610
	into:aDrawableId 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3611
	x:dstx y:dsty 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3612
	width:w height:h 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3613
	with:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3614
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3615
    "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
  3616
     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
  3617
     Individual source pixels have bitsPerPixel bits, allowing to draw
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3618
     depth and pixel-units to be different.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3619
     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
  3620
     depth - otherwise, primitive failure will be signalled.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3621
     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
  3622
     colors are allocated - otherwise the colors may be wrong."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3623
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3624
    |fmt padding bits wantedPadding|
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3625
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3626
    padding := givenPadding.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3627
    bits := givenBits.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3628
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3629
    "/ the XF86_VGA16 server seems to report an error when we pass it an
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3630
    "/ 8-bit padded image. (it wants it 32bit padded).
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3631
    "/ as a workaround, repad it here (although, the server and/or Xlib should
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3632
    "/ care for that.
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3633
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3634
    ((imageDepth == 4) and:[depth == 4]) ifTrue:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3635
	fmt := self supportedImageFormatForDepth:4.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3636
	fmt isNil ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3637
	    self primitiveFailed. "/ cannot represent this image
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3638
	    ^ nil
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3639
	].
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3640
	wantedPadding := fmt at:#padding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3641
	wantedPadding > givenPadding ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3642
	    bits := self 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3643
			    repadBits:givenBits 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3644
			    width:imageWidth 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3645
			    height:imageHeight
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3646
			    depth:imageDepth
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3647
			    from:givenPadding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3648
			    to:wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3649
	    padding := wantedPadding.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3650
	]
2537
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3651
    ].
b8bb3e221b8b repadding support (req'd for 4-bit VGA server) sigh
Claus Gittinger <cg@exept.de>
parents: 2531
diff changeset
  3652
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3653
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3654
     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
  3655
     an unlimited stack, and thus cannot send primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3656
    "
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  3657
    (self 
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3658
	primDrawBits:bits 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3659
	bitsPerPixel:bitsPerPixel 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3660
	depth:imageDepth 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3661
	padding:padding
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3662
	width:imageWidth height:imageHeight 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3663
	x:srcx y:srcy
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3664
	into:aDrawableId 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3665
	x:dstx y:dsty 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3666
	width:w height:h 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3667
	with:aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3668
    ifFalse:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3669
	"
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3670
	 also happens, if a segmentation violation occurs in the 
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3671
	 XPutImage ...
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3672
	"
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  3673
	self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3674
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3675
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3676
652
30a701619098 fill/drawArc..w:h:.. renamed to ...width:height:...
Claus Gittinger <cg@exept.de>
parents: 613
diff changeset
  3677
fillArcX:x y:y width:width height:height from:startAngle angle:angle
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3678
	       in:aDrawableId with:aGCId
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3679
    "fill an arc. If any coordinate is not integer, an error is triggered.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  3680
     The angles may be floats or integer - they are given in degrees."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3681
48194c26a46c Initial revision
claus
parents:
diff changeset
  3682
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  3683
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3684
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3685
    Window win;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3686
    int w, h, angle1, angle2;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3687
    double f;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3688
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3689
    if (__isSmallInteger(startAngle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3690
	angle1 = __intVal(startAngle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3691
    else if (__isFloat(startAngle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3692
	f = __floatVal(startAngle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3693
	angle1 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3694
    } else if (__isShortFloat(startAngle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3695
	f = __shortFloatVal(startAngle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3696
	angle1 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3697
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3698
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3699
    if (__isSmallInteger(angle))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3700
	angle2 = __intVal(angle) * 64;
36
b297468551c6 *** empty log message ***
claus
parents: 31
diff changeset
  3701
    else if (__isFloat(angle)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3702
	f = __floatVal(angle);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3703
	angle2 = f * 64;
2268
1a774fc02c83 fixed non-float (i.e. fraction) args to fillArc/ displayArc
Claus Gittinger <cg@exept.de>
parents: 2267
diff changeset
  3704
    } else if (__isShortFloat(angle)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3705
	f = __shortFloatVal(angle);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3706
	angle2 = f * 64;
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3707
    } else goto bad;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3708
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3709
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3710
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3711
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3712
     && __bothSmallInteger(x, y)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3713
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3714
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3715
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3716
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3717
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3718
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3719
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3720
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3721
	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3722
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3723
	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3724
				   w, h, angle1, angle2);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3725
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3726
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3727
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3728
    }
2267
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3729
    bad: ;
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3730
%}.
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3731
    "badGC, badDrawable or coordinates not integer
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3732
     or non float angle(s)"
f6fbc3e71521 care for float or int angles in fillArc / displayArc
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  3733
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3734
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  3735
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3736
48194c26a46c Initial revision
claus
parents:
diff changeset
  3737
fillPolygon:aPolygon in:aDrawableId with:aGCId
118
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3738
    "fill a polygon given by its points. 
25e775072a89 *** empty log message ***
claus
parents: 115
diff changeset
  3739
     If any coordinate is not integer, an error is triggered."
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3740
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3741
    |numberOfPoints|
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3742
48194c26a46c Initial revision
claus
parents:
diff changeset
  3743
    numberOfPoints := aPolygon size.
48194c26a46c Initial revision
claus
parents:
diff changeset
  3744
%{
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3745
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3746
    Window win;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3747
    OBJ point, x, y;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3748
    int i, num;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3749
    XPoint *points;
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3750
    XPoint qPoints[100];
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3751
    int mustFree = 0;
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3752
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3753
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3754
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3755
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3756
     && __isSmallInteger(numberOfPoints)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3757
	gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3758
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3759
	num = __intVal(numberOfPoints);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3760
	if (num < 3) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3761
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3762
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3763
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3764
	 * avoid (slow) malloc, if not many points
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3765
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3766
	if (num > 100) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3767
	    points = (XPoint *) malloc(sizeof(XPoint) * num);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3768
	    if (! points) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3769
	    mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3770
	} else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3771
	    points = qPoints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3772
	for (i=0; i<num; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3773
	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3774
	    if (! __isPoint(point)) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3775
	    x = _point_X(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3776
	    y = _point_Y(point);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3777
	    if (! __bothSmallInteger(x, y))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3778
		goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3779
	    points[i].x = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3780
	    points[i].y = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3781
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3782
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3783
	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3784
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3785
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3786
	    free(points);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3787
	RETURN ( self );
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3788
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3789
fail: ;
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3790
	if (mustFree)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3791
	    free(points);
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3792
    }
73
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3793
%}.
dd85c19ec8d9 final before switching to new primitive stuff
claus
parents: 72
diff changeset
  3794
    "badGC, badDrawable or coordinates not integer"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3795
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  3796
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  3797
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3798
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
  3799
    "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
  3800
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3801
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3802
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3803
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3804
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3805
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3806
     && __isExternalAddress(aGCId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3807
     && __isExternalAddress(aDrawableId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3808
     && __bothSmallInteger(x, y)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3809
     && __bothSmallInteger(width, height)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3810
	w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3811
	h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3812
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3813
	 * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3814
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3815
	if ((w >= 0) && (h >= 0)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3816
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3817
	    XFillRectangle(myDpy,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3818
			   (Drawable)_WindowVal(aDrawableId), _GCVal(aGCId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3819
			   __intVal(x), __intVal(y), w, h);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  3820
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3821
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  3822
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3823
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3824
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3825
    "badGC, badDrawable or coordinates not integer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  3826
    self primitiveFailed
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3827
!
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3828
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  3829
primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3830
			      width:imageWidth height:imageHeight 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3831
				  x:srcx y:srcy
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3832
			       into:aDrawableId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3833
				  x:dstx y:dsty 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3834
			      width:w height:h 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3835
			       with:aGCId
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3836
132
claus
parents: 129
diff changeset
  3837
    "since XPutImage may allocate huge amount of stack space 
claus
parents: 129
diff changeset
  3838
     (some implementations use alloca), this must run with unlimited stack."
claus
parents: 129
diff changeset
  3839
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3840
%{  /* UNLIMITEDSTACK */
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3841
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3842
    /*
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3843
     * need unlimited stack, since some Xlibs do a huge alloca in
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3844
     * XPutImage
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3845
     */
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3846
    GC gc;
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  3847
    Window win;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3848
    XImage image;
377
191915daff5e *** empty log message ***
ah
parents: 374
diff changeset
  3849
    int imgWdth;
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3850
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3851
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  3852
     && __isExternalAddress(aGCId)
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3853
     && __isExternalAddress(aDrawableId)
97
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3854
     && __bothSmallInteger(srcx, srcy)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3855
     && __bothSmallInteger(dstx, dsty)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3856
     && __bothSmallInteger(w, h)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3857
     && __bothSmallInteger(imageWidth, imageHeight)
dd6116883ac0 *** empty log message ***
claus
parents: 96
diff changeset
  3858
     && __bothSmallInteger(imageDepth, bitsPerPixel)
1995
1ff668145d23 allow padding to be passed down to Xlib
Claus Gittinger <cg@exept.de>
parents: 1990
diff changeset
  3859
     && __isSmallInteger(bitPadding)
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3860
     && __isByteArray(imageBits)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3861
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3862
	int pad = __intVal(bitPadding);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3863
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3864
	gc = _GCVal(aGCId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3865
	win = _WindowVal(aDrawableId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3866
	if (! gc || !win) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3867
	    goto fail;
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3868
#ifdef ARGDEBUG
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3869
	printf("args ok\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3870
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3871
	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3872
	image.width = imgWdth = __intVal(imageWidth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3873
	image.height = __intVal(imageHeight);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3874
	image.xoffset = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3875
	image.format = ZPixmap;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3876
	image.byte_order = MSBFirst;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3877
	image.bitmap_unit = 8;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3878
	image.bitmap_bit_order = MSBFirst;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3879
	image.bitmap_pad = pad;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3880
	image.depth = __intVal(imageDepth);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3881
	image.bits_per_pixel = __intVal(bitsPerPixel);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3882
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3883
	/*
2021
67626c0fb1eb fixed image padding bug
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  3884
	image.bytes_per_line = ((((imgWdth * image.depth) + (pad-1)) / pad) * pad) / 8;
67626c0fb1eb fixed image padding bug
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  3885
	*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3886
	image.bytes_per_line = ((((imgWdth * image.bits_per_pixel) + (pad-1)) / pad) * pad) / 8;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3887
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3888
	switch (image.bits_per_pixel) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3889
	    case 1:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3890
	    case 2:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3891
	    case 4:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3892
	    case 8:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3893
	    case 16:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3894
	    case 24:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3895
	    case 32:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3896
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3897
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3898
	    default:
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3899
#ifdef ARGDEBUG
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3900
		printf("bits_per_pixel=%d\n",image.bits_per_pixel);
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3901
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3902
		goto fail;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3903
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3904
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3905
	image.red_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3906
	image.green_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3907
	image.blue_mask = 0xFFFF;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3908
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3909
	/* ENTER_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3910
	XPutImage(dpy, win, gc, &image, __intVal(srcx), __intVal(srcy),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3911
					__intVal(dstx), __intVal(dsty),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3912
					__intVal(w), __intVal(h));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3913
	/* LEAVE_XLIB(); */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3914
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  3915
	RETURN ( true );
43
1d44cc4da884 *** empty log message ***
claus
parents: 37
diff changeset
  3916
    }
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3917
#ifdef ARGDEBUG
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  3918
    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
  3919
    if (!! __isExternalAddress(aDrawableId)) printf("aDrawableId\n");
193
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3920
    if (!! __isSmallInteger(srcx)) printf("srcx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3921
    if (!! __isSmallInteger(srcy)) printf("srcy\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3922
    if (!! __isSmallInteger(dstx)) printf("dstx\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3923
    if (!! __isSmallInteger(dsty)) printf("dsty\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3924
    if (!! __isSmallInteger(w)) printf("w\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3925
    if (!! __isSmallInteger(h)) printf("h\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3926
    if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3927
    if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3928
    if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3929
    if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
Claus Gittinger <cg@exept.de>
parents: 190
diff changeset
  3930
    if (!! __isByteArray(imageBits)) printf("imageBits\n");
46
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3931
#endif
7b331e9012fd *** empty log message ***
claus
parents: 44
diff changeset
  3932
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3933
fail: ;
48194c26a46c Initial revision
claus
parents:
diff changeset
  3934
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  3935
.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  3936
    ^ false
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  3937
! !
48194c26a46c Initial revision
claus
parents:
diff changeset
  3938
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  3939
!XWorkstation methodsFor:'event forwarding'!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  3940
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3941
buttonPress:button x:x y:y view:aView
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3942
    "forward a button-press event for some view"
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3943
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3944
    button == 1 ifTrue:[
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  3945
	activateOnClick == true ifTrue:[
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3946
	    "/ dont raise above an active popup view.
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3947
	    (activeKeyboardGrab isNil and:[activePointerGrab isNil]) ifTrue:[
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3948
		aView topView raise.
2386
102db396aa42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2385
diff changeset
  3949
"/            ] ifFalse:[
102db396aa42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2385
diff changeset
  3950
"/                activeKeyboardGrab printCR.
102db396aa42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2385
diff changeset
  3951
"/                activePointerGrab printCR.
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3952
	    ]
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  3953
	].
2385
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3954
    ].
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3955
    super buttonPress:button x:x y:y view:aView
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3956
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3957
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3958
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3959
!
0237421f277c support activateOnClick.
Claus Gittinger <cg@exept.de>
parents: 2361
diff changeset
  3960
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3961
circulateNotifyView:aView
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3962
    "sent, when the stacking order changes.
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3963
     ignored for now."
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3964
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3965
!
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3966
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3967
circulateRequestView:aView
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3968
    "sent, when the stacking order is about to change.
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3969
     ignored for now."
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3970
!
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  3971
1540
290be8b62d44 client messages
Claus Gittinger <cg@exept.de>
parents: 1537
diff changeset
  3972
clientMessage:event dataOffset:offs view:targetView
1757
193744c17992 added message to debugHalt
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
  3973
    self halt:'debug halt: unimplemented client message'.
1540
290be8b62d44 client messages
Claus Gittinger <cg@exept.de>
parents: 1537
diff changeset
  3974
290be8b62d44 client messages
Claus Gittinger <cg@exept.de>
parents: 1537
diff changeset
  3975
    "Created: 4.4.1997 / 17:23:12 / cg"
1757
193744c17992 added message to debugHalt
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
  3976
    "Modified: 17.6.1997 / 18:04:24 / cg"
1540
290be8b62d44 client messages
Claus Gittinger <cg@exept.de>
parents: 1537
diff changeset
  3977
!
290be8b62d44 client messages
Claus Gittinger <cg@exept.de>
parents: 1537
diff changeset
  3978
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3979
clientMessage:event type:type format:format dataOffset:offs view:targetView
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3980
    |sensor data|
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3981
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3982
    data := event copyFrom:offs + 1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3983
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3984
    "/ DND drag&drop protocol
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3985
    type == (self atomIDOf:'DndProtocol') ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3986
	format == 32 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3987
	    self dndMessage:event data:data view:targetView.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3988
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3989
	]
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3990
    ].
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3991
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3992
    (sensor := targetView sensor) notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3993
	sensor clientMessage:type format:format eventData:data view:targetView
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3994
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3995
	"
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3996
	 not posted, if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  3997
	"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3998
    ]
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  3999
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4000
    "Created: 4.4.1997 / 17:49:26 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4001
    "Modified: 4.4.1997 / 18:00:18 / cg"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4002
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4003
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4004
colorMapChangeView:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4005
    "sent, when another colormap is installed.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4006
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4007
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4008
    aView colorMapChange
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4009
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4010
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4011
configureRequestView:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4012
    "ignored for now"
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4013
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4014
    "/ aView configureRequest
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4015
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4016
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4017
createdView:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4018
    "ignored for now"
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4019
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4020
    "/ aView created
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4021
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4022
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4023
dndMessage:event data:data view:targetView
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4024
    "handle a DND drag&drop protocol message"
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4025
1553
279d9566bd83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1552
diff changeset
  4026
    |sensor dropType dropValue names i1 i2 t|
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4027
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4028
    dropType := data doubleWordAt:1.
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4029
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4030
    "/ see def's in DragAndDropTypes.h
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  4031
    dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4032
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4033
    self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4034
	getProperty:(self atomIDOf:'DndSelection')
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4035
	from:rootId
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4036
	into:[:type :value |
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4037
	    t := type.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4038
	    dropValue := value
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4039
	].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4040
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4041
    "/ preconvert into a collection
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4042
    "/ of fileNames, string or byteArray
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4043
    "/ Notice: we do not yet convert into dropObjects
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4044
    "/ here, to allow arbitrary data to be handled by
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4045
    "/ redefined dropMessage methods in applications.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4046
    "/ Conversion is done for some well known types
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4047
    "/ in the default dropMessage handling of SimpleView.
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4048
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4049
    dropType == #DndFiles ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4050
	"/ actually, a list of fileNames
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4051
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4052
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4053
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4054
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4055
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4056
	names := OrderedCollection new.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4057
	i1 := 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4058
	[i1 ~~ 0] whileTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4059
	    i2 := dropValue indexOf:(Character value:0) startingAt:i1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4060
	    i2 ~~ 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4061
		names add:(dropValue copyFrom:i1 to:(i2-1)).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4062
		i1 := i2 + 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4063
	    ] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4064
		i1 := i2
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4065
	    ].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4066
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4067
	dropValue := names.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4068
	dropValue := dropValue collect:[:nm | nm asFilename].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4069
	dropType := #files.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4070
    ] ifFalse:[ (dropType == #DndFile) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4071
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4072
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4073
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4074
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4075
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4076
	dropValue := dropValue asFilename.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4077
	dropType := #file.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4078
    ] ifFalse:[ (dropType == #DndDir) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4079
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4080
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4081
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4082
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4083
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4084
	dropValue := dropValue asFilename.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4085
	dropType := #directory.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4086
    ] ifFalse:[ (dropType == #DndText) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4087
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4088
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4089
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4090
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4091
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4092
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4093
	dropType := #text.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4094
    ] ifFalse:[ (dropType == #DndExe) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4095
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4096
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4097
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4098
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4099
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4100
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4101
	dropType := #executable.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4102
    ] ifFalse:[ (dropType == #DndLink) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4103
	t ~~ stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4104
	    'XWorkstation [info]: expected a string propertyValue in drop' infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4105
	    ^ self
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4106
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4107
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4108
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4109
	dropType := #link.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4110
    ] ifFalse:[ (dropType == #DndRawData) ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4111
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4112
	dropType := #rawData.
1552
969fd0309d2a more drop support
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  4113
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4114
	'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4115
	'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4116
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4117
	dropValue := dropValue.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4118
	dropType := #unknown.
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4119
    ]]]]]]].
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4120
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4121
    (sensor := targetView sensor) notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4122
	sensor dropMessage:dropType data:dropValue view:targetView
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4123
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4124
	"
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4125
	 not posted, if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4126
	"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4127
    ]
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4128
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4129
    "Created: 4.4.1997 / 17:59:37 / cg"
1558
e1eb73ed3360 support all DND dropTypes.
Claus Gittinger <cg@exept.de>
parents: 1557
diff changeset
  4130
    "Modified: 6.4.1997 / 14:50:44 / cg"
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4131
!
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4132
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4133
gravityNotifyView:aView
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4134
    "ignored for now"
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4135
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4136
    "/ aView gravityNotify
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4137
!
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4138
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4139
mapRequestView:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4140
    "ignored for now"
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4141
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4142
    "/ aView mapRequest
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4143
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4144
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4145
propertyChangeView:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4146
    "sent when an X property changes.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4147
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4148
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4149
    aView propertyChange
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4150
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4151
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4152
reparentedView:aView
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4153
    "ignored for now"
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4154
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4155
    "/ aView reparented
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4156
!
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4157
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4158
resizeRequestView:aView
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4159
    "ignored for now"
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4160
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4161
    "/ aView resizeRequest
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4162
!
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  4163
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4164
selectionClear:selectionID view:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4165
    "sent when another X-client has created a selection.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4166
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4167
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4168
    "/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4169
    "/ workaround a bug in olvwm: it clears selections
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4170
    "/ on window raise.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4171
    "/ In this case, keep my last own selection.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4172
    "/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4173
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4174
    self setLastCopyBuffer:(self getCopyBuffer).
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4175
    self setCopyBuffer:nil
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4176
1795
Claus Gittinger <cg@exept.de>
parents: 1793
diff changeset
  4177
    "/ noone is interested in that ...
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  4178
    "/ aView selectionClear:selectionID
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4179
!
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4180
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4181
selectionNotify:propertyID target:targetID selection:selectionID from:requestorID view:aView
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4182
    "sent when the server returns an answer from a request for a selection.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4183
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4184
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4185
    |s sensor|
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4186
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4187
    propertyID == 0 ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4188
	"invalid olvwm behavior"
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4189
	s := self getLastCopyBuffer
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4190
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4191
	targetID == self atomIDOfSTRING ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4192
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4193
	     a returned string
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4194
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4195
	    s := self getTextProperty:propertyID from:requestorID.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4196
	    s notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4197
		(s endsWith:Character cr) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4198
		    s := s asStringCollection copyWith:''
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4199
		]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4200
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4201
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4202
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4203
	     a returned object
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4204
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4205
	    s := self getObjectProperty:propertyID from:requestorID.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4206
	].
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4207
    ].
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4208
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4209
    s notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4210
	(sensor := aView sensor) notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4211
	    sensor pasteFromClipBoard:s view:aView
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4212
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4213
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4214
	     if there is no sensor ...
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4215
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4216
	    aView pasteFromClipBoard:s
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  4217
	]
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4218
    ]
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4219
!
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4220
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4221
selectionRequest:propertyID target:targetID selection:selectionID time:t from:windowID view:aView
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4222
    "sent by some other X-client to ask for the selection.
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4223
     This is a very X-specific mechanism."
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4224
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4225
    |o s stream|
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4226
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4227
    targetID == (self atomIDOfLENGTH) ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4228
	"/
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4229
	"/ the other one wants to know the size of our selection ...
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4230
	"/
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4231
	s := self selectionAsString.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4232
	self
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4233
	    setLengthProperty:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4234
	    value:s size 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4235
	    for:windowID.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4236
	self
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4237
	    sendSelectionNotifySelection:selectionID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4238
	    property:propertyID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4239
	    target:targetID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4240
	    time:t
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4241
	    from:aView id
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4242
	    to:windowID.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4243
	^ self
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4244
    ].
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4245
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4246
    (targetID == self atomIDOfSTRING or:[
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4247
     targetID == (self atomIDOf:'COMPOUND_TEXT')]) ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4248
	"/
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4249
	"/ the other view wants the selection as string
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4250
	"/
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4251
	s := self selectionAsString.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4252
	self
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4253
	    sendSelection:s 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4254
	    selection:primaryAtom
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4255
	    property:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4256
	    target:self atomIDOfSTRING "/ targetID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4257
	    time:t
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4258
	    from:windowID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4259
	    to:windowID.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4260
	^ self
1341
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4261
    ].
026bdf39f4ea pasteFromClipboard goes via the sensor,
Claus Gittinger <cg@exept.de>
parents: 1339
diff changeset
  4262
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4263
"/    (targetID == (self atomIDOf:'TARGETS')) ifTrue:[
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4264
"/"/ TODO: implement this to avoid netscape paste-delay.
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4265
"/"/
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4266
"/        ^ self
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4267
"/    ].
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4268
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4269
    (targetID == (self atomIDOf:'ST_OBJECT')) ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4270
	"/
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4271
	"/ send the selection in binaryStore format
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4272
	"/ (assuming, that the other view knows how to handle it)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4273
	"/
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4274
	o := self getCopyBuffer.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4275
	stream := WriteStream on:(ByteArray new:200).
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4276
	o storeBinaryOn:stream.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4277
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4278
	^ self
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4279
	    sendSelection:(stream contents) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4280
	    selection:primaryAtom
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4281
	    property:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4282
	    target:targetID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4283
	    time:t
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4284
	    from:windowID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4285
	    to:windowID
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4286
    ].
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4287
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4288
    "Created: / 17.6.1998 / 19:33:10 / cg"
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4289
    "Modified: / 17.6.1998 / 20:24:40 / cg"
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4290
! !
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4291
86
032006651226 *** empty log message ***
claus
parents: 83
diff changeset
  4292
!XWorkstation methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4293
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4294
defaultEventMask
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4295
    "return a mask to enable some events by default."
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4296
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4297
%{  /* NOCONTEXT */
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4298
    RETURN (__MKSMALLINT( ExposureMask | StructureNotifyMask |
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  4299
			 KeyPressMask | KeyReleaseMask |
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  4300
			 PointerMotionMask |
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  4301
			 EnterWindowMask | LeaveWindowMask |
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  4302
			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
2977
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4303
%}
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4304
!
abdb7cf1635a enable pointerMotion events initially
Claus Gittinger <cg@exept.de>
parents: 2974
diff changeset
  4305
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4306
dispatchEventFor:aViewIdOrNil withMask:eventMask
48194c26a46c Initial revision
claus
parents:
diff changeset
  4307
    "central event handling method:
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4308
     get next event and send appropriate message to the sensor or view.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4309
     If the argument aViewIdOrNil is nil, events for any view are processed,
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4310
     otherwise only events for the view with given id are processed.
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4311
     If the argument aMask is nonNil, only events for this eventMask are
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4312
     handled.
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4313
     WARNING: this may block to wait for an event - you better check for a 
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4314
	      pending event before calling this."
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4315
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4316
    (self getEventFor:aViewIdOrNil withMask:eventMask) ifTrue:[
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4317
	AbortSignal handle:[:ex |
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4318
	    ex return
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4319
	] do:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4320
	    self dispatchLastEvent.
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4321
	]
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4322
    ].
1489
f264f7852a8d avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents: 1486
diff changeset
  4323
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4324
    "Modified: 19.8.1997 / 17:10:42 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4325
!
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4326
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4327
dispatchExposeEventFor:aViewIdOrNil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4328
    "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
  4329
     If the argument aViewIdOrNil is nil, events for any view are processed,
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4330
     otherwise only events for the view with given id are processed.
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4331
     WARNING: this may block to wait for an event - you better check for a 
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  4332
	      pending event before calling this."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4333
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  4334
    self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4335
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  4336
    "Modified: 19.8.1997 / 17:10:26 / cg"
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4337
!
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4338
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4339
dispatchLastEvent
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4340
    |theView symS arg butt sibling 
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4341
     windowID siblingID propertyID selectionID targetID requestorID
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4342
     evTime
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4343
     eventType|
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4344
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4345
%{  /* STACK: 8000 */
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4346
#   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4347
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4348
    Display *dpy;
135
claus
parents: 133
diff changeset
  4349
    OBJ eB;
claus
parents: 133
diff changeset
  4350
    XEvent *ev;
1521
23aacd62bbac care for GC before reaccessing the eventBuffer
Claus Gittinger <cg@exept.de>
parents: 1511
diff changeset
  4351
    int ev_x, ev_y;
135
claus
parents: 133
diff changeset
  4352
claus
parents: 133
diff changeset
  4353
#   define ae ((XAnyEvent *)ev)
claus
parents: 133
diff changeset
  4354
#   define ee ((XExposeEvent *)ev)
claus
parents: 133
diff changeset
  4355
#   define ke ((XKeyPressedEvent *)ev)
claus
parents: 133
diff changeset
  4356
#   define be ((XButtonPressedEvent *)ev)
claus
parents: 133
diff changeset
  4357
#   define ce ((XConfigureEvent *)ev)
claus
parents: 133
diff changeset
  4358
#   define me ((XMotionEvent *)ev)
claus
parents: 133
diff changeset
  4359
#   define ewe ((XEnterWindowEvent *)ev)
claus
parents: 133
diff changeset
  4360
#   define lwe ((XLeaveWindowEvent *)ev)
claus
parents: 133
diff changeset
  4361
#   define de ((XDestroyWindowEvent *)ev)
claus
parents: 133
diff changeset
  4362
#   define ve ((XVisibilityEvent *)ev)
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  4363
#   define mape ((XMappingEvent *)ev)
135
claus
parents: 133
diff changeset
  4364
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4365
    KeySym keySym;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4366
    unsigned char buffer[10];
48194c26a46c Initial revision
claus
parents:
diff changeset
  4367
    int i, nchars;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4368
    char *keySymString;
48194c26a46c Initial revision
claus
parents:
diff changeset
  4369
    char keySymStringBuffer[32];
1832
4faf4cd47962 alpha64 change
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  4370
    unsigned INT nextMultiClickTime;
1223
09d8118c8031 keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  4371
    OBJ upDown, t;
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  4372
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  4373
    struct inlineCache *ipS;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4374
    static struct inlineCache vid = _ILC1;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4375
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4376
    static struct inlineCache expS = _ILC5;
1295
ef93ded3c030 renamed graphicExpose -> graphicsExpose;
Claus Gittinger <cg@exept.de>
parents: 1246
diff changeset
  4377
    static struct inlineCache gexpS = _ILC6;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4378
    static struct inlineCache nexpS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4379
    static struct inlineCache motS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4380
    static struct inlineCache bpS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4381
    static struct inlineCache bmpS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4382
    static struct inlineCache bspS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4383
    static struct inlineCache brS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4384
    static struct inlineCache focInS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4385
    static struct inlineCache focOutS = _ILC1;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4386
    static struct inlineCache peS = _ILC4;
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4387
    static struct inlineCache plS = _ILC2;
54
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4388
    static struct inlineCache termS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4389
    static struct inlineCache savtermS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4390
    static struct inlineCache destrS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4391
    static struct inlineCache unmapS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4392
    static struct inlineCache mapS = _ILC1;
29a6b2f8e042 *** empty log message ***
claus
parents: 46
diff changeset
  4393
    static struct inlineCache confS = _ILC5;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  4394
    static struct inlineCache coveredS = _ILC2;
1543
3887e1b2a7aa prepare drop handling;
Claus Gittinger <cg@exept.de>
parents: 1540
diff changeset
  4395
    static struct inlineCache clientMsg = _ILC5;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4396
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4397
    static struct inlineCache keymap = _ILC0;
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4398
    static struct inlineCache created = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4399
    static struct inlineCache mapReq = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4400
    static struct inlineCache repar = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4401
    static struct inlineCache confReq = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4402
    static struct inlineCache resReq = _ILC1;
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4403
    static struct inlineCache circReq = _ILC1;
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  4404
    static struct inlineCache circNotify = _ILC1;
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4405
    static struct inlineCache gravNotify = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4406
    static struct inlineCache prop = _ILC1;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4407
    static struct inlineCache selClear = _ILC2;
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4408
    static struct inlineCache selReq = _ILC6;
1338
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4409
    static struct inlineCache selNotify = _ILC5;
8df6dbb44883 no more direct messages to the view
Claus Gittinger <cg@exept.de>
parents: 1295
diff changeset
  4410
    static struct inlineCache colormap = _ILC1;
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  4411
    static struct inlineCache mapping = _ILC2;
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  4412
    static struct inlineCache vis = _ILC1;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4413
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4414
    static struct inlineCache skpS = _ILC4;
63
b9d17e2b6c92 keyRelease and more event masks
claus
parents: 55
diff changeset
  4415
    static struct inlineCache skrS = _ILC4;
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4416
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4417
    if (! ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4418
	RETURN (false);
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4419
    }
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4420
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4421
    dpy = myDpy;
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  4422
1210
Claus Gittinger <cg@exept.de>
parents: 1209
diff changeset
  4423
    eB = __INST(eventBuffer);
Claus Gittinger <cg@exept.de>
parents: 1209
diff changeset
  4424
135
claus
parents: 133
diff changeset
  4425
    if (__isByteArray(eB)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4426
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
135
claus
parents: 133
diff changeset
  4427
    } else {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4428
	printf("DISPLAY: no eventBuffer\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4429
	RETURN (false);
135
claus
parents: 133
diff changeset
  4430
    }
claus
parents: 133
diff changeset
  4431
1486
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4432
    /*
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4433
     * very often, its another event for the same view ...
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4434
     * avoid creation & lookup then.
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4435
     */
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4436
    if ((t = __INST(lastId)) != nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4437
	if (__isExternalAddress(t)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4438
	    if (_WindowVal(t) == ae->window) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4439
		theView = __INST(lastView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4440
		if (__isNonNilObject(theView)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4441
		    if (__qClass(theView) == nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4442
			theView = nil;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4443
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4444
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4445
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4446
	}
1486
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4447
    }
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4448
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4449
    if (theView == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4450
	windowID = __MKEXTERNALADDRESS(ae->window);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4451
	theView = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, windowID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4452
	/*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4453
	 * MKEXTERNALADDRESS and/or #viewFromId: could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4454
	 */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4455
	eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4456
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1486
638558d89c66 inlined lastId/lastView check into event handler;
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  4457
    }
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4458
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  4459
    if ((theView == nil) && (ev->type != MappingNotify)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4460
	RETURN (nil);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4461
    }
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4462
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4463
    /*
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4464
     * key, button and pointer events are sent to the sensor,
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4465
     * or (if there is none) to the delegate.
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4466
     * or (if there is none) to the view.
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  4467
     *
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  4468
     * expose events are sent to the sensor,
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  4469
     * or (if there is none) to the view
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
  4470
     *
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4471
     * sensor and delegate get view as additional argument
115
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  4472
     * all of this has been taken out of here to corresponding methods
1d93fd8c5371 *** empty log message ***
claus
parents: 109
diff changeset
  4473
     * in DeviceWorkstation.
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4474
     */
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  4475
206
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4476
#ifdef DEBUG
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4477
    eventType = __MKSMALLINT(ev->type);
4284b80bebdf changed to use ExternalAddress handles for all Window, Font,
Claus Gittinger <cg@exept.de>
parents: 202
diff changeset
  4478
#endif
135
claus
parents: 133
diff changeset
  4479
    switch (ev->type) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4480
	case KeyRelease:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4481
	    symS = @symbol(keyRelease:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4482
	    ipS = &skrS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4483
	    upDown = false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4484
	    goto keyPressAndRelease;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4485
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4486
	case KeyPress:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4487
	    symS = @symbol(keyPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4488
	    ipS = &skpS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4489
	    upDown = true;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4490
	    /* FALL INTO */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4491
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4492
	keyPressAndRelease:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4493
	    __INST(eventRootX) = __MKSMALLINT(ke->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4494
	    __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
  4495
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4496
	    __INST(altDown) = (ke->state & Mod2Mask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4497
	    __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
  4498
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4499
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4500
	    __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
  4501
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4502
	    __INST(shiftDown) = (ke->state & ShiftMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4503
	    __INST(ctrlDown) = (ke->state & ControlMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4504
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4505
	    ev_x = ke->x;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4506
	    ev_y = ke->y;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4507
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4508
	    arg = nil;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4509
	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4510
	    if (nchars 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4511
	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4512
		 || (buffer[0] >= 0x80))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4513
		arg = _MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4514
		keySymString = NULL;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4515
	    } else {
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  4516
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4517
		switch (keySym) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4518
		    case XK_Control_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4519
		    case XK_Control_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4520
			__INST(ctrlDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4521
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4522
		    case XK_Shift_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4523
		    case XK_Shift_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4524
			__INST(shiftDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4525
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4526
		    case XK_Meta_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4527
		    case XK_Meta_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4528
			__INST(metaDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4529
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4530
		    case XK_Alt_L:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4531
		    case XK_Alt_R:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4532
			__INST(altDown) = upDown;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4533
			break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4534
		}
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  4535
#endif
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  4536
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4537
		keySymString = XKeysymToString(keySym);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4538
		if (keySymString) {
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  4539
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4540
		    if (keySymString[0] == 'D') {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4541
			/*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4542
			 * remove underscore, dont want it in symbols
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4543
			 */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4544
			if (strcmp(keySymString, "Delete_line") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4545
			    keySymString = "DeleteLine";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4546
			} else if (strcmp(keySymString, "Delete_word") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4547
			    keySymString = "DeleteWord";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4548
			}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4549
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4550
		    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4551
		     * make names compatible
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4552
		     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4553
		    if (strcmp(keySymString, "Down") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4554
			keySymString = "CursorDown";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4555
		    } else if (strcmp(keySymString, "Up") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4556
			keySymString = "CursorUp";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4557
		    } else if (strcmp(keySymString, "Left") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4558
			keySymString = "CursorLeft";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4559
		    } else if (strcmp(keySymString, "Right") == 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4560
			keySymString = "CursorRight";
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4561
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4562
		    arg = __MKSYMBOL(keySymString, (OBJ *)0);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  4563
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4564
		    arg = __MKSTRING(keySymString);
250
eaa532ebcad7 modifierKeyProcessing now done in DevWorkstat via tables;
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
  4565
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4566
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4567
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4568
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4569
	    if (arg == nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4570
		/* happens sometimes (alt-graph on sun has no keysym) */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4571
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4572
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4573
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4574
	    (*(*ipS).ilc_func)(self, symS, nil, ipS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4575
			       arg, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4576
			       __MKSMALLINT(ev_x), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4577
			       __MKSMALLINT(ev_y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4578
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4579
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4580
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4581
	case ButtonPress:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4582
	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) | (1 << be->button));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4583
	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4584
	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4585
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4586
	    if (__isSmallInteger(__INST(multiClickTimeDelta)))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4587
		nextMultiClickTime = be->time + __intVal(__INST(multiClickTimeDelta));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4588
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4589
		nextMultiClickTime = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4590
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4591
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4592
	    if ((t = __INST(multiClickTime)) != nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4593
		INT _multiClickTime;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4594
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4595
		_multiClickTime = __longIntVal(t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4596
		if (be->time < _multiClickTime) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4597
		    __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4598
		    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4599
		     * MKUINT could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4600
		     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4601
		    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4602
		    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4603
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4604
		    ipS = &bmpS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4605
		    symS = @symbol(buttonMultiPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4606
		    goto sendButtonEvent;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4607
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4608
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4609
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4610
	    __INST(multiClickTime) = t = __MKUINT(nextMultiClickTime); __STORE(self, t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4611
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4612
	     * MKUINT could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4613
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4614
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4615
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1223
09d8118c8031 keep nextMultiClickTime on a per-display basis
Claus Gittinger <cg@exept.de>
parents: 1214
diff changeset
  4616
1010
b8576573e6aa no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 1008
diff changeset
  4617
#ifdef NO_LONGER
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4618
	    if (be->state & ShiftMask) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4619
		ipS = &bspS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4620
		symS = @symbol(buttonShiftPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4621
		goto sendButtonEvent;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4622
	    }
1010
b8576573e6aa no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 1008
diff changeset
  4623
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4624
	    ipS = &bpS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4625
	    symS = @symbol(buttonPress:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4626
	    goto sendButtonEvent;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4627
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4628
	    /* NOT REACHED */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4629
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4630
	case ButtonRelease:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4631
	    __INST(buttonsPressed) = __MKSMALLINT(__intVal(__INST(buttonsPressed)) & ~(1 << be->button));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4632
	    __INST(eventRootX) = __MKSMALLINT(be->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4633
	    __INST(eventRootY) = __MKSMALLINT(be->y_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4634
	    ipS = &brS;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4635
	    symS = @symbol(buttonRelease:x:y:view:);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4636
	    /* fall into */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4637
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4638
	sendButtonEvent:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4639
	    butt = __MKSMALLINT(be->button);
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  4640
#ifdef NOTDEF
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4641
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4642
	     * this allows operation with single button mouses: meta-click is always Button 2
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4643
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4644
	    if (__INST(metaDown) == true)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4645
		butt = __MKSMALLINT(2);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4646
	    else 
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4647
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4648
		butt = __AT_(__INST(buttonTranslation), butt);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4649
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4650
	     * #at: could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4651
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4652
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4653
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4654
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4655
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4656
	    (*(*ipS).ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4657
			       symS, nil, ipS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4658
			       butt, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4659
			       __MKSMALLINT(ke->x), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4660
			       __MKSMALLINT(ke->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4661
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4662
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4663
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4664
	case MotionNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4665
	    if (__INST(motionEventCompression) != false) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4666
		while (XCheckWindowEvent(dpy, me->window, ANYBUTTON, ev)) ;;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4667
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4668
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4669
	    __INST(eventRootX) = __MKSMALLINT(me->x_root);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4670
	    __INST(eventRootY) = __MKSMALLINT(me->y_root);
70
3cb3992ead10 *** empty log message ***
claus
parents: 66
diff changeset
  4671
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  4672
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4673
	    __INST(altDown) = (me->state & Mod2Mask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4674
	    __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
  4675
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4676
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4677
	    __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
  4678
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4679
	    __INST(shiftDown) = (me->state & ShiftMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4680
	    __INST(ctrlDown) = (me->state & ControlMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4681
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4682
	    (*motS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4683
			     @symbol(buttonMotion:x:y:view:), nil, &motS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4684
			     __MKSMALLINT(me->state),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4685
			     __MKSMALLINT(me->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4686
			     __MKSMALLINT(me->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4687
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4688
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4689
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4690
	case FocusIn:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4691
	    (*focInS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4692
			       @symbol(focusInView:), nil, &focInS, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4693
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4694
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4695
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4696
	case FocusOut:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4697
	    (*focOutS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4698
				@symbol(focusOutView:), nil, &focOutS, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4699
				theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4700
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4701
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4702
	case EnterNotify:
240
bdbab643c0e7 allow change of the Alt- and Meta modifiermasks
Claus Gittinger <cg@exept.de>
parents: 235
diff changeset
  4703
#ifdef OLD
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4704
	    __INST(altDown) = (ewe->state & Mod2Mask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4705
	    __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
  4706
#else
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4707
	    __INST(altDown) = (ke->state & __intVal(__INST(altModifierMask))) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4708
	    __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
  4709
#endif
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4710
	    __INST(shiftDown) = (ewe->state & ShiftMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4711
	    __INST(ctrlDown) = (ewe->state & ControlMask) ? true : false;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4712
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4713
	    (*peS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4714
			    @symbol(pointerEnter:x:y:view:), nil, &peS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4715
			    __MKSMALLINT(ewe->state),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4716
			    __MKSMALLINT(ewe->x), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4717
			    __MKSMALLINT(ewe->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4718
			    theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4719
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4720
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4721
	case LeaveNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4722
	    (*plS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4723
			    @symbol(pointerLeave:view:), nil, &plS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4724
			    __MKSMALLINT(lwe->state), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4725
			    theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4726
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4727
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4728
	case GraphicsExpose:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4729
	    (*gexpS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4730
			      @symbol(graphicsExposeX:y:width:height:final:view:), nil, &gexpS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4731
			      __MKSMALLINT(ee->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4732
			      __MKSMALLINT(ee->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4733
			      __MKSMALLINT(ee->width),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4734
			      __MKSMALLINT(ee->height),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4735
			      ee->count == 0 ? true : false,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4736
			      theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4737
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4738
	    if (ee->count != 0) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4739
		break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4740
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4741
	    /* fall into */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4742
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4743
	case NoExpose:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4744
	    (*nexpS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4745
			      @symbol(noExposeView:), nil, &nexpS, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4746
			      theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4747
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4748
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4749
	case Expose:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4750
	    (*expS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4751
			     @symbol(exposeX:y:width:height:view:), nil, &expS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4752
			     __MKSMALLINT(ee->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4753
			     __MKSMALLINT(ee->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4754
			     __MKSMALLINT(ee->width),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4755
			     __MKSMALLINT(ee->height),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4756
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4757
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4758
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4759
	case ConfigureNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4760
	    if (ce->above != None) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4761
		siblingID = __MKEXTERNALADDRESS(ce->above);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4762
		sibling = (*vid.ilc_func)(self, @symbol(viewFromId:), nil, &vid, siblingID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4763
		/*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4764
		 * MKEXTERNALADDRESS or #viewFromId: could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4765
		 */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4766
		eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4767
		ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4768
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4769
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4770
	    (*confS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4771
			     @symbol(configureX:y:width:height:view:), nil, &confS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4772
			     __MKSMALLINT(ce->x),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4773
			     __MKSMALLINT(ce->y),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4774
			     __MKSMALLINT(ce->width),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4775
			     __MKSMALLINT(ce->height),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4776
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4777
	    if (sibling != nil) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4778
		(*coveredS.ilc_func)(self,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4779
				    @symbol(coveredBy:view:), nil, &coveredS,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4780
				    theView,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4781
				    sibling);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4782
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4783
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4784
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4785
	case ClientMessage:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4786
	    if (ev->xclient.message_type == (int) _AtomVal(__INST(protocolsAtom))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4787
		if ((ev->xclient.data.l[0] == (int) _AtomVal(__INST(quitAppAtom)))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4788
		 || (ev->xclient.data.l[0] == (int) _AtomVal(__INST(deleteWindowAtom)))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4789
		    (*termS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4790
				      @symbol(terminateView:), nil, &termS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4791
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4792
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4793
		if (ev->xclient.data.l[0] == (int) _AtomVal(__INST(saveYourselfAtom))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4794
		    (*savtermS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4795
					 @symbol(saveAndTerminateView:)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4796
					 , nil, &savtermS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4797
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4798
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4799
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4800
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4801
	     * any other client message
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4802
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4803
	    i = (char *)(&(ev->xclient.data)) - (char *)ev;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4804
	    (*clientMsg.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4805
				 @symbol(clientMessage:type:format:dataOffset:view:)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4806
				 , nil, &clientMsg 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4807
				 , __INST(eventBuffer)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4808
				 ,__MKSMALLINT(ev->xclient.message_type)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4809
				 ,__MKSMALLINT(ev->xclient.format)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4810
				 ,__MKSMALLINT(i), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4811
				 theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4812
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4813
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4814
	case DestroyNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4815
	    (*destrS.ilc_func)(self, @symbol(destroyedView:)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4816
			       , nil, &destrS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4817
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4818
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4819
	case UnmapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4820
	    (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4821
			       , nil, &unmapS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4822
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4823
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4824
	case MapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4825
	    (*mapS.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4826
			     @symbol(mappedView:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4827
			     , nil, &mapS, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4828
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4829
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4830
	case KeymapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4831
	    (*keymap.ilc_func)(theView, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4832
			       @symbol(keyMapChange) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4833
			       , nil, &keymap);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4834
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4835
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4836
	case VisibilityNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4837
	    switch (ve->state) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4838
		case VisibilityUnobscured:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4839
		    arg = @symbol(unobscured);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4840
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4841
		case VisibilityPartiallyObscured:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4842
		    arg = @symbol(partiallyObscured);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4843
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4844
		case VisibilityFullyObscured:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4845
		    arg = @symbol(fullyObscured);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4846
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4847
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4848
	    (*vis.ilc_func)(theView, @symbol(visibilityChange:), nil, &vis, arg);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4849
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4850
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4851
	case CreateNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4852
	    (*created.ilc_func)(self, @symbol(createdView:), nil, &created, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4853
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4854
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4855
	case MapRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4856
	    (*mapReq.ilc_func)(self, @symbol(mapRequestView:), nil, &mapReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4857
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4858
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4859
	case ReparentNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4860
	    (*repar.ilc_func)(self, @symbol(reparentedView:), nil, &repar, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4861
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4862
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4863
	case ConfigureRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4864
	    (*confReq.ilc_func)(self, @symbol(configureRequestView:), nil, &confReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4865
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4866
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4867
	case GravityNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4868
	    (*gravNotify.ilc_func)(self, @symbol(gravityNotifyView:), nil, &resReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4869
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4870
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4871
	case ResizeRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4872
	    (*resReq.ilc_func)(self, @symbol(resizeRequestView:), nil, &resReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4873
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4874
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4875
	case CirculateNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4876
	    (*circNotify.ilc_func)(self, @symbol(circulateNotifyView:), nil, &circNotify, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4877
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4878
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4879
	case CirculateRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4880
	    (*circReq.ilc_func)(self, @symbol(circulateRequestView:), nil, &circReq, theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4881
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4882
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4883
	case PropertyNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4884
	    (*prop.ilc_func)(self, 
3146
bf7e27673865 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3131
diff changeset
  4885
			     @symbol(propertyChangeView:) 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4886
			     , nil, &prop,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4887
			     theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4888
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4889
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4890
	case SelectionClear:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4891
	    selectionID = __MKATOMOBJ(ev->xselectionclear.selection);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4892
	    (*selClear.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4893
				 @symbol(selectionClear:view:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4894
				 , nil, &selClear,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4895
				 selectionID,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4896
				 theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4897
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4898
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4899
	case SelectionNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4900
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4901
	     * returned selection value (answer from SelectionRequest)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4902
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4903
	    DPRINTF(("SelectionNotify prop=%x target=%x selection= %x requestor=%x\n", 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4904
			ev->xselection.property, ev->xselection.target,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4905
			ev->xselection.selection, ev->xselection.requestor));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4906
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4907
	    {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4908
		INT _property = ev->xselection.property;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4909
		INT _target = ev->xselection.target;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4910
		INT _selection = ev->xselection.selection;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4911
		INT _requestor = ev->xselection.requestor;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4912
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4913
		propertyID = __MKATOMOBJ(_property);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4914
		targetID = __MKATOMOBJ(_target);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4915
		selectionID = __MKATOMOBJ(_selection);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4916
		requestorID = __MKEXTERNALADDRESS(_requestor);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4917
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4918
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4919
	     * MKATOMOBJ/MKEXTERNALADDRESS could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4920
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4921
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4922
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4923
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4924
	    (*selNotify.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4925
				  @symbol(selectionNotify:target:selection:from:view:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4926
				  , nil, &selNotify,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4927
				  propertyID, targetID, selectionID, requestorID,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4928
				  theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4929
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4930
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4931
	case SelectionRequest:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4932
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4933
	     * someone wants the selection
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4934
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4935
	    DPRINTF(("SelectionRequest prop=%x target=%x selection=%x requestor=%x\n", 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4936
			ev->xselectionrequest.property,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4937
			ev->xselectionrequest.target,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4938
			ev->xselectionrequest.selection,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4939
			ev->xselectionrequest.requestor));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4940
	    {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4941
		INT _property = ev->xselectionrequest.property;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4942
		INT _target = ev->xselectionrequest.target;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4943
		INT _selection = ev->xselectionrequest.selection;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4944
		INT _requestor = ev->xselectionrequest.requestor;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4945
		INT _t = ev->xselectionrequest.time;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4946
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4947
		propertyID = __MKATOMOBJ(_property);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4948
		targetID = __MKATOMOBJ(_target);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4949
		selectionID = __MKATOMOBJ(_selection);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4950
		requestorID = __MKEXTERNALADDRESS(_requestor);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4951
		evTime = __MKEXTERNALADDRESS(_t);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4952
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4953
	    /*
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4954
	     * MKATOMOBJ/MKEXTERNALADDR could lead to a GC - refetch event ptr
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4955
	     */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4956
	    eB = __INST(eventBuffer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4957
	    ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4958
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4959
	    (*selReq.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4960
			       @symbol(selectionRequest:target:selection:time:from:view:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4961
			       , nil, &selReq,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4962
			       propertyID, targetID, selectionID, evTime, requestorID,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4963
			       theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4964
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4965
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4966
	case ColormapNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4967
	    (*colormap.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4968
				 @symbol(colorMapChangeView:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4969
				 , nil, &colormap,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4970
				 theView);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4971
	    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4972
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4973
	case MappingNotify:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4974
	    switch(mape->request) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4975
		case MappingModifier:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4976
		    arg = @symbol(mappingModifier);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4977
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4978
		case MappingKeyboard:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4979
		    arg = @symbol(mappingKeyboard);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4980
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4981
		case MappingPointer:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4982
		    arg = @symbol(mappingPointer);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4983
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4984
		default:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4985
		    arg = nil;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4986
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4987
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4988
	    (*mapping.ilc_func)(self, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4989
				@symbol(mappingChanged:event:) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4990
				, nil, &mapping, arg, eB);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  4991
	    break;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4992
    }
135
claus
parents: 133
diff changeset
  4993
#undef ae
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  4994
#undef ee
48194c26a46c Initial revision
claus
parents:
diff changeset
  4995
#undef ke
48194c26a46c Initial revision
claus
parents:
diff changeset
  4996
#undef be
48194c26a46c Initial revision
claus
parents:
diff changeset
  4997
#undef ce
48194c26a46c Initial revision
claus
parents:
diff changeset
  4998
#undef me
48194c26a46c Initial revision
claus
parents:
diff changeset
  4999
#undef ewe
48194c26a46c Initial revision
claus
parents:
diff changeset
  5000
#undef lwe
48194c26a46c Initial revision
claus
parents:
diff changeset
  5001
#undef de
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5002
#undef mape
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  5003
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5004
    ^ true
48194c26a46c Initial revision
claus
parents:
diff changeset
  5005
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  5006
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5007
dispatchPendingEvents
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5008
    "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
  5009
     (i.e. this is now only used in the modal debugger)
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5010
     Dispatch any pending events; return when no more are pending.
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5011
     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
  5012
     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
  5013
     we only handle exposes until the graphicsExpose arrives.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5014
     Other systems may not need such a kludge"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5015
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  5016
    "interested in exposes only ?"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5017
    dispatchingExpose notNil ifTrue:[
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5018
	[self exposeEventPendingFor:dispatchingExpose withSync:false] whileTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5019
	    self dispatchExposeEventFor:dispatchingExpose
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5020
	].
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5021
	^ self
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5022
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5023
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5024
    [self eventPendingWithSync:false] whileTrue:[
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5025
	(self getEventFor:nil withMask:nil) ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5026
	    AbortSignal handle:[:ex |
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5027
		ex return
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5028
	    ] do:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5029
		self dispatchLastEvent
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5030
	    ]
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  5031
	].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5032
    ]
1489
f264f7852a8d avoid creation of a block for every event when a
Claus Gittinger <cg@exept.de>
parents: 1486
diff changeset
  5033
1871
a8e7a9b8923b comments
Claus Gittinger <cg@exept.de>
parents: 1848
diff changeset
  5034
    "Modified: 19.8.1997 / 17:11:18 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5035
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5036
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5037
disposeEventsWithMask:aMask for:aWindowIdOrNil
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5038
    "dispose (throw away) specific events. If aWindowId is nil,
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5039
     events matching the mask are thrown away regardless of which
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5040
     view they are for. Otherwise, only matching events for that 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5041
     view are flushed."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5042
48194c26a46c Initial revision
claus
parents:
diff changeset
  5043
%{  /* NOCONTEXT */
48194c26a46c Initial revision
claus
parents:
diff changeset
  5044
48194c26a46c Initial revision
claus
parents:
diff changeset
  5045
    XEvent ev;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5046
    Window win;
48194c26a46c Initial revision
claus
parents:
diff changeset
  5047
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5048
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5049
     && __isSmallInteger(aMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5050
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5051
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5052
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5053
	if (__isExternalAddress(aWindowIdOrNil)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5054
	    win = _WindowVal(aWindowIdOrNil);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5055
	    while (XCheckWindowEvent(dpy, win, __intVal(aMask), &ev)) ;;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5056
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5057
	    while (XCheckMaskEvent(dpy, __intVal(aMask), &ev)) ;;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5058
	}
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5059
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5060
	RETURN ( self );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5061
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  5062
%}.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5063
    self primitiveFailed
48194c26a46c Initial revision
claus
parents:
diff changeset
  5064
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  5065
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5066
eventMaskFor:anEventSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5067
    "return the eventMask bit-constant corresponding to an event symbol"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5068
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5069
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5070
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5071
    int m = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5072
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5073
    if (anEventSymbol == @symbol(keyPress)) m = KeyPressMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5074
    else if (anEventSymbol == @symbol(keyRelease)) m = KeyReleaseMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5075
    else if (anEventSymbol == @symbol(buttonPress)) m = ButtonPressMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5076
    else if (anEventSymbol == @symbol(buttonRelease)) m = ButtonReleaseMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5077
    else if (anEventSymbol == @symbol(buttonMotion)) m = ButtonMotionMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5078
    else if (anEventSymbol == @symbol(pointerMotion)) m = PointerMotionMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5079
    else if (anEventSymbol == @symbol(expose)) m = ExposureMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5080
    else if (anEventSymbol == @symbol(focusChange)) m = FocusChangeMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5081
    else if (anEventSymbol == @symbol(enter)) m = EnterWindowMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5082
    else if (anEventSymbol == @symbol(leave)) m = LeaveWindowMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5083
    else if (anEventSymbol == @symbol(keymapState)) m = KeymapStateMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5084
    else if (anEventSymbol == @symbol(visibilityChange)) m = VisibilityChangeMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5085
    else if (anEventSymbol == @symbol(structureNotify)) m = StructureNotifyMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5086
    else if (anEventSymbol == @symbol(resizeRedirect)) m = ResizeRedirectMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5087
    else if (anEventSymbol == @symbol(propertyChange)) m = PropertyChangeMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5088
    else if (anEventSymbol == @symbol(colormapChange)) m = ColormapChangeMask;
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  5089
    RETURN (__MKSMALLINT(m));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5090
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5091
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5092
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5093
eventPending
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  5094
    "return true, if any event is pending. 
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  5095
     This looks for both the internal queue and the display connection."
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5096
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  5097
    "/ ConservativeSync is required for some Xlib implementation,
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  5098
    "/ where eventPending returns wrong if we do not flush the buffer.
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  5099
    "/ (especially Win32 & Xlib)
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  5100
2594
0b1a2d11b658 oops - win32 ConservativeSync
Claus Gittinger <cg@exept.de>
parents: 2592
diff changeset
  5101
    ConservativeSync == true ifTrue:[self sync].
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5102
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5103
    dispatchingExpose notNil ifTrue:[
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
  5104
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5105
    ].
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5106
    ^ self eventPendingWithSync:false
2592
43cd99949614 need sync before asking for pending event on WIN32 systems.
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  5107
2594
0b1a2d11b658 oops - win32 ConservativeSync
Claus Gittinger <cg@exept.de>
parents: 2592
diff changeset
  5108
    "Modified: / 28.4.1999 / 11:08:12 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5109
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  5110
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5111
eventPending:anEventSymbol for:aWindowIdOrNil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5112
    "return true, if a specific event is pending"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5113
404
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5114
    ^ 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
  5115
!
0db38d8283a4 removed implicit XSync calls - optionally perform conservative XSync if classvar says so
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
  5116
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5117
eventPendingWithSync:doSync
7
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  5118
    "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
  5119
     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
  5120
     before checking."
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5121
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5122
%{  /* UNLIMITEDSTACK */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5123
    OBJ rslt = false;
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5124
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  5125
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5126
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5127
2132
7be8ef8e6f2d XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  5128
	if (XEventsQueued(dpy, QueuedAlready)) {
7be8ef8e6f2d XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  5129
	    RETURN (true);
7be8ef8e6f2d XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  5130
	}
7be8ef8e6f2d XEventsQueued needs no timeout check (it never blocks)
Claus Gittinger <cg@exept.de>
parents: 2105
diff changeset
  5131
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5132
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5133
	if (doSync == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5134
	    XSync(dpy, 0);      /* make certain everything is flushed */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5135
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5136
	if (XPending(dpy)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5137
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5138
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5139
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5140
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5141
    RETURN ( rslt );
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5142
%}
48194c26a46c Initial revision
claus
parents:
diff changeset
  5143
!
48194c26a46c Initial revision
claus
parents:
diff changeset
  5144
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5145
eventQueued
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5146
    "return true, if any event is queued"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5147
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5148
    dispatchingExpose notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5149
	^ self exposeEventPendingFor:dispatchingExpose withSync:false
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5150
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5151
    ^ self eventQueuedAlready
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5152
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5153
    "Created: 12.12.1995 / 21:43:00 / stefan"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5154
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5155
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5156
eventQueuedAlready
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5157
    "return true, if any event is queued internally.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5158
     (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
  5159
      nextEvent calls AND whenever drawing is done and events are pending on
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5160
      the display connection)."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5161
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5162
%{  /* UNLIMITEDSTACK */
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5163
    OBJ rslt = false;
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5164
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5165
    if (ISCONNECTED) {
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5166
	/* ENTER ... LEAVE not needed; XEventsQueued will not block */
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5167
	/* ENTER_XLIB(); */
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5168
	if (XEventsQueued(myDpy, QueuedAlready)) {
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5169
	    rslt = true;
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5170
	}
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  5171
	/* LEAVE_XLIB(); */
2952
b86deefe21c9 Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents: 2905
diff changeset
  5172
    }
b86deefe21c9 Return the correct result in #eventQueuedAlready.
Claus Gittinger <cg@exept.de>
parents: 2905
diff changeset
  5173
    RETURN ( rslt );
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5174
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5175
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  5176
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5177
eventsPending:anEventMask for:aWindowIdOrNil withSync:doSync
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5178
    "return true, if any of the masked events is pending"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5179
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5180
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5181
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5182
    XEvent ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5183
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5184
    int thereIsOne;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5185
    OBJ rslt = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5186
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5187
    if (ISCONNECTED && __isSmallInteger(anEventMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5188
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5189
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5190
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5191
	if (doSync == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5192
	    XSync(dpy, 0);      /* make certain everything is flushed */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5193
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5194
	if (__isExternalAddress(aWindowIdOrNil)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5195
	    win = _WindowVal(aWindowIdOrNil);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5196
	    thereIsOne = XCheckWindowEvent(dpy, win, __intVal(anEventMask), &ev);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5197
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5198
	    thereIsOne = XCheckMaskEvent(dpy, __intVal(anEventMask), &ev);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5199
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5200
	if (thereIsOne) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5201
	    XPutBackEvent(dpy, &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5202
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5203
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5204
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5205
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5206
    RETURN ( rslt );
295
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5210
exposeEventPendingFor:aWindowIdOrNil withSync:doSync
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  5211
    "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
  5212
     or any view (if the arg is nil).
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  5213
     This is an X specific, only required after a scroll operation."
7
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  5214
12
9f0995fac1fa *** empty log message ***
claus
parents: 7
diff changeset
  5215
%{  /* UNLIMITEDSTACK */
7
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  5216
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  5217
    XEvent ev;
9b4a00211ca5 last version before dispatch change
claus
parents: 6
diff changeset
  5218
    Window win;
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5219
    int thereIsOne;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5220
    OBJ rslt = false;
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5221
150
5d0b9d669832 *** empty log message ***
claus
parents: 146
diff changeset
  5222
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5223
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5224
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5225
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5226
	if (doSync == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5227
	    XSync(dpy, 0);      /* make certain everything is flushed */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5228
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5229
	if (__isExternalAddress(aWindowIdOrNil)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5230
	    win = _WindowVal(aWindowIdOrNil);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5231
	    thereIsOne = XCheckWindowEvent(dpy, win, ExposureMask, &ev);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5232
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5233
	    thereIsOne = XCheckMaskEvent(dpy, ExposureMask, &ev);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5234
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5235
	if (thereIsOne) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5236
	    XPutBackEvent(dpy, &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5237
	    rslt = true;
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5238
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5239
	LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5240
    }
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5241
    RETURN ( rslt );
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5242
%}
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5243
!
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5244
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5245
getEventFor:aViewIdOrNil withMask:eventMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5246
    "read next event - put into local eventBuffer. 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5247
     If aViewIdOrNil is nil, events for any view are fetched; 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5248
     otherwise only events for that specific view will be fetched.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5249
     Returns true, if there was an event, false otherwise.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5250
     This method may block - so you better check for pending events
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5251
     before calling for it.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5252
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5253
     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
  5254
     handle method to allow unlimitedstack here.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5255
     (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
  5256
     dispatchLastEvent, since it dispatches out into ST-methods.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5257
    "
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5258
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5259
%{  /* UNLIMITEDSTACK */
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
  5260
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  5261
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5262
    Window win, wWanted;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5263
    int evMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5264
    OBJ eB;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5265
    XEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5266
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5267
    if (! ISCONNECTED) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5268
	RETURN (false);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5269
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5270
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  5271
    dpy = myDpy;
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  5272
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  5273
    eB = __INST(eventBuffer);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5274
    if (__isByteArray(eB)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5275
	ev = (XEvent *)(__ByteArrayInstPtr(eB)->ba_element);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5276
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5277
	printf("DISPLAY: no eventBuffer\n");
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5278
	RETURN (false);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5279
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5280
    ev->type = 0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5281
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5282
    if (__isSmallInteger(eventMask)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5283
	evMask = __intVal(eventMask);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5284
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5285
	evMask = ~0;
295
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
    if (__isExternalAddress(aViewIdOrNil)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5289
	wWanted = _WindowVal(aViewIdOrNil);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5290
	if (XCheckWindowEvent(dpy, wWanted, evMask, ev)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5291
	    RETURN ( true );
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5292
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5293
    } else {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5294
	if (evMask == ~0) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5295
	    XNextEvent(dpy, ev);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5296
	    RETURN (true);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5297
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5298
	if (XCheckMaskEvent(dpy, evMask, ev)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5299
	   RETURN (true);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5300
	}
295
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
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5304
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5305
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5306
handleAllEvents
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5307
    "from now on, handle any kind of event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5308
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5309
    dispatchingExpose := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5310
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5311
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5312
handleExposeOnlyFor:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5313
    "from now on, handle expose events only"
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
    dispatchingExpose := aView id
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5316
!
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5317
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5318
mappingChanged:what event:eB
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5319
    "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
  5320
     Tell xlib about the fact."
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5321
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5322
    (what == #mappingKeyboard or:[what == #mappingModifier]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5323
	self refreshKeyboardMapping:eB.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5324
	"Maybe some of our modifiers have been changed"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5325
	self initializeModifierMappings.
288
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5326
    ].
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5327
5d49b00f2bad changes for modifierMappings from stefan
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
  5328
    "Created: 1.12.1995 / 16:28:23 / stefan"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5329
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5330
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5331
setEventMask:aMask in:aWindowId
320
b7b8dc88fe9f interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  5332
    "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
  5333
     is the bitwise or of the eventMask bits (see 'eventMaskFor:')"
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
%{  /* NOCONTEXT */
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
    int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5338
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5339
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  5340
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5341
     && __isSmallInteger(aMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5342
	mask = __intVal(aMask);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5343
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5344
#ifdef OLD
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5345
	/* these may not be disabled */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5346
	mask |= ExposureMask | StructureNotifyMask |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5347
		KeyPressMask | KeyReleaseMask |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5348
		EnterWindowMask | LeaveWindowMask |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5349
		ButtonPressMask | ButtonMotionMask | ButtonReleaseMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5350
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5351
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5352
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5353
	XSelectInput(myDpy, _WindowVal(aWindowId), mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5354
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5355
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5356
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  5357
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5358
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5359
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5360
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5361
startDispatch
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5362
    "redefined to clear dispatchingExpose, which is a special X feature"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5363
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5364
    dispatching ifTrue:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5365
    dispatchingExpose := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5366
    super startDispatch
0
48194c26a46c Initial revision
claus
parents:
diff changeset
  5367
! !
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5368
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5369
!XWorkstation methodsFor:'event sending'!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5370
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5371
sendClientEvent:msgType format:msgFormat to:targetWindowID data1:d1 data2:d2 data3:d3 data4:d4 data5:d5
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5372
    "send a ClientMessage to some other (possibly: non-ST/X) view.
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5373
     The client message gets message_type and msgFormat as specified by
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5374
     the arguments. The additional data arguments specify up to
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5375
     5 longWords of user data; each may be an integer or nil.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5376
     It is passed transparently in the events data field.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5377
     See XProtocol specification for more details."
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5378
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5379
    "/ Event.xclient.type              = ClientMessage;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5380
    "/ Event.xclient.display           = dpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5381
    "/ Event.xclient.message_type      = msgType;
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5382
    "/ Event.xclient.format            = msgFormat;
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5383
    "/ Event.xclient.window            = targetWindowID;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5384
    "/ Event.xclient.data.l[0]         = d1
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5385
    "/ Event.xclient.data.l[1]         = d2
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5386
    "/ Event.xclient.data.l[2]         = d3
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5387
    "/ Event.xclient.data.l[3]         = d4
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5388
    "/ Event.xclient.data.l[4]         = d5
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5389
    "/
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5390
    "/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5391
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5392
%{  /* NOCONTEXT */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5393
    int type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5394
    int state;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5395
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5396
    if (ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5397
     && __isInteger(msgType)
1567
71215c933fd9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1566
diff changeset
  5398
     && __isInteger(msgFormat)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5399
     && (__isExternalAddress(targetWindowID) || __isInteger(targetWindowID))) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5400
	Display *dpy = myDpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5401
	XEvent ev;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5402
	Status result;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5403
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5404
	if (__isInteger(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5405
	    ev.xclient.data.l[0] = __longIntVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5406
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5407
	    if (__isExternalAddress(d1)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5408
		ev.xclient.data.l[0] = (int)__externalAddressVal(d1);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5409
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5410
		ev.xclient.data.l[0] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5411
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5412
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5413
	if (__isInteger(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5414
	    ev.xclient.data.l[1] = __longIntVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5415
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5416
	    if (__isExternalAddress(d2)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5417
		ev.xclient.data.l[1] = (int)__externalAddressVal(d2);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5418
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5419
		ev.xclient.data.l[1] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5420
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5421
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5422
	if (__isInteger(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5423
	    ev.xclient.data.l[2] = __longIntVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5424
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5425
	    if (__isExternalAddress(d3)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5426
		ev.xclient.data.l[2] = (int)__externalAddressVal(d3);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5427
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5428
		ev.xclient.data.l[2] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5429
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5430
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5431
	if (__isInteger(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5432
	    ev.xclient.data.l[3] = __longIntVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5433
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5434
	    if (__isExternalAddress(d4)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5435
		ev.xclient.data.l[3] = (int)__externalAddressVal(d4);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5436
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5437
		ev.xclient.data.l[3] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5438
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5439
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5440
	if (__isInteger(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5441
	    ev.xclient.data.l[4] = __longIntVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5442
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5443
	    if (__isExternalAddress(d5)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5444
		ev.xclient.data.l[4] = (int)__externalAddressVal(d5);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5445
	    } else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5446
		ev.xclient.data.l[4] = 0;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5447
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5448
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5449
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5450
	if (__isExternalAddress(targetWindowID)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5451
	    ev.xclient.window = _WindowVal(targetWindowID);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5452
	} else {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5453
	    ev.xclient.window = (Window)__longIntVal(targetWindowID);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5454
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5455
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5456
	ev.xclient.type              = ClientMessage;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5457
	ev.xclient.display           = dpy;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5458
	ev.xclient.message_type      = __longIntVal(msgType);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5459
	ev.xclient.format            = __longIntVal(msgFormat);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5460
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5461
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5462
	result = XSendEvent(dpy, ev.xclient.window, True, NoEventMask , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5463
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5464
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5465
	if ((result == BadValue) || (result == BadWindow)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5466
	    DPRINTF(("bad status in sendClientEvent\n"));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5467
	    RETURN ( false )
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5468
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  5469
	RETURN (true)
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5470
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5471
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5472
    self primitiveFailed.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5473
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5474
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  5475
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5476
sendKeyOrButtonEvent:typeSymbol x:xPos y:yPos keyOrButton:keySymCodeOrButtonNr state:stateMask toViewId:targetId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5477
    "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
  5478
     TypeSymbol must be one of: #keyPress, #keyRelease, #buttonPress , #buttonRelease.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5479
     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
  5480
     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
  5481
     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
  5482
     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
  5483
     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
  5484
     (not very user friendly)"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5485
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5486
%{  /* NOCONTEXT */
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5487
    int type;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5488
    int state;
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5489
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5490
    if (__isSmallInteger(stateMask)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5491
	state = __intVal(stateMask);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5492
    } else {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5493
	state = 0;
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5494
    }
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5495
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5496
    if (ISCONNECTED
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5497
     && __isSmallInteger(xPos) && __isSmallInteger(yPos)
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5498
     && (__isSmallInteger(keySymCodeOrButtonNr) || __isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr))
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5499
     && (__isExternalAddress(targetId) || __isInteger(targetId))) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5500
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5501
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5502
	XEvent ev;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5503
	Window target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5504
	Status result;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5505
	KeySym keySym, *syms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5506
	int screen = __intVal(__INST(screen));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5507
	char s[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5508
	int nSyms;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5509
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5510
	if ((typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5511
	 || (typeSymbol == @symbol(keyRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5512
	    if (__isSymbol(keySymCodeOrButtonNr) || __isString(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5513
		keySym = XStringToKeysym(__stringVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5514
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5515
		if (__isCharacter(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5516
		    s[0] = __intVal(__characterVal(keySymCodeOrButtonNr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5517
		    s[1] = '\0';
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5518
		    keySym = XStringToKeysym(s);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5519
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5520
		    keySym = (KeySym) __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5521
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5522
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5523
	    ev.xkey.keycode = XKeysymToKeycode(dpy, keySym);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5524
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5525
	    if (stateMask == nil) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5526
		/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5527
		 * get the modifier from the keySym
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5528
		 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5529
		nSyms = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5530
		syms = XGetKeyboardMapping(dpy, ev.xkey.keycode, 1, &nSyms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5531
		if (syms) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5532
		    int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5533
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5534
		    for (i=0; i<nSyms; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5535
			if (syms[i] == keySym) {
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5536
#ifdef MODIFIERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5537
			    printf("modifier-index is %d\n", i);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  5538
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5539
			    if (i) state = (1 << (i-1));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5540
			    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5541
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5542
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5543
		    XFree(syms);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5544
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5545
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5546
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5547
	    if ((typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5548
	     || (typeSymbol == @symbol(buttonRelease))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5549
		if (__isSmallInteger(keySymCodeOrButtonNr)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5550
		    ev.xbutton.button = __intVal(keySymCodeOrButtonNr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5551
		} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5552
		    ev.xbutton.button = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5553
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5554
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5555
		DPRINTF(("invalid sendEvent typeSymbol\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5556
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5557
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5558
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5559
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5560
	if (typeSymbol == @symbol(keyPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5561
	    ev.xany.type = KeyPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5562
	else if (typeSymbol == @symbol(keyRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5563
	    ev.xany.type = KeyRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5564
	else if (typeSymbol == @symbol(buttonPress))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5565
	    ev.xany.type = ButtonPress;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5566
	else if (typeSymbol == @symbol(buttonRelease))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5567
	    ev.xany.type = ButtonRelease;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5568
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5569
	if (__isExternalAddress(targetId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5570
	    target = _WindowVal(targetId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5571
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5572
	    target = (Window) __longIntVal(targetId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5573
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5574
	ev.xkey.window = target;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5575
	ev.xkey.same_screen = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5576
	ev.xkey.subwindow = 0;
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  5577
	ev.xkey.root = RootWindow(dpy, screen);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5578
	ev.xkey.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5579
	ev.xkey.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5580
	ev.xkey.state = state;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5581
	ev.xkey.time = CurrentTime;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5582
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5583
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5584
	result = XSendEvent(dpy, target, False, 0 , &ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  5585
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5586
	if ((result == BadValue) || (result == BadWindow)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5587
	    DPRINTF(("bad status\n"));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5588
	    RETURN ( false )
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5589
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5590
	RETURN (true)
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5591
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5592
%}.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5593
    self primitiveFailed.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5594
    ^ false
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5595
! !
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5596
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5597
!XWorkstation methodsFor:'font stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5598
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5599
createFontFor:aFontName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5600
    "a basic method for X-font allocation; this method allows
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5601
     any font to be aquired (even those not conforming to
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5602
     standard naming conventions, such as cursor, fixed or k14)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5603
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5604
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5605
    /* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */
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
    XFontStruct *newFont;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5608
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5609
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5610
     && __isNonNilObject(aFontName)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5611
     && (__qIsString(aFontName) || __qIsSymbol(aFontName))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5612
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5613
	ENTER_XLIB();
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5614
	newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5615
	LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  5616
#ifdef COUNT_RESOURCES
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5617
	if (newFont)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5618
	    __cnt_font++;
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5619
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5620
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  5621
	RETURN ( newFont ? __MKEXTERNALADDRESS(newFont) : nil );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5622
    }
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
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5625
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5626
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5627
decomposeXFontName:aString into:aBlock
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5628
    "extract family, face, style and size from an
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5629
     X-font name 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5630
     (-brand-family-face-style-moreStyle--height-size-res-res-?-??-coding); 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5631
     evaluate aBlock with these"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5632
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5633
    |origin family face style moreStyle skip fheight size
1566
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5634
     resX resY x1 x2 registry encoding coding start end |
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5635
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5636
    aString isNil ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5637
    (aString startsWith:'-') ifFalse:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5638
	"
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5639
	 take care for ill-named fonts (i.e. pre Rel4 fonts)
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5640
	"
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5641
	('*-*-[0-9]*' match:aString) ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5642
	    end := aString indexOf:$- startingAt:1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5643
	    family := aString copyFrom:1 to:(end - 1).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5644
	    start := end + 1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5645
	    end := aString indexOf:$- startingAt:start.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5646
	    style := aString copyFrom:start to:(end - 1).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5647
	    start := end + 1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5648
	    size := aString copyFrom:start.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5649
	    size := (Number readFromString:size onError:[^false]).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5650
	    aBlock value:family value:nil value:style value:size value:nil.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5651
	    ^ true.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5652
	].
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5653
	('*-[0-9]*' match:aString) ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5654
	    "
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5655
	     something like lucidasans-24
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5656
	    "
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5657
	    end := aString indexOf:$- startingAt:1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5658
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5659
	    family := aString copyFrom:1 to:(end - 1).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5660
	    start := end + 1.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5661
	    size := aString copyFrom:start.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5662
	    size := (Number readFromString:size onError:[^false]).
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5663
	    aBlock value:family value:nil value:nil value:size value:nil.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5664
	    ^ true.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5665
	].
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5666
	aBlock value:aString value:nil value:nil value:nil value:nil.
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5667
	^ true.
295
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
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5670
    end := aString indexOf:$- startingAt:2.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5671
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5672
    origin := aString copyFrom:2 to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5673
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5674
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5675
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5676
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5677
    family := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5678
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5679
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5680
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5681
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5682
    face := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5683
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5684
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5685
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5686
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5687
    style := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5688
    (style = 'o') ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5689
	style := 'oblique'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5690
    ] ifFalse:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5691
	(style = 'i') ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5692
	    style := 'italic'
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5693
	] ifFalse:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5694
	    (style = 'r') ifTrue:[
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5695
		style := 'roman'
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5696
	    ]
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5697
	]
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5698
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5699
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5700
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5701
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5702
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5703
    moreStyle := aString copyFrom:start to:(end - 1).
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
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5706
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5707
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5708
    skip := aString copyFrom:start to:(end - 1).
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
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5711
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5712
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5713
    fheight := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5714
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5715
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5716
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5717
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5718
    size := aString copyFrom:start to:(end - 1).
3036
427225abb47f Catch number decoding error.
Stefan Vogel <sv@exept.de>
parents: 3018
diff changeset
  5719
    size := (Number readFromString:size onError:[^ false]) / 10.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5720
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5721
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5722
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5723
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5724
    resX := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5725
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5726
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5727
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5728
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5729
    resY := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5730
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5731
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5732
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5733
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5734
    x1 := aString copyFrom:start to:(end - 1).
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5735
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5736
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5737
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5738
    (end == 0) ifTrue:[^ false].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5739
    x2 := aString copyFrom:start to:(end - 1).
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
    start := end + 1.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5742
    end := aString indexOf:$- startingAt:start.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5743
    (end == 0) ifTrue:[^ false].
1566
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5744
    registry := aString copyFrom:start to:(end - 1).
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5745
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5746
    encoding := aString copyFrom:end + 1.
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5747
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5748
    coding := registry , '-' , encoding.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5749
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  5750
    (moreStyle ~= 'normal' and:[moreStyle ~= '']) ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5751
	style := style, '-', moreStyle.
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  5752
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  5753
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5754
    aBlock value:family value:face value:style value:size value:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5755
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5756
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  5757
    "Modified: 4.7.1996 / 11:12:25 / stefan"
1566
d6280c6d470a care for registry PLUS encoding
Claus Gittinger <cg@exept.de>
parents: 1563
diff changeset
  5758
    "Modified: 10.4.1997 / 09:45:36 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5759
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  5760
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5761
encodingOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5762
    "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
  5763
     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
  5764
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5765
    |enc fullName fontName registry encoding charSetCollections|
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5766
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5767
%{ 
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5768
    XFontStruct *f;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5769
    XFontProp *prop;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5770
    int n;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5771
    char *cp;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5772
    Atom fontAtom, registryAtom, encodingAtom, charSetCollAtom;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5773
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5774
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5775
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5776
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5777
	registryAtom = XInternAtom(dpy, "CHARSET_REGISTRY", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5778
	encodingAtom = XInternAtom(dpy, "CHARSET_ENCODING", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5779
	charSetCollAtom = XInternAtom(dpy, "CHARSET_COLLECTIONS", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5780
	fontAtom = XInternAtom(dpy, "FONT", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5781
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5782
	if (__isExternalAddress(aFontId)) {
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5783
        
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5784
	    f = _FontVal(aFontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5785
	    if (f) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5786
		n = f->n_properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5787
		prop = f->properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5788
		if (prop) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5789
		    while (n--) {
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5790
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5791
			cp = XGetAtomName(dpy, prop->name);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5792
			printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5793
			XFree(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5794
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5795
			if (prop->name == XA_FULL_NAME) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5796
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5797
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5798
				fullName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5799
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5800
				printf("   FULL_NAME -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5801
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5802
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5803
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5804
			} else if (prop->name == fontAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5805
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5806
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5807
				fontName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5808
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5809
				printf("   FONT -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5810
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5811
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5812
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5813
			} else if (prop->name == encodingAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5814
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5815
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5816
				encoding = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5817
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5818
				printf("   ENCODING -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5819
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5820
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5821
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5822
			} else if (prop->name == registryAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5823
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5824
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5825
				registry = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5826
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5827
				printf("   REGISTRY -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5828
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5829
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5830
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5831
			} else if (prop->name == charSetCollAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5832
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5833
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5834
				charSetCollections = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5835
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5836
				printf("   CHARSET_COLLECTIONS -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5837
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5838
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5839
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5840
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5841
			prop++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5842
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5843
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5844
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5845
	}
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5846
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5847
%}.
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5848
    ^ self
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5849
	extractEncodingFromRegistry:registry 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5850
	encoding:encoding 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5851
	charSetCollections:charSetCollections
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5852
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5853
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5854
extractEncodingFromRegistry:registry encoding:encoding charSetCollections:charSetCollections
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5855
    "this is pure magic ..."
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5856
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5857
    |enc charSets|
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5858
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5859
    (registry notNil and:[registry notEmpty]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5860
	enc := registry asLowercase asSymbol.
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5861
    ] ifFalse:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5862
	(encoding notNil and:[encoding notEmpty]) ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5863
	    enc := encoding asLowercase asSymbol
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5864
	] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5865
	    charSets := charSetCollections.    
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5866
	    (charSets notNil and:[charSets notEmpty]) ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5867
		charSets := charSets asUppercase asCollectionOfWords.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5868
		(charSets includes:'ISO8859-1') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5869
		    enc := #iso8859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5870
		] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5871
		    (charSets includes:'ISO8859') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5872
			enc := #iso8859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5873
		    ] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5874
			(charSets includes:'ASCII') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5875
			    enc := #ascii
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5876
			] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5877
			    (charSets includes:'ADOBE-STANDARD') ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5878
				enc := #iso8859
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5879
			    ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5880
			]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5881
		    ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5882
		]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5883
	    ] 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5884
	]
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5885
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5886
    ^  enc
567
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5887
7b735ef0974b separated encoding-extraction into extra method
Claus Gittinger <cg@exept.de>
parents: 558
diff changeset
  5888
    "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
  5889
    "Modified: 17.4.1996 / 17:22:35 / cg"
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5890
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5891
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5892
flushListOfAvailableFonts
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5893
    "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
  5894
     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
  5895
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5896
    listOfXFonts := nil
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5897
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5898
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5899
     Display flushListOfAvailableFonts.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5900
     Display listOfAvailableFonts
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5901
    "
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5902
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5903
    "Modified: 27.9.1995 / 10:54:47 / stefan"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5904
    "Created: 20.2.1996 / 22:55:52 / cg"
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5905
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  5906
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5907
fontMetricsOf:fontId into:aBlock
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5908
    "evaluate aBlock, passing a fonts metrics as arguments"
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5909
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5910
    |encoding avgAscent avgDescent
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5911
     maxAscent maxDescent minWidth maxWidth avgWidth
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5912
     res resX resY|
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5913
994
7e720b29c838 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  5914
%{
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5915
    XFontStruct *f;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5916
    int len;
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5917
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5918
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5919
	if (__isExternalAddress(fontId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5920
	    f = _FontVal(fontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5921
	    if (f) {
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5922
#ifdef NOTDEF
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5923
		char *cp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5924
		XFontProp *prop;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5925
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5926
		n = f->n_properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5927
		prop = f->properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5928
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5929
		if (prop) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5930
		    while (n--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5931
			if (prop->name == RESOLUTION_X) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5932
			    resX = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5933
			} else if (prop->name == RESOLUTION_Y) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5934
			    resY = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5935
			} else if (prop->name == RESOLUTION) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5936
			    res = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5937
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5938
			prop++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5939
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5940
		}
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5941
#endif
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5942
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5943
		avgAscent = __MKSMALLINT(f->ascent);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5944
		avgDescent = __MKSMALLINT(f->descent);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5945
		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5946
		maxDescent = __MKSMALLINT(f->max_bounds.descent);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5947
		minWidth = __MKSMALLINT(f->min_bounds.width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5948
		maxWidth = __MKSMALLINT(f->max_bounds.width);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5949
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5950
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5951
		len = XTextWidth(f, " ", 1);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  5952
		LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  5953
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5954
		avgWidth = __MKSMALLINT( len );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5955
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5956
	}
991
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5957
    }
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5958
%}.
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5959
    encoding := self encodingOf:fontId.
b3a0b903bd7f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 976
diff changeset
  5960
    aBlock value:encoding
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5961
	   value:avgAscent
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5962
	   value:avgDescent
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5963
	   value:maxAscent
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5964
	   value:maxDescent
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5965
	   value:minWidth
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5966
	   value:maxWidth
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5967
	   value:avgWidth
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5968
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5969
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5970
fontResolutionOf:fontId
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5971
    "return the resolution (as dpiX @ dpiY) of the font - this is usually the displays resolution,
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5972
     but due to errors in some XServer installations, some use 75dpi fonts on higher
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5973
     resolution displays and vice/versa."
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5974
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5975
    |res resX resY|
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5976
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5977
%{
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5978
    XFontStruct *f;
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5979
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  5980
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5981
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5982
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5983
	if (__isExternalAddress(fontId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5984
	    f = _FontVal(fontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5985
	    if (f) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5986
		char *cp;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5987
		XFontProp *prop;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5988
		Atom resolutionXAtom, resolutionYAtom;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5989
		int n;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5990
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5991
		n = f->n_properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5992
		prop = f->properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5993
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5994
		if (prop) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5995
		    resolutionXAtom = XInternAtom(dpy, "RESOLUTION_X", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5996
		    resolutionYAtom = XInternAtom(dpy, "RESOLUTION_Y", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5997
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5998
		    while (n--) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  5999
			if (prop->name == resolutionXAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6000
			    resX = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6001
			} else if (prop->name == resolutionYAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6002
			    resY = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6003
			} else if (prop->name == XA_RESOLUTION) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6004
			    res = __MKSMALLINT(prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6005
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6006
			prop++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6007
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6008
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6009
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6010
	}
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6011
    }
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6012
%}.
1046
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  6013
    (resX notNil and:[resY notNil]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6014
	^ resX @ resY
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6015
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6016
    res notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6017
	^ res @ res
1045
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6018
    ].
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6019
    ^ self resolution
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6020
!
b03222053583 added query for a fonts real resolution (kludge for X)
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
  6021
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6022
fullNameOf:aFontId
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6023
    "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
  6024
     used for user feed-back (for example: in the fontPanel).
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6025
     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
  6026
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6027
    |fullName fontName|
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6028
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6029
%{ 
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6030
    XFontStruct *f;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6031
    XFontProp *prop;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6032
    int n;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6033
    char *cp;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6034
    Atom fontAtom;
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6035
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6036
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6037
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6038
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6039
	fontAtom = XInternAtom(dpy, "FONT", True);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6040
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6041
	if (__isExternalAddress(aFontId)) {
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6042
        
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6043
	    f = _FontVal(aFontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6044
	    if (f) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6045
		n = f->n_properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6046
		prop = f->properties;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6047
		if (prop) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6048
		    while (n--) {
1049
59cc92776676 oops - free XGetAtomName string after use
Claus Gittinger <cg@exept.de>
parents: 1047
diff changeset
  6049
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6050
			cp = XGetAtomName(dpy, prop->name);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6051
			printf("%s (%d) -> %d\n", cp, prop->name, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6052
			XFree(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6053
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6054
			if (prop->name == XA_FULL_NAME) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6055
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6056
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6057
				fullName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6058
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6059
				printf("   FULL_NAME -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6060
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6061
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6062
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6063
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6064
			if (prop->name == fontAtom) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6065
			    cp = XGetAtomName(dpy, prop->card32);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6066
			    if (cp) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6067
				fontName = __MKSTRING(cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6068
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6069
				printf("   FONT -> %s\n", cp);
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6070
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6071
				XFree(cp);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6072
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6073
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6074
			prop++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6075
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6076
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6077
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6078
	}
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6079
    }
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6080
%}.
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6081
    (fullName notNil and:[fullName notEmpty]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6082
	^ fullName
440
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6083
    ].
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6084
    ^ fontName
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6085
!
e959b8e18453 font encoding & fullName support
Claus Gittinger <cg@exept.de>
parents: 404
diff changeset
  6086
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6087
getAvailableFontsMatching:pattern
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6088
    "return an Array filled with font names matching aPattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6089
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6090
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6091
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6092
    int nnames = 1500;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6093
    int available = nnames + 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6094
    char **fonts;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6095
    OBJ arr, str;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6096
    int i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6097
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6098
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6099
	if (__isString(pattern)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6100
	    for (;;) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6101
		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6102
		if ((fonts == NULL) || (available < nnames)) break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6103
		XFreeFontNames(fonts);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6104
		nnames = available * 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6105
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6106
	    if (fonts == NULL) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6107
		RETURN ( nil );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6108
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6109
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6110
	     * now, that we know the number of font names,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6111
	     * create the array ...
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6112
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6113
	    arr = __ARRAY_NEW_INT(available);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6114
	    if (! arr) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6115
		RETURN (nil);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6116
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6117
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6118
	     * ... and fill it
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6119
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6120
	    for (i=0; i<available; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6121
		__PROTECT__(arr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6122
		str = __MKSTRING(fonts[i]);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6123
		__UNPROTECT__(arr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6124
		__ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6125
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6126
	    RETURN (arr);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6127
	}
295
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
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6131
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6132
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6133
getDefaultFont
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6134
    "return a default font id - used when class Font cannot
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6135
     find anything usable"
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
     ^ self createFontFor:'fixed'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6138
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6139
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6140
getFontWithFamily:familyString face:faceString
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6141
	    style:styleArgString size:sizeArg encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6142
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6143
    "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
  6144
     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
  6145
     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
  6146
     can be aquired that way."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6147
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6148
    |styleString theName theId xlatedStyle 
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6149
     id spacing encodingMatch registryMatch idx|
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6150
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6151
    styleString := styleArgString.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6152
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6153
    "special: if face is nil, allow access to X-fonts"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6154
    faceString isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6155
	sizeArg notNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6156
	    theName := familyString , '-' , sizeArg printString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6157
	] ifFalse:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6158
	    theName := familyString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6159
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6160
	theName isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6161
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6162
	     mhmh - fall back to the default font
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6163
	    "
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6164
	    theName := 'fixed'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6165
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6166
	theId := self createFontFor:theName.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6167
	theId isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6168
	    theId := self getDefaultFont
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6169
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6170
	^ theId
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6171
    ].
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6172
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6173
    "/ spacing other than 'normal' is contained as last component
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6174
    "/ in style
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6175
1392
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  6176
    (styleString notNil
45ae91abdfac care for nil styleString in #getFontWithFamily...
Claus Gittinger <cg@exept.de>
parents: 1376
diff changeset
  6177
     and:[(styleString endsWith:'-narrow') 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6178
	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6179
	|i|
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6180
	i := styleString lastIndexOf:$-.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6181
	spacing := styleString copyFrom:(i+1).
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6182
	styleString := styleString copyTo:(i-1).
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6183
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6184
	spacing := 'normal'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6185
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6186
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6187
    xlatedStyle := styleString.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6188
    xlatedStyle notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6189
	xlatedStyle := xlatedStyle first asString
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6190
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6191
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6192
    encodingMatch := encoding.
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6193
    registryMatch := '*'.
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6194
    encoding isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6195
	encodingMatch := '*'.
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6196
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6197
	idx := encoding indexOf:$-.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6198
	idx ~~ 0 ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6199
	    encodingMatch := encoding copyTo:idx - 1.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6200
	    registryMatch := encoding copyFrom:idx + 1
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6201
	].
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6202
    ].
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6203
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6204
    id := self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6205
	    getFontWithFoundry:'*'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6206
	    family:familyString asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6207
	    weight:faceString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6208
	    slant:xlatedStyle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6209
	    spacing:spacing
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6210
	    pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6211
	    size:sizeArg 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6212
	    registry:encodingMatch
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6213
	    encoding:registryMatch.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6214
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6215
    id isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6216
	(encodingMatch notNil and:[encodingMatch ~= '*']) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6217
	    "/ too stupid: encodings come in both cases
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6218
	    "/ and X does not ignore case
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6219
	    "/
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6220
	    id := self 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6221
		    getFontWithFoundry:'*'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6222
		    family:familyString asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6223
		    weight:faceString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6224
		    slant:xlatedStyle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6225
		    spacing:spacing
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6226
		    pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6227
		    size:sizeArg 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6228
		    registry:encodingMatch asUppercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6229
		    encoding:registryMatch.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6230
	    id isNil ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6231
		id := self 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6232
			getFontWithFoundry:'*'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6233
			family:familyString asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6234
			weight:faceString
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6235
			slant:xlatedStyle
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6236
			spacing:spacing
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6237
			pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6238
			size:sizeArg 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6239
			registry:encodingMatch asLowercase
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6240
			encoding:registryMatch.
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6241
	    ]
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6242
	]
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6243
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6244
    ^ id
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6245
914
6cf4cc647095 Account for 'narrow' and 'semicondensed' in X11-Fonts.
Stefan Vogel <sv@exept.de>
parents: 911
diff changeset
  6246
    "Modified: 4.7.1996 / 11:38:47 / stefan"
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6247
    "Modified: 10.4.1997 / 19:20:06 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6248
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6249
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6250
getFontWithFoundry:foundry family:family weight:weight
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6251
	      slant:slant spacing:spc pixelSize:pSize size:size 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6252
	      registry:registry encoding:encoding
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6253
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6254
    "get the specified font, if not available, return nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6255
     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
  6256
     use this entry.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6257
     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
  6258
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6259
     foundry: 'adobe', 'misc', 'dec', 'schumacher' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6260
     family:  'helvetica' 'courier' 'times' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6261
     weight:  'bold' 'medium' 'demi' ...
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6262
     slant:   'r(oman)' 'i(talic)' 'o(blique)'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6263
     spacing: 'narrow' 'normal' semicondensed' ... usually '*'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6264
     pixelSize: 16,18 ... usually left empty
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6265
     size:      size in point (1/72th of an inch)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6266
     registry:  iso8859, sgi ... '*'
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6267
     encoding:  registry specific encoding (usually '*')
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6268
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6269
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6270
    |theName sizeMatch 
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6271
     foundryMatch familyMatch weightMatch slantMatch spcMatch
1099
b236304804f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1098
diff changeset
  6272
     pSizeMatch registryMatch encodingMatch|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6273
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6274
    "this works only on 'Release >= 3' - X-servers"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6275
    "name is:
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6276
	-foundry-family    -weight -slant-
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6277
	 sony    helvetica bold     r
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6278
	 adobe   courier   medium   i
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6279
	 msic    fixed              o
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6280
	 ...     ...
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6281
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6282
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6283
    size isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6284
	sizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6285
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6286
	sizeMatch := size printString , '0'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6287
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6288
    foundry isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6289
	foundryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6290
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6291
	foundryMatch := foundry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6292
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6293
    family isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6294
	familyMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6295
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6296
	familyMatch := family
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6297
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6298
    weight isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6299
	weightMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6300
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6301
	weightMatch := weight
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6302
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6303
    slant isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6304
	slantMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6305
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6306
	slantMatch := slant
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6307
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6308
    spc isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6309
	spcMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6310
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6311
	spcMatch := spc
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6312
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6313
    pSize isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6314
	pSizeMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6315
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6316
	pSizeMatch := pSize printString
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6317
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6318
    registry isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6319
	registryMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6320
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6321
	registryMatch := registry
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6322
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6323
    encoding isNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6324
	encodingMatch := '*'
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6325
    ] ifFalse:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6326
	encodingMatch := encoding
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6327
    ].
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6328
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6329
    theName := ('-' , foundryMatch,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6330
		'-' , familyMatch,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6331
		'-' , weightMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6332
		'-' , slantMatch , 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6333
		'-' , spcMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6334
		'-*' ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6335
		'-' , pSizeMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6336
		'-' , sizeMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6337
		'-*-*-*-*' ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6338
		'-' , registryMatch ,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6339
		'-' , encodingMatch).
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6340
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 652
diff changeset
  6341
"/  Transcript showCR:theName; endEntry.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6342
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6343
    ^ self createFontFor:theName.
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6344
        
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6345
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6346
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6347
     Display getFontWithFoundry:'*'
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6348
			 family:'courier'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6349
			 weight:'medium'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6350
			  slant:'r'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6351
			spacing:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6352
		      pixelSize:nil
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6353
			   size:13
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6354
		       registry:'iso8859'
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  6355
		       encoding:'*'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6356
    "
457
b40bf5d8727c ignore vendor-encoding (use only registry for match)
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  6357
1576
b75c64bb5849 care for encoding & registry
Claus Gittinger <cg@exept.de>
parents: 1567
diff changeset
  6358
    "Modified: 10.4.1997 / 19:15:44 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6359
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6360
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6361
listOfAvailableFonts
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6362
    "return a list with all available fonts on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6363
     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
  6364
     next time. The elements of the returned collection are instances of
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6365
     FontDescription."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6366
392
caf4452ec3dd merged sendKey/ButtonEvent into one method;
Claus Gittinger <cg@exept.de>
parents: 391
diff changeset
  6367
    |"stream aName fntDescr" names|
295
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
    listOfXFonts isNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6370
"/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6371
"/ old code; using a pipe to xlsfonts
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
"/      stream := PipeStream readingFrom:'xlsfonts ''*'''.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6374
"/      stream isNil ifTrue:[^ nil].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6375
"/      listOfXFonts := OrderedCollection new.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6376
"/      [stream atEnd] whileFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6377
"/          aName := stream nextLine.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6378
"/          aName notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6379
"/          self decomposeXFontName:aName into:
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6380
"/                  [:family :face :style :size :coding |
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6381
"/                      family notNil ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6382
"/                          fntDescr := FontDescription
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6383
"/                                          family:family
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6384
"/                                          face:face
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6385
"/                                          style:style
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6386
"/                                          size:size
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6387
"/                                          encoding:coding.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6388
"/                          listOfXFonts add:fntDescr
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
"/                  ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6391
"/          ]
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6392
"/      ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6393
"/      stream close.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6394
"/      "if xlsfont is broken ... (hey sco)"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6395
"/      (listOfXFonts size == 0) ifTrue:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6396
"/          listOfXFonts := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6397
"/      ] ifFalse:[
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6398
"/          listOfXFonts sort:[:a :b | a family < b family].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6399
"/      ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6400
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6401
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6402
	"/ new code:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6403
	"/ use new primitive to get font names;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6404
	"/ this is much faster, and also works on systems where
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6405
	"/      a) xlsfonts is broken (sco)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6406
	"/      b) xlsfonts is not available (aix)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6407
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6408
	names := self getAvailableFontsMatching:'*'.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6409
	names isNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6410
	    "no names returned ..."
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6411
	    ^ nil
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6412
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6413
	listOfXFonts := names collect:[:aName |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6414
				    |fntDescr|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6415
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6416
				    (self decomposeXFontName:aName into:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6417
					[:family :face :style :size :coding |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6418
					   family notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6419
					       fntDescr := FontDescription
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6420
							       family:family
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6421
							       face:face
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6422
							       style:style
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6423
							       size:size
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6424
							       encoding:coding.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6425
					   ] ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6426
					       fntDescr := FontDescription
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6427
							       name:aName
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6428
					   ]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6429
					]
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6430
				    ) ifFalse:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6431
					fntDescr := FontDescription name:aName.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6432
				    ].  
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6433
				    fntDescr
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6434
			    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6435
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6436
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6437
    ^ listOfXFonts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6438
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6439
    "
568
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6440
     Display listOfAvailableFonts.
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6441
ded98de3475f return encoding as a symbol (faster compare)
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
  6442
     Display getAvailableFontsMatching:'*'.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6443
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6444
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6445
    "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
  6446
    "Modified: 17.4.1996 / 15:27:57 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6447
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6448
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6449
releaseFont:aFontId
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
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6454
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6455
    if (! ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6456
	RETURN ( self );
1212
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6457
    }
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6458
e06a0a01a817 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
  6459
    if (__isExternalAddress(aFontId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6460
	f = _FontVal(aFontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6461
	if (f) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6462
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6463
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6464
	    XFreeFont(myDpy, f);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6465
	    LEAVE_XLIB();
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6466
#ifdef COUNT_RESOURCES
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6467
	    __cnt_font--;
923
64bbcd3ee100 added debug counting of X resource allocation
Claus Gittinger <cg@exept.de>
parents: 918
diff changeset
  6468
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6469
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6470
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6471
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6472
    }
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6473
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6474
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6475
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6476
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6477
sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6478
    "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
  6479
     on this display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6480
     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
  6481
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6482
    |sizes|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6483
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6484
    sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6485
    (sizes notNil and:[sizes includes:0]) ifTrue:[
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  6486
	"special: in X11R5 and above, size 0 means:
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  6487
	 there are scaled versions in all sizes available"
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  6488
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  6489
	^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6490
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6491
    ^ sizes
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6492
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6493
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6494
     Display sizesInFamily:'courier' face:'bold' style:'roman'
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6495
    "
466
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6496
257f4414a176 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 463
diff changeset
  6497
    "Created: 27.2.1996 / 01:38:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6498
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6499
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6500
widthOf:aString from:index1 to:index2 inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6501
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6502
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6503
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6504
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6505
    char *cp;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6506
    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
  6507
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6508
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6509
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6510
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6511
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6512
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6513
	if (__bothSmallInteger(index1, index2)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6514
	 && __isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6515
	 && __isNonNilObject(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6516
	    f = _FontVal(aFontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6517
	    if (! f) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6518
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6519
	    i1 = __intVal(index1) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6520
	    cls = __qClass(aString);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6521
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6522
	    if (i1 >= 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6523
		i2 = __intVal(index2) - 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6524
		if (i2 < i1) {
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  6525
		    RETURN ( __MKSMALLINT(0) );
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6526
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6527
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  6528
		cp = (char *) __stringVal(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6529
		l = i2 - i1 + 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6530
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6531
		if ((cls == @global(String)) || (cls == @global(Symbol))) {
2011
47e72d42226b eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  6532
		    n = __stringSize(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6533
		    if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6534
			cp += i1;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6535
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6536
			ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6537
			len = XTextWidth(f, cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6538
			LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6539
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6540
			RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6541
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6542
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6543
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6544
		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6545
		cp += nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6546
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6547
		if (__isBytes(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6548
		    n = __byteArraySize(aString) - nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6549
		    if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6550
			cp += i1;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6551
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6552
			ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6553
			len = XTextWidth(f, cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6554
			LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6555
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6556
			RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6557
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6558
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6559
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6560
		/* TWOBYTESTRINGS */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6561
		if (__isWords(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6562
		    n = (__byteArraySize(aString) - nInstBytes) / 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6563
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6564
		    if (i2 < n) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6565
			union {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6566
			    char b[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6567
			    unsigned short s;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6568
			} u;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6569
			int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6570
			XChar2b *cp2 = (XChar2b *)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6571
			int mustFree = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6572
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6573
			cp += (i1 * 2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6574
			if (l > 1000) l = 1000;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6575
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6576
			/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6577
			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6578
			 * X expects them MSB first
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6579
			 * convert as required
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6580
			 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6581
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6582
			u.s = 0x1234;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6583
			if (u.b[0] != 0x12) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6584
			    if (l <= NLOCALBUFFER) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6585
				cp2 = xlatebuffer;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6586
			    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6587
				cp2 = (XChar2b *)(malloc(l * 2));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6588
				mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6589
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6590
			    for (i=0; i<l; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6591
				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6592
				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6593
			    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6594
			    cp = (char *) cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6595
			}
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6596
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6597
			ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6598
			len = XTextWidth16(f, (XChar2b *)cp, l);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6599
			LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6600
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6601
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6602
			if (mustFree) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6603
			    free(cp2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6604
			}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6605
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6606
			RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6607
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6608
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6609
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6610
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6611
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6612
#undef NLOCALBUFFER
995
2f2c0b2bff1a check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents: 994
diff changeset
  6613
fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6614
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6615
    self primitiveFailed.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  6616
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6617
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6618
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6619
widthOf:aString inFont:aFontId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6620
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6621
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6622
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6623
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6624
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6625
    int len, n;
447
9a58924e921b dont hardcode TwoByteString - use __isWords to check for doubleByteStringDraw
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
  6626
    OBJ cls;
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6627
#   define NLOCALBUFFER 200
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6628
    XChar2b xlatebuffer[NLOCALBUFFER];
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6629
    int nInstBytes;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6630
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6631
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6632
	if (__isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6633
	 && __isNonNilObject(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6634
	    f = _FontVal(aFontId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6635
	    if (! f) goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6636
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6637
	    cls = __qClass(aString);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6638
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  6639
	    cp = (char *) __stringVal(aString);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6640
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6641
	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
2011
47e72d42226b eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents: 2007
diff changeset
  6642
		n = __stringSize(aString);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6643
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6644
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6645
		len = XTextWidth(f, cp, n);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6646
		LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6647
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6648
		RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6649
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6650
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6651
	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6652
	    cp += nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6653
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6654
	    if (__isBytes(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6655
		n = __byteArraySize(aString) - nInstBytes;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6656
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6657
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6658
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6659
		len = XTextWidth(f, cp, n);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6660
		LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6661
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6662
		RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6663
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6664
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6665
	    /* TWOBYTESTRINGS */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6666
	    if (__isWords(aString)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6667
		union {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6668
		    char b[2];
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6669
		    unsigned short s;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6670
		} u;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6671
		int i;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6672
		XChar2b *cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6673
		int mustFree = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6674
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6675
		n = (__byteArraySize(aString) - nInstBytes) / 2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6676
		if (n > 1000) n = 1000;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6677
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6678
		/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6679
		 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6680
		 * X expects them MSB first
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6681
		 * convert as required
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6682
		 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6683
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6684
		u.s = 0x1234;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6685
		if (u.b[0] != 0x12) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6686
		    if (n <= NLOCALBUFFER) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6687
			cp2 = xlatebuffer;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6688
		    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6689
			cp2 = (XChar2b *)(malloc(n * 2));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6690
			mustFree = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6691
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6692
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6693
		    for (i=0; i<n; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6694
			cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6695
			cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6696
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6697
		    cp = (char *) cp2;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6698
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6699
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6700
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6701
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6702
		len = XTextWidth16(f, (XChar2b *)cp, n);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6703
		LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6704
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6705
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6706
		if (mustFree) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6707
		    free(cp2);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6708
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6709
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6710
		RETURN ( __MKSMALLINT(len) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6711
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6712
	}
486
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6713
    }
0c35ed67797d oops - 16bit drawing was corrupted / fixed widthOf-16bit for byteSwapped displays
Claus Gittinger <cg@exept.de>
parents: 481
diff changeset
  6714
#undef NLOCALBUFFER
995
2f2c0b2bff1a check fontStruct args - could be nil (but only if caller is wrong)
Claus Gittinger <cg@exept.de>
parents: 994
diff changeset
  6715
  fail: ;
402
f5a53e2a868d check for being connected in font query methods
Claus Gittinger <cg@exept.de>
parents: 397
diff changeset
  6716
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6717
    self primitiveFailed.
1361
784d654780e6 added circulate event hooks;
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  6718
    ^ 0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6719
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6720
3177
8aa3c800394a category rename
Claus Gittinger <cg@exept.de>
parents: 3146
diff changeset
  6721
!XWorkstation methodsFor:'grabbing'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6722
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6723
allowEvents:mode
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6724
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6725
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6726
    int _mode, ok = 1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6727
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6728
    if (mode == @symbol(asyncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6729
	_mode = AsyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6730
    else if (mode == @symbol(syncPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6731
	_mode = SyncPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6732
    else if (mode == @symbol(asyncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6733
	_mode = AsyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6734
    else if (mode == @symbol(syncKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6735
	_mode = SyncKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6736
    else if (mode == @symbol(syncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6737
	_mode = SyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6738
    else if (mode == @symbol(asyncBoth))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6739
	_mode = AsyncBoth;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6740
    else if (mode == @symbol(replayPointer))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6741
	_mode = ReplayPointer;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6742
    else if (mode == @symbol(replayKeyboard))
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6743
	_mode = ReplayKeyboard;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6744
    else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6745
	ok = 0;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6746
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6747
    if (ok) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6748
	if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6749
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6750
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6751
	    XAllowEvents(myDpy, _mode, CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6752
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6753
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6754
	    RETURN (self);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6755
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6756
    }
481
62f1be5db8aa also support string-subclasses in stringDraw methods
Claus Gittinger <cg@exept.de>
parents: 480
diff changeset
  6757
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6758
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6759
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6760
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6761
grabKeyboardIn:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6762
    "grab the keyboard"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6765
    int result, ok;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6766
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  6767
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6768
	if (__isExternalAddress(aWindowId)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6769
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6770
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6771
	    result = XGrabKeyboard(myDpy,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6772
				   _WindowVal(aWindowId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6773
				   True /* False */,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6774
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6775
				   GrabModeAsync,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6776
				   CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6777
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6778
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6779
	    ok = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6780
	    switch(result) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6781
		case AlreadyGrabbed: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6782
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6783
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6784
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6785
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6786
		case GrabNotViewable: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6787
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6788
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6789
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6790
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6791
		case GrabInvalidTime: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6792
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6793
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6794
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6795
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6796
		case GrabFrozen: 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6797
		    if (@global(ErrorPrinting) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6798
			fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6799
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6800
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6801
		default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6802
		    ok = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6803
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6804
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6805
	    if (! ok) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6806
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6807
		XUngrabKeyboard(myDpy, CurrentTime);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6808
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6809
		RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6810
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6811
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6812
	    RETURN ( true );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6813
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6814
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  6815
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6816
    self primitiveFailed
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
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6819
grabPointerIn:aWindowId withCursor:aCursorId eventMask:eventMask pointerMode:pMode keyboardMode:kMode confineTo:confineId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6820
    "grap the pointer - return true if ok"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6821
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6822
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6823
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6824
    int result, ok, evMask;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6825
    Window confineWin;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6826
    Cursor curs;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6827
    int pointer_mode, keyboard_mode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6828
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  6829
    if (ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6830
	if (__isExternalAddress(aWindowId)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6831
	    if (__isExternalAddress(confineId)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6832
		confineWin = _WindowVal(confineId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6833
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6834
		confineWin = (Window) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6835
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6836
	    if (__isExternalAddress(aCursorId)) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6837
		curs = _CursorVal(aCursorId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6838
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6839
		curs = (Cursor) None;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6840
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6841
	    if (pMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6842
		pointer_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6843
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6844
		pointer_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6845
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6846
	    if (kMode == @symbol(sync))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6847
		keyboard_mode = GrabModeSync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6848
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6849
		keyboard_mode = GrabModeAsync;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6850
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6851
	    if (__isSmallInteger(eventMask))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6852
		evMask = __intVal(eventMask);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6853
	    else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6854
		evMask = ButtonPressMask | ButtonMotionMask | PointerMotionMask | ButtonReleaseMask;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6855
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6856
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6857
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6858
	    ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6859
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6860
	    result = XGrabPointer(myDpy,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6861
				  _WindowVal(aWindowId), 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6862
				  False, 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6863
				  evMask,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6864
				  pointer_mode, keyboard_mode,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6865
				  confineWin,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6866
				  curs,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6867
				  CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6868
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6869
	    LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6870
*/
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6871
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6872
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6873
	    ok = 0;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6874
	    switch (result) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6875
		case AlreadyGrabbed: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6876
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6877
			fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6878
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6879
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6880
		case GrabNotViewable: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6881
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6882
			fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6883
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6884
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6885
		case GrabInvalidTime: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6886
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6887
			fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6888
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6889
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6890
		case GrabFrozen: 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6891
		    if (@global(ErrorPrinting) == true) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6892
			fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6893
		    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6894
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6895
		default:
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6896
		    ok = 1;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6897
		    break;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6898
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6899
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6900
	    if (! ok) {
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6901
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6902
		ENTER_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6903
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6904
		XUngrabPointer(myDpy, CurrentTime);
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6905
/*
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6906
		LEAVE_XLIB();
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6907
*/
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6908
		RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6909
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6910
	    RETURN ( true );
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6911
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6912
    }
1183
28cfb8ef3504 new messages
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
  6913
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6914
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6915
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6916
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6917
grabPointerIn:aWindowId withCursor:aCursorId pointerMode:pMode keyboardMode:kMode confineTo:confineId
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6918
    "grap the pointer - return true if ok"
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6919
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6920
    ^ self
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6921
	grabPointerIn:aWindowId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6922
	withCursor:aCursorId 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6923
	eventMask:nil
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6924
	pointerMode:pMode 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6925
	keyboardMode:kMode 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  6926
	confineTo:confineId
2195
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6927
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6928
    "Modified: / 28.7.1998 / 02:47:51 / cg"
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6929
!
f64b74292537 arrange for pointerMotion to be also sent, when grabbing the pointer.
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  6930
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6931
ungrabKeyboard
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6932
    "release the keyboard"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6933
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6934
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6935
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6936
    if (ISCONNECTED) {
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6937
        Display *dpy = myDpy;
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6938
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6939
        ENTER_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6940
        XUngrabKeyboard(dpy, CurrentTime);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6941
        XSync(dpy, 0);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6942
        LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6943
295
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
    activeKeyboardGrab := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6947
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6948
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6949
ungrabPointer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6950
    "release the pointer"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6951
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6952
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6953
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6954
    if (ISCONNECTED) {
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6955
        Display *dpy = myDpy;
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6956
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6957
        ENTER_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6958
        XUngrabPointer(dpy, CurrentTime);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6959
        XSync(dpy, 0);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  6960
        LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  6961
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6962
    }
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
    activePointerGrab := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6965
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6966
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6967
!XWorkstation methodsFor:'graphic context stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6968
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  6969
noClipIn:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6970
    "disable clipping rectangle"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6973
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6974
    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
  6975
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6976
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  6977
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6978
	if (__isExternalAddress(aGCId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6979
	    gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6980
	    gcv.clip_mask = None;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6981
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6982
	    XChangeGC(myDpy, gc, GCClipMask, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6983
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6984
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6985
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6986
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6987
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6988
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6989
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6990
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6991
setBackground:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6992
    "set background color to be drawn with"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  6995
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  6996
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6997
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  6998
	 && __isSmallInteger(bgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  6999
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7000
	    XSetBackground(myDpy, _GCVal(aGCId), __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7001
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7002
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7003
	}
295
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
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7006
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7007
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7008
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7009
setBitmapMask:aBitmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7010
    "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
  7011
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7012
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7013
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7014
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7015
    Pixmap bitmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7016
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7017
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7018
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7019
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7020
	if (__isExternalAddress(aGCId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7021
	    gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7022
	    if (__isExternalAddress(aBitmapId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7023
		bitmap = _PixmapVal(aBitmapId);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7024
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7025
		XSetStipple(dpy, gc, bitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7026
		XSetFillStyle(dpy, gc, FillOpaqueStippled);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7027
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7028
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7029
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7030
	    if (aBitmapId == nil) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7031
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7032
		XSetFillStyle(dpy, gc, FillSolid);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7033
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7034
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7035
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7036
	}
295
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
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7039
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7040
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7041
1681
069ede63fb19 pass both drawableId & gcID to setClipByChildren
Claus Gittinger <cg@exept.de>
parents: 1627
diff changeset
  7042
setClipByChildren:aBool in:aDrawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7043
    "enable/disable drawing into child views"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7044
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7045
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7046
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7047
    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
  7048
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7049
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7050
    if (ISCONNECTED) {
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7051
	if (__isExternalAddress(aGCId)) {
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7052
	    gc = _GCVal(aGCId);
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7053
	    if (aBool == true)
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7054
		gcv.subwindow_mode = ClipByChildren;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7055
	    else
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7056
		gcv.subwindow_mode = IncludeInferiors;
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7057
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7058
	    ENTER_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7059
	    XChangeGC(myDpy, gc, GCSubwindowMode, &gcv);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7060
	    LEAVE_XLIB();
1694
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7061
	    RETURN ( self );
e93a814a1395 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  7062
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7063
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7064
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7065
    self primitiveFailed
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
1709
342fc0eb3517 pass drawableId to clip methods (req'd for Windows)
Claus Gittinger <cg@exept.de>
parents: 1695
diff changeset
  7068
setClipX:clipX y:clipY width:clipWidth height:clipHeight in:drawableId gc:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7069
    "clip to a rectangle"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7072
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7073
    XRectangle r;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7074
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7075
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7076
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7077
	 && __bothSmallInteger(clipX, clipY)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7078
	 && __bothSmallInteger(clipWidth, clipHeight)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7079
	    r.x = __intVal(clipX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7080
	    r.y = __intVal(clipY);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7081
	    r.width = __intVal(clipWidth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7082
	    r.height = __intVal(clipHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7083
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7084
	    XSetClipRectangles(myDpy, _GCVal(aGCId), 0, 0, &r, 1, Unsorted);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7085
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7086
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7087
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7088
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7089
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7090
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7091
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7092
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7093
setDashes:dashList dashOffset:offset in:aGCId
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7094
    "set line attributes"
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7095
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7096
%{  /* NOCONTEXT */
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7097
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7098
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7099
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7100
	 && __isSmallInteger(offset)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7101
	 && __isByteArray(dashList)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7102
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7103
	    XSetDashes(myDpy, _GCVal(aGCId), 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7104
		       __intVal(offset),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7105
		       __ByteArrayInstPtr(dashList)->ba_element,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7106
		       __byteArraySize(dashList));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7107
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7108
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7109
	}
788
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7110
    }
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7111
bad: ;
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7112
%}.
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7113
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7114
     either aGCId is invalid,
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7115
     and/or dashList is not a byteArray
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7116
     and/or offset is not a smallInteger
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7117
    "
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7118
    self primitiveFailed
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7119
!
23b4d0a26e3c added setDashes: ...
Claus Gittinger <cg@exept.de>
parents: 780
diff changeset
  7120
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7121
setFont:aFontId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7122
    "set font to be drawn in"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7125
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7126
    XFontStruct *f;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7127
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7128
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7129
	if (__isExternalAddress(aFontId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7130
	 && __isExternalAddress(aGCId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7131
	    f = (XFontStruct *) _FontVal(aFontId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7132
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7133
	    XSetFont(myDpy, _GCVal(aGCId), f->fid);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7134
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7135
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7136
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7137
    }
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
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7140
     aGCId and/or aFontId are invalid
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7141
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7142
    self primitiveFailed
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7145
setForeground:fgColorIndex background:bgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7146
    "set foreground and background colors to be drawn with"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7149
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7150
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7151
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7152
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7153
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7154
	if (__bothSmallInteger(fgColorIndex, bgColorIndex)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7155
	 && __isExternalAddress(aGCId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7156
	    gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7157
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7158
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7159
	    XSetForeground(dpy, gc, __intVal(fgColorIndex));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7160
	    XSetBackground(dpy, gc, __intVal(bgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7161
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7162
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7163
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7164
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7165
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7166
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7167
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7168
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7169
setForeground:fgColorIndex in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7170
    "set foreground color to be drawn with"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7173
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7174
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7175
	if (__isExternalAddress(aGCId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7176
	 && __isSmallInteger(fgColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7177
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7178
	    XSetForeground(myDpy, _GCVal(aGCId), __intVal(fgColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7179
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7180
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7181
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7182
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7183
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7184
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7185
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7186
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7187
setFunction:aFunctionSymbol in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7188
    "set alu function to be drawn with"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7189
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7190
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7191
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7192
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7193
    int fun = -1;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7194
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7195
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7196
	if (__isExternalAddress(aGCId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7197
	    gc = _GCVal(aGCId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7198
	    if (aFunctionSymbol == @symbol(copy)) fun = GXcopy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7199
	    else if (aFunctionSymbol == @symbol(copyInverted)) fun = GXcopyInverted;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7200
	    else if (aFunctionSymbol == @symbol(xor)) fun = GXxor;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7201
	    else if (aFunctionSymbol == @symbol(and)) fun = GXand;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7202
	    else if (aFunctionSymbol == @symbol(andReverse)) fun = GXandReverse;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7203
	    else if (aFunctionSymbol == @symbol(andInverted)) fun = GXandInverted;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7204
	    else if (aFunctionSymbol == @symbol(or)) fun = GXor;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7205
	    else if (aFunctionSymbol == @symbol(orReverse)) fun = GXorReverse;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7206
	    else if (aFunctionSymbol == @symbol(orInverted)) fun = GXorInverted;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7207
	    if (fun != -1) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7208
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7209
		XSetFunction(myDpy, gc, fun);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  7210
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7211
		RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7212
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7213
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7214
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7215
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7216
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7217
     either aGCId is not an integer, or an invalid symbol
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7218
     was passed ... valid functions are #copy, #copyInverted, #xor, #and, #andReverse,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7219
     #andInverted, #or, #orReverse, #orInverted. See Xlib documentation for more details.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7220
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7221
    self primitiveFailed
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7224
setGraphicsExposures:aBoolean in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7225
    "set or clear the graphics exposures flag"
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
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7228
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7229
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7230
	if (__isExternalAddress(aGCId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7231
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7232
	    XSetGraphicsExposures(myDpy, _GCVal(aGCId), (aBoolean==true)?1:0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7233
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7234
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7235
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7236
    }
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7237
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7238
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7239
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7240
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7241
setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7242
    "set line attributes; 
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7243
     lineStyle must be one of #solid, #dashed or #doubleDashed;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7244
     capStyle one of: #notLast, #butt, #round or #projecting;
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7245
     joinStyle one of: #miter, #bevel or #round."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7246
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7247
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7248
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7249
    int x_style, x_cap, x_join;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7250
    static char dashList[2] = { 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7251
    static char dotList[2]  = { 4,4 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7252
    static char dashDotList[4]    = { 4,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7253
    static char dashDotDotList[6] = { 4,1 , 1,1 , 1,1 };
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7254
    char *x_dashes = 0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7255
    int x_nDash;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7256
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7257
    if (ISCONNECTED) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7258
	if (__isExternalAddress(aGCId)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7259
	 && __isSmallInteger(aNumber)) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7260
	    Display *dpy = myDpy;
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7261
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7262
	    if (lineStyle == @symbol(solid)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7263
		x_dashes = (char *)0;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7264
		x_style = LineSolid;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7265
	    } else if (lineStyle == @symbol(dashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7266
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7267
		x_nDash = sizeof(dashList);
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  7268
		x_style = LineOnOffDash;
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7269
	    } else if (lineStyle == @symbol(doubleDashed)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7270
		x_dashes = dashList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7271
		x_nDash = sizeof(dashList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7272
		x_style = LineDoubleDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7273
	    } else if (lineStyle == @symbol(dotted)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7274
		x_dashes = dotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7275
		x_nDash = sizeof(dotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7276
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7277
	    } else if (lineStyle == @symbol(dashDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7278
		x_dashes = dashDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7279
		x_nDash = sizeof(dashDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7280
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7281
	    } else if (lineStyle == @symbol(dashDotDot)) {
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7282
		x_dashes = dashDotDotList;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7283
		x_nDash = sizeof(dashDotDotList);
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7284
		x_style = LineOnOffDash;
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7285
	    } else goto bad;
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7286
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7287
	    if (capStyle == @symbol(notLast)) x_cap = CapNotLast;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7288
	    else if (capStyle == @symbol(butt)) x_cap = CapButt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7289
	    else if (capStyle == @symbol(round)) x_cap  = CapRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7290
	    else if (capStyle == @symbol(projecting)) x_cap  = CapProjecting;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7291
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7292
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7293
	    if (joinStyle == @symbol(miter)) x_join = JoinMiter;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7294
	    else if (joinStyle == @symbol(bevel)) x_join = JoinBevel;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7295
	    else if (joinStyle == @symbol(round)) x_join  = JoinRound;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7296
	    else goto bad;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7297
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7298
	    ENTER_XLIB();
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7299
	    if (x_dashes) {
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7300
		XSetDashes(dpy, _GCVal(aGCId), 0, x_dashes, x_nDash);
2361
b721237f3265 added #dotted, #dashDot and #dashDotDot styles
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  7301
	    }
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7302
	    XSetLineAttributes(dpy,
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7303
			       _GCVal(aGCId), __intVal(aNumber),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7304
			       x_style, x_cap, x_join);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7305
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7306
	    RETURN ( self );
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  7307
	}
295
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
bad: ;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7310
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7311
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7312
     either aGCId is invalid,
1455
d217819923b3 removed obsolete methods
Claus Gittinger <cg@exept.de>
parents: 1430
diff changeset
  7313
     and/or lineWidth is not a smallInteger,
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7314
     and/or lineStyle is none of #solid, #dashed, #doubleDashed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7315
     and/or capStyle is none of #notLast, #butt, #round, #projecting
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7316
     and/or joinStyle is none of #miter, #bevel, #round
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7317
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7318
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7319
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7320
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7321
setMaskOriginX:orgX y:orgY in:aGCid
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7322
    "set the mask origin"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7323
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7324
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7325
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7326
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7327
	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7328
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7329
	    XSetTSOrigin(myDpy, _GCVal(aGCid), __intVal(orgX), __intVal(orgY));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7330
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7331
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7332
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7333
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7334
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7335
    self primitiveFailed
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
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7338
setPixmapMask:aPixmapId in:aGCId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7339
    "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
  7340
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7341
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7342
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  7343
    GC gc;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7344
    Pixmap pixmap;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7345
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7346
    if (ISCONNECTED) {
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7347
        Display *dpy = myDpy;
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7348
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7349
        if (__isExternalAddress(aGCId)) {
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7350
            gc = _GCVal(aGCId);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7351
            if (__isExternalAddress(aPixmapId)) {
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7352
                pixmap = _PixmapVal(aPixmapId);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7353
                ENTER_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7354
                XSetTile(dpy, gc, pixmap);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7355
                XSetFillStyle(dpy, gc, FillTiled);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7356
                LEAVE_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7357
                RETURN ( self );
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7358
            }
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7359
            if (aPixmapId == nil) {
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7360
                ENTER_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7361
                XSetFillStyle(dpy, gc, FillSolid);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7362
                LEAVE_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7363
                RETURN ( self );
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7364
            }
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  7365
        }
295
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
!XWorkstation methodsFor:'initialize / release'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7372
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7373
closeConnection
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7374
    "close down the connection to the X-server"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7375
3061
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7376
"/ 'closing' errorPrintCR.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7377
"/ thisContext fullPrintAll.
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7378
060d483207c2 allow color-name query - even if closed
Claus Gittinger <cg@exept.de>
parents: 3058
diff changeset
  7379
%{
295
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
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7382
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7383
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7384
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7385
	__INST(displayId) = nil;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7386
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7387
	XCloseDisplay(dpy);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  7388
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7389
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7390
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7391
%}
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
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7394
emergencyCloseConnection
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7395
    "low level close of the displays connection (without sending any buffered
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7396
     requests to the display). Only used in case of emergency (brokenConnection)"
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7397
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7398
%{ 
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7399
    if (ISCONNECTED) {
3016
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  7400
	close(ConnectionNumber(myDpy));
326429127f47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3015
diff changeset
  7401
	__INST(displayId) = nil;
3015
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7402
    }
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7403
%}
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7404
!
401637ae1c72 emergencyClose
Claus Gittinger <cg@exept.de>
parents: 3001
diff changeset
  7405
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7406
initializeDefaultValues
2685
094ce08f9fc5 made activateOnClick an instance method
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  7407
    activateOnClick := false.
2862
2f43bf146110 moved some init stuff to super
Claus Gittinger <cg@exept.de>
parents: 2856
diff changeset
  7408
    super initializeDefaultValues.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7409
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7410
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7411
initializeDeviceSignals
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7412
    super initializeDeviceSignals.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7413
2984
6a278fd02e74 Signal init.
Stefan Vogel <sv@exept.de>
parents: 2977
diff changeset
  7414
    deviceIOTimeoutErrorSignal := deviceIOErrorSignal newSignal.
2856
95cb0ea5f7cc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2855
diff changeset
  7415
    deviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7416
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7417
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7418
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7419
    ObjectMemory registerErrorInterruptHandler:self class forID:#DisplayIOTimeoutError.
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7420
!
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7421
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7422
initializeEventBuffer
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7423
    |sz|
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
%{
315
2abc494f0c45 _-macros replaced by __-macros
Claus Gittinger <cg@exept.de>
parents: 310
diff changeset
  7426
    sz = __MKSMALLINT(sizeof(XEvent) + 100);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7427
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7428
    eventBuffer isNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7429
	eventBuffer := ByteArray new:sz.
295
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
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7432
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7433
initializeFor:aDisplayName
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7434
    "initialize the receiver for a connection to an X-Server;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7435
     the argument, aDisplayName may be nil (for the default server from
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7436
     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
  7437
     as hostname:number"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7438
334
8c851e8a0b05 access comandline args via access method
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  7439
    |dpyName index arguments|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7440
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7441
    displayId notNil ifTrue:[
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7442
        "/ already connected - you bad guy try to trick me manually ?
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7443
        ^ self
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7444
    ].
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7445
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7446
    dpyName := aDisplayName.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7447
    dpyName isNil ifTrue:[
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7448
        "look for a '-display xxx' argument"
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7449
        (arguments := Smalltalk commandLineArguments) notNil ifTrue:[
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7450
            index := arguments indexOf:'-display'.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7451
            (index between:1 and:(arguments size - 1)) ifTrue:[
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7452
                dpyName := arguments at:index+1
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7453
            ]
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7454
        ].
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7455
        dpyName isNil ifTrue:[
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7456
            dpyName := OperatingSystem getEnvironment:'DISPLAY'.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7457
        ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7458
    ].
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7459
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7460
    self openConnectionTo:dpyName.
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7461
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7462
    displayId isNil ifTrue:[
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7463
        "/ could not connect.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7464
        "/ only output a message, if running under X
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7465
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7466
        ((OperatingSystem isMSWINDOWSlike not) or:[WinWorkstation isNil]) ifTrue:[
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7467
            'XWorkstation [warning]: cannot connect to Display (' infoPrint.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7468
            (dpyName ? ((OperatingSystem getEnvironment:'Display') ? 'default')) infoPrint.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7469
            ')' infoPrintCR.
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7470
        ].
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7471
        ^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7472
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7473
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7474
    dispatching := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7475
    dispatchingExpose := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7476
    isSlow := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7477
    shiftDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7478
    ctrlDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7479
    metaDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7480
    altDown := false.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7481
    motionEventCompression := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7482
    buttonsPressed := 0.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7483
    displayName := dpyName.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7484
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7485
    protocolsAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7486
    deleteWindowAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7487
    saveYourselfAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7488
    quitAppAtom := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7489
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7490
    self initializeDeviceResourceTables.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7491
    self initializeScreenProperties.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7492
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7493
    self initializeDefaultValues.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7494
    self initializeEventBuffer.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7495
    self initializeSpecialFlags.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7496
    self initializeKeyboardMap.
2855
f1fca530bab1 moved signal creation up in the hierarchy
Claus Gittinger <cg@exept.de>
parents: 2791
diff changeset
  7497
    self initializeDeviceSignals.
2992
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7498
95837ca26ca0 lazy init of ViewStyle stuff
Stefan Vogel <sv@exept.de>
parents: 2984
diff changeset
  7499
    self initializeViewStyle.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7500
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7501
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7502
initializeModifierMappings
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7503
    "initialize keyboard modifiers.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7504
     We assume that mod1 are the META modifiers and mod2 are the ALT modifiers,
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7505
     but if any of them contains the Num_Lock key, it is disregarded."
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7506
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7507
    |map mod|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7508
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7509
    super initializeModifierMappings.                                     
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7510
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7511
    map := self modifierMapping.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  7512
    map isNil ifTrue:[
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7513
        "/
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7514
        "/ mhmh - a crippled Xlib which does not provide modifier mappings
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7515
        "/ setup some reasonable default. If that is not sufficient,
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7516
        "/ you have to change things from your display.rc file.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7517
        "/
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7518
        altModifierMask := self modifier1Mask.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7519
        metaModifierMask := self modifier2Mask.
342
a52a4e45a294 more on modifiers
Claus Gittinger <cg@exept.de>
parents: 341
diff changeset
  7520
    ] ifFalse:[
3200
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7521
        altModifierMask := 0.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7522
        metaModifierMask := 0.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7523
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7524
        mod := map at:1.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7525
        mod notNil ifTrue:[
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7526
            shiftModifiers := mod collect:[ :key | self stringFromKeycode:key ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7527
        ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7528
        mod := map at:3.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7529
        mod notNil ifTrue:[
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7530
            ctrlModifiers  := mod collect:[ :key | self stringFromKeycode:key ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7531
        ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7532
        mod := map at:4.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7533
        mod notNil ifTrue:[
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7534
            mod := mod collect:[ :key | self stringFromKeycode:key ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7535
            (mod includes:'Num_Lock') ifFalse:[
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7536
                metaModifiers := mod.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7537
                metaModifierMask := 1 bitShift:(4-1).
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7538
            ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7539
        ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7540
        mod := map at:5.
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7541
        mod notNil ifTrue:[
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7542
            mod := mod collect:[ :key | self stringFromKeycode:key ].    
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7543
            (mod includes:'Num_Lock') ifFalse:[
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7544
                altModifiers   := mod.    
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7545
                altModifierMask := 1 bitShift:(5-1).
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7546
            ].
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7547
        ]
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7548
    ].                                                          
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7549
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7550
    "
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7551
      Display initializeModifierMappings
f92ccb3cac8e Care for Num_Lock in any of the mod1- or mod2-keys.
Stefan Vogel <sv@exept.de>
parents: 3177
diff changeset
  7552
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7553
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7554
    "Modified: 1.12.1995 / 23:44:40 / stefan"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7555
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7556
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7557
initializeScreenProperties
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7558
    super initializeScreenProperties.
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7559
1627
e7ba6be03b14 removed dangerous NOCONTEXT primitives
Claus Gittinger <cg@exept.de>
parents: 1610
diff changeset
  7560
%{
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7561
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  7562
    Display *dpy;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7563
    int scr;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7564
    Visual *visual;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7565
    XVisualInfo viproto;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7566
    XVisualInfo *vip;                   /* retured info */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7567
    int maxRGBDepth;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7568
    int rgbRedMask, rgbGreenMask, rgbBlueMask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7569
    int rgbVisualID;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7570
    int nvi, i;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7571
    int shapeEventBase, shapeErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7572
    int shmEventBase, shmErrorBase;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7573
    char *type, *nm;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7574
    int dummy;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7575
    int mask, shift, nBits;
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
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7578
	dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7579
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7580
	__INST(altModifierMask) = __MKSMALLINT(Mod2Mask);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7581
	__INST(metaModifierMask) = __MKSMALLINT(Mod1Mask);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7582
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7583
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7584
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7585
	__INST(screen) = __MKSMALLINT(scr = DefaultScreen(dpy));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7586
	__INST(depth) = __MKSMALLINT(DisplayPlanes(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7587
	__INST(ncells) = __MKSMALLINT(DisplayCells(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7588
	__INST(width) = __MKSMALLINT(DisplayWidth(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7589
	__INST(height) = __MKSMALLINT(DisplayHeight(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7590
	__INST(widthMM) = __MKSMALLINT(DisplayWidthMM(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7591
	__INST(heightMM) = __MKSMALLINT(DisplayHeightMM(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7592
	__INST(blackpixel) = __MKSMALLINT(BlackPixel(dpy, scr));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7593
	__INST(whitepixel) = __MKSMALLINT(WhitePixel(dpy, scr));
295
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
#ifdef SHAPE
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7596
	if (XShapeQueryExtension(dpy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7597
	    __INST(hasShapeExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7598
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7599
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7600
	  __INST(hasShapeExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7601
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7602
#ifdef SHM
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7603
	if (XQueryExtension(dpy, "MIT_SHM", &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7604
	    __INST(hasShmExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7605
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7606
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7607
	  __INST(hasShmExtension) = false;
295
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
#ifdef DPS
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7610
	if (XQueryExtension(dpy, "DPSExtension", &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7611
	    __INST(hasDPSExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7612
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7613
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7614
	  __INST(hasDPSExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7615
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7616
#ifdef XVIDEO
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7617
	if (XQueryExtension(dpy, "XVideo", &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7618
	    __INST(hasXVideoExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7619
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7620
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7621
	  __INST(hasXVideoExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7622
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7623
#ifdef MBUF
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7624
	if (XQueryExtension(dpy, "Multi-Buffering", &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7625
	    __INST(hasMbufExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7626
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7627
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7628
	  __INST(hasMbufExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7629
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7630
#ifdef PEX5
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7631
	if (XQueryExtension(dpy, PEX_NAME_STRING, &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7632
	    __INST(hasPEXExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7633
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7634
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7635
	  __INST(hasPEXExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7636
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7637
#ifdef XIE
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7638
	if (XQueryExtension(dpy, xieExtName, &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7639
	    __INST(hasImageExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7640
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7641
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7642
	  __INST(hasImageExtension) = false;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7643
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7644
#ifdef XI
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7645
	if (XQueryExtension(dpy, "XInputExtension", &dummy, &dummy, &dummy))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7646
	    __INST(hasInputExtension) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7647
	else
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7648
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7649
	  __INST(hasInputExtension) = false;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7650
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7651
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7652
	 * look for RGB visual
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7653
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7654
	nvi = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7655
	viproto.screen = scr;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7656
	vip = XGetVisualInfo (dpy, VisualScreenMask, &viproto, &nvi);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7657
	maxRGBDepth = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7658
	for (i = 0; i < nvi; i++) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7659
	    switch (vip[i].class) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7660
		case TrueColor:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7661
		    if (vip[i].depth > maxRGBDepth) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7662
			maxRGBDepth = vip[i].depth;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7663
			rgbRedMask = vip[i].red_mask;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7664
			rgbGreenMask = vip[i].green_mask;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7665
			rgbBlueMask = vip[i].blue_mask;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7666
			rgbVisualID = vip[i].visualid;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7667
		    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7668
		    break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7669
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7670
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7671
	if (vip) XFree ((char *) vip);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7672
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7673
	if (maxRGBDepth) {
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  7674
	    __INST(rgbVisual) = __MKEXTERNALADDRESS(rgbVisualID); __STORESELF(rgbVisual);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7675
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7676
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7677
	visual = DefaultVisualOfScreen(DefaultScreenOfDisplay(dpy));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7678
	__INST(monitorType) = @symbol(unknown);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7679
	__INST(hasColors) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7680
	__INST(hasGreyscales) = true;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7681
	switch (visual->class) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7682
	    case StaticGray:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7683
		__INST(visualType) = @symbol(StaticGray);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7684
		__INST(hasColors) = false;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7685
		__INST(monitorType) = @symbol(monochrome);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7686
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7687
	    case GrayScale:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7688
		__INST(visualType) = @symbol(GrayScale);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7689
		__INST(hasColors) = false;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7690
		__INST(monitorType) = @symbol(monochrome);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7691
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7692
	    case StaticColor:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7693
		__INST(visualType) = @symbol(StaticColor);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7694
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7695
	    case PseudoColor:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7696
		__INST(visualType) = @symbol(PseudoColor);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7697
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7698
	    case TrueColor:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7699
		__INST(visualType) = @symbol(TrueColor);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7700
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7701
	    case DirectColor:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7702
		__INST(visualType) = @symbol(DirectColor);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7703
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7704
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7705
	if (DisplayCells(dpy, scr) == 2) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7706
	    __INST(hasColors) = false;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7707
	    __INST(hasGreyscales) = false;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7708
	    __INST(monitorType) = @symbol(monochrome);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7709
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7710
	__INST(bitsPerRGB) = __MKSMALLINT(visual->bits_per_rgb);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7711
	__INST(redMask)   = __MKSMALLINT(visual->red_mask);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7712
	__INST(greenMask) = __MKSMALLINT(visual->green_mask);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7713
	__INST(blueMask)  = __MKSMALLINT(visual->blue_mask);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7714
	switch (visual->class) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7715
	    case TrueColor:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7716
		/* extract number of bits and shift counts */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7717
		mask = visual->red_mask;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7718
		shift = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7719
		while (mask && ((mask & 1) == 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7720
		    mask >>= 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7721
		    shift++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7722
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7723
		__INST(redShift) = __MKSMALLINT(shift);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7724
		nBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7725
		while (mask) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7726
		    mask >>= 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7727
		    nBits++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7728
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7729
		__INST(bitsRed) = __MKSMALLINT(nBits);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7730
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7731
		mask = visual->green_mask;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7732
		shift = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7733
		while (mask && ((mask & 1) == 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7734
		    mask >>= 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7735
		    shift++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7736
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7737
		__INST(greenShift) = __MKSMALLINT(shift);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7738
		nBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7739
		while (mask) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7740
		    mask >>= 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7741
		    nBits++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7742
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7743
		__INST(bitsGreen) = __MKSMALLINT(nBits);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7744
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7745
		mask = visual->blue_mask;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7746
		shift = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7747
		while (mask && ((mask & 1) == 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7748
		    mask >>= 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7749
		    shift++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7750
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7751
		__INST(blueShift) = __MKSMALLINT(shift);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7752
		nBits = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7753
		while (mask) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7754
		    mask >>= 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7755
		    nBits++;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7756
		}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7757
		__INST(bitsBlue) = __MKSMALLINT(nBits);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7758
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7759
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7760
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7761
#ifndef XA_PRIMARY
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7762
	__INST(primaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "PRIMARY", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7763
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7764
	__INST(primaryAtom) = __MKATOMOBJ( XA_PRIMARY );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7765
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7766
#ifndef XA_SECONDARY
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7767
	__INST(secondaryAtom) = __MKATOMOBJ( XInternAtom(dpy, "SECONDARY", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7768
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7769
	__INST(secondaryAtom) = __MKATOMOBJ( XA_SECONDARY );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7770
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7771
#ifndef XA_CUT_BUFFER0
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7772
	__INST(cutBuffer0Atom) = __MKATOMOBJ( XInternAtom(dpy, "CUT_BUFFER0", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7773
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7774
	__INST(cutBuffer0Atom) = __MKATOMOBJ( XA_CUT_BUFFER0 );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7775
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7776
#ifndef XA_STRING
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7777
	__INST(stringAtom) = __MKATOMOBJ( XInternAtom(dpy, "STRING", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7778
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7779
	__INST(stringAtom) = __MKATOMOBJ( XA_STRING );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7780
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7781
#ifndef XA_LENGTH
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7782
	__INST(lengthAtom) = __MKATOMOBJ( XInternAtom(dpy, "LENGTH", True) );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7783
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7784
	__INST(lengthAtom) = __MKATOMOBJ( XA_LENGTH );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7785
#endif
1533
18e7a458b625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  7786
#ifndef WM_STATE
18e7a458b625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  7787
	__INST(wmStateAtom) = __MKATOMOBJ( XInternAtom(dpy, "WM_STATE", True) );
18e7a458b625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  7788
#else
18e7a458b625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  7789
	__INST(wmStateAtom) = __MKATOMOBJ( WM_STATE );
18e7a458b625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  7790
#endif
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7791
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7792
815
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7793
    }
1e659479b292 call super in initScreenProps
Claus Gittinger <cg@exept.de>
parents: 811
diff changeset
  7794
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7795
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7796
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7797
initializeSpecialFlags
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7798
    "perform additional special server implementation flags"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7799
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7800
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7801
    "/ assume we have it ... (should check)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7802
    "/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7803
    hasSaveUnder := true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7804
    ignoreBackingStore := false.
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 serverVendor = 'X11/NeWS') ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7807
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7808
	"/ this is a kludge around a bug in the X11/NeWS server,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7809
	"/ which does not correctly handle saveUnder
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7810
	"/
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7811
	hasSaveUnder := false.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7812
    ].
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
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7815
openConnectionTo:dpyName
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7816
    "open a connection to some display;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7817
     set my displayId if ok; leaves it as nil of not ok"
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7818
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7819
%{
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7820
    Display *dpy;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7821
    int i;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7822
    char *nm;
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7823
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7824
    if (__INST(displayId) != nil) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7825
        /*
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7826
         * already connected - you bad guy try to
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7827
         * trick me manually ?
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7828
         */
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7829
        RETURN ( self );
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7830
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7831
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7832
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7833
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7834
    if (__isString(dpyName))
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7835
        nm = (char *) __stringVal(dpyName);
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7836
    else {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7837
        nm = NULL;
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7838
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7839
    dpy = XOpenDisplay(nm);
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7840
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7841
    if (dpy) {
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7842
        static int firstCall = 1;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7843
        OBJ dpyID;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7844
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7845
        __INST(displayId) = dpyID = __MKEXTERNALADDRESS(dpy); __STORE(self, dpyID);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7846
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7847
        if (firstCall) {
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7848
            firstCall = 0;
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7849
            XSetErrorHandler(__XErrorHandler__);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7850
            XSetIOErrorHandler(__XIOErrorHandler__);
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
  7851
        }
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7852
    }
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7853
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  7854
2286
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7855
%}
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7856
!
111e4f4993be *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2268
diff changeset
  7857
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7858
reinitialize
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7859
    virtualRootId := rootId := nil.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7860
    super reinitialize.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7861
    dispatchingExpose := nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7862
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7863
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7864
!XWorkstation methodsFor:'keyboard mapping'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  7865
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7866
altModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7867
    "return the mask (in motionEvents) for the alt-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7868
     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
  7869
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7870
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7871
    ^ altModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7872
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7873
    "Created: 23.3.1996 / 12:43:22 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7874
    "Modified: 23.3.1996 / 12:44:56 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7875
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7876
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7877
altModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7878
    "define which key takes the role of an alt-key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7879
     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
  7880
     most keyboards. However, there may be exceptions to this,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7881
     and the setting can be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7882
	Display altModifierMask:(Display modifier2Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7883
     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
  7884
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7885
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7886
    altModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7887
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7888
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7889
metaModifierMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7890
    "return the mask (in motionEvents) for the meta-key modifier.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7891
     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
  7892
     therefore return a variable here, which can be changed during startup."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7893
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7894
    ^ metaModifierMask
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7895
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7896
    "Created: 23.3.1996 / 12:43:39 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7897
    "Modified: 23.3.1996 / 12:45:09 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7898
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  7899
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7900
metaModifierMask:aSmallInteger
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7901
    "define which key takes the role of a meta key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7902
     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
  7903
     most keyboards (if present at all).
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7904
     However, there may be exceptions to this, and the setting can
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7905
     be changed with:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7906
	Display metaModifierMask:(Display modifier1Mask)
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7907
     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
  7908
     As reported, some Xservers place the Meta-key onto NumLock,
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7909
     and having NumLock enabled makes ST/X think, that meta is pressed
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7910
     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
  7911
     the mask to 0.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7912
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7913
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7914
    metaModifierMask := aSmallInteger
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7915
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7916
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7917
modifier1Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7918
    "return the Xlib mask bit for the 1st modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7919
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7920
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7921
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7922
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7923
    RETURN (__MKSMALLINT(Mod1Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7924
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7925
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7926
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7927
modifier2Mask
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7928
    "return the Xlib mask bit for the 2nd modifier key.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7929
     See comment in altModifierMask: / metaModifierMask: for what
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7930
     this could be used."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7931
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7932
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7933
    RETURN (__MKSMALLINT(Mod2Mask));
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7934
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7935
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7936
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7937
modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7938
    "Get the Modifier Mapping.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7939
     We return an array of arrays of keycodes"
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7940
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7941
    |modifierKeyMap maxKeyPerMod ret nextKey|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7942
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7943
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7944
    XModifierKeymap *modmap;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7945
    OBJ __BYTEARRAY_UNINITIALIZED_NEW_INT();
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7946
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7947
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7948
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7949
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  7950
	if ((modmap = XGetModifierMapping(dpy)) != 0) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7951
	   maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7952
	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7953
	   if (modifierKeyMap != nil) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7954
		maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7955
		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7956
		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7957
	   }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7958
	   XFreeModifiermap(modmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7959
	}
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7960
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7961
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7962
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7963
    modifierKeyMap isNil ifTrue:[^ nil].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7964
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7965
    ret := Array new:8.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7966
    nextKey := 1.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7967
    1 to:8 do:[ :i |
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7968
	(modifierKeyMap at:nextKey) ~= 0 ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7969
	    |mod|
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7970
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7971
	    mod := OrderedCollection new:maxKeyPerMod.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7972
	    modifierKeyMap from:nextKey to:(nextKey+maxKeyPerMod-1) do:[ :key |
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7973
		key ~= 0 ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7974
		    mod add:key
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7975
		].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7976
	    ].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7977
	    ret at:i put:mod.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7978
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7979
	nextKey := nextKey+maxKeyPerMod.
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7980
    ].
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7981
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7982
    ^ ret
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7983
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7984
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7985
	Display modifierMapping
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7986
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7987
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7988
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7989
stringFromKeycode:code
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7990
    "Get a KeySymbol (a smalltalk symbol) from the keycode."
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7991
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7992
    |str|
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7993
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7994
%{
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7995
    KeySym keysym;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7996
    char *keystring;
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7997
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  7998
    if (ISCONNECTED && __isSmallInteger(code)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  7999
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8000
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8001
	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol &&
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8002
	    (keystring = XKeysymToString(keysym)) != 0) 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8003
	    str = __MKSTRING(keystring);
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8004
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8005
%}.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8006
    ^ str
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8007
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8008
    "
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8009
	Display stringFromKeycode:28
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8010
    "
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8011
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8012
2140
21ad63e0c739 allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  8013
translateKey:untranslatedKey forView:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8014
    "Return the key translated via the translation table.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8015
     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
  8016
     which gets further processed in the superclasses translation method."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8017
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8018
    |key|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8019
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8020
    (key := untranslatedKey) isString ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8021
	key := RawKeysymTranslation at:key ifAbsent:key.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8022
	key := key asSymbol.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8023
    ].
2140
21ad63e0c739 allow for views to provide a private keyboardMap.
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  8024
    ^ super translateKey:key forView:aView
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8025
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8026
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8027
!XWorkstation methodsFor:'misc'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8028
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8029
beep
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8030
    "output an audible beep or bell"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8031
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8032
    UserPreferences current beepEnabled ifTrue:[
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8033
	self beep:50
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8034
    ]
3079
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8035
c72afe99c62c allow beeper to be disabled.
ps
parents: 3061
diff changeset
  8036
    "Modified: / 3.12.1999 / 17:13:59 / ps"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8037
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8038
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8039
beep:volumeInPercent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8040
    "output an audible beep"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8041
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8042
    int volume;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8043
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8044
    if (__isSmallInteger(volumeInPercent) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8045
	/* stupid: X wants -100 .. 100 and calls this percent */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8046
	volume = __intVal(volumeInPercent) * 2 - 100;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8047
	if (volume < -100) volume = -100;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8048
	else if (volume > 100) volume = 100;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8049
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8050
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8051
	XBell(myDpy, volume);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8052
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8053
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8054
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8055
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8056
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8057
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8058
buffered
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8059
    "buffer drawing - do not send it immediately to the display.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8060
     This is the default anyway.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8061
     See #unBuffered for additional info."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8062
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8063
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8064
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8065
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8066
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8067
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8068
	XSynchronize(myDpy, 0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8069
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8070
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8071
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8072
%}
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8073
    "
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8074
     Display buffered
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8075
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8076
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8077
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8078
flush
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8079
    "send all buffered drawing to the display.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8080
     This may be required to make certain, that all previous operations
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8081
     are really sent to the display before continuing. For example,
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8082
     after a cursor-change with a followup long computation.
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8083
     (otherwise, the cursor change request may still be in the output buffer)
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8084
     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
  8085
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8086
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8087
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8088
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8089
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8090
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8091
	XFlush(myDpy);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8092
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8093
310
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8094
    }
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8095
%}
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8096
!
6ed27eebc243 stefans event queue changes
Claus Gittinger <cg@exept.de>
parents: 303
diff changeset
  8097
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8098
flushDpsContext:aDPSContext
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8099
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8100
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8101
#ifdef DPS
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8102
    if (__isExternalAddress(aDPSContext)) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8103
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8104
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8105
	DPSFlushContext(MKDPSCONTEXT(aDPSContext));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8106
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8107
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8108
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8109
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8110
#endif
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8111
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8112
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8113
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8114
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8115
refreshKeyboardMapping:eB
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8116
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8117
    XMappingEvent *ev;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8118
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8119
    if (__isByteArray(eB)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8120
	ev = (XMappingEvent *)(__ByteArrayInstPtr(eB)->ba_element);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8121
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8122
	XRefreshKeyboardMapping(ev);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8123
	LEAVE_XLIB();
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8124
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8125
%}
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8126
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8127
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8128
setInputFocusTo:aWindowId
2871
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8129
    "set the focus to the view as defined by aWindowId.
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8130
     When released, return the focus to the root window"
f33c75104fa9 comment
Claus Gittinger <cg@exept.de>
parents: 2862
diff changeset
  8131
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8132
"/    self setInputFocusTo:aWindowId revertTo:#parent
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8133
    self setInputFocusTo:aWindowId revertTo:#root
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8134
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8135
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8136
setInputFocusTo:aWindowId revertTo:revertSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8137
    "set the focus to the view as defined by aWindowId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8138
     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
  8139
     input until a new focus is set.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8140
     RevertSymbol specifies what should happen if the view becomes invisible;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8141
     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
  8142
     given to the parent view, the root view or no view."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8143
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8144
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8145
    int arg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8146
    Window focusWindow;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8147
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8148
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8149
	if (__isExternalAddress(aWindowId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8150
	    focusWindow = _WindowVal(aWindowId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8151
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8152
	    focusWindow = None;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8153
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8154
	if (revertSymbol == @symbol(parent))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8155
	    arg = RevertToParent;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8156
	else if (revertSymbol == @symbol(root))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8157
	    arg = RevertToPointerRoot;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8158
	else 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8159
	    arg = RevertToNone;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8160
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8161
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8162
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8163
	XSetInputFocus(myDpy, focusWindow, arg, CurrentTime);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8164
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8165
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8166
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8167
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8168
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8169
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8170
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8171
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8172
sync
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8173
    "send all buffered drawing to the display AND wait until the display
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8174
     has finished drawing it.
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8175
     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
  8176
     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
  8177
     to be finished. See also #flush."
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8178
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8179
%{  /* NOCONTEXT */
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8180
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8181
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8182
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8183
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8184
	XSync(myDpy, 0);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8185
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8186
341
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8187
    }
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8188
%}
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8189
!
47ac178c3924 modifiermappings - again
Claus Gittinger <cg@exept.de>
parents: 334
diff changeset
  8190
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8191
unBuffered
374
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8192
    "make all drawing be sent immediately to the display.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8193
     This makes all graphics synchronous and turns off any buffering
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8194
     (i.e. each individual draw-request is sent immediately without 
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8195
      packing multiple requests into a larger message buffer).
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8196
     Be prepared, that this slows down graphics considerably.
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8197
     However, it allows display errors to be handled immediately and
17c544cc1fad commentary
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  8198
     may be useful if you get Xdisplay errors and want to find the request
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8199
     which was responsible for it. See also #buffered."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8200
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8201
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8202
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8203
    if (ISCONNECTED) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8204
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8205
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8206
	XSynchronize(myDpy, 1);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8207
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8208
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8209
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8210
%}
1813
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8211
    "
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8212
     Display unBuffered
2622c38573df *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1798
diff changeset
  8213
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8214
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8215
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8216
!XWorkstation methodsFor:'pointer stuff'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8217
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8218
anyButtonStateMask
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8219
    "return an integer for masking out any button from a
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8220
     buttonStates value."
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8221
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8222
    "/ should use ``Display buttonXMotionMask bitOr:....''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8223
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8224
    ^ 256 + 512 + 1024
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8225
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8226
    "Modified: 23.3.1996 / 12:41:33 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8227
    "Created: 23.3.1996 / 12:46:35 / cg"
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8228
!
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8229
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8230
buttonStates
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8231
    "return an integer representing the state of the pointer buttons;
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8232
     a one-bit in positions 0.. represent a pressed button.
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8233
     See the button1Mask/button2Mask/button3Mask,
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8234
     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
  8235
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8236
%{  /* NOCONTEXT*/
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8237
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  8238
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8239
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8240
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8241
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8242
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8243
    if (ISCONNECTED) {
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8244
	Display *dpy = myDpy;
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8245
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8246
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8247
#ifdef VIRTUAL_ROOT
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8248
	w = getRootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8249
#else
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8250
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8251
#endif
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8252
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8253
	if (w) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8254
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8255
	    ENTER_XLIB();
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8256
	    XQueryPointer(dpy, w, &rootRet, &childRet,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8257
				 &rootX, &rootY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8258
				 &winX, &winY,
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8259
				 &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8260
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8261
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8262
	    RETURN (__MKSMALLINT(mask));
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8263
	}
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8264
    }
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8265
%}.
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8266
    self primitiveFailed
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8267
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8268
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8269
     Display buttonStates     
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8270
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8271
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8272
    "is the control-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8273
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8274
     Display buttonStates bitTest:(Display controlMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8275
    "
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8276
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8277
    "is the alt/meta-key pressed ?
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8278
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8279
     Display buttonStates bitTest:(Display altModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8280
     Display buttonStates bitTest:(Display metaModifierMask)    
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8281
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8282
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8283
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8284
leftButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8285
    "return an integer for masking out the left button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8286
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8287
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8288
    "/ should use ``Display button1MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8289
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8290
    ^ 256
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8291
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8292
    "Modified: 23.3.1996 / 12:41:33 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8293
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8294
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8295
middleButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8296
    "return an integer for masking out the middle button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8297
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8298
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8299
    "/ should use ``Display button2MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8300
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8301
    ^ 512
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8302
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8303
    "Modified: 23.3.1996 / 12:41:43 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8304
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8305
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8306
pointerPosition
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8307
    "return the current pointer position in root-window coordinates"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8308
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8309
    |xpos ypos|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8310
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8311
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8312
    Window w;
555
2705be333c5f underscore macro cleanup
Claus Gittinger <cg@exept.de>
parents: 551
diff changeset
  8313
    int screen = __intVal(__INST(screen));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8314
    Window rootRet, childRet;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8315
    int rootX, rootY, winX, winY;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8316
    unsigned int mask;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8317
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8318
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8319
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8320
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8321
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8322
#ifdef VIRTUAL_ROOT
2541
6c3bf8c5435e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2537
diff changeset
  8323
	w = getRootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8324
#else
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8325
	w = RootWindow(dpy, screen);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8326
#endif
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8327
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8328
	XQueryPointer(dpy, w, &rootRet, &childRet,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8329
			      &rootX, &rootY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8330
			      &winX, &winY,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8331
			      &mask);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8332
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8333
	xpos = __MKSMALLINT(rootX);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8334
	ypos = __MKSMALLINT(rootY);
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8335
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8336
    }
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8337
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8338
    ^ xpos @ ypos
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8339
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8340
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8341
rightButtonStateMask
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8342
    "return an integer for masking out the right button from a
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8343
     buttonStates value"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8344
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8345
    "/ should use ``Display button3MotionMask''
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8346
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8347
    ^ 1024
540
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8348
c954c490c8be stateMask methods & commentary
Claus Gittinger <cg@exept.de>
parents: 487
diff changeset
  8349
    "Modified: 23.3.1996 / 12:41:52 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8350
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8351
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8352
rootPositionOfLastEvent
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8353
    "return the position in root-window coordinates
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8354
     of the last button, key or pointer event"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8355
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8356
    ^ eventRootX @ eventRootY
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8357
!
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8358
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8359
setPointerPosition:newPosition in:aWindowId
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8360
    "change the pointer position to a new position relative to the
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8361
     given windows origin (which may be the rootWindow).
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8362
     Be careful with this - its usually not very ergonimically
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8363
     to change the mousePointer position.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8364
     This interface is provided for special applications (presentation
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8365
     playback) and should not be used in normal applications."
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8366
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8367
    |xpos ypos|
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8368
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8369
    xpos := newPosition x.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8370
    ypos := newPosition y.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8371
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8372
%{
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8373
    if (ISCONNECTED
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8374
     && __isExternalAddress(aWindowId)
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8375
     && __bothSmallInteger(xpos, ypos)) {
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8376
	Display *dpy = myDpy;
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8377
	Window w = _WindowVal(aWindowId);
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8378
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8379
	ENTER_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8380
	XWarpPointer(dpy, 
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8381
		     None,  /* src window */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8382
		     w,  /* dst window */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8383
		     0,  /* src_x */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8384
		     0,  /* src_y */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8385
		     0,  /* src_w */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8386
		     0,  /* src_h */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8387
		     __intVal(xpos),  /* dst_x */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8388
		     __intVal(ypos)   /* dst_y */
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8389
		    );
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8390
	LEAVE_XLIB();
1718
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8391
    }
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8392
%}.
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8393
    ^ self
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8394
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8395
    "
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8396
     Display setPointerPosition:1000@1000
886b895eb2f3 added setPointerPosition: for recorder/playback support
Claus Gittinger <cg@exept.de>
parents: 1709
diff changeset
  8397
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8398
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8399
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8400
!XWorkstation methodsFor:'properties'!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8401
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8402
getObjectProperty:propertyID from:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8403
    "get an object property from the server; return object or nil"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8404
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8405
    self getProperty:propertyID from:aWindowID into:[:type :value |
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8406
	type == stringAtom ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8407
	    ^ value
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8408
	].
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8409
	(value isMemberOf:ByteArray) ifTrue:[
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8410
	    ^ (Object readBinaryFrom:(ReadStream on:value) onError:[nil])
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8411
	]
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8412
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8413
    ^ nil
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8414
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8415
    "Modified: 6.4.1997 / 13:27:07 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8416
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8417
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8418
getProperty:propertyID from:aWindowID into:aTwoArgBlock
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8419
    "get a property, evaluate aTwoArgBlock with typeID and value"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8420
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8421
    |val typeID cls|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8422
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8423
    cls := ByteArray.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8424
%{
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8425
    Window window;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8426
    Atom property;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8427
    char *cp, *cp2;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8428
    Atom actual_type;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8429
    int actual_format,i;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8430
    unsigned long nitems, bytes_after, nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8431
    unsigned char *data;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8432
    int ok = 1;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8433
#   define PROP_SIZE    2048
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8434
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8435
    if (ISCONNECTED) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8436
	Display *dpy = myDpy;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8437
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8438
	if (__isAtomID(propertyID)) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8439
	    property = _AtomVal(propertyID);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8440
	    if (__isExternalAddress(aWindowID)) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8441
		window = _WindowVal(aWindowID);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8442
	    } else {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8443
		window = DefaultRootWindow(dpy);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8444
	    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8445
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8446
	    nread = 0;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8447
	    cp = 0;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8448
/*
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8449
	    fprintf(stderr, "getProperty: ");
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8450
 */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8451
	    do {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8452
		if (XGetWindowProperty(dpy,window,property,nread/4,PROP_SIZE,False,
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8453
				       AnyPropertyType,&actual_type,&actual_format,
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8454
				       &nitems,&bytes_after,(unsigned char **)&data)
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8455
		    != Success) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8456
			ok = 0;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8457
			break;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8458
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8459
		typeID = __MKATOMOBJ(actual_type);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8460
		if (! cp) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8461
		    cp = cp2 = (char *)malloc(nitems+1);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8462
		} else {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8463
		    cp = (char *)realloc(cp, nread + nitems + 1);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8464
		    cp2 = cp + nread;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8465
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8466
		if (! cp) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8467
		    XFree(data);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8468
		    goto fail;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8469
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8470
    
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8471
		nread += nitems;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8472
		bcopy(data, cp2, nitems);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8473
		XFree(data);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8474
    /*
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8475
		fprintf(stderr, "<nitems:%d bytes_after:%d>", nitems, bytes_after);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8476
     */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8477
	    } while (bytes_after > 0);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8478
    /*
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8479
	    fprintf(stderr, "\n");
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8480
     */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8481
    
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8482
	    if (ok) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8483
		if (actual_type == XA_STRING) {
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8484
		    cp[nread] = '\0';
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8485
		    val = __MKSTRING_L(cp, nread);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8486
		} else {
2449
5fdfb68d0bcc renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 2428
diff changeset
  8487
		    val = __STX___new(nread + OHDR_SIZE);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8488
		    val->o_class = cls;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8489
		    bcopy(cp, __ByteArrayInstPtr(val)->ba_element, nread);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8490
		}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8491
	    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8492
	    if (cp)
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8493
		free(cp);
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8494
	}
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8495
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8496
fail: ;
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8497
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8498
    typeID isNil ifTrue:[
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8499
	^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8500
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8501
    aTwoArgBlock value:typeID value:val.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8502
    ^ true
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8503
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8504
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8505
getTextProperty:propertyID from:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8506
    "get a text property; return string or nil"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8507
1798
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  8508
    |stringClass|
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  8509
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8510
    self getProperty:propertyID from:aWindowID into:[:type :value |
1906
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8511
	type == stringAtom ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8512
	    clipBoardEncoding notNil ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8513
		stringClass := (CharacterArray classForEncoding:clipBoardEncoding).
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8514
		stringClass ~~ String ifTrue:[
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8515
		    ^ stringClass fromBytes:(value asByteArray)
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8516
		].
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8517
		^ value decodeFrom:clipBoardEncoding
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8518
	    ].    
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8519
	    ^ value
6fa8e10f3a51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  8520
	]
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8521
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8522
    ^ nil
1793
5cda147b5f33 added clipboardEncoding
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
  8523
1798
fcbbdcbd5870 clipBoardEncoding
Claus Gittinger <cg@exept.de>
parents: 1795
diff changeset
  8524
    "Modified: 30.6.1997 / 20:54:59 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8525
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8526
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8527
setLengthProperty:propertyID value:aNumber for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8528
    "set a size property"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8529
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8530
    ^ self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8531
	setProperty:propertyID 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8532
	type:(self atomIDOfLENGTH)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8533
	value:aNumber 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8534
	for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8535
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8536
    "Modified: 6.4.1997 / 13:27:26 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8537
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8538
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8539
setObjectProperty:propertyID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8540
    "set a property to a smalltalk object in the XServer.
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  8541
     Non-strings can only be retrieved by another ST/X smalltalk"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8542
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8543
    |s|
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8544
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8545
    (anObject isMemberOf:String) ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8546
	^ self setTextProperty:propertyID value:anObject for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8547
    ].
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8548
    s := WriteStream on:(ByteArray new:200).
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8549
    anObject storeBinaryOn:s.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8550
    ^ self 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8551
	setProperty:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8552
	type:(self atomIDOf:'ST_OBJECT' create:true) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8553
	value:(s contents) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8554
	for:aWindowID
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  8555
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  8556
    "Modified: / 17.6.1998 / 17:23:49 / cg"
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8557
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8558
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8559
setProperty:propertyID type:typeID value:anObject for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8560
    "set a property in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8561
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8562
%{  /* UNLIMITEDSTACK */
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8563
    if (__isAtomID(propertyID)
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8564
     && __isAtomID(typeID) 
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8565
     && ISCONNECTED
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8566
     && (__isString(anObject) 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8567
	 || __isSmallInteger(anObject) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8568
	 || __isSymbol(anObject) 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8569
	 || __isByteArray(anObject)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8570
	 || __isWords(anObject))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8571
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8572
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8573
	Atom prop, type;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8574
	Window window;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8575
	unsigned INT value;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8576
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8577
	prop = _AtomVal(propertyID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8578
	type = _AtomVal(typeID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8579
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8580
	if (__isExternalAddress(aWindowID)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8581
	    window = _WindowVal(aWindowID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8582
	} else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8583
	    window = DefaultRootWindow(dpy);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8584
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8585
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8586
	if (__isSmallInteger(anObject)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8587
	    value = __intVal(anObject);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8588
	    XChangeProperty(dpy, window, prop, type, 32,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8589
			    PropModeReplace,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8590
			    (unsigned char *)(&value), sizeof(unsigned int));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8591
	} else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8592
	    if (__isByteArray(anObject)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8593
		XChangeProperty(dpy, window, prop, type, 8,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8594
				PropModeReplace,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8595
				__ByteArrayInstPtr(anObject)->ba_element,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8596
				__byteArraySize(anObject));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8597
	    } else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8598
		/* string or symbol or wordArray-like (16bit-string) object */
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8599
		if (__isWords(__qClass(anObject))) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8600
		    XChangeProperty(dpy, window, prop, type, 16,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8601
				    PropModeReplace,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8602
				    __stringVal(anObject),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8603
				    __wordArraySize(anObject));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8604
		} else {
2176
80290576c9db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  8605
		    /* must be string or symbol */
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8606
		    XChangeProperty(dpy, window, prop, type, 8,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8607
				    PropModeReplace,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8608
				    __stringVal(anObject),
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8609
				    __stringSize(anObject));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8610
		}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8611
	    }
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8612
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8613
	DPRINTF(("changeProp win=%x prop=%x type=%x\n", window, prop, type));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8614
	RETURN (true);
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8615
    }
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8616
%}.
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8617
    ^ false
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8618
!
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8619
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8620
setTextProperty:propertyID value:aString for:aWindowID
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8621
    "set a property to a stringValue in the XServer"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8622
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8623
    ^ self 
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8624
	setProperty:propertyID 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8625
	type:(self atomIDOfSTRING) 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8626
	value:aString 
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
  8627
	for:aWindowID
1556
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8628
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8629
    "Modified: 6.4.1997 / 13:26:32 / cg"
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8630
! !
cdc53ab8ceff added #sendClientEvent...
Claus Gittinger <cg@exept.de>
parents: 1554
diff changeset
  8631
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8632
!XWorkstation methodsFor:'resources'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8633
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8634
atomIDOf:aStringOrSymbol
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8635
    "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
  8636
     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
  8637
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8638
    ^ self atomIDOf:aStringOrSymbol create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8639
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8640
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8641
     Display atomIDOf:'FACE_NAME'      
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8642
     Display atomIDOf:'FULL_NAME' 
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  8643
     Display atomIDOf:'DndProtocol' 
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  8644
     Display atomIDOf:'DndSelection' 
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8645
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8646
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  8647
    "Modified: 4.4.1997 / 13:38:48 / cg"
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8648
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8649
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8650
atomIDOf:aStringOrSymbol create:create
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8651
    "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
  8652
     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
  8653
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8654
%{  /* NOCONTEXT */
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8655
    Atom prop;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8656
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8657
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8658
     && __isNonNilObject(aStringOrSymbol)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8659
     && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) {
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8660
	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), 
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8661
				  (create == true) ? False : True);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8662
	if (prop == None) {
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8663
	    RETURN (nil);
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8664
	}
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8665
	RETURN ( __MKATOMOBJ(prop) );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8666
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8667
%}.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8668
    self primitiveFailed.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8669
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8670
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8671
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8672
     Display atomIDOf:'VT_SELECTION' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8673
     Display atomIDOf:'CUT_BUFFER0' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8674
     Display atomIDOf:'STRING' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8675
     Display atomIDOf:'PRIMARY' create:false
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8676
     Display atomIDOfPRIMARY
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8677
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8678
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8679
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8680
atomIDOfCUTBUFFER0
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8681
    "return the CUTBUFFER0 AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8682
     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
  8683
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8684
    ^ cutBuffer0Atom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8685
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8686
    "Modified: 2.3.1996 / 15:10:36 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8687
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8688
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8689
atomIDOfLENGTH
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8690
    "return the LENGTH AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8691
     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
  8692
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8693
    ^ lengthAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8694
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8695
    "Modified: 2.3.1996 / 15:10:41 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8696
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8697
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8698
atomIDOfPRIMARY
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8699
    "return the PRIMARY AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8700
     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
  8701
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8702
    ^ primaryAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8703
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8704
    "Modified: 2.3.1996 / 15:10:49 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8705
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8706
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8707
atomIDOfSECONDARY
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8708
    "return the SECONDARY AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8709
     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
  8710
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8711
    ^ secondaryAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8712
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8713
    "Modified: 2.3.1996 / 15:10:59 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8714
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8715
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8716
atomIDOfSTRING
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8717
    "return the STRING AtomID.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8718
     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
  8719
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8720
    ^ stringAtom
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8721
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8722
    "Modified: 2.3.1996 / 15:11:08 / cg"
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8723
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8724
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8725
atomName:anAtomID
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8726
    "given an AtomID, return its name.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8727
     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
  8728
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8729
%{  /* NOCONTEXT */ 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8730
    OBJ str;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8731
    char *name;
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8732
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8733
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8734
	if (__isAtomID(anAtomID)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8735
	    name = XGetAtomName(myDpy, _AtomVal(anAtomID));
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8736
	    if (name == 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8737
		RETURN (nil);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8738
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8739
	    str = __MKSTRING(name);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8740
	    XFree(name);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8741
	    RETURN ( str );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8742
	}
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8743
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8744
%}.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8745
    self primitiveFailed.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8746
    ^ nil
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8747
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8748
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8749
     Display atomName:1 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8750
     Display atomName:130  '_DEC_DEVICE_FONTNAMES'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8751
     Display atomName:132  'FONTNAME_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8752
     Display atomName:135 'FOUNDRY' 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8753
     Display atomName:150  'CHARSET_REGISTRY'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8754
     Display atomName:151  'ISO8859'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8755
     Display atomName:152 'CHARSET_ENCODING'
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8756
     Display atomName:154 
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8757
    "
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8758
!
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8759
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8760
getResource:name class:cls
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8761
    "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
  8762
     of name in a resource class.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8763
     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
  8764
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8765
     Notice: 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8766
	we do not plan to use X's resources for ST/X's defaults,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8767
	styles or resources. This would make porting of applications
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8768
	to different platforms much more difficult (Windows has no resource
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8769
	database). If you stay within ST/X's resource files, these can be
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8770
	easily transported to other platforms.
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8771
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8772
     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
  8773
     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
  8774
     platforms."
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8775
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8776
%{
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8777
    char *rslt;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8778
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8779
    if (ISCONNECTED
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8780
     && __isNonNilObject(name)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8781
     && (__qIsString(name) || __qIsSymbol(name))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8782
     && __isNonNilObject(cls)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  8783
     && (__qIsString(cls) || __qIsSymbol(cls))) {
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8784
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  8785
	rslt = XGetDefault(myDpy, (char *) __stringVal(cls),
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  8786
				  (char *) __stringVal(name));
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  8787
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8788
	RETURN (rslt ? __MKSTRING(rslt) : nil );
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8789
    }
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8790
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8791
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8792
    ^ nil
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8793
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8794
    "if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8795
	OpenWindows.Beep:       notices
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8796
     the following returns 'notices'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8797
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8798
	 Display getResource:'Beep' class:'OpenWindows'   
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8799
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8800
     if your ~/.Xdefaults contains an entry such as:
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8801
	*.beNiceToColormap:       false
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8802
     the following return 'false'.
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8803
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8804
	 Display getResource:'beNiceToColormap' class:'any'  
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8805
	 Display getResource:'beNiceToColormap' class:''  
487
f6ac7231749e category changes & comments in atomXXX methods
Claus Gittinger <cg@exept.de>
parents: 486
diff changeset
  8806
    "
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8807
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8808
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8809
!XWorkstation methodsFor:'retrieving pixels'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8810
1462
f8b2909deb3c renamed getBitsFrom to getBitsFromId
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
  8811
getBitsFromId:aDrawableId x:srcx y:srcy width:w height:h into:imageBits
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8812
    "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
  8813
     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
  8814
     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
  8815
     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
  8816
     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
  8817
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  8818
    |rawInfo info|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8819
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8820
    ((w <= 0) or:[h <= 0]) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8821
	self primitiveFailed.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8822
	^ nil
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8823
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8824
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  8825
    rawInfo := Array new:8.
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8826
		  "1 -> bit order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8827
		  "2 -> depth"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8828
		  "3 -> bytes_per_line"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8829
		  "4 -> byte_order"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8830
		  "5 -> format"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8831
		  "6 -> bitmap_unit"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8832
		  "7 -> bitmap_pad"
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8833
		  "8 -> bits_per_pixel"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8834
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8835
    "/ 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
  8836
    "/ unlimitedStack (some implementations use alloca and require huge amounts
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8837
    "/ of temporary stack space
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8838
397
094b8604ea72 return more info from getBits (bitsPerPixel); return it as a dictionary
Claus Gittinger <cg@exept.de>
parents: 395
diff changeset
  8839
    (self primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:rawInfo) ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8840
	info := IdentityDictionary new.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8841
	info at:#bitOrder put:(rawInfo at:1).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8842
	info at:#depth put:(rawInfo at:2).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8843
	info at:#bytesPerLine put:(rawInfo at:3).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8844
	info at:#byteOrder put:(rawInfo at:4).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8845
	info at:#format put:(rawInfo at:5).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8846
	info at:#bitmapUnit put:(rawInfo at:6).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8847
	info at:#bitmapPad put:(rawInfo at:7).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8848
	info at:#bitsPerPixel put:(rawInfo at:8).
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8849
	^ info
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8850
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8851
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8852
     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
  8853
     or is too small to hold the bits
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8854
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8855
    ^ self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8856
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8857
2713
1aef3acb4e04 need dummy GCId in getPixel (for win32)
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
  8858
getPixelX:x y:y from:aDrawableId with:dummyGCId
790
05ea637c94c3 care for null return from XGetImage
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
  8859
    "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
  8860
     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
  8861
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8862
%{  /* UNLIMITEDSTACK NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8863
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8864
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8865
    XImage *img;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8866
    int ret;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8867
    int xpos, ypos;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8868
1209
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  8869
    if (ISCONNECTED
98d9f8a5a2a6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1207
diff changeset
  8870
     && __isExternalAddress(aDrawableId) && __bothSmallInteger(x, y)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8871
	win = _WindowVal(aDrawableId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8872
	xpos = __intVal(x);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8873
	ypos = __intVal(y);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8874
	if ((xpos < 0) || (ypos < 0)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8875
	    RETURN ( __MKSMALLINT(0) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8876
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8877
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8878
	img = XGetImage(myDpy, win, xpos, ypos, 1, 1, (unsigned)~0, ZPixmap);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8879
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8880
	if (img != 0) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8881
	    ret = XGetPixel(img, 0, 0);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8882
	    XDestroyImage(img);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8883
	    RETURN (  __MKSMALLINT(ret) );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8884
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8885
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8886
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8887
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8888
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8889
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8890
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
  8891
    "since XGetImage may allocate huge amount of stack space 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8892
     (some implementations use alloca), this must run with unlimited stack."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8893
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8894
%{  /* UNLIMITEDSTACK */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8895
303
f2021d90f12d dont access GC's Windows before checking them for being ExternalBytes instances
Claus Gittinger <cg@exept.de>
parents: 295
diff changeset
  8896
    Window win;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8897
    XImage *image = (XImage *)0;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8898
    int pad, bytes_per_line, numBytes;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8899
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8900
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  8901
     && __isExternalAddress(aDrawableId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8902
     && __bothSmallInteger(srcx, srcy)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8903
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8904
     && __isArray(info)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8905
     && __isByteArray(imageBits)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8906
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8907
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8908
	win = _WindowVal(aDrawableId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8909
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8910
	image = XGetImage(dpy, win, __intVal(srcx), __intVal(srcy),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8911
				    __intVal(w), __intVal(h),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8912
				    (unsigned)AllPlanes, ZPixmap);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  8913
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8914
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8915
	if (! image) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8916
	    RETURN ( false );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8917
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8918
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8919
	pad = image->bitmap_pad;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8920
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8921
	printf("pad:%d depth:%d\n", image->bitmap_pad, image->depth);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8922
#endif
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8923
	switch (image->depth) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8924
	    case 1:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8925
	    case 2:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8926
	    case 4:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8927
	    case 8:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8928
	    case 16:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8929
	    case 24:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8930
	    case 32:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8931
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8932
		break;
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  8933
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8934
	    default:
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8935
		/* unsupported depth ? */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8936
		printf("possibly unsupported depth:%d in primGetBits\n", image->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8937
		numBytes = image->bytes_per_line * image->height;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8938
		break;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8939
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8940
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8941
#ifdef SUPERDEBUG
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8942
	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
  8943
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8944
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8945
	if (numBytes > __byteArraySize(imageBits)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8946
	    /* imageBits too small */
1728
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  8947
	    fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  8948
	    fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits));
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  8949
	    fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n", 
4c9eb98d443f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1718
diff changeset
  8950
				image->bitmap_pad, image->depth, image->bytes_per_line);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8951
	    goto fail;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8952
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8953
	if (image->bitmap_bit_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8954
	    __ArrayInstPtr(info)->a_element[0] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8955
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8956
	    __ArrayInstPtr(info)->a_element[0] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8957
	__ArrayInstPtr(info)->a_element[1] = __MKSMALLINT(image->depth);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8958
	__ArrayInstPtr(info)->a_element[2] = __MKSMALLINT(image->bytes_per_line);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8959
	if (image->byte_order == MSBFirst)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8960
	    __ArrayInstPtr(info)->a_element[3] = @symbol(msbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8961
	else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8962
	    __ArrayInstPtr(info)->a_element[3] = @symbol(lsbFirst);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8963
	if (image->format == XYBitmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8964
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYBitmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8965
	else if (image->format == XYPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8966
	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8967
	else if (image->format == ZPixmap)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8968
	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
480
07ab9bbaea5f create modifierState when sending keyboard events
Claus Gittinger <cg@exept.de>
parents: 466
diff changeset
  8969
        
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8970
	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8971
	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8972
	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8973
	bcopy(image->data, __ByteArrayInstPtr(imageBits)->ba_element, numBytes);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8974
	XDestroyImage(image);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8975
	RETURN ( true );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8976
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8977
fail: 
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8978
    if (image) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8979
	XDestroyImage(image);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8980
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8981
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8982
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8983
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8984
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8985
!XWorkstation methodsFor:'selections'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8986
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  8987
getSelectionFor:drawableId
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  8988
    "get the object selection - either immediate, or asynchronous.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8989
     Returns nil, if async request is on its way"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8990
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8991
    |selProp sel|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8992
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8993
    (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8994
	"no primary selection - use cut buffer"
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8995
	sel := self getObjectProperty:cutBuffer0Atom from:nil.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  8996
	^ sel
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8997
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8998
    selProp := self atomIDOf:'ST_SELECTION' create:true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  8999
    self requestObjectSelection:primaryAtom property:selProp for:drawableId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9000
    ^ nil
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9001
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9002
    "Modified: / 17.6.1998 / 17:11:15 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9003
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9004
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9005
getSelectionOwnerOf:selectionAtomID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9006
    "get the owner of a selection"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9007
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9008
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9009
    Atom selection;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9010
    Window window;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9011
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9012
    if (__isAtomID(selectionAtomID) && ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9013
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9014
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9015
	window = XGetSelectionOwner(dpy, _AtomVal(selectionAtomID));
1913
cd9259612040 eliminate MKOBJ & MKCP (use MKEXTERNALADDRESS & externalAddressVal)
Claus Gittinger <cg@exept.de>
parents: 1906
diff changeset
  9016
	RETURN ((window == None) ? nil : __MKEXTERNALADDRESS(window));
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9017
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9018
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9019
     self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9020
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9021
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9022
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9023
getTextSelectionFor:drawableId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9024
    "get the text selection -  either immediate, or asynchronous.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9025
     Returns nil, if async request is on its way"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9026
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9027
    |selProp sel|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9028
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9029
    (self getSelectionOwnerOf:primaryAtom) isNil ifTrue:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9030
	"no primary selection - use cut buffer"
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9031
	sel := self getTextProperty:cutBuffer0Atom from:nil.
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9032
	^ sel
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9033
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9034
    selProp := self atomIDOf:'VT_SELECTION' create:true.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9035
    self requestTextSelection:primaryAtom property:selProp for:drawableId.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9036
    ^ nil
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9037
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9038
    "Modified: / 17.6.1998 / 17:12:05 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9039
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9040
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9041
requestObjectSelection:selectionID property:propertyID for:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9042
    "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
  9043
     will later receive a SelectionNotify event for it."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9044
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9045
    ^ self requestSelection:selectionID 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9046
		   property:propertyID 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9047
		   type:(self atomIDOf:'ST_OBJECT' create:true) 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9048
		   for:aWindowId
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9049
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9050
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9051
requestSelection:selectionID property:propertyID type:typeID for:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9052
    "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
  9053
     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
  9054
     with the selections value)."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9055
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9056
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9057
    Atom sel_prop;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9058
    char *cp;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9059
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9060
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9061
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9062
     && __isSmallInteger(typeID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9063
     && __isAtomID(selectionID)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9064
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9065
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9066
	if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) == None) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9067
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9068
	     * no owner of primary selection
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9069
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9070
	    RETURN (false);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9071
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9072
	/*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9073
	 * PRIMARY selection
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9074
	 */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9075
	XConvertSelection(dpy, _AtomVal(selectionID), _AtomVal(typeID), 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9076
			       _AtomVal(propertyID), _WindowVal(aWindowId), CurrentTime);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9077
	RETURN (true);
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9078
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9079
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9080
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9081
    ^ false
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9082
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9083
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9084
     Display requestSelection:(Display atomIDOf:'PRIMARY')
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9085
		     property:(Display atomIDOf:'VT_SELECTION')
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9086
			  for:0
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9087
    "
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9088
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9089
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9090
requestTextSelection:selectionID property:propertyID for:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9091
    "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
  9092
     will later receive a SelectionNotify event for it."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9093
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9094
    ^ self requestSelection:selectionID 
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9095
		   property:propertyID 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9096
		       type:stringAtom 
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9097
			for:aWindowId
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9098
!
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9099
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9100
sendSelection:something selection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9101
    "send aString back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9102
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9103
    self 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9104
	setProperty:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9105
	type:targetID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9106
	value:something 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9107
	for:requestorID.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9108
    self 
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9109
	sendSelectionNotifySelection:selectionID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9110
	property:propertyID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9111
	target:targetID
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9112
	time:t 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9113
	from:windowID 
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9114
	to:requestorID.
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9115
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9116
    "Modified: / 17.6.1998 / 17:03:20 / cg"
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9117
    "Created: / 17.6.1998 / 19:44:03 / cg"
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9118
!
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9119
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9120
sendSelectionNotifySelection:selectionID property:propertyID target:targetID time:t from:windowID to:requestorID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9121
    "send a selectionNotify back from a SelectionRequest"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9122
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9123
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9124
    if (__isAtomID(propertyID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9125
     && __isExternalAddress(requestorID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9126
     && ISCONNECTED
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9127
     && __isAtomID(targetID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9128
     && __isAtomID(selectionID)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9129
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9130
	XEvent ev;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9131
	Window requestor = _WindowVal(requestorID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9132
	Atom property = _AtomVal(propertyID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9133
	Atom target = _AtomVal(targetID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9134
	Atom selection = _AtomVal(selectionID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9135
	Status result;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9136
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9137
	ev.xselection.type = SelectionNotify;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9138
	ev.xselection.display = dpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9139
	ev.xselection.selection = selection;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9140
	ev.xselection.target = target;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9141
	if (__isExternalAddress(windowID))
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9142
	    ev.xselection.requestor = _WindowVal(windowID);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9143
	else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9144
	    ev.xselection.requestor = DefaultRootWindow(dpy);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9145
	if (__isExternalAddress(t)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9146
	    ev.xselection.time = (INT)(__externalAddressVal(t));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9147
	} else {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9148
	    ev.xselection.time = CurrentTime;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9149
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9150
	if (property == None)
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9151
	    ev.xselection.property = target;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9152
	else
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9153
	    ev.xselection.property = property;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9154
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9155
	DPRINTF(("sending SelectionNotify sel=%x prop=%x target=%x requestor=%x to %x\n",
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9156
		ev.xselection.selection,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9157
		ev.xselection.property,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9158
		ev.xselection.target,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9159
		ev.xselection.requestor,
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9160
		requestor));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9161
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9162
	ENTER_XLIB();
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9163
	result = XSendEvent(dpy, requestor, False, 0 , &ev);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9164
	LEAVE_XLIB();
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9165
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9166
	if ((result == BadValue) || (result == BadWindow)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9167
	    DPRINTF(("bad status\n"));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9168
	    RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9169
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9170
	ENTER_XLIB();
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9171
	XFlush(dpy);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9172
	LEAVE_XLIB();
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9173
	RETURN (true)
382
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  9174
    }
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  9175
%}.
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  9176
    self primitiveFailed.
92200ee9f558 added sendKey/sendButtonEvent
ah
parents: 378
diff changeset
  9177
    ^ false
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9178
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9179
    "Modified: / 17.6.1998 / 20:23:20 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9180
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9181
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9182
setSelection:anObject owner:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9183
    "set the object selection, and make aWindowId be the owner.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9184
     This can be used by other Smalltalk(X) applications only."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9185
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9186
    (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9187
	^ false
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9188
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9189
"/    ^ self setObjectProperty:cutBuffer0Atom value:anObject for:nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9190
    ^ true
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9191
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9192
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9193
setSelectionOwner:aWindowId of:selectionID
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9194
    "set the owner of a selection; return false if failed"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9195
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9196
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9197
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9198
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9199
    if (__isExternalAddress(aWindowId)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9200
     && __isAtomID(selectionID)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9201
     && ISCONNECTED) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9202
	Display *dpy = myDpy;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9203
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9204
	win = _WindowVal(aWindowId);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9205
	XSetSelectionOwner(dpy, _AtomVal(selectionID), win, CurrentTime);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9206
	DPRINTF(("setOwner prop=%x win=%x\n", _AtomVal(selectionID), win));
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9207
	if (XGetSelectionOwner(dpy, _AtomVal(selectionID)) != win) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9208
	    RETURN (false);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9209
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9210
	RETURN (true);
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9211
    }
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9212
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9213
    self primitiveFailed.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9214
    ^ nil
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9215
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9216
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9217
setTextSelection:aString owner:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9218
    "set the text selection, and make aWindowId be the owner.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9219
     This can be used by any other X application."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9220
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9221
    (self setSelectionOwner:aWindowId of:primaryAtom) ifFalse:[
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9222
	'XWorkstation [warning]: selection ownerchange failed' errorPrintCR.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9223
    ].
2156
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9224
    ^ self setTextProperty:cutBuffer0Atom value:aString for:rootId.
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9225
0cb3b353630f fixed selection stuff (time must be passed back)
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  9226
    "Modified: / 17.6.1998 / 19:48:54 / cg"
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9227
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9228
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9229
!XWorkstation methodsFor:'window stuff'!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9230
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9231
clearRectangleX:x y:y width:width height:height in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9232
    "clear a rectangular area to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9233
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9234
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9235
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9236
    int w, h;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9237
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9238
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9239
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9240
	 && __bothSmallInteger(x, y)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9241
	 && __bothSmallInteger(width, height)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9242
	    w = __intVal(width);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9243
	    h = __intVal(height);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9244
	    /*
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9245
	     * need this check here: some servers simply dump core with bad args
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9246
	     */
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9247
	    if ((w >= 0) && (h >= 0)) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9248
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9249
		XClearArea(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y), w, h, 0);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9250
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9251
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9252
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9253
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9254
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9255
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9256
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9257
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9258
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9259
clearWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9260
    "clear a window to viewbackground"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9261
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9262
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9263
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9264
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9265
	if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9266
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9267
	    XClearWindow(myDpy, _WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9268
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9269
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9270
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9271
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9272
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9273
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9274
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9275
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9276
configureWindow:aWindowId sibling:siblingId stackMode:modeSymbol
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9277
    "configure stacking operation of aWindowId w.r.t siblingId"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9278
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9279
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9280
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9281
    XWindowChanges chg;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9282
    int mask = CWSibling | CWStackMode;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9283
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9284
    if (ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9285
	if (__isExternalAddress(aWindowId)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9286
	 && __isExternalAddress(siblingId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9287
	    if (modeSymbol == @symbol(above)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9288
		chg.stack_mode = Above;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9289
	    } else if (modeSymbol == @symbol(below)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9290
		chg.stack_mode = Below;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9291
	    } else if (modeSymbol == @symbol(topIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9292
		chg.stack_mode = TopIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9293
	    } else if (modeSymbol == @symbol(bottomIf)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9294
		chg.stack_mode = BottomIf;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9295
	    } else if (modeSymbol == @symbol(opposite)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9296
		chg.stack_mode = Opposite;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9297
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9298
		mask = CWSibling;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9299
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9300
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9301
	    chg.sibling = _WindowVal(siblingId);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9302
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9303
	    XConfigureWindow(myDpy, _WindowVal(aWindowId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9304
				    mask, &chg);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9305
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9306
	    RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9307
	}
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9308
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9309
bad: ;
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9310
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9311
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9312
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9313
2457
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9314
isValidWindowId:aWindowId
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9315
    "return true, if the given window ID is (still) valid.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9316
     Especially useful, if the passed windowID is 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9317
     an alien (external) windows id."
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9318
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9319
    |ret|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9320
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9321
%{ 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9322
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9323
    if (ISCONNECTED
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9324
     && __isExternalAddress(aWindowId)) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9325
	char *name = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9326
	Status ok;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9327
	Window root, parent, *children = NULL;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9328
	int nChildren;
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9329
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9330
/*        ENTER_XLIB(); */
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9331
	ok = XQueryTree(myDpy, _WindowVal(aWindowId), 
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9332
			&root, &parent, &children, &nChildren);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9333
	if (children) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9334
	    XFree(children);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9335
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9336
/*        LEAVE_XLIB();   */
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9337
	if (ok) {
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9338
	    RETURN (true);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9339
	}
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9340
	RETURN (false);
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9341
    }
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9342
%}.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9343
    self primitiveFailed
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9344
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9345
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9346
     |v aWindowId ok|
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9347
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9348
     v := StandardSystemView new.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9349
     v label:'hello'.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9350
     v openAndWait.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9351
     aWindowId := v id.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9352
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9353
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9354
     Delay waitForSeconds:1.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9355
     v destroy.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9356
     ok := Display isValidWindowId:aWindowId.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9357
     Transcript showCR:'ok is: ' , ok printString.
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9358
    "
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9359
!
2a00e88fb04f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2449
diff changeset
  9360
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9361
lowerWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9362
    "bring a window to back"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9363
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9364
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9365
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9366
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9367
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9368
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9369
	XLowerWindow(myDpy, _WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9370
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9371
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9372
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9373
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9374
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9375
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9376
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9377
mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos 
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9378
	      width:w height:h minExtent:minExt maxExtent:maxExt
2650
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  9379
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  9380
    "make a window visible - either as icon or as a real view 
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  9381
     in addition, allow change of extend, position, minExtend and maxExtent.
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  9382
     Needed for restart, to allow recreating a view as iconified,
f7183e9c71b1 comment
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  9383
     and to collaps/expand windows."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9384
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9385
    |wicon wiconId wiconView wiconViewId wlabel minW minH maxW maxH|
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9386
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9387
    aBoolean ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9388
	wicon := aView icon.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9389
	wicon notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9390
	    wiconId := wicon id
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9391
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9392
	wiconView := aView iconView.
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9393
	wiconView notNil ifTrue:[
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9394
	    wiconViewId := wiconView id
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9395
	].
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9396
	wlabel := aView label.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9397
    ].
2105
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9398
    minExt notNil ifTrue:[
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9399
	minW := minExt x.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9400
	minH := minExt y.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9401
    ].
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9402
    maxExt notNil ifTrue:[
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9403
	maxW := maxExt x.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9404
	maxH := maxExt y.
1c1277d63a2c pass minExtent/maxExtent to mapView:...
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
  9405
    ].
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9406
%{  
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9407
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9408
    XWMHints wmhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9409
    XSizeHints szhints;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9410
    Window win;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9411
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9412
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9413
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9414
	Display *dpy = myDpy;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9415
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9416
	win = _WindowVal(aWindowId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9417
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9418
	szhints.flags = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9419
	if (__bothSmallInteger(xPos, yPos)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9420
	    szhints.x = __intVal(xPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9421
	    szhints.y = __intVal(yPos);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9422
	    szhints.flags |= USPosition;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9423
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9424
	if (__bothSmallInteger(w, h)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9425
	    szhints.width = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9426
	    szhints.height = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9427
	    szhints.flags |= USSize;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9428
	}
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9429
	if (__bothSmallInteger(minW, minH)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9430
	    szhints.flags |= PMinSize;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9431
	    szhints.min_width = __intVal(minW);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9432
	    szhints.min_height = __intVal(minH);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9433
	}
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9434
	if (__bothSmallInteger(maxW, maxH)) {
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9435
	    szhints.flags |= PMaxSize;
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9436
	    szhints.max_width = __intVal(maxW);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9437
	    szhints.max_height = __intVal(maxH);
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9438
	}
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9439
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9440
	if (aBoolean == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9441
	    char *windowName;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9442
	    Pixmap iconBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9443
	    Window iconWindow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9444
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9445
	    if (__isExternalAddress(wiconId))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9446
		iconBitmap = _PixmapVal(wiconId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9447
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9448
		iconBitmap = (Pixmap)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9449
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9450
	    if (__isExternalAddress(wiconViewId))
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9451
		iconWindow = _WindowVal(wiconViewId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9452
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9453
		iconWindow = (Window)0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9454
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9455
	    if (__isString(wlabel) || __isSymbol(wlabel))
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9456
		windowName = (char *) __stringVal(wlabel);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9457
	    else
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9458
		windowName = "";
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9459
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9460
	    if (iconBitmap || windowName) {
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9461
		ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9462
		XSetStandardProperties(dpy, win,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9463
					windowName, windowName,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9464
					iconBitmap,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9465
					0, 0, &szhints);
2305
7746d6252645 added supportsBackgroundPixmaps query (for win32 compatibility)
Claus Gittinger <cg@exept.de>
parents: 2289
diff changeset
  9466
		LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9467
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9468
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9469
	    wmhints.flags = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9470
	    if (iconBitmap) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9471
		wmhints.flags |= IconPixmapHint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9472
		wmhints.icon_pixmap = iconBitmap;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9473
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9474
	    if (iconWindow) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9475
		wmhints.flags |= IconWindowHint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9476
		wmhints.icon_window = iconWindow;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9477
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9478
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9479
	    wmhints.initial_state = IconicState;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9480
	    wmhints.flags |= StateHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9481
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9482
	    XSetWMHints(dpy, win, &wmhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9483
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9484
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9485
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9486
	if (szhints.flags) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9487
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9488
	    XSetNormalHints(dpy, win, &szhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9489
	    LEAVE_XLIB();
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9490
	}
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9491
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9492
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9493
	XMapWindow(dpy, win);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9494
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9495
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9496
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9497
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9498
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9499
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9500
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9501
mapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9502
    "make a window visible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9503
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9504
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9505
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9506
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9507
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9508
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9509
	XMapWindow(myDpy, _WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9510
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9511
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9512
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9513
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9514
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9515
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9516
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9517
moveResizeWindow:aWindowId x:x y:y width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9518
    "move and resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9519
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9520
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9521
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9522
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9523
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9524
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9525
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9526
     && __bothSmallInteger(w, h)
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9527
     && __bothSmallInteger(x, y)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9528
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9529
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9530
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9531
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9532
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9533
	XMoveResizeWindow(myDpy, _WindowVal(aWindowId),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9534
			      __intVal(x), __intVal(y),
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9535
			      newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9536
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9537
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9538
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9539
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9540
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9541
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9542
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9543
moveWindow:aWindowId x:x y:y
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9544
    "move a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9545
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9546
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9547
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9548
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9549
     && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9550
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9551
	XMoveWindow(myDpy, _WindowVal(aWindowId), __intVal(x), __intVal(y));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9552
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9553
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9554
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9555
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9556
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9557
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9558
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9559
raiseWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9560
    "bring a window to front"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9561
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9562
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9563
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9564
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9565
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9566
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9567
	XRaiseWindow(myDpy, _WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9568
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9569
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9570
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9571
%}.
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9572
    self primitiveFailed
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9573
!
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9574
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9575
reparentWindow:windowId to:newParentWindowId
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9576
    "change a windows parent (an optional interface)"
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9577
%{
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9578
    if (ISCONNECTED
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9579
     && __isExternalAddress(windowId)
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9580
     && __isExternalAddress(newParentWindowId)) {
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9581
        Display *dpy = myDpy;
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9582
        Window _child, _newParent;
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9583
        int i;
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9584
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9585
        _child = _WindowVal(windowId);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9586
        _newParent = _WindowVal(newParentWindowId);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9587
        ENTER_XLIB();
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9588
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
  9589
#if 0
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9590
        XWithdrawWindow (dpy, _child, DefaultScreen(dpy));
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9591
        XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
  9592
#endif
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9593
        /*
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9594
         * Code 'stolen' from xswallow source ...
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9595
         * ... mhmh - what is this loop for ?
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9596
         */
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9597
        for (i=0; i<5; i++) {
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9598
            XReparentWindow (dpy, _child, _newParent, 0, 0);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9599
            XSync (dpy, 0);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9600
        }
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
  9601
#if 0
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9602
        XMapWindow (dpy, _child);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9603
        XSync (dpy, 0);
2428
191f961209f8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2426
diff changeset
  9604
#endif
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9605
        LEAVE_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9606
        RETURN ( true );
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9607
    }
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9608
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9609
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9610
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9611
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9612
resizeWindow:aWindowId width:w height:h
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9613
    "resize a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9614
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9615
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9616
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9617
    int newWidth, newHeight;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9618
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9619
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9620
     && __isExternalAddress(aWindowId) && __bothSmallInteger(w, h)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9621
	newWidth = __intVal(w);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9622
	newHeight = __intVal(h);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9623
	if (newWidth < 1) newWidth = 1;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9624
	if (newHeight < 1) newHeight = 1;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9625
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9626
	XResizeWindow(myDpy, _WindowVal(aWindowId), newWidth, newHeight);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9627
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9628
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9629
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9630
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9631
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9632
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9633
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9634
setBackingStore:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9635
    "turn on/off backing-store for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9636
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9637
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9638
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9639
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9640
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9641
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9642
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9643
	if (__INST(ignoreBackingStore) != true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9644
	    if (how == @symbol(always)) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9645
	    else if (how == @symbol(whenMapped)) wa.backing_store = WhenMapped;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9646
	    else if (how == true) wa.backing_store = Always;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9647
	    else wa.backing_store = 0;
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9648
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9649
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9650
	    XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBackingStore, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9651
	    LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9652
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9653
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9654
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9655
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9656
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9657
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9658
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9659
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9660
setBitGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9661
    "set bit gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9662
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9663
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9664
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9665
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9666
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9667
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9668
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9669
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9670
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9671
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9672
	    wa.bit_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9673
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9674
	    wa.bit_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9675
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9676
	    wa.bit_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9677
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9678
	    wa.bit_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9679
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9680
	    wa.bit_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9681
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9682
	    wa.bit_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9683
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9684
	    wa.bit_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9685
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9686
	    wa.bit_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9687
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9688
	    wa.bit_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9689
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9690
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9691
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9692
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9693
	XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWBitGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9694
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9695
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9696
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9697
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9698
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9699
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9700
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9701
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9702
setCursor:aCursorId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9703
    "define a windows cursor"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9704
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9705
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9706
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9707
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9708
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9709
     && __isExternalAddress(aCursorId)) {
3203
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9710
        Window w = _WindowVal(aWindowId);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9711
        Cursor c = _CursorVal(aCursorId);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9712
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9713
        if (w && c) {
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9714
            ENTER_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9715
            XDefineCursor(myDpy, w, c);
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9716
            LEAVE_XLIB();
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9717
        }
2df4b477c891 Care for nil display before calling myDpy
Stefan Vogel <sv@exept.de>
parents: 3200
diff changeset
  9718
        RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9719
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9720
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9721
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9722
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9723
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9724
setIconName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9725
    "define a windows iconname"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9726
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9727
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9728
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9729
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9730
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9731
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
  9732
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9733
	ENTER_XLIB();
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9734
	XSetIconName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9735
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9736
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9737
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9738
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9739
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9740
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9741
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9742
setSaveUnder:yesOrNo in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9743
    "turn on/off save-under for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9744
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9745
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9746
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9747
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9748
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9749
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9750
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9751
	if (__INST(hasSaveUnder) == true) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9752
	    wa.save_under = (yesOrNo == true) ? 1 : 0;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9753
	    ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9754
	    XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWSaveUnder, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9755
	    LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9756
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9757
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9758
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9759
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9760
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9761
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9762
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9763
setTransient:aWindowId for:aMainWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9764
    "set aWindowId to be a transient of aMainWindow"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9765
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9766
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9767
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9768
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9769
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9770
	Window w;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9771
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9772
	if ((aMainWindowId == nil) || (aMainWindowId == __MKSMALLINT(0))) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9773
	    w = (Window) 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9774
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9775
	    if (__isExternalAddress(aMainWindowId)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9776
		w = _WindowVal(aMainWindowId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9777
	    } else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9778
		goto getOutOfHere;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9779
	    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9780
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9781
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9782
	XSetTransientForHint(myDpy, _WindowVal(aWindowId), w);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9783
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9784
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9785
    }
353
5be3ae3c8838 sorry stefan - need eventPending (instead of eventQueued)
Claus Gittinger <cg@exept.de>
parents: 350
diff changeset
  9786
 getOutOfHere: ;
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9787
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9788
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9789
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9790
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9791
setWindowBackground:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9792
    "set the windows background color. This is the color with which
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9793
     the view is filled whenever exposed. Do not confuse this with
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9794
     the background drawing color, which is used with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9795
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9796
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9797
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9798
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9799
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9800
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9801
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9802
	XSetWindowBackground(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9803
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9804
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9805
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9806
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9807
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9808
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9809
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9810
setWindowBackgroundPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9811
    "set the windows background pattern to be a form.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9812
     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
  9813
     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
  9814
     with opaque drawing."
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9815
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9816
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9817
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9818
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9819
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9820
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9821
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9822
	XSetWindowBackgroundPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9823
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9824
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9825
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9826
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9827
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9828
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9829
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9830
setWindowBorderColor:aColorIndex in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9831
    "set the windows border color"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9832
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9833
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9834
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9835
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9836
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9837
     && __isSmallInteger(aColorIndex)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9838
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9839
	XSetWindowBorder(myDpy, _WindowVal(aWindowId), __intVal(aColorIndex));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9840
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9841
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9842
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9843
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9844
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9845
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9846
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9847
setWindowBorderPixmap:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9848
    "set the windows border pattern"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9849
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9850
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9851
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9852
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9853
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9854
     && __isExternalAddress(aPixmapId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9855
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9856
	XSetWindowBorderPixmap(myDpy, _WindowVal(aWindowId), _PixmapVal(aPixmapId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9857
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9858
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9859
    }
2426
7cb649f45f93 added support to reparent a window
Claus Gittinger <cg@exept.de>
parents: 2422
diff changeset
  9860
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9861
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9862
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9863
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9864
setWindowBorderShape:aPixmapId in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9865
    "set the windows border shape"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9866
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9867
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9868
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9869
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9870
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9871
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9872
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9873
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9874
    if (__isExternalAddress(aPixmapId))
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9875
	shapeBitmap = _PixmapVal(aPixmapId);
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9876
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9877
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9878
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9879
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9880
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9881
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9882
	XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeBounding,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
  9883
			  0, 0, shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9884
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9885
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9886
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9887
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9888
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9889
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9890
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9891
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9892
setWindowBorderWidth:aNumber in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9893
    "set the windows border width"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9894
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9895
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9896
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9897
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9898
     && __isExternalAddress(aWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9899
     && __isSmallInteger(aNumber)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9900
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9901
	XSetWindowBorderWidth(myDpy, _WindowVal(aWindowId), __intVal(aNumber));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9902
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9903
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9904
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9905
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9906
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9907
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9908
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9909
setWindowClass:wClass name:wName in:aWindowId
857
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9910
    "define class and name of a window.
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9911
     This may be used by the window manager to
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9912
     select client specific resources."
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9913
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9914
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9915
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9916
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9917
	XClassHint classhint;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9918
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9919
	classhint.res_class = classhint.res_name = 0;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9920
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9921
	if (__isString(wClass) || __isSymbol(wClass)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9922
	    classhint.res_class = (char *) __stringVal(wClass);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9923
	} else if (wClass != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9924
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9925
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9926
	if (__isString(wName) || __isSymbol(wName)) {
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  9927
	    classhint.res_name = (char *) __stringVal(wName);
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9928
	} else if (wName != nil)
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9929
	    goto error;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9930
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9931
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9932
	XSetClassHint(myDpy, _WindowVal(aWindowId), &classhint);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9933
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9934
	RETURN ( self );
857
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9935
error:;
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9936
    }
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9937
%}.
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9938
    self primitiveFailed
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9939
!
df5125310d86 New method #setWindowClass:name:in: to give a hint to the window manager.
Stefan Vogel <sv@exept.de>
parents: 850
diff changeset
  9940
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9941
setWindowGravity:how in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9942
    "set window gravity for a window"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9943
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9944
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9945
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9946
    XSetWindowAttributes wa;
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9947
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9948
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9949
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9950
	if (how == @symbol(NorthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9951
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9952
	} else if (how == @symbol(NorthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9953
	    wa.win_gravity = NorthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9954
	} else if (how == @symbol(SouthWest)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9955
	    wa.win_gravity = SouthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9956
	} else if (how == @symbol(SouthEast)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9957
	    wa.win_gravity = SouthEastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9958
	} else if (how == @symbol(Center)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9959
	    wa.win_gravity = CenterGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9960
	} else if (how == @symbol(North)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9961
	    wa.win_gravity = NorthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9962
	} else if (how == @symbol(South)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9963
	    wa.win_gravity = SouthGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9964
	} else if (how == @symbol(West)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9965
	    wa.win_gravity = WestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9966
	} else if (how == @symbol(East)) {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9967
	    wa.win_gravity = EastGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9968
	} else {
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9969
	    wa.win_gravity = NorthWestGravity;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9970
	}
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9971
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9972
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9973
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9974
	XChangeWindowAttributes(myDpy, _WindowVal(aWindowId), CWWinGravity, &wa);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9975
	LEAVE_XLIB();
3131
88293c577ba6 got rid of BEGIN_INTERRUPTS_BLOCKED .. END_INTERRUPTS_BLOCKED;
Claus Gittinger <cg@exept.de>
parents: 3079
diff changeset
  9976
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9977
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9978
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9979
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9980
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9981
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9982
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9983
setWindowIcon:aForm in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9984
    "define a bitmap to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9985
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9986
    |iconId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9987
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9988
    aForm notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9989
	iconId := aForm id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9990
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9991
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9992
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  9993
     && __isExternalAddress(iconId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
  9994
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9995
	XWMHints hints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9996
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9997
	hints.icon_pixmap = _PixmapVal(iconId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
  9998
	hints.flags = IconPixmapHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
  9999
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10000
	XSetWMHints(myDpy, _WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10001
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10002
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10003
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10004
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10005
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10006
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10007
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 10008
setWindowIcon:aForm mask:aMaskForm in:aWindowId
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10009
    "define a windows icon and (optional) iconMask."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10010
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10011
    |iconId maskId|
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10012
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10013
    aForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10014
	iconId := aForm id
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10015
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10016
    aMaskForm notNil ifTrue:[
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10017
	maskId := aMaskForm id.
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10018
    ].
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10019
%{
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10020
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10021
     && __isExternalAddress(iconId)
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10022
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10023
	XWMHints hints;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10024
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10025
	hints.icon_pixmap = _PixmapVal(iconId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10026
	hints.flags = IconPixmapHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10027
	if ((maskId != nil)
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10028
	 && __isExternalAddress(maskId)) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10029
	    hints.icon_mask = _PixmapVal(maskId);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10030
	    hints.flags |= IconMaskHint;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10031
	}
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10032
	ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10033
	XSetWMHints(myDpy, _WindowVal(aWindowId), &hints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10034
	LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10035
	RETURN ( self );
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10036
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10037
%}.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10038
    self primitiveFailed
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10039
1376
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 10040
!
8b2ceb27230d prepare for iconMasks
Claus Gittinger <cg@exept.de>
parents: 1366
diff changeset
 10041
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10042
setWindowIconWindow:aView in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10043
    "define a window to be used as icon"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10044
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10045
    |iconWindowId|
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10046
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10047
    aView notNil ifTrue:[
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10048
	iconWindowId := aView id
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10049
    ].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10050
%{
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10051
    if (ISCONNECTED
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10052
     && __isExternalAddress(iconWindowId)
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10053
     && __isExternalAddress(aWindowId)) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10054
	XWMHints wmhints;
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10055
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10056
	wmhints.icon_window = _WindowVal(iconWindowId);
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10057
	wmhints.flags = IconWindowHint;
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10058
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10059
	XSetWMHints(myDpy, _WindowVal(aWindowId), &wmhints);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10060
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10061
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10062
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10063
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10064
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10065
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10066
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10067
setWindowMinExtent:minExt maxExtent:maxExt in:aWindowId
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10068
    "set a windows minimum & max extents.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10069
     nil arguments are ignored."
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10070
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10071
    |minW minH maxW maxH|
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10072
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10073
    minExt notNil ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10074
	minW := minExt x.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10075
	minH := minExt y.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10076
    ].
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10077
    maxExt notNil ifTrue:[
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10078
	maxW := maxExt x.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10079
	maxH := maxExt y.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10080
    ].
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10081
%{  
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10082
    if (ISCONNECTED
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10083
     && __isExternalAddress(aWindowId)) {
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10084
	Display *dpy = myDpy;
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10085
	XSizeHints szhints;
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10086
	Window win;
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10087
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10088
	win = _WindowVal(aWindowId);
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10089
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10090
	szhints.flags = 0;
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10091
	if (__bothSmallInteger(minW, minH)) {
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10092
	    szhints.flags |= PMinSize;
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10093
	    szhints.min_width = __intVal(minW);
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10094
	    szhints.min_height = __intVal(minH);
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10095
	}
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10096
	if (__bothSmallInteger(maxW, maxH)) {
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10097
	    szhints.flags |= PMaxSize;
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10098
	    szhints.max_width = __intVal(maxW);
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10099
	    szhints.max_height = __intVal(maxH);
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10100
	}
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10101
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10102
	if (szhints.flags) {
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10103
	    ENTER_XLIB();
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10104
	    XSetNormalHints(dpy, win, &szhints);
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10105
	    LEAVE_XLIB();
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10106
	}
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10107
    }
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10108
%}.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10109
!
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10110
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10111
setWindowName:aString in:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10112
    "define a windows name"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10113
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10114
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10115
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10116
    if (ISCONNECTED
2531
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10117
     && __isNonNilObject(aString)
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10118
     && (__qIsString(aString) || __qIsSymbol(aString))
e4d6bdae7bcf use quick-isString / isSymbol
Claus Gittinger <cg@exept.de>
parents: 2501
diff changeset
 10119
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10120
	ENTER_XLIB();
1831
8a03aa87a0ee casts to avoid warnings
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
 10121
	XStoreName(myDpy, _WindowVal(aWindowId), (char *) __stringVal(aString));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10122
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10123
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10124
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10125
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10126
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10127
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10128
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10129
setWindowShape:aPixmapId in:aWindowId
2647
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10130
    "set the windows shape.
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10131
     Returns false, if the display does not support the
3c65550477c0 allow change of minExtent/maxExtent
Claus Gittinger <cg@exept.de>
parents: 2635
diff changeset
 10132
     X shape extension."
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10133
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10134
    hasShapeExtension ifFalse:[^ self].
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10135
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10136
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10137
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10138
#ifdef SHAPE
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10139
    Pixmap shapeBitmap;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10140
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10141
    if (__isExternalAddress(aPixmapId))
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10142
	shapeBitmap = _PixmapVal(aPixmapId);
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10143
    else
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10144
	shapeBitmap = (Pixmap)0;
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10145
1207
274dbb13f15a always check if display connection is valid, before doing anything
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
 10146
    if (ISCONNECTED
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10147
     && __isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10148
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10149
	XShapeCombineMask(myDpy, _WindowVal(aWindowId), ShapeClip,
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10150
			  0, 0,
2758
329098f17dd9 allow for a shape to be unset
Claus Gittinger <cg@exept.de>
parents: 2748
diff changeset
 10151
			  shapeBitmap, ShapeSet);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10152
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10153
	RETURN ( self );
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10154
    }
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10155
#endif
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10156
%}.
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10157
    self primitiveFailed
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10158
!
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10159
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10160
unmapWindow:aWindowId
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10161
    "make a window invisible"
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10162
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10163
%{  /* NOCONTEXT */
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10164
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 10165
    if (!ISCONNECTED) {
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10166
	RETURN ( self );
1214
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 10167
    }
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 10168
e68cfc3ba4ce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1213
diff changeset
 10169
    if (__isExternalAddress(aWindowId)) {
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10170
	ENTER_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10171
	XUnmapWindow(myDpy, _WindowVal(aWindowId));
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10172
	LEAVE_XLIB();
1344
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10173
	RETURN ( self );
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10174
    }
f19217b30901 oops - corrupted
Claus Gittinger <cg@exept.de>
parents: 1341
diff changeset
 10175
%}.
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10176
    self primitiveFailed
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10177
!
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10178
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10179
windowIsIconified:aWindowId
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10180
    "return true, if some window is iconified.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10181
     The passed windowID may be an alien windows id."
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10182
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10183
%{  /* NOCONTEXT */
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10184
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10185
    if (ISCONNECTED
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10186
     && __isExternalAddress(aWindowId)) {
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10187
	Atom JunkAtom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10188
	int JunkInt;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10189
	unsigned long WinState,JunkLong;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10190
	unsigned char *Property;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10191
	Atom WM_STATE_Atom;
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10192
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10193
	if (__INST(wmStateAtom) != nil) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10194
	    WM_STATE_Atom = _AtomVal(__INST(wmStateAtom));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10195
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10196
	    ENTER_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10197
	    XGetWindowProperty(myDpy, _WindowVal(aWindowId),
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10198
			       WM_STATE_Atom,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10199
			       0L, 2L, False, AnyPropertyType,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10200
			       &JunkAtom,&JunkInt,&WinState,&JunkLong,
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10201
			       &Property);
1974
3a780312fa2e preps for timeout handling
Claus Gittinger <cg@exept.de>
parents: 1960
diff changeset
 10202
	    LEAVE_XLIB();
1579
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10203
	    WinState=(unsigned long)(*((long*)Property));
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10204
	    if (WinState==3) {
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10205
		RETURN (true);
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10206
	    }
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10207
	}
692c2f62d94e handle broken X-connection smoothly
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
 10208
	RETURN (false);
1535
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10209
    }
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10210
%}.
a347ad2379bc added isIconified query;
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
 10211
    self primitiveFailed
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10212
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10213
1171
a40ea3d796fd newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 1138
diff changeset
 10214
!XWorkstation class methodsFor:'documentation'!
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10215
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10216
version
3205
8648fa72c0af Fix error handling (#displayTimoutError)
Stefan Vogel <sv@exept.de>
parents: 3203
diff changeset
 10217
    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.347 2000-05-30 17:06:04 stefan Exp $'
295
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10218
! !
08cd959204c7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 291
diff changeset
 10219
XWorkstation initialize!